Isle
Loading...
Searching...
No Matches
infocenterdoor.cpp
Go to the documentation of this file.
1#include "infocenterdoor.h"
2
3#include "infocenter.h"
4#include "infodoor_actions.h"
5#include "jukebox.h"
6#include "jukebox_actions.h"
8#include "legogamestate.h"
9#include "legoinputmanager.h"
10#include "legomain.h"
11#include "misc.h"
14#include "mxmisc.h"
16#include "mxtransitionmanager.h"
17#include "scripts.h"
18
20
21// FUNCTION: LEGO1 0x10037730
23{
24 m_destLocation = LegoGameState::e_undefined;
25
27}
28
29// FUNCTION: LEGO1 0x100378f0
31{
32 if (InputManager()->GetWorld() == this) {
34 }
35
38}
39
40// FUNCTION: LEGO1 0x10037980
42{
43 MxResult result = LegoWorld::Create(p_dsAction);
44 if (result == SUCCESS) {
45 InputManager()->SetWorld(this);
46 ControlManager()->Register(this);
47 }
48
50
53
54 return result;
55}
56
57// FUNCTION: LEGO1 0x100379e0
58// FUNCTION: BETA10 0x10032227
60{
61 MxNotificationParam& param = (MxNotificationParam&) p_param;
62 MxLong result = 0;
63 LegoWorld::Notify(p_param);
64
65 if (m_worldStarted) {
66 switch (param.GetNotification()) {
68 if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atomId) {
70 result = 1;
71 }
72 break;
74 result = HandleControl((LegoControlManagerNotificationParam&) p_param);
75 break;
77 GameState()->SwitchArea(m_destLocation);
78 result = 1;
79 break;
80 }
81 }
82
83 return result;
84}
85
86// FUNCTION: LEGO1 0x10037a70
88{
92}
93
94// FUNCTION: LEGO1 0x10037a90
95MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_param)
96{
97 MxLong result = 0;
98
99 if (p_param.m_unk0x28 == 1) {
101
102 switch (p_param.m_clickedObjectId) {
104 m_destLocation = LegoGameState::e_infoscor;
106 result = 1;
107 break;
109 m_destLocation = LegoGameState::e_elevbott;
111 result = 1;
112 break;
114 m_destLocation = LegoGameState::e_infomain;
116 result = 1;
117 break;
119 if (GameState()->GetActorId() != LegoActor::c_none) {
120 InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
121 if (state->HasRegistered()) {
122 m_destLocation = LegoGameState::e_unk4;
123 }
124 else {
125 MxDSAction action;
129 Start(&action);
130 goto done;
131 }
132 }
133 else {
134 MxDSAction action;
138 Start(&action);
139 goto done;
140 }
141
143
144 done:
145 result = 1;
146 break;
147 }
148 }
149
150 return result;
151}
152
153// FUNCTION: LEGO1 0x10037c80
155{
156 LegoWorld::Enable(p_enable);
157
158 if (p_enable) {
159 InputManager()->SetWorld(this);
161 }
162 else {
163 if (InputManager()->GetWorld() == this) {
165 }
166 }
167}
168
169// FUNCTION: LEGO1 0x10037cd0
171{
173 m_destLocation = LegoGameState::e_infomain;
174 return TRUE;
175}
[AI] Represents the door world for the information center, handling control, transitions and area swi...
MxBool Escape() override
[AI] Handles ESC key (or game escape) in the InfocenterDoor world.
MxLong Notify(MxParam &p_param) override
[AI] Handles notifications for actions ending, control input, and transitions in this world.
void Enable(MxBool p_enable) override
[AI] Enables or disables the world, controlling input routing and world state.
void ReadyWorld() override
[AI] Prepares the world for entry.
MxResult Create(MxDSAction &p_dsAction) override
[AI] Creates the InfocenterDoor world from a script action and sets up input/control handlers.
~InfocenterDoor() override
[AI] Cleans up InfocenterDoor, unregistering from control/notification managers and updating input st...
[AI] Represents the state of the Infocenter area, storing scripts, dialogue playlists and UI letter p...
Definition: infocenter.h:23
MxBool HasRegistered()
[AI] True if any letter slot is filled (indicating the player has registered).
Definition: infocenter.h:83
@ c_none
No actor ([AI])
Definition: legoactor.h:16
[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].
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_infoscor
Info Center hi-score area. [AI].
@ e_undefined
Undefined or unset area. [AI].
Definition: legogamestate.h:93
@ e_unk4
Unknown / possibly reserved. [AI].
Definition: legogamestate.h:98
@ e_elevbott
Elevator bottom. [AI].
Definition: legogamestate.h:99
@ e_infodoor
Info Center door/title view. [AI].
Definition: legogamestate.h:97
void ClearWorld()
[AI] Remove any world assignment (used to clear targeting/scene changes). [AI]
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 ReadyWorld()
Called when the world is ready to be used—typically for custom scene setup after startup.
Definition: legoworld.cpp:874
virtual void Enable(MxBool p_enable)
Enables or disables (pauses) the world and its main components.
Definition: legoworld.cpp:684
MxBool m_worldStarted
Indicates if the world has successfully started and is considered active.
Definition: legoworld.h:388
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
void RaiseVolume()
[AI] Requests that the background music volume is raised (decrements suppression counter); triggers f...
void LowerVolume()
[AI] Requests a reduction in current background music volume, queuing for fade out (increments suppre...
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
virtual void SetAtomId(MxAtomId p_atomId)
[AI] Sets the atom id for this object instance, used for indexing or lookup.
Definition: mxdsobject.h:118
void SetObjectId(MxU32 p_objectId)
[AI] Sets the object id (for serialization or lookup).
Definition: mxdsobject.h:147
[AI] Notification parameter marking the end of an action, specialization of MxActionNotificationParam...
MxAtomId & GetAtomId()
Returns a reference to the entity AtomId.
Definition: mxentity.h:98
MxAtomId m_atomId
The AtomId associated with this entity, used for resource and script identification.
Definition: mxentity.h:124
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
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 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
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
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
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
void SetIsWorldActive(MxBool p_isWorldActive)
[AI] Toggles whether the world should be considered active (enables/disables camera/user control etc)...
Definition: misc.cpp:228
LegoInputManager * InputManager()
[AI] Accessor for the input manager, which handles keyboard, mouse, and controller input....
Definition: misc.cpp:45
MxResult Start(MxDSAction *p_dsAction)
[AI] Schedules and initiates execution of a script action.
Definition: mxmisc.cpp:97
MxNotificationManager * NotificationManager()
[AI] Returns the notification manager for system-wide state/update notifications.
Definition: mxmisc.cpp:17
@ c_notificationControl
[AI] UI control event [AI]
@ c_notificationTransitioned
[AI] Object has transitioned states or locations [AI]
@ c_notificationEndAction
[AI] Indicates the end of an action [AI]
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
@ c_iic007in_PlayWav
[AI] Plays a .wav sound effect indexed at 007in. [SI file: iic007in_PlayWav]
@ c_LeftArrow_Ctl
[AI] Handles left arrow button control. [SI file: LeftArrow_Ctl]
@ c_Info_Ctl
[AI] Handles info button control. [SI file: Info_Ctl]
@ c_Door_Ctl
[AI] Handles door button control. [SI file: Door_Ctl]
@ c_RightArrow_Ctl
[AI] Handles right arrow button control. [SI file: RightArrow_Ctl]
@ c_iic037in_PlayWav
[AI] Plays a .wav sound effect indexed at 037in. [SI file: iic037in_PlayWav]
@ c_InformationCenter_Music
[AI] Background music for the information center.
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_infodoorScript
[AI] Script AtomId for the Info Center door logic script.
Definition: scripts.cpp:38