Isle
Loading...
Searching...
No Matches
legopathcontroller.h
Go to the documentation of this file.
1#ifndef LEGOPATHCONTROLLER_H
2#define LEGOPATHCONTROLLER_H
3
4#include "decomp.h"
6#include "legopathactor.h"
7#include "legopathboundary.h"
8#include "legopathstruct.h"
9#include "mxstl/stlcompat.h"
10
16
22 MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
23 {
24 return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
25 }
26};
27
32typedef set<LegoPathCtrlEdge*, LegoPathCtrlEdgeCompare> LegoPathCtrlEdgeSet;
33
35class LegoWorld;
36class MxAtomId;
37class Vector3;
38
47class LegoPathController : public MxCore {
48public:
53 struct CtrlBoundary {
58 {
61 }
62
65 };
66
71 struct CtrlEdge {
76 {
78 m_edge = NULL;
79 }
80
83 };
84
89
93 ~LegoPathController() override { Destroy(); }
94
100 MxResult Tickle() override;
101
106 const char* ClassName() const override;
107
113 MxBool IsA(const char* p_name) const override;
114
122 virtual MxResult Create(MxU8* p_data, const Vector3& p_location, const MxAtomId& p_trigger);
123
127 virtual void Destroy();
128
140 LegoPathActor* p_actor,
141 const char* p_name,
142 MxS32 p_src,
143 float p_srcScale,
144 MxS32 p_dest,
145 float p_destScale
146 );
147
157 LegoPathActor* p_actor,
158 LegoAnimPresenter* p_presenter,
159 Vector3& p_position,
160 Vector3& p_direction
161 );
162
169
176
181 void FUN_100468f0(LegoAnimPresenter* p_presenter);
182
187 void FUN_10046930(LegoAnimPresenter* p_presenter);
188
195 MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL);
196
202 LegoPathBoundary* GetPathBoundary(const char* p_name);
203
208 void Enable(MxBool p_enable);
209
214 void FUN_10046bb0(LegoWorld* p_world);
215
230 LegoPathEdgeContainer* p_grec,
231 const Vector3& p_oldPosition,
232 const Vector3& p_oldDirection,
233 LegoPathBoundary* p_oldBoundary,
234 const Vector3& p_newPosition,
235 const Vector3& p_newDirection,
236 LegoPathBoundary* p_newBoundary,
237 LegoU8 p_mask,
238 MxFloat* p_param9
239 );
240
252 LegoPathEdgeContainer& p_grec,
253 Vector3& p_v1,
254 Vector3& p_v2,
255 float p_f1,
256 LegoUnknown100db7f4*& p_edge,
257 LegoPathBoundary*& p_boundary
258 );
259
270 Vector3& p_param1,
271 Vector3& p_param2,
272 Mx3DPointFloat* p_param3,
273 LegoPathBoundary*& p_boundary,
274 MxFloat& p_param5
275 );
276
282 MxBool ActorExists(LegoPathActor* p_actor) { return m_actors.find(p_actor) == m_actors.end() ? FALSE : TRUE; }
283
288 static MxResult Init();
289
294 static MxResult Reset();
295
301 static LegoUnknown100db7f4* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; }
302
308 static LegoPathBoundary* GetControlBoundaryA(MxS32 p_index) { return g_ctrlBoundariesA[p_index].m_boundary; }
309
315 static LegoUnknown100db7f4* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; }
316
322 static LegoPathBoundary* GetControlBoundaryB(MxS32 p_index) { return g_ctrlBoundariesB[p_index].m_boundary; }
323
324private:
328 void FUN_10046970();
329
335 MxResult Read(LegoStorage* p_storage);
336
342 MxResult ReadStructs(LegoStorage* p_storage);
343
349 MxResult ReadEdges(LegoStorage* p_storage);
350
356 MxResult ReadBoundaries(LegoStorage* p_storage);
357
364 static MxResult ReadVector(LegoStorage* p_storage, Mx3DPointFloat& p_vec);
365
372 static MxResult ReadVector(LegoStorage* p_storage, Mx4DPointFloat& p_vec);
373
381 static MxU32 IsBetween(MxFloat p_v, MxFloat p_a, MxFloat p_b);
382
391 static MxU32 FUN_100c17a0(MxFloat p_v1, MxFloat p_v2, MxFloat p_a, MxFloat p_b);
392
393 LegoPathBoundary* m_boundaries;
394 LegoPathCtrlEdge* m_edges;
395 Mx3DPointFloat* m_unk0x10;
396 LegoPathStruct* m_structs;
397 MxU16 m_numL;
398 MxU16 m_numE;
399 MxU16 m_numN;
400 MxU16 m_numT;
401 LegoPathCtrlEdgeSet m_pfsE;
402 LegoPathActorSet m_actors;
403
404 // Names verified by BETA10
405
406 static CtrlBoundary* g_ctrlBoundariesA;
407 static CtrlEdge* g_ctrlEdgesA;
408 static const char* g_unk0x100f42f0[];
409 static const char* g_unk0x100f4330[];
410 static CtrlBoundary* g_ctrlBoundariesB;
411 static CtrlEdge* g_ctrlEdgesB;
412};
413
414#endif // LEGOPATHCONTROLLER_H
[AI] Handles playback and synchronization of animated LEGO objects, including variable substitution,...
[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] Manager for controlling actors' movement along predefined geometric paths.
MxBool ActorExists(LegoPathActor *p_actor)
[AI] Checks whether an actor is contained in the controller's actor set.
void FUN_100468f0(LegoAnimPresenter *p_presenter)
[AI] Processes all boundaries except those with bit3 set, invoking FUN_10057fe0 for the provided anim...
MxResult FUN_10046b30(LegoPathBoundary *&p_boundaries, MxS32 &p_numL)
[AI] Provides current array of boundaries and count as output parameters, for external queries.
MxResult Tickle() override
[AI] Implements the tickle (per-frame update) callback for the controller.
LegoPathBoundary * GetPathBoundary(const char *p_name)
[AI] Searches for a path boundary by name among owned boundaries.
static MxResult Init()
[AI] Static initializer for global controller boundary/edge arrays.
static LegoPathBoundary * GetControlBoundaryA(MxS32 p_index)
[AI] Provides static access to the boundary at given index in g_ctrlBoundariesA.
virtual void Destroy()
[AI] Deinitializes path controller, releases all owned resources and unregisters from tickle manager.
MxResult RemoveActor(LegoPathActor *p_actor)
[AI] Removes an actor from the controller, detaches it from controlled boundaries,...
MxBool IsA(const char *p_name) const override
[AI] Checks inheritance by class name for type introspection.
MxResult PlaceActor(LegoPathActor *p_actor, const char *p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, float p_destScale)
[AI] Places an actor on a boundary at given source/destination edge indices, commonly for track segme...
MxResult FUN_10048310(LegoPathEdgeContainer *p_grec, const Vector3 &p_oldPosition, const Vector3 &p_oldDirection, LegoPathBoundary *p_oldBoundary, const Vector3 &p_newPosition, const Vector3 &p_newDirection, LegoPathBoundary *p_newBoundary, LegoU8 p_mask, MxFloat *p_param9)
[AI] Complex function performing path transition resolution; computes possible edge transition sequen...
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,...
~LegoPathController() override
[AI] Destructor, unregisters itself from the tickle manager and releases all dynamically allocated pa...
static MxResult Reset()
[AI] Resets (cleans up) global controller boundary/edge arrays allocated by Init().
MxResult FUN_1004a380(Vector3 &p_param1, Vector3 &p_param2, Mx3DPointFloat *p_param3, LegoPathBoundary *&p_boundary, MxFloat &p_param5)
[AI] Finds earliest intersection and placement on a valid boundary for the provided vectors and updat...
MxS32 FUN_1004a240(LegoPathEdgeContainer &p_grec, Vector3 &p_v1, Vector3 &p_v2, float p_f1, LegoUnknown100db7f4 *&p_edge, LegoPathBoundary *&p_boundary)
[AI] Computes path vector and orientation for an actor given a transition along the resolved edge con...
LegoPathController()
[AI] Constructs a LegoPathController, initializing boundary and edge pointers to NULL and counts to z...
const char * ClassName() const override
[AI] Returns the class name for runtime type identification.
static LegoPathBoundary * GetControlBoundaryB(MxS32 p_index)
[AI] Provides static access to the boundary at given index in g_ctrlBoundariesB.
void Enable(MxBool p_enable)
[AI] Enables or disables the controller's registration with the tickle manager, controlling per-frame...
void FUN_10046bb0(LegoWorld *p_world)
[AI] Assigns the provided world pointer to all struct triggers owned by this path controller.
static LegoUnknown100db7f4 * GetControlEdgeB(MxS32 p_index)
[AI] Provides static access to the edge at a given index in g_ctrlEdgesB.
void FUN_10046930(LegoAnimPresenter *p_presenter)
[AI] Invokes FUN_100586e0 for each boundary, with the provided animation presenter.
static LegoUnknown100db7f4 * GetControlEdgeA(MxS32 p_index)
[AI] Provides static access to the edge at a given index in g_ctrlEdgesA.
[AI] Represents a trigger/control element in the LEGO world's path system, linked logically to the wo...
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
[AI] 4D point class for floating point values.
Definition: mxgeometry4d.h:18
[AI] Atomized (unique) string identifier, managed by reference counting.
Definition: mxatom.h:124
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
[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 COMPARE_POINTER_TYPE
set< LegoPathActor *, LegoPathActorSetCompare > LegoPathActorSet
[AI] Defines a set of LegoPathActor pointers, ordered by pointer value using LegoPathActorSetCompare.
set< LegoPathCtrlEdge *, LegoPathCtrlEdgeCompare > LegoPathCtrlEdgeSet
[AI] Set of pointers to control edges, ordered using LegoPathCtrlEdgeCompare.
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
unsigned char LegoU8
[AI] Unsigned 8-bit integer type used throughout LEGO Island.
Definition: legotypes.h:47
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
float MxFloat
[AI]
Definition: mxtypes.h:68
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
[AI] STL compatibility layer header to provide consistent STL (Standard Template Library) types and a...
[AI] Helper structure for rapid lookups of controller-boundary pairs, often used for global or indexe...
LegoPathBoundary * m_boundary
[AI] Associated path boundary within the controller. [AI]
CtrlBoundary()
[AI] Initializes structure by nullifying pointers.
LegoPathController * m_controller
[AI] Pointer to owning path controller. [AI]
[AI] Helper structure pairing controllers with edge references for global or fast access.
CtrlEdge()
[AI] Initializes structure by nullifying pointers.
LegoUnknown100db7f4 * m_edge
[AI] Reference to a specific edge, typically a segment connector or trigger. [AI]
LegoPathController * m_controller
[AI] Pointer to owning path controller. [AI]
[AI] Comparator functor for LegoPathCtrlEdge pointer sets.
MxU32 operator()(const LegoPathCtrlEdge *p_lhs, const LegoPathCtrlEdge *p_rhs) const
[AI] Controller-specific edge used in path navigation.
[AI] Container for path boundary edges, also stores position, direction, and flags.
[AI] Represents an advanced edge in the LEGO Island geometry system, with direction,...