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
};
#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)

View File

@ -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;

View File

@ -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);