WIP improvements

This commit is contained in:
Christian Semmler 2024-02-19 07:55:38 -05:00
parent cb99e0a673
commit 848fb527c6
3 changed files with 24 additions and 13 deletions

View File

@ -86,18 +86,19 @@ class LegoGameState {
e_unk66 = 66 e_unk66 = 66
}; };
#pragma pack(push, 1) // SIZE 0x0c
// SIZE 0xc
struct ScoreName { struct ScoreName {
// FUNCTION: LEGO1 0x1003c710 // FUNCTION: LEGO1 0x1003c710
ScoreName* operator=(ScoreName* const p_other); ScoreName* operator=(const ScoreName* p_other);
MxS16 m_letters[7]; // 0x0
MxS16 m_letters[7]; // 0x00
}; };
#pragma pack(push, 1)
// SIZE 0x2c // SIZE 0x2c
struct Score { struct Score {
undefined2 m_unk0x0; // 0x0 undefined2 m_unk0x00; // 0x00
MxU8 m_state[25]; // 0x2 MxU8 m_state[25]; // 0x02
MxU8 m_pad; // 0x1b MxU8 m_pad; // 0x1b
ScoreName m_name; // 0x1c ScoreName m_name; // 0x1c
undefined2 m_unk0x2a; // 0x2a undefined2 m_unk0x2a; // 0x2a
@ -108,10 +109,10 @@ class LegoGameState {
void WriteScoreHistory(); void WriteScoreHistory();
void FUN_1003ccf0(LegoFile&); void FUN_1003ccf0(LegoFile&);
inline Score* GetScore(MxU32 p_index) { return p_index >= m_count ? NULL : m_scores + p_index; } inline Score* GetScore(MxS16 p_index) { return p_index >= m_count ? NULL : m_scores + p_index; }
MxU16 m_count; // 0x0 MxS16 m_count; // 0x00
Score m_scores[20]; // 0x2 Score m_scores[20]; // 0x02
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -689,7 +689,7 @@ void LegoGameState::RegisterState(LegoState* p_state)
} }
// FUNCTION: LEGO1 0x1003c710 // FUNCTION: LEGO1 0x1003c710
LegoGameState::ScoreName* LegoGameState::ScoreName::operator=(ScoreName* const p_other) LegoGameState::ScoreName* LegoGameState::ScoreName::operator=(const ScoreName* p_other)
{ {
memcpy(m_letters, p_other->m_letters, sizeof(m_letters)); memcpy(m_letters, p_other->m_letters, sizeof(m_letters));
return this; return this;

View File

@ -81,37 +81,47 @@ void HistoryBook::ReadyWorld()
{ {
LegoWorld::ReadyWorld(); LegoWorld::ReadyWorld();
GameState()->GetScores()->WriteScoreHistory(); GameState()->GetScores()->WriteScoreHistory();
char bitmap[] = "A_Bitmap"; char bitmap[] = "A_Bitmap";
for (MxS16 i = 0; i < 26; i++) { for (MxS16 i = 0; i < 26; i++) {
m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", bitmap); m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", bitmap);
bitmap[0]++; bitmap[0]++;
} }
MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox"); MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox");
MxU8 scoreColors[3] = MxU8 scoreColors[3] =
{0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B {0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B
MxU32 scoreY = 0x79; MxU32 scoreY = 0x79;
for (MxS16 j = 0; j < GameState()->GetScores()->m_count; j++) { for (MxS16 j = 0; j < GameState()->GetScores()->m_count; j++) {
LegoGameState::Score* score = GameState()->GetScores()->GetScore(j); LegoGameState::Score* score = GameState()->GetScores()->GetScore(j);
MxS32 scoreIndex = j; MxS32 scoreIndex = j;
MxStillPresenter** scorebox = m_scores + j; MxStillPresenter** scorebox = m_scores + j;
*scorebox = scoreboxMaster->Clone(); *scorebox = scoreboxMaster->Clone();
MxU32 scoreX = 0x90; MxU32 scoreX = 0x90;
if (j >= 10) { if (j >= 10) {
if (j == 10) { if (j == 10) {
scoreY = 0x79; scoreY = 0x79;
} }
scoreX = 0x158; scoreX = 0x158;
} }
MxU32 scoreboxX = 1;
MxU32 scoreboxRow = 5; MxS32 scoreboxX = 1;
MxS32 scoreboxRow = 5;
MxU8* scoreState = score->m_state; MxU8* scoreState = score->m_state;
for (; scoreboxRow > 0; scoreboxRow--) { for (; scoreboxRow > 0; scoreboxRow--) {
for (MxU32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) { for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) {
SetColor(*scorebox, scoreState[scoreBoxColumn], scoreColors, scoreboxX, scoreboxY); SetColor(*scorebox, scoreState[scoreBoxColumn], scoreColors, scoreboxX, scoreboxY);
} }
scoreState += 5; scoreState += 5;
scoreboxX += 5; scoreboxX += 5;
} }
(*scorebox)->Enable(TRUE); (*scorebox)->Enable(TRUE);
(*scorebox)->SetTickleState(MxPresenter::e_repeating); (*scorebox)->SetTickleState(MxPresenter::e_repeating);
(*scorebox)->SetPosition(scoreX + 0xa1, scoreY); (*scorebox)->SetPosition(scoreX + 0xa1, scoreY);