Rename Infocenterstate::m_buffer to m_letters (#558)

* Rename Infocenterstate::m_buffer

* Rename function

* Fix

* Fix

* Rename function

* Rename function

* Rename function
This commit is contained in:
Christian Semmler 2024-02-11 10:44:55 -05:00 committed by GitHub
parent 5233b48c59
commit 5bba81c0ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 37 deletions

View file

@ -29,8 +29,9 @@ class InfocenterState : public LegoState {
// FUNCTION: LEGO1 0x10071830 // FUNCTION: LEGO1 0x10071830
MxBool VTable0x14() override { return FALSE; } // vtable+0x14 MxBool VTable0x14() override { return FALSE; } // vtable+0x14
inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); } inline MxS16 GetMaxNameLength() { return _countof(m_letters); }
inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; } inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; }
inline MxBool HasRegistered() { return m_letters[0] != NULL; }
inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; } inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; }
inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; } inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; }
inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; } inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; }
@ -44,13 +45,13 @@ class InfocenterState : public LegoState {
// InfocenterState::`scalar deleting destructor' // InfocenterState::`scalar deleting destructor'
private: private:
Playlist m_exitDialogueAct1; // 0x08 Playlist m_exitDialogueAct1; // 0x08
Playlist m_exitDialogueAct23; // 0x14 Playlist m_exitDialogueAct23; // 0x14
Playlist m_returnDialogue[3]; // 0x20 Playlist m_returnDialogue[3]; // 0x20
Playlist m_leaveDialogue[3]; // 0x44 Playlist m_leaveDialogue[3]; // 0x44
Playlist m_bricksterDialogue; // 0x68 Playlist m_bricksterDialogue; // 0x68
MxU32 m_unk0x74; // 0x74 MxU32 m_unk0x74; // 0x74
MxStillPresenter* m_buffer[7]; // 0x78 MxStillPresenter* m_letters[7]; // 0x78
}; };
#endif // INFOCENTERSTATE_H #endif // INFOCENTERSTATE_H

View file

