implement RegistrationBook::ReadyWorld()

This commit is contained in:
Ramen2X 2024-03-15 12:30:56 -04:00
parent 78f0455463
commit e9119e8bf0
4 changed files with 123 additions and 45 deletions

View File

@ -76,35 +76,35 @@ enum Script {
c_Back_Down_Bitmap = 66, c_Back_Down_Bitmap = 66,
c_Info_Down_Bitmap = 67, c_Info_Down_Bitmap = 67,
c_Check0_Ctl = 68, c_Check0_Ctl = 68,
c_Check0_Bitmap = 69, c_Check0_Bitmap_69 = 69,
c_Check0_Bitmap = 70, c_Check0_Bitmap_70 = 70,
c_Check1_Ctl = 71, c_Check1_Ctl = 71,
c_Check1_Bitmap = 72, c_Check1_Bitmap_72 = 72,
c_Check1_Bitmap = 73, c_Check1_Bitmap_73 = 73,
c_Check2_Ctl = 74, c_Check2_Ctl = 74,
c_Check2_Bitmap = 75, c_Check2_Bitmap_75 = 75,
c_Check2_Bitmap = 76, c_Check2_Bitmap_76 = 76,
c_Check3_Ctl = 77, c_Check3_Ctl = 77,
c_Check3_Bitmap = 78, c_Check3_Bitmap_78 = 78,
c_Check3_Bitmap = 79, c_Check3_Bitmap_79 = 79,
c_Check4_Ctl = 80, c_Check4_Ctl = 80,
c_Check4_Bitmap = 81, c_Check4_Bitmap_81 = 81,
c_Check4_Bitmap = 82, c_Check4_Bitmap_82 = 82,
c_Check5_Ctl = 83, c_Check5_Ctl = 83,
c_Check5_Bitmap = 84, c_Check5_Bitmap_84 = 84,
c_Check5_Bitmap = 85, c_Check5_Bitmap_85 = 85,
c_Check6_Ctl = 86, c_Check6_Ctl = 86,
c_Check6_Bitmap = 87, c_Check6_Bitmap_87 = 87,
c_Check6_Bitmap = 88, c_Check6_Bitmap_88 = 88,
c_Check7_Ctl = 89, c_Check7_Ctl = 89,
c_Check7_Bitmap = 90, c_Check7_Bitmap_90 = 90,
c_Check7_Bitmap = 91, c_Check7_Bitmap_91 = 91,
c_Check8_Ctl = 92, c_Check8_Ctl = 92,
c_Check8_Bitmap = 93, c_Check8_Bitmap_93 = 93,
c_Check8_Bitmap = 94, c_Check8_Bitmap_94 = 94,
c_Check9_Ctl = 95, c_Check9_Ctl = 95,
c_Check9_Bitmap = 96, c_Check9_Bitmap_96 = 96,
c_Check9_Bitmap = 97, c_Check9_Bitmap_97 = 97,
c_ConfigAnimation = 98, c_ConfigAnimation = 98,
c_Chptr_Model = 99, c_Chptr_Model = 99,
c_DuneBugy_Model = 100, c_DuneBugy_Model = 100,

View File

@ -162,11 +162,13 @@ class LegoGameState {
inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }
inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; } inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; }
inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; } inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
inline Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; }
inline MxS16 GetPlayerCount() { return m_playerCount; }
void SetCurrentAct(Act p_currentAct); void SetCurrentAct(Act p_currentAct);
void FindLoadedAct(); void FindLoadedAct();
private: public:
void RegisterState(LegoState* p_state); void RegisterState(LegoState* p_state);
MxResult WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName); MxResult WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName);
MxResult WriteEndOfVariables(LegoStorage* p_storage); MxResult WriteEndOfVariables(LegoStorage* p_storage);

View File

