Isle
Loading...
Searching...
No Matches
legolocomotionanimpresenter.cpp
Go to the documentation of this file.
2
3#include "anim/legoanim.h"
4#include "legoanimactor.h"
5#include "legomain.h"
6#include "legoworld.h"
7#include "misc.h"
8#include "mxautolock.h"
9#include "mxdssubscriber.h"
10#include "mxmisc.h"
11#include "mxvariabletable.h"
12
14
15// FUNCTION: LEGO1 0x1006cdd0
17{
18 Init();
19}
20
21// FUNCTION: LEGO1 0x1006d050
23{
25}
26
27// FUNCTION: LEGO1 0x1006d0b0
28void LegoLocomotionAnimPresenter::Init()
29{
30 m_unk0xc0 = 0;
31 m_unk0xc4 = NULL;
32 m_unk0xcc = -1;
33 m_unk0xd0 = -1;
34 m_roiMapList = NULL;
35 m_unk0xd4 = 0;
36}
37
38// FUNCTION: LEGO1 0x1006d0e0
40{
42
43 if (m_unk0xc4) {
44 delete[] m_unk0xc4;
45 }
46
47 if (m_roiMapList) {
48 delete m_roiMapList;
49 }
50
51 m_roiMap = NULL;
52 Init();
53
55
56 if (!p_fromDestructor) {
58 }
59}
60
61// FUNCTION: LEGO1 0x1006d140
63{
65 return result == SUCCESS ? SUCCESS : result;
66}
67
68// FUNCTION: LEGO1 0x1006d160
69// FUNCTION: BETA10 0x100528c7
71{
72 m_roiMapList = new LegoROIMapList();
73
74 if (m_roiMapList == NULL) {
75 return FAILURE;
76 }
77
79}
80
81// FUNCTION: LEGO1 0x1006d5b0
83{
85}
86
87// FUNCTION: LEGO1 0x1006d5c0
89{
90 // Empty
91}
92
93// FUNCTION: LEGO1 0x1006d5d0
95{
97
99 m_currentWorld->Add(this);
100 if (m_compositePresenter != NULL) {
102 }
103
104 m_unk0xd4++;
105 }
106}
107
108// FUNCTION: LEGO1 0x1006d610
109// FUNCTION: BETA10 0x10052a34
111{
112 if (m_subscriber->PeekData()) {
115 }
116
117 if (m_roiMapList->GetNumElements() != 0) {
119 }
120}
121
122// FUNCTION: LEGO1 0x1006d660
124{
125 if (m_unk0xd4 == 0) {
126 EndAction();
127 }
128}
129
130// FUNCTION: LEGO1 0x1006d670
132{
133 if (m_action) {
135 }
136}
137
138// FUNCTION: LEGO1 0x1006d680
139// FUNCTION: BETA10 0x10052b3d
141{
143
144 MxVariableTable* variableTable = VariableTable();
145
146 const char* key = ((LegoAnimNodeData*) m_anim->GetRoot()->GetData())->GetName();
147 variableTable->SetVariable(key, p_actor->GetROI()->GetName());
148
149 FUN_100695c0();
150 FUN_10069b10();
151
152 if (m_roiMap != NULL) {
153 m_roiMapList->Append(m_roiMap);
154 p_actor->FUN_1001c450(m_anim, p_value, m_roiMap, m_roiMapSize);
155 m_roiMap = NULL;
156 }
157
158 variableTable->SetVariable(key, "");
159
160 if (m_unk0x70 != NULL) {
161 delete m_unk0x70;
162 m_unk0x70 = NULL;
163 }
164}
[AI] Path-based actor which supports skeletal/mesh animation via an animation tree and multiple anima...
Definition: legoanimactor.h:49
virtual MxResult FUN_1001c450(LegoAnim *p_AnimTreePtr, float p_unk0x00, LegoROI **p_roiMap, MxU32 p_numROIs)
[AI] Adds a new animation mapping (LegoAnimActorStruct) with a tree, threshold, and mesh mapping.
[AI] Holds per-node animation data for a model's animation tree.
Definition: legoanim.h:144
LegoROIList * m_unk0x70
[AI] List of ROIs used during preprocessing, actor matching, or variable substitution (purpose varies...
void FUN_10069b10()
[AI] Builds mapping from animation node data names to ROIs, fills m_roiMap and m_roiMapSize.
virtual MxResult CreateAnim(MxStreamChunk *p_chunk)
[AI] Creates/loads the LegoAnim resource instance from a stream chunk buffer.
LegoAnim * m_anim
[AI] Animation resource currently being played back.
void ReadyTickle() override
[AI] Called when the presenter is in the "Ready" tickle state.
MxU32 m_roiMapSize
[AI] Number of valid entries in m_roiMap (excluding 0th index).
void Destroy() override
[AI] Releases all internal resources, actors, maps, and presenter state.
LegoROI ** m_roiMap
[AI] Lookup array to map animation node indices to scene ROIs (1-based index).
void FUN_100695c0()
[AI] Scans the world view compound objects to find and collect relevant ROIs for animation,...
MxResult AddToManager() override
[AI] Adds this presenter instance to the relevant presenter/notification manager.
LegoWorld * m_currentWorld
[AI] Reference to the world in which this presenter is currently placed/active.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
[AI] Specialized presenter class for handling locomotion animation playback and state in the LEGO Isl...
void Destroy() override
[AI] Completely cleans up and deletes this presenter's resources.
void ReadyTickle() override
[AI] Called during the ready tickle state to prepare for animation processing and add itself to the w...
~LegoLocomotionAnimPresenter() override
[AI] Destructor.
void FUN_1006d680(LegoAnimActor *p_actor, MxFloat p_value)
[AI] Binds a LegoAnimActor to the internal animation context and ROI mapping.
void EndAction() override
[AI] Ends the bound action/animation for this presenter, finalizing any running videos or related res...
MxResult AddToManager() override
[AI] Registers this presenter with manager systems and initializes additional ROI mapping state.
void PutFrame() override
[AI] Called to process/queue a frame for this presenter's active animation playback.
MxResult CreateAnim(MxStreamChunk *p_chunk) override
[AI] Creates an animation sequence from a stream chunk and initializes playback.
void StartingTickle() override
[AI] Called during the starting tickle state to dequeue and process any pending animation data chunks...
void StreamingTickle() override
[AI] Called during the streaming state to manage lifecycle and check if further processing is require...
[AI] Specialized pointer list that manages collections of LegoROI pointers, for ROI map management in...
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
LegoTreeNodeData * GetData()
[AI] Returns the data payload stored at this node (may be nullptr). [AI]
Definition: legotree.h:54
LegoTreeNode * GetRoot()
[AI] Returns a pointer to the root node of the tree. [AI]
Definition: legotree.h:112
virtual void Add(MxCore *p_object)
Adds an object (entity, presenter, ROI, etc.) to the appropriate world-managed list or set.
Definition: legoworld.cpp:418
void Enter()
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available.
void Leave()
[AI] Releases/leaves the critical section or mutex.
MxStreamChunk * PopData()
[AI] Pops the next available pending data chunk for consumption, moving it to the consumed list.
void FreeDataChunk(MxStreamChunk *p_chunk)
[AI] Frees (deletes) a data chunk if it's found in the consumed data list; also forcibly deletes sing...
MxStreamChunk * PeekData()
[AI] Returns but does not remove the first pending data chunk ("peek" operation).
void Append(T p_obj)
[AI]
Definition: mxlist.h:100
MxU32 GetNumElements()
[AI]
Definition: mxlist.h:118
MxDSSubscriber * m_subscriber
[AI] Subscriber that provides the stream data (e.g., audio/video chunks) for this presenter.
void ProgressTickleState(TickleState p_tickleState)
[AI] Helper for advancing the presenter's tickle state and updating transition history.
Definition: mxpresenter.h:72
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
Definition: mxpresenter.h:211
TickleState m_currentTickleState
[AI] Current state in the tickle lifecycle.
Definition: mxpresenter.h:199
@ e_starting
[AI] In the process of starting playback/presentation.
Definition: mxpresenter.h:26
@ e_streaming
[AI] Streaming or rendering actively.
Definition: mxpresenter.h:27
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
Definition: mxpresenter.h:214
MxCompositePresenter * m_compositePresenter
[AI] Owner composite presenter, if any.
Definition: mxpresenter.h:217
void SendToCompositePresenter(MxOmni *p_omni)
[AI] Notifies a composite presenter (if one exists) that this presenter wishes to join a group.
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
MxVariableTable is a specialized hash table for storing key/value string variables used by the LEGO I...
void SetVariable(const char *p_key, const char *p_value)
Sets a variable by key and value, replacing or updating if it exists.
void EndAction() override
Signals the end of the current playback action.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
LegoOmni * Lego()
[AI] Retrieves the global LegoOmni singleton instance, providing access to core subsystems.
Definition: misc.cpp:16
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
Definition: mxautolock.h:5
MxVariableTable * VariableTable()
[AI] Returns the variable table used for script variables and global key/value state.
Definition: mxmisc.cpp:73
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
float MxFloat
[AI]
Definition: mxtypes.h:68