Isle
|
[AI] Manages LEGO buildings in the world, including their state, animation, switching, saving/loading, and scheduling of animations. More...
#include <legobuildingmanager.h>
Classes | |
struct | AnimEntry |
[AI] Tracks and schedules a single animation entry for a building with sound and timer information, for use with the tickling/animation update system. More... | |
Public Member Functions | |
LegoBuildingManager () | |
[AI] Constructor. Initializes state and building info array (see Init()). More... | |
~LegoBuildingManager () override | |
[AI] Destructor. Cleans up scheduled animation file string and resets manager state. More... | |
MxResult | Tickle () override |
[AI] Tick updates for scheduled animation: animates buildings scheduled in m_entries, triggers sound, does hiding or motion, then unregisters self if no more animations remain. More... | |
const char * | ClassName () const override |
[AI] Returns the runtime class name for this manager. More... | |
void | Init () |
[AI] Initializes all manager fields, resets animation tracking, and loads the default building info array. More... | |
void | LoadWorldInfo () |
[AI] Loads/creates building models for the current world, sets up variants appropriately for current config, and manages building visibility. More... | |
void | CreateBuilding (MxS32 p_index, LegoWorld *p_world) |
[AI] Spawns and configures a building entity and its ROI based on world/array index. More... | |
void | Reset () |
[AI] Removes all building-state links to world entities and cancels/cleans any scheduled animation entries. More... | |
MxResult | Write (LegoStorage *p_storage) |
[AI] Serializes current building state to the given storage. More... | |
MxResult | Read (LegoStorage *p_storage) |
[AI] Restores data from serialized building state in the given storage. More... | |
LegoBuildingInfo * | GetInfo (LegoEntity *p_entity) |
[AI] Locates the building info entry for a specific building entity. More... | |
MxBool | SwitchVariant (LegoEntity *p_entity) |
[AI] Attempts to switch the building variant for the specified entity (e.g. More... | |
MxBool | SwitchSound (LegoEntity *p_entity) |
[AI] Cycles the current active sound for a building (if sounds available). More... | |
MxBool | SwitchMove (LegoEntity *p_entity) |
[AI] Cycles the current move/animation state for a building (if moves available). More... | |
MxBool | SwitchMood (LegoEntity *p_entity) |
[AI] Cycles the current mood state for a building (if moods available, mood in 0..3). More... | |
MxU32 | GetAnimationId (LegoEntity *p_entity) |
[AI] Returns the animation id for a building entity, factoring in base animation id and move offset. More... | |
MxU32 | GetSoundId (LegoEntity *p_entity, MxBool p_state) |
[AI] Returns the sound id for a building entity, using either mood or active sound state. More... | |
MxBool | FUN_10030000 (LegoEntity *p_entity) |
[AI] Attempts to "progress" demolition/animation of a building entity by calling FUN_10030030 on its array index. More... | |
MxBool | FUN_10030030 (MxS32 p_index) |
[AI] Internal: progresses the demolition/animation state/counter of the indexed building, moves ROI if appropriate, otherwise hides the entity when done. More... | |
MxBool | FUN_10030110 (LegoBuildingInfo *p_data) |
[AI] Forwards to FUN_10030030 with lookup by pointer; used for pointer-based demolition/motion triggers. More... | |
void | ScheduleAnimation (LegoEntity *p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28) |
[AI] Schedules an animation bounce/effect for a given building entity (updates AnimEntry tracking and triggers Tickle registration). More... | |
void | FUN_10030590 () |
[AI] Resets all buildings' construction/demolition status to "unbuilt" (-1), updates heights/visibilities, and resets entity transform. More... | |
void | AdjustHeight (MxS32 p_index) |
[AI] Adjusts (recalculates) a building's world Y position based on its current demo/build counter, which offsets Y lower as more damage occurs. More... | |
MxResult | FUN_10030630 () |
[AI] Performs a boundary existence/consistency check for each building, resolving path boundaries and snapping Y if necessary. More... | |
LegoBuildingInfo * | GetInfoArray (MxS32 &p_length) |
[AI] Returns the full set of LegoBuildingInfo entries, checks/initializes boundary data if needed. More... | |
void | FUN_100307b0 (LegoEntity *p_entity, MxS32 p_adjust) |
[AI] Adjusts the construction/demolition counter for a building entity, incrementing or decrementing by a fixed adjust amount. More... | |
void | FUN_10030800 () |
[AI] Copies the current m_unk0x11 demo/counter into m_initialUnk0x11 for all buildings (for persistent saving). More... | |
![]() | |
MxCore () | |
[AI] Constructs a new MxCore object and assigns it a unique id. More... | |
virtual | ~MxCore () |
[AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
virtual MxLong | Notify (MxParam &p_param) |
[AI] Virtual callback notification mechanism. More... | |
virtual MxResult | Tickle () |
[AI] Called by tickle managers to allow the object to update itself. More... | |
virtual const char * | ClassName () const |
[AI] Returns the runtime class name of this object. More... | |
virtual MxBool | IsA (const char *p_name) const |
[AI] Checks whether this object's class type or parents match the given name. More... | |
MxU32 | GetId () |
[AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Static Public Member Functions | |
static void | configureLegoBuildingManager (MxS32 p_buildingManagerConfig) |
[AI] Configure static settings for the LegoBuildingManager globally. More... | |
static void | SetCustomizeAnimFile (const char *p_value) |
[AI] Sets the global filename for a custom "customize animation" SMK/FLC file. More... | |
static const char * | GetCustomizeAnimFile () |
[AI] Gets the current static filename for custom "customize" animations. More... | |
[AI] Manages LEGO buildings in the world, including their state, animation, switching, saving/loading, and scheduling of animations.
[AI] This manager handles all building-related logic for LEGO Island, providing per-building state storage (via LegoBuildingInfo) and operations for visual/audio/mood switching, construction/demolition sequence, and animation/physics scheduling. It also implements serialization into LegoStorage and exposes relevant configuration and access APIs. [AI]
Definition at line 47 of file legobuildingmanager.h.
LegoBuildingManager::LegoBuildingManager | ( | ) |
[AI] Constructor. Initializes state and building info array (see Init()).
Definition at line 237 of file legobuildingmanager.cpp.
|
override |
[AI] Destructor. Cleans up scheduled animation file string and resets manager state.
Definition at line 243 of file legobuildingmanager.cpp.
void LegoBuildingManager::AdjustHeight | ( | MxS32 | p_index | ) |
[AI] Adjusts (recalculates) a building's world Y position based on its current demo/build counter, which offsets Y lower as more damage occurs.
p_index | [AI] The index into g_buildingInfo |
Definition at line 403 of file legobuildingmanager.cpp.
|
inlineoverridevirtual |
[AI] Returns the runtime class name for this manager.
Reimplemented from MxCore.
Definition at line 70 of file legobuildingmanager.h.
|
static |
[AI] Configure static settings for the LegoBuildingManager globally.
p_buildingManagerConfig | [AI] New configuration value (affects switching and initialization behavior). |
Definition at line 231 of file legobuildingmanager.cpp.
[AI] Spawns and configures a building entity and its ROI based on world/array index.
p_index | [AI] The index into static building info array. |
p_world | [AI] The LegoWorld to place the building in. |
Definition at line 294 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::FUN_10030000 | ( | LegoEntity * | p_entity | ) |
[AI] Attempts to "progress" demolition/animation of a building entity by calling FUN_10030030 on its array index.
p_entity | [AI] Building entity |
Definition at line 590 of file legobuildingmanager.cpp.
[AI] Internal: progresses the demolition/animation state/counter of the indexed building, moves ROI if appropriate, otherwise hides the entity when done.
p_index | [AI] Index in the building info array |
Definition at line 611 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::FUN_10030110 | ( | LegoBuildingInfo * | p_data | ) |
[AI] Forwards to FUN_10030030 with lookup by pointer; used for pointer-based demolition/motion triggers.
p_data | [AI] Pointer to LegoBuildingInfo |
Definition at line 652 of file legobuildingmanager.cpp.
void LegoBuildingManager::FUN_10030590 | ( | ) |
[AI] Resets all buildings' construction/demolition status to "unbuilt" (-1), updates heights/visibilities, and resets entity transform.
Definition at line 777 of file legobuildingmanager.cpp.
MxResult LegoBuildingManager::FUN_10030630 | ( | ) |
[AI] Performs a boundary existence/consistency check for each building, resolving path boundaries and snapping Y if necessary.
Definition at line 796 of file legobuildingmanager.cpp.
void LegoBuildingManager::FUN_100307b0 | ( | LegoEntity * | p_entity, |
MxS32 | p_adjust | ||
) |
[AI] Adjusts the construction/demolition counter for a building entity, incrementing or decrementing by a fixed adjust amount.
p_entity | [AI] Building entity |
p_adjust | [AI] Value to increment (positive) or decrement (negative) |
Definition at line 879 of file legobuildingmanager.cpp.
void LegoBuildingManager::FUN_10030800 | ( | ) |
[AI] Copies the current m_unk0x11 demo/counter into m_initialUnk0x11 for all buildings (for persistent saving).
Definition at line 898 of file legobuildingmanager.cpp.
MxU32 LegoBuildingManager::GetAnimationId | ( | LegoEntity * | p_entity | ) |
[AI] Returns the animation id for a building entity, factoring in base animation id and move offset.
p_entity | [AI] Building entity |
Definition at line 538 of file legobuildingmanager.cpp.
|
inlinestatic |
[AI] Gets the current static filename for custom "customize" animations.
Definition at line 188 of file legobuildingmanager.h.
LegoBuildingInfo * LegoBuildingManager::GetInfo | ( | LegoEntity * | p_entity | ) |
[AI] Locates the building info entry for a specific building entity.
p_entity | [AI] Building entity pointer (LegoEntity) |
Definition at line 429 of file legobuildingmanager.cpp.
LegoBuildingInfo * LegoBuildingManager::GetInfoArray | ( | MxS32 & | p_length | ) |
[AI] Returns the full set of LegoBuildingInfo entries, checks/initializes boundary data if needed.
p_length | [AI] Set to the count of entries returned. |
Definition at line 868 of file legobuildingmanager.cpp.
MxU32 LegoBuildingManager::GetSoundId | ( | LegoEntity * | p_entity, |
MxBool | p_state | ||
) |
[AI] Returns the sound id for a building entity, using either mood or active sound state.
If p_state is TRUE, returns the mood-related sound id, else uses current sound slot.
p_entity | [AI] Building entity |
p_state | [AI] TRUE for mood, FALSE for main sound |
Definition at line 551 of file legobuildingmanager.cpp.
void LegoBuildingManager::Init | ( | ) |
[AI] Initializes all manager fields, resets animation tracking, and loads the default building info array.
Definition at line 249 of file legobuildingmanager.cpp.
void LegoBuildingManager::LoadWorldInfo | ( | ) |
[AI] Loads/creates building models for the current world, sets up variants appropriately for current config, and manages building visibility.
Definition at line 264 of file legobuildingmanager.cpp.
MxResult LegoBuildingManager::Read | ( | LegoStorage * | p_storage | ) |
[AI] Restores data from serialized building state in the given storage.
p_storage | [AI] The storage to read from. |
Definition at line 363 of file legobuildingmanager.cpp.
void LegoBuildingManager::Reset | ( | ) |
[AI] Removes all building-state links to world entities and cancels/cleans any scheduled animation entries.
Definition at line 311 of file legobuildingmanager.cpp.
void LegoBuildingManager::ScheduleAnimation | ( | LegoEntity * | p_entity, |
MxLong | p_length, | ||
MxBool | p_haveSound, | ||
MxBool | p_unk0x28 | ||
) |
[AI] Schedules an animation bounce/effect for a given building entity (updates AnimEntry tracking and triggers Tickle registration).
p_entity | [AI] The entity to animate |
p_length | [AI] Duration of the animation (in ms) |
p_haveSound | [AI] Whether sound should play at peak event [AI] |
p_unk0x28 | [AI] Whether to immediately set demolition state to zero at finish. |
Definition at line 664 of file legobuildingmanager.cpp.
|
static |
[AI] Sets the global filename for a custom "customize animation" SMK/FLC file.
p_value | [AI] C-string path, or NULL to clear. |
Definition at line 571 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::SwitchMood | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the current mood state for a building (if moods available, mood in 0..3).
p_entity | [AI] Building entity |
Definition at line 518 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::SwitchMove | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the current move/animation state for a building (if moves available).
p_entity | [AI] Building entity |
Definition at line 498 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::SwitchSound | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the current active sound for a building (if sounds available).
p_entity | [AI] Building entity |
Definition at line 478 of file legobuildingmanager.cpp.
MxBool LegoBuildingManager::SwitchVariant | ( | LegoEntity * | p_entity | ) |
[AI] Attempts to switch the building variant for the specified entity (e.g.
changes type of house). Returns TRUE on success. Does nothing if config disables variants or not eligible.
p_entity | [AI] Building entity |
Definition at line 448 of file legobuildingmanager.cpp.
|
overridevirtual |
[AI] Tick updates for scheduled animation: animates buildings scheduled in m_entries, triggers sound, does hiding or motion, then unregisters self if no more animations remain.
Reimplemented from MxCore.
Definition at line 694 of file legobuildingmanager.cpp.
MxResult LegoBuildingManager::Write | ( | LegoStorage * | p_storage | ) |
[AI] Serializes current building state to the given storage.
p_storage | [AI] The storage to write to. |
Definition at line 330 of file legobuildingmanager.cpp.