diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 1dd5501ad..8446acf57 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,14 @@ +December 23, 2007 (Changes by Graf Zahl) +- Changed DTA_Translation parameter for DrawTexture to an integer to avoid + passing renderer specific data to the function. Also added DTA_Font so + that the renderer can fetch font translations from the proper font. + DIM_MAP/ConShade had to be made a regular translation table to make it + work. +- Added Karate Chris's fix for scoreboard displaying team play related data + in non teamplay games. +- Fixed: The team selection menu didn't work. +- Fixed: UpdateTeam passed an FString to Printf. + December 22, 2007 - Had a look at sbarinfo.cpp and noticed a few places where it allocated character arrays and never freed them. Those have been replaced with diff --git a/src/am_map.cpp b/src/am_map.cpp index 62d94e76d..9e89efe08 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2119,7 +2119,7 @@ static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust, DTA_ClipLeft, f_x, DTA_ClipRight, f_x + f_w, DTA_FlipX, flip, - DTA_Translation, translation != 0 ? translationtables[(translation&0xff00)>>8] + (translation&0x00ff)*256 : NULL, + DTA_Translation, translation, DTA_Alpha, alpha, DTA_FillColor, alphacolor, DTA_RenderStyle, renderstyle, diff --git a/src/c_console.cpp b/src/c_console.cpp index ed63fa525..a3ef245c3 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -80,7 +80,7 @@ static bool TabbedList; // True if tab list was shown CVAR (Bool, con_notablist, false, CVAR_ARCHIVE) static int conback; -static BYTE conshade[256]; +static int conshade; static bool conline; extern int gametic; @@ -292,38 +292,17 @@ void C_InitConsole (int width, int height, bool ingame) { if (!gotconback) { - int i; - conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch); if (conback <= 0) { - BYTE unremap[256]; - BYTE shadetmp[256]; - + conshade = DIM_MAP; conback = TexMan.GetTexture (gameinfo.titlePage, FTexture::TEX_MiscPatch); - - FWadLump palookup = Wads.OpenLumpName ("COLORMAP"); - palookup.Seek (22*256, SEEK_CUR); - palookup.Read (shadetmp, 256); - memset (unremap, 0, 256); - for (i = 0; i < 256; ++i) - { - unremap[GPalette.Remap[i]] = i; - } - for (i = 0; i < 256; ++i) - { - conshade[i] = GPalette.Remap[shadetmp[unremap[i]]]; - } conline = true; - conshade[0] = GPalette.Remap[0]; } else { - for (i = 0; i < 256; ++i) - { - conshade[i] = i; - } + conshade = 0; conline = false; } diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 0a1a81843..182b29c04 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -290,7 +290,7 @@ static void UpdateTeam (int pnum, int team, bool update) if (update && oldteam != info->team) { if (TEAMINFO_IsValidTeam (info->team)) - Printf ("%s joined the %s team\n", info->netname, teams[info->team].name); + Printf ("%s joined the %s team\n", info->netname, teams[info->team].name.GetChars()); else Printf ("%s is now a loner\n", info->netname); } diff --git a/src/f_finale.cpp b/src/f_finale.cpp index 56684465b..4370a52a3 100644 --- a/src/f_finale.cpp +++ b/src/f_finale.cpp @@ -377,7 +377,6 @@ void F_TextWrite (void) int c; int cx; int cy; - const BYTE *range; int leftmargin; int rowheight; bool scale; @@ -403,7 +402,6 @@ void F_TextWrite (void) ch = FinaleText.GetChars(); count = (FinaleCount - 10)/TEXTSPEED; - range = screen->Font->GetColorTranslation (CR_UNTRANSLATED); for ( ; count ; count-- ) { @@ -427,7 +425,8 @@ void F_TextWrite (void) screen->DrawTexture (pic, cx + 320 / 2, cy + 200 / 2, - DTA_Translation, range, + DTA_Font, screen->Font, + DTA_Translation, CR_UNTRANSLATED, DTA_Clean, true, TAG_DONE); } @@ -436,7 +435,8 @@ void F_TextWrite (void) screen->DrawTexture (pic, cx + 320 / 2, cy + 200 / 2, - DTA_Translation, range, + DTA_Font, screen->Font, + DTA_Translation, CR_UNTRANSLATED, TAG_DONE); } } @@ -522,7 +522,7 @@ static struct int castnum; int casttics; int castsprite; // [RH] For overriding the player sprite with a skin -const BYTE * casttranslation; // [RH] Draw "our hero" with their chosen suit color +int casttranslation; // [RH] Draw "our hero" with their chosen suit color FState* caststate; bool castdeath; int castframes; @@ -582,7 +582,7 @@ void F_StartCast (void) castnum = 0; caststate = castorder[castnum].info->SeeState; castsprite = caststate->sprite.index; - casttranslation = NULL; + casttranslation = 0; casttics = caststate->GetTics (); castdeath = false; FinaleStage = 3; @@ -632,12 +632,12 @@ void F_CastTicker (void) if (castnum == 16) { castsprite = skins[players[consoleplayer].userinfo.skin].sprite; - casttranslation = translationtables[TRANSLATION_Players] + 256*consoleplayer; + casttranslation = TRANSLATION(TRANSLATION_Players, consoleplayer); } else { castsprite = caststate->sprite.index; - casttranslation = NULL; + casttranslation = 0; } castframes = 0; } diff --git a/src/g_heretic/heretic_sbar.cpp b/src/g_heretic/heretic_sbar.cpp index 887376fa6..596e2daa1 100644 --- a/src/g_heretic/heretic_sbar.cpp +++ b/src/g_heretic/heretic_sbar.cpp @@ -273,7 +273,7 @@ private: DrawImage (Images[imgCHAINBACK], 0, 32); DrawImage (Images[imgCHAIN], 2+(healthPos%17), chainY); DrawImage (Images[imgLIFEGEM], 17+healthPos, chainY, multiplayer ? - translationtables[TRANSLATION_PlayersExtra] + (CPlayer-players)*256 : NULL); + TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer-players)) : 0); DrawImage (Images[imgLTFACE], 0, 32); DrawImage (Images[imgRTFACE], 276, 32); screen->DrawTexture (&ChainShade, ST_X+19, ST_Y+32, diff --git a/src/g_hexen/hexen_sbar.cpp b/src/g_hexen/hexen_sbar.cpp index 5767fc99d..397c9d02a 100644 --- a/src/g_hexen/hexen_sbar.cpp +++ b/src/g_hexen/hexen_sbar.cpp @@ -367,7 +367,7 @@ private: healthPos = clamp (HealthMarker, 0, 100); DrawImage (ClassImages[lifeClass][imgCHAIN], 35+((healthPos*196/100)%9), 31); DrawImage (ClassImages[lifeClass][imgLIFEGEM], 7+(healthPos*11/5), 31, multiplayer ? - translationtables[TRANSLATION_PlayersExtra] + (CPlayer-players)*256 : NULL); + TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer-players)) : 0); DrawImage (Images[imgLFEDGE], 0, 31); DrawImage (Images[imgRTEDGE], 277, 31); } diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index e8353148c..e80d474d1 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -198,7 +198,7 @@ protected: void DrawPowerups (); void UpdateRect (int x, int y, int width, int height) const; - void DrawImage (FTexture *image, int x, int y, BYTE *translation=NULL) const; + void DrawImage (FTexture *image, int x, int y, int translation=0, FFont *font=NULL) const; void DrawFadedImage (FTexture *image, int x, int y, fixed_t shade) const; void DrawPartialImage (FTexture *image, int wx, int ww) const; diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index 69ddf88e7..f2cfc5387 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1524,7 +1524,7 @@ private: continue; } x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size - DrawImage(character, x, y, drawingFont->GetColorTranslation(translation)); + DrawImage(character, x, y, translation, drawingFont); x += width + spacing - (character->LeftOffset+1); str++; } @@ -1734,14 +1734,13 @@ private: DrawImage(chain, x+(offset%chainsize), y); } if(gem != NULL) - DrawImage(gem, x+padleft+offset, y, translate ? getTranslation() : NULL); + DrawImage(gem, x+padleft+offset, y, translate ? getTranslation() : 0); } - BYTE* getTranslation() + int getTranslation() { - if(gameinfo.gametype & GAME_Raven) - return translationtables[TRANSLATION_PlayersExtra] + (CPlayer - players)*256; - return translationtables[TRANSLATION_Players] + (CPlayer - players)*256; + if(gameinfo.gametype & GAME_Raven) return TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer - players)); + else return TRANSLATION(TRANSLATION_Players, BYTE(CPlayer - players)); } FImageCollection Images; diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 58e9cedbb..841d7e047 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -408,11 +408,12 @@ void FBaseStatusBar::ShowPlayerName () //--------------------------------------------------------------------------- void FBaseStatusBar::DrawImage (FTexture *img, - int x, int y, BYTE *translation) const + int x, int y, int translation, FFont *font) const { if (img != NULL) { screen->DrawTexture (img, x + ST_X, y + ST_Y, + DTA_Font, font, DTA_Translation, translation, DTA_320x200, Scaled, TAG_DONE); @@ -795,11 +796,13 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) DTA_HUDRules, HUD_Normal, DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); screen->DrawTexture (pic, xpos - v/2, y, DTA_HUDRules, HUD_Normal, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); return; } @@ -820,7 +823,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) DTA_HUDRules, HUD_Normal, DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); val /= 10; xpos -= w; @@ -834,7 +838,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) DTA_HUDRules, HUD_Normal, DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); } } @@ -847,7 +852,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) pic = BigFont->GetChar ('0' + val % 10, &v); screen->DrawTexture (pic, xpos - v/2, y, DTA_HUDRules, HUD_Normal, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); val /= 10; xpos -= w; @@ -859,7 +865,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) { screen->DrawTexture (pic, xpos - v/2, y, DTA_HUDRules, HUD_Normal, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), + DTA_Font, BigFont, + DTA_TranslationPtr, CR_UNTRANSLATED, TAG_DONE); } } diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index c654dd973..be7c8986d 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -179,46 +179,52 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER } } - gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 16; + if (teamplay) + gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 16; + else + gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 4 : y = SCREENHEIGHT / 16; HU_DrawTimeRemaining (ST_Y - height); - for (i = 0; i < teams.Size (); i++) + if (teamplay) { - teams[i].players = 0; - teams[i].score = 0; - } - - for (i = 0; i < MAXPLAYERS; ++i) - { - if (playeringame[sortedplayers[i]-players] && TEAMINFO_IsValidTeam (sortedplayers[i]->userinfo.team)) + for (i = 0; i < teams.Size (); i++) { - if (teams[sortedplayers[i]->userinfo.team].players++ == 0) + teams[i].players = 0; + teams[i].score = 0; + } + + for (i = 0; i < MAXPLAYERS; ++i) + { + if (playeringame[sortedplayers[i]-players] && TEAMINFO_IsValidTeam (sortedplayers[i]->userinfo.team)) { - numTeams++; + if (teams[sortedplayers[i]->userinfo.team].players++ == 0) + { + numTeams++; + } + + teams[sortedplayers[i]->userinfo.team].score += sortedplayers[i]->fragcount; } - - teams[sortedplayers[i]->userinfo.team].score += sortedplayers[i]->fragcount; } - } - int scorexwidth = SCREENWIDTH / 32; - for (i = 0; i < teams.Size (); i++) - { - if (teams[i].players) + int scorexwidth = SCREENWIDTH / 32; + for (i = 0; i < teams.Size (); i++) { - char score[80]; - sprintf (score, "%d", teams[i].score); + if (teams[i].players) + { + char score[80]; + sprintf (score, "%d", teams[i].score); - screen->SetFont (BigFont); - screen->DrawText (teams[i].GetTextColor (), scorexwidth, gamestate == GS_INTERMISSION ? y / 1.25 : y / 2, score, - DTA_CleanNoMove, true, TAG_DONE); + screen->SetFont (BigFont); + screen->DrawText (teams[i].GetTextColor (), scorexwidth, gamestate == GS_INTERMISSION ? y / 1.25 : y / 2, score, + DTA_CleanNoMove, true, TAG_DONE); - scorexwidth += SCREENWIDTH / 8; + scorexwidth += SCREENWIDTH / 8; + } } - } - gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32; + gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32; + } screen->SetFont (SmallFont); @@ -234,7 +240,8 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1); gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 10; - y += SCREENWIDTH / 32; + if (teamplay) + y += SCREENWIDTH / 32; for (i = 0; i < MAXPLAYERS && y < ST_Y - 12 * CleanYfac; i++) { diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 36e14173f..e3b60e5eb 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -2134,7 +2134,7 @@ static void M_PlayerSetupDrawer () (PSetupDef.y + LINEHEIGHT*3 + 57 - 104)*CleanYfac + (SCREENHEIGHT/2), DTA_DestWidth, MulScale16 (tex->GetWidth() * CleanXfac, Scale), DTA_DestHeight, MulScale16 (tex->GetHeight() * CleanYfac, Scale), - DTA_Translation, translationtables[TRANSLATION_Players] + 256 * MAXPLAYERS, + DTA_Translation, TRANSLATION(TRANSLATION_Players, 0), TAG_DONE); } } @@ -2547,7 +2547,7 @@ static void M_ChangePlayerTeam (int choice) { team = TEAM_None; } - else if (team == TEAM_None) + else if (!TEAMINFO_IsValidTeam (team)) { team = teams.Size () - 1; } @@ -2558,11 +2558,7 @@ static void M_ChangePlayerTeam (int choice) } else { - if (team == teams.Size () - 1) - { - team = TEAM_None; - } - else if (team == TEAM_None) + if (!TEAMINFO_IsValidTeam (team)) { team = 0; } diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 73fcaa607..ca3fdaf5e 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -1423,6 +1423,7 @@ void R_InitTranslationTables () +8 // Standard (7 for Strife, 3 for the rest) +MAX_ACS_TRANSLATIONS // LevelScripted +BODYQUESIZE // PlayerCorpses + +1 )]; int i, j; @@ -1450,9 +1451,13 @@ void R_InitTranslationTables () translationtables[TRANSLATION_PlayerCorpses] = translationtables[TRANSLATION_LevelScripted] + MAX_ACS_TRANSLATIONS*256; + translationtables[TRANSLATION_Dim] = + translationtables[TRANSLATION_PlayerCorpses] + BODYQUESIZE*256; + translationtables[TRANSLATION_Decorate] = decorate_translations; translationtables[TRANSLATION_Blood] = decorate_translations + MAX_DECORATE_TRANSLATIONS*256; + // [RH] Each player now gets their own translation table. These are set // up during netgame arbitration and as-needed rather than in here. @@ -1597,6 +1602,27 @@ void R_InitTranslationTables () table += 256; } } + + // Dim map + { + BYTE *dim_map = translationtables[TRANSLATION_Dim]; + BYTE unremap[256]; + BYTE shadetmp[256]; + + FWadLump palookup = Wads.OpenLumpName ("COLORMAP"); + palookup.Seek (22*256, SEEK_CUR); + palookup.Read (shadetmp, 256); + memset (unremap, 0, 256); + for (i = 0; i < 256; ++i) + { + unremap[GPalette.Remap[i]] = i; + } + for (i = 0; i < 256; ++i) + { + dim_map[i] = GPalette.Remap[shadetmp[unremap[i]]]; + } + dim_map[0] = GPalette.Remap[0]; + } } // [RH] Create a player's translation table based on a given mid-range color. diff --git a/src/r_draw.h b/src/r_draw.h index b0308e80f..0789dc855 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -212,6 +212,7 @@ enum TRANSLATION_PlayerCorpses, TRANSLATION_Decorate, TRANSLATION_Blood, + TRANSLATION_Dim, NUM_TRANSLATION_TABLES }; @@ -228,6 +229,8 @@ inline int GetTranslationType(WORD trans) return trans >> 8; } +#define DIM_MAP TRANSLATION(TRANSLATION_Dim, 0) + const int MAX_ACS_TRANSLATIONS = 255; const int MAX_DECORATE_TRANSLATIONS = 255; diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 3b3e86c5a..11179992e 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -90,9 +90,13 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, int x, int y, uint32 tag, v if (parms.style != STYLE_Shaded) { - if (parms.translation != NULL) + if (parms.font != NULL) { - dc_colormap = (lighttable_t *)parms.translation; + dc_colormap = parms.font->GetColorTranslation (EColorRange(parms.translation)); + } + else if (parms.translation != 0) + { + dc_colormap = translationtables[(parms.translation&0xff00)>>8] + (parms.translation&0x00ff)*256; } else { @@ -251,6 +255,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l { INTBOOL boolval; int intval; + bool translationset = false; if (img == NULL || img->UseType == FTexture::TEX_Null) { @@ -272,7 +277,8 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l parms->left = img->GetScaledLeftOffset(); parms->alpha = FRACUNIT; parms->fillcolor = -1; - parms->translation = NULL; + parms->font = NULL; + parms->translation = 0; parms->alphaChannel = false; parms->flipX = false; parms->shadowAlpha = 0; @@ -397,8 +403,19 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l parms->fillcolor = va_arg (tags, int); break; + case DTA_Font: + parms->font = va_arg(tags, FFont*); + if (!translationset) + { + // default translation for fonts should be untranslated which unfortunately is not 0. + parms->translation = CR_UNTRANSLATED; + translationset = true; + } + break; + case DTA_Translation: - parms->translation = va_arg (tags, const BYTE *); + parms->translation = va_arg(tags, int); + translationset = true; break; case DTA_FlipX: diff --git a/src/v_palette.h b/src/v_palette.h index dee420b60..4f56078b6 100644 --- a/src/v_palette.h +++ b/src/v_palette.h @@ -89,9 +89,6 @@ extern "C" { extern FDynamicColormap NormalLight; } -// The translation to use for depleted items -#define DIM_MAP &NormalLight.Maps[NUMCOLORMAPS*2/3*256] - extern int Near255; // A color near 255 in appearance, but not 255 int BestColor (const uint32 *pal, int r, int g, int b, int first=1, int num=255); diff --git a/src/v_text.cpp b/src/v_text.cpp index a4bebc773..7c69e3349 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -70,10 +70,9 @@ void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, BYTE character if (NULL != (pic = Font->GetChar (character, &dummy))) { - const BYTE *range = Font->GetColorTranslation ((EColorRange)normalcolor); va_list taglist; va_start (taglist, character); - DrawTexture (pic, x, y, DTA_Translation, range, TAG_MORE, &taglist); + DrawTexture (pic, x, y, DTA_Font, Font, DTA_Translation, normalcolor, TAG_MORE, &taglist); va_end (taglist); } } @@ -96,11 +95,13 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st int cx; int cy; int boldcolor; - const BYTE *range; + int range; int height; int forcedwidth = 0; int scalex, scaley; int kerning; + FFont *Font = this->Font; + FTexture *pic; if (Font == NULL || string == NULL) @@ -110,7 +111,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st normalcolor = CR_UNTRANSLATED; boldcolor = normalcolor ? normalcolor - 1 : NumTextColors - 1; - range = Font->GetColorTranslation ((EColorRange)normalcolor); + range = normalcolor; height = Font->GetHeight () + 1; kerning = Font->GetDefaultKerning (); @@ -129,7 +130,6 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st { va_list *more_p; DWORD data; - void *ptrval; switch (tag) { @@ -158,7 +158,12 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st // Translation is specified explicitly by the text. case DTA_Translation: *(DWORD *)tags = TAG_IGNORE; - ptrval = va_arg (tags, void*); + data = va_arg (tags, int); + break; + + case DTA_Font: + *(DWORD *)tags = TAG_IGNORE; + Font = va_arg (tags, FFont*); break; case DTA_CleanNoMove: @@ -214,7 +219,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st EColorRange newcolor = V_ParseFontColor (ch, normalcolor, boldcolor); if (newcolor != CR_UNDEFINED) { - range = Font->GetColorTranslation (newcolor); + range = newcolor; } continue; } @@ -234,6 +239,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st { w = forcedwidth; DrawTexture (pic, cx, cy, + DTA_Font, Font, DTA_Translation, range, DTA_DestWidth, forcedwidth, DTA_DestHeight, height, @@ -242,6 +248,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st else { DrawTexture (pic, cx, cy, + DTA_Font, Font, DTA_Translation, range, TAG_MORE, &taglist); } diff --git a/src/v_video.h b/src/v_video.h index 884ec1674..d4dbc68ff 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -76,7 +76,9 @@ enum DTA_DestHeight, // height of area to draw to DTA_Alpha, // alpha value for translucency DTA_FillColor, // color to stencil onto the destination + DTA_Font, // For characters: Font it belongs to DTA_Translation, // translation table to recolor the source + DTA_TranslationPtr, // 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 @@ -204,7 +206,8 @@ protected: int left; fixed_t alpha; int fillcolor; - const BYTE *translation; + FFont *font; + int translation; INTBOOL alphaChannel; INTBOOL flipX; fixed_t shadowAlpha; diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 84b43580c..d700f6d28 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -698,7 +698,8 @@ static void WI_DrawCharPatch (FTexture *patch, int x, int y) screen->DrawTexture (patch, x, y, DTA_Clean, true, DTA_ShadowAlpha, (gameinfo.gametype == GAME_Doom) ? 0 : FRACUNIT/2, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), // otherwise it doesn't look good in Strife! + DTA_Font, BigFont, + DTA_Translation, CR_UNTRANSLATED, // otherwise it doesn't look good in Strife! TAG_DONE); } } @@ -1583,13 +1584,13 @@ void WI_drawNetgameStats () x = NG_STATSX; // [RH] Only use one graphic for the face backgrounds screen->DrawTexture (p, x - p->GetWidth(), y, - DTA_Translation, translationtables[TRANSLATION_Players] + i*256, + DTA_Translation, TRANSLATION(TRANSLATION_Players, i), DTA_Clean, true, TAG_DONE); if (i == me) screen->DrawTexture (star, x - p->GetWidth(), y, - DTA_Translation, translationtables[TRANSLATION_Players] + i*256, + DTA_Translation, TRANSLATION(TRANSLATION_Players, i), DTA_Clean, true, TAG_DONE); @@ -1633,7 +1634,7 @@ void WI_drawNetgameStats () if (gameinfo.gametype == GAME_Heretic) { screen->DrawTexture (star, 25, y, - DTA_Translation, translationtables[TRANSLATION_Players] + i*256, + DTA_Translation, TRANSLATION(TRANSLATION_Players, i), DTA_Clean, true, TAG_DONE); }