35 0.0f, 1.0f, 1.0f, 1.0f,
36 1.0f, 1.0f, 1.0f, 1.0f,
37 1.0f, 1.0f, 1.0f, 1.0f,
38 1.0f, 1.0f, 1.0f, 1.0f,
57 84.79617f, 9.0f, -10.2189f,
66 67.28488, 1.0f, -85.3917,
75 93.245659f, 0.0f, -48.7773f,
84 -21.7321f, 0.0f, 11.23354f,
93 86.020737f, 4.0f, 31.35498f,
102 26.32025f, 0.0f, -2.28938f,
111 14.375f, -1.3125f, -56.75f,
120 -4.15951f, 0.0f, 5.2003198f,
129 -4.15951f, 0.0f, 5.2003198f,
138 -49.4744f, 2.0f, -56.6276f,
147 18.53531f, 0.0f, -16.6053f,
156 -33.5413f, 0.0f, -55.1791f,
165 -62.7827f, 7.0f, -45.2215f,
174 -69.2376f, 8.0f, -6.8008099f,
183 -69.0596f, 7.0f, -24.4928f,
192 -17.9438f, 0.0f, -46.827999f,
199MxU32 LegoBuildingManager::g_maxSound = 6;
210 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00,
212 0x00, 0x46, 0x49, 0x4c,
213 0x4f, 0x52, 0x55, 0x00,
218char* LegoBuildingManager::g_customizeAnimFile =
NULL;
228MxS32 LegoBuildingManager::g_maxMove[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0};
245 delete[] g_customizeAnimFile;
321 for (i = 0; i < m_numEntries; i++) {
351 if (p_storage->
Write(&m_nextVariant,
sizeof(m_nextVariant)) !=
SUCCESS) {
387 if (p_storage->
Read(&m_nextVariant,
sizeof(m_nextVariant)) !=
SUCCESS) {
486 if (info->
m_sound >= g_maxSound) {
573 if (g_customizeAnimFile !=
NULL) {
574 delete[] g_customizeAnimFile;
577 if (p_value !=
NULL) {
578 g_customizeAnimFile =
new char[strlen(p_value) + 1];
580 if (g_customizeAnimFile !=
NULL) {
581 strcpy(g_customizeAnimFile, p_value);
585 g_customizeAnimFile =
NULL;
673 if (m_numEntries == 0) {
674 m_unk0x28 = p_unk0x28;
686 entry->
m_time = time + 1000;
698 if (m_numEntries != 0) {
699 for (
MxS32 i = 0; i < m_numEntries; i++) {
707 if (m_numEntries != i) {
708 m_entries[i] = m_entries[m_numEntries];
709 m_entries[m_numEntries] =
NULL;
715 if (entry->
m_time - time > 1000) {
735 local134[1] = sin(((entry->
m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->
m_unk0x0c -= 0.05);
736 SET3(local120[3], local134);
741 if (entry->
m_time < time) {
760 if (m_numEntries != i) {
762 *ppEntry = m_entries[m_numEntries];
763 m_entries[m_numEntries] =
NULL;
815 if (position.
Dot(*normal, position) + (*normal).index_operator(3) < -0.001) {
817 "Building %d shot location (%g, %g, %g) is not in boundary %s.\n",
841 "Building %d shot location (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, "
857 MxTrace(
"Building %d is in boundary %s that does not exist.\n", i,
g_buildingInfo[i].m_boundaryName);
890 if (info->
m_unk0x11 <= 1 && p_adjust < 0) {
BOOL Moved(ViewROI &rROI)
[AI] Notifies the manager that the ROI has moved and needs spatial update.
[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,...
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...
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.
LegoCacheSound * FindSoundByKey(const char *p_key)
[AI] Attempts to find and return a cached sound by its key (case-insensitive).
LegoCacheSound * Play(const char *p_key, const char *p_name, MxBool p_looping)
[AI] Plays a sound identified by key, with the given playback name and looping flag.
void SetDistance(MxS32 p_min, MxS32 p_max)
Sets minimum and maximum audible distances for 3D sound attenuation.
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
void SetType(MxU8 p_type)
[AI] Sets the entity's type (actor/plant/building/etc.) [AI]
@ e_building
[AI] Building entities, usually interactable or decorations [AI]
[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.
const LegoChar * GetName() const
[AI] Gets this ROI's name.
LegoCacheSoundManager * GetCacheSoundManager()
[AI] Returns the cache sound manager used to cache and reuse sound effects.
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
virtual LegoResult Write(const void *p_buffer, LegoU32 p_size)=0
Write bytes from buffer into storage.
virtual LegoResult Read(void *p_buffer, LegoU32 p_size)=0
Read bytes from storage into buffer.
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
LegoU8 GetNumEdges()
[AI] Returns the number of edge elements assigned to this face.
const LegoChar * GetName()
[AI] Returns the name string of this edge, typically used for debugging and lookup.
Mx4DPointFloat * GetEdgeNormal(int index)
[AI] Returns a pointer to the 4D edge normal at the given sub-edge index.
Mx4DPointFloat * GetUnknown0x14()
[AI] Returns a pointer to the cached 4D normal or reference plane for the edge.
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
LegoPathBoundary * FindPathBoundary(const char *p_name)
Finds a path boundary in all path controllers by name.
MxCore * Find(const char *p_class, const char *p_name)
Finds an object of a given class and name in the world.
virtual void SetIdentity()
Sets this matrix to identity (diagonal 1, others 0).
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
[AI] 4D point class for floating point values.
float & index_operator(int idx)
[AI] Explicit indexed access wrapper (alias for operator[]).
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
virtual void UnregisterClient(MxCore *p_client)
[AI] Unregisters (marks for destruction) a previously registered client.
virtual void RegisterClient(MxCore *p_client, MxTime p_interval)
[AI] Registers an MxCore object to receive periodic tickles.
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
const float * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
void UpdateTransformationRelativeToParent(const Matrix4 &p_transform)
Calculates and updates the world transform relative to this object's parent, then calls UpdateWorldDa...
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
virtual float Dot(const float *p_a, const float *p_b) const
[AI] Compute the dot product of the two float arrays interpreted as vectors of 2 elements.
#define DECOMP_SIZE_ASSERT(T, S)
LegoBuildingInfo g_buildingInfoInit[16]
LegoBuildingInfo g_buildingInfo[16]
MxS32 g_buildingManagerConfig
LegoBuildingInfo * GetBuildingInfo(MxS32 p_index)
MxU8 g_buildingInfoDownshift[16]
float g_buildingInfoDownshiftScale[16]
const char * g_buildingInfoVariants[5]
MxU32 g_buildingAnimationId[16]
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
LegoSoundManager * SoundManager()
[AI] Accessor for the game's LegoSoundManager subsystem from the global LegoOmni instance....
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
MxTimer * Timer()
[AI] Returns the global simulation timer.
MxTickleManager * TickleManager()
[AI] Provides access to the global tickle manager.
[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]
MxS8 m_initialUnk0x11
[AI] Initial value for m_unk0x11, used for state resets or persistence [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]