Isle
Loading...
Searching...
No Matches
LegoPathController Class Reference

[AI] Manager for controlling actors' movement along predefined geometric paths. More...

#include <legopathcontroller.h>

Inheritance diagram for LegoPathController:
Collaboration diagram for LegoPathController:

Classes

struct  CtrlBoundary
 [AI] Helper structure for rapid lookups of controller-boundary pairs, often used for global or indexed access patterns across controllers. More...
 
struct  CtrlEdge
 [AI] Helper structure pairing controllers with edge references for global or fast access. More...
 

Public Member Functions

 LegoPathController ()
 [AI] Constructs a LegoPathController, initializing boundary and edge pointers to NULL and counts to zero. More...
 
 ~LegoPathController () override
 [AI] Destructor, unregisters itself from the tickle manager and releases all dynamically allocated path data. More...
 
MxResult Tickle () override
 [AI] Implements the tickle (per-frame update) callback for the controller. More...
 
const char * ClassName () const override
 [AI] Returns the class name for runtime type identification. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Checks inheritance by class name for type introspection. More...
 
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, applying a trigger. More...
 
virtual void Destroy ()
 [AI] Deinitializes path controller, releases all owned resources and unregisters from tickle manager. More...
 
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 segment transitions (e.g., for vehicles). More...
 
MxResult PlaceActor (LegoPathActor *p_actor, LegoAnimPresenter *p_presenter, Vector3 &p_position, Vector3 &p_direction)
 [AI] Places an actor using an animation presenter and direct position/direction data. More...
 
MxResult PlaceActor (LegoPathActor *p_actor)
 [AI] Registers an actor as controlled by this path controller without moving it to a specific boundary location, e.g., after controller change. More...
 
MxResult RemoveActor (LegoPathActor *p_actor)
 [AI] Removes an actor from the controller, detaches it from controlled boundaries, and clears associations. More...
 
void FUN_100468f0 (LegoAnimPresenter *p_presenter)
 [AI] Processes all boundaries except those with bit3 set, invoking FUN_10057fe0 for the provided animation presenter. More...
 
void FUN_10046930 (LegoAnimPresenter *p_presenter)
 [AI] Invokes FUN_100586e0 for each boundary, with the provided animation presenter. More...
 
MxResult FUN_10046b30 (LegoPathBoundary *&p_boundaries, MxS32 &p_numL)
 [AI] Provides current array of boundaries and count as output parameters, for external queries. More...
 
LegoPathBoundaryGetPathBoundary (const char *p_name)
 [AI] Searches for a path boundary by name among owned boundaries. More...
 
void Enable (MxBool p_enable)
 [AI] Enables or disables the controller's registration with the tickle manager, controlling per-frame updates. More...
 
void FUN_10046bb0 (LegoWorld *p_world)
 [AI] Assigns the provided world pointer to all struct triggers owned by this path controller. More...
 
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 sequences for an actor moving between boundaries. More...
 
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 container sequence. More...
 
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 updates parameters as needed. More...
 
MxBool ActorExists (LegoPathActor *p_actor)
 [AI] Checks whether an actor is contained in the controller's actor set. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Static Public Member Functions

static MxResult Init ()
 [AI] Static initializer for global controller boundary/edge arrays. More...
 
static MxResult Reset ()
 [AI] Resets (cleans up) global controller boundary/edge arrays allocated by Init(). More...
 
static LegoUnknown100db7f4GetControlEdgeA (MxS32 p_index)
 [AI] Provides static access to the edge at a given index in g_ctrlEdgesA. More...
 
static LegoPathBoundaryGetControlBoundaryA (MxS32 p_index)
 [AI] Provides static access to the boundary at given index in g_ctrlBoundariesA. More...
 
static LegoUnknown100db7f4GetControlEdgeB (MxS32 p_index)
 [AI] Provides static access to the edge at a given index in g_ctrlEdgesB. More...
 
static LegoPathBoundaryGetControlBoundaryB (MxS32 p_index)
 [AI] Provides static access to the boundary at given index in g_ctrlBoundariesB. More...
 

Detailed Description

