Isle
Loading...
Searching...
No Matches
legopathpresenter.cpp
Go to the documentation of this file.
1#include "legopathpresenter.h"
2
3#include "define.h"
5#include "legovideomanager.h"
6#include "legoworld.h"
7#include "misc.h"
8#include "mxautolock.h"
9#include "mxdssubscriber.h"
10#include "mxutilities.h"
11
13
14// FUNCTION: LEGO1 0x100448d0
16{
17 Init();
18}
19
20// FUNCTION: LEGO1 0x10044ab0
21void LegoPathPresenter::Init()
22{
23}
24
25// FUNCTION: LEGO1 0x10044ac0
27{
29}
30
31// FUNCTION: LEGO1 0x10044b40
33{
34 MxResult status = FAILURE;
35
36 if (VideoManager()) {
38 status = SUCCESS;
39 }
40
41 return status;
42}
43
44// FUNCTION: LEGO1 0x10044b70
45void LegoPathPresenter::Destroy(MxBool p_fromDestructor)
46{
47 if (VideoManager()) {
49 }
50
51 {
53 Init();
54 }
55
56 if (!p_fromDestructor) {
58 }
59}
60
61// FUNCTION: LEGO1 0x10044c10
63{
65}
66
67// FUNCTION: LEGO1 0x10044c20
69{
70 LegoWorld* world = CurrentWorld();
71
72 if (world) {
74
75 if (chunk) {
76 LegoPathController* controller = new LegoPathController();
77
78 if (controller == NULL) {
79 EndAction();
80 }
81 else {
82 ParseExtra();
83
84 controller->Create(chunk->GetData(), m_action->GetLocation(), m_trigger);
85 world->AddPath(controller);
86
89 }
90 }
91 }
92}
93
94// FUNCTION: LEGO1 0x10044d00
96{
98
99 if (chunk) {
100 if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) {
102 }
103
105 }
106}
107
108// FUNCTION: LEGO1 0x10044d40
110{
111 if (this->m_action->GetDuration() == -1) {
112 return;
113 }
114
115 EndAction();
116}
117
118// FUNCTION: LEGO1 0x10044d60
120{
121 MxU16 extraLength;
122 char* extraData;
123 m_action->GetExtra(extraLength, extraData);
124
125 if (extraLength) {
126 char extraCopy[256], output[256];
127 memcpy(extraCopy, extraData, extraLength);
128 extraCopy[extraLength] = '\0';
129
130 strupr(extraCopy);
131
132 if (KeyValueStringParse(output, g_strTRIGGERS_SOURCE, extraCopy) != FALSE) {
134 }
135 }
136}
[AI] Manager for controlling actors' movement along predefined geometric paths.
virtual MxResult Create(MxU8 *p_data, const Vector3 &p_location, const MxAtomId &p_trigger)
[AI] Initializes the path controller from the provided binary data at the specified location,...
[AI] Presenter class for loading and managing path data from scripts/actions, used for actor pathing ...
~LegoPathPresenter() override
[AI] Destroys this presenter, unregistering from the video manager, deleting resources,...
void StreamingTickle() override
[AI] Processes data stream chunks during the streaming tickle phase.
void ParseExtra() override
[AI] Parses the extra (optional) field from the related media action, searching for a trigger string ...
MxResult AddToManager() override
[AI] Registers this presenter instance with the global or world's video manager (LegoVideoManager).
void RepeatingTickle() override
[AI] Handles the repeating tickle logic, ending the action if the associated duration is not indefini...
void ReadyTickle() override
[AI] Handles the transition to the ready state ("ReadyTickle") by consuming streamed path data,...
MxAtomId m_trigger
[AI] Atom identifier representing a trigger parsed from the extra string in the associated media acti...
void Destroy() override
[AI] Unregisters the presenter from the video manager, deallocates managed resources,...
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
void AddPath(LegoPathController *p_controller)
Adds a path controller to the world and calls its initialization with this.
Definition: legoworld.cpp:377
[AI] Atomized (unique) string identifier, managed by reference counting.
Definition: mxatom.h:124
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
virtual MxLong GetDuration()
[AI] Gets the duration for which this action is intended to run.
Definition: mxdsaction.cpp:39
MxU8 * GetData()
[AI] Returns a pointer to the start of the data payload. [AI]
Definition: mxdschunk.h:108
MxU16 GetChunkFlags()
[AI] Returns the chunk's flag bitfield. [AI]
Definition: mxdschunk.h:96
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...
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 Destroy() override
[AI] Cleans up internal resources and resets the presenter to an uninitialized state.
void EndAction() override
[AI] Ends the media playback action, releasing all resources, notifying listeners if necessary.
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
@ e_repeating
[AI] Presentation is repeating (e.g., looping media).
Definition: mxpresenter.h:28
@ e_starting
[AI] In the process of starting playback/presentation.
Definition: mxpresenter.h:26
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
Definition: mxpresenter.h:214
[AI] Represents a streamable chunk of data, typically sourced from a media buffer and designed for no...
Definition: mxstreamchunk.h:19
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
const char * g_strTRIGGERS_SOURCE
[AI] Name used to reference identifiers for possible event triggers or references to triggers sources...
Definition: define.cpp:113
#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
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
@ e_lowerCase2
[AI] Alternative or legacy lower case mode, functionally equivalent to e_lowerCase.
Definition: mxatom.h:109
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
Definition: mxautolock.h:5
#define DS_CHUNK_END_OF_STREAM
[AI] Flag bit indicating this chunk is the last in its stream.
Definition: mxdschunk.h:14
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
MxBool KeyValueStringParse(char *, const char *, const char *)
Searches p_string for a key command and copies its associated value to p_output.
Definition: mxutilities.cpp:85