Isle
Loading...
Searching...
No Matches
legomain.cpp
Go to the documentation of this file.
1#include "legomain.h"
2
4#include "islepathactor.h"
8#include "legogamestate.h"
9#include "legoinputmanager.h"
10#include "legoobjectfactory.h"
11#include "legoplantmanager.h"
12#include "legosoundmanager.h"
13#include "legoutils.h"
14#include "legovariables.h"
15#include "legovideomanager.h"
16#include "legoworld.h"
17#include "legoworldlist.h"
18#include "misc.h"
19#include "misc/legocontainer.h"
21#include "mxautolock.h"
23#include "mxdisplaysurface.h"
24#include "mxmisc.h"
26#include "mxomnicreateflags.h"
27#include "mxomnicreateparam.h"
28#include "mxstreamer.h"
29#include "mxticklemanager.h"
30#include "mxtransitionmanager.h"
31#include "mxvariabletable.h"
32#include "scripts.h"
34
36DECOMP_SIZE_ASSERT(LegoOmni::WorldContainer, 0x1c)
39
40// GLOBAL: LEGO1 0x100f6718
41// STRING: LEGO1 0x100f6710
42const char* g_current = "current";
43
44// FUNCTION: LEGO1 0x10058a00
46{
47 Init();
48}
49
50// FUNCTION: LEGO1 0x10058b50
52{
53 Destroy();
54}
55
56// FUNCTION: LEGO1 0x10058bd0
58{
60 m_worlds = NULL;
61 m_inputManager = NULL;
62 m_viewLODListManager = NULL;
63 m_textureContainer = NULL;
64 m_worldList = NULL;
65 m_currentWorld = NULL;
66 m_exit = FALSE;
67 m_userActor = NULL;
68 m_characterManager = NULL;
69 m_plantManager = NULL;
70 m_gameState = NULL;
71 m_animationManager = NULL;
72 m_buildingManager = NULL;
73 m_bkgAudioManager = NULL;
75 m_transitionManager = NULL;
76}
77
78// FUNCTION: LEGO1 0x10058c30
80{
82
84
85 if (m_worldList) {
86 delete m_worldList;
87 m_worldList = NULL;
88 }
89
90 if (m_gameState) {
91 delete m_gameState;
92 m_gameState = NULL;
93 }
94
95 if (m_animationManager) {
96 delete m_animationManager;
97 m_animationManager = NULL;
98 }
99
100 if (m_characterManager) {
101 delete m_characterManager;
102 m_characterManager = NULL;
103 }
104
105 if (m_plantManager) {
106 delete m_plantManager;
107 m_plantManager = NULL;
108 }
109
110 if (m_buildingManager) {
111 delete m_buildingManager;
112 m_buildingManager = NULL;
113 }
114
115 if (m_textureContainer) {
116 m_textureContainer->Clear();
117 delete m_textureContainer;
118 m_textureContainer = NULL;
119 }
120
121 if (m_viewLODListManager) {
122 delete m_viewLODListManager;
123 m_viewLODListManager = NULL;
124 }
125
126 if (m_inputManager) {
127 delete m_inputManager;
128 m_inputManager = NULL;
129 }
130
132
133 if (m_bkgAudioManager) {
134 m_bkgAudioManager->Stop();
135 delete m_bkgAudioManager;
136 m_bkgAudioManager = NULL;
137 }
138
139 if (m_transitionManager) {
140 delete m_transitionManager;
141 m_transitionManager = NULL;
142 }
143
144 m_action.ClearAtom();
146
147 if (m_worlds) {
148 delete[] m_worlds;
149 }
150
152}
153
154// FUNCTION: LEGO1 0x10058e70
155// FUNCTION: BETA10 0x1008d6bf
157{
158 MxResult result = FAILURE;
160
165
166 if (!(m_tickleManager = new MxTickleManager())) {
167 goto done;
168 }
169
170 if (MxOmni::Create(p_param) != SUCCESS) {
171 goto done;
172 }
173
174 if (!(m_objectFactory = new LegoObjectFactory())) {
175 goto done;
176 }
177
178 if (!(m_soundManager = new LegoSoundManager()) || m_soundManager->Create(10, 0) != SUCCESS) {
179 delete m_soundManager;
181 goto done;
182 }
183
184 if (!(m_videoManager = new LegoVideoManager()) ||
185 m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) {
186 delete m_videoManager;
188 goto done;
189 }
190
191 if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(p_param.GetWindowHandle()) != SUCCESS) {
192 delete m_inputManager;
193 m_inputManager = NULL;
194 goto done;
195 }
196
197 m_viewLODListManager = new ViewLODListManager();
198 m_textureContainer = new LegoTextureContainer();
199 m_textureContainer->SetOwnership(FALSE);
201
202 m_characterManager = new LegoCharacterManager();
203 m_plantManager = new LegoPlantManager();
204 m_animationManager = new LegoAnimationManager();
205 m_buildingManager = new LegoBuildingManager();
206 m_gameState = new LegoGameState();
207 m_worldList = new LegoWorldList(TRUE);
208
209 if (!m_viewLODListManager || !m_textureContainer || !m_worldList || !m_characterManager || !m_plantManager ||
210 !m_animationManager || !m_buildingManager) {
211 goto done;
212 }
213
214 MxVariable* variable;
215
216 if (!(variable = new VisibilityVariable())) {
217 goto done;
218 }
219 m_variableTable->SetVariable(variable);
220
221 if (!(variable = new CameraLocationVariable())) {
222 goto done;
223 }
224 m_variableTable->SetVariable(variable);
225
226 if (!(variable = new CursorVariable())) {
227 goto done;
228 }
229 m_variableTable->SetVariable(variable);
230
231 if (!(variable = new WhoAmIVariable())) {
232 goto done;
233 }
234 m_variableTable->SetVariable(variable);
235
238 result = RegisterWorlds();
239
240 if (result != SUCCESS) {
241 goto done;
242 }
243
244 if (!(m_bkgAudioManager = new MxBackgroundAudioManager())) {
245 goto done;
246 }
247
248 if (!(m_transitionManager = new MxTransitionManager())) {
249 goto done;
250 }
251
252 if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) {
253 goto done;
254 }
255
259
260 result = SUCCESS;
261
262done:
263 return result;
264}
265
266// FUNCTION: LEGO1 0x1005a5f0
268{
269 m_worlds = new WorldContainer[e_numWorlds];
270
271 if (!m_worlds) {
272 return FAILURE;
273 }
274
275 m_worlds[0] = WorldContainer();
276 m_worlds[1] = WorldContainer(e_act1, "ACT1", g_isleScript);
277 m_worlds[2] = WorldContainer(e_imain, "IMAIN", g_infomainScript);
278 m_worlds[3] = WorldContainer(e_icube, "ICUBE", g_infoscorScript);
279 m_worlds[4] = WorldContainer(e_ireg, "IREG", g_regbookScript);
280 m_worlds[5] = WorldContainer(e_ielev, "IELEV", g_elevbottScript);
281 m_worlds[6] = WorldContainer(e_iisle, "IISLE", g_infodoorScript);
282 m_worlds[7] = WorldContainer(e_hosp, "HOSP", g_hospitalScript);
283 m_worlds[8] = WorldContainer(e_police, "POLICE", g_policeScript);
284 m_worlds[9] = WorldContainer(e_gmain, "GMAIN", g_garageScript);
285 m_worlds[10] = WorldContainer(e_bldh, "BLDH", g_copterScript);
286 m_worlds[11] = WorldContainer(e_bldd, "BLDD", g_dunecarScript);
287 m_worlds[12] = WorldContainer(e_bldj, "BLDJ", g_jetskiScript);
288 m_worlds[13] = WorldContainer(e_bldr, "BLDR", g_racecarScript);
289 m_worlds[14] = WorldContainer(e_racc, "RACC", g_carraceScript);
290 m_worlds[15] = WorldContainer(e_racj, "RACJ", g_jetraceScript);
291 m_worlds[16] = WorldContainer(e_act2, "ACT2", g_act2mainScript);
292 m_worlds[17] = WorldContainer(e_act3, "ACT3", g_act3Script);
293 m_worlds[18] = WorldContainer(e_test, "TEST", g_testScript);
294 return SUCCESS;
295}
296
297// FUNCTION: LEGO1 0x1005ac90
299{
302}
303
304// FUNCTION: LEGO1 0x1005ad10
306{
307 return (LegoOmni*) MxOmni::GetInstance();
308}
309
310// FUNCTION: LEGO1 0x1005ad20
312{
313 m_worldList->Append(p_world);
314}
315
316// FUNCTION: LEGO1 0x1005adb0
318{
319 if (m_worldList) {
320 LegoWorldListCursor cursor(m_worldList);
321
322 if (cursor.Find(p_world)) {
323 cursor.Detach();
324
325 if (m_currentWorld == p_world) {
326 m_currentWorld = NULL;
327 }
328
329 delete p_world;
330 }
331 }
332}
333
334// FUNCTION: LEGO1 0x1005af10
335void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId)
336{
337 if (m_worldList) {
338 LegoWorldListCursor a(m_worldList);
339 LegoWorldListCursor b(m_worldList);
340 LegoWorld* world;
341
342 a.Head();
343 while (a.Current(world)) {
344 b = a;
345 b.Next();
346
347 if ((p_objectId == -1 || world->GetEntityId() == p_objectId) &&
348 (!p_atom.GetInternal() || world->GetAtomId() == p_atom)) {
349 a.Detach();
350 delete world;
351 }
352
353 a = b;
354 }
355 }
356}
357
358// FUNCTION: LEGO1 0x1005b0c0
359// FUNCTION: BETA10 0x1008e827
360LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
361{
362 if (m_worldList) {
363 LegoWorldListCursor cursor(m_worldList);
364 LegoWorld* world;
365
366 while (cursor.Next(world)) {
367 if ((p_entityid == -1 || world->GetEntityId() == p_entityid) &&
368 (!p_atom.GetInternal() || world->GetAtomId() == p_atom)) {
369 return world;
370 }
371 }
372 }
373
374 return NULL;
375}
376
377// FUNCTION: LEGO1 0x1005b1d0
379{
380 if (p_dsAction.GetAtomId().GetInternal() != NULL) {
381 LegoWorld* world = FindWorld(p_dsAction.GetAtomId(), p_dsAction.GetObjectId());
382 if (world) {
383 DeleteWorld(world);
384 return;
385 }
386
387 if (m_currentWorld != NULL) {
388 MxCore* entity = m_currentWorld->Find(p_dsAction.GetAtomId(), p_dsAction.GetObjectId());
389 if (entity) {
390 m_currentWorld->Remove(entity);
391
392 if (entity->IsA("MxPresenter")) {
393 Streamer()->FUN_100b98f0(((MxPresenter*) entity)->GetAction());
394 ((MxPresenter*) entity)->EndAction();
395 }
396 else {
397 delete entity;
398 }
399 return;
400 }
401 }
402 }
403 MxOmni::DeleteObject(p_dsAction);
404}
405
406// FUNCTION: LEGO1 0x1005b270
407// FUNCTION: BETA10 0x1008ea6d
408LegoROI* LegoOmni::FindROI(const char* p_name)
409{
410 const CompoundObject& rois =
411 ((LegoVideoManager*) m_videoManager)->Get3DManager()->GetLego3DView()->GetViewManager()->GetROIs();
412
413 if (p_name != NULL && *p_name != '\0' && rois.size() > 0) {
414 for (CompoundObject::const_iterator it = rois.begin(); it != rois.end(); it++) {
415 LegoROI* roi = (LegoROI*) *it;
416 const char* name = roi->GetName();
417
418 if (name != NULL) {
419 if (!strcmpi(name, p_name)) {
420 return roi;
421 }
422 }
423 }
424 }
425
426 return NULL;
427}
428
429// FUNCTION: LEGO1 0x1005b2f0
430MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter)
431{
432 LegoWorld* world = NULL;
433
434 if (strcmpi(p_id, g_current)) {
435 world = FindWorld(MxAtomId(p_id, e_lowerCase2), p_entityId);
436 }
437 else {
438 world = this->m_currentWorld;
439 }
440
441 if (world != NULL) {
442 world->Add(p_presenter);
443 }
444
445 return world;
446}
447
448// FUNCTION: LEGO1 0x1005b3a0
450{
451 if (m_currentWorld) {
452 NotificationManager()->Send(m_currentWorld, p_param);
453 }
454}
455
456// FUNCTION: LEGO1 0x1005b3c0
458{
459 if (MxOmni::DoesEntityExist(p_dsAction)) {
460 if (FindWorld(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()) == NULL) {
461 return TRUE;
462 }
463 }
464 return FALSE;
465}
466
467// FUNCTION: LEGO1 0x1005b400
469{
470 if (::CurrentWorld() == NULL) {
471 return FAILURE;
472 }
473
474 return ::CurrentWorld()->GetCurrPathInfo(p_path, p_value);
475}
476
477// FUNCTION: LEGO1 0x1005b430
479{
480 for (MxS32 i = 0; i < e_numWorlds; i++) {
481 if (m_worlds[i].m_id == p_worldId) {
482 return m_worlds[i].m_key;
483 }
484 }
485
486 return NULL;
487}
488
489// FUNCTION: LEGO1 0x1005b460
490// FUNCTION: BETA10 0x1008edd8
492{
493 for (MxS32 i = 0; i < e_numWorlds; i++) {
494 if (m_worlds[i].m_id == p_worldId) {
495 return m_worlds[i].m_atomId;
496 }
497 }
498
499 // A gem from BETA10
500 assert("Hey, check your code. We do not have this world." == NULL);
501 return NULL;
502}
503
504// FUNCTION: LEGO1 0x1005b490
506{
507 for (MxS32 i = 0; i < e_numWorlds; i++) {
508 if ((MxS32) &m_worlds[i] != -4 && !strcmpi(m_worlds[i].GetKey(), p_key)) {
509 return m_worlds[i].GetId();
510 }
511 }
512
513 return e_undefined;
514}
515
516// FUNCTION: LEGO1 0x1005b4f0
517void LegoOmni::FUN_1005b4f0(MxBool p_disable, MxU16 p_flags)
518{
519 if (p_disable) {
520 if (p_flags & c_disableInput) {
521 m_inputManager->DisableInputProcessing();
522 }
523
524 if (p_flags & c_disable3d) {
525 ((LegoVideoManager*) m_videoManager)->SetRender3D(FALSE);
526 }
527
528 if (p_flags & c_clearScreen) {
530 }
531 }
532 else {
533 m_inputManager->EnableInputProcessing();
534 ((LegoVideoManager*) m_videoManager)->SetRender3D(TRUE);
535 ((LegoVideoManager*) m_videoManager)->UpdateView(0, 0, 0, 0);
536 }
537}
538
539// FUNCTION: LEGO1 0x1005b560
541{
542 if (m_bkgAudioManager) {
543 m_bkgAudioManager->Create(*g_jukeboxScript, 100);
544 }
545}
546
547// FUNCTION: LEGO1 0x1005b580
549{
550 MxResult result = MxOmni::Start(p_dsAction);
551 this->m_action.SetAtomId(p_dsAction->GetAtomId());
552 this->m_action.SetObjectId(p_dsAction->GetObjectId());
553 this->m_action.SetUnknown24(p_dsAction->GetUnknown24());
554 return result;
555}
556
557// FUNCTION: LEGO1 0x1005b5c0
559{
560 if (m_action.GetObjectId() != -1) {
561 DeleteObject(m_action);
562 m_action.SetObjectId(-1);
563 }
564}
565
566// FUNCTION: LEGO1 0x1005b5f0
568{
569 MxBool isCD = FALSE;
570
571 if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAction &&
572 ((MxActionNotificationParam&) p_param).GetAction()->GetAtomId() == *g_nocdSourceName) {
573 isCD = TRUE;
574 }
575
576 MxLong result = MxOmni::Notify(p_param);
577 if (isCD) {
578 // Exit the game if nocd.si ended
580 }
581
582 return result;
583}
584
585// FUNCTION: LEGO1 0x1005b640
587{
590}
591
592// FUNCTION: LEGO1 0x1005b650
594{
597}
[AI] Variable for updating camera location and POV (field of view/frustum settings) for navigation an...
Definition: legovariables.h:81
[AI] Variable to represent game cursor (pointer) state.
Definition: legovariables.h:96
static void RegisterSpawnLocations()
[AI] Static: Registers all known player spawn locations into the global location table.
[AI] Animation manager handling all world and character animation state, loading, and logic for extra...
[AI] Manages LEGO buildings in the world, including their state, animation, switching,...
[AI] Manages reference-counted characters and provides character creation, switching,...
void SetOwnership(LegoBool p_ownership)
Set whether this container owns/deletes its objects (and name strings) on removal/destruction.
void Clear()
Remove and delete all mapped objects; preserves key strings.
Definition: legocontainer.h:74
Comprehensive persistent game state manager: handles save/load, player selection, area switching,...
Definition: legogamestate.h:78
void SetCurrentAct(Act p_currentAct)
Sets the current game act.
@ e_act1
Act 1: the first main segment of the game. [AI].
Definition: legogamestate.h:84
[AI] Handles keyboard, mouse, and joystick input for the game.
MxResult Create(HWND p_hwnd)
[AI] Set up DirectInput and joystick state, instantiate controller and notification list.
void EnableInputProcessing()
[AI] Enable event queue and input event processing. Resets relevant state. [AI]
void DisableInputProcessing()
[AI] Block most input processing, allowing only button-down and space events (UI modal input blocking...
[AI] Object factory for the LEGO Island game, responsible for instantiating all game-specific entitie...
[AI] Central hub singleton for the LEGO Island game engine, managing all core game systems,...
Definition: legomain.h:40
void CloseMainWindow()
[AI] Posts a close (exit) message to the main window handle, triggering shutdown.
Definition: legomain.h:479
MxResult Start(MxDSAction *p_dsAction) override
[AI] Begins executing the specified DSAction/script in the context of the current world/state.
Definition: legomain.cpp:548
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags)
[AI] Enables or disables input/3d/screen clearing in a single call, based on flags.
Definition: legomain.cpp:517
void Resume() override
[AI] Resumes engine/game state and sets default cursor.
Definition: legomain.cpp:593
static LegoOmni * GetInstance()
[AI] Returns the current LegoOmni singleton pointer, cast from MxOmni.
Definition: legomain.cpp:305
MxResult RegisterWorlds()
[AI] Registers all builtin worlds/scripts into the world's Atom/registry list (m_worlds).
Definition: legomain.cpp:267
void RemoveWorld(const MxAtomId &p_atom, MxLong p_objectId)
[AI] Removes worlds by Atom and/or id, deleting matching entries from the world list and freeing reso...
Definition: legomain.cpp:335
void AddWorld(LegoWorld *p_world)
[AI] Appends a LegoWorld to the active world list, acquiring ownership.
Definition: legomain.cpp:311
@ c_clearScreen
[AI] When set, clears the display surface. [AI]
Definition: legomain.h:49
@ c_disable3d
[AI] When set, disables 3D rendering. [AI]
Definition: legomain.h:48
@ c_disableInput
[AI] When set, disables input processing. [AI]
Definition: legomain.h:47
LegoWorld * FindWorld(const MxAtomId &p_atom, MxS32 p_entityid)
[AI] Finds and returns the LegoWorld by AtomId and/or entity id.
Definition: legomain.cpp:360
World
[AI] Identifiers for all unique, script-driven world environments in LEGO Island.
Definition: legomain.h:57
@ e_numWorlds
[AI] Number of worlds (includes undefined, test, or unused). [AI]
Definition: legomain.h:77
@ e_act3
[AI] Act 3. [AI]
Definition: legomain.h:75
@ e_racj
[AI] Jet race area/world. [AI]
Definition: legomain.h:73
@ e_act2
[AI] Act 2. [AI]
Definition: legomain.h:74
@ e_racc
[AI] Car race area/world. [AI]
Definition: legomain.h:72
@ e_bldr
[AI] Race car building. [AI]
Definition: legomain.h:71
@ e_icube
[AI] Information cube building. [AI]
Definition: legomain.h:61
@ e_ireg
[AI] Information registration/building. [AI]
Definition: legomain.h:62
@ e_bldh
[AI] Helicopter building. [AI]
Definition: legomain.h:68
@ e_ielev
[AI] Information elevator. [AI]
Definition: legomain.h:63
@ e_test
[AI] Test world. [AI]
Definition: legomain.h:76
@ e_bldd
[AI] Dune car building. [AI]
Definition: legomain.h:69
@ e_gmain
[AI] Garage. [AI]
Definition: legomain.h:67
@ e_police
[AI] Police station. [AI]
Definition: legomain.h:66
@ e_bldj
[AI] Jet ski building. [AI]
Definition: legomain.h:70
@ e_iisle
[AI] Information Isle room. [AI]
Definition: legomain.h:64
@ e_undefined
[AI] No world specified. [AI]
Definition: legomain.h:58
@ e_imain
[AI] Information main building. [AI]
Definition: legomain.h:60
@ e_hosp
[AI] Hospital. [AI]
Definition: legomain.h:65
@ e_act1
[AI] Act 1 main world. [AI]
Definition: legomain.h:59
LegoROI * FindROI(const char *p_name)
[AI] Finds a top-level LegoROI (region of interest/3D object) by name string.
Definition: legomain.cpp:408
MxAtomId * GetWorldAtom(LegoOmni::World p_id)
[AI] Looks up and returns the AtomId of a world by its enum id.
Definition: legomain.cpp:491
void NotifyCurrentEntity(const MxNotificationParam &p_param) override
[AI] Sends notification to the currently active world.
Definition: legomain.cpp:449
void DeleteWorld(LegoWorld *p_world)
[AI] Deletes (and removes from registry) a LegoWorld, deleting all resources.
Definition: legomain.cpp:317
static void CreateInstance()
[AI] Allocates and sets up a new LegoOmni singleton instance, replacing the previous one if any.
Definition: legomain.cpp:298
MxLong Notify(MxParam &p_param) override
[AI] Handles notification messages sent to the engine, including EndAction notifications for quitting...
Definition: legomain.cpp:567
static MxS32 GetCurrPathInfo(LegoPathBoundary **, MxS32 &)
[AI] Static utility for retrieving current path boundary and info from the current world.
Definition: legomain.cpp:468
void Destroy() override
[AI] Shuts down and deletes all owned game managers, variable tables, registry lists and Lego subsyst...
Definition: legomain.cpp:79
MxBool m_unk0x13c
[AI] Unknown flag used in rare start-action cases. [AI]
Definition: legomain.h:504
World GetWorldId(const char *p_key)
[AI] Looks up a World enum id from its string key.
Definition: legomain.cpp:505
void CreateBackgroundAudio()
[AI] Initializes background audio manager and starts music using global script.
Definition: legomain.cpp:540
~LegoOmni() override
[AI] Tears down LegoOmni, deleting or unregistering all major owned game systems and registry lists.
Definition: legomain.cpp:51
LegoOmni()
[AI] Constructs the LegoOmni singleton and initializes all internal pointers to NULL/default state.
Definition: legomain.cpp:45
void DeleteAction()
[AI] Deletes and clears the current DSAction used for world/entity tracking.
Definition: legomain.cpp:558
void Pause() override
[AI] Pauses the engine/game state and sets busy cursor.
Definition: legomain.cpp:586
MxResult Create(MxOmniCreateParam &p_param) override
[AI] Creates and initializes all subsystems for the game, wiring up all managers and attaching Lego-s...
Definition: legomain.cpp:156
void Init() override
[AI] Performs LegoOmni member and subsystem initialization.
Definition: legomain.cpp:57
MxBool DoesEntityExist(MxDSAction &p_dsAction) override
[AI] Checks if the entity described by the DSAction does NOT exist in worlds (true if not found,...
Definition: legomain.cpp:457
const char * GetWorldName(LegoOmni::World p_id)
[AI] Looks up and returns the registered world key for a world id.
Definition: legomain.cpp:478
MxEntity * AddToWorld(const char *p_id, MxS32 p_entityId, MxPresenter *p_presenter) override
[AI] Adds an entity presenter to the specified world (by id or current).
Definition: legomain.cpp:430
void DeleteObject(MxDSAction &p_dsAction) override
[AI] Deletes an entity or world referenced by the given DSAction (by object and Atom),...
Definition: legomain.cpp:378
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
static MxResult Init()
[AI] Static initializer for global controller boundary/edge arrays.
static MxResult Reset()
[AI] Resets (cleans up) global controller boundary/edge arrays allocated by Init().
[AI] Manages the lifecycle, state, and properties for all plant objects (flowers, trees,...
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
[AI] Manages 3D sound effects and music playback for LEGO Island, integrating with DirectSound and pr...
Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching.
[AI] Extends the functionality of MxVideoManager to provide LEGO Island–specific video and 3D graphic...
Provides iteration access to a LegoWorldList.
Definition: legoworldlist.h:33
A specialized list for managing pointers to LegoWorld instances.
Definition: legoworldlist.h:13
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
void Remove(MxCore *p_object)
Removes an object from all relevant world-managed lists or sets, and also detaches if needed.
Definition: legoworld.cpp:508
virtual void Add(MxCore *p_object)
Adds an object (entity, presenter, ROI, etc.) to the appropriate world-managed list or set.
Definition: legoworld.cpp:418
MxCore * Find(const char *p_class, const char *p_name)
Finds an object of a given class and name in the world.
Definition: legoworld.cpp:573
[AI] Notification parameter class that contains information about an MxDSAction, used for inter-objec...
[AI] Atomized (unique) string identifier, managed by reference counting.
Definition: mxatom.h:124
const char * GetInternal() const
[AI] Returns a pointer to the internal string, or nullptr if not set.
Definition: mxatom.h:194
[AI] Background music manager that handles playback, volume, state transitions, and notifications for...
void Stop()
[AI] Immediately stops all background music, clears all actions and presenters, and resets tickle sta...
virtual MxResult Create(MxAtomId &p_script, MxU32 p_frequencyMS)
[AI] Opens the music script (SI file) for streaming and registers this background audio manager as a ...
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
virtual MxBool IsA(const char *p_name) const
[AI] Checks whether this object's class type or parents match the given name.
Definition: mxcore.h:46
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
const MxAtomId & GetAtomId()
[AI] Returns a const-reference to the object's atom identifier.
Definition: mxdsobject.h:133
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
Definition: mxdsobject.h:118
void SetUnknown24(MxS16 p_unk0x24)
[AI] Sets the unknown field at 0x24 (possibly version/state).
Definition: mxdsobject.h:151
void ClearAtom()
[AI] Clears the atom id, releasing its association.
Definition: mxdsobject.h:158
MxS16 GetUnknown24()
[AI] Returns the unknown 0x24 value (may be data version or usage state). [AI]
Definition: mxdsobject.h:136
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
Definition: mxdsobject.h:147
MxU32 GetObjectId()
[AI] Returns the object id numeric value.
Definition: mxdsobject.h:130
void ClearScreen()
[AI] Fills the current back buffer with black (clears the display area). [AI]
MxEntity is a base class for game entities which are uniquely identified by an integer ID and an Atom...
Definition: mxentity.h:22
MxAtomId & GetAtomId()
Returns a reference to the entity AtomId.
Definition: mxentity.h:98
MxS32 GetEntityId()
Returns the current entity ID.
Definition: mxentity.h:93
MxBool Next()
[AI]
MxBool Head()
[AI]
Definition: mxlist.h:252
void Detach()
[AI]
MxBool Current(T &p_obj)
[AI]
MxBool Find(T p_obj)
[AI]
void Append(T p_obj)
[AI]
Definition: mxlist.h:100
void Unregister(MxCore *p_listener)
[AI] Removes a previously registered listener and flushes any pending notifications for it.
void Register(MxCore *p_listener)
[AI] Registers a listener object to receive notifications.
MxResult Send(MxCore *p_listener, const MxNotificationParam &p_param)
[AI] Queues a notification to be sent to a specific registered listener.
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
void CreateTickleManager(MxBool p_enable)
[AI] Enables or disables the creation of the Tickle Manager subsystem at startup.
void CreateSoundManager(MxBool p_enable)
[AI] Enables or disables the creation of the Sound Manager subsystem at startup.
void CreateVideoManager(MxBool p_enable)
[AI] Enables or disables the creation of the Video Manager subsystem at startup.
void CreateObjectFactory(MxBool p_enable)
[AI] Enables or disables the creation of the Object Factory subsystem at startup.
[AI] Encapsulates parameters required to initialize the core Omni engine.
MxOmniCreateFlags & CreateFlags()
[AI] Access/modify the creation flags.
MxVideoParam & GetVideoParam()
[AI] Access the detailed video parameter structure (for modification).
const HWND GetWindowHandle() const
[AI] Returns the handle to the rendering window.
virtual void Destroy()
[AI] Tears down all engine subsystems, deletes and frees all managed memory.
Definition: mxomni.cpp:182
MxSoundManager * m_soundManager
[AI] Manages sound (WAV, MIDI) output and channels.
Definition: mxomni.h:314
virtual MxResult Create(MxOmniCreateParam &p_param)
[AI] Allocates and configures engine subsystems, depending on the provided flags in MxOmniCreateParam...
Definition: mxomni.cpp:82
MxVideoManager * m_videoManager
[AI] Manager for decoding and rendering video resources (FLC, etc.).
Definition: mxomni.h:309
static void DestroyInstance()
[AI] Destroys the singleton MxOmni instance and performs memory cleanup.
Definition: mxomni.cpp:295
MxLong Notify(MxParam &p_param) override
[AI] Handles global notifications.
Definition: mxomni.cpp:325
MxNotificationManager * m_notificationManager
[AI] Manages notifications and their distribution to interested clients.
Definition: mxomni.h:304
virtual MxResult Start(MxDSAction *p_dsAction)
[AI] Requests the start of a top-level scripted action (from SI).
Definition: mxomni.cpp:226
MxVariableTable * m_variableTable
[AI] Variable table for scripting/in-engine variable storage.
Definition: mxomni.h:294
static MxOmni * GetInstance()
[AI] Returns the singleton instance of the MxOmni subsystem coordinator.
Definition: mxomni.cpp:289
MxObjectFactory * m_objectFactory
[AI] Factory object used to instantiate engine objects (presenters, entities) by class name.
Definition: mxomni.h:289
virtual void Resume()
[AI] Resumes paused subsystems (timer, sound manager) and clears paused state.
Definition: mxomni.cpp:422
virtual void Init()
[AI] Resets all internal pointers to defaults.
Definition: mxomni.cpp:57
virtual void DeleteObject(MxDSAction &p_dsAction)
[AI] Deletes a world or subsystem object corresponding to an action.
Definition: mxomni.cpp:237
static void SetInstance(MxOmni *p_instance)
[AI] Manually set the static instance of the global engine object.
Definition: mxomni.cpp:75
virtual MxBool DoesEntityExist(MxDSAction &p_dsAction)
[AI] Checks whether an entity (gameplay object) exists by querying the streamer and notification mana...
Definition: mxomni.cpp:399
MxCriticalSection m_criticalSection
[AI] Critical section used for thread-safe engine operations.
Definition: mxomni.h:344
virtual void Pause()
[AI] Pauses subsystems that support pausing (timer, sound manager) and sets paused state.
Definition: mxomni.cpp:412
MxTickleManager * m_tickleManager
[AI] Manages list of objects requiring tickle updates each frame/step.
Definition: mxomni.h:299
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
[AI] Abstract base class for all presenter types in the LEGO Island engine, responsible for managing ...
Definition: mxpresenter.h:20
virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread)
[AI] Initializes and sets up the DirectSound environment.
void FUN_100b98f0(MxDSAction *p_action)
Internal: Delegate stream operation on MxDSAction to a DiskStreamController if present.
Definition: mxstreamer.cpp:144
[AI] Manages ticking ("tickling") a set of MxCore objects at specified intervals.
[AI] Handles screen transitions and animations (such as dissolve, mosaic, wipe, etc....
virtual MxResult GetDDrawSurfaceFromVideoManager()
[AI] Retrieves the primary DirectDraw surface to render transitions onto, querying via the video mana...
void SetVariable(const char *p_key, const char *p_value)
Sets a variable by key and value, replacing or updating if it exists.
[AI] Represents a key-value variable as used in the variable table for the LEGO Island engine.
Definition: mxvariable.h:16
virtual MxResult Create(MxVideoParam &p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
[AI] Similar to VTable0x28, this launches video with a new DirectDraw instance.
MxDisplaySurface * GetDisplaySurface()
[AI] Returns the display surface used for video output; for direct drawing and palette operations.
[AI] Manages the lifecycle, lookup, and sharing of ViewLODList instances for different ROI names.
Definition: viewlodlist.h:111
[AI] Variable to trigger show/hide operations on in-game 3D objects (ROIs) by parsing visibility comm...
Definition: legovariables.h:66
[AI] Variable representing the current player's character, allowing the game to switch the active act...
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
const char * g_current
Definition: legomain.cpp:42
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
void SetAppCursor(Cursor p_cursor)
[AI] Sets the in-game cursor to a specified type.
Definition: legoutils.cpp:566
@ e_cursorBusy
[AI] Busy or loading cursor (e.g., hourglass). [AI]
Definition: legoutils.h:24
@ e_cursorArrow
[AI] Standard arrow cursor. [AI]
Definition: legoutils.h:23
@ e_cursorNo
[AI] 'Not allowed' cursor. [AI]
Definition: legoutils.h:25
MxAtomId * g_isleScript
[AI] Node used in hierarchical scene graphs and animation trees. [AI]
Definition: scripts.cpp:32
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
Definition: misc.cpp:93
@ e_lowerCase2
[AI] Alternative or legacy lower case mode, functionally equivalent to e_lowerCase.
Definition: mxatom.h:109
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
Definition: mxautolock.h:5
MxStreamer * Streamer()
[AI] Returns the global streamer used for all chunked media streaming (SI file, audio,...
Definition: mxmisc.cpp:49
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
@ c_notificationEndAction
[AI] Indicates the end of an action [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
list< ROI * > CompoundObject
Definition: roi.h:135
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_infoscorScript
[AI] Script AtomId for the Info Center scoring/stat script.
Definition: scripts.cpp:45
MxAtomId * g_act3Script
[AI] Script AtomId for Act 3 (endgame/helicopter chase) scripting.
Definition: scripts.cpp:66
MxAtomId * g_nocdSourceName
[AI] AtomId for the NoCD patch/script identifier used for copy protection checks.
Definition: scripts.cpp:91
MxAtomId * g_policeScript
[AI] Script AtomId for the police station script logic.
Definition: scripts.cpp:57
MxAtomId * g_regbookScript
[AI] Script AtomId for the registration book script (name entry).
Definition: scripts.cpp:48
MxAtomId * g_jukeboxScript
[AI] Script AtomId for the Jukebox entity/event script.
Definition: scripts.cpp:70
MxAtomId * g_infodoorScript
[AI] Script AtomId for the Info Center door logic script.
Definition: scripts.cpp:38
void DestroyScripts()
[AI] Frees and nullifies all global script AtomIds.
Definition: scripts.cpp:127
MxAtomId * g_infomainScript
[AI] Script AtomId for the main Info Center world/event script.
Definition: scripts.cpp:42
MxAtomId * g_racecarScript
[AI] Script AtomId for the build/race car SI file.
Definition: scripts.cpp:15
MxAtomId * g_garageScript
[AI] Script AtomId for the vehicle garage/world logic.
Definition: scripts.cpp:60
void CreateScripts()
[AI] Allocates and initializes all global script MxAtomIds.
Definition: scripts.cpp:94
MxAtomId * g_copterScript
[AI] Script AtomId for the helicopter ("copter") build or activity.
Definition: scripts.cpp:6
MxAtomId * g_jetskiScript
[AI] Script AtomId for the jet ski-related script.
Definition: scripts.cpp:12
MxAtomId * g_jetraceScript
[AI] Script AtomId for jet racing-related scripts.
Definition: scripts.cpp:25
MxAtomId * g_elevbottScript
[AI] Script AtomId for the elevator bottom script in Info Center.
Definition: scripts.cpp:35
MxAtomId * g_testScript
[AI] Script AtomId for test SI data (used in debug/development).
Definition: scripts.cpp:79
MxAtomId * g_hospitalScript
[AI] Script AtomId for the hospital SI logic.
Definition: scripts.cpp:54
MxAtomId * g_act2mainScript
[AI] Script AtomId for main script of Act 2 (island event progression).
Definition: scripts.cpp:63
MxAtomId * g_dunecarScript
[AI] Script AtomId for the dune car building or mission script.
Definition: scripts.cpp:9
MxAtomId * g_carraceScript
[AI] Script AtomId for the car racing event script.
Definition: scripts.cpp:19
[AI] Associates a world enum, key, and AtomId for dynamic world lookup, Atom-based registry,...
Definition: legomain.h:85
World GetId()
[AI] Returns world identifier.
Definition: legomain.h:129
MxAtomId * m_atomId
[AI] AtomId pointer for this world's script.
Definition: legomain.h:139
char m_key[20]
[AI] String key for this world (used for script/world lookup).
Definition: legomain.h:138