Isle
Loading...
Searching...
No Matches
legobuildingmanager.h
Go to the documentation of this file.
1#ifndef LEGOBUILDINGMANAGER_H
2#define LEGOBUILDINGMANAGER_H
3
4#include "decomp.h"
5#include "misc/legotypes.h"
6#include "mxcore.h"
7
8class LegoEntity;
9class LegoROI;
10class LegoStorage;
11class LegoWorld;
12class LegoCacheSound;
14
19 enum {
21 c_hasSounds = 0x02,
22 c_hasMoves = 0x04,
23 c_hasMoods = 0x08
24 };
25
27 const char* m_variant;
34 float m_unk0x14;
35 const char* m_boundaryName;
36 float m_x;
37 float m_y;
38 float m_z;
40};
41
45// VTABLE: LEGO1 0x100d6f50
46// SIZE 0x30
48public:
52 struct AnimEntry {
56 float m_unk0x0c;
58 };
59
62
64 ~LegoBuildingManager() override;
65
67 MxResult Tickle() override; // vtable+0x08
68
70 const char* ClassName() const override // vtable+0x0c
71 {
72 return "LegoBuildingManager";
73 }
74
77 static void configureLegoBuildingManager(MxS32 p_buildingManagerConfig);
78
81 static void SetCustomizeAnimFile(const char* p_value);
82
84 void Init();
85
87 void LoadWorldInfo();
88
92 void CreateBuilding(MxS32 p_index, LegoWorld* p_world);
93
95 void Reset();
96
100 MxResult Write(LegoStorage* p_storage);
101
105 MxResult Read(LegoStorage* p_storage);
106
111
116
120 MxBool SwitchSound(LegoEntity* p_entity);
121
125 MxBool SwitchMove(LegoEntity* p_entity);
126
130 MxBool SwitchMood(LegoEntity* p_entity);
131
136
141 MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
142
145 MxBool FUN_10030000(LegoEntity* p_entity);
146
149 MxBool FUN_10030030(MxS32 p_index);
150
154
160 void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28);
161
163 void FUN_10030590();
164
167 void AdjustHeight(MxS32 p_index);
168
172
177
181 void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust);
182
184 void FUN_10030800();
185
188 static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
189
190 // SYNTHETIC: LEGO1 0x1002f940
191 // LegoBuildingManager::`scalar deleting destructor'
192
193private:
195 static char* g_customizeAnimFile;
196
198 static MxS32 g_maxMove[16];
199
201 static MxU32 g_maxSound;
202
203 MxU8 m_nextVariant;
204 MxBool m_unk0x09;
205 AnimEntry* m_entries[5];
206 MxS8 m_numEntries;
207 LegoCacheSound* m_sound;
208 MxBool m_unk0x28;
209 LegoWorld* m_world;
210};
211
212#endif // LEGOBUILDINGMANAGER_H
[AI] Manages LEGO buildings in the world, including their state, animation, switching,...
~LegoBuildingManager() override
[AI] Destructor. Cleans up scheduled animation file string and resets manager state.
void FUN_10030800()
[AI] Copies the current m_unk0x11 demo/counter into m_initialUnk0x11 for all buildings (for persisten...
MxBool SwitchSound(LegoEntity *p_entity)
[AI] Cycles the current active sound for a building (if sounds available).
void AdjustHeight(MxS32 p_index)
[AI] Adjusts (recalculates) a building's world Y position based on its current demo/build counter,...
const char * ClassName() const override
[AI] Returns the runtime class name for this manager.
MxResult Read(LegoStorage *p_storage)
[AI] Restores data from serialized building state in the given storage.
void FUN_100307b0(LegoEntity *p_entity, MxS32 p_adjust)
[AI] Adjusts the construction/demolition counter for a building entity, incrementing or decrementing ...
void Reset()
[AI] Removes all building-state links to world entities and cancels/cleans any scheduled animation en...
MxBool SwitchMove(LegoEntity *p_entity)
[AI] Cycles the current move/animation state for a building (if moves available).
void LoadWorldInfo()
[AI] Loads/creates building models for the current world, sets up variants appropriately for current ...
LegoBuildingInfo * GetInfoArray(MxS32 &p_length)
[AI] Returns the full set of LegoBuildingInfo entries, checks/initializes boundary data if needed.
static void SetCustomizeAnimFile(const char *p_value)
[AI] Sets the global filename for a custom "customize animation" SMK/FLC file.
MxBool FUN_10030110(LegoBuildingInfo *p_data)
[AI] Forwards to FUN_10030030 with lookup by pointer; used for pointer-based demolition/motion trigge...
static const char * GetCustomizeAnimFile()
[AI] Gets the current static filename for custom "customize" animations.
LegoBuildingInfo * GetInfo(LegoEntity *p_entity)
[AI] Locates the building info entry for a specific building entity.
void FUN_10030590()
[AI] Resets all buildings' construction/demolition status to "unbuilt" (-1), updates heights/visibili...
LegoBuildingManager()
[AI] Constructor. Initializes state and building info array (see Init()).
void CreateBuilding(MxS32 p_index, LegoWorld *p_world)
[AI] Spawns and configures a building entity and its ROI based on world/array index.
void Init()
[AI] Initializes all manager fields, resets animation tracking, and loads the default building info a...
MxBool SwitchVariant(LegoEntity *p_entity)
[AI] Attempts to switch the building variant for the specified entity (e.g.
MxBool SwitchMood(LegoEntity *p_entity)
[AI] Cycles the current mood state for a building (if moods available, mood in 0.....
MxU32 GetSoundId(LegoEntity *p_entity, MxBool p_state)
[AI] Returns the sound id for a building entity, using either mood or active sound state.
MxBool FUN_10030000(LegoEntity *p_entity)
[AI] Attempts to "progress" demolition/animation of a building entity by calling FUN_10030030 on its ...
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...
static void configureLegoBuildingManager(MxS32 p_buildingManagerConfig)
[AI] Configure static settings for the LegoBuildingManager globally.
MxResult Tickle() override
[AI] Tick updates for scheduled animation: animates buildings scheduled in m_entries,...
MxU32 GetAnimationId(LegoEntity *p_entity)
[AI] Returns the animation id for a building entity, factoring in base animation id and move offset.
MxBool FUN_10030030(MxS32 p_index)
[AI] Internal: progresses the demolition/animation state/counter of the indexed building,...
MxResult FUN_10030630()
[AI] Performs a boundary existence/consistency check for each building, resolving path boundaries and...
MxResult Write(LegoStorage *p_storage)
[AI] Serializes current building state to the given storage.
Sound cache object managing DirectSound buffers and 3D positioning for preloaded sound data.
Definition: legocachsound.h:17
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
#define override
Definition: compat.h:21
[AI] Defines basic fixed-width data types and platform-neutral constants for LEGO Island codebase.
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
signed char MxS8
[AI]
Definition: mxtypes.h:14
[AI] Describes the state, configuration, and world placement of a single LEGO building entity,...
MxU32 m_move
[AI] Index or ID of current animation state [AI]
const char * m_variant
[AI] Name of the building's current variant (model name/ID) [AI]
float m_y
[AI] World Y coordinate for the building's ground placement [AI]
LegoEntity * m_entity
[AI] Associated entity in the world for this building [AI]
@ c_hasMoves
[AI] This building supports animation cycling [AI]
@ c_hasVariants
[AI] This building has multiple variant models (for switching appearance) [AI]
@ c_hasMoods
[AI] This building supports mood changes [AI]
@ c_hasSounds
[AI] This building supports multiple sounds [AI]
MxU32 m_sound
[AI] Index or ID of current sound selection [AI]
MxU8 m_mood
[AI] Current mood index (0-3) [AI]
const char * m_boundaryName
[AI] Name label of the boundary zone for this building (used to find LegoPathBoundary) [AI]
MxS8 m_initialUnk0x11
[AI] Initial value for m_unk0x11, used for state resets or persistence [AI]
float m_x
[AI] World X coordinate for the building's ground placement [AI]
float m_z
[AI] World Z coordinate for the building's ground placement [AI]
float m_unk0x14
[AI] World height or vertical offset for this building [AI]
LegoPathBoundary * m_boundary
[AI] Pointer to the world boundary (collision/trigger volume) [AI]
MxU8 m_flags
[AI] Bitfield of building properties (see enum above) [AI]
MxS8 m_unk0x11
[AI] Counter or state value for construction/demolition progress [AI]
[AI] Tracks and schedules a single animation entry for a building with sound and timer information,...
LegoEntity * m_entity
[AI] The building entity being animated [AI]
float m_unk0x0c
[AI] Internal Y offset for vertical bouncy animation (demolition effect) [AI]
MxBool m_muted
[AI] TRUE if sound should be muted for this animation [AI]
MxLong m_time
[AI] Target future time when the animation should complete [AI]
LegoROI * m_roi
[AI] ROI used for transformations and updates [AI]