From 848fb527c61122f5574920f2d65d4d9d90150d79 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 19 Feb 2024 07:55:38 -0500 Subject: [PATCH] WIP improvements --- LEGO1/lego/legoomni/include/legogamestate.h | 19 ++++++++++--------- .../legoomni/src/common/legogamestate.cpp | 2 +- LEGO1/lego/legoomni/src/isle/historybook.cpp | 16 +++++++++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index f91cda35..523997e0 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -86,18 +86,19 @@ class LegoGameState { e_unk66 = 66 }; -#pragma pack(push, 1) - // SIZE 0xc + // SIZE 0x0c struct ScoreName { // FUNCTION: LEGO1 0x1003c710 - ScoreName* operator=(ScoreName* const p_other); - MxS16 m_letters[7]; // 0x0 + ScoreName* operator=(const ScoreName* p_other); + + MxS16 m_letters[7]; // 0x00 }; +#pragma pack(push, 1) // SIZE 0x2c struct Score { - undefined2 m_unk0x0; // 0x0 - MxU8 m_state[25]; // 0x2 + undefined2 m_unk0x00; // 0x00 + MxU8 m_state[25]; // 0x02 MxU8 m_pad; // 0x1b ScoreName m_name; // 0x1c undefined2 m_unk0x2a; // 0x2a @@ -108,10 +109,10 @@ class LegoGameState { void WriteScoreHistory(); 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 - Score m_scores[20]; // 0x2 + MxS16 m_count; // 0x00 + Score m_scores[20]; // 0x02 }; #pragma pack(pop) diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index dd5146fa..a49fc016 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -689,7 +689,7 @@ void LegoGameState::RegisterState(LegoState* p_state) } // 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)); return this; diff --git a/LEGO1/lego/legoomni/src/isle/historybook.cpp b/LEGO1/lego/legoomni/src/isle/historybook.cpp index 4348525e..29f25e75 100644 --- a/LEGO1/lego/legoomni/src/isle/historybook.cpp +++ b/LEGO1/lego/legoomni/src/isle/historybook.cpp @@ -81,37 +81,47 @@ void HistoryBook::ReadyWorld() { LegoWorld::ReadyWorld(); GameState()->GetScores()->WriteScoreHistory(); + char bitmap[] = "A_Bitmap"; for (MxS16 i = 0; i < 26; i++) { m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", bitmap); bitmap[0]++; } + MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox"); MxU8 scoreColors[3] = {0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B MxU32 scoreY = 0x79; + for (MxS16 j = 0; j < GameState()->GetScores()->m_count; j++) { LegoGameState::Score* score = GameState()->GetScores()->GetScore(j); + MxS32 scoreIndex = j; MxStillPresenter** scorebox = m_scores + j; *scorebox = scoreboxMaster->Clone(); + MxU32 scoreX = 0x90; if (j >= 10) { if (j == 10) { scoreY = 0x79; } + scoreX = 0x158; } - MxU32 scoreboxX = 1; - MxU32 scoreboxRow = 5; + + MxS32 scoreboxX = 1; + MxS32 scoreboxRow = 5; MxU8* scoreState = score->m_state; + 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); } + scoreState += 5; scoreboxX += 5; } + (*scorebox)->Enable(TRUE); (*scorebox)->SetTickleState(MxPresenter::e_repeating); (*scorebox)->SetPosition(scoreX + 0xa1, scoreY);