Implement Infocenter::HandleNotification0 (#514)

* Implement Infocenter::HandleNotification0

* Match

* Match

* Match

* Match

* Braces

* Add enum constants
This commit is contained in:
Christian Semmler 2024-02-01 15:56:27 -05:00 committed by GitHub
parent 9e686e2a87
commit 17252b95f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 13 deletions

View file

@ -61,9 +61,17 @@ class Infocenter : public LegoWorld {
c_nickSelected = 33,
c_lauraSelected = 34,
c_unk40 = 40,
c_unk41 = 41,
c_unk42 = 42,
c_unk43 = 43,
c_unk44 = 44,
c_goToRegBook = 70,
c_goToRegBookRed = 71,
c_unk499 = 499,
c_welcomeDialogue = 500,
c_goodJobDialogue = 501,
@ -127,6 +135,7 @@ class Infocenter : public LegoWorld {
c_gasCtlDescription = 555,
c_medCtlDescription = 556,
c_unk557 = 557,
c_boatCtlDescription = 558,
c_copCtlDescription = 559,
c_pizzaCtlDescription = 560,
@ -182,8 +191,8 @@ class Infocenter : public LegoWorld {
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
MxU8 HandleClick(LegoControlManagerEvent& p_param);
MxLong HandleEndAction(MxParam& p_param);
MxLong HandleNotification0(MxParam&);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleNotification0(MxNotificationParam& p_param);
void UpdateFrameHot(MxBool p_display);
void FUN_10070e90();

View file

@ -30,6 +30,8 @@ class InfocenterState : public LegoState {
inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); }
inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; }
inline StateStruct& GetUnknown0x08() { return m_unk0x08; }
inline StateStruct& GetUnknown0x14() { return m_unk0x14; }
inline StateStruct& GetUnknown0x68() { return m_unk0x68; }
inline MxU32 GetUnknown0x74() { return m_unk0x74; }
@ -39,7 +41,8 @@ class InfocenterState : public LegoState {
// InfocenterState::`scalar deleting destructor'
private:
undefined m_unk0x08[0x18]; // 0x08
StateStruct m_unk0x08; // 0x08
StateStruct m_unk0x14; // 0x14
StateStruct m_unk0x20[3]; // 0x20
StateStruct m_unk0x44[3]; // 0x44
StateStruct m_unk0x68; // 0x68

View file

@ -32,6 +32,8 @@ class Radio : public MxCore {
void Play();
void Stop();
inline RadioState* GetState() { return m_state; }
// SYNTHETIC: LEGO1 0x1002c970
// Radio::`scalar deleting destructor'

View file

@ -106,10 +106,10 @@ MxLong Infocenter::Notify(MxParam& p_param)
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationType0:
result = HandleNotification0(p_param);
result = HandleNotification0((MxNotificationParam&) p_param);
break;
case c_notificationEndAction:
result = HandleEndAction(p_param);
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
result = HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey());
@ -150,17 +150,17 @@ MxLong Infocenter::Notify(MxParam& p_param)
}
// FUNCTION: LEGO1 0x1006f080
MxLong Infocenter::HandleEndAction(MxParam& p_param)
MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
{
MxDSAction* action = ((MxEndActionNotificationParam&) p_param).GetAction();
if (action->GetAtomId() == *g_creditsScript && action->GetObjectId() == 499) {
MxDSAction* action = p_param.GetAction();
if (action->GetAtomId() == *g_creditsScript && action->GetObjectId() == c_unk499) {
Lego()->CloseMainWindow();
return 1;
}
if (action->GetAtomId() == m_atom &&
(action->GetObjectId() == 40 || action->GetObjectId() == 41 || action->GetObjectId() == 42 ||
action->GetObjectId() == 43 || action->GetObjectId() == 44)) {
(action->GetObjectId() == c_unk40 || action->GetObjectId() == c_unk41 || action->GetObjectId() == c_unk42 ||
action->GetObjectId() == c_unk43 || action->GetObjectId() == c_unk44)) {
if (m_unk0x1d4) {
m_unk0x1d4--;
}
@ -260,7 +260,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param)
BackgroundAudioManager()->RaiseVolume();
return 1;
case 4:
if (action->GetObjectId() == 70 || action->GetObjectId() == 71) {
if (action->GetObjectId() == c_goToRegBook || action->GetObjectId() == c_goToRegBookRed) {
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_infocenterState->SetUnknown0x74(14);
return 1;
@ -638,9 +638,73 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
return 1;
}
// STUB: LEGO1 0x10070870
MxLong Infocenter::HandleNotification0(MxParam&)
// FUNCTION: LEGO1 0x10070870
MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param)
{
// MxLong result
MxCore* sender = p_param.GetSender();
if (sender == NULL) {
if (m_infocenterState->GetUnknown0x74() == 8) {
m_infoManDialogueTimer = 0;
StopCutscene();
PlayAction(c_exitConfirmationDialogue);
}
}
else if (sender->IsA("MxEntity") && m_infocenterState->GetUnknown0x74() != 5 && m_infocenterState->GetUnknown0x74() != 12) {
switch (((MxEntity*) sender)->GetEntityId()) {
case 5: {
m_infoManDialogueTimer = 0;
InfomainScript objectId;
if (GameState()->GetUnknown10()) {
objectId = (InfomainScript) m_infocenterState->GetUnknown0x14().FUN_10014d00();
}
else {
objectId = (InfomainScript) m_infocenterState->GetUnknown0x08().FUN_10014d00();
}
PlayAction(objectId);
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
return 1;
}
case 6:
if (m_infocenterState->GetUnknown0x74() == 8) {
StopCurrentAction();
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
m_infocenterState->SetUnknown0x74(2);
PlayAction(c_infomanSneeze);
return 1;
}
case 7:
if (m_infocenterState->GetUnknown0x74() == 8) {
if (m_infocenterState->GetInfocenterBufferElement(0)) {
GameState()->Save(0);
}
m_infocenterState->SetUnknown0x74(12);
PlayAction(c_exitGameDialogue);
InputManager()->DisableInputProcessing();
InputManager()->SetUnknown336(TRUE);
return 1;
}
}
}
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 ||
m_currentInfomainScript == c_boatCtlDescription || m_currentInfomainScript == c_raceCtlDescription ||
m_currentInfomainScript == c_pizzaCtlDescription || m_currentInfomainScript == c_gasCtlDescription ||
m_currentInfomainScript == c_medCtlDescription || m_currentInfomainScript == c_copCtlDescription) {
StopCurrentAction();
}
}
}
return 1;
}