Match Infocenter::HandleButtonUp ()

This commit is contained in:
Christian Semmler 2025-02-11 15:23:20 -07:00 committed by GitHub
parent 956c900ec6
commit 347da7d555
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 19 deletions
LEGO1/lego/legoomni

View file

@ -5,6 +5,7 @@
#include "legogamestate.h"
#include "legostate.h"
#include "legoworld.h"
#include "misc.h"
#include "mxrect32.h"
#include "radio.h"
@ -44,6 +45,13 @@ public:
// FUNCTION: BETA10 0x10031bd0
MxBool HasRegistered() { return m_letters[0] != NULL; }
// FUNCTION: BETA10 0x10031c10
InfomainScript::Script GetNextLeaveDialogue()
{
return (InfomainScript::Script) m_leaveDialogue[GameState()->GetCurrentAct()].Next();
}
// TODO: These probably don't exist according to BETA
Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; }
Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; }
Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; }

View file

@ -205,7 +205,9 @@ public:
// FUNCTION: BETA10 0x1004a2d0
const char* GetActorName() { return g_actorNames[GetActorId()]; }
// FUNCTION: BETA10 0x1002b4c0
Act GetCurrentAct() { return m_currentAct; }
Act GetLoadedAct() { return m_loadedAct; }
Area GetPreviousArea() { return m_previousArea; }
Area GetUnknown0x42c() { return m_unk0x42c; }

View file

@ -17,7 +17,6 @@
#include "legoplantmanager.h"
#include "legoutils.h"
#include "legovideomanager.h"
#include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxcontrolpresenter.h"
@ -725,15 +724,16 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
}
// FUNCTION: LEGO1 0x1006fda0
// FUNCTION: BETA10 0x1002f907
MxLong Infocenter::HandleKeyPress(MxS8 p_key)
{
MxLong result = 0;
if (p_key == VK_SPACE && m_worldStarted) {
switch (m_infocenterState->GetUnknown0x74()) {
switch (m_infocenterState->m_unk0x74) {
case 0:
StopCutscene();
m_infocenterState->SetUnknown0x74(1);
m_infocenterState->m_unk0x74 = 1;
if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1;
@ -747,13 +747,13 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
InfomainScript::Script script = m_currentInfomainScript;
StopCurrentAction();
switch (m_infocenterState->GetUnknown0x74()) {
switch (m_infocenterState->m_unk0x74) {
case 5:
case 12:
m_currentInfomainScript = script;
return 1;
default:
m_infocenterState->SetUnknown0x74(2);
m_infocenterState->m_unk0x74 = 2;
return 1;
case 8:
case 11:
@ -772,6 +772,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
}
// FUNCTION: LEGO1 0x1006feb0
// FUNCTION: BETA10 0x1002fa12
MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
{
if (m_unk0x11c) {
@ -870,37 +871,37 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
case 10:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_jetraceExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
case 11:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_carraceExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
case 12:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_pizzeriaExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
case 13:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_garageExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
case 14:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_hospitalExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
case 15:
if (m_selectedCharacter) {
m_destLocation = LegoGameState::e_policeExterior;
m_infocenterState->SetUnknown0x74(5);
m_infocenterState->m_unk0x74 = 5;
}
break;
}
@ -910,14 +911,14 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
m_unk0x11c->Enable(FALSE);
m_unk0x11c = NULL;
if (m_infocenterState->GetUnknown0x74() == 5) {
if (m_infocenterState->m_unk0x74 == 5) {
InfomainScript::Script dialogueToPlay;
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
if (!m_infocenterState->HasRegistered()) {
m_infocenterState->SetUnknown0x74(2);
m_destLocation = LegoGameState::e_undefined;
dialogueToPlay = InfomainScript::c_iic007in_PlayWav;
m_infocenterState->m_unk0x74 = 2;
m_destLocation = LegoGameState::e_undefined;
}
else {
switch (m_selectedCharacter) {
@ -942,9 +943,8 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
GameState()->SetActorId(m_selectedCharacter);
break;
default:
dialogueToPlay =
(InfomainScript::Script) m_infocenterState->GetLeaveDialogue(GameState()->GetCurrentAct())
.Next();
assert(0);
dialogueToPlay = m_infocenterState->GetNextLeaveDialogue();
break;
}
@ -953,8 +953,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
}
}
else {
dialogueToPlay =
(InfomainScript::Script) m_infocenterState->GetLeaveDialogue(GameState()->GetCurrentAct()).Next();
dialogueToPlay = m_infocenterState->GetNextLeaveDialogue();
}
PlayAction(dialogueToPlay);