35#define VK_OEM_MINUS 0xBD
46#define DTOR(angle) ((angle) * M_PI / 180.)
160 if (
VideoManager()->GetVideoParam().Flags().GetFullScreen()) {
247 if (p_accel !=
FALSE) {
265 int diff = p_pos - p_center;
284 int diff = p_pos - p_center;
286 newAccel =
Abs(diff) * p_max / p_center;
288 if (newAccel < p_min) {
289 newAccel = (float) p_min;
298 float newVel = p_currentVel;
300 float velDiff = p_targetVel - p_currentVel;
301 int vSign = velDiff > 0 ? 1 : -1;
304 float deltaVel = p_accel * p_time;
305 newVel = p_currentVel + (deltaVel * vSign);
308 newVel =
Min(newVel, p_targetVel);
311 newVel =
Max(newVel, p_targetVel);
336 float deltaTime = (currentTime -
m_lastTime) / 1000.0;
361 VPV3(p_newPos, p_curPos, delta_pos);
371 if (p_und !=
NULL && (*p_und)[1] < 0.0f) {
372 delta_rad = -delta_rad;
376 rot_mat[0][0] = rot_mat[2][2] = cos(delta_rad);
377 rot_mat[0][2] = rot_mat[2][0] = sin(delta_rad);
378 rot_mat[0][2] *= -1.0f;
379 VXM3(p_newDir, p_curDir, rot_mat);
389 SET3(new_pos, p_newPos);
390 SET3(new_dir, p_newDir);
393 SET3(new_pos, p_curPos);
394 SET3(new_dir, p_curDir);
407 VPV3(p_newPos, new_pos, delta_pos);
412 rot_mat[0][0] = rot_mat[2][2] = cos(delta_rad);
413 rot_mat[0][2] = rot_mat[2][0] = sin(delta_rad);
414 rot_mat[0][2] *= -1.0f;
415 VXM3(p_newDir, new_dir, rot_mat);
418 SET3(p_newDir, new_dir);
534 if (joystickX <= 45 || joystickX >= 55 || joystickY <= 45 || joystickY >= 55) {
548 if (povPosition >= 0) {
601 skipRotationVelAndAccelCalc =
TRUE;
616 skipLinearVelAndAccelCalc =
TRUE;
623 if (!skipRotationVelAndAccelCalc) {
633 if (!skipLinearVelAndAccelCalc) {
665 if (currentWorld !=
NULL) {
691 for (
MxS32 i = 0; i < numPlants; i++) {
702 roiPosition -= viewPosition;
744 mat.
TranslateBy(direction[0] * 2.0f, direction[1] - 1.0, direction[2] * 2.0f);
860 if (act3State ==
NULL) {
874 if (act3State ==
NULL) {
1005 "pos: %f, %f, %f\ndir: %f, %f, %f\nup: %f, %f, %f\n",
[AI] Holds persistent state and status variables for Act 3 mission, saved between world reloads and p...
undefined4 m_unk0x08
[AI] Unknown persistent field holding an instruction/state flag.
[AI] Represents an axis-aligned bounding box in 3D space, using minimum and maximum points.
[AI] Represents the state of the Infocenter area, storing scripts, dialogue playlists and UI letter p...
MxBool HasRegistered()
[AI] True if any letter slot is filled (indicating the player has registered).
MxU32 m_unk0x74
[AI] State machine variable tracking the Infocenter flow (e.g., 0=intro, 3=NA, 4=goto book,...
BOOL Moved(ViewROI &rROI)
[AI] Notifies the manager that the ROI has moved and needs spatial update.
Lego3DView * GetLego3DView()
[AI] Returns the encapsulated Lego3DView instance.
ViewManager * GetViewManager()
[AI] Returns the ViewManager responsible for managing scene objects and transformations.
@ c_brickster
The Brickster ([AI])
@ c_pepper
Pepper Roni ([AI])
MxResult FUN_10060dc0(MxU32 p_objectId, MxMatrix *p_matrix, MxBool p_param3, MxU8 p_param4, LegoROI *p_roi, MxBool p_param6, MxBool p_param7, MxBool p_param8, MxBool p_param9)
[AI] Helper for starting a specific animation, including world matrix and camera settings.
void FUN_10061010(MxBool p_und)
[AI] Cancels all camera/transition animations and resets camera after completion.
PlayMode
[AI] Animation play modes, possibly for controlling explicit or random playback.
@ e_unk1
[AI] Unknown/unspecified play mode
@ e_unk2
[AI] Unknown/unspecified play mode
void FUN_10060570(MxBool p_unk0x1a)
[AI] Sets whether the manager should immediately trigger camera transition animations in quick succes...
void FUN_10012320(float p_angle)
Rotates the current camera transformation by a given angle around the Y axis.
MxU32 GetNumActors()
[AI] Returns the number of actors registered in global g_actorInfo.
void ReleaseActor(const char *p_name)
[AI] Releases a character/ROI by name, decrementing its reference count and deleting if zero.
LegoROI * GetActorROI(const char *p_name, MxBool p_createEntity)
[AI] Returns a LegoROI for the given character name, creating and registering the actor if necessary.
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
MxBool GetUnknown0x10IsSet(MxU8 p_flag)
[AI] Checks if a bit flag in m_unk0x10 is set (purpose: state/animation suppression lock).
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
@ c_altBit1
[AI] Used to prevent repeat sound/animation actions while one is in progress [AI]
virtual void ClickAnimation()
[AI] Plays a context-sensitive click animation, driven by current entity type and state....
Notification parameter class for LEGO event notifications such as mouse events and modifier keys.
void SwitchArea(Area p_area)
Switches the whole game state into a new area/world; manages transitions/scene loads.
void SetCurrentAct(Act p_currentAct)
Sets the current game act.
Area m_currentArea
Area/world the player is presently in. [AI].
MxBool m_isDirty
TRUE if unsaved changes present. [AI].
void SetActorId(MxU8 p_actorId)
Directly sets the current actor ID (preferred: use SetActor).
@ e_act3
Act 3: final main story segment. [AI].
@ e_act1
Act 1: the first main segment of the game. [AI].
@ e_act2
Act 2: main story segment two. [AI].
void RegisterState(LegoState *p_state)
Registers a state object, replacing by class if already present.
MxU8 GetActorId()
Returns the current selected actor ID. [AI].
MxResult Save(MxULong p_slot)
Saves persistent game state (world variables, actor, etc.) to a file slot.
LegoState * GetState(const char *p_stateName)
Find an existing state (LegoState-derived) object by its registered script/class name.
@ e_infomain
Information Center, main screen. [AI].
@ e_act3script
Act 3 world/script main. [AI].
@ e_act2main
Act 2 world main screen. [AI].
@ e_isle
Open world (LEGO Island main map). [AI].
[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...
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.
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.
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.
MxBool m_unk0x5d
[AI] Indicates that Notify() should inject a one-time movement/turn based on special debug or event t...
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.
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).
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.
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.
float m_rotSensitivity
[AI] Sensitivity multiplier for rotation (applies if useRotationalVel is FALSE).
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.
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.
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...
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] Central hub singleton for the LEGO Island game engine, managing all core game systems,...
MxResult Start(MxDSAction *p_dsAction) override
[AI] Begins executing the specified DSAction/script in the context of the current world/state.
LegoPlantManager * GetPlantManager()
[AI] Returns active plant manager, which tracks in-world plants/objects.
void Resume() override
[AI] Resumes engine/game state and sets default cursor.
static LegoOmni * GetInstance()
[AI] Returns the current LegoOmni singleton pointer, cast from MxOmni.
LegoInputManager * GetInputManager()
[AI] Returns the input manager.
@ e_act1
[AI] Act 1 main world. [AI]
LegoVideoManager * GetVideoManager()
[AI] Returns the active video manager, cast to LegoVideoManager.
LegoWorld * GetCurrentWorld()
[AI] Returns the pointer to the currently active world.
MxBool m_unk0x13c
[AI] Unknown flag used in rare start-action cases. [AI]
void Pause() override
[AI] Pauses the engine/game state and sets busy cursor.
[AI] Manages the lifecycle, state, and properties for all plant objects (flowers, trees,...
LegoEntity * CreatePlant(MxS32 p_index, LegoWorld *p_world, LegoOmni::World p_worldId)
[AI] Instantiates an entity and ROI for the plant at given index in world (if appropriate).
void LoadWorldInfo(LegoOmni::World p_worldId)
[AI] Loads all plant objects/entities for the requested world, instantiates requisite ROIs and entiti...
MxS32 GetNumPlants()
[AI] Returns the total number of plant records referenced by this manager.
void Reset(LegoOmni::World p_worldId)
[AI] Completely resets (removes) all plant objects for the supplied world.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
void UpdateListener(const float *p_position, const float *p_direction, const float *p_up, const float *p_velocity)
[AI] Updates the 3D sound listener properties in DirectSound, reflecting player/world changes.
[AI] Extends the functionality of MxVideoManager to provide LEGO Island–specific video and 3D graphic...
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
LegoROI * GetViewROI()
[AI] Returns the viewpoint ROI for the current view/camera.
void ToggleFPS(MxBool p_visible)
[AI] Toggles display of the on-screen frames-per-second (FPS) overlay.
void SetRender3D(MxBool p_render3d)
[AI] Enables or disables main 3D rendering (e.g., used internally on video transitions).
void SetLightTransform(BOOL bDirectionalLight, Tgl::FloatMatrix4 &rMatrix)
[AI] Sets the transformation matrix (position/orientation) for either the sun or directional light.
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
LegoOmni::World GetWorldId()
Gets the world id associated with this world.
virtual MxBool Escape()
Handles user-initiated "escape" or exit action.
LegoCameraController * GetCameraController()
Returns the current camera controller for the world.
4x4 Matrix class with virtual interface for manipulation and transformation.
virtual void TranslateBy(const float &p_x, const float &p_y, const float &p_z)
Applies translation by amounts along X, Y, Z axes.
void RotateX(const float &p_angle)
Applies a rotation (in radians or degrees, depending on implementation) about the X axis.
void RotateZ(const float &p_angle)
Applies a rotation (in radians or degrees) about the Z axis.
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] Atomized (unique) string identifier, managed by reference counting.
void Enable(MxBool p_enable)
[AI] Enables or disables the background audio manager.
void Stop()
[AI] Immediately stops all background music, clears all actions and presenters, and resets tickle sta...
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
MxAtomId & GetAtomId()
Returns a reference to the entity AtomId.
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
virtual MxBool IsPaused()
[AI] Returns paused state of the engine.
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_doCopy, MxBool p_playMusicInAnim)
[AI] Begins a new transition animation of type p_animationType at the specified speed,...
@ e_mosaic
[AI] Complex mosaic block-out effect.
const float * GetWorldUp() const
Returns a pointer to the world up vector from the transformation matrix.
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.
void WrappedSetLocalTransform(const Matrix4 &p_transform)
Wraps SetLocalTransform, for possible override or interface uniformity.
void FUN_100a5a30(const Vector3 &p_world_velocity)
Sets the world velocity to the provided vector.
const float * GetWorldVelocity() const override
Returns a pointer to the object's velocity vector in world space.
void GetLocalTransform(Matrix4 &p_transform)
Retrieves the local-to-world transformation, or if there is a parent, computes the transform relative...
void WrappedVTable0x24(const Matrix4 &p_transform)
Wraps VTable0x24, possibly for decoupling or uniform invocation.
void UpdateTransformationRelativeToParent(const Matrix4 &p_transform)
Calculates and updates the world transform relative to this object's parent, then calls UpdateWorldDa...
const BoundingBox & GetWorldBoundingBox() const override
Returns the object's bounding box in world coordinates.
unsigned char GetVisibility()
[AI] Returns the visibility flag; true if visible, false if hidden.
static void SetUserMaxLOD(float p_lod)
[AI] Sets the maximum LOD allowed for the user and updates global LOD power.
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
void Clear() override
[AI] Sets every coordinate (x, y, z) to zero.
float LenSquared() const override
[AI] Computes the squared magnitude (x^2 + y^2 + z^2) of this vector.
[AI] Manages all ViewROI objects that are rendered in a given scene, handles frustum culling,...
unsigned int IsBoundingBoxInFrustum(const BoundingBox &p_bounding_box)
[AI] Determines if a bounding box is (partially) inside the camera's view frustum using frustum-plane...
[AI] ViewROI objects represent viewable and placeable objects in the scene, each holding their own tr...
int GetUnknown0xe0()
[AI] Gets the value of an internal state field at offset 0xe0.
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
#define DECOMP_SIZE_ASSERT(T, S)
LegoLocation g_locations[70]
Global table of all defined LEGO Island scene/camera/world locations.
MxS32 g_animationCalcStep
LegoAnimationManager::PlayMode g_unk0x100f66bc
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
T Max(T p_t1, T p_t2)
[AI] Returns the maximum of two values.
T Min(T p_t1, T p_t2)
[AI] Returns the minimum of two values.
T Abs(T p_t)
[AI] Returns the absolute value.
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
LegoCharacterManager * CharacterManager()
[AI] Accessor for the character manager, which manages in-game characters/NPCs. [AI]
LegoAnimationManager * AnimationManager()
[AI] Accessor for the animation manager, which controls Lego character/world animation state....
LegoSoundManager * SoundManager()
[AI] Accessor for the game's LegoSoundManager subsystem from the global LegoOmni instance....
MxTransitionManager * TransitionManager()
[AI] Accessor for the MxTransitionManager, handling level transitions, fades, and world changes....
MxBackgroundAudioManager * BackgroundAudioManager()
[AI] Accessor for the background audio manager. Used for background music and ambient sounds....
MxBool g_isWorldActive
Global variable indicating whether the current LegoWorld is considered active.
LegoPlantManager * PlantManager()
[AI] Accessor for the plant manager, handling in-game foliage and plants. [AI]
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
LegoOmni * Lego()
[AI] Retrieves the global LegoOmni singleton instance, providing access to core subsystems.
LegoInputManager * InputManager()
[AI] Accessor for the input manager, which handles keyboard, mouse, and controller input....
@ e_lowerCase2
[AI] Alternative or legacy lower case mode, functionally equivalent to e_lowerCase.
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
MxTimer * Timer()
[AI] Returns the global simulation timer.
@ c_notificationKeyPress
[AI] Keyboard key press detected [AI]
float FloatMatrix4[4][4]
[AI] Represents a 4x4 matrix of single-precision floating point values.
void CalcLocalTransform(const Vector3 &p_posVec, const Vector3 &p_dirVec, const Vector3 &p_upVec, Matrix4 &p_outMatrix)
[AI] Computes a transformation matrix based on a position, direction, and up vector.
Data structure representing a named spatial location and orientation in the LEGO Island world,...
#define VXS3(to, from, s)