[AI] Manager for controlling actors' movement along predefined geometric paths.

Handles path boundaries, connectivity, and the logic for actor transitions and obstacle detection. Registered as a tickle client for per-frame updates. [AI]

[AI] This class provides and maintains the runtime representation of path boundaries (track segments), structural triggers, and linkage edges. It manages actor attachments, movement placement along the path network, and supplies special path information to enable complex transitions between segments. Path data is read from script storage and is essential for AI pathfinding and animation coordination. [AI]

Note
[AI] Used heavily for high-level navigation in LEGO Island, such as vehicle/train movement, NPC walking, and special camera paths. [AI]

Definition at line 47 of file legopathcontroller.h.

Constructor & Destructor Documentation

◆ LegoPathController()

LegoPathController::LegoPathController ( )

[AI] Constructs a LegoPathController, initializing boundary and edge pointers to NULL and counts to zero.

[AI]

Definition at line 70 of file legopathcontroller.cpp.

◆ ~LegoPathController()

LegoPathController::~LegoPathController ( )
inlineoverride

[AI] Destructor, unregisters itself from the tickle manager and releases all dynamically allocated path data.

[AI]

Definition at line 93 of file legopathcontroller.h.

Member Function Documentation

◆ ActorExists()

MxBool LegoPathController::ActorExists ( LegoPathActor p_actor)
inline

[AI] Checks whether an actor is contained in the controller's actor set.

Parameters
p_actor[AI] Pointer to the actor to query.
Returns
[AI] TRUE if actor exists, FALSE otherwise.

Definition at line 282 of file legopathcontroller.h.

◆ ClassName()

const char * LegoPathController::ClassName ( ) const
overridevirtual

[AI] Returns the class name for runtime type identification.

[AI]

Returns
[AI] Static string: "LegoPathController". [AI]

Reimplemented from MxCore.

◆ Create()

MxResult LegoPathController::Create ( MxU8 p_data,
const Vector3 p_location,
const MxAtomId p_trigger 
)
virtual

[AI] Initializes the path controller from the provided binary data at the specified location, applying a trigger.

[AI]

Parameters
p_data[AI] Pointer to memory containing path controller serialized data.
p_location[AI] The world position for relocation of controller-linked objects.
p_trigger[AI] Atom ID used for signaling or associating with relevant path structures.
Returns
[AI] Result code indicating success or failure during data parsing/initialization.

Definition at line 84 of file legopathcontroller.cpp.

◆ Destroy()

void LegoPathController::Destroy ( )
virtual

[AI] Deinitializes path controller, releases all owned resources and unregisters from tickle manager.

[AI]

Definition at line 137 of file legopathcontroller.cpp.

◆ Enable()

void LegoPathController::Enable ( MxBool  p_enable)

[AI] Enables or disables the controller's registration with the tickle manager, controlling per-frame updates.

[AI]

Parameters
p_enable[AI] TRUE to enable, FALSE to disable. [AI]

Definition at line 416 of file legopathcontroller.cpp.

◆ FUN_100468f0()

void LegoPathController::FUN_100468f0 ( LegoAnimPresenter p_presenter)

[AI] Processes all boundaries except those with bit3 set, invoking FUN_10057fe0 for the provided animation presenter.

[AI]

Parameters
p_presenter[AI] Pointer to an animation presenter. [AI]

Definition at line 347 of file legopathcontroller.cpp.

◆ FUN_10046930()

void LegoPathController::FUN_10046930 ( LegoAnimPresenter p_presenter)

[AI] Invokes FUN_100586e0 for each boundary, with the provided animation presenter.

[AI]

Parameters
p_presenter[AI] Pointer to the animation presenter. [AI]

Definition at line 358 of file legopathcontroller.cpp.

◆ FUN_10046b30()

MxResult LegoPathController::FUN_10046b30 ( LegoPathBoundary *&  p_boundaries,
MxS32 p_numL 
)

[AI] Provides current array of boundaries and count as output parameters, for external queries.

[AI]

