World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
IocContainer.cpp
См. документацию.
1 #include "Engine/IocContainer.h"
2 
3 #include "Arcomage/Arcomage.h"
4 
5 #include "Engine/Events.h"
6 #include "Engine/Events2D.h"
7 #include "Engine/LOD.h"
8 #include "Engine/MapsLongTimer.h"
9 #include "Engine/Party.h"
10 #include "Engine/SaveLoad.h"
11 #include "Engine/SpellFxRenderer.h"
12 #include "Engine/stru123.h"
13 
16 #include "Engine/Graphics/Indoor.h"
19 #include "Engine/Graphics/Lights.h"
24 #include "Engine/Graphics/Vis.h"
25 
27 
28 #include "Engine/Objects/Actor.h"
29 #include "Engine/Objects/Chest.h"
31 #include "Engine/Objects/NPC.h"
33 #include "Engine/Objects/Player.h"
34 
36 
40 
41 #include "IO/Mouse.h"
42 #include "IO/Keyboard.h"
43 
44 
46 
47 Log *logger = nullptr;
48 
49 
50 
51 Log *IocContainer::ResolveLogger() {
52  if (!logger) {
53  logger = new Log();
54  logger->Initialize();
55  logger->Info(L"World of Might and Magic build %S %S", __DATE__, __TIME__);
56  }
57  return logger;
58 }
59 
61  if (!decal_builder) {
63  }
64  return decal_builder;
65 }
66 
68  if (!bloodspalt_container) {
70  }
71  return bloodspalt_container;
72 }
73 
75  if (!spell_fx_renderer) {
77  }
78  return spell_fx_renderer;
79 }
80 
82  if (!lightmap_builder) {
84  }
85  return lightmap_builder;
86 }
87 
89  if (!mouse) {
90  mouse = new Mouse();
91  }
92  return mouse;
93 }
94 
97  if (!keyboard) {
98  keyboard = new Keyboard();
99  }
100  return keyboard;
101 }
102 
104  if (!particle_engine) {
106  }
107  return particle_engine;
108 }
109 
111  if (!vis) {
112  vis = new Vis();
113  }
114  return vis;
115 }
116 
121 Mouse *IocContainer::mouse = nullptr;
123 Vis *IocContainer::vis = nullptr;
124 
125 
126 
128  // ToDo(_): make platform independent
129  static_assert(sizeof(BLVSector) == 0x74, "Wrong type size");
130  static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size");
131  static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size");
132  static_assert(sizeof(Particle) == 0x68, "Wrong type size");
133  static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size");
134  static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size");
135  static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size");
136  // static_assert(sizeof(Vis) == 0x20D0, "Wrong type size");
137  static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size");
138  static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size");
139  static_assert(sizeof(IndoorCameraD3D_Vec4) == 0x18, "Wrong type size"); // should be 14 (10 vec3 + 4 vdtor) but 18 coz of
140  // his +4 from own vdtor, but it is odd since vdtor
141  // already present from vec3
142  static_assert(sizeof(NPCData) == 0x4C, "Wrong type size");
143  static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size");
144  static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size");
145  static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size");
146  static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size");
147  static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size");
148  static_assert(sizeof(_2devent) == 0x34, "Wrong type size");
149  static_assert(sizeof(StorylineText) == 0x160, "Wrong type size");
150  static_assert(sizeof(Decal) == 0xC20, "Wrong type size");
151  static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size");
152  static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size");
153  static_assert(sizeof(BLVSector) == 116, "Wrong type size");
154  static_assert(sizeof(Actor) == 836, "Wrong type size");
155 
156  // ToDo(_): move to usage place
157  static_assert(sizeof(OverlayDesc) == 8, "Wrong type size");
158  static_assert(sizeof(DecorationDesc) == 84, "Wrong type size");
159  static_assert(sizeof(PlayerFrame) == 10, "Wrong type size");
160  static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size");
161  static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size");
162  static_assert(sizeof(MonsterDesc) == 152, "Wrong type size");
163  static_assert(sizeof(Timer) == 0x28, "Wrong type size");
164  static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size");
165  static_assert(sizeof(ItemGen) == 0x24, "Wrong type size");
166  static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size");
167  static_assert(sizeof(Chest) == 0x14CC, "Wrong type size");
168  static_assert(sizeof(SpellData) == 0x14, "Wrong type size");
169  static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size");
170  static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size");
171  static_assert(sizeof(ActorJob) == 0xC, "Wrong type size");
172  static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size");
173  static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size");
174  static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size");
175  static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size");
176  static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size");
177  static_assert(sizeof(MobileLight) == 0x12, "Wrong type size");
178  static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size");
179  static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size");
180  static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size");
181  static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size");
182  static_assert(sizeof(EventIndex) == 0xC, "Wrong type size");
183  static_assert(sizeof(MapsLongTimer) == 0x20, "Wrong type size");
184  static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size");
185  static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size");
186  static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size");
187  static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size");
188  static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size");
189  static_assert(sizeof(LightsData) == 0x3FC, "Wrong type size");
190  static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size");
191  static_assert(sizeof(stru336) == 0x798, "Wrong type size");
192  static_assert(sizeof(Vec3_short_) == 6, "Wrong type size");
193  static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size");
194  static_assert(sizeof(LevelDecoration) == 32, "Wrong type size");
195  static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size");
196  static_assert(sizeof(BSPNode) == 8, "Wrong type size");
197  static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size");
198  static_assert(sizeof(SpriteObject) == 112, "Wrong type size");
199  static_assert(sizeof(Chest) == 5324, "Wrong type size");
200  static_assert(sizeof(stru123) == 0xC8, "Wrong type size");
201  static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size");
202 }
BspRenderer
Definition: Indoor.h:800
SpriteObject
Definition: SpriteObject.h:189
ParticleEngine.h
MobileLight
Definition: Lights.h:21
Engine_::IocContainer
Definition: IocContainer.h:15
IocContainer.h
PlayerFrame
Definition: PlayerFrameTable.h:7
Viewport.h
stru141_actor_collision_object
Definition: Indoor.h:148
BLVFaceExtra
Definition: Indoor.h:496
LOD.h
OverlayDesc
Definition: Overlays.h:44
DecorationList.h
Mouse
Definition: Mouse.h:279
PaletteManager
Definition: PaletteManager.h:7
CastSpellInfo
Definition: CastSpellInfo.h:17
Monsters.h
_2devent
Definition: Events2D.h:40
Engine_::IocContainer::vis
static Vis * vis
Definition: IocContainer.h:35
Engine_::IocContainer::ResolveBloodsplatContainer
static BloodsplatContainer * ResolveBloodsplatContainer()
Definition: IocContainer.cpp:67
SpellBuff
Definition: Spells.h:147
Engine_::IocContainer::mouse
static Mouse * mouse
Definition: IocContainer.h:32
Actor
Definition: Actor.h:151
Decal
Definition: DecalBuilder.h:98
ArcomageCard
Definition: Arcomage.h:9
TravelInfo
Definition: MM7.h:264
FactionTable.h
ProjectileAnim
Definition: SpellFxRenderer.h:73
MapsLongTimer.h
Overlays.h
PaletteManager.h
LightmapBuilder.h
PlayerFrameTable.h
IndoorCameraD3D_Vec4
Definition: IndoorCameraD3D.h:32
SpellFxRenderer.h
SpellData
Definition: Spells.h:206
Log
Definition: Log.h:3
MonsterDesc_mm6
Definition: Monsters.h:203
Lightmap
Definition: LightmapBuilder.h:12
BSPNode
Definition: BSPModel.h:42
StorylineText
Definition: StorylineTextTable.h:18
BLVMapOutline
Definition: Indoor.h:412
Chest.h
stru336
Definition: MM7.h:290
Lights.h
EventIndex
Definition: Events.h:6
AIDirection
Definition: Actor.h:126
ParticleEngine
Definition: ParticleEngine.h:93
NPC.h
Events.h
Actor.h
Engine_::IocContainer::bloodspalt_container
static BloodsplatContainer * bloodspalt_container
Definition: IocContainer.h:29
StationaryLight
Definition: Lights.h:10
Particle
Definition: ParticleEngine.h:40
Engine_::IocContainer::ResolveVis
static Vis * ResolveVis()
Definition: IocContainer.cpp:110
LightmapBuilder
Definition: LightmapBuilder.h:33
Engine_::IocContainer::ResolveParticleEngine
static ParticleEngine * ResolveParticleEngine()
Definition: IocContainer.cpp:103
IRender.h
Vis
Definition: Vis.h:69
OtherOverlay
Definition: Overlays.h:7
Log::Info
void Info(const wchar_t *pFormat,...)
Definition: Log.cpp:11
ViewingParams
Definition: Viewport.h:38
Log::Initialize
bool Initialize()
Definition: Log.cpp:9
IndoorCameraD3D_Vec3
Definition: IndoorCameraD3D.h:9
stru123.h
SaveLoad.h
BLVDoor
Definition: Indoor.h:378
MonsterStats
Definition: Monsters.h:186
Indoor.h
Engine_::IocContainer::ResolveDecalBuilder
static DecalBuilder * ResolveDecalBuilder()
Definition: IocContainer.cpp:60
stru123
Definition: stru123.h:6
Engine_::IocContainer::ResolveMouse
static Mouse * ResolveMouse()
Definition: IocContainer.cpp:88
Arcomage.h
Party.h
Particle_sw
Definition: ParticleEngine.h:18
FactionTable
Definition: FactionTable.h:5
IntegrityTest
void IntegrityTest()
Definition: IocContainer.cpp:127
Bloodsplat
Definition: DecalBuilder.h:13
DDM_DLV_Header
Definition: Indoor.h:82
NPCData
Definition: NPC.h:79
Events2D.h
LevelDecoration
Definition: Decoration.h:20
MonsterDesc
Definition: Monsters.h:213
PlayerBuffAnim
Definition: SpellFxRenderer.h:59
BloodsplatContainer
Definition: DecalBuilder.h:50
LightsData
Definition: Indoor.h:16
SpellFxRenderer
Definition: SpellFxRenderer.h:97
Player.h
Timer
Definition: Time.h:104
MapsLongTimer
Definition: MapsLongTimer.h:6
Engine_::IocContainer::spell_fx_renderer
static SpellFxRenderer * spell_fx_renderer
Definition: IocContainer.h:30
TrailParticle
Definition: ParticleEngine.h:116
Decoration.h
BLVLightMM7
Definition: Indoor.h:357
Engine_::IocContainer::keyboard
static Keyboard * keyboard
Definition: IocContainer.h:33
DecorationDesc
Definition: DecorationList.h:49
ActionQueue
Definition: Party.h:121
SavegameHeader
Definition: SaveLoad.h:18
PartyTimeStruct
Definition: Party.h:141
Chest
Definition: Chest.h:35
BLVSector
Definition: Indoor.h:522
ItemGen
Definition: Items.h:263
RenderVertexSoft
Definition: IRender.h:113
ObjectList.h
logger
Log * logger
Definition: IocContainer.cpp:47
Vis_SelectionList
Definition: Vis.h:42
Engine_::IocContainer::ResolveSpellFxRenderer
static SpellFxRenderer * ResolveSpellFxRenderer()
Definition: IocContainer.cpp:74
Engine_::IocContainer::ResolveLightmapBuilder
static LightmapBuilder * ResolveLightmapBuilder()
Definition: IocContainer.cpp:81
Engine_::IocContainer::lightmap_builder
static LightmapBuilder * lightmap_builder
Definition: IocContainer.h:31
MonsterInfo
Definition: Monsters.h:109
DecalBuilder.h
StorylineTextTable.h
Keyboard.h
Engine_::IocContainer::ResolveKeyboard
static Keyboard * ResolveKeyboard()
Definition: IocContainer.cpp:96
Engine_::IocContainer::particle_engine
static ParticleEngine * particle_engine
Definition: IocContainer.h:34
Engine_::IocContainer::decal_builder
static DecalBuilder * decal_builder
Definition: IocContainer.h:28
Keyboard
Definition: Keyboard.h:76
Mouse.h
CastSpellInfo.h
DecalBuilder
Definition: DecalBuilder.h:123
ActorJob
Definition: Actor.h:137
Vis.h
NPCStats
Definition: NPC.h:146