Isle
Loading...
Searching...
No Matches
skateboard.cpp
Go to the documentation of this file.
1#include "skateboard.h"
2
3#include "decomp.h"
4#include "isle.h"
5#include "isle_actions.h"
6#include "jukebox_actions.h"
9#include "legoutils.h"
10#include "misc.h"
11#include "mxmisc.h"
13#include "mxstillpresenter.h"
14#include "mxtransitionmanager.h"
15#include "pizza.h"
16#include "scripts.h"
17
19
20// FUNCTION: LEGO1 0x1000fd40
22{
23 m_pizzaVisible = FALSE;
24 m_maxLinearVel = 15.0;
25 m_unk0x150 = 3.5;
26 m_unk0x148 = 1;
27
29}
30
31// FUNCTION: LEGO1 0x1000ff80
33{
36}
37
38// FUNCTION: LEGO1 0x10010000
40{
41 MxResult result = IslePathActor::Create(p_dsAction);
42
43 if (result == SUCCESS) {
45 m_world->Add(this);
46
48 if (pizza) {
49 pizza->SetSkateboard(this);
50 }
51 }
52
53 return result;
54}
55
56// FUNCTION: LEGO1 0x10010050
58{
59 if (m_act1state->m_unk0x018 == 3) {
61 pizza->StopActions();
62 pizza->FUN_100382b0();
63 m_pizzaVisible = FALSE;
64 }
65
71}
72
73// FUNCTION: LEGO1 0x100100e0
75{
76 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
77
78 if (!FUN_1003ef60() && state->m_unk0x018 != 3) {
79 return 1;
80 }
81
83
86
87 if (GameState()->GetActorId() != UserActor()->GetActorId()) {
88 if (!UserActor()->IsA("SkateBoard")) {
90 }
91 }
92
93 if (!UserActor()->IsA("SkateBoard")) {
94 Enter();
97 ControlManager()->Register(this);
98 }
99
100 EnableScenePresentation(m_pizzaVisible);
101
102 Vector3 position = m_roi->GetWorldPosition();
103 AnimationManager()->FUN_10064670(&position);
104 AnimationManager()->FUN_10064740(&position);
105 return 1;
106}
107
108// FUNCTION: LEGO1 0x10010230
110{
111 MxU32 result = 0;
112
113 if (p_param.m_unk0x28 == 1 && p_param.m_clickedObjectId == IsleScript::c_SkateArms_Ctl) {
114 Exit();
116 result = 1;
117 }
118
119 return result;
120}
121
122// FUNCTION: LEGO1 0x10010270
123// FUNCTION: BETA10 0x100f5366
125{
126 m_act1state = (Act1State*) GameState()->GetState("Act1State");
127 if (!m_act1state) {
128 m_act1state = (Act1State*) GameState()->CreateState("Act1State");
129 }
130
132 if (presenter) {
133 presenter->Enable(p_enable);
134 }
135 else if (m_pizzaVisible) {
137 }
138}
139
140// FUNCTION: LEGO1 0x100104f0
141// FUNCTION: BETA10 0x100f5472
143{
144 EnableScenePresentation(m_pizzaVisible);
145 return 1;
146}
147
148// FUNCTION: LEGO1 0x10010510
150{
151 if (m_act1state->m_unk0x018 != 3) {
153
154 if (!m_act1state->m_unk0x022) {
155 m_act1state->m_unk0x022 = TRUE;
156
157 MxMatrix mat(UserActor()->GetROI()->GetLocal2World());
158 mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5);
159
162 &mat,
163 TRUE,
165 NULL,
166 FALSE,
167 TRUE,
168 TRUE,
169 TRUE
170 );
171 }
172 }
173}
[AI] Holds state and transient gameplay data for the first act on Lego Island.
Definition: isle.h:29
MxBool m_unk0x022
[AI] Temporary state variable; persists through serialization, often used for logic gating....
Definition: isle.h:110
MxU32 m_unk0x018
[AI] Internal gameplay state variable; see Get/SetUnknown18 for usage. [AI]
Definition: isle.h:92
Derived path actor type for handling player transitions and activities on LEGO Island.
Definition: islepathactor.h:23
MxResult Create(MxDSAction &p_dsAction) override
[AI] Initialize this actor from a DSAction.
virtual void Exit()
[AI] Called when the actor is deactivated or moved out of player control, restoring previous actor if...
LegoWorld * m_world
[AI] Pointer to the current world instance actor is existing in. [AI]
virtual void Enter()
[AI] Called when the actor is made active in a new area or context, setting navigation and visibility...
[AI] Represents the main overworld (LEGO Island) in the game, acting as the central hub and state mac...
Definition: isle.h:179
virtual MxU8 GetActorId()
[AI] Gets this actor's numeric ID, corresponding to a known enumeration/actor.
Definition: legoactor.h:77
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.
@ e_unk0
[AI] Unknown/unspecified play mode
MxResult FUN_10064740(Vector3 *p_position)
[AI] Similar to FUN_10064670, but triggers a different special animation event for secondary location...
MxResult FUN_10064670(Vector3 *p_position)
[AI] Activates special triggered animation in response to player position near given point.
[AI] Notification parameter for the LegoControlManager, used to propagate information about control e...
MxS32 m_clickedObjectId
[AI] Object ID of the clicked control/presenter (or -1 if not set). [AI]
MxS16 m_unk0x28
[AI] Undetermined; settable via SetUnknown0x28. [AI]
void Register(MxCore *p_listener)
[AI] Adds a listener to be notified of control events.
void Unregister(MxCore *p_listener)
[AI] Removes a listener so it no longer receives control events.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
LegoROI * m_roi
[AI] Pointer to this entity's currently assigned ROI (3D instance in the world). [AI]
Definition: legoentity.h:215
Area m_currentArea
Area/world the player is presently in. [AI].
LegoState * CreateState(const char *p_stateName)
Creates an instance of given state, registers it, and returns pointer.
LegoState * GetState(const char *p_stateName)
Find an existing state (LegoState-derived) object by its registered script/class name.
@ e_unk66
Used for some spawn locations. [AI].
@ e_skateboard
Skateboard (vehicle, spawn). [AI].
MxBool IsA(const char *p_name) const override
[AI] RTTI-like check, matches against own or base class name for IsA hierarchy checks.
virtual void Add(MxCore *p_object)
Adds an object (entity, presenter, ROI, etc.) to the appropriate world-managed list or set.
Definition: legoworld.cpp:418
MxCore * Find(const char *p_class, const char *p_name)
Finds an object of a given class and name in the world.
Definition: legoworld.cpp:573
virtual void TranslateBy(const float &p_x, const float &p_y, const float &p_z)
Applies translation by amounts along X, Y, Z axes.
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
Definition: mxdsobject.h:147
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
void Unregister(MxCore *p_listener)
[AI] Removes a previously registered listener and flushes any pending notifications for it.
void Register(MxCore *p_listener)
[AI] Registers a listener object to receive notifications.
MxResult Send(MxCore *p_listener, const MxNotificationParam &p_param)
[AI] Queues a notification to be sent to a specific registered listener.
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
[AI] Presenter for single still image/bitmap media sources in the game.
void Enable(MxBool p_enable) override
[AI] Sets the enabled/disabled state of the presenter, updating the video manager's rendering as need...
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 * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
Interactive pizza entity actor; manages the in-game pizza delivery sequence and reacts to mission tri...
Definition: pizza.h:263
void SetSkateboard(SkateBoard *p_skateBoard)
Sets the SkateBoard actor pointer used for interaction and scene presentation.
Definition: pizza.h:363
void StopActions()
Stops all currently running pizza mission actions and resets to an idle state.
Definition: pizza.cpp:223
void FUN_100382b0()
Cancels or resets the Pizza mission, stopping music, resetting camera, and animation state.
Definition: pizza.cpp:196
[AI] Represents the skateboard vehicle actor used in the minigame and cutscenes.
Definition: skateboard.h:14
~SkateBoard() override
[AI] Destructor that performs de-registration from control/notification managers. [AI]
Definition: skateboard.cpp:32
MxLong HandleClick() override
[AI] Handles player click events on the SkateBoard.
Definition: skateboard.cpp:74
MxLong HandleNotification0() override
[AI] Responds to a generic notification.
Definition: skateboard.cpp:142
MxLong HandleControl(LegoControlManagerNotificationParam &p_param) override
[AI] Handles controller input or notification events directed at the SkateBoard (e....
Definition: skateboard.cpp:109
MxBool IsA(const char *p_name) const override
[AI] Checks if this instance is of type "SkateBoard" or a base type.
Definition: skateboard.h:33
void ActivateSceneActions()
[AI] Activates the skateboard scene-specific scripted actions, including animations and music.
Definition: skateboard.cpp:149
void Exit() override
[AI] Exits the skateboard sequence, unregisters itself, and resets related scene state.
Definition: skateboard.cpp:57
MxResult Create(MxDSAction &p_dsAction) override
[AI] Initializes the SkateBoard from a DSAction (e.g., script sequence start).
Definition: skateboard.cpp:39
void EnableScenePresentation(MxBool p_enable)
[AI] Enables or disables the presentation (visual display) of pizza in the skateboard scene.
Definition: skateboard.cpp:124
[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 DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
void InvokeAction(Extra::ActionType p_actionId, const MxAtomId &p_pAtom, MxS32 p_streamId, LegoEntity *p_sender)
[AI] Dispatches and triggers a game action on the given script or object.
Definition: legoutils.cpp:271
MxBool RemoveFromCurrentWorld(const MxAtomId &p_atomId, MxS32 p_id)
[AI] Removes an entity or presenter with specified AtomId and ID from the current world; triggers End...
Definition: legoutils.cpp:495
MxBool FUN_1003ef60()
[AI] Determines if the current actor can exit their area, based on state/zone/vehicle.
Definition: legoutils.cpp:572
MxAtomId * g_isleScript
[AI] Node used in hierarchical scene graphs and animation trees. [AI]
Definition: scripts.cpp:32
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
Definition: misc.cpp:61
LegoAnimationManager * AnimationManager()
[AI] Accessor for the animation manager, which controls Lego character/world animation state....
Definition: misc.cpp:69
MxTransitionManager * TransitionManager()
[AI] Accessor for the MxTransitionManager, handling level transitions, fades, and world changes....
Definition: misc.cpp:208
MxDSAction & GetCurrentAction()
[AI] Accessor for the currently running MxDSAction (e.g.
Definition: misc.cpp:195
LegoControlManager * ControlManager()
[AI] Accessor for the control manager through the input manager; manages higher-level user/game contr...
Definition: misc.cpp:53
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
Definition: misc.cpp:93
void FUN_10015820(MxBool p_disable, MxU16 p_flags)
[AI] Utility for enabling or disabling functionality in LegoOmni based on certain flags.
Definition: misc.cpp:143
void PlayMusic(JukeboxScript::Script p_objectId)
[AI] Starts music playback by scripting the background audio manager to play the music piece referenc...
Definition: misc.cpp:216
LegoPathActor * UserActor()
[AI] Accessor for the user (player-controllable) LegoPathActor. [AI]
Definition: misc.cpp:85
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
@ c_notificationType0
[AI] Undefined/Generic notification type [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
@ c_sns008in_RunAnim
Definition: isle_actions.h:878
@ c_SkatePizza_Bitmap
Definition: isle_actions.h:213
@ c_BeachBlvd_Music
[AI] Music for Beach Boulevard.
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
@ e_start
[AI] Start an activity or playback [AI]
Definition: extra.h:30