From d50e52ea59ae8f16fd36aef9784b03e657a71d61 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 4 Feb 2017 22:50:23 +0100 Subject: [PATCH] - use DrawChar to draw font characters instead of calling DrawTexture directly. Mostly done to remove uses of DTA_Translation. --- src/g_statusbar/strife_sbar.cpp | 18 ++++++------------ src/v_draw.cpp | 9 +++++---- src/wi_stuff.cpp | 4 ++-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/g_statusbar/strife_sbar.cpp b/src/g_statusbar/strife_sbar.cpp index 4ce1cf198..8e1374491 100644 --- a/src/g_statusbar/strife_sbar.cpp +++ b/src/g_statusbar/strife_sbar.cpp @@ -945,15 +945,13 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size if (val == 0) { 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_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); - screen->DrawTexture(pic, xpos - v / 2, y, + screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '0', DTA_HUDRules, HUD_Normal, - DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); return; } @@ -970,11 +968,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size while (val != 0) { 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_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); val /= 10; xpos -= w; @@ -984,11 +981,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size pic = BigFont->GetChar('-', &v); 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_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); } } @@ -999,9 +995,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size while (val != 0) { 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_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); val /= 10; xpos -= w; @@ -1011,9 +1006,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size pic = BigFont->GetChar('-', &v); if (pic != NULL) { - screen->DrawTexture(pic, xpos - v / 2, y, + screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '-', DTA_HUDRules, HUD_Normal, - DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); } } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index c678e8282..3961c1ec1 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -733,10 +733,6 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, case DTA_Translation: 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; case DTA_ColorOverlay: @@ -911,6 +907,11 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, } 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) { return false; diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 46be7d8c9..73a5b9742 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -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) { 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, DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : 0.5, - DTA_Translation, font->GetColorTranslation(translation), TAG_DONE); return x - width; }