Parameters
p_boundaries[AI] Output: pointer set to internal array of boundaries. [AI]
p_numL[AI] Output: count of path boundaries. [AI]
Returns
[AI] Always returns SUCCESS.

Definition at line 385 of file legopathcontroller.cpp.

◆ FUN_10046bb0()

void LegoPathController::FUN_10046bb0 ( LegoWorld p_world)

[AI] Assigns the provided world pointer to all struct triggers owned by this path controller.

[AI]

Parameters
p_world[AI] Pointer to the LegoWorld object, set in all structs. [AI]

Definition at line 407 of file legopathcontroller.cpp.

◆ FUN_10048310()

MxResult LegoPathController::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 sequences for an actor moving between boundaries.

[AI]

Parameters
p_grec[AI] Edge container holding the resulting transition sequence.
p_oldPosition[AI] Source position.
p_oldDirection[AI] Source direction.
p_oldBoundary[AI] Boundary actor is moving from.
p_newPosition[AI] Destination position.
p_newDirection[AI] Destination direction.
p_newBoundary[AI] Boundary actor is moving to.
p_mask[AI] Path mask for allowed transitions (bitmask).
p_param9[AI] Out: will contain shortest path distance if provided.
Returns
[AI] SUCCESS if a route is computed, FAILURE otherwise.

Definition at line 745 of file legopathcontroller.cpp.

◆ FUN_1004a240()

MxS32 LegoPathController::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 container sequence.

[AI]

Parameters
p_grec[AI] Edge transition container (LegoPathEdgeContainer).
p_v1[AI] Output: next position vector for the actor.
p_v2[AI] Output: next direction vector for the actor.
p_f1[AI] Interpolation parameter or normalized distance along the transition.
p_edge[AI] Output: pointer to the next transition edge taken.
p_boundary[AI] Output: pointer to the target boundary.
Returns
[AI] 1 if the edge container is empty, 0 if a transition step was advanced.

Definition at line 933 of file legopathcontroller.cpp.

◆ FUN_1004a380()

MxResult LegoPathController::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 updates parameters as needed.

[AI]

Parameters
p_param1[AI] Reference vector for placement update.
p_param2[AI] Reference direction for placement update.
p_param3[AI] Array of three 3D float points used in intersection calculation.
p_boundary[AI] Output: chosen boundary for intersection, if any.
p_param5[AI] In/out intersection parameter: updated if intersection found.
Returns
[AI] SUCCESS if intersection found, FAILURE otherwise.

Definition at line 966 of file legopathcontroller.cpp.

◆ GetControlBoundaryA()

static LegoPathBoundary * LegoPathController::GetControlBoundaryA ( MxS32  p_index)
inlinestatic

[AI] Provides static access to the boundary at given index in g_ctrlBoundariesA.

Parameters
p_index[AI] The index of the control boundary to retrieve.
Returns
[AI] Pointer to the corresponding LegoPathBoundary.

Definition at line 308 of file legopathcontroller.h.

◆ GetControlBoundaryB()

static LegoPathBoundary * LegoPathController::GetControlBoundaryB ( MxS32  p_index)
inlinestatic

[AI] Provides static access to the boundary at given index in g_ctrlBoundariesB.

Parameters
p_index[AI] The index of the control boundary to retrieve.
Returns
[AI] Pointer to the corresponding LegoPathBoundary.

Definition at line 322 of file legopathcontroller.h.

◆ GetControlEdgeA()

static LegoUnknown100db7f4 * LegoPathController::GetControlEdgeA ( MxS32  p_index)
inlinestatic

[AI] Provides static access to the edge at a given index in g_ctrlEdgesA.

Parameters
p_index[AI] The index of the control edge to retrieve.
Returns
[AI] Pointer to the corresponding LegoUnknown100db7f4 object.

Definition at line 301 of file legopathcontroller.h.

◆ GetControlEdgeB()

static LegoUnknown100db7f4 * LegoPathController::GetControlEdgeB ( MxS32  p_index)
inlinestatic

[AI] Provides static access to the edge at a given index in g_ctrlEdgesB.

Parameters
p_index[AI] The index of the control edge to retrieve.
Returns
[AI] Pointer to the corresponding LegoUnknown100db7f4 object.

