Isle
Loading...
Searching...
No Matches
legomain.h
Go to the documentation of this file.
1#ifndef LEGOMAIN_H
2#define LEGOMAIN_H
3
4#include "compat.h"
5#include "mxdsaction.h"
6#include "mxomni.h"
7
14class Isle;
18class LegoEntity;
19class LegoGameState;
22class LegoPathActor;
25class LegoROI;
29class LegoWorld;
30class LegoWorldList;
31class MxAtomId;
35
40class LegoOmni : public MxOmni {
41public:
46 enum {
48 c_disable3d = 0x02,
49 c_clearScreen = 0x04
50 };
51
57 enum World {
59 e_act1 = 0,
77 e_numWorlds = e_test + 2
78 };
79
90 {
92 m_atomId = NULL;
93 }
94
101 WorldContainer(World p_id, const char* p_key, MxAtomId* p_atomId)
102 {
103 m_id = p_id;
104
105 if (p_key) {
106 strcpy(m_key, p_key);
107 }
108
109 m_atomId = p_atomId;
110 }
111
118 {
119 m_id = p_container.m_id;
120 strcpy(m_key, p_container.m_key);
121 m_atomId = p_container.m_atomId;
122 return *this;
123 }
124
129 World GetId() { return m_id; }
130
135 const char* GetKey() { return m_key; }
136
138 char m_key[20];
140 };
141
145 LegoOmni();
146
150 ~LegoOmni() override;
151
157 MxLong Notify(MxParam& p_param) override; // vtable+0x04
158
163 const char* ClassName() const override // vtable+0x0c
164 {
165 return "LegoOmni";
166 }
167
173 MxBool IsA(const char* p_name) const override // vtable+0x10
174 {
175 return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name);
176 }
177
181 void Init() override;
182
188 MxResult Create(MxOmniCreateParam& p_param) override;
189
193 void Destroy() override;
194
200 MxResult Start(MxDSAction* p_dsAction) override;
201
206 void DeleteObject(MxDSAction& p_dsAction) override;
207
213 MxBool DoesEntityExist(MxDSAction& p_dsAction) override;
214
222 MxEntity* AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override;
223
228 void NotifyCurrentEntity(const MxNotificationParam& p_param) override;
229
233 void Pause() override;
234
238 void Resume() override;
239
246 LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);
247
253 LegoROI* FindROI(const char* p_name);
254
259 void AddWorld(LegoWorld* p_world);
260
265 void DeleteWorld(LegoWorld* p_world);
266
272 void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
273
278
284 void RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId);
285
291
297 const char* GetWorldName(LegoOmni::World p_id);
298
305
311 World GetWorldId(const char* p_key);
312
316 void DeleteAction();
317
325
329 static void CreateInstance();
330
335 static LegoOmni* GetInstance();
336
342
348
353 LegoInputManager* GetInputManager() { return m_inputManager; }
354
359 LegoTextureContainer* GetTextureContainer() { return m_textureContainer; }
360
365 ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; }
366
371 LegoWorld* GetCurrentWorld() { return m_currentWorld; }
372
377 LegoNavController* GetNavController() { return m_navController; }
378
383 LegoPathActor* GetUserActor() { return m_userActor; }
384
389 LegoPlantManager* GetPlantManager() { return m_plantManager; }
390
395 LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
396
401 LegoBuildingManager* GetBuildingManager() { return m_buildingManager; }
402
407 LegoWorldList* GetWorldList() { return m_worldList; }
408
413 LegoGameState* GetGameState() { return m_gameState; }
414
420
425 MxTransitionManager* GetTransitionManager() { return m_transitionManager; }
426
431 MxDSAction& GetCurrentAction() { return m_action; }
432
437 LegoCharacterManager* GetCharacterManager() { return m_characterManager; }
438
443 void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
444
449 void SetUserActor(LegoPathActor* p_userActor) { m_userActor = p_userActor; }
450
455 void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
456
461 void SetExit(MxBool p_exit) { m_exit = p_exit; }
462
468 MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) { return m_unk0x13c ? Start(&p_dsAction) : SUCCESS; }
469
474 void SetUnknown13c(MxBool p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
475
479 void CloseMainWindow() { PostMessageA(m_windowHandle, WM_CLOSE, 0, 0); }
480
481 // SYNTHETIC: LEGO1 0x10058b30
482 // LegoOmni::`scalar deleting destructor'
483
484private:
485 WorldContainer* m_worlds;
486 ViewLODListManager* m_viewLODListManager;
487 LegoInputManager* m_inputManager;
488 LegoTextureContainer* m_textureContainer;
489 LegoWorldList* m_worldList;
490 LegoWorld* m_currentWorld;
491 MxBool m_exit;
492 LegoNavController* m_navController;
493 LegoPathActor* m_userActor;
494 LegoCharacterManager* m_characterManager;
495 LegoPlantManager* m_plantManager;
496 LegoAnimationManager* m_animationManager;
497 LegoBuildingManager* m_buildingManager;
498 LegoGameState* m_gameState;
499 MxDSAction m_action;
500 MxBackgroundAudioManager* m_bkgAudioManager;
501 MxTransitionManager* m_transitionManager;
502
503public:
505};
506
507#endif // LEGOMAIN_H
[AI] Represents the main overworld (LEGO Island) in the game, acting as the central hub and state mac...
Definition: isle.h:179
[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,...
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
Comprehensive persistent game state manager: handles save/load, player selection, area switching,...
Definition: legogamestate.h:78
[AI] Handles keyboard, mouse, and joystick input for the game.
[AI] Handles user navigation input (keyboard and joystick) and determines avatar movement and directi...
[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 SetNavController(LegoNavController *p_navController)
[AI] Sets the navigation controller.
Definition: legomain.h:443
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
LegoCharacterManager * GetCharacterManager()
[AI] Returns character manager, handling population and logic for all in-world characters.
Definition: legomain.h:437
LegoAnimationManager * GetAnimationManager()
[AI] Returns animation manager for managing character/world animations.
Definition: legomain.h:395
LegoBuildingManager * GetBuildingManager()
[AI] Returns building manager (handles in-world structures and their logic).
Definition: legomain.h:401
void SetUserActor(LegoPathActor *p_userActor)
[AI] Sets the user actor pointer (player).
Definition: legomain.h:449
LegoPlantManager * GetPlantManager()
[AI] Returns active plant manager, which tracks in-world plants/objects.
Definition: legomain.h:389
void SetUnknown13c(MxBool p_unk0x13c)
[AI] Sets the unknown0x13c flag (purpose not fully documented in reverse).
Definition: legomain.h:474
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
MxTransitionManager * GetTransitionManager()
[AI] Returns transition manager for handling UI/game state transitions/fades.
Definition: legomain.h:425
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
LegoGameState * GetGameState()
[AI] Returns the global game state tracker.
Definition: legomain.h:413
MxResult StartActionIfUnknown0x13c(MxDSAction &p_dsAction)
[AI] Starts action if the unknown0x13c member is set; otherwise returns success.
Definition: legomain.h:468
LegoNavController * GetNavController()
[AI] Returns the navigation controller (handles player navigation and camera logic).
Definition: legomain.h:377
LegoInputManager * GetInputManager()
[AI] Returns the input manager.
Definition: legomain.h:353
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
LegoVideoManager * GetVideoManager()
[AI] Returns the active video manager, cast to LegoVideoManager.
Definition: legomain.h:341
MxAtomId * GetWorldAtom(LegoOmni::World p_id)
[AI] Looks up and returns the AtomId of a world by its enum id.
Definition: legomain.cpp:491
LegoTextureContainer * GetTextureContainer()
[AI] Returns the global texture container (all loaded textures).
Definition: legomain.h:359
LegoWorld * GetCurrentWorld()
[AI] Returns the pointer to the currently active world.
Definition: legomain.h:371
void NotifyCurrentEntity(const MxNotificationParam &p_param) override
[AI] Sends notification to the currently active world.
Definition: legomain.cpp:449
void SetExit(MxBool p_exit)
[AI] Signals the engine to exit/game quit procedure.
Definition: legomain.h:461
void DeleteWorld(LegoWorld *p_world)
[AI] Deletes (and removes from registry) a LegoWorld, deleting all resources.
Definition: legomain.cpp:317
LegoWorldList * GetWorldList()
[AI] Returns pointer to world and script registry list.
Definition: legomain.h:407
static void CreateInstance()
[AI] Allocates and sets up a new LegoOmni singleton instance, replacing the previous one if any.
Definition: legomain.cpp:298
const char * ClassName() const override
[AI] Returns a static string identifying this class for runtime type checking.
Definition: legomain.h:163
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
MxDSAction & GetCurrentAction()
[AI] Returns the actual DSAction used for the current/pending event.
Definition: legomain.h:431
void Destroy() override
[AI] Shuts down and deletes all owned game managers, variable tables, registry lists and Lego subsyst...
Definition: legomain.cpp:79
MxBackgroundAudioManager * GetBackgroundAudioManager()
[AI] Returns handle to the background audio manager (jukebox/music/ambience).
Definition: legomain.h:419
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
MxBool IsA(const char *p_name) const override
[AI] Performs runtime type checking, supporting inheritance.
Definition: legomain.h:173
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 SetCurrentWorld(LegoWorld *p_currentWorld)
[AI] Sets the current world pointer for global context.
Definition: legomain.h:455
ViewLODListManager * GetViewLODListManager()
[AI] Returns the LOD list manager for handling refcounted LOD data in the scene.
Definition: legomain.h:365
void Pause() override
[AI] Pauses the engine/game state and sets busy cursor.
Definition: legomain.cpp:586
LegoPathActor * GetUserActor()
[AI] Returns the player-controlled ("user") actor.
Definition: legomain.h:383
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
LegoSoundManager * GetSoundManager()
[AI] Returns the sound manager, cast to LegoSoundManager.
Definition: legomain.h:347
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] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
[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
[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...
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
[AI] Atomized (unique) string identifier, managed by reference counting.
Definition: mxatom.h:124
[AI] Background music manager that handles playback, volume, state transitions, and notifications for...
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
MxEntity is a base class for game entities which are uniquely identified by an integer ID and an Atom...
Definition: mxentity.h:22
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
[AI] Encapsulates parameters required to initialize the core Omni engine.
[AI] Central subsystem coordinator and singleton of the LEGO Island engine.
Definition: mxomni.h:32
HWND m_windowHandle
[AI] Associated window handle for DirectX/Win32 operations.
Definition: mxomni.h:284
MxSoundManager * m_soundManager
[AI] Manages sound (WAV, MIDI) output and channels.
Definition: mxomni.h:314
MxVideoManager * m_videoManager
[AI] Manager for decoding and rendering video resources (FLC, etc.).
Definition: mxomni.h:309
[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
[AI] Handles screen transitions and animations (such as dissolve, mosaic, wipe, etc....
[AI] Manages the lifecycle, lookup, and sharing of ViewLODList instances for different ROI names.
Definition: viewlodlist.h:111
#define override
Definition: compat.h:21
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
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
[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
WorldContainer & operator=(const WorldContainer &p_container)
[AI] Copy assignment operator.
Definition: legomain.h:117
char m_key[20]
[AI] String key for this world (used for script/world lookup).
Definition: legomain.h:138
const char * GetKey()
[AI] Returns world string key.
Definition: legomain.h:135
WorldContainer(World p_id, const char *p_key, MxAtomId *p_atomId)
[AI] Construct a WorldContainer from enum id, string key, and AtomId pointer.
Definition: legomain.h:101
World m_id
[AI] World enum identifier.
Definition: legomain.h:137
WorldContainer()
[AI] Default constructor.
Definition: legomain.h:89