Isle
Loading...
Searching...
No Matches
buildings.cpp
Go to the documentation of this file.
1#include "buildings.h"
2
3#include "act2main_actions.h"
4#include "act3.h"
5#include "act3_actions.h"
6#include "isle.h"
7#include "isle_actions.h"
8#include "islepathactor.h"
9#include "legoact2.h"
12#include "legogamestate.h"
13#include "legoutils.h"
14#include "legoworld.h"
15#include "misc.h"
17#include "mxtransitionmanager.h"
18#include "scripts.h"
19
27
28// GLOBAL: LEGO1 0x100f0c2c
29// STRING: LEGO1 0x100f0c24
30const char* g_chest = "chest";
31
32// GLOBAL: LEGO1 0x100f0c30
33// STRING: LEGO1 0x100f0c18
34const char* g_cavedoor = "cavedoor";
35
36// GLOBAL: LEGO1 0x100f0c34
37IsleScript::Script g_nextChestAction = IsleScript::c_nca001ca_RunAnim;
38
39// GLOBAL: LEGO1 0x100f0c38
40IsleScript::Script g_nextCavedoorAction = IsleScript::c_Avo900Ps_PlayWav;
41
42// FUNCTION: LEGO1 0x100150c0
44{
45 switch (GameState()->GetCurrentAct()) {
47 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
48 ((IslePathActor*) UserActor())->Exit();
49 }
50
52 isle->FUN_10033350();
54
55 Act1State* act1state = (Act1State*) GameState()->GetState("Act1State");
56 act1state->SetUnknown18(0);
57 break;
58 }
62
63 LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State");
64 if (act2state) {
65 act2state->m_enabled = FALSE;
66 }
67 break;
68 }
72 break;
73 }
74
77 return 1;
78}
79
80// FUNCTION: LEGO1 0x100151d0
82{
83 if (FUN_1003ef60()) {
84 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
85
86 if (state->GetUnknown18() != 8) {
87 state->SetUnknown18(0);
88
89 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
90 ((IslePathActor*) UserActor())->Exit();
91 }
92
95
98 }
99 }
100
101 return 1;
102}
103
104// FUNCTION: LEGO1 0x10015270
106{
107 if (FUN_1003ef60()) {
108 Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
109
110 if (act1State->GetUnknown18() != 10) {
111 act1State->SetUnknown18(0);
112
113 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
114 ((IslePathActor*) UserActor())->Exit();
115 }
116
119
122 }
123 }
124
125 return 1;
126}
127
128// FUNCTION: LEGO1 0x10015310
130{
131 if (FUN_1003ef60()) {
132 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
133
134 if (state->GetUnknown18() != 10) {
135 state->SetUnknown18(0);
136
137 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
138 ((IslePathActor*) UserActor())->Exit();
139 }
140
143
146 }
147 }
148
149 return 1;
150}
151
152// FUNCTION: LEGO1 0x100153b0
154{
155 if (FUN_1003ef60()) {
156 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
157 state->SetUnknown18(0);
158
159 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
160 ((IslePathActor*) UserActor())->Exit();
161 }
162
165
168 }
169
170 return 1;
171}
172
173// FUNCTION: LEGO1 0x10015450
174MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
175{
176 if (FUN_1003ef60()) {
177 Act1State* state = (Act1State*) GameState()->GetState("Act1State");
178 state->SetUnknown18(0);
179
180 if (UserActor()->GetActorId() != GameState()->GetActorId()) {
181 ((IslePathActor*) UserActor())->Exit();
182 }
183
186
189 }
190
191 return 1;
192}
193
194// FUNCTION: LEGO1 0x100154f0
195// FUNCTION: BETA10 0x100256e8
196MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param)
197{
198 if (FUN_1003ef60()) {
200 }
201
202 return 1;
203}
204
205// FUNCTION: LEGO1 0x10015520
206// FUNCTION: BETA10 0x10025719
207MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param)
208{
209 LegoROI* roi = p_param.GetROI();
210
211 if (!strncmp(roi->GetName(), g_chest, strlen(g_chest))) {
214
215 switch (g_nextChestAction) {
218 break;
221 break;
224 break;
225 }
226 }
227 else if (!strcmp(roi->GetName(), g_cavedoor)) {
231
232 switch (g_nextCavedoorAction) {
235 break;
238 break;
241 break;
244 break;
247 break;
248 }
249 }
250
251 return 1;
252}
[AI] Defines enumerated script action identifiers for Act 3 of LEGO Island scripting system.
const char * g_cavedoor
Definition: buildings.cpp:34
IsleScript::Script g_nextCavedoorAction
Definition: buildings.cpp:40
IsleScript::Script g_nextChestAction
Definition: buildings.cpp:37
const char * g_chest
Definition: buildings.cpp:30
[AI] Holds state and transient gameplay data for the first act on Lego Island.
Definition: isle.h:29
void SetUnknown18(MxU32 p_unk0x18)
[AI] Sets the gameplay progress variable at 0x018 (controls state transitions, gameplay mode changes,...
Definition: isle.h:77
MxU32 GetUnknown18()
[AI] Retrieves the internal state variable at offset 0x018 (purpose: current major state,...
Definition: isle.h:68
[AI] Controls all main logic and progression of Act 3 in LEGO Island, including objects,...
Definition: act3.h:182
void SetDestLocation(LegoGameState::Area p_destLocation)
[AI] Sets the destination area/location for the next world switch.
Definition: act3.h:285
[AI] Entity for the Beach House building in LEGO Island.
Definition: buildings.h:125
MxLong HandleClick(LegoEventNotificationParam &p_param) override
[AI] Handles click events specific to the Beach House building.
Definition: buildings.cpp:153
[AI] Entity for the Gas Station building in LEGO Island.
Definition: buildings.h:44
MxLong HandleClick(LegoEventNotificationParam &p_param) override
[AI] Handles click events specific to the Gas Station building.
Definition: buildings.cpp:81
[AI] Entity for the Hospital building in LEGO Island.
Definition: buildings.h:71
MxLong HandleClick(LegoEventNotificationParam &p_param) override
[AI] Handles click events specific to the Hospital building.
Definition: buildings.cpp:105
[AI] Entity for the Information Center building in LEGO Island.
Definition: buildings.h:12
Derived path actor type for handling player transitions and activities on LEGO Island.
Definition: islepathactor.h:23
[AI] Represents the main overworld (LEGO Island) in the game, acting as the central hub and state mac...
Definition: isle.h:179
void SetDestLocation(LegoGameState::Area p_destLocation)
[AI] Sets destination location for world transitions (are used after certain cutscenes/buttons).
Definition: isle.h:234
void FUN_10033350()
[AI] Performs world cleanup related to transitions and resets (see source for transition/actor logic)...
Definition: isle.cpp:1248
[AI] Entity for the Jail building in LEGO Island.
Definition: buildings.h:178
Represents the state object for Act 2 of the game.
Definition: legoact2.h:25
MxBool m_enabled
[AI] TRUE if this state is currently enabled/active. [AI]
Definition: legoact2.h:83
Implements the world and game logic for Act 2.
Definition: legoact2.h:98
void SetDestLocation(LegoGameState::Area p_destLocation)
Sets the destination location for area transition upon completion.
Definition: legoact2.h:170
virtual MxU8 GetActorId()
[AI] Gets this actor's numeric ID, corresponding to a known enumeration/actor.
Definition: legoactor.h:77
void FUN_10061010(MxBool p_und)
[AI] Cancels all camera/transition animations and resets camera after completion.
Notification parameter class for LEGO event notifications such as mouse events and modifier keys.
LegoROI * GetROI()
Returns the ROI (3D Object) associated with this event, if any.
@ e_act3
Act 3: final main story segment. [AI].
Definition: legogamestate.h:86
@ e_act1
Act 1: the first main segment of the game. [AI].
Definition: legogamestate.h:84
@ e_act2
Act 2: main story segment two. [AI].
Definition: legogamestate.h:85
MxU8 GetActorId()
Returns the current selected actor ID. [AI].
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].
Definition: legogamestate.h:96
@ e_racecarbuild
Vehicle construction: racecar. [AI].
@ e_police
Police Station interior. [AI].
@ e_garage
Garage (build vehicle) interior. [AI].
@ e_jetskibuild
Vehicle construction: jetski. [AI].
@ e_hospital
Hospital interior. [AI].
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
const LegoChar * GetName() const
[AI] Gets this ROI's name.
Definition: legoroi.h:287
void LowerVolume()
[AI] Requests a reduction in current background music volume, queuing for fade out (increments suppre...
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.
[AI] Entity for the Police building in LEGO Island.
Definition: buildings.h:98
MxLong HandleClick(LegoEventNotificationParam &p_param) override
[AI] Handles click events specific to the Police building.
Definition: buildings.cpp:129
[AI] Entity for the Race Stands (grandstands) building in LEGO Island.
Definition: buildings.h:152
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
MxBool FUN_1003ef60()
[AI] Determines if the current actor can exit their area, based on state/zone/vehicle.
Definition: legoutils.cpp:572
void PlayCamAnim(LegoPathActor *p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool)
[AI] Initiates a camera animation for a specific path actor, or falls back to default animation trigg...
Definition: legoutils.cpp:459
void StartIsleAction(IsleScript::Script p_objectId)
[AI] Helper to invoke a 'start' action for an Isle script object by its script ID.
Definition: legoutils.h:268
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
void DeleteObjects(MxAtomId *p_id, MxS32 p_first, MxS32 p_last)
[AI] Batch deletes objects, given by atom id, and within the entity id range [p_first,...
Definition: misc.cpp:237
MxTransitionManager * TransitionManager()
[AI] Accessor for the MxTransitionManager, handling level transitions, fades, and world changes....
Definition: misc.cpp:208
MxBackgroundAudioManager * BackgroundAudioManager()
[AI] Accessor for the background audio manager. Used for background music and ambient sounds....
Definition: misc.cpp:37
LegoWorld * FindWorld(const MxAtomId &p_atom, MxS32 p_entityid)
[AI] Searches for or retrieves a LegoWorld instance based on an atom id and entity id.
Definition: misc.cpp:188
LegoPathActor * UserActor()
[AI] Accessor for the user (player-controllable) LegoPathActor. [AI]
Definition: misc.cpp:85
int MxLong
[AI]
Definition: mxtypes.h:83
@ c__Act2Main
[AI] Root script or entry point for Act2Main actions.
@ c__Act3
[AI] Reserved or unnamed root action for Act 3 scripting context. [AI]
Definition: act3_actions.h:31
@ c_Avo900Ps_PlayWav
Definition: isle_actions.h:967
@ c_nca001ca_RunAnim
Definition: isle_actions.h:819
@ c_Avo901Ps_PlayWav
Definition: isle_actions.h:968
@ c_nca003gh_RunAnim
Definition: isle_actions.h:821
@ c_Avo903Ps_PlayWav
Definition: isle_actions.h:970
@ c_Avo904Ps_PlayWav
Definition: isle_actions.h:971
@ c_Avo902Ps_PlayWav
Definition: isle_actions.h:969
@ c_nca002sk_RunAnim
Definition: isle_actions.h:820
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_act3Script
[AI] Script AtomId for Act 3 (endgame/helicopter chase) scripting.
Definition: scripts.cpp:66
MxAtomId * g_act2mainScript
[AI] Script AtomId for main script of Act 2 (island event progression).
Definition: scripts.cpp:63