mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- use DrawChar to draw font characters instead of calling DrawTexture directly.
Mostly done to remove uses of DTA_Translation.
This commit is contained in:
parent
6dea3eef8e
commit
d50e52ea59
3 changed files with 13 additions and 18 deletions
|
@ -945,15 +945,13 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
{
|
{
|
||||||
pic = BigFont->GetChar('0', &v);
|
pic = BigFont->GetChar('0', &v);
|
||||||
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2, '0',
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
screen->DrawTexture(pic, xpos - v / 2, y,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '0',
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -970,11 +968,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
|
||||||
while (val != 0)
|
while (val != 0)
|
||||||
{
|
{
|
||||||
pic = BigFont->GetChar('0' + val % 10, &v);
|
pic = BigFont->GetChar('0' + val % 10, &v);
|
||||||
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
val /= 10;
|
val /= 10;
|
||||||
xpos -= w;
|
xpos -= w;
|
||||||
|
@ -984,11 +981,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
|
||||||
pic = BigFont->GetChar('-', &v);
|
pic = BigFont->GetChar('-', &v);
|
||||||
if (pic != NULL)
|
if (pic != NULL)
|
||||||
{
|
{
|
||||||
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2, '-',
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -999,9 +995,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
|
||||||
while (val != 0)
|
while (val != 0)
|
||||||
{
|
{
|
||||||
pic = BigFont->GetChar('0' + val % 10, &v);
|
pic = BigFont->GetChar('0' + val % 10, &v);
|
||||||
screen->DrawTexture(pic, xpos - v / 2, y,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '0',
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
val /= 10;
|
val /= 10;
|
||||||
xpos -= w;
|
xpos -= w;
|
||||||
|
@ -1011,9 +1006,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
|
||||||
pic = BigFont->GetChar('-', &v);
|
pic = BigFont->GetChar('-', &v);
|
||||||
if (pic != NULL)
|
if (pic != NULL)
|
||||||
{
|
{
|
||||||
screen->DrawTexture(pic, xpos - v / 2, y,
|
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '-',
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,10 +733,6 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag,
|
||||||
|
|
||||||
case DTA_Translation:
|
case DTA_Translation:
|
||||||
parms->remap = ListGetTranslation(tags);
|
parms->remap = ListGetTranslation(tags);
|
||||||
if (parms->remap != NULL && parms->remap->Inactive)
|
|
||||||
{ // If it's inactive, pretend we were passed NULL instead.
|
|
||||||
parms->remap = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTA_ColorOverlay:
|
case DTA_ColorOverlay:
|
||||||
|
@ -911,6 +907,11 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag,
|
||||||
}
|
}
|
||||||
ListEnd(tags);
|
ListEnd(tags);
|
||||||
|
|
||||||
|
if (parms->remap != nullptr && parms->remap->Inactive)
|
||||||
|
{ // If it's inactive, pretend we were passed NULL instead.
|
||||||
|
parms->remap = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (parms->uclip >= parms->dclip || parms->lclip >= parms->rclip)
|
if (parms->uclip >= parms->dclip || parms->lclip >= parms->rclip)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -722,10 +722,10 @@ void WI_drawBackground()
|
||||||
static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED, bool nomove=false)
|
static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED, bool nomove=false)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
screen->DrawTexture(font->GetChar(charcode, &width), x, y,
|
font->GetChar(charcode, &width);
|
||||||
|
screen->DrawChar(font, translation, x, y, charcode,
|
||||||
nomove ? DTA_CleanNoMove : DTA_Clean, true,
|
nomove ? DTA_CleanNoMove : DTA_Clean, true,
|
||||||
DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : 0.5,
|
DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : 0.5,
|
||||||
DTA_Translation, font->GetColorTranslation(translation),
|
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
return x - width;
|
return x - width;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue