mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- allow switching between the two Duke BigFonts and fix Y in Duke's BigFont13.
This commit is contained in:
parent
90bcba302e
commit
d174b61c3c
8 changed files with 51 additions and 12 deletions
|
@ -1007,10 +1007,10 @@ void FFont::LoadTranslations()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FFont::FFont (int lump)
|
||||
FFont::FFont (int lump, FName nm)
|
||||
{
|
||||
Lump = lump;
|
||||
FontName = NAME_None;
|
||||
FontName = nm;
|
||||
Cursor = '_';
|
||||
noTranslate = false;
|
||||
}
|
||||
|
|
|
@ -103,13 +103,6 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
if (font) return font;
|
||||
}
|
||||
|
||||
// This is only temporary until virtual fonts get implemented
|
||||
if (!stricmp(name, "BIGFONT"))
|
||||
{
|
||||
font = V_GetFont("BIGFONT15");
|
||||
if (font) return font;
|
||||
}
|
||||
|
||||
int lump = -1;
|
||||
int folderfile = -1;
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
};
|
||||
|
||||
FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false, bool iwadonly = false, bool doomtemplate = false, GlyphSet *baseGlpyphs = nullptr);
|
||||
FFont(int lump, FName nm = NAME_None);
|
||||
virtual ~FFont ();
|
||||
|
||||
virtual FGameTexture *GetChar (int code, int translation, int *const width) const;
|
||||
|
@ -141,6 +142,7 @@ public:
|
|||
bool NoTranslate() const { return noTranslate; }
|
||||
virtual void RecordAllTextureColors(uint32_t *usedcolors);
|
||||
void CheckCase();
|
||||
void SetName(FName nm) { FontName = nm; }
|
||||
|
||||
int GetDisplacement() const { return Displacement; }
|
||||
|
||||
|
@ -149,8 +151,26 @@ public:
|
|||
|
||||
friend void V_InitCustomFonts();
|
||||
|
||||
void CopyFrom(const FFont& other)
|
||||
{
|
||||
Type = other.Type;
|
||||
FirstChar = other.FirstChar;
|
||||
LastChar = other.LastChar;
|
||||
SpaceWidth = other.SpaceWidth;
|
||||
FontHeight = other.FontHeight;
|
||||
GlobalKerning = other.GlobalKerning;
|
||||
TranslationType = other.TranslationType;
|
||||
Displacement = other.Displacement;
|
||||
Cursor = other.Cursor;
|
||||
noTranslate = other.noTranslate;
|
||||
MixedCase = other.MixedCase;
|
||||
forceremap = other.forceremap;
|
||||
Chars = other.Chars;
|
||||
Translations = other.Translations;
|
||||
Lump = other.Lump;
|
||||
}
|
||||
|
||||
protected:
|
||||
FFont (int lump);
|
||||
|
||||
void FixXMoves();
|
||||
|
||||
|
|
|
@ -836,7 +836,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
|
||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt, int style)
|
||||
{
|
||||
if (font == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
if (font == nullptr || font->mFont == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
// resolve auto-alignment before making any adjustments to the position values.
|
||||
|
|
|
@ -1026,6 +1026,7 @@ int RunGame()
|
|||
lookups.postLoadTables();
|
||||
PostLoadSetup();
|
||||
lookups.postLoadLookups();
|
||||
duke_menufont.Callback();
|
||||
V_LoadTranslations(); // loading the translations must be delayed until the palettes have been fully set up.
|
||||
|
||||
FMaterial::SetLayerCallback(setpalettelayer);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
*/
|
||||
|
||||
#include "razefont.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "c_cvars.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
FGameTexture* GetBaseForChar(FGameTexture* t);
|
||||
|
@ -41,6 +43,20 @@ void FontCharCreated(FGameTexture* base, FGameTexture* glyph);
|
|||
|
||||
FFont* IndexFont;
|
||||
FFont* DigiFont;
|
||||
FFont* BigFont13, * BigFont15;
|
||||
|
||||
CUSTOM_CVAR(Int, duke_menufont, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (!(g_gameType & GAMEFLAG_DUKE) || !BigFont13 || !BigFont15) return;
|
||||
if (self < -1 || self > 1) self = -1;
|
||||
else
|
||||
{
|
||||
// Font info must be copied so that BigFont does not change its address.
|
||||
if (self == 0 || (self == -1 && isPlutoPak())) BigFont->CopyFrom(*BigFont15);
|
||||
else if (self == 1 || (self == -1 && !isPlutoPak())) BigFont->CopyFrom(*BigFont13);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void SetupHires(FFont *font)
|
||||
{
|
||||
|
@ -78,6 +94,12 @@ void InitFont()
|
|||
SetupHires(BigFont);
|
||||
SetupHires(SmallFont);
|
||||
|
||||
if (g_gameType & GAMEFLAG_DUKE)
|
||||
{
|
||||
BigFont13 = V_GetFont("BigFont13");
|
||||
BigFont15 = V_GetFont("BigFont15");
|
||||
BigFont = new FFont(0, "BigFont");
|
||||
}
|
||||
|
||||
// todo: Compare small and big fonts with the base font and decide which one to use.
|
||||
// todo: Allow Duke to select between both variants.
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
#include "v_font.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
EXTERN_CVAR(Int, duke_menufont)
|
||||
|
||||
extern FFont* IndexFont;
|
||||
extern FFont* DigiFont;
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue