diff --git a/LEGO1/lego/legoomni/include/historybook.h b/LEGO1/lego/legoomni/include/historybook.h index c90e9a93..9acbe8ac 100644 --- a/LEGO1/lego/legoomni/include/historybook.h +++ b/LEGO1/lego/legoomni/include/historybook.h @@ -48,6 +48,7 @@ class HistoryBook : public LegoWorld { MxStillPresenter* m_scores[20]; // 0x394 MxStillPresenter* m_intAlphabet[sizeOfArray(LegoGameState::g_intCharacters)]; + MxU32 m_intAlphabetOffset; }; #endif // HISTORYBOOK_H diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 07561968..e3af55b4 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -263,7 +263,7 @@ class LegoGameState { Area m_previousArea; // 0x428 Area m_unk0x42c; // 0x42c - static const InternationalCharacter g_intCharacters[4]; + static const InternationalCharacter g_intCharacters[7]; }; MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen); diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index 92f289b6..b6e60ae0 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -65,6 +65,7 @@ class RegistrationBook : public LegoWorld { LPDIRECTDRAWSURFACE m_checkboxSurface; // 0x2c8 LPDIRECTDRAWSURFACE m_checkboxNormal; // 0x2cc MxStillPresenter* m_intAlphabet[sizeOfArray(LegoGameState::g_intCharacters)]; + MxU32 m_intAlphabetOffset; MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(SDL_Keycode p_key); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 1946cbf9..11b67784 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -143,8 +143,15 @@ const char* g_strEnable = "enable"; // STRING: LEGO1 0x100f3bf4 const char* g_strDisable = "disable"; -const InternationalCharacter LegoGameState::g_intCharacters[4] = - {{0xe4, "Aum_Bitmap", 29}, {0xf6, "Oum_Bitmap", 30}, {0xdf, "Beta_Bitmap", 31}, {0xfc, "Uum_Bitmap", 32}}; +const InternationalCharacter LegoGameState::g_intCharacters[7] = { + {0xe4, "Aum_Bitmap", 29}, + {0xf6, "Oum_Bitmap", 30}, + {0xdf, "Beta_Bitmap", 31}, + {0xfc, "Uum_Bitmap", 32}, + {0xe5, "Ao_Bitmap", 29}, + {0xe6, "Ae_Bitmap", 30}, + {0xf8, "Oz_Bitmap", 31} +}; // FUNCTION: LEGO1 0x10039550 LegoGameState::LegoGameState() diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index ddf3143b..89de03d9 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -119,6 +119,16 @@ void HistoryBook::ReadyWorld() m_intAlphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", LegoGameState::g_intCharacters[i].m_bitmap); } + m_intAlphabetOffset = 0; + for (i = 0; i < sizeOfArray(m_intAlphabet); i++) { + if (!m_intAlphabet[i]) { + m_intAlphabetOffset++; + } + else { + break; + } + } + MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox"); MxU8 scoreColors[3] = {0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B @@ -181,9 +191,9 @@ void HistoryBook::ReadyWorld() } index -= sizeOfArray(m_alphabet); - assert(index < sizeOfArray(m_intAlphabet)); + index += m_intAlphabetOffset; - if (!m_intAlphabet[index]) { + if (index >= sizeOfArray(m_intAlphabet) || !m_intAlphabet[index]) { SDL_Log("Warning: international character not present in current game. Falling back to X"); return &m_alphabet[SDLK_X - SDLK_A]; } diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 82b229fa..adaf45d4 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -212,8 +212,9 @@ MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key) } m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = - key >= SDLK_A && key <= SDLK_Z ? key - SDLK_A - : (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet); + key >= SDLK_A && key <= SDLK_Z + ? key - SDLK_A + : (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet) - m_intAlphabetOffset; m_unk0x280.m_cursorPos++; } } @@ -460,6 +461,16 @@ void RegistrationBook::ReadyWorld() m_intAlphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", LegoGameState::g_intCharacters[i].m_bitmap); } + m_intAlphabetOffset = 0; + for (i = 0; i < sizeOfArray(m_intAlphabet); i++) { + if (!m_intAlphabet[i]) { + m_intAlphabetOffset++; + } + else { + break; + } + } + // Now we have to do the checkmarks char checkmarkBuffer[] = "Check0_Ctl"; for (i = 0; i < 10; i++) { @@ -488,9 +499,9 @@ void RegistrationBook::ReadyWorld() } index -= sizeOfArray(m_alphabet); - assert(index < sizeOfArray(m_intAlphabet)); + index += m_intAlphabetOffset; - if (!m_intAlphabet[index]) { + if (index >= sizeOfArray(m_intAlphabet) || !m_intAlphabet[index]) { SDL_Log("Warning: international character not present in current game. Falling back to X"); return &m_alphabet[SDLK_X - SDLK_A]; }