1#ifndef __LEGONAVCONTROLLER_H
2#define __LEGONAVCONTROLLER_H
49 return "LegoNavController";
282 float CalculateNewVel(
float p_targetVel,
float p_currentVel,
float p_accel,
float p_time);
[AI] Handles user navigation input (keyboard and joystick) and determines avatar movement and directi...
int m_vMax
[AI] Current vertical axis control maximum (e.g., 480 for screen height).
float m_maxRotationalDeccel
[AI] Maximum allowed rotational deceleration.
MxResult ProcessJoystickInput(MxBool &p_und)
[AI] Processes current joystick/gamepad input and updates navigation targets and accelerations.
float m_maxLinearVel
[AI] Maximum allowed linear velocity.
void SetTargets(int p_hPos, int p_vPos, MxBool p_accel)
[AI] Set the horizontal/vertical target positions from input and optionally apply acceleration/dynami...
void ResetMaxLinearVel(MxFloat p_maxLinearVel)
[AI] Resets the maximum allowed linear velocity and marks controller as using custom parameters.
LegoNavController()
[AI] Constructs a navigation controller and registers it for input processing.
MxResult ProcessKeyboardInput()
[AI] Reads and processes keyboard navigation input to update velocity/acceleration targets.
void Reset()
[AI] Resets the internal navigation state and all navigation parameters to current defaults.
float CalculateNewTargetVel(int p_pos, int p_center, float p_max)
[AI] Translates control position into a new target velocity, applying deadzone and centering logic.
static float g_defminLinearAccel
[AI] Application-global default min linear acceleration.
static MxS32 GetNumLocations()
[AI] Static: Retrieves the number of named locations registered in the navigation system.
float m_maxRotationalVel
[AI] Maximum allowed rotational velocity.
static LegoLocation * GetLocation(MxU32 p_location)
[AI] Static: Retrieves the pointer to a LegoLocation struct by its index.
float m_rotationalVel
[AI] Current rotational velocity.
const char * ClassName() const override
[AI] Returns this class's string name: "LegoNavController".
static float g_defminRotationalAccel
[AI] Application-global default min rotational acceleration.
static void GetDefaults(int *p_dz, float *p_lv, float *p_rv, float *p_la, float *p_ra, float *p_ld, float *p_rd, float *p_lmina, float *p_rmina, float *p_rs, MxBool *p_urs)
[AI] Static: Retrieves current global default navigation parameter values.
static float g_defmaxLinearDeccel
[AI] Application-global default max linear deceleration.
void ResetMaxLinearDeccel(MxFloat p_maxLinearDeccel)
[AI] Resets the maximum allowed linear deceleration and marks controller as using custom parameters.
void SetLinearVel(MxFloat p_linearVel)
[AI] Sets the current linear velocity for user navigation.
MxBool m_unk0x5d
[AI] Indicates that Notify() should inject a one-time movement/turn based on special debug or event t...
MxFloat GetMaxLinearVel()
[AI] Returns the current maximum linear velocity (units per sec).
static float g_defrotSensitivity
[AI] Application-global default rotation sensitivity.
static float g_defzeroThreshold
[AI] Application-global default zero threshold value.
MxBool m_useRotationalVel
[AI] If TRUE, rotation is determined by velocity (dynamic turning); if FALSE, snaps turn instantly.
static float g_defmaxRotationalVel
[AI] Application-global default max rotational velocity.
MxBool m_isAccelerating
[AI] TRUE if last input was an active movement/acceleration (vs.
void SetControlMax(int p_hMax, int p_vMax)
[AI] Set limits for horizontal and vertical input controls, typically reflecting window/screen size.
void SetDeadZone(MxS32 p_deadZone)
[AI] Sets the deadzone radius for input processing (region within which inputs are ignored).
float m_minRotationalAccel
[AI] Minimum allowed rotational acceleration.
void SetToDefaultParams()
[AI] Resets current navigation parameters to globally set defaults.
static float g_defmaxRotationalAccel
[AI] Application-global default max rotational acceleration.
float m_unk0x68
[AI] [Usage: debug/direct movement] Rotational offset (degrees), to next direction vector after Notif...
float CalculateNewVel(float p_targetVel, float p_currentVel, float p_accel, float p_time)
[AI] Calculates the next velocity given a target velocity, current velocity, acceleration,...
~LegoNavController() override
[AI] Destroys the controller and unregisters it from input processing.
float m_minLinearAccel
[AI] Minimum allowed linear acceleration.
float m_rotationalAccel
[AI] Current rotational acceleration used to interpolate rotational velocity.
static MxResult UpdateLocation(MxU32 p_location)
[AI] Static: Changes the current world/camera location to the specified index in the location registr...
MxBool m_trackDefault
[AI] TRUE if navigation parameters should match the application defaults; FALSE to allow per-instance...
float m_maxLinearDeccel
[AI] Maximum allowed linear deceleration (negative accel).
MxFloat GetMaxLinearAccel()
[AI] Returns the current maximum linear acceleration.
void SetTrackDefault(MxS32 p_trackDefault)
[AI] Marks the controller to track global/default navigation parameters rather than custom overrides.
float m_maxLinearAccel
[AI] Maximum allowed linear acceleration.
static float g_defmaxLinearVel
[AI] Application-global default max linear velocity.
static float g_defmaxRotationalDeccel
[AI] Application-global default max rotational deceleration.
int m_deadZone
[AI] Deadzone value; minimum distance input must be from axis center to register as movement.
float m_targetLinearVel
[AI] Target value for linear velocity, used for acceleration smoothing.
MxFloat GetMaxLinearDeccel()
[AI] Returns the current maximum linear deceleration.
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,...
static int g_defdeadZone
[AI] Application-global default deadzone value.
void ResetMaxLinearAccel(MxFloat p_maxLinearAccel)
[AI] Resets the maximum allowed linear acceleration and marks controller as using custom parameters.
float m_rotSensitivity
[AI] Sensitivity multiplier for rotation (applies if useRotationalVel is FALSE).
MxFloat GetRotationalVel()
[AI] Returns the current rotational velocity (degrees per sec).
MxTime m_lastTime
[AI] Tracks time of the last navigation tick for smooth movement with deltaTime.
static void SetDefaults(int p_dz, float p_lv, float p_rv, float p_la, float p_ra, float p_ld, float p_rd, float p_lmina, float p_rmina, float p_rs, MxBool p_urs)
[AI] Static: Sets new global defaults for navigation parameters.
MxBool IsA(const char *p_name) const override
[AI] Tests if this object is of type "LegoNavController" or any MxCore ancestor.
int m_hMax
[AI] Current horizontal axis control maximum (e.g., 640 for screen width).
float m_unk0x64
[AI] [Usage: debug/direct movement] Linear velocity applied to next position after Notify key event.
int GetDefaultDeadZone()
[AI] Returns the application-global default deadzone value for navigation input processing.
float CalculateNewAccel(int p_pos, int p_center, float p_max, int p_min)
[AI] Computes new acceleration value based on position, axis center, maximum and minimum acceleration...
MxFloat GetLinearVel()
[AI] Returns the current linear velocity (units per sec).
float m_targetRotationalVel
[AI] Target value for rotational velocity, used for smoothing.
float m_maxRotationalAccel
[AI] Maximum allowed rotational acceleration.
float m_linearVel
[AI] Current linear velocity.
static float g_defmaxLinearAccel
[AI] Application-global default max linear acceleration.
float m_zeroThreshold
[AI] Threshold below which movements are considered negligible/zero.
MxLong Notify(MxParam &p_param) override
[AI] Responds to notifications, including keypresses and special debug shortcuts for avatar control,...
float m_unk0x60
[AI] [Usage: debug/direct movement] Y-offset applied to next position after Notify key event.
float m_linearAccel
[AI] Current linear acceleration used to interpolate linear velocity.
static MxBool g_defuseRotationalVel
[AI] Application-global default for useRotationalVel.
[AI] Base virtual class for all Mindscape engine (Mx) objects.
virtual MxBool IsA(const char *p_name) const
[AI] Checks whether this object's class type or parents match the given name.
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Data structure representing a named spatial location and orientation in the LEGO Island world,...