1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 04:00:00 +00:00

Add russian lang support

This commit is contained in:
Sergeanur 2020-03-29 09:35:13 +03:00
parent db92864fe2
commit bb8868eba7
13 changed files with 697 additions and 515 deletions

BIN
gamefiles/JAPANESE.gxt Normal file

Binary file not shown.

BIN
gamefiles/fonts_j.txd Normal file

Binary file not shown.

BIN
gamefiles/fonts_r.txd Normal file

Binary file not shown.

BIN
gamefiles/russian.gxt Normal file

Binary file not shown.

View file

@ -1707,6 +1707,17 @@ void CMenuManager::InitialiseChangedLanguageSettings()
CTimer::Update(); CTimer::Update();
CGame::frenchGame = false; CGame::frenchGame = false;
CGame::germanGame = false; CGame::germanGame = false;
#ifdef MORE_LANGUAGES
switch (CMenuManager::m_PrefsLanguage) {
case LANGUAGE_RUSSIAN:
CFont::ReloadFonts(FONT_LANGSET_RUSSIAN);
break;
default:
CFont::ReloadFonts(FONT_LANGSET_EFIGS);
break;
}
#endif
switch (CMenuManager::m_PrefsLanguage) { switch (CMenuManager::m_PrefsLanguage) {
case LANGUAGE_FRENCH: case LANGUAGE_FRENCH:
CGame::frenchGame = true; CGame::frenchGame = true;
@ -1714,6 +1725,11 @@ void CMenuManager::InitialiseChangedLanguageSettings()
case LANGUAGE_GERMAN: case LANGUAGE_GERMAN:
CGame::germanGame = true; CGame::germanGame = true;
break; break;
#ifdef MORE_LANGUAGES
case LANGUAGE_RUSSIAN:
CGame::russianGame = true;
break;
#endif
default: default:
break; break;
} }
@ -2916,6 +2932,14 @@ CMenuManager::ProcessButtonPresses(void)
CMenuManager::InitialiseChangedLanguageSettings(); CMenuManager::InitialiseChangedLanguageSettings();
SaveSettings(); SaveSettings();
break; break;
#ifdef MORE_LANGUAGES
case MENUACTION_LANG_RUS:
m_PrefsLanguage = LANGUAGE_RUSSIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
CMenuManager::InitialiseChangedLanguageSettings();
SaveSettings();
break;
#endif
case MENUACTION_POPULATESLOTS_CHANGEMENU: case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo(); PcSaveHelper.PopulateSlotInfo();

View file

@ -51,6 +51,9 @@ enum eLanguages
LANGUAGE_GERMAN, LANGUAGE_GERMAN,
LANGUAGE_ITALIAN, LANGUAGE_ITALIAN,
LANGUAGE_SPANISH, LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_RUSSIAN,
#endif
}; };
enum eFrontendSprites enum eFrontendSprites
@ -301,6 +304,9 @@ enum eMenuAction
MENUACTION_UNK108, MENUACTION_UNK108,
MENUACTION_UNK109, MENUACTION_UNK109,
MENUACTION_UNK110, MENUACTION_UNK110,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_RUS,
#endif
}; };
enum eCheckHover enum eCheckHover

View file

@ -78,6 +78,9 @@ bool &CGame::germanGame = *(bool*)0x95CD1E;
bool &CGame::noProstitutes = *(bool*)0x95CDCF; bool &CGame::noProstitutes = *(bool*)0x95CDCF;
bool &CGame::playingIntro = *(bool*)0x95CDC2; bool &CGame::playingIntro = *(bool*)0x95CDC2;
char *CGame::aDatFile = (char*)0x773A48; char *CGame::aDatFile = (char*)0x773A48;
#ifdef MORE_LANGUAGES
bool CGame::russianGame = false;
#endif
bool bool

View file

