Skip to content

Commit

Permalink
Match Infocenter::HandleControl (#1386)
Browse files Browse the repository at this point in the history
* Add BETA10 references

* Refactor non-existent getters

* Infocenter::HandleControl maybe down to entropy

* Rename variable

* More refactoring

* Refactor public variable

* 100 %

* Fix clang-format

* Fix clang-format

---------

Co-authored-by: jonschz <[email protected]>
Co-authored-by: Christian Semmler <[email protected]>
  • Loading branch information
3 people authored Feb 18, 2025
1 parent d88ab0a commit 777dfa8
Show file tree
Hide file tree
Showing 27 changed files with 160 additions and 149 deletions.
6 changes: 1 addition & 5 deletions LEGO1/lego/legoomni/include/infocenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ class InfocenterState : public LegoState {
Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; }
Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; }
Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; }
Playlist& GetLeaveDialogue(LegoGameState::Act p_act) { return m_leaveDialogue[p_act]; }
Playlist& GetBricksterDialogue() { return m_bricksterDialogue; }
MxU32 GetUnknown0x74() { return m_unk0x74; }

void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; }

// SYNTHETIC: LEGO1 0x10071900
// InfocenterState::`scalar deleting destructor'
Expand Down Expand Up @@ -170,7 +166,7 @@ class Infocenter : public LegoWorld {
LegoGameState::Area m_destLocation; // 0x104
Cutscene m_currentCutscene; // 0x108
Radio m_radio; // 0x10c
MxStillPresenter* m_unk0x11c; // 0x11c
MxStillPresenter* m_dragPresenter; // 0x11c
InfocenterMapEntry m_glowInfo[7]; // 0x120
MxS16 m_unk0x1c8; // 0x1c8
MxStillPresenter* m_frame; // 0x1cc
Expand Down
2 changes: 0 additions & 2 deletions LEGO1/lego/legoomni/include/legocontrolmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class LegoControlManagerNotificationParam : public LegoEventNotificationParam {

// TODO: Most likely getters/setters are not used according to BETA.

MxS32 GetClickedObjectId() const { return m_clickedObjectId; }
const char* GetClickedAtom() const { return m_clickedAtom; }
MxS16 GetUnknown0x28() const { return m_unk0x28; }

void SetClickedObjectId(MxS32 p_clickedObjectId) { m_clickedObjectId = p_clickedObjectId; }
void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; }
Expand Down
1 change: 0 additions & 1 deletion LEGO1/lego/legoomni/include/legogamestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ class LegoGameState {
void SetDirty(MxBool p_isDirty) { m_isDirty = p_isDirty; }
void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }
void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; }
MxS16 GetPlayerCount() { return m_playerCount; }
LegoBackgroundColor* GetBackgroundColor() { return m_backgroundColor; }
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/actors/ambulance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_AmbulanceArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
Expand All @@ -454,7 +454,7 @@ MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param)
case IsleScript::c_AmbulanceHorn_Ctl:
MxSoundPresenter* presenter =
(MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "AmbulanceHorn_Sound");
presenter->Enable(p_param.GetUnknown0x28());
presenter->Enable(p_param.m_unk0x28);
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/actors/bike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_BikeArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
Expand All @@ -97,7 +97,7 @@ MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param)
case IsleScript::c_BikeHorn_Ctl:
MxSoundPresenter* presenter =
(MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "BikeHorn_Sound");
presenter->Enable(p_param.GetUnknown0x28());
presenter->Enable(p_param.m_unk0x28);
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/actors/dunebuggy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_DuneCarArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
Expand All @@ -137,7 +137,7 @@ MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
case IsleScript::c_DuneCarHorn_Ctl:
MxSoundPresenter* presenter =
(MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "DuneCarHorn_Sound");
presenter->Enable(p_param.GetUnknown0x28());
presenter->Enable(p_param.m_unk0x28);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/actors/jetski.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ void Jetski::RemoveFromWorld()
// FUNCTION: LEGO1 0x1007e8e0
MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param)
{
if (p_param.GetUnknown0x28() == 1 && CurrentWorld()->IsA("Isle")) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1 && CurrentWorld()->IsA("Isle")) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_JetskiArms_Ctl:
Exit();
((IslePathActor*) UserActor())
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/actors/motorcycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ MxLong Motocycle::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_MotoBikeArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/actors/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Radio::Stop()
MxLong Radio::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxDSAction action; // Unused
MxS32 objectId = p_param.GetClickedObjectId();
MxS32 objectId = p_param.m_clickedObjectId;