@ -1,7 +1,10 @@
#ifndef REGISTRATIONBOOK_H #ifndef REGISTRATIONBOOK_H
#define REGISTRATIONBOOK_H #define REGISTRATIONBOOK_H
#include "jukebox.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxcontrolpresenter.h"
#include "mxstillpresenter.h"
class InfocenterState; class InfocenterState;
class MxEndActionNotificationParam; class MxEndActionNotificationParam;
@ -39,25 +42,25 @@ class RegistrationBook : public LegoWorld {
// RegistrationBook::`scalar deleting destructor' // RegistrationBook::`scalar deleting destructor'
private: private:
undefined4 m_unk0xf8; // 0xf8 undefined4 m_unk0xf8; // 0xf8
undefined m_unk0xfc; // 0xfc undefined m_unk0xfc; // 0xfc
undefined m_unk0xfd[3]; // 0xfd undefined m_unk0xfd[3]; // 0xfd
undefined m_unk0x100[0x68]; // 0x100 MxStillPresenter* m_alphabet[26]; // 0x100
undefined m_unk0x168[0x118]; // 0x168 MxStillPresenter* m_name[10][7]; // 0x168
struct { struct {
undefined4 m_unk0x00[3]; // 0x00 undefined4 m_unk0x00[3]; // 0x00
undefined2 m_unk0x0c; // 0x0c undefined2 m_unk0x0c; // 0x0c
undefined2 m_unk0x0e; // 0x0e undefined2 m_unk0x0e; // 0x0e
} m_unk0x280; // 0x280 } m_unk0x280; // 0x280
undefined m_unk0x290[0x28]; // 0x290 MxControlPresenter* m_checkmark[10]; // 0x290
undefined2 m_unk0x2b8; // 0x2b8 undefined2 m_unk0x2b8; // 0x2b8
InfocenterState* m_infocenterState; // 0x2bc InfocenterState* m_infocenterState; // 0x2bc
undefined m_unk0x2c0; // 0x2c0 undefined m_unk0x2c0; // 0x2c0
undefined m_unk0x2c1; // 0x2c1 undefined m_unk0x2c1; // 0x2c1
undefined m_unk0x2c2[0x02]; // 0x2c2 undefined m_unk0x2c2[0x02]; // 0x2c2
undefined4 m_unk0x2c4; // 0x2c4 undefined4 m_unk0x2c4; // 0x2c4
undefined4 m_unk0x2c8; // 0x2c8 undefined4 m_unk0x2c8; // 0x2c8
undefined4 m_unk0x2cc; // 0x2cc undefined4 m_unk0x2cc; // 0x2cc
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(MxS8 p_key); MxLong HandleKeyPress(MxS8 p_key);

View File

@ -4,24 +4,27 @@
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legoomni.h"
#include "misc.h" #include "misc.h"
#include "mxactionnotificationparam.h" #include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxtimer.h" #include "mxtimer.h"
#include "regbook_actions.h"
DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0) DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0)
// FUNCTION: LEGO1 0x10076d20 // FUNCTION: LEGO1 0x10076d20
RegistrationBook::RegistrationBook() : m_unk0xf8(0x80000000), m_unk0xfc(1) RegistrationBook::RegistrationBook() : m_unk0xf8(0x80000000), m_unk0xfc(1)
{ {
memset(m_unk0x100, 0, sizeof(m_unk0x100)); memset(m_alphabet, 0, sizeof(m_alphabet));
memset(m_unk0x168, 0, sizeof(m_unk0x168)); memset(m_name, 0, sizeof(m_name));
// Maybe not be part of the struct, but then it would need packing // May not be part of the struct, but then it would need packing
m_unk0x280.m_unk0x0e = 0; m_unk0x280.m_unk0x0e = 0;
memset(m_unk0x290, 0, sizeof(m_unk0x290)); memset(m_checkmark, 0, sizeof(m_checkmark));
memset(&m_unk0x280, -1, sizeof(m_unk0x280) - 2); memset(&m_unk0x280, -1, sizeof(m_unk0x280) - 2);
m_unk0x2b8 = 0; m_unk0x2b8 = 0;
@ -110,10 +113,80 @@ MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param)
return 0; return 0;
} }
// STUB: LEGO1 0x10077cc0 // FUNCTION: LEGO1 0x10077cc0
void RegistrationBook::ReadyWorld() void RegistrationBook::ReadyWorld()
{ {
// TODO LegoGameState* gameState = GameState();
gameState->GetHistory()->WriteScoreHistory();
PlayMusic(JukeboxScript::c_InformationCenter_Music);
char letterBuffer[12] = "A_Bitmap";
for (MxS16 i = 0; i < 26; i++) {
m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", letterBuffer);
// We need to loop through the entire alphabet,
// so increment the first char of the bitmap name
letterBuffer[0]++;
}
// Now we have to do the checkmarks
char checkmarkBuffer[] = "Check0_Ctl";
for (i = 0; i < 10; i++) {
m_checkmark[i] = (MxControlPresenter*) Find("MxControlPresenter", checkmarkBuffer);
// Just like in the prior letter loop,
// we need to increment the fifth char
// to get the next checkmark bitmap
checkmarkBuffer[5]++;
}
MxS16 playerCount = GameState()->GetPlayerCount();
// Optimization: Just skip the whole loop if there's no player data
if (playerCount > 0) {
for (i = 1; i <= playerCount; i++) {
for (MxS16 j = 0; j < 7; j++) {
if (GameState()->m_players[i].m_letters[j] != -1) {
if (!j) {
m_checkmark[i]->Enable(TRUE);
}
// Start building the player name using a two-dimensional array
m_name[i][j] = m_alphabet[gameState->m_players[i].m_letters[j]]->Clone();
// Enable the presenter to actually show the letter
m_name[i][j]->Enable(TRUE);
m_name[i][j]->SetTickleState(MxPresenter::e_repeating);
m_name[i][j]->SetPosition((23 * j + 343), 27 * i + 121);
}
}
}
}
if (m_infocenterState->GetNameLetter(0) == NULL) {
MxDSAction action;
action.SetAtomId(*g_regbookScript);
action.SetObjectId(RegbookScript::c_iic006in_RunAnim);
BackgroundAudioManager()->LowerVolume();
Start(&action);
}
else {
LegoROI* infoman = FindROI("infoman");
MxDSAction action;
action.SetAtomId(*g_regbookScript);
action.SetObjectId(RegbookScript::c_iic008in_PlayWav);
BackgroundAudioManager()->LowerVolume();
Start(&action);
if (infoman != NULL) {
infoman->SetUnknown0x0c(0);
}
}
} }
// STUB: LEGO1 0x10077fd0 // STUB: LEGO1 0x10077fd0