From 470dc138c68b2f8d41ccaf5e166be147188f7c25 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 5 Feb 2017 00:17:29 +0100 Subject: [PATCH] - got rid of all DTA_Translation uses. --- src/menu/menuinput.cpp | 6 +++--- src/menu/playerdisplay.cpp | 9 +++++---- src/r_data/r_translate.cpp | 2 ++ src/v_draw.cpp | 15 --------------- src/v_video.h | 3 +-- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/menu/menuinput.cpp b/src/menu/menuinput.cpp index b59080278..71646410d 100644 --- a/src/menu/menuinput.cpp +++ b/src/menu/menuinput.cpp @@ -332,7 +332,6 @@ void DTextEnterMenu::Drawer () const int ch = InputGridChars[y * INPUTGRID_WIDTH + x]; FTexture *pic = SmallFont->GetChar(ch, &width); EColorRange color; - FRemapTable *remap; // The highlighted character is yellow; the rest are dark gray. color = (x == InputGridX && y == InputGridY) ? CR_YELLOW : CR_DARKGRAY; @@ -344,13 +343,14 @@ void DTextEnterMenu::Drawer () } else if (ch == ' ') { + FRemapTable *remap = SmallFont->GetColorTranslation(color); // Draw the space as a box outline. We also draw it 50% wider than it really is. const int x1 = xx + cell_width/2 - width * CleanXfac * 3 / 4; const int x2 = x1 + width * 3 * CleanXfac / 2; const int y1 = yy + top_padding; const int y2 = y1 + SmallFont->GetHeight() * CleanYfac; - const int palentry = remap->Remap[remap->NumEntries*2/3]; - const uint32 palcolor = remap->Palette[remap->NumEntries*2/3]; + const int palentry = remap->Remap[remap->NumEntries * 2 / 3]; + const uint32 palcolor = remap->Palette[remap->NumEntries * 2 / 3]; screen->Clear(x1, y1, x2, y1+CleanYfac, palentry, palcolor); // top screen->Clear(x1, y2, x2, y2+CleanYfac, palentry, palcolor); // bottom screen->Clear(x1, y1+CleanYfac, x1+CleanXfac, y2, palentry, palcolor); // left diff --git a/src/menu/playerdisplay.cpp b/src/menu/playerdisplay.cpp index 9b26d7471..57c8ecf26 100644 --- a/src/menu/playerdisplay.cpp +++ b/src/menu/playerdisplay.cpp @@ -360,13 +360,14 @@ DListMenuItemPlayerDisplay::DListMenuItemPlayerDisplay(FListMenuDescriptor *menu { mOwner = menu; + FRemapTable *bdremap = translationtables[TRANSLATION_Players][MAXPLAYERS + 1]; for (int i = 0; i < 256; i++) { int r = c1.r + c2.r * i / 255; int g = c1.g + c2.g * i / 255; int b = c1.b + c2.b * i / 255; - mRemap.Remap[i] = ColorMatcher.Pick (r, g, b); - mRemap.Palette[i] = PalEntry(255, r, g, b); + bdremap->Remap[i] = ColorMatcher.Pick (r, g, b); + bdremap->Palette[i] = PalEntry(255, r, g, b); } mBackdrop = new FBackdropTexture; mPlayerClass = NULL; @@ -574,10 +575,10 @@ void DListMenuItemPlayerDisplay::Drawer(bool selected) int x = (mXpos - 160) * CleanXfac + (SCREENWIDTH>>1); int y = (mYpos - 100) * CleanYfac + (SCREENHEIGHT>>1); - screen->DrawTexture (mBackdrop, x, y - 1, + screen->DrawTexture(mBackdrop, x, y - 1, DTA_DestWidth, 72 * CleanXfac, DTA_DestHeight, 80 * CleanYfac, - DTA_Translation, &mRemap, + DTA_TranslationIndex, TRANSLATION(TRANSLATION_Players, MAXPLAYERS + 1), DTA_Masked, true, TAG_DONE); diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 78d6e22c9..64f490b30 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -740,6 +740,8 @@ void R_InitTranslationTables () } // The menu player also gets a separate translation table PushIdentityTable(TRANSLATION_Players); + // This one is for the backdrop in the menu + PushIdentityTable(TRANSLATION_Players); // The three standard translations from Doom or Heretic (seven for Strife), // plus the generic ice translation. diff --git a/src/v_draw.cpp b/src/v_draw.cpp index b61d83b01..331be9712 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -472,11 +472,6 @@ static inline double ListGetDouble(va_list &tags) return va_arg(tags, double); } -static inline FRemapTable* ListGetTranslation(va_list &tags) -{ - return va_arg(tags, FRemapTable*); -} - // These two options are only being used by the D3D version of the HUD weapon drawer, they serve no purpose anywhere else. static inline FSpecialColormap * ListGetSpecialColormap(va_list &tags) { @@ -512,12 +507,6 @@ static inline double ListGetDouble(VMVa_List &tags) return 0; } -static inline FRemapTable* ListGetTranslation(VMVa_List &tags) -{ - ThrowAbortException(X_OTHER, "Invalid tag in draw function"); - return nullptr; -} - static inline FSpecialColormap * ListGetSpecialColormap(VMVa_List &tags) { ThrowAbortException(X_OTHER, "Invalid tag in draw function"); @@ -731,10 +720,6 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, fillcolorset = true; break; - case DTA_Translation: - parms->remap = ListGetTranslation(tags); - break; - case DTA_TranslationIndex: parms->remap = TranslationToTable(ListGetInt(tags)); break; diff --git a/src/v_video.h b/src/v_video.h index f52e8b8aa..18bb310e1 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -76,8 +76,7 @@ enum DTA_DestHeight, // height of area to draw to DTA_Alpha, // alpha value for translucency DTA_FillColor, // color to stencil onto the destination (RGB is the color for truecolor drawers, A is the palette index for paletted drawers) - DTA_Translation, // translation table to recolor the source - DTA_TranslationIndex, + DTA_TranslationIndex, // translation table to recolor the source DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen