From 2308321805b97105cf03e8a38d44c90d9f652cd1 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 19 Apr 2020 22:32:59 +0300 Subject: Add polish lang support --- gamefiles/fonts_p.txd | Bin 0 -> 1379752 bytes gamefiles/polish.gxt | Bin 0 -> 239930 bytes src/core/Frontend.cpp | 13 +++++++++++ src/core/Frontend.h | 2 ++ src/core/Game.cpp | 1 + src/core/Game.h | 1 + src/core/MenuScreens.h | 1 + src/render/Font.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++- src/render/Font.h | 6 +++-- src/text/Text.cpp | 3 +++ 10 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 gamefiles/fonts_p.txd create mode 100644 gamefiles/polish.gxt diff --git a/gamefiles/fonts_p.txd b/gamefiles/fonts_p.txd new file mode 100644 index 00000000..c05e402e Binary files /dev/null and b/gamefiles/fonts_p.txd differ diff --git a/gamefiles/polish.gxt b/gamefiles/polish.gxt new file mode 100644 index 00000000..1782ef87 Binary files /dev/null and b/gamefiles/polish.gxt differ diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 6fe06d96..6bfde701 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -2893,6 +2893,9 @@ CMenuManager::InitialiseChangedLanguageSettings() CGame::germanGame = false; #ifdef MORE_LANGUAGES switch (m_PrefsLanguage) { + case LANGUAGE_POLISH: + CFont::ReloadFonts(FONT_LANGSET_POLISH); + break; case LANGUAGE_RUSSIAN: CFont::ReloadFonts(FONT_LANGSET_RUSSIAN); break; @@ -2910,6 +2913,9 @@ CMenuManager::InitialiseChangedLanguageSettings() CGame::germanGame = true; break; #ifdef MORE_LANGUAGES + case LANGUAGE_POLISH: + CGame::polishGame = true; + break; case LANGUAGE_RUSSIAN: CGame::russianGame = true; break; @@ -4254,6 +4260,12 @@ CMenuManager::ProcessButtonPresses(void) SaveSettings(); break; #ifdef MORE_LANGUAGES + case MENUACTION_LANG_PL: + m_PrefsLanguage = LANGUAGE_POLISH; + m_bFrontEnd_ReloadObrTxtGxt = true; + InitialiseChangedLanguageSettings(); + SaveSettings(); + break; case MENUACTION_LANG_RUS: m_PrefsLanguage = LANGUAGE_RUSSIAN; m_bFrontEnd_ReloadObrTxtGxt = true; @@ -5550,6 +5562,7 @@ CMenuManager::ConstructStatLine(int rowIdx) case LANGUAGE_ITALIAN: case LANGUAGE_SPANISH: #ifdef MORE_LANGUAGES + case LANGUAGE_POLISH: case LANGUAGE_RUSSIAN: #endif STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil); diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 71aac605..7877d6f1 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -89,6 +89,7 @@ enum eLanguages LANGUAGE_ITALIAN, LANGUAGE_SPANISH, #ifdef MORE_LANGUAGES + LANGUAGE_POLISH, LANGUAGE_RUSSIAN, #endif }; @@ -365,6 +366,7 @@ enum eMenuAction MENUACTION_UNK109, MENUACTION_UNK110, #ifdef MORE_LANGUAGES + MENUACTION_LANG_PL, MENUACTION_LANG_RUS, #endif }; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 7ccf78d0..b1d29161 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -98,6 +98,7 @@ bool CGame::noProstitutes; bool CGame::playingIntro; char CGame::aDatFile[32]; #ifdef MORE_LANGUAGES +bool CGame::polishGame = false; bool CGame::russianGame = false; #endif diff --git a/src/core/Game.h b/src/core/Game.h index e3f0f616..3b8a856d 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -18,6 +18,7 @@ public: static bool frenchGame; static bool germanGame; #ifdef MORE_LANGUAGES + static bool polishGame; static bool russianGame; #endif static bool noProstitutes; diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index 8692d4dc..48e2173e 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -74,6 +74,7 @@ const CMenuScreen aScreens[] = { MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE, #ifdef MORE_LANGUAGES + MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE, #endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 14a678b8..e4bd2a11 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -12,7 +12,7 @@ CSprite2d CFont::Sprite[MAX_FONTS]; uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS; int32 CFont::Slot = -1; -int16 CFont::Size[2][MAX_FONTS][193] = { +int16 CFont::Size[LANGSET_MAX][MAX_FONTS][193] = { { #else int16 CFont::Size[MAX_FONTS][193] = { @@ -112,6 +112,56 @@ int16 CFont::Size[MAX_FONTS][193] = { 21, 32, 21, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 }, + }, + + { + { + 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31, + 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26, + 30, 26, 24, 23, 24, 22, 21, 24, 26, 10, 20, 26, 22, 29, 26, 25, + 23, 25, 24, 24, 22, 25, 24, 29, 29, 23, 25, 37, 22, 37, 35, 37, + 35, 21, 22, 21, 21, 22, 13, 22, 21, 10, 16, 22, 11, 32, 21, 21, + 23, 22, 16, 20, 14, 21, 20, 30, 25, 21, 21, 33, 33, 33, 33, 35, + 27, 27, 27, 27, 32, 24, 23, 23, 23, 23, 11, 11, 11, 11, 26, 26, + 26, 26, 26, 26, 26, 25, 26, 21, 21, 21, 21, 32, 23, 22, 22, 22, + 22, 11, 11, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 26, 21, 24, + 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 18, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 20 + }, + + { + 13, 9, 21, 35, 23, 35, 35, 11, 35, 35, 25, 35, 11, 17, 13, 33, + 28, 14, 22, 21, 24, 23, 23, 21, 23, 22, 10, 35, 13, 35, 13, 33, + 5, 25, 22, 23, 24, 21, 21, 24, 24, 9, 20, 24, 21, 27, 25, 25, + 22, 25, 23, 20, 23, 23, 23, 31, 23, 23, 23, 37, 33, 37, 35, 37, + 35, 21, 19, 19, 21, 19, 17, 21, 21, 8, 17, 18, 14, 24, 21, 21, + 20, 22, 19, 20, 20, 19, 20, 26, 21, 20, 21, 33, 33, 33, 33, 35, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 16 + }, + + { + 15, 14, 16, 25, 19, 26, 22, 11, 18, 18, 27, 26, 13, 19, 9, 27, + 19, 18, 19, 19, 22, 19, 20, 18, 19, 20, 12, 32, 15, 32, 15, 35, + 15, 19, 19, 19, 19, 19, 16, 19, 20, 9, 19, 20, 14, 29, 19, 20, + 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19, 33, 31, 39, 37, 39, + 37, 21, 21, 21, 23, 21, 19, 23, 23, 10, 19, 20, 16, 26, 23, 23, + 20, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35, 35, 35, 35, 37, + 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, 9, 9, 9, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 30, 19, 19, 19, 19, + 19, 10, 10, 10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35, + 12, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19 + } } #endif }; @@ -141,6 +191,9 @@ CFont::Initialise(void) default: CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD"); break; + case FONT_LANGSET_POLISH: + CTxdStore::LoadTxd(slot, "MODELS/FONTS_P.TXD"); + break; case FONT_LANGSET_RUSSIAN: CTxdStore::LoadTxd(slot, "MODELS/FONTS_R.TXD"); break; @@ -189,6 +242,9 @@ CFont::ReloadFonts(uint8 set) default: CTxdStore::LoadTxd(Slot, "MODELS/FONTS.TXD"); break; + case FONT_LANGSET_POLISH: + CTxdStore::LoadTxd(Slot, "MODELS/FONTS_P.TXD"); + break; case FONT_LANGSET_RUSSIAN: CTxdStore::LoadTxd(Slot, "MODELS/FONTS_R.TXD"); break; diff --git a/src/render/Font.h b/src/render/Font.h index ebf5e292..01d67700 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -44,14 +44,16 @@ enum { enum { FONT_LANGSET_EFIGS, - FONT_LANGSET_RUSSIAN + FONT_LANGSET_RUSSIAN, + FONT_LANGSET_POLISH, + LANGSET_MAX }; #endif class CFont { #ifdef MORE_LANGUAGES - static int16 Size[2][MAX_FONTS][193]; + static int16 Size[LANGSET_MAX][MAX_FONTS][193]; static uint8 LanguageSet; static int32 Slot; #else diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 69025df1..f481403d 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -44,6 +44,9 @@ CText::Load(void) sprintf(filename, "SPANISH.GXT"); break; #ifdef MORE_LANGUAGES + case LANGUAGE_POLISH: + sprintf(filename, "POLISH.GXT"); + break; case LANGUAGE_RUSSIAN: sprintf(filename, "RUSSIAN.GXT"); break; -- cgit v1.2.3