mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-06 01:30:54 +00:00
- Backend update from Raze.
This commit is contained in:
parent
250fac5b7e
commit
e453f97872
15 changed files with 157 additions and 81 deletions
|
@ -185,7 +185,7 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
|
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
|
||||||
PalEntry color = 0xffffffff;
|
PalEntry color = 0xffffffff;
|
||||||
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
|
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||||
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
||||||
|
@ -210,7 +210,7 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
|
||||||
uint32_t tag = ListGetInt(args);
|
uint32_t tag = ListGetInt(args);
|
||||||
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, false);
|
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, false);
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
|
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
|
||||||
PalEntry color = 0xffffffff;
|
PalEntry color = 0xffffffff;
|
||||||
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
|
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||||
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
||||||
|
@ -265,7 +265,7 @@ void DrawTextCommon(F2DDrawer *drawer, FFont *font, int normalcolor, double x, d
|
||||||
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
|
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
|
||||||
parms.celly = int (parms.celly * scaley);
|
parms.celly = int (parms.celly * scaley);
|
||||||
|
|
||||||
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
|
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
|
||||||
|
|
||||||
if (normalcolor >= NumTextColors)
|
if (normalcolor >= NumTextColors)
|
||||||
normalcolor = CR_UNTRANSLATED;
|
normalcolor = CR_UNTRANSLATED;
|
||||||
|
|
|
@ -613,17 +613,20 @@ static void CheckReplayGain(const char *musicname, EMidiDevice playertype, const
|
||||||
ZMusic_Close(handle);
|
ZMusic_Close(handle);
|
||||||
|
|
||||||
GainAnalyzer analyzer;
|
GainAnalyzer analyzer;
|
||||||
analyzer.InitGainAnalysis(fmt.mSampleRate);
|
int result = analyzer.InitGainAnalysis(fmt.mSampleRate);
|
||||||
int result = analyzer.AnalyzeSamples(lbuffer.Data(), rbuffer.Size() == 0 ? nullptr : rbuffer.Data(), lbuffer.Size(), rbuffer.Size() == 0? 1: 2);
|
|
||||||
if (result == GAIN_ANALYSIS_OK)
|
if (result == GAIN_ANALYSIS_OK)
|
||||||
{
|
{
|
||||||
auto gain = analyzer.GetTitleGain();
|
result = analyzer.AnalyzeSamples(lbuffer.Data(), rbuffer.Size() == 0 ? nullptr : rbuffer.Data(), lbuffer.Size(), rbuffer.Size() == 0 ? 1 : 2);
|
||||||
Printf("Calculated replay gain for %s at %f dB\n", hash.GetChars(), gain);
|
if (result == GAIN_ANALYSIS_OK)
|
||||||
|
{
|
||||||
|
auto gain = analyzer.GetTitleGain();
|
||||||
|
Printf("Calculated replay gain for %s at %f dB\n", hash.GetChars(), gain);
|
||||||
|
|
||||||
gainMap.Insert(hash, gain);
|
gainMap.Insert(hash, gain);
|
||||||
mus_playing.replayGain = gain;
|
mus_playing.replayGain = gain;
|
||||||
mus_playing.replayGainFactor = dBToAmplitude(mus_playing.replayGain + mus_gainoffset);
|
mus_playing.replayGainFactor = dBToAmplitude(mus_playing.replayGain + mus_gainoffset);
|
||||||
SaveGains();
|
SaveGains();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +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);
|
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SystemCallbacks sysCallbacks;
|
extern SystemCallbacks sysCallbacks;
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FFont::FFont (const char *name, const char *nametemplate, const char *filetemplate, int lfirst, int lcount, int start, int fdlump, int spacewidth, bool notranslate, bool iwadonly, bool doomtemplate, GlyphSet *baseGlyphs)
|
FFont::FFont (const char *name, const char *nametemplate, const char *filetemplate, int lfirst, int lcount, int start, int fdlump, int spacewidth, bool notranslate, bool iwadonly, bool doomtemplate, GlyphSet *baseGlyphs)
|
||||||
|
: FFont(fdlump, name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FTextureID lump;
|
FTextureID lump;
|
||||||
|
@ -77,17 +78,9 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
DVector2 Scale = { 1, 1 };
|
DVector2 Scale = { 1, 1 };
|
||||||
|
|
||||||
noTranslate = notranslate;
|
noTranslate = notranslate;
|
||||||
Lump = fdlump;
|
|
||||||
GlobalKerning = false;
|
GlobalKerning = false;
|
||||||
FontName = name;
|
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
Cursor = '_';
|
|
||||||
SpaceWidth = 0;
|
SpaceWidth = 0;
|
||||||
FontHeight = 0;
|
FontHeight = 0;
|
||||||
uint8_t pp = 0;
|
|
||||||
for (auto &p : PatchRemap) p = pp++;
|
|
||||||
translateUntranslated = false;
|
|
||||||
int FixedWidth = 0;
|
int FixedWidth = 0;
|
||||||
|
|
||||||
TMap<int, FGameTexture*> charMap;
|
TMap<int, FGameTexture*> charMap;
|
||||||
|
@ -126,6 +119,11 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
sc.MustGetValue(false);
|
sc.MustGetValue(false);
|
||||||
GlobalKerning = sc.Number;
|
GlobalKerning = sc.Number;
|
||||||
}
|
}
|
||||||
|
if (sc.Compare("Altfont"))
|
||||||
|
{
|
||||||
|
sc.MustGetString();
|
||||||
|
AltFontName = sc.String;
|
||||||
|
}
|
||||||
else if (sc.Compare("Scale"))
|
else if (sc.Compare("Scale"))
|
||||||
{
|
{
|
||||||
sc.MustGetValue(true);
|
sc.MustGetValue(true);
|
||||||
|
@ -154,6 +152,16 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
sc.MustGetValue(false);
|
sc.MustGetValue(false);
|
||||||
FontHeight = sc.Number;
|
FontHeight = sc.Number;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("minluminosity"))
|
||||||
|
{
|
||||||
|
sc.MustGetValue(false);
|
||||||
|
MinLum = (int16_t)clamp(sc.Number, 0, 255);
|
||||||
|
}
|
||||||
|
else if (sc.Compare("maxluminosity"))
|
||||||
|
{
|
||||||
|
sc.MustGetValue(false);
|
||||||
|
MaxLum = (int16_t)clamp(sc.Number, 0, 255);
|
||||||
|
}
|
||||||
else if (sc.Compare("Translationtype"))
|
else if (sc.Compare("Translationtype"))
|
||||||
{
|
{
|
||||||
sc.MustGetToken(TK_Identifier);
|
sc.MustGetToken(TK_Identifier);
|
||||||
|
@ -302,7 +310,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
auto count = maxchar - minchar + 1;
|
auto count = maxchar - minchar + 1;
|
||||||
Chars.Resize(count);
|
Chars.Resize(count);
|
||||||
int fontheight = 0;
|
int fontheight = 0;
|
||||||
int asciiheight = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -320,10 +327,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
{
|
{
|
||||||
fontheight = height;
|
fontheight = height;
|
||||||
}
|
}
|
||||||
if (height > asciiheight && FirstChar + 1 < 128)
|
|
||||||
{
|
|
||||||
asciiheight = height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto orig = pic->GetTexture();
|
auto orig = pic->GetTexture();
|
||||||
|
@ -332,7 +335,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
TexMan.AddGameTexture(tex);
|
TexMan.AddGameTexture(tex);
|
||||||
Chars[i].OriginalPic = tex;
|
Chars[i].OriginalPic = tex;
|
||||||
|
|
||||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].OriginalPic);
|
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic);
|
||||||
|
|
||||||
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
||||||
}
|
}
|
||||||
|
@ -359,7 +362,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FontHeight == 0) FontHeight = fontheight;
|
if (FontHeight == 0) FontHeight = fontheight;
|
||||||
if (AsciiHeight == 0) AsciiHeight = asciiheight;
|
|
||||||
|
|
||||||
FixXMoves();
|
FixXMoves();
|
||||||
}
|
}
|
||||||
|
@ -656,7 +658,7 @@ int FFont::GetLuminosity (uint32_t *colorsused, TArray<double> &Luminosity, int*
|
||||||
|
|
||||||
int FFont::GetColorTranslation (EColorRange range, PalEntry *color) const
|
int FFont::GetColorTranslation (EColorRange range, PalEntry *color) const
|
||||||
{
|
{
|
||||||
// Single pic fonts don not set up their translation table and must always return 0.
|
// Single pic fonts do not set up their translation table and must always return 0.
|
||||||
if (Translations.Size() == 0) return 0;
|
if (Translations.Size() == 0) return 0;
|
||||||
assert(Translations.Size() == NumTextColors);
|
assert(Translations.Size() == NumTextColors);
|
||||||
|
|
||||||
|
@ -966,10 +968,11 @@ int FFont::GetMaxAscender(const uint8_t* string) const
|
||||||
|
|
||||||
void FFont::LoadTranslations()
|
void FFont::LoadTranslations()
|
||||||
{
|
{
|
||||||
unsigned int count = LastChar - FirstChar + 1;
|
unsigned int count = min<unsigned>(Chars.Size(), LastChar - FirstChar + 1);
|
||||||
uint32_t usedcolors[256] = {};
|
uint32_t usedcolors[256] = {};
|
||||||
TArray<double> Luminosity;
|
TArray<double> Luminosity;
|
||||||
|
|
||||||
|
if (count == 0) return;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (Chars[i].OriginalPic)
|
if (Chars[i].OriginalPic)
|
||||||
|
@ -981,6 +984,8 @@ void FFont::LoadTranslations()
|
||||||
|
|
||||||
int minlum = 0, maxlum = 0;
|
int minlum = 0, maxlum = 0;
|
||||||
GetLuminosity (usedcolors, Luminosity, &minlum, &maxlum);
|
GetLuminosity (usedcolors, Luminosity, &minlum, &maxlum);
|
||||||
|
if (MinLum >= 0 && MinLum < minlum) minlum = MinLum;
|
||||||
|
if (MaxLum > maxlum) maxlum = MaxLum;
|
||||||
|
|
||||||
// Here we can set everything to a luminosity translation.
|
// Here we can set everything to a luminosity translation.
|
||||||
|
|
||||||
|
@ -999,14 +1004,15 @@ void FFont::LoadTranslations()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FFont::FFont (int lump)
|
FFont::FFont (int lump, FName nm)
|
||||||
{
|
{
|
||||||
|
FirstChar = LastChar = 0;
|
||||||
|
Next = FirstFont;
|
||||||
|
FirstFont = this;
|
||||||
Lump = lump;
|
Lump = lump;
|
||||||
FontName = NAME_None;
|
FontName = nm;
|
||||||
Cursor = '_';
|
Cursor = '_';
|
||||||
noTranslate = false;
|
noTranslate = false;
|
||||||
uint8_t pp = 0;
|
|
||||||
for (auto &p : PatchRemap) p = pp++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1070,3 +1076,7 @@ void FFont::FixXMoves()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FFont::ClearOffsets()
|
||||||
|
{
|
||||||
|
for (auto& c : Chars) if (c.OriginalPic) c.OriginalPic->SetOffsets(0, 0);
|
||||||
|
}
|
||||||
|
|
|
@ -287,13 +287,10 @@ public:
|
||||||
FirstChar = hexdata.FirstChar;
|
FirstChar = hexdata.FirstChar;
|
||||||
LastChar = hexdata.LastChar;
|
LastChar = hexdata.LastChar;
|
||||||
|
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
FontHeight = 16;
|
FontHeight = 16;
|
||||||
SpaceWidth = 9;
|
SpaceWidth = 9;
|
||||||
GlobalKerning = 0;
|
GlobalKerning = 0;
|
||||||
translateUntranslated = true;
|
|
||||||
|
|
||||||
Chars.Resize(LastChar - FirstChar + 1);
|
Chars.Resize(LastChar - FirstChar + 1);
|
||||||
for (int i = FirstChar; i <= LastChar; i++)
|
for (int i = FirstChar; i <= LastChar; i++)
|
||||||
{
|
{
|
||||||
|
@ -355,12 +352,9 @@ public:
|
||||||
FirstChar = hexdata.FirstChar;
|
FirstChar = hexdata.FirstChar;
|
||||||
LastChar = hexdata.LastChar;
|
LastChar = hexdata.LastChar;
|
||||||
|
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
FontHeight = 18;
|
FontHeight = 18;
|
||||||
SpaceWidth = 9;
|
SpaceWidth = 9;
|
||||||
GlobalKerning = -1;
|
GlobalKerning = -1;
|
||||||
translateUntranslated = true;
|
|
||||||
Chars.Resize(LastChar - FirstChar + 1);
|
Chars.Resize(LastChar - FirstChar + 1);
|
||||||
for (int i = FirstChar; i <= LastChar; i++)
|
for (int i = FirstChar; i <= LastChar; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,9 +151,6 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -227,7 +224,6 @@ void FSingleLumpFont::LoadFON1 (int lump, const uint8_t *data)
|
||||||
FirstChar = 0;
|
FirstChar = 0;
|
||||||
LastChar = 255; // This is to allow LoadTranslations to function. The way this is all set up really needs to be changed.
|
LastChar = 255; // This is to allow LoadTranslations to function. The way this is all set up really needs to be changed.
|
||||||
GlobalKerning = 0;
|
GlobalKerning = 0;
|
||||||
translateUntranslated = true;
|
|
||||||
LastChar = 0x2122;
|
LastChar = 0x2122;
|
||||||
|
|
||||||
// Move the Windows-1252 characters to their proper place.
|
// Move the Windows-1252 characters to their proper place.
|
||||||
|
|
|
@ -80,9 +80,6 @@ FSinglePicFont::FSinglePicFont(const char *picname) :
|
||||||
GlobalKerning = 0;
|
GlobalKerning = 0;
|
||||||
FirstChar = LastChar = 'A';
|
FirstChar = LastChar = 'A';
|
||||||
PicNum = picnum;
|
PicNum = picnum;
|
||||||
|
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -78,8 +78,6 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
||||||
LastChar = first + count - 1;
|
LastChar = first + count - 1;
|
||||||
FontHeight = 0;
|
FontHeight = 0;
|
||||||
GlobalKerning = false;
|
GlobalKerning = false;
|
||||||
Next = FirstFont;
|
|
||||||
FirstFont = this;
|
|
||||||
|
|
||||||
maxyoffs = 0;
|
maxyoffs = 0;
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
||||||
Chars[i].OriginalPic->CopySize(pic, true);
|
Chars[i].OriginalPic->CopySize(pic, true);
|
||||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||||
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
||||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].OriginalPic);
|
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,9 +177,11 @@ void V_InitCustomFonts()
|
||||||
int start;
|
int start;
|
||||||
int first;
|
int first;
|
||||||
int count;
|
int count;
|
||||||
int spacewidth;
|
int spacewidth = -1;
|
||||||
int kerning;
|
int kerning;
|
||||||
char cursor = '_';
|
char cursor = '_';
|
||||||
|
bool ignoreoffsets = false;
|
||||||
|
int MinLum = -1, MaxLum = -1;
|
||||||
|
|
||||||
while ((llump = fileSystem.FindLump ("FONTDEFS", &lastlump)) != -1)
|
while ((llump = fileSystem.FindLump ("FONTDEFS", &lastlump)) != -1)
|
||||||
{
|
{
|
||||||
|
@ -236,10 +238,8 @@ void V_InitCustomFonts()
|
||||||
}
|
}
|
||||||
else if (sc.Compare ("SPACEWIDTH"))
|
else if (sc.Compare ("SPACEWIDTH"))
|
||||||
{
|
{
|
||||||
if (format == 2) goto wrong;
|
|
||||||
sc.MustGetNumber();
|
sc.MustGetNumber();
|
||||||
spacewidth = sc.Number;
|
spacewidth = sc.Number;
|
||||||
format = 1;
|
|
||||||
}
|
}
|
||||||
else if (sc.Compare("DONTTRANSLATE"))
|
else if (sc.Compare("DONTTRANSLATE"))
|
||||||
{
|
{
|
||||||
|
@ -260,9 +260,26 @@ void V_InitCustomFonts()
|
||||||
sc.MustGetNumber();
|
sc.MustGetNumber();
|
||||||
kerning = sc.Number;
|
kerning = sc.Number;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("ignoreoffsets"))
|
||||||
|
{
|
||||||
|
ignoreoffsets = true;
|
||||||
|
}
|
||||||
|
else if (sc.Compare("minluminosity"))
|
||||||
|
{
|
||||||
|
sc.MustGetValue(false);
|
||||||
|
MinLum = (int16_t)clamp(sc.Number, 0, 255);
|
||||||
|
}
|
||||||
|
else if (sc.Compare("maxluminosity"))
|
||||||
|
{
|
||||||
|
sc.MustGetValue(false);
|
||||||
|
MaxLum = (int16_t)clamp(sc.Number, 0, 255);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (format == 1) goto wrong;
|
if (format == 1) goto wrong;
|
||||||
|
// The braces must be filtered so because they'd be treated as block terminators otherwise.
|
||||||
|
if (!strcmp(sc.String, "-{")) strcpy(sc.String, "{");
|
||||||
|
if (!strcmp(sc.String, "-}")) strcpy(sc.String, "}");
|
||||||
FGameTexture **p = &lumplist[*(unsigned char*)sc.String];
|
FGameTexture **p = &lumplist[*(unsigned char*)sc.String];
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FTextureID texid = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
FTextureID texid = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
||||||
|
@ -283,6 +300,7 @@ void V_InitCustomFonts()
|
||||||
FFont *fnt = new FFont (namebuffer, templatebuf, nullptr, first, count, start, llump, spacewidth, donttranslate);
|
FFont *fnt = new FFont (namebuffer, templatebuf, nullptr, first, count, start, llump, spacewidth, donttranslate);
|
||||||
fnt->SetCursor(cursor);
|
fnt->SetCursor(cursor);
|
||||||
fnt->SetKerning(kerning);
|
fnt->SetKerning(kerning);
|
||||||
|
if (ignoreoffsets) fnt->ClearOffsets();
|
||||||
}
|
}
|
||||||
else if (format == 2)
|
else if (format == 2)
|
||||||
{
|
{
|
||||||
|
@ -308,6 +326,10 @@ void V_InitCustomFonts()
|
||||||
FFont *fnt = CreateSpecialFont (namebuffer, first, count, &lumplist[first], notranslate, llump, donttranslate);
|
FFont *fnt = CreateSpecialFont (namebuffer, first, count, &lumplist[first], notranslate, llump, donttranslate);
|
||||||
fnt->SetCursor(cursor);
|
fnt->SetCursor(cursor);
|
||||||
fnt->SetKerning(kerning);
|
fnt->SetKerning(kerning);
|
||||||
|
if (spacewidth >= 0) fnt->SpaceWidth = spacewidth;
|
||||||
|
fnt->MinLum = MinLum;
|
||||||
|
fnt->MaxLum = MaxLum;
|
||||||
|
if (ignoreoffsets) fnt->ClearOffsets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else goto wrong;
|
else goto wrong;
|
||||||
|
@ -317,7 +339,7 @@ void V_InitCustomFonts()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wrong:
|
wrong:
|
||||||
sc.ScriptError ("Invalid combination of properties in font '%s'", namebuffer.GetChars());
|
sc.ScriptError ("Invalid combination of properties in font '%s', %s not allowed", namebuffer.GetChars(), sc.String);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -40,10 +40,14 @@
|
||||||
|
|
||||||
class FGameTexture;
|
class FGameTexture;
|
||||||
struct FRemapTable;
|
struct FRemapTable;
|
||||||
|
class FFont;
|
||||||
|
|
||||||
|
FFont* V_GetFont(const char* fontname, const char* fontlumpname = nullptr);
|
||||||
|
|
||||||
enum EColorRange : int
|
enum EColorRange : int
|
||||||
{
|
{
|
||||||
CR_UNDEFINED = -1,
|
CR_UNDEFINED = -1,
|
||||||
|
CR_NATIVEPAL = -1,
|
||||||
CR_BRICK,
|
CR_BRICK,
|
||||||
CR_TAN,
|
CR_TAN,
|
||||||
CR_GRAY,
|
CR_GRAY,
|
||||||
|
@ -95,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 (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 ~FFont ();
|
||||||
|
|
||||||
virtual FGameTexture *GetChar (int code, int translation, int *const width) const;
|
virtual FGameTexture *GetChar (int code, int translation, int *const width) const;
|
||||||
|
@ -122,38 +127,66 @@ public:
|
||||||
inline bool CanPrint(const char *str) const { return CanPrint((const uint8_t *)str); }
|
inline bool CanPrint(const char *str) const { return CanPrint((const uint8_t *)str); }
|
||||||
inline bool CanPrint(const FString &str) const { return CanPrint((const uint8_t *)str.GetChars()); }
|
inline bool CanPrint(const FString &str) const { return CanPrint((const uint8_t *)str.GetChars()); }
|
||||||
|
|
||||||
|
inline FFont* AltFont()
|
||||||
|
{
|
||||||
|
if (AltFontName != NAME_None) return V_GetFont(AltFontName.GetChars());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int GetCharCode(int code, bool needpic) const;
|
int GetCharCode(int code, bool needpic) const;
|
||||||
char GetCursor() const { return Cursor; }
|
char GetCursor() const { return Cursor; }
|
||||||
void SetCursor(char c) { Cursor = c; }
|
void SetCursor(char c) { Cursor = c; }
|
||||||
void SetKerning(int c) { GlobalKerning = c; }
|
void SetKerning(int c) { GlobalKerning = c; }
|
||||||
|
void SetHeight(int c) { FontHeight = c; }
|
||||||
|
void ClearOffsets();
|
||||||
bool NoTranslate() const { return noTranslate; }
|
bool NoTranslate() const { return noTranslate; }
|
||||||
virtual void RecordAllTextureColors(uint32_t *usedcolors);
|
virtual void RecordAllTextureColors(uint32_t *usedcolors);
|
||||||
void CheckCase();
|
void CheckCase();
|
||||||
|
void SetName(FName nm) { FontName = nm; }
|
||||||
|
|
||||||
int GetDisplacement() const { return Displacement; }
|
int GetDisplacement() const { return Displacement; }
|
||||||
|
|
||||||
static int GetLuminosity(uint32_t* colorsused, TArray<double>& Luminosity, int* minlum = nullptr, int* maxlum = nullptr);
|
static int GetLuminosity(uint32_t* colorsused, TArray<double>& Luminosity, int* minlum = nullptr, int* maxlum = nullptr);
|
||||||
EFontType GetType() const { return Type; }
|
EFontType GetType() const { return Type; }
|
||||||
|
|
||||||
|
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:
|
protected:
|
||||||
FFont (int lump);
|
|
||||||
|
|
||||||
void FixXMoves();
|
void FixXMoves();
|
||||||
|
|
||||||
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
|
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
|
||||||
|
|
||||||
EFontType Type = EFontType::Unknown;
|
EFontType Type = EFontType::Unknown;
|
||||||
|
FName AltFontName = NAME_None;
|
||||||
int FirstChar, LastChar;
|
int FirstChar, LastChar;
|
||||||
int SpaceWidth;
|
int SpaceWidth;
|
||||||
int FontHeight;
|
int FontHeight;
|
||||||
int AsciiHeight = 0;
|
|
||||||
int GlobalKerning;
|
int GlobalKerning;
|
||||||
int TranslationType = 0;
|
int TranslationType = 0;
|
||||||
int Displacement = 0;
|
int Displacement = 0;
|
||||||
|
int16_t MinLum = -1, MaxLum = -1;
|
||||||
char Cursor;
|
char Cursor;
|
||||||
bool noTranslate = false;
|
bool noTranslate = false;
|
||||||
bool translateUntranslated;
|
|
||||||
bool MixedCase = false;
|
bool MixedCase = false;
|
||||||
bool forceremap = false;
|
bool forceremap = false;
|
||||||
struct CharData
|
struct CharData
|
||||||
|
@ -163,7 +196,6 @@ protected:
|
||||||
};
|
};
|
||||||
TArray<CharData> Chars;
|
TArray<CharData> Chars;
|
||||||
TArray<int> Translations;
|
TArray<int> Translations;
|
||||||
uint8_t PatchRemap[256];
|
|
||||||
|
|
||||||
int Lump;
|
int Lump;
|
||||||
FName FontName = NAME_None;
|
FName FontName = NAME_None;
|
||||||
|
@ -184,7 +216,6 @@ void V_ClearFonts();
|
||||||
EColorRange V_FindFontColor (FName name);
|
EColorRange V_FindFontColor (FName name);
|
||||||
PalEntry V_LogColorFromColorRange (EColorRange range);
|
PalEntry V_LogColorFromColorRange (EColorRange range);
|
||||||
EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int boldcolor);
|
EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int boldcolor);
|
||||||
FFont *V_GetFont(const char *fontname, const char *fontlumpname = nullptr);
|
|
||||||
void V_InitFontColors();
|
void V_InitFontColors();
|
||||||
char* CleanseString(char* str);
|
char* CleanseString(char* str);
|
||||||
void V_ApplyLuminosityTranslation(int translation, uint8_t* pixel, int size);
|
void V_ApplyLuminosityTranslation(int translation, uint8_t* pixel, int size);
|
||||||
|
|
|
@ -817,7 +817,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
DrawChar(twod, font, pt == 0? fontcolor : CR_UNDEFINED, rx, ry, ch,
|
DrawChar(twod, font, pt == 0? fontcolor : CR_NATIVEPAL, rx, ry, ch,
|
||||||
DTA_DestWidthF, rw,
|
DTA_DestWidthF, rw,
|
||||||
DTA_DestHeightF, rh,
|
DTA_DestHeightF, rh,
|
||||||
DTA_Alpha, Alpha,
|
DTA_Alpha, Alpha,
|
||||||
|
@ -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)
|
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");
|
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.
|
// resolve auto-alignment before making any adjustments to the position values.
|
||||||
|
|
|
@ -188,6 +188,9 @@ static void renderframe(anim_t *anim, uint16_t framenumber, uint16_t *pagepointe
|
||||||
|
|
||||||
while (frame--) offset += LittleShort(pagepointer[frame]);
|
while (frame--) offset += LittleShort(pagepointer[frame]);
|
||||||
|
|
||||||
|
if (offset >= anim->curlp->nBytes)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t *ppointer = (uint8_t *)(pagepointer) + anim->curlp->nRecords*2 + offset + 4;
|
uint8_t *ppointer = (uint8_t *)(pagepointer) + anim->curlp->nRecords*2 + offset + 4;
|
||||||
|
|
||||||
if ((ppointer-4)[1])
|
if ((ppointer-4)[1])
|
||||||
|
|
|
@ -448,7 +448,13 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
|
||||||
if (lumpnum != -1)
|
if (lumpnum != -1)
|
||||||
{
|
{
|
||||||
FString str;
|
FString str;
|
||||||
fileSystem.GetFileShortName(str, lumpnum);
|
if (!usefullnames)
|
||||||
|
fileSystem.GetFileShortName(str, lumpnum);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto fn = fileSystem.GetFileFullName(lumpnum);
|
||||||
|
str = ExtractFileBase(fn);
|
||||||
|
}
|
||||||
auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str, usetype);
|
auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str, usetype);
|
||||||
|
|
||||||
if (out != NULL)
|
if (out != NULL)
|
||||||
|
@ -557,30 +563,44 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
|
||||||
int lasttx = fileSystem.GetLastEntry(wadnum);
|
int lasttx = fileSystem.GetLastEntry(wadnum);
|
||||||
FString Name;
|
FString Name;
|
||||||
|
|
||||||
// Go from first to last so that ANIMDEFS work as expected. However,
|
if (!usefullnames)
|
||||||
// to avoid duplicates (and to keep earlier entries from overriding
|
|
||||||
// later ones), the texture is only inserted if it is the one returned
|
|
||||||
// by doing a check by name in the list of wads.
|
|
||||||
|
|
||||||
for (; firsttx <= lasttx; ++firsttx)
|
|
||||||
{
|
{
|
||||||
if (fileSystem.GetFileNamespace(firsttx) == ns)
|
// Go from first to last so that ANIMDEFS work as expected. However,
|
||||||
{
|
// to avoid duplicates (and to keep earlier entries from overriding
|
||||||
fileSystem.GetFileShortName (Name, firsttx);
|
// later ones), the texture is only inserted if it is the one returned
|
||||||
|
// by doing a check by name in the list of wads.
|
||||||
|
|
||||||
if (fileSystem.CheckNumForName (Name, ns) == firsttx)
|
for (; firsttx <= lasttx; ++firsttx)
|
||||||
{
|
|
||||||
CreateTexture (firsttx, usetype);
|
|
||||||
}
|
|
||||||
progressFunc();
|
|
||||||
}
|
|
||||||
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & LUMPF_MAYBEFLAT)
|
|
||||||
{
|
{
|
||||||
if (fileSystem.CheckNumForName (Name, ns) < firsttx)
|
if (fileSystem.GetFileNamespace(firsttx) == ns)
|
||||||
{
|
{
|
||||||
CreateTexture (firsttx, usetype);
|
fileSystem.GetFileShortName(Name, firsttx);
|
||||||
|
|
||||||
|
if (fileSystem.CheckNumForName(Name, ns) == firsttx)
|
||||||
|
{
|
||||||
|
CreateTexture(firsttx, usetype);
|
||||||
|
}
|
||||||
|
progressFunc();
|
||||||
|
}
|
||||||
|
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & LUMPF_MAYBEFLAT)
|
||||||
|
{
|
||||||
|
if (fileSystem.CheckNumForName(Name, ns) < firsttx)
|
||||||
|
{
|
||||||
|
CreateTexture(firsttx, usetype);
|
||||||
|
}
|
||||||
|
progressFunc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The duplicate check does not work with this (yet.)
|
||||||
|
for (; firsttx <= lasttx; ++firsttx)
|
||||||
|
{
|
||||||
|
if (fileSystem.GetFileNamespace(firsttx) == ns)
|
||||||
|
{
|
||||||
|
CreateTexture(firsttx, usetype);
|
||||||
}
|
}
|
||||||
progressFunc();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,7 @@ public:
|
||||||
FTextureID glPart2;
|
FTextureID glPart2;
|
||||||
FTextureID glPart;
|
FTextureID glPart;
|
||||||
FTextureID mirrorTexture;
|
FTextureID mirrorTexture;
|
||||||
|
bool usefullnames;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
1
src/common/thirdparty/gain_analysis.cpp
vendored
1
src/common/thirdparty/gain_analysis.cpp
vendored
|
@ -251,6 +251,7 @@ GainAnalyzer::ResetSampleFrequency(int samplefreq) {
|
||||||
freqindex = 9;
|
freqindex = 9;
|
||||||
break;
|
break;
|
||||||
case 11025:
|
case 11025:
|
||||||
|
case 11111: // SW shareware tries to play a VOC with this frequency as music. This is close enough to 11025 to use the same table.
|
||||||
freqindex = 10;
|
freqindex = 10;
|
||||||
break;
|
break;
|
||||||
case 8000:
|
case 8000:
|
||||||
|
|
Loading…
Reference in a new issue