- WH2 font fixes and translation setup.

This commit is contained in:
Christoph Oelckers 2021-06-05 22:23:28 +02:00
parent 8e513429ad
commit b6c7ee1a94
5 changed files with 22 additions and 9 deletions

View file

@ -20,17 +20,18 @@ void InitFonts()
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THEFONT + 26 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(THEFONT + i));
fontdata.Insert('!', tileGetTexture(1547)); // WH2 is each one less.
fontdata.Insert('?', tileGetTexture(1548));
fontdata.Insert('-', tileGetTexture(1549));
fontdata.Insert('_', tileGetTexture(1549));
fontdata.Insert(':', tileGetTexture(1550));
fontdata.Insert('!', tileGetTexture(THEFONT + 36));
fontdata.Insert('?', tileGetTexture(THEFONT + 37));
fontdata.Insert('-', tileGetTexture(THEFONT + 38));
fontdata.Insert('_', tileGetTexture(THEFONT + 38));
fontdata.Insert(':', tileGetTexture(THEFONT + 39));
// The texture offsets in this font are useless for font printing. This should only apply to these glyphs, not for international extensions, though.
// The texture offsets in this font are useless for font printing.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
SmallFont->LoadTranslations();
}

View file

@ -575,9 +575,8 @@ void GameInterface::loadPalette()
void GameInterface::app_init()
{
InitFonts();
C_SetNotifyFontScale(isWh2()? 1 : 0.6);
GameTicRate = TIMERRATE / TICSPERFRAME;
InitNames();
engineInit();
TileFiles.tileMakeWritable(ANILAVA);
@ -818,6 +817,13 @@ void GameInterface::ToggleThirdPerson()
return new GameInterface;
}
void GameInterface::LoadGameTextures()
{
// Must be done early so that fonts etc. get properly set up.
InitNames();
}
DEFINE_FIELD_X(WhPlayer,PLAYER,spellnum);
DEFINE_FIELD_X(WhPlayer,PLAYER,x);

View file

@ -512,6 +512,7 @@ struct GameInterface : public ::GameInterface
void MenuOpened() override;
void MenuSound(EMenuSounds snd) override;
bool CanSave() override;
void LoadGameTextures() override;
FSavegameInfo GetSaveSig() override;
void SerializeGameState(FSerializer& arc) override;
FString GetCoordString() override;

View file

@ -475,7 +475,7 @@ class WHStatusBar : RazeStatusBar
void DoLevelStats(int bottomy, SummaryInfo info)
{
StatsPrintInfo stats;
stats.fontscale = 0.6;
stats.fontscale = Raze.isWh2()? 1. : 0.6;
stats.spacing = stats.fontScale * SmallFont.GetHeight() + 1;
stats.screenbottomspace = bottomy;
stats.statfont = SmallFont;

View file

@ -204,6 +204,11 @@ struct Raze
return gameinfo.gametype & GAMEFLAG_BLOOD;
}
static bool isWh2()
{
return gameinfo.gametype & GAMEFLAG_WH2;
}
// Dont know yet how to best export this, so for now these are just placeholders as MP is not operational anyway.
static int playerPalette(int i)
{