Isle
Loading...
Searching...
No Matches
jukebox.cpp
Go to the documentation of this file.
1#include "jukebox.h"
2
3#include "isle.h"
4#include "jukebox_actions.h"
5#include "jukeboxw_actions.h"
7#include "legogamestate.h"
8#include "legoinputmanager.h"
9#include "legomain.h"
10#include "misc.h"
11#include "mxmisc.h"
13#include "mxstillpresenter.h"
14#include "mxticklemanager.h"
15#include "mxtransitionmanager.h"
16#include "mxvideopresenter.h"
17
20
21// FUNCTION: LEGO1 0x1005d660
23{
24 m_unk0x100 = 0;
25 m_state = NULL;
27}
28
29// FUNCTION: LEGO1 0x1005d830
31{
32 if (InputManager()->GetWorld() == this) {
34 }
35
39}
40
41// FUNCTION: LEGO1 0x1005d8d0
43{
44 MxResult ret = LegoWorld::Create(p_dsAction);
45 if (ret == SUCCESS) {
46 InputManager()->SetWorld(this);
47 ControlManager()->Register(this);
48 }
49
51
52 m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
53 if (!m_state) {
54 m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState");
56 }
57
60 TickleManager()->RegisterClient(this, 2000);
61 return ret;
62}
63
64// FUNCTION: LEGO1 0x1005d980
65// FUNCTION: BETA10 0x10037daf
67{
68 MxLong result = 0;
69 MxNotificationParam& param = (MxNotificationParam&) p_param;
70 LegoWorld::Notify(p_param);
71
72 if (m_worldStarted) {
73 switch (param.GetNotification()) {
75 result = HandleControl((LegoControlManagerNotificationParam&) p_param);
76 break;
78 GameState()->SwitchArea(m_destLocation);
79 result = 1;
80 break;
81 }
82 }
83
84 return result;
85}
86
87// FUNCTION: LEGO1 0x1005d9f0
88// FUNCTION: BETA10 0x10037e39
90{
91 MxStillPresenter* presenter = NULL;
92
93 switch (m_state->m_music) {
95 break;
97 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
98 break;
100 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
101 break;
103 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
104 break;
106 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
107 break;
109 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
110 break;
111 }
112
113 if (presenter) {
114 presenter->Enable(TRUE);
115 }
116
117 m_unk0x100 = 1;
118}
119
120// FUNCTION: LEGO1 0x1005da70
121// FUNCTION: BETA10 0x10037f6d
122MxBool JukeBox::HandleControl(LegoControlManagerNotificationParam& p_param)
123{
124 MxStillPresenter* presenter;
125
126 if (p_param.m_unk0x28 == 1) {
127 switch (p_param.m_clickedObjectId) {
129 switch (m_state->m_music) {
132 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
133 presenter->Enable(TRUE);
134 break;
137 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
138 presenter->Enable(FALSE);
139 break;
142 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
143 presenter->Enable(FALSE);
144 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
145 presenter->Enable(TRUE);
146 break;
149 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
150 presenter->Enable(FALSE);
151 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
152 presenter->Enable(TRUE);
153 break;
156 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
157 presenter->Enable(FALSE);
158 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
159 presenter->Enable(TRUE);
160 break;
163 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
164 presenter->Enable(FALSE);
165 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
166 presenter->Enable(TRUE);
167 break;
168 }
169 break;
171 switch (m_state->m_music) {
174 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
175 presenter->Enable(TRUE);
176 break;
179 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
180 presenter->Enable(FALSE);
181 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
182 presenter->Enable(TRUE);
183 break;
186 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
187 presenter->Enable(FALSE);
188 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
189 presenter->Enable(TRUE);
190 break;
193 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
194 presenter->Enable(FALSE);
195 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
196 presenter->Enable(TRUE);
197 break;
200 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
201 presenter->Enable(FALSE);
202 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
203 presenter->Enable(TRUE);
204 break;
207 presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
208 presenter->Enable(FALSE);
209 break;
210 }
211 break;
213 Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
214 act1State->m_unk0x018 = 11;
217 break;
218 }
219 }
220
221 return TRUE;
222}
223
224// FUNCTION: LEGO1 0x1005dde0
226{
227 LegoWorld::Enable(p_enable);
228
229 if (p_enable) {
230 InputManager()->SetWorld(this);
232 }
233 else {
234 if (InputManager()->GetWorld() == this) {
236 }
237 }
238}
239
240// FUNCTION: LEGO1 0x1005de30
242{
243 if (m_worldStarted == FALSE) {
245 return SUCCESS;
246 }
247
248 if (m_unk0x100 == 1) {
249 m_unk0x100 = 0;
251 }
252
253 return SUCCESS;
254}
255
256// FUNCTION: LEGO1 0x1005de70
258{
259 m_destLocation = LegoGameState::e_infomain;
260 return TRUE;
261}
[AI] Holds state and transient gameplay data for the first act on Lego Island.
Definition: isle.h:29
MxU32 m_unk0x018
[AI] Internal gameplay state variable; see Get/SetUnknown18 for usage. [AI]
Definition: isle.h:92
[AI] Represents the music selection state for the Jukebox in the game.
Definition: jukebox.h:14
Music m_music
[AI] Currently selected music track in the Jukebox. [AI]
Definition: jukebox.h:46
@ e_torpedos
[AI] "Torpedos" music track. [AI]
Definition: jukebox.h:23
@ e_nelson
[AI] "Nelson" music track. [AI]
Definition: jukebox.h:22
@ e_decal
[AI] "Decal" music track. [AI]
Definition: jukebox.h:20
@ e_right
[AI] "Right" music track. [AI]
Definition: jukebox.h:19
@ e_pasquell
[AI] "Pasquell" music track (default selection). [AI]
Definition: jukebox.h:18
@ e_wallis
[AI] "Wallis" music track. [AI]
Definition: jukebox.h:21
[AI] Represents the Jukebox world environment in the game—handles display, state, notifications,...
Definition: jukebox.h:53
MxResult Tickle() override
[AI] Called by the tickle manager on update/tick events; manages per-frame logic such as input disabl...
Definition: jukebox.cpp:241
~JukeBox() override
[AI] Destructor. Unregisters world from all managers and releases input/camera focus if currently set...
Definition: jukebox.cpp:30
void ReadyWorld() override
[AI] Finalizes world setup, including enabling presenters for the currently selected music bitmap and...
Definition: jukebox.cpp:89
void Enable(MxBool p_enable) override
[AI] Enables or disables input/control focus for the world (and sets input manager state accordingly)...
Definition: jukebox.cpp:225
MxBool Escape() override
[AI] Handles request to exit the Jukebox world—sets destination for transition (will switch area on n...
Definition: jukebox.cpp:257
MxResult Create(MxDSAction &p_dsAction) override
[AI] Sets up world state, registers input and control handlers, and initializes camera upon entry.
Definition: jukebox.cpp:42
MxLong Notify(MxParam &p_param) override
[AI] Handles incoming notifications (such as control input and transition events) for the Jukebox wor...
Definition: jukebox.cpp:66
[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.
void SwitchArea(Area p_area)
Switches the whole game state into a new area/world; manages transitions/scene loads.
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.
void StopArea(Area p_area)
Calls cleanup logic for the specified area (removes actors, VMs, closes handles, etc....
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_previousArea
Alias: go to previous area. [AI].
Definition: legogamestate.h:94
@ e_jukeboxw
Western Jukebox (special minigame). [AI].
@ e_jukeboxExterior
Jukebox, seen from outside. [AI].
void ClearWorld()
[AI] Remove any world assignment (used to clear targeting/scene changes). [AI]
void SetCamera(LegoCameraController *p_camera)
[AI] Assigns a new camera controller for mouse/look operations.
void SetWorld(LegoWorld *p_world)
[AI] Assigns the current world to receive mouse/click/pick notifications.
@ c_clearScreen
[AI] When set, clears the display surface. [AI]
Definition: legomain.h:49
@ c_disable3d
[AI] When set, disables 3D rendering. [AI]
Definition: legomain.h:48
@ c_disableInput
[AI] When set, disables input processing. [AI]
Definition: legomain.h:47
virtual void Enable(MxBool p_enable)
Enables or disables (pauses) the world and its main components.
Definition: legoworld.cpp:684
MxResult Tickle() override
Main world tick/update, especially manages startup countdown.
Definition: legoworld.cpp:810
MxBool m_worldStarted
Indicates if the world has successfully started and is considered active.
Definition: legoworld.h:388
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
MxLong Notify(MxParam &p_param) override
Notification callback responding to registered events such as EndAction and NewPresenter.
Definition: legoworld.cpp:212
MxResult Create(MxDSAction &p_dsAction) override
Initializes the world using an action, creating entity and sound lists, and camera controller.
Definition: legoworld.cpp:58
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
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.
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
NotificationId GetNotification() const
[AI] Retrieves the current notification type of this parameter.
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
[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...
virtual void UnregisterClient(MxCore *p_client)
[AI] Unregisters (marks for destruction) a previously registered client.
virtual void RegisterClient(MxCore *p_client, MxTime p_interval)
[AI] Registers an MxCore object to receive periodic tickles.
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.
#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
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
Definition: misc.cpp:61
MxTransitionManager * TransitionManager()
[AI] Accessor for the MxTransitionManager, handling level transitions, fades, and world changes....
Definition: misc.cpp:208
LegoControlManager * ControlManager()
[AI] Accessor for the control manager through the input manager; manages higher-level user/game contr...
Definition: misc.cpp:53
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
LegoInputManager * InputManager()
[AI] Accessor for the input manager, which handles keyboard, mouse, and controller input....
Definition: misc.cpp:45
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
MxTickleManager * TickleManager()
[AI] Provides access to the global tickle manager.
Definition: mxmisc.cpp:25
@ c_notificationControl
[AI] UI control event [AI]
@ c_notificationTransitioned
[AI] Object has transitioned states or locations [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
@ c_Dback_Ctl
[AI] Script/control ID for "back" (rewind or previous) button in the interface. [AI]
@ c_Note_Ctl
[AI] Script/control ID for a "note" imagery/button. [AI]
@ c_Dfwd_Ctl
[AI] Script/control ID for "forward" (advance/next) button. [AI]