mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- made hires replacements work for untranslated fonts.
This commit is contained in:
parent
8ac6a4d321
commit
96fbfdcf86
8 changed files with 55 additions and 4 deletions
|
@ -31,6 +31,7 @@ struct SystemCallbacks
|
|||
bool (*CheckMenudefOption)(const char* opt);
|
||||
void (*ConsoleToggled)(int state);
|
||||
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||
};
|
||||
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "fontchars.h"
|
||||
#include "multipatchtexture.h"
|
||||
#include "texturemanager.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#include "fontinternals.h"
|
||||
|
||||
|
@ -342,6 +343,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
{
|
||||
Chars[i].TranslatedPic = tex;
|
||||
}
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "image.h"
|
||||
#include "fontchars.h"
|
||||
#include "texturemanager.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#include "fontinternals.h"
|
||||
|
||||
|
@ -116,6 +117,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
|||
}
|
||||
else Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -133,6 +133,7 @@ void MainLoop();
|
|||
void SetConsoleNotifyBuffer();
|
||||
bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||
void PostLoadSetup();
|
||||
void FontCharCreated(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||
|
||||
DBaseStatusBar* StatusBar;
|
||||
|
||||
|
@ -525,7 +526,8 @@ int GameMain()
|
|||
System_MenuClosed,
|
||||
nullptr,
|
||||
nullptr,
|
||||
PreBindTexture
|
||||
PreBindTexture,
|
||||
FontCharCreated
|
||||
};
|
||||
|
||||
try
|
||||
|
|
|
@ -62,6 +62,24 @@ struct HightileReplacement
|
|||
static TMap<int, TArray<HightileReplacement>> tileReplacements;
|
||||
static TMap<int, TArray<HightileReplacement>> textureReplacements;
|
||||
|
||||
struct FontCharInf
|
||||
{
|
||||
FGameTexture* base;
|
||||
FGameTexture* untranslated;
|
||||
FGameTexture* translated;
|
||||
};
|
||||
|
||||
static TArray<FontCharInf> deferredChars;
|
||||
|
||||
void FontCharCreated(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated)
|
||||
{
|
||||
// Store these in a list for now - they can only be processed in the finalization step.
|
||||
if (translated == untranslated) translated = nullptr;
|
||||
FontCharInf fci = { base, untranslated, translated };
|
||||
deferredChars.Push(fci);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Replacement textures
|
||||
|
@ -185,6 +203,32 @@ void PostLoadSetup()
|
|||
textureReplacements.Insert(tex->GetID().GetIndex(), std::move(*Hightile));
|
||||
}
|
||||
tileReplacements.Clear();
|
||||
|
||||
int i = 0;
|
||||
for (auto& ci : deferredChars)
|
||||
{
|
||||
i++;
|
||||
auto rep = textureReplacements.CheckKey(ci.base->GetID().GetIndex());
|
||||
if (rep)
|
||||
{
|
||||
if (ci.untranslated)
|
||||
{
|
||||
auto rrep = *rep;
|
||||
textureReplacements.Insert(ci.untranslated->GetID().GetIndex(), std::move(rrep));
|
||||
}
|
||||
|
||||
if (ci.translated)
|
||||
{
|
||||
//auto reptex = FindReplacement(ci.base->GetID(), 0, false);
|
||||
//if (reptex)
|
||||
{
|
||||
// Todo: apply the translation.
|
||||
//auto rrep = *rep;
|
||||
//textureReplacements.Insert(ci.translated->GetID().GetIndex(), std::move(rrep));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -82,7 +82,6 @@ void InstallEngine()
|
|||
}
|
||||
uploadCinemaPalettes();
|
||||
LoadPaletteLookups();
|
||||
InitFonts();
|
||||
}
|
||||
|
||||
void RemoveEngine()
|
||||
|
@ -527,6 +526,7 @@ void GameInterface::app_init()
|
|||
// temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut
|
||||
InstallEngine();
|
||||
LoadDefinitions();
|
||||
InitFonts();
|
||||
SetTileNames();
|
||||
|
||||
TileFiles.SetBackup();
|
||||
|
|
|
@ -317,7 +317,6 @@ void GameInterface::app_init()
|
|||
//Net_SendClientInfo();
|
||||
|
||||
initTiles();
|
||||
fi.InitFonts();
|
||||
genspriteremaps();
|
||||
SetupGameButtons();
|
||||
InitCheats();
|
||||
|
@ -333,6 +332,7 @@ void GameInterface::app_init()
|
|||
}
|
||||
|
||||
LoadDefinitions();
|
||||
fi.InitFonts();
|
||||
SetTileNames();
|
||||
TileFiles.SetBackup();
|
||||
C_InitConback(TexMan.CheckForTexture("MENUSCREEN", ETextureType::Any), false, 0.75);
|
||||
|
|
|
@ -221,7 +221,6 @@ void GameInterface::app_init()
|
|||
}
|
||||
|
||||
TileFiles.LoadArtSet("tiles%03d.art");
|
||||
InitFonts();
|
||||
|
||||
//Connect();
|
||||
SortBreakInfo();
|
||||
|
@ -240,6 +239,7 @@ void GameInterface::app_init()
|
|||
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
||||
|
||||
LoadDefinitions();
|
||||
InitFonts();
|
||||
SetTileNames();
|
||||
TileFiles.SetBackup();
|
||||
userConfig.AddDefs.reset();
|
||||
|
|
Loading…
Reference in a new issue