@ -126,7 +126,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
MxResult result; MxResult result;
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!infocenterState || !infocenterState->HasRegistered()) {
result = SUCCESS; result = SUCCESS;
} }
else { else {

View file

@ -62,11 +62,11 @@ Infocenter::~Infocenter()
MxS16 i = 0; MxS16 i = 0;
do { do {
if (m_infocenterState->GetInfocenterBufferElement(i) != NULL) { if (m_infocenterState->GetNameLetter(i) != NULL) {
m_infocenterState->GetInfocenterBufferElement(i)->Enable(FALSE); m_infocenterState->GetNameLetter(i)->Enable(FALSE);
} }
i++; i++;
} while (i < m_infocenterState->GetInfocenterBufferSize()); } while (i < m_infocenterState->GetMaxNameLength());
ControlManager()->Unregister(this); ControlManager()->Unregister(this);
@ -101,17 +101,17 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
} }
MxS16 count, i; MxS16 count, i;
for (count = 0; count < m_infocenterState->GetInfocenterBufferSize(); count++) { for (count = 0; count < m_infocenterState->GetMaxNameLength(); count++) {
if (m_infocenterState->GetInfocenterBufferElement(count) == NULL) { if (m_infocenterState->GetNameLetter(count) == NULL) {
break; break;
} }
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (m_infocenterState->GetInfocenterBufferElement(i)) { if (m_infocenterState->GetNameLetter(i)) {
m_infocenterState->GetInfocenterBufferElement(i)->Enable(TRUE); m_infocenterState->GetNameLetter(i)->Enable(TRUE);
m_infocenterState->GetInfocenterBufferElement(i)->SetTickleState(MxPresenter::e_repeating); m_infocenterState->GetNameLetter(i)->SetTickleState(MxPresenter::e_repeating);
m_infocenterState->GetInfocenterBufferElement(i)->VTable0x88(((7 - count) / 2 + i) * 29 + 223, 45); m_infocenterState->GetNameLetter(i)->VTable0x88(((7 - count) / 2 + i) * 29 + 223, 45);
} }
} }
} }
@ -267,7 +267,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
PlayAction(c_welcomeDialogue); PlayAction(c_welcomeDialogue);
m_currentCutscene = e_noIntro; m_currentCutscene = e_noIntro;
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1; m_bookAnimationTimer = 1;
return 1; return 1;
} }
@ -311,7 +311,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
break; break;
case 11: case 11:
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL && m_currentInfomainScript != c_mamaMovie && if (!m_infocenterState->HasRegistered() && m_currentInfomainScript != c_mamaMovie &&
m_currentInfomainScript != c_papaMovie && m_currentInfomainScript != c_pepperMovie && m_currentInfomainScript != c_papaMovie && m_currentInfomainScript != c_pepperMovie &&
m_currentInfomainScript != c_nickMovie && m_currentInfomainScript != c_lauraMovie) { m_currentInfomainScript != c_nickMovie && m_currentInfomainScript != c_lauraMovie) {
m_infoManDialogueTimer = 1; m_infoManDialogueTimer = 1;
@ -355,7 +355,7 @@ void Infocenter::ReadyWorld()
break; break;
case 4: case 4:
m_infocenterState->SetUnknown0x74(2); m_infocenterState->SetUnknown0x74(2);
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1; m_bookAnimationTimer = 1;
} }
@ -377,7 +377,7 @@ void Infocenter::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1; m_bookAnimationTimer = 1;
} }
@ -392,7 +392,7 @@ void Infocenter::ReadyWorld()
break; break;
case 0xf: case 0xf:
m_infocenterState->SetUnknown0x74(2); m_infocenterState->SetUnknown0x74(2);
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1; m_bookAnimationTimer = 1;
} }
@ -622,7 +622,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
StopCutscene(); StopCutscene();
m_infocenterState->SetUnknown0x74(1); m_infocenterState->SetUnknown0x74(1);
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_bookAnimationTimer = 1; m_bookAnimationTimer = 1;
return 1; return 1;
} }
@ -801,7 +801,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
InfomainScript dialogueToPlay; InfomainScript dialogueToPlay;
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { if (!m_infocenterState->HasRegistered()) {
m_infocenterState->SetUnknown0x74(2); m_infocenterState->SetUnknown0x74(2);
m_transitionDestination = LegoGameState::e_noArea; m_transitionDestination = LegoGameState::e_noArea;
dialogueToPlay = c_registerToContinueDialogue; dialogueToPlay = c_registerToContinueDialogue;
@ -949,7 +949,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
break; break;
case LegoGameState::e_unk4: case LegoGameState::e_unk4:
if (state->GetUnknownC()) { if (state->GetUnknownC()) {
if (m_infocenterState->GetInfocenterBufferElement(0)) { if (m_infocenterState->HasRegistered()) {
m_infocenterState->SetUnknown0x74(5); m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = state->GetPreviousArea(); m_transitionDestination = state->GetPreviousArea();
actionToPlay = actionToPlay =
@ -1069,7 +1069,7 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param)
} }
case 7: case 7:
if (m_infocenterState->GetUnknown0x74() == 8) { if (m_infocenterState->GetUnknown0x74() == 8) {
if (m_infocenterState->GetInfocenterBufferElement(0)) { if (m_infocenterState->HasRegistered()) {
GameState()->Save(0); GameState()->Save(0);
} }
@ -1371,11 +1371,11 @@ void Infocenter::StartCredits()
MxS16 i = 0; MxS16 i = 0;
do { do {
if (m_infocenterState->GetInfocenterBufferElement(i) != NULL) { if (m_infocenterState->GetNameLetter(i) != NULL) {
m_infocenterState->GetInfocenterBufferElement(i)->Enable(FALSE); m_infocenterState->GetNameLetter(i)->Enable(FALSE);
} }
i++; i++;
} while (i < m_infocenterState->GetInfocenterBufferSize()); } while (i < m_infocenterState->GetMaxNameLength());
VideoManager()->FUN_1007c520(); VideoManager()->FUN_1007c520();
GetViewManager()->RemoveAll(NULL); GetViewManager()->RemoveAll(NULL);

View file

@ -111,7 +111,7 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
case 4: case 4:
if (GameState()->GetUnknownC()) { if (GameState()->GetUnknownC()) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->GetInfocenterBufferElement(0) != NULL) { if (state->HasRegistered()) {
m_unk0xf8 = LegoGameState::e_unk4; m_unk0xf8 = LegoGameState::e_unk4;
} }
else { else {

View file

@ -107,7 +107,7 @@ InfocenterState::InfocenterState()
m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, _countof(g_bricksterDialogue)); m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, _countof(g_bricksterDialogue));
memset(m_buffer, 0, sizeof(m_buffer)); memset(m_letters, 0, sizeof(m_letters));
} }
// FUNCTION: LEGO1 0x10071920 // FUNCTION: LEGO1 0x10071920
@ -115,10 +115,10 @@ InfocenterState::~InfocenterState()
{ {
MxS16 i = 0; MxS16 i = 0;
do { do {
if (GetInfocenterBufferElement(i) != NULL) { if (GetNameLetter(i) != NULL) {
delete GetInfocenterBufferElement(i)->GetAction(); delete GetNameLetter(i)->GetAction();
delete GetInfocenterBufferElement(i); delete GetNameLetter(i);
} }
i++; i++;
} while (i < GetInfocenterBufferSize()); } while (i < GetMaxNameLength());
} }