Implement various infocenter methods

This commit is contained in:
Misha 2024-01-30 19:12:27 -05:00
parent cdf76754f7
commit 5210d04e11
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
11 changed files with 384 additions and 31 deletions

View File

@ -27,9 +27,12 @@ class Act1State : public LegoState {
inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x18 = p_unk0x18; }
inline MxU32 GetUnknown18() { return m_unk0x18; }
inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x21 = p_unk0x21; }
inline MxU32 GetUnknown1c() { return m_unk0x1c; }
inline MxS16 GetUnknown21() { return m_unk0x21; }
inline void SetUnknown1c(MxU32 p_unk0x1c) { m_unk0x1c = p_unk0x1c; }
inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x21 = p_unk0x21; }
void FUN_10034d00();
// SYNTHETIC: LEGO1 0x10033960

View File

@ -4,6 +4,8 @@
#include "decomp.h"
#include "legoworld.h"
class LegoControlManagerEvent;
// VTABLE: LEGO1 0x100d5f20
// SIZE: 0xfc (from inlined ctor at 0x1000a8aa)
class ElevatorBottom : public LegoWorld {
@ -41,7 +43,7 @@ class ElevatorBottom : public LegoWorld {
private:
undefined4 m_unk0xf8; // 0xf8
MxLong HandleNotification17(MxParam& p_param);
MxLong HandleNotification17(LegoControlManagerEvent& p_param);
};
#endif // ELEVATORBOTTOM_H

View File

@ -6,6 +6,7 @@
class InfocenterState;
class MxStillPresenter;
class LegoControlManagerEvent;
// SIZE 0x18
struct InfocenterMapEntry {
@ -40,12 +41,15 @@ class Infocenter : public LegoWorld {
c_leftArrowCtl = 1,
c_rightArrowCtl = 2,
c_infoCtl = 3,
c_doorCtl = 4,
c_boatCtl = 10,
c_raceCtl = 11,
c_pizzaCtl = 12,
c_gasCtl = 13,
c_medCtl = 14,
c_copCtl = 15,
c_bigInfoCtl = 16,
c_bookCtl = 17,
c_radioCtl = 18,
c_mamaCtl = 21,
c_papaCtl = 22,
@ -53,6 +57,15 @@ class Infocenter : public LegoWorld {
c_nickCtl = 24,
c_lauraCtl = 25,
c_mamaSelected = 30,
c_papaSelected = 31,
c_pepperSelected = 32,
c_nickSelected = 33,
c_lauraSelected = 34,
c_goToRegBook = 70,
c_goToRegBookRed = 71,
c_welcomeDialogue = 500,
c_goodJobDialogue = 501,
@ -114,6 +127,13 @@ class Infocenter : public LegoWorld {
c_noCDDialogueUnused1 = 552,
c_noCDDialogueUnused2 = 553,
c_gasCtlDescription = 555,
c_medCtlDescription = 556,
c_boatCtlDescription = 558,
c_copCtlDescription = 559,
c_pizzaCtlDescription = 560,
c_raceCtlDescription = 561,
c_leaveInfoCenterDialogue1 = 562,
c_leaveInfoCenterDialogue2 = 563,
c_leaveInfoCenterDialogue3 = 564,
@ -163,16 +183,18 @@ class Infocenter : public LegoWorld {
MxLong HandleKeyPress(MxS8 p_key);
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
MxU8 HandleNotification17(MxParam&);
MxU8 HandleNotification17(LegoControlManagerEvent& p_param);
MxLong HandleEndAction(MxParam& p_param);
MxLong HandleNotification0(MxParam&);
void FUN_10070dc0(MxBool);
void UpdateFrameHot(MxBool p_display);
void FUN_10070e90();
void PlayCutscene(Cutscene p_entityId, MxBool p_scale);
void StopCutscene();
void FUN_10070d10(MxS32 p_x, MxS32 p_y);
void StartCredits();
void StopCredits();
@ -185,10 +207,10 @@ class Infocenter : public LegoWorld {
InfomainScript m_currentInfomainScript; // 0xf8
MxS16 m_unk0xfc; // 0xfc
InfocenterState* m_infocenterState; // 0x100
undefined4 m_unk0x104; // 0x104
undefined4 m_transitionDestination; // 0x104
Cutscene m_currentCutscene; // 0x108
Radio m_radio; // 0x10c
undefined4 m_unk0x11c; // 0x11c
MxStillPresenter* m_unk0x11c; // 0x11c
InfocenterMapEntry m_mapAreas[7]; // 0x120
MxS16 m_unk0x1c8; // 0x1c8
MxStillPresenter* m_frameHotBitmap; // 0x1cc

View File

@ -3,6 +3,8 @@
#include "legoworld.h"
class LegoControlManagerEvent;
// VTABLE: LEGO1 0x100d72d8
// SIZE 0xfc
class InfocenterDoor : public LegoWorld {
@ -39,6 +41,8 @@ class InfocenterDoor : public LegoWorld {
private:
MxS32 m_unk0xf8; // 0xf8
MxLong HandleClick(LegoControlManagerEvent& p_param);
};
#endif // INFOCENTERDOOR_H

View File

@ -39,6 +39,7 @@ class LegoGameState {
inline MxU32 GetUnknown10() { return m_unk0x10; }
inline MxS32 GetCurrentAct() { return m_currentAct; }
inline undefined4 GetUnknown424() { return m_unk0x424; }
inline undefined4 GetPrevArea() { return m_prevArea; }
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; }
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; }

View File

@ -29,18 +29,19 @@ class Radio : public MxCore {
}
void Initialize(MxBool p_und);
void Play();
void Stop();
// SYNTHETIC: LEGO1 0x1002c970
// Radio::`scalar deleting destructor'
private:
void CreateRadioState();
RadioState* m_state; // 0x08
MxBool m_unk0x0c; // 0x0c
MxBool m_bgAudioPreviouslyEnabled; // 0x0d
void CreateRadioState();
void Play();
void Stop();
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleNotification17(LegoControlManagerEvent& p_param);
};

View File

@ -282,6 +282,18 @@ void LegoGameState::HandleAction(MxU32 p_area)
VideoManager()->SetUnk0x554(1);
script = g_infodoorScript;
break;
// TODO
case 5:
script = g_elevbottScript;
break;
case 12:
VideoManager()->SetUnk0x554(1);
script = g_regbookScript;
break;
case 13:
VideoManager()->SetUnk0x554(1);
script = g_infoscorScript;
break;
// TODO: implement other cases
}

View File

@ -1,5 +1,6 @@
#include "elevatorbottom.h"
#include "act1state.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
@ -7,9 +8,14 @@
#include "legoomni.h"
#include "mxnotificationmanager.h"
#include "mxomni.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc)
// STRING: LEGO1 0x100f0d34
// GLOBAL: LEGO1 0x100f3a44
char* g_cameraLoc = "CAMERA_LOCATION";
// FUNCTION: LEGO1 0x10017e90
ElevatorBottom::ElevatorBottom()
{
@ -53,7 +59,7 @@ MxLong ElevatorBottom::Notify(MxParam& p_param)
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetType()) {
case c_notificationType17:
ret = HandleNotification17(p_param);
ret = HandleNotification17((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->HandleAction(m_unk0xf8);
@ -72,10 +78,37 @@ void ElevatorBottom::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// STUB: LEGO1 0x100181d0
MxLong ElevatorBottom::HandleNotification17(MxParam& p_param)
// FUNCTION: LEGO1 0x100181d0
MxLong ElevatorBottom::HandleNotification17(LegoControlManagerEvent& p_param)
{
return 0;
MxLong result = 0;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = 3;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 2:
m_unk0xf8 = 2;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 3:
LegoGameState* gs = GameState();
Act1State* state = (Act1State*) gs->GetState("Act1State");
if (state == NULL) {
state = (Act1State*) gs->CreateState("Act1State");
}
state->SetUnknown1c(1);
m_unk0xf8 = 6;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VariableTable()->SetVariable(g_cameraLoc, "LCAMZI1,90");
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x100182c0

View File

@ -32,7 +32,7 @@ Infocenter::Infocenter()
m_infocenterState = NULL;
m_frameHotBitmap = 0;
m_unk0x11c = 0;
m_unk0x104 = 0;
m_transitionDestination = 0;
m_currentInfomainScript = c_noInfomain;
m_currentCutscene = e_noIntro;
@ -127,7 +127,7 @@ MxLong Infocenter::Notify(MxParam& p_param)
);
break;
case c_notificationType17:
result = HandleNotification17(p_param);
result = HandleNotification17((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
StopBookAnimation();
@ -137,10 +137,10 @@ MxLong Infocenter::Notify(MxParam& p_param)
StartCredits();
m_infocenterState->SetUnknown0x74(0xd);
}
else if (m_unk0x104 != 0) {
else if (m_transitionDestination != 0) {
BackgroundAudioManager()->RaiseVolume();
GameState()->HandleAction(m_unk0x104);
m_unk0x104 = 0;
GameState()->HandleAction(m_transitionDestination);
m_transitionDestination = 0;
}
break;
}
@ -189,7 +189,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param)
break;
}
FUN_10070dc0(TRUE);
UpdateFrameHot(TRUE);
}
}
@ -433,13 +433,31 @@ void Infocenter::InitializeBitmaps()
m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap");
FUN_10070dc0(TRUE);
UpdateFrameHot(TRUE);
}
// STUB: LEGO1 0x1006fd00
// FUNCTION: LEGO1 0x1006fd00
MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
{
return 1;
if (m_unk0x11c) {
if (!m_unk0x11c->IsEnabled()) {
MxS32 oldDisplayZ = m_unk0x11c->GetDisplayZ();
m_unk0x11c->SetDisplayZ(1000);
VideoManager()->SortPresenterList();
m_unk0x11c->Enable(TRUE);
m_unk0x11c->VTable0x88(p_x, p_y);
m_unk0x11c->SetDisplayZ(oldDisplayZ);
}
else {
m_unk0x11c->VTable0x88(p_x, p_y);
}
FUN_10070d10(p_x, p_y);
return 1;
}
return 0;
}
// FUNCTION: LEGO1 0x1006fda0
@ -492,12 +510,119 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
// STUB: LEGO1 0x1006feb0
MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
{
return 1;
return FALSE;
}
// STUB: LEGO1 0x10070370
MxU8 Infocenter::HandleNotification17(MxParam&)
// FUNCTION: LEGO1 0x10070370
MxU8 Infocenter::HandleNotification17(LegoControlManagerEvent& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
m_infoManDialogueTimer = 0;
InfomainScript actionToPlay = c_noInfomain;
StopCurrentAction();
InfomainScript characterBitmap = c_noInfomain;
switch (p_param.GetClickedObjectId()) {
case c_leftArrowCtl:
m_infocenterState->SetUnknown0x74(14);
StopCurrentAction();
if (GameState()->GetUnknown10() == 0) {
m_radio.Stop();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_transitionDestination = 5;
}
else {
// todo
}
break;
case c_rightArrowCtl:
m_infocenterState->SetUnknown0x74(14);
StopCurrentAction();
if (GameState()->GetUnknown10() == 0) {
m_radio.Stop();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_transitionDestination = 13;
}
else {
// todo
}
break;
case c_infoCtl:
m_radio.Stop();
break;
case c_doorCtl:
if (m_infocenterState->GetUnknown0x74() != 8) {
actionToPlay = c_exitConfirmationDialogue;
m_radio.Stop();
m_infocenterState->SetUnknown0x74(8);
}
break;
case c_boatCtl:
actionToPlay = c_boatCtlDescription;
m_radio.Stop();
break;
case c_raceCtl:
actionToPlay = c_raceCtlDescription;
m_radio.Stop();
break;
case c_pizzaCtl:
actionToPlay = c_pizzaCtlDescription;
m_radio.Stop();
break;
case c_gasCtl:
actionToPlay = c_gasCtlDescription;
m_radio.Stop();
break;
case c_medCtl:
actionToPlay = c_medCtlDescription;
m_radio.Stop();
break;
case c_copCtlDescription:
actionToPlay = c_medCtlDescription;
m_radio.Stop();
break;
case c_bigInfoCtl:
// TODO
break;
case c_bookCtl:
m_transitionDestination = 12;
m_infocenterState->SetUnknown0x74(4);
actionToPlay = GameState()->GetUnknown10() ? c_goToRegBookRed : c_goToRegBook;
m_radio.Stop();
GameState()->SetUnknown424(GameState()->GetPrevArea());
InputManager()->DisableInputProcessing();
break;
case c_mamaCtl:
characterBitmap = c_mamaSelected;
UpdateFrameHot(FALSE);
break;
case c_papaCtl:
characterBitmap = c_papaSelected;
UpdateFrameHot(FALSE);
break;
case c_pepperCtl:
characterBitmap = c_pepperSelected;
UpdateFrameHot(FALSE);
break;
case c_nickCtl:
characterBitmap = c_nickSelected;
UpdateFrameHot(FALSE);
break;
case c_lauraCtl:
characterBitmap = c_lauraCtl;
UpdateFrameHot(FALSE);
break;
}
if (actionToPlay != c_noInfomain) {
PlayAction(actionToPlay);
}
if (characterBitmap != c_noInfomain)
{
m_unk0x11c = (MxStillPresenter*)Find(m_atom, characterBitmap);
}
}
return 1;
}
@ -595,15 +720,78 @@ void Infocenter::StopCutscene()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x10070d10
void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
{
MxS16 i;
for (i = 0; i < sizeof(m_mapAreas) / sizeof(InfocenterMapEntry); i++) {
if (m_mapAreas[i].m_unk0x08 <= p_x && p_x <= m_mapAreas[i].m_unk0x10 && m_mapAreas[i].m_unk0x0c <= p_y &&
p_y <= m_mapAreas[i].m_unk0x14) {
break;
}
}
if (i == 7) {
i = -1;
}
if (i != m_unk0x1c8) {
if (m_unk0x1c8 != -1) {
m_mapAreas[i].m_presenter->Enable(FALSE);
}
m_unk0x1c8 = i;
if (i != -1) {
m_mapAreas[i].m_presenter->Enable(TRUE);
}
}
}
// FUNCTION: LEGO1 0x10070d00
MxBool Infocenter::VTable0x5c()
{
return TRUE;
}
// STUB: LEGO1 0x10070dc0
void Infocenter::FUN_10070dc0(MxBool)
// FUNCTION: LEGO1 0x10070dc0
void Infocenter::UpdateFrameHot(MxBool p_display)
{
if (p_display) {
MxU32 x;
switch (GameState()->GetUnknownC()) {
case 1:
x = 302;
break;
case 2:
x = 204;
break;
case 3:
x = 253;
break;
case 4:
x = 353;
break;
case 5:
x = 399;
break;
default:
return;
}
MxS32 oldZ = m_frameHotBitmap->GetDisplayZ();
m_frameHotBitmap->SetDisplayZ(1000);
VideoManager()->SortPresenterList();
m_frameHotBitmap->Enable(TRUE);
m_frameHotBitmap->VTable0x88(x, 81);
m_frameHotBitmap->SetDisplayZ(oldZ);
}
else {
if (m_frameHotBitmap) {
m_frameHotBitmap->Enable(FALSE);
}
}
}
// STUB: LEGO1 0x10070e90
@ -611,9 +799,23 @@ void Infocenter::FUN_10070e90()
{
}
// STUB: LEGO1 0x10070f60
// FUNCTION: LEGO1 0x10070f60
MxBool Infocenter::VTable0x64()
{
if (m_infocenterState != NULL) {
MxU32 val = m_infocenterState->GetUnknown0x74();
if (val == 0) {
StopCutscene();
m_infocenterState->SetUnknown0x74(1);
}
else if (val == 13) {
StopCredits();
}
else if (val != 8) {
Notify(MxNotificationParam(c_notificationType0, NULL));
}
}
return FALSE;
}

View File

@ -1,11 +1,15 @@
#include "infocenterdoor.h"
#include "infocenterstate.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc)
@ -45,11 +49,79 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
return result;
}
// STUB: LEGO1 0x100379e0
// FUNCTION: LEGO1 0x100379e0
MxLong InfocenterDoor::Notify(MxParam& p_param)
{
// TODO
return LegoWorld::Notify(p_param);
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetType()) {
case c_notificationEndAction:
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) {
BackgroundAudioManager()->RaiseVolume();
result = 1;
}
break;
case c_notificationType17:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->HandleAction(m_unk0xf8);
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x10037a90
MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
DeleteObjects(&m_atom, 500, 510);
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = 13;
break;
case 2:
m_unk0xf8 = 5;
break;
case 3:
m_unk0xf8 = 2;
break;
case 4:
if (GameState()->GetUnknownC()) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->GetInfocenterBufferElement(0) != NULL) {
m_unk0xf8 = 4;
}
else {
MxDSAction action;
action.SetObjectId(503);
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
return 1;
}
}
else {
MxDSAction action;
action.SetObjectId(500);
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
return 1;
}
default:
return 0;
}
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
}
return 1;
}
// FUNCTION: LEGO1 0x10037a70

View File

@ -120,6 +120,7 @@ class MxPresenter : public MxCore {
{
m_compositePresenter = p_compositePresenter;
}
inline void SetDisplayZ(MxS32 p_displayZ) { m_displayZ = p_displayZ; }
// SYNTHETIC: LEGO1 0x1000c070
// MxPresenter::`scalar deleting destructor'