31#define DTOR(angle) ((angle) * M_PI / 180.)
258 MxTrace(
"Intersect returned -1\n");
290 if (var && var[0] != 0) {
464 for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) {
465 if ((*itap)->VTable0x94(p_v1, p_v2, p_f1, p_f2, p_v3)) {
473 for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) {
474 if (plpas.find(*itpa) != plpas.end()) {
495 list<LegoPathBoundary*>& p_boundaries,
511 p_boundaries.push_back(p_boundary);
518 for (
MxS32 i = 0; i < numEdges; i++) {
522 if (boundary !=
NULL) {
523 list<LegoPathBoundary*>::const_iterator it;
525 for (it = p_boundaries.begin(); !(it == p_boundaries.end()); it++) {
526 if ((*it) == boundary) {
531 if (it == p_boundaries.end()) {
532 result =
FUN_1002edd0(p_boundaries, boundary, p_v1, p_v2, p_f1, p_f2, p_v3, p_und + 1);
559 len = sqrt((
double) len);
563 list<LegoPathBoundary*> boundaries;
591 MxS32 src = atoi(token);
594 float srcScale = atof(token);
597 MxS32 dest = atoi(token);
600 float destScale = atof(token);
604 world->
PlaceActor(
this, name, src, srcScale, dest, destScale);
716 p_und2 = rand() % p_und2 + 1;
const float & Radius() const
[AI] Const accessor for the sphere radius.
@ c_brickster
The Brickster ([AI])
@ c_pepper
Pepper Roni ([AI])
virtual MxU8 GetActorId()
[AI] Gets this actor's numeric ID, corresponding to a known enumeration/actor.
void ParseAction(char *p_extra) override
[AI] Parses an action string and applies parsed behaviors to the actor.
LegoCacheSound * Play(const char *p_key, const char *p_name, MxBool p_looping)
[AI] Plays a sound identified by key, with the given playback name and looping flag.
void FUN_10012290(float p_angle)
Rotates the current camera transformation by a given angle around the Z axis.
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.
Mx3DPointFloat GetWorldDirection()
[AI] Gets the normalized world-space direction vector, optionally updating from ROI....
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
void FUN_10010c30()
[AI] Updates the camera transformation when this entity is the camera target. Used after movement or ...
MxBool m_cameraFlag
[AI] Set to TRUE if this entity is currently the camera target. [AI]
MxFloat m_worldSpeed
[AI] World-relative speed (can affect animation/movement logic). [AI]
LegoROI * m_roi
[AI] Pointer to this entity's currently assigned ROI (3D instance in the world). [AI]
Mx3DPointFloat GetWorldUp()
[AI] Gets the normalized world-space up vector, optionally updating from ROI. [AI]
MxBool GetCameraFlag()
[AI] Returns whether this entity is flagged as camera (affects world/camera synchronization)....
Mx3DPointFloat GetWorldPosition()
[AI] Gets the world-space position vector, optionally updating from ROI. [AI]
[AI] Handles user navigation input (keyboard and joystick) and determines avatar movement and directi...
void ResetMaxLinearVel(MxFloat p_maxLinearVel)
[AI] Resets the maximum allowed linear velocity and marks controller as using custom parameters.
void SetLinearVel(MxFloat p_linearVel)
[AI] Sets the current linear velocity for user navigation.
MxFloat GetMaxLinearVel()
[AI] Returns the current maximum linear velocity (units per sec).
MxBool CalculateNewPosDir(const Vector3 &p_curPos, const Vector3 &p_curDir, Vector3 &p_newPos, Vector3 &p_newDir, const Vector3 *p_und)
[AI] Calculates the new position and direction vectors based on input, current velocity,...
MxFloat GetRotationalVel()
[AI] Returns the current rotational velocity (degrees per sec).
MxFloat GetLinearVel()
[AI] Returns the current linear velocity (units per sec).
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
virtual MxResult VTable0x80(const Vector3 &p_point1, Vector3 &p_point2, Vector3 &p_point3, Vector3 &p_point4)
[AI] Calculates path interpolation for a set of points, updates state for path animation,...
MxFloat m_actorTime
[AI] Animation time for current path segment. [AI]
virtual MxResult VTable0x88(LegoPathBoundary *p_boundary, float p_time, LegoEdge &p_srcEdge, float p_srcScale, LegoUnknown100db7f4 &p_destEdge, float p_destScale)
[AI] Moves the actor between two edges across a boundary, recalculates placement and orientation.
virtual void Animate(float p_time)
[AI] Per-frame animation update.
MxU32 GetActorState()
[AI] Gets the current navigation/animation state of the actor.
virtual MxU32 VTable0x90(float, Matrix4 &)
[AI] Placeholder for custom logic during per-timestep simulation for non-user-controlled animation.
LegoUnknown100db7f4 * m_destEdge
[AI] Current or target edge for path traversal. [AI]
virtual MxU32 VTable0x6c(LegoPathBoundary *p_boundary, Vector3 &p_v1, Vector3 &p_v2, float p_f1, float p_f2, Vector3 &p_v3)
[AI] Trace movement or collision through presenters (edge test), then through other actors.
MxFloat m_unk0x144
[AI] Damping factor for velocity after collision ("bounce" friction). [AI]
virtual MxS32 VTable0x8c(float p_time, Matrix4 &p_transform)
[AI] Advance actor's position/state along the path for a given timeslice.
virtual void SwitchBoundary(LegoPathBoundary *&p_boundary, LegoUnknown100db7f4 *&p_edge, float &p_unk0xe4)
[AI] Switches current path boundary and destination edge, typically called on transitions or respawns...
LegoPathBoundary * m_boundary
[AI] Current boundary the actor is navigating on. [AI]
MxU32 m_actorState
[AI] State and flags bitfield for path following logic. [AI]
MxFloat m_unk0x7c
[AI] Interpolator/progress state along curve segment. [AI]
MxFloat m_unk0xe4
[AI] Position scalar on destination edge (0-1 across the edge). [AI]
virtual void SetUserNavFlag(MxBool p_userNavFlag)
[AI] Sets whether the actor is controlled by user navigation.
void ParseAction(char *p_extra) override
[AI] Parses a set of key-value action commands and configures path navigation and collision for this ...
MxFloat m_unk0x140
[AI] Scaling factor for fallback/collision response logic. [AI]
virtual void VTable0x74(Matrix4 &p_transform)
[AI] Updates the ROI's transformation (typically matrix) with new values, applies world position/orie...
MxS32 m_unk0x14c
[AI] Rolling angle delta (variant for camera logic). [AI]
LegoPathController * m_pathController
[AI] Path controller/manages permitted boundaries for transitions. [AI]
MxU32 FUN_1002edd0(list< LegoPathBoundary * > &p_boundaries, LegoPathBoundary *p_boundary, Vector3 &p_v1, Vector3 &p_v2, float p_f1, float p_f2, Vector3 &p_v3, MxS32 p_und)
[AI] Recursively checks boundaries for collisions or collision path propagation up to a certain recur...
@ c_initial
[AI] Default state upon creation or reset. [AI]
@ c_noCollide
[AI] Disables collision for this actor (e.g. ghosts, debug). [AI]
MxU8 m_unk0x148
[AI] Angle/animation mode for rolling/camera tilting. [AI]
virtual MxResult VTable0x9c()
[AI] Handles exit transition and next-edge search logic; also used for collision reaction and fallbac...
virtual MxResult VTable0x84(LegoPathBoundary *p_boundary, float p_time, Vector3 &p_p1, Vector3 &p_p4, LegoUnknown100db7f4 &p_destEdge, float p_destScale)
[AI] Moves actor to a destination edge.
MxMatrix m_unk0xec
[AI] World-to-local transformation matrix for this actor/ROI. [AI]
virtual void VTable0xa8()
[AI] Re-applies transform to ROI, updates camera if needed, and processes per-actor tick actions.
MxBool m_userNavFlag
[AI] TRUE if this actor is currently user/player controlled. [AI]
LegoPathEdgeContainer * m_grec
[AI] Edge/boundary helper for tracking transitions and stateful animation. [AI]
void PlaceActor(LegoNamedPlane &p_namedPlane)
[AI] Places this actor into the world at the given plane's name, location, and orientation.
void UpdatePlane(LegoNamedPlane &p_namedPlane)
[AI] Updates a named plane to match this actor's world position, direction, and up vector.
LegoUnknown m_unk0x8c
[AI] Helper object for path curve interpolation and evaluation. [AI]
MxFloat m_unk0x150
[AI] Scalar factor for camera turn velocity logic. [AI]
virtual void VTable0xa4(MxBool &p_und1, MxS32 &p_und2)
[AI] Returns information depending on actor type.
MxBool m_collideBox
[AI] Use bounding-box for more accurate collision. [AI]
virtual MxS32 VTable0x68(Vector3 &p_v1, Vector3 &p_v2, Vector3 &p_v3)
[AI] Checks for collision/intersection with boundaries, geometry, and other actors along a traced seg...
LegoPathActor()
[AI] Initializes the path actor, setting up default state and references. [AI]
virtual MxResult HitActor(LegoPathActor *, MxBool)
[AI] Handles logic when this actor hits (collides with) another path actor; can be overridden for cus...
MxBool m_unk0xe9
[AI] Stores latest intersection/collision status/type. [AI]
MxFloat m_BADuration
[AI] Duration of current Bezier arc (distance along path/current edge). [AI]
MxFloat m_lastTime
[AI] Time of last update (used for delta calculations). [AI]
~LegoPathActor() override
[AI] Destructor, cleans up allocated containers. [AI]
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
void FUN_100575b0(Vector3 &p_point1, Vector3 &p_point2, LegoPathActor *p_actor)
[AI] Handles processing path triggers along this boundary as an actor moves from p_point1 to p_point2...
LegoAnimPresenterSet & GetPresenters()
[AI] Direct access to the animation presenter set for this boundary.
LegoPathActorSet & GetActors()
[AI] Direct access to the actor set for this boundary.
MxResult AddActor(LegoPathActor *p_actor)
[AI] Adds the given actor to this path boundary and sets its boundary pointer.
void SwitchBoundary(LegoPathActor *p_actor, LegoPathBoundary *&p_boundary, LegoUnknown100db7f4 *&p_edge, float &p_unk0xe4)
[AI] Switches the boundary that the actor is associated with based on edge traversal.
MxU32 Intersect(float p_scale, Vector3 &p_point1, Vector3 &p_point2, Vector3 &p_point3, LegoUnknown100db7f4 *&p_edge)
[AI] Tests for intersection between a path and this boundary; finds the first edge hit and intersecti...
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...
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
LegoU32 FUN_100a9410(Vector3 &p_v1, Vector3 &p_v2, float p_f1, float p_f2, Vector3 &p_v3, LegoBool p_collideBox)
[AI] Tests for collision along or within sphere/box, and computes intersection point as needed.
LegoCacheSoundManager * GetCacheSoundManager()
[AI] Returns the cache sound manager used to cache and reuse sound effects.
LegoResult FUN_1009a1e0(float p_f1, Matrix4 &p_mat, Vector3 &p_v, LegoU32 p_und)
[AI] Evaluates the curve and its tangent at p_f1 and computes the local orthonormal frame.
void FUN_1009a140(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, const Vector3 &p_point4)
[AI] Configure internal curve control points.
LegoU8 GetNumEdges()
[AI] Returns the number of edge elements assigned to this face.
LegoUnknown100db7f4 ** GetEdges()
[AI] Gets the array of pointers to the edge objects that form this face.
const LegoChar * GetName()
[AI] Returns the name string of this edge, typically used for debugging and lookup.
Mx4DPointFloat * GetUnknown0x14()
[AI] Returns a pointer to the cached 4D normal or reference plane for the edge.
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
MxResult PlaceActor(LegoPathActor *p_actor, const char *p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, float p_destScale)
Places an actor along a path, from source to destination, using named references and scaling.
LegoCameraController * GetCameraController()
Returns the current camera controller for the world.
4x4 Matrix class with virtual interface for manipulation and transformation.
virtual void SetIdentity()
Sets this matrix to identity (diagonal 1, others 0).
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
const char * GetVariable(const char *p_key)
Returns the value for the variable with a given key, or an empty string if not found.
const BoundingSphere & GetWorldBoundingSphere() const override
Returns the object's bounding sphere in world coordinates.
const float * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
const float * GetWorldDirection() const
Returns a pointer to the world direction vector (forward axis) from the transformation matrix.
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
void WrappedSetLocalTransform(const Matrix4 &p_transform)
Wraps SetLocalTransform, for possible override or interface uniformity.
virtual void VTable0x14()
[AI] Calls VTable0x1c().
void FUN_100a58f0(const Matrix4 &p_transform)
Assigns the given matrix as the local-to-world transformation and enables some internal flags.
void UpdateTransformationRelativeToParent(const Matrix4 &p_transform)
Calculates and updates the world transform relative to this object's parent, then calls UpdateWorldDa...
unsigned char GetVisibility()
[AI] Returns the visibility flag; true if visible, false if hidden.
virtual int Unitize()
[AI] Scales the vector so its norm is 1 (unit vector).
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
float LenSquared() const override
[AI] Computes the squared magnitude (x^2 + y^2 + z^2) of this vector.
virtual void EqualsCross(const Vector3 &p_a, const Vector3 &p_b)
[AI] Sets this vector to be the cross product of p_a and p_b.
#define DECOMP_SIZE_ASSERT(T, S)
const char * g_strPATH
[AI] Name of a path for moving actors, objects or camera in the world scripting system.
const char * g_parseExtraTokens
[AI] Delimiter tokens for parsing extra parameters in scripts or command strings.
const char * g_strPERMIT_NAVIGATE
[AI] Script key for allowing or restricting player/entity navigation in a context.
const char * g_strCOLLIDEBOX
[AI] Denotes the collision box; used to specify bounding volume for collision in the world/entities.
const char * g_strHIT_WALL_SOUND
[AI] Variable table name for the wall hit sound [AI]
MxLong g_unk0x100f3308
[AI] Timer for wall hit sound playback throttling in navigation [AI]
const char * g_strHIT_WALL_SOUND
[AI] Variable table name for the wall hit sound [AI]
MxLong g_unk0x100f3308
[AI] Timer for wall hit sound playback throttling in navigation [AI]
set< LegoAnimPresenter *, LegoAnimPresenterSetCompare > LegoAnimPresenterSet
[AI] Defines a set of LegoAnimPresenter pointers, ordered by pointer value using LegoAnimPresenterSet...
set< LegoPathActor *, LegoPathActorSetCompare > LegoPathActorSet
[AI] Defines a set of LegoPathActor pointers, ordered by pointer value using LegoPathActorSetCompare.
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
long LegoS32
[AI] Signed 32-bit integer type for cross-platform compatibility.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
LegoSoundManager * SoundManager()
[AI] Accessor for the game's LegoSoundManager subsystem from the global LegoOmni instance....
void SetUserActor(LegoPathActor *p_userActor)
[AI] Sets the user-controlled LegoPathActor in the engine.
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
LegoNavController * NavController()
[AI] Accessor for the navigation controller, managing player/camera navigation. [AI]
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
MxTimer * Timer()
[AI] Returns the global simulation timer.
MxVariableTable * VariableTable()
[AI] Returns the variable table used for script variables and global key/value state.
MxBool KeyValueStringParse(char *, const char *, const char *)
Searches p_string for a key command and copies its associated value to p_output.
[AI] Represents an edge in the LEGO world geometry graph.
Vector3 * CWVertex(LegoWEEdge &p_face)
[AI] Returns the "clockwise" endpoint of this edge with respect to a given face.
Vector3 * CCWVertex(LegoWEEdge &p_face)
[AI] Returns the "counterclockwise" endpoint of this edge with respect to a given face.
[AI] Represents a named 3D plane with orientation and position, used to describe places or camera tar...
void SetUp(const Mx3DPointFloat &p_up)
[AI] Set the "up" vector of the plane.
const char * GetName() const
[AI] Default destructor (implementation likely trivial).
void SetName(const char *p_name)
[AI] Set the name identifier for this plane.
const Mx3DPointFloat & GetPosition()
[AI] Get the 3D position of this plane in world coordinates.
MxBool IsPresent()
[AI] Determines whether the plane instance is valid (present) based on its name.
const Mx3DPointFloat & GetDirection()
[AI] Get the normalized direction (forward) vector of the plane.
const Mx3DPointFloat & GetUp()
[AI] Get the normalized "up" vector of the plane, defining its orientation.
void SetDirection(const Mx3DPointFloat &p_direction)
[AI] Set the direction (forward) vector of the plane.
void SetPosition(const Mx3DPointFloat &p_position)
[AI] Set the 3D position of the plane.
[AI] Container for path boundary edges, also stores position, direction, and flags.
MxU32 GetBit1()
[AI] Query if the c_bit1 flag is set.
[AI] Represents an advanced edge in the LEGO Island geometry system, with direction,...
LegoWEEdge * OtherFace(LegoWEEdge *p_other)
[AI] Returns the opposite face pointer to the one passed in.
LegoResult FUN_1002ddc0(LegoWEEdge &p_f, Vector3 &p_point) const
[AI] Calculates the edge normal for use from the given face, negating it if called from faceA.
#define LERP3(to, v0, v1, t)