Isle
Loading...
Searching...
No Matches
legoentitypresenter.cpp
Go to the documentation of this file.
2
3#include "islepathactor.h"
4#include "legovideomanager.h"
5#include "misc.h"
6
8
9// FUNCTION: LEGO1 0x10053440
11{
12 Init();
13}
14
15// FUNCTION: LEGO1 0x100535c0
17{
18 m_entity = NULL;
19}
20
21// FUNCTION: LEGO1 0x100535d0
23{
25}
26
27// FUNCTION: LEGO1 0x10053630
29{
30 m_entity = p_entity;
31 return 0;
32}
33
34// FUNCTION: LEGO1 0x10053640
35void LegoEntityPresenter::Destroy(MxBool p_fromDestructor)
36{
37 if (VideoManager()) {
39 }
40
41 Init();
42}
43
44// FUNCTION: LEGO1 0x10053670
46{
48}
49
50// FUNCTION: LEGO1 0x10053680
52{
53 MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
54
55 if (VideoManager()) {
57 }
58
59 return result;
60}
61
62// FUNCTION: LEGO1 0x100536c0
64{
65 if (CurrentWorld()) {
67 if (m_entity) {
70 ParseExtra();
71 }
73 }
74}
75
76// FUNCTION: LEGO1 0x10053720
78{
79 if (m_list.empty()) {
80 EndAction();
81 }
82}
83
84// FUNCTION: LEGO1 0x10053730
85void LegoEntityPresenter::SetEntityLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up)
86{
87 if (m_entity) {
88 m_entity->SetLocation(p_location, p_direction, p_up, TRUE);
89 }
90}
91
92// FUNCTION: LEGO1 0x10053750
94{
95 MxU16 extraLength;
96 char* extraData;
97 m_action->GetExtra(extraLength, extraData);
98
99 if (extraLength) {
100 char extraCopy[512];
101 memcpy(extraCopy, extraData, extraLength);
102 extraCopy[extraLength] = '\0';
103
104 m_entity->ParseAction(extraCopy);
105 }
106}
[AI] Presenter responsible for managing the lifecycle, location, and logic for a LegoEntity instance ...
MxResult StartAction(MxStreamController *p_controller, MxDSAction *p_action) override
[AI] Starts a new LegoEntity action using the provided stream controller and definition.
virtual undefined4 SetEntity(LegoEntity *p_entity)
[AI] Sets the managed LegoEntity for this presenter.
void Destroy() override
[AI] Cleans up this presenter, unregisters itself from the VideoManager, and resets its entity.
virtual void Init()
[AI] Initializes internal state for (re-)use, called from constructor and internal resets.
LegoEntity * m_entity
[AI] The entity instance managed by this presenter, typically created based on the current action.
void ParseExtra() override
[AI] Parses extra data (typically serialized commands/string) from the action and applies it to the m...
void SetEntityLocation(const Vector3 &p_location, const Vector3 &p_direction, const Vector3 &p_up)
[AI] Sets the entity's world transformation using location, direction, and up vectors.
void RepeatingTickle() override
[AI] Called periodically in the Repeating state to check for completion and manage progression.
~LegoEntityPresenter() override
[AI] Destructor.
void ReadyTickle() override
[AI] Called when the presenter is in the Ready state, typically responsible for instantiating and ini...
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
void SetLocation(const Vector3 &p_location, const Vector3 &p_direction, const Vector3 &p_up, MxBool p_und)
[AI] Sets the world-space location, direction, and up, applying normalization and transformation.
Definition: legoentity.cpp:158
virtual MxResult Create(MxDSAction &p_dsAction)
[AI] Initializes the entity from a DSAction object, typically from a script or file load.
Definition: legoentity.cpp:84
virtual void ParseAction(char *p_extra)
[AI] Parses an action description string (usually from script "extra" data) and sets up this entity's...
Definition: legoentity.cpp:236
void EndAction() override
[AI] Ends the composite action, terminating all child presenters and clearing action lists....
MxCompositePresenterList m_list
[AI] List of owned child presenters that are managed by this MxCompositePresenter....
MxResult StartAction(MxStreamController *p_controller, MxDSAction *p_action) override
[AI] Starts a composite action by creating child presenters for each action in a MxDSMultiAction list...
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
void GetExtra(MxU16 &p_extraLength, char *&p_extraData)
[AI] Retrieves the extra data and its length for this action.
Definition: mxdsaction.h:168
const Vector3 & GetLocation()
[AI] Gets the location vector for this action (world or local space).
Definition: mxdsaction.h:215
const Vector3 & GetUp()
[AI] Gets the up vector for this action (global or local).
Definition: mxdsaction.h:225
const Vector3 & GetDirection()
[AI] Gets the direction vector (typically forward vector) for this action.
Definition: mxdsaction.h:220
virtual void RegisterPresenter(MxPresenter &p_presenter)
[AI] Register a new presenter for tickle management and playback coordination.
virtual void UnregisterPresenter(MxPresenter &p_presenter)
[AI] Remove a presenter from tickle and managed output lists.
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
MxEntity * CreateEntity(const char *p_defaultName)
[AI] Creates an entity based on action 'extra' data, or uses the provided default name.
@ e_starting
[AI] In the process of starting playback/presentation.
Definition: mxpresenter.h:26
[AI] Controller for streaming and managing multimedia resources and actions during gameplay.
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
unsigned int undefined4
Definition: decomp.h:28
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
Definition: misc.cpp:29
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
Definition: misc.cpp:93
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned short MxU16
[AI]
Definition: mxtypes.h:20