if (objectId == IsleScript::c_Radio_Ctl) {
if (m_state->IsActive()) {
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/actors/skateboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ MxLong SkateBoard::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxU32 result = 0;

if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) {
if (p_param.m_unk0x28 == 1 && p_param.m_clickedObjectId == IsleScript::c_SkateArms_Ctl) {
Exit();
GameState()->m_currentArea = LegoGameState::Area::e_unk66;
result = 1;
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/actors/towtrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param)
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case IsleScript::c_TowTrackArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
Expand All @@ -498,7 +498,7 @@ MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param)
break;
case IsleScript::c_TowHorn_Ctl:
MxSoundPresenter* presenter = (MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "TowHorn_Sound");
presenter->Enable(p_param.GetUnknown0x28());
presenter->Enable(p_param.m_unk0x28);
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ void MxBackgroundAudioManager::LowerVolume()
}

// FUNCTION: LEGO1 0x1007f5b0
// FUNCTION: BETA10 0x100e9543
void MxBackgroundAudioManager::RaiseVolume()
{
if (m_unk0x148 != 0) {
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ MxBool LegoControlManager::FUN_10029630()

while (cursor.Next(presenter)) {
if (((MxControlPresenter*) presenter)->FUN_10044480(&m_event, m_unk0x14)) {
g_unk0x100f31b0 = m_event.GetClickedObjectId();
g_unk0x100f31b0 = m_event.m_clickedObjectId;
g_unk0x100f31b4 = m_event.GetClickedAtom();
FUN_100292e0();
m_unk0x08 = 1;
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/src/entity/legoworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
}

// FUNCTION: LEGO1 0x10021790
// FUNCTION: BETA10 0x100db3de
MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
{
LegoEntityListCursor entityCursor(m_entityList);
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/src/main/scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MxAtomId* g_elevbottScript = NULL;
MxAtomId* g_infodoorScript = NULL;

// GLOBAL: LEGO1 0x100f4548
// GLOBAL: BETA10 0x102114dc
MxAtomId* g_infomainScript = NULL;

// GLOBAL: LEGO1 0x100f454c
Expand Down
5 changes: 2 additions & 3 deletions LEGO1/lego/legoomni/src/race/legoracemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ MxLong LegoRaceMap::Notify(MxParam& p_param)
MxNotificationParam& param = (MxNotificationParam&) p_param;

if (param.GetNotification() == c_notificationControl &&
m_Map_Ctl->GetAction()->GetObjectId() ==
((LegoControlManagerNotificationParam&) p_param).GetClickedObjectId()) {
m_Map_Ctl->GetAction()->GetObjectId() == ((LegoControlManagerNotificationParam&) p_param).m_clickedObjectId) {

if (((LegoControlManagerNotificationParam&) p_param).GetUnknown0x28() == 1) {
if (((LegoControlManagerNotificationParam&) p_param).m_unk0x28 == 1) {
m_unk0x08 = TRUE;
FUN_1005d4b0();
m_stillPresenter->Enable(TRUE);
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ MxLong ElevatorBottom::HandleControl(LegoControlManagerNotificationParam& p_para
{
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case ElevbottScript::c_LeftArrow_Ctl:
m_destLocation = LegoGameState::e_infodoor;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/worlds/gasstation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param
// FUNCTION: BETA10 0x10029445
MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
if (p_param.m_unk0x28 == 1) {
MxDSAction action;

switch (p_param.GetClickedObjectId()) {
switch (p_param.m_clickedObjectId) {
case GarageScript::c_LeftArrow_Ctl:
case GarageScript::c_RightArrow_Ctl:
m_state->m_unk0x14 = 0;
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/worlds/hospital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
// FUNCTION: LEGO1 0x10075f90
MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case HospitalScript::c_Info_Ctl:
BackgroundAudioManager()->RaiseVolume();
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
Expand Down
Loading

0 comments on commit 777dfa8

Please sign in to comment.