Definition at line 315 of file legopathcontroller.h.

◆ GetPathBoundary()

LegoPathBoundary * LegoPathController::GetPathBoundary ( const char *  p_name)

[AI] Searches for a path boundary by name among owned boundaries.

[AI]

Parameters
p_name[AI] Name to search for (case-insensitive). [AI]
Returns
[AI] Pointer to boundary or NULL if not found. [AI]

Definition at line 394 of file legopathcontroller.cpp.

◆ Init()

MxResult LegoPathController::Init ( )
static

[AI] Static initializer for global controller boundary/edge arrays.

Allocates the global lookup tables for controller-bounded objects.

Returns
[AI] SUCCESS on allocation, FAILURE if already initialized.

Definition at line 428 of file legopathcontroller.cpp.

◆ IsA()

MxBool LegoPathController::IsA ( const char *  p_name) const
overridevirtual

[AI] Checks inheritance by class name for type introspection.

[AI]

Parameters
p_nameClass name to check. [AI]
Returns
[AI] TRUE if class matches or inherited, else FALSE. [AI]

Reimplemented from MxCore.

◆ PlaceActor() [1/3]

MxResult LegoPathController::PlaceActor ( LegoPathActor p_actor)

[AI] Registers an actor as controlled by this path controller without moving it to a specific boundary location, e.g., after controller change.

[AI]

Parameters
p_actor[AI] The actor to register.
Returns
[AI] SUCCESS after registration.

Definition at line 315 of file legopathcontroller.cpp.

◆ PlaceActor() [2/3]

MxResult LegoPathController::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 segment transitions (e.g., for vehicles).

[AI]

Parameters
p_actor[AI] Pointer to the path actor to move.
p_name[AI] Name of the path boundary to use as source/destination.
p_src[AI] Index of the source edge on the boundary.
p_srcScale[AI] Scaled offset on the source edge (0..1), for fine placement.
p_dest[AI] Index of destination edge on the boundary.
p_destScale[AI] Scaled offset on the destination edge (0..1), for fine placement.
Returns
[AI] SUCCESS if actor was successfully placed, FAILURE otherwise.

Definition at line 201 of file legopathcontroller.cpp.

◆ PlaceActor() [3/3]

MxResult LegoPathController::PlaceActor ( LegoPathActor p_actor,
LegoAnimPresenter p_presenter,
Vector3 p_position,
Vector3 p_direction 
)

[AI] Places an actor using an animation presenter and direct position/direction data.

Used for initial placement or precise positioning by external systems. [AI]

Parameters
p_actor[AI] Pointer to the actor.
p_presenter[AI] Animation presenter used for visual/behavior state.
p_position[AI] Starting position in world coordinates.
p_direction[AI] Direction vector for initial movement or facing.
Returns
[AI] SUCCESS if placement succeeded, FAILURE if no boundary fits requirements.

Definition at line 241 of file legopathcontroller.cpp.

◆ RemoveActor()

MxResult LegoPathController::RemoveActor ( LegoPathActor p_actor)

[AI] Removes an actor from the controller, detaches it from controlled boundaries, and clears associations.

[AI]

Parameters
p_actor[AI] Actor to remove.
Returns
[AI] SUCCESS if the actor was detached from at least one boundary, FAILURE otherwise.

Definition at line 329 of file legopathcontroller.cpp.

◆ Reset()

MxResult LegoPathController::Reset ( )
static

[AI] Resets (cleans up) global controller boundary/edge arrays allocated by Init().

Returns
[AI] SUCCESS if cleanup was performed, FAILURE otherwise.

Definition at line 443 of file legopathcontroller.cpp.

◆ Tickle()

MxResult LegoPathController::Tickle ( )
overridevirtual

[AI] Implements the tickle (per-frame update) callback for the controller.

[AI]

[AI] Updates animation state for managed actors along the path. [AI]

Returns
[AI] Always returns SUCCESS. [AI]

Reimplemented from MxCore.

Definition at line 193 of file legopathcontroller.cpp.


The documentation for this class was generated from the following files: