Isle
Loading...
Searching...
No Matches
legoanimationmanager.h
Go to the documentation of this file.
1#ifndef LEGOANIMATIONMANAGER_H
2#define LEGOANIMATIONMANAGER_H
3
4#include "decomp.h"
5#include "legolocations.h"
6#include "legomain.h"
7#include "legostate.h"
8#include "legotraninfolist.h"
9#include "mxcore.h"
11
13class LegoEntity;
14class LegoExtraActor;
15class LegoFile;
16class LegoPathActor;
18class LegoROIList;
20class LegoWorld;
21class MxDSAction;
22
27struct ModelInfo {
28 char* m_name;
30 float m_location[3];
31 float m_direction[3];
32 float m_up[3];
34};
35
40struct AnimInfo {
41 char* m_name;
48 float m_unk0x10[4];
55};
56
61class AnimState : public LegoState {
62public:
63 AnimState();
64 ~AnimState() override;
65
67 const char* ClassName() const override;
68
70 MxBool IsA(const char* p_name) const override;
71
73 MxBool Reset() override;
74
77 MxResult Serialize(LegoStorage* p_storage) override;
78
82 void CopyToAnims(MxU32, AnimInfo* p_anims, MxU32& p_outExtraCharacterId);
83
88 void InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_extraCharacterId);
89
90private:
91 MxU32 m_extraCharacterId;
92 MxU32 m_unk0x0c;
93 MxU16* m_unk0x10;
94 MxU32 m_locationsFlagsLength;
95 MxBool* m_locationsFlags;
96};
97
103public:
106 struct Character {
107 const char* m_name;
119 };
120
123 struct Vehicle {
124 const char* m_name;
127 };
128
131 struct Extra {
137 float m_speed;
139 };
140
143 enum PlayMode {
144 e_unk0 = 0,
146 e_unk2
147 };
148
150 ~LegoAnimationManager() override;
151
154 MxLong Notify(MxParam& p_param) override;
155
157 MxResult Tickle() override;
158
160 const char* ClassName() const override;
161
163 MxBool IsA(const char* p_name) const override;
164
167 void Reset(MxBool p_und);
168
170 void Suspend();
171
173 void Resume();
174
177 void FUN_1005f6d0(MxBool p_unk0x400);
178
181 void EnableCamAnims(MxBool p_enableCamAnims);
182
186
190 MxBool FindVehicle(const char* p_name, MxU32& p_index);
191
195 MxResult ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_info);
196
200 MxResult ReadModelInfo(LegoStorage* p_storage, ModelInfo* p_info);
201
205 void FUN_10060480(const LegoChar* p_characterNames[], MxU32 p_numCharacterNames);
206
209 void FUN_100604d0(MxBool p_unk0x08);
210
214 void FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds);
215
218 void FUN_10060540(MxBool p_unk0x29);
219
222 void FUN_10060570(MxBool p_unk0x1a);
223
227 MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity);
228
232 MxU32 p_objectId,
233 MxMatrix* p_matrix,
234 MxBool p_param3,
235 MxU8 p_param4,
236 LegoROI* p_roi,
237 MxBool p_param6,
238 MxBool p_param7,
239 MxBool p_param8,
240 MxBool p_param9
241 );
242
246 void CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU32 p_location, MxBool p_bool);
247
250 void FUN_10061010(MxBool p_und);
251
255
257 void FUN_10062770();
258
261 void PurgeExtra(MxBool p_und);
262
266 void AddExtra(MxS32 p_location, MxBool p_und);
267
271 void FUN_10063270(LegoROIList* p_list, LegoAnimPresenter* p_presenter);
272
275 void FUN_10063780(LegoROIList* p_list);
276
279 MxResult FUN_10064670(Vector3* p_position);
280
283 MxResult FUN_10064740(Vector3* p_position);
284
287 static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig);
288
293 MxResult FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10);
294
297 MxBool FUN_10064ee0(MxU32 p_objectId);
298
299 // -- internal/private methods and members follow -- [AI]
300private:
301 void Init();
302
303 MxResult FUN_100605e0(
304 MxU32 p_index,
305 MxBool p_unk0x0a,
306 MxMatrix* p_matrix,
307 MxBool p_bool1,
308 LegoROI* p_roi,
309 MxBool p_bool2,
310 MxBool p_bool3,
311 MxBool p_bool4,
312 MxBool p_bool5
313 );
314
315 MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2);
316
318 void DeleteAnimations();
319
320 void FUN_10061530();
321
323 MxResult FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10);
324
325 MxU16 FUN_10062110(
326 LegoROI* p_roi,
327 Vector3& p_direction,
328 Vector3& p_position,
329 LegoPathBoundary* p_boundary,
330 float p_speed,
331 MxU8 p_unk0x0c,
332 MxBool p_unk0x14
333 );
334
336 MxS8 GetCharacterIndex(const char* p_name);
337
339 MxBool FUN_100623a0(AnimInfo& p_info);
340
342 MxBool ModelExists(AnimInfo& p_info, const char* p_name);
343
345 void FUN_10062580(AnimInfo& p_info);
346
348 MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi);
349
351 MxBool FUN_10062710(AnimInfo& p_info);
352
354 MxBool FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter);
355
356 void FUN_10063950(LegoROI* p_roi);
357 void FUN_10063aa0();
358
364 MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId);
365
366 void FUN_10063d10();
367 void FUN_10063e40(LegoAnimPresenter* p_presenter);
368
370 MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world);
371
373 MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale);
374
376 MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2);
377
379 MxResult FUN_10064380(
380 const char* p_name,
381 const char* p_boundaryName,
382 MxS32 p_src,
383 float p_srcScale,
384 MxS32 p_dest,
385 float p_destScale,
386 MxU32 p_undIdx1,
387 MxS32 p_unk0x0c,
388 MxU32 p_undIdx2,
389 MxS32 p_unk0x10,
390 float p_speed
391 );
392
394 void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404);
395
397 void FUN_10064b50(MxLong p_time);
398
399 LegoOmni::World m_worldId;
400 MxU16 m_animCount;
401 MxU16 m_unk0x0e;
402 MxU16 m_unk0x10;
403 AnimInfo* m_anims;
404 undefined2 m_unk0x18;
405 MxBool m_unk0x1a;
406 MxU32 m_unk0x1c;
407 LegoTranInfoList* m_tranInfoList;
408 LegoTranInfoList* m_tranInfoList2;
409 MxPresenter* m_unk0x28[2];
410 MxLong m_unk0x30[2];
411 MxBool m_unk0x38;
412 MxBool m_animRunning;
413 MxBool m_enableCamAnims;
414 Extra m_extras[40];
415 MxU32 m_lastExtraCharacterId;
416 MxBool m_unk0x400;
417 MxBool m_unk0x401;
418 MxBool m_unk0x402;
419 MxLong m_unk0x404;
420 MxLong m_unk0x408;
421 MxLong m_unk0x40c;
422 MxLong m_unk0x410;
423 MxU32 m_unk0x414;
424 MxU32 m_numAllowedExtras;
425 undefined4 m_unk0x41c;
426 AnimState* m_animState;
427 LegoROIList* m_unk0x424;
428 MxBool m_suspendedEnableCamAnims;
429 MxBool m_unk0x429;
430 MxBool m_unk0x42a;
431 MxBool m_suspended;
432 LegoTranInfo* m_unk0x42c;
433 MxBool m_unk0x430;
434 MxLong m_unk0x434;
435 MxLong m_unk0x438;
436 MxMatrix m_unk0x43c;
437 MxMatrix m_unk0x484;
438 MxQuaternionTransformer m_unk0x4cc;
439};
440
441#endif // LEGOANIMATIONMANAGER_H
[AI] Persistent serializable animation state for resuming animations and restoring global animation p...
AnimState()
Constructor. [AI].
void CopyToAnims(MxU32, AnimInfo *p_anims, MxU32 &p_outExtraCharacterId)
[AI] Writes tracked usage data to animations.
MxBool Reset() override
[AI] Resets all tracked animation usage to default.
MxBool IsA(const char *p_name) const override
[AI] Checks if this or a parent is the given class.
const char * ClassName() const override
[AI] Gets the class name ("AnimState").
~AnimState() override
Destructor, releases animation tracking arrays. [AI].
MxResult Serialize(LegoStorage *p_storage) override
[AI] Serialize state to or from disk for save/load.
void InitFromAnims(MxU32 p_animsLength, AnimInfo *p_anims, MxU32 p_extraCharacterId)
[AI] Reads usage state from animations and stores it in this AnimState.
[AI] Handles playback and synchronization of animated LEGO objects, including variable substitution,...
[AI] Animation manager handling all world and character animation state, loading, and logic for extra...
MxLong Notify(MxParam &p_param) override
[AI] Handles system/game notifications, e.g.
void PurgeExtra(MxBool p_und)
[AI] Removes all extras matching current world/time criteria (but not the player's current character)...
MxResult StartEntityAction(MxDSAction &p_dsAction, LegoEntity *p_entity)
[AI] Starts a DSAction for a specific entity, managing controller/actor logic if relevant.
void FUN_10063780(LegoROIList *p_list)
[AI] Examines an ROI list and adds all actors of type to internal "pending" list for extras.
MxBool FUN_10064ee0(MxU32 p_objectId)
[AI] Determines if any currently running animation is assigned to the given objectId,...
void FUN_10060540(MxBool p_unk0x29)
[AI] Sets the 'enabled for random camera animation' flag for all animations.
void FUN_10060480(const LegoChar *p_characterNames[], MxU32 p_numCharacterNames)
[AI] Marks characters in the global character list (g_characters) as available for animation accordin...
MxResult FUN_10060dc0(MxU32 p_objectId, MxMatrix *p_matrix, MxBool p_param3, MxU8 p_param4, LegoROI *p_roi, MxBool p_param6, MxBool p_param7, MxBool p_param8, MxBool p_param9)
[AI] Helper for starting a specific animation, including world matrix and camera settings.
MxBool FindVehicle(const char *p_name, MxU32 &p_index)
[AI] Looks up a vehicle by name, returning its index if found.
void Reset(MxBool p_und)
[AI] Resets all internal state; optionally resets animation state too.
void FUN_10061010(MxBool p_und)
[AI] Cancels all camera/transition animations and resets camera after completion.
PlayMode
[AI] Animation play modes, possibly for controlling explicit or random playback.
@ e_unk1
[AI] Unknown/unspecified play mode
@ e_unk2
[AI] Unknown/unspecified play mode
@ e_unk0
[AI] Unknown/unspecified play mode
~LegoAnimationManager() override
Destructor, cleans up all allocations and deregisters from tickle/notify. [AI].
void FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds)
[AI] Enables/disables certain animations by object id list (sets m_unk0x29 flag in AnimInfo).
MxResult LoadWorldInfo(LegoOmni::World p_worldId)
[AI] Loads all world animation and extra info.
const char * ClassName() const override
[AI] Gets the class name ("LegoAnimationManager").
MxResult Tickle() override
[AI] Called by tick manager, processes world/time-based animation logic, including spawning extras an...
MxResult ReadModelInfo(LegoStorage *p_storage, ModelInfo *p_info)
[AI] Reads a single ModelInfo out of storage.
void FUN_10060570(MxBool p_unk0x1a)
[AI] Sets whether the manager should immediately trigger camera transition animations in quick succes...
void Resume()
[AI] Resumes animation manager from suspension, restoring all previously suspended state.
void FUN_100604d0(MxBool p_unk0x08)
[AI] Sets the m_unk0x08 flag for all characters.
MxResult FUN_10064880(const char *p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10)
[AI] Updates specified character's extra animation idle/play time values for active extras.
void FUN_10062770()
[AI] Initializes sound transitions if not already active for the current world.
void EnableCamAnims(MxBool p_enableCamAnims)
[AI] Sets whether camera-based queued animations are enabled for the world.
void FUN_10063270(LegoROIList *p_list, LegoAnimPresenter *p_presenter)
[AI] Handles "extras" onboarding by evaluating visibility and position for presenter-based animation.
LegoAnimationManager()
Default constructor. [AI].
void CameraTriggerFire(LegoPathActor *p_actor, MxBool, MxU32 p_location, MxBool p_bool)
[AI] Triggers a camera animation based on user and location state.
MxResult ReadAnimInfo(LegoStorage *p_storage, AnimInfo *p_info)
[AI] Reads an AnimInfo entry from file storage, building model list and parsing parameters.
void Suspend()
[AI] Suspends all activity, saving out transition/animation state, and disables extra processing.
MxBool IsA(const char *p_name) const override
[AI] Checks if this or a parent is the given class.
MxResult FUN_10064740(Vector3 *p_position)
[AI] Similar to FUN_10064670, but triggers a different special animation event for secondary location...
MxResult FUN_10064670(Vector3 *p_position)
[AI] Activates special triggered animation in response to player position near given point.
LegoTranInfo * GetTranInfo(MxU32 p_index)
[AI] Retrieves an active transition info, or NULL if not found.
static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig)
[AI] Updates the configuration values (global) for animation manager's allowed number of extras,...
void AddExtra(MxS32 p_location, MxBool p_und)
[AI] Spawns a new extra actor at a boundary or location, if capacity and logic allow.
void FUN_1005f6d0(MxBool p_unk0x400)
[AI] Enables or disables extras (extra actors).
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
Represents a special actor in the world with additional animation state machines and complex interact...
Implementation of LegoStorage for file-backed storage using stdio FILE*.
Definition: legostorage.h:387
World
[AI] Identifiers for all unique, script-driven world environments in LEGO Island.
Definition: legomain.h:57
[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] A specialized pointer list for managing LegoROI instances.
Definition: legoroilist.h:25
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
[AI] Base class for game state blocks which encapsulate serializable and/or resettable aspects of the...
Definition: legostate.h:17
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
[AI] List container holding pointers to LegoTranInfo objects for use in transfer/pathfinding/ROIs.
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
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
[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
Quaternion interpolation utility for 4D transformations, supporting quaternion start/end points and s...
Definition: mxquaternion.h:14
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
unsigned short undefined2
Definition: decomp.h:27
unsigned int undefined4
Definition: decomp.h:28
unsigned char undefined
Definition: decomp.h:26
char LegoChar
[AI] Alias for char, for use in character/byte data and string handling.
Definition: legotypes.h:83
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
signed short MxS16
[AI]
Definition: mxtypes.h:26
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
signed char MxS8
[AI]
Definition: mxtypes.h:14
[AI] Describes a specific animation, containing animation parameters, model list, and related metadat...
float m_unk0x10[4]
Animation parameters: start/target position and radius. [AI].
MxBool m_unk0x29
Animation is active/available/playable. [AI].
MxU16 m_unk0x22
Use-count or instance count for this animation. [AI].
ModelInfo * m_models
Array of ModelInfo structs for the animation's involved models. [AI].
MxU8 m_unk0x0c
Bitmask related to actor/vehicle ability to use this animation (see g_unk0x100d8b28)....
MxU32 m_objectId
Object ID corresponding to this animation; used as a unique key. [AI].
MxBool m_unk0x0a
Boolean to control startup/behavioral logic. [AI].
MxS8 m_unk0x2a[3]
Vehicle indices or similar (max 3), for use by certain actors. [AI].
MxU8 m_unk0x0b
Purpose unknown; animation-related flag. [AI].
MxU8 m_unk0x0d
Additional animation state flag. [AI].
char * m_name
Animation name. [AI].
MxS8 m_characterIndex
Index into g_characters for the owning character (-1 if not set). [AI].
MxS16 m_location
Location index if relevant (−1 for omni/global). [AI].
MxU8 m_modelCount
Number of models referenced in m_models array. [AI].
[AI] Static definition of a character, its animation settings, flags, and world identity.
MxS32 m_unk0x10
Maximum idle time before main animation for this character (milliseconds). [AI].
const char * m_name
Character's name/identifier (must be unique). [AI].
undefined m_unk0x06
[AI_SUGGESTED_NAME: unusedPadding] Currently unused byte. [AI]
MxBool m_active
Runtime flag; TRUE if animation for this character is currently activated (in any mode)....
MxBool m_unk0x08
Boolean, TRUE if this character is eligible for "extra" animation. [AI].
MxU8 m_unk0x15
Probability (0–100) used for random vehicle assignment. [AI].
MxBool m_unk0x09
Boolean, TRUE if this character is ever to be placed as an extra at all. [AI].
MxBool m_unk0x07
Flag for reuse/destruction logic; meaning: pending return to actor pool. [AI].
MxS8 m_unk0x16
Index in g_cycles, used for finding correct main/alternative cycle animations for this character....
MxS8 m_vehicleId
Index into the vehicle array for this character's vehicle, −1 if not relevant. [AI].
MxBool m_inExtras
True if this character is currently active as an 'extra'. [AI].
MxS32 m_unk0x0c
Minimum idle time before main animation for this character (milliseconds). [AI].
[AI] Tracks a currently active extra (non-player) actor in the world, with associated parameters.
MxBool m_unk0x0d
Indicates that this extra is to be purged/removed at next tick. [AI].
LegoROI * m_roi
ROI object for this extra; NULL if slot unused. [AI].
float m_speed
Animation speed for the extra; negative to indicate not set. [AI].
MxLong m_unk0x08
Last time this extra was updated or used, ms. [AI].
MxS32 m_characterId
Index into g_characters, currently loaded actor type. [AI].
MxBool m_unk0x14
TRUE if this extra is currently in a vehicle animation. [AI].
MxBool m_unk0x0c
Used to signal waiting for an animation activation. [AI].
[AI] Static definition of a vehicle, including its name and state flags.
const char * m_name
Vehicle's name (corresponds to a ROI/model name). [AI].
MxBool m_unk0x04
TRUE if this vehicle is to be used in the next animation cycle. [AI].
MxBool m_unk0x05
TRUE if this vehicle is reserved by an actor present as an extra. [AI].
Defines a logical boundary associated with a location for things such as triggers,...
Definition: legolocations.h:24
[AI] Holds transformation and animation information for a LEGO object/ROI, especially in the context ...
Definition: legotraninfo.h:17
[AI] Represents an advanced edge in the LEGO Island geometry system, with direction,...
[AI] Contains information about a model used in an animation, including name and orientation.
MxU8 m_unk0x2c
Unknown purpose, acts as a boolean/flag. [AI].
MxU8 m_unk0x04
Unknown byte flag. [AI].
char * m_name
Name of the model. [AI].
float m_location[3]
Location/origin for the model in 3D space. [AI].
float m_direction[3]
Forward/direction vector. [AI].
float m_up[3]
Up vector for the model orientation. [AI].