Add Danish support

This commit is contained in:
Christian Semmler 2025-06-17 15:28:10 -07:00
parent 36ee7e7b2b
commit d156ac0f48
6 changed files with 39 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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