mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +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);
|
bool (*CheckMenudefOption)(const char* opt);
|
||||||
void (*ConsoleToggled)(int state);
|
void (*ConsoleToggled)(int state);
|
||||||
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
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;
|
extern SystemCallbacks sysCallbacks;
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "fontchars.h"
|
#include "fontchars.h"
|
||||||
#include "multipatchtexture.h"
|
#include "multipatchtexture.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
#include "fontinternals.h"
|
#include "fontinternals.h"
|
||||||
|
|
||||||
|
@ -342,6 +343,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
{
|
{
|
||||||
Chars[i].TranslatedPic = tex;
|
Chars[i].TranslatedPic = tex;
|
||||||
}
|
}
|
||||||
|
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||||
|
|
||||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "fontchars.h"
|
#include "fontchars.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
#include "fontinternals.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;
|
else Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||||
|
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,7 @@ void MainLoop();
|
||||||
void SetConsoleNotifyBuffer();
|
void SetConsoleNotifyBuffer();
|
||||||
bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||||
void PostLoadSetup();
|
void PostLoadSetup();
|
||||||
|
void FontCharCreated(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||||
|
|
||||||
DBaseStatusBar* StatusBar;
|
DBaseStatusBar* StatusBar;
|
||||||
|
|
||||||
|
@ -525,7 +526,8 @@ int GameMain()
|
||||||
System_MenuClosed,
|
System_MenuClosed,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
PreBindTexture
|
PreBindTexture,
|
||||||
|
FontCharCreated
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -62,6 +62,24 @@ struct HightileReplacement
|
||||||
static TMap<int, TArray<HightileReplacement>> tileReplacements;
|
static TMap<int, TArray<HightileReplacement>> tileReplacements;
|
||||||
static TMap<int, TArray<HightileReplacement>> textureReplacements;
|
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
|
// Replacement textures
|
||||||
|
@ -185,6 +203,32 @@ void PostLoadSetup()
|
||||||
textureReplacements.Insert(tex->GetID().GetIndex(), std::move(*Hightile));
|
textureReplacements.Insert(tex->GetID().GetIndex(), std::move(*Hightile));
|
||||||
}
|
}
|
||||||
tileReplacements.Clear();
|
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();
|
uploadCinemaPalettes();
|
||||||
LoadPaletteLookups();
|
LoadPaletteLookups();
|
||||||
InitFonts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveEngine()
|
void RemoveEngine()
|
||||||
|
@ -527,6 +526,7 @@ void GameInterface::app_init()
|
||||||
// temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut
|
// temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut
|
||||||
InstallEngine();
|
InstallEngine();
|
||||||
LoadDefinitions();
|
LoadDefinitions();
|
||||||
|
InitFonts();
|
||||||
SetTileNames();
|
SetTileNames();
|
||||||
|
|
||||||
TileFiles.SetBackup();
|
TileFiles.SetBackup();
|
||||||
|
|
|
@ -317,7 +317,6 @@ void GameInterface::app_init()
|
||||||
//Net_SendClientInfo();
|
//Net_SendClientInfo();
|
||||||
|
|
||||||
initTiles();
|
initTiles();
|
||||||
fi.InitFonts();
|
|
||||||
genspriteremaps();
|
genspriteremaps();
|
||||||
SetupGameButtons();
|
SetupGameButtons();
|
||||||
InitCheats();
|
InitCheats();
|
||||||
|
@ -333,6 +332,7 @@ void GameInterface::app_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadDefinitions();
|
LoadDefinitions();
|
||||||
|
fi.InitFonts();
|
||||||
SetTileNames();
|
SetTileNames();
|
||||||
TileFiles.SetBackup();
|
TileFiles.SetBackup();
|
||||||
C_InitConback(TexMan.CheckForTexture("MENUSCREEN", ETextureType::Any), false, 0.75);
|
C_InitConback(TexMan.CheckForTexture("MENUSCREEN", ETextureType::Any), false, 0.75);
|
||||||
|
|
|
@ -221,7 +221,6 @@ void GameInterface::app_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
TileFiles.LoadArtSet("tiles%03d.art");
|
TileFiles.LoadArtSet("tiles%03d.art");
|
||||||
InitFonts();
|
|
||||||
|
|
||||||
//Connect();
|
//Connect();
|
||||||
SortBreakInfo();
|
SortBreakInfo();
|
||||||
|
@ -240,6 +239,7 @@ void GameInterface::app_init()
|
||||||
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
||||||
|
|
||||||
LoadDefinitions();
|
LoadDefinitions();
|
||||||
|
InitFonts();
|
||||||
SetTileNames();
|
SetTileNames();
|
||||||
TileFiles.SetBackup();
|
TileFiles.SetBackup();
|
||||||
userConfig.AddDefs.reset();
|
userConfig.AddDefs.reset();
|
||||||
|
|
Loading…
Reference in a new issue