Implement more infocenter methods (#519)

* push changes

* format fix

* Update legogamestate.cpp

* Update legogamestate.cpp

* Fixes

* Match Infocenter::Create

* Style

* Fix InfocenterDoor::HandleClick

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-02-02 16:32:50 -05:00
committed by GitHub
parent a28113a26f
commit 0c47ed5056
10 changed files with 286 additions and 27 deletions

View File

@@ -10,6 +10,7 @@
#include "legovideomanager.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxcontrolpresenter.h"
#include "mxnotificationmanager.h"
#include "mxstillpresenter.h"
#include "mxticklemanager.h"
@@ -73,28 +74,54 @@ Infocenter::~Infocenter()
TickleManager()->UnregisterClient(this);
}
// STUB: LEGO1 0x1006ed90
// FUNCTION: LEGO1 0x1006ed90
MxResult Infocenter::Create(MxDSAction& p_dsAction)
{
if (LegoWorld::Create(p_dsAction) == SUCCESS) {
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
LegoGameState* gs = GameState();
m_infocenterState = (InfocenterState*) gs->GetState("InfocenterState");
m_infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
if (!m_infocenterState) {
m_infocenterState = (InfocenterState*) gs->CreateState("InfocenterState");
m_infocenterState = (InfocenterState*) GameState()->CreateState("InfocenterState");
m_infocenterState->SetUnknown0x74(3);
}
else {
// TODO
if (m_infocenterState->GetUnknown0x74() != 8 && m_infocenterState->GetUnknown0x74() != 4 &&
m_infocenterState->GetUnknown0x74() != 15) {
m_infocenterState->SetUnknown0x74(2);
}
MxS16 count, i;
for (count = 0; count < m_infocenterState->GetInfocenterBufferSize(); count++) {
if (m_infocenterState->GetInfocenterBufferElement(count) == NULL) {
break;
}
}
for (i = 0; i < count; i++) {
if (m_infocenterState->GetInfocenterBufferElement(i)) {
m_infocenterState->GetInfocenterBufferElement(i)->Enable(TRUE);
m_infocenterState->GetInfocenterBufferElement(i)->SetTickleState(MxPresenter::e_repeating);
m_infocenterState->GetInfocenterBufferElement(i)->VTable0x88(((7 - count) / 2 + i) * 29 + 223, 45);
}
}
}
GameState()->SetCurrentArea(2);
GameState()->StopArea(0);
if (m_infocenterState->GetUnknown0x74() == 4) {
LegoGameState* state = GameState();
state->SetPreviousArea(GameState()->GetUnknown0x42c());
}
// TODO
InputManager()->Register(this);
SetIsWorldActive(FALSE);
return SUCCESS;
return result;
}
// FUNCTION: LEGO1 0x1006ef10
@@ -159,8 +186,9 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
}
if (action->GetAtomId() == m_atom &&
(action->GetObjectId() == c_unk40 || action->GetObjectId() == c_unk41 || action->GetObjectId() == c_unk42 ||
action->GetObjectId() == c_unk43 || action->GetObjectId() == c_unk44)) {
(action->GetObjectId() == c_mamaMovie || action->GetObjectId() == c_papaMovie ||
action->GetObjectId() == c_pepperMovie || action->GetObjectId() == c_nickMovie ||
action->GetObjectId() == c_lauraMovie)) {
if (m_unk0x1d4) {
m_unk0x1d4--;
}
@@ -509,9 +537,194 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
return result;
}
// STUB: LEGO1 0x1006feb0
// FUNCTION: LEGO1 0x1006feb0
MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
{
if (m_unk0x11c) {
MxControlPresenter* control = InputManager()->GetControlManager()->FUN_100294e0(p_x - 1, p_y - 1);
switch (m_unk0x11c->GetAction()->GetObjectId()) {
case c_mamaSelected:
m_unk0xfc = 2;
break;
case c_papaSelected:
m_unk0xfc = 3;
break;
case c_pepperSelected:
m_unk0xfc = 1;
break;
case c_nickSelected:
m_unk0xfc = 4;
break;
case c_lauraSelected:
m_unk0xfc = 5;
break;
}
if (control != NULL) {
m_infoManDialogueTimer = 0;
switch (control->GetAction()->GetObjectId()) {
case c_mamaCtl:
if (m_unk0xfc == 2) {
m_radio.Stop();
BackgroundAudioManager()->Stop();
PlayAction(c_mamaMovie);
m_unk0x1d4++;
}
break;
case c_papaCtl:
if (m_unk0xfc == 3) {
m_radio.Stop();
BackgroundAudioManager()->Stop();
PlayAction(c_papaMovie);
m_unk0x1d4++;
}
break;
case c_pepperCtl:
if (m_unk0xfc == 1) {
m_radio.Stop();
BackgroundAudioManager()->Stop();
PlayAction(c_pepperMovie);
m_unk0x1d4++;
}
break;
case c_nickCtl:
if (m_unk0xfc == 4) {
m_radio.Stop();
BackgroundAudioManager()->Stop();
PlayAction(c_nickMovie);
m_unk0x1d4++;
}
break;
case c_lauraCtl:
if (m_unk0xfc == 5) {
m_radio.Stop();
BackgroundAudioManager()->Stop();
PlayAction(c_lauraMovie);
m_unk0x1d4++;
}
break;
}
}
else {
if (m_unk0x1c8 != -1) {
m_infoManDialogueTimer = 0;
switch (m_mapAreas[m_unk0x1c8].m_unk0x04) {
case 3:
GameState()->FUN_10039780(m_unk0xfc);
switch (m_unk0xfc) {
case 1:
PlayAction(c_pepperCharacterSelect);
break;
case 2:
PlayAction(c_mamaCharacterSelect);
break;
case 3:
PlayAction(c_papaCharacterSelect);
break;
case 4:
PlayAction(c_nickCharacterSelect);
break;
case 5:
PlayAction(c_lauraCharacterSelect);
break;
}
break;
case 10:
if (m_unk0xfc) {
m_transitionDestination = 16;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 11:
if (m_unk0xfc) {
m_transitionDestination = 19;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 12:
if (m_unk0xfc) {
m_transitionDestination = 22;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 13:
if (m_unk0xfc) {
m_transitionDestination = 25;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 14:
if (m_unk0xfc) {
m_transitionDestination = 29;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 15:
if (m_unk0xfc) {
m_transitionDestination = 32;
m_infocenterState->SetUnknown0x74(5);
}
break;
}
}
}
m_unk0x11c->Enable(FALSE);
m_unk0x11c = NULL;
if (m_infocenterState->GetUnknown0x74() == 5) {
InfomainScript dialogueToPlay;
if (GameState()->GetUnknown10() == 0) {
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) {
m_infocenterState->SetUnknown0x74(2);
m_transitionDestination = 0;
dialogueToPlay = c_registerToContinueDialogue;
}
else {
switch (m_unk0xfc) {
case 1:
dialogueToPlay = c_pepperCharacterSelect;
break;
case 2:
dialogueToPlay = c_mamaCharacterSelect;
break;
case 3:
dialogueToPlay = c_papaCharacterSelect;
break;
case 4:
dialogueToPlay = c_nickCharacterSelect;
break;
case 5:
dialogueToPlay = c_lauraCharacterSelect;
GameState()->SetUnknown0x0c(m_unk0xfc);
break;
default:
dialogueToPlay =
(InfomainScript) m_infocenterState->GetUnknown0x44()[GameState()->GetUnknown10()].Next();
break;
}
InputManager()->DisableInputProcessing();
InputManager()->SetUnknown336(TRUE);
}
}
else {
dialogueToPlay =
(InfomainScript) m_infocenterState->GetUnknown0x44()[GameState()->GetUnknown10()].Next();
}
PlayAction(dialogueToPlay);
}
UpdateFrameHot(TRUE);
FUN_10070d10(0, 0);
}
return FALSE;
}
@@ -694,9 +907,9 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param)
}
else {
if (sender->IsA("Radio") && m_radio.GetState()->IsActive()) {
if (m_currentInfomainScript == c_unk40 || m_currentInfomainScript == c_unk41 ||
m_currentInfomainScript == c_unk42 || m_currentInfomainScript == c_unk43 ||
m_currentInfomainScript == c_unk44 || m_currentInfomainScript == c_unk557 ||
if (m_currentInfomainScript == c_mamaMovie || m_currentInfomainScript == c_papaMovie ||
m_currentInfomainScript == c_pepperMovie || m_currentInfomainScript == c_nickMovie ||
m_currentInfomainScript == c_lauraMovie || m_currentInfomainScript == c_unk557 ||
m_currentInfomainScript == c_boatCtlDescription || m_currentInfomainScript == c_raceCtlDescription ||
m_currentInfomainScript == c_pizzaCtlDescription || m_currentInfomainScript == c_gasCtlDescription ||
m_currentInfomainScript == c_medCtlDescription || m_currentInfomainScript == c_copCtlDescription) {
@@ -823,7 +1036,7 @@ void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
if (i != m_unk0x1c8) {
if (m_unk0x1c8 != -1) {
m_mapAreas[i].m_presenter->Enable(FALSE);
m_mapAreas[m_unk0x1c8].m_presenter->Enable(FALSE);
}
m_unk0x1c8 = i;

View File

@@ -120,6 +120,7 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
goto done;
}
}
else {
@@ -128,9 +129,12 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
goto done;
}
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
done:
result = 1;
break;
}