@ -16,6 +16,9 @@ public:
static bool &nastyGame; static bool &nastyGame;
static bool &frenchGame; static bool &frenchGame;
static bool &germanGame; static bool &germanGame;
#ifdef MORE_LANGUAGES
static bool russianGame;
#endif
static bool &noProstitutes; static bool &noProstitutes;
static bool &playingIntro; static bool &playingIntro;
static char *aDatFile; //[32]; static char *aDatFile; //[32];

View file

@ -65,6 +65,9 @@ const CMenuScreen aScreens[] = {
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },

View file

@ -172,6 +172,7 @@ enum Config {
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more #define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things #define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things
#define MORE_LANGUAGES // Add more translations to the game
// Pad // Pad
#define XINPUT #define XINPUT

View file

@ -8,7 +8,15 @@ CFontDetails &CFont::Details = *(CFontDetails*)0x8F317C;
int16 &CFont::NewLine = *(int16*)0x95CC94; int16 &CFont::NewLine = *(int16*)0x95CC94;
CSprite2d *CFont::Sprite = (CSprite2d*)0x95CC04; CSprite2d *CFont::Sprite = (CSprite2d*)0x95CC04;
#ifdef MORE_LANGUAGES
uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS;
int32 CFont::Slot = -1;
int16 CFont::Size[2][3][193] = {
{
#else
int16 CFont::Size[3][193] = { int16 CFont::Size[3][193] = {
#endif
{ {
13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31, 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, 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26,
@ -56,6 +64,56 @@ int16 CFont::Size[3][193] = {
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
} }
#ifdef MORE_LANGUAGES
},
{
{ 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, 13,
33, 13, 13, 13, 24, 22, 22, 19, 26, 21, 30, 20, 23,
23, 21, 24, 26, 23, 22, 23, 21, 22, 20, 20, 26, 25,
24, 22, 31, 32, 23, 30, 22, 22, 32, 23, 19, 18, 18,
15, 22, 19, 27, 19, 20, 20, 18, 22, 24, 20, 19, 19,
20, 19, 16, 19, 28, 20, 20, 18, 26, 27, 19, 26, 18,
19, 27, 19, 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,
21, 21, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35,
35, 35, 35, 37, 19, 19, 19, 19, 19, 19, 29, 19, 19,
19, 20, 22, 31, 19, 19, 19, 19, 19, 29, 19, 29, 19,
21, 19, 30, 31, 21, 29, 19, 19, 29, 19, 21, 23, 32,
21, 21, 30, 31, 22, 21, 32, 33, 23, 32, 21, 21, 32,
21, 19, 19, 30, 31, 22, 22, 21, 32, 33, 23, 32, 21,
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 },
}
#endif
}; };
uint16 foreign_table[128] = { uint16 foreign_table[128] = {
@ -75,7 +133,21 @@ CFont::Initialise(void)
int slot; int slot;
slot = CTxdStore::AddTxdSlot("fonts"); slot = CTxdStore::AddTxdSlot("fonts");
#ifdef MORE_LANGUAGES
Slot = slot;
switch (LanguageSet)
{
case FONT_LANGSET_EFIGS:
default:
CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD"); CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
break;
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(slot, "MODELS/FONTS_R.TXD");
break;
}
#else
CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
#endif
CTxdStore::AddRef(slot); CTxdStore::AddRef(slot);
CTxdStore::PushCurrentTxd(); CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(slot); CTxdStore::SetCurrentTxd(slot);
@ -101,13 +173,48 @@ CFont::Initialise(void)
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
#ifdef MORE_LANGUAGES
void
CFont::ReloadFonts(uint8 set)
{
if (Slot != -1 && LanguageSet != set) {
Sprite[0].Delete();
Sprite[1].Delete();
Sprite[2].Delete();
CTxdStore::PushCurrentTxd();
CTxdStore::RemoveTxd(Slot);
switch (set)
{
case FONT_LANGSET_EFIGS:
default:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS.TXD");
break;
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS_R.TXD");
break;
}
CTxdStore::SetCurrentTxd(Slot);
Sprite[0].SetTexture("font2", "font2_mask");
Sprite[1].SetTexture("pager", "pager_mask");
Sprite[2].SetTexture("font1", "font1_mask");
CTxdStore::PopCurrentTxd();
}
LanguageSet = set;
}
#endif
void void
CFont::Shutdown(void) CFont::Shutdown(void)
{ {
Sprite[0].Delete(); Sprite[0].Delete();
Sprite[1].Delete(); Sprite[1].Delete();
Sprite[2].Delete(); Sprite[2].Delete();
#ifdef MORE_LANGUAGES
CTxdStore::RemoveTxdSlot(Slot);
Slot = -1;
#else
CTxdStore::RemoveTxdSlot(CTxdStore::FindTxdSlot("fonts")); CTxdStore::RemoveTxdSlot(CTxdStore::FindTxdSlot("fonts"));
#endif
} }
void void
@ -382,19 +489,33 @@ CFont::PrintString(float x, float y, uint16 *start, uint16 *end, float spwidth)
float float
CFont::GetCharacterWidth(uint16 c) CFont::GetCharacterWidth(uint16 c)
{ {
#ifdef MORE_LANGUAGES
if (Details.proportional)
return Size[LanguageSet][Details.style][c];
else
return Size[LanguageSet][Details.style][192];
#else
if (Details.proportional) if (Details.proportional)
return Size[Details.style][c]; return Size[Details.style][c];
else else
return Size[Details.style][192]; return Size[Details.style][192];
#endif // MORE_LANGUAGES
} }
float float
CFont::GetCharacterSize(uint16 c) CFont::GetCharacterSize(uint16 c)
{ {
#ifdef MORE_LANGUAGES
if(Details.proportional)
return Size[LanguageSet][Details.style][c] * Details.scaleX;
else
return Size[LanguageSet][Details.style][192] * Details.scaleX;
#else
if (Details.proportional) if (Details.proportional)
return Size[Details.style][c] * Details.scaleX; return Size[Details.style][c] * Details.scaleX;
else else
return Size[Details.style][192] * Details.scaleX; return Size[Details.style][192] * Details.scaleX;
#endif // MORE_LANGUAGES
} }
float float

View file

@ -39,9 +39,23 @@ enum {
ALIGN_RIGHT, ALIGN_RIGHT,
}; };
#ifdef MORE_LANGUAGES
enum
{
FONT_LANGSET_EFIGS,
FONT_LANGSET_RUSSIAN
};
#endif
class CFont class CFont
{ {
#ifdef MORE_LANGUAGES
static int16 Size[2][3][193];
static uint8 LanguageSet;
static int32 Slot;
#else
static int16 Size[3][193]; static int16 Size[3][193];
#endif
static int16 
 static int16 

static CSprite2d *Sprite; //[3] static CSprite2d *Sprite; //[3]
public: public:
@ -136,4 +150,6 @@ public:
if(Details.alphaFade < 255.0f) if(Details.alphaFade < 255.0f)
Details.dropColor.a *= Details.alphaFade/255.0f; Details.dropColor.a *= Details.alphaFade/255.0f;
} }
static void ReloadFonts(uint8 set);
}; };

View file

@ -43,6 +43,11 @@ CText::Load(void)
case LANGUAGE_SPANISH: case LANGUAGE_SPANISH:
sprintf(filename, "SPANISH.GXT"); sprintf(filename, "SPANISH.GXT");
break; break;
#ifdef MORE_LANGUAGES
case LANGUAGE_RUSSIAN:
sprintf(filename, "RUSSIAN.GXT");
break;
#endif
} }
length = CFileMgr::LoadFile(filename, filedata, 0x40000, "rb"); length = CFileMgr::LoadFile(filename, filedata, 0x40000, "rb");