From d3ed83942f9b5c3b3727d64b4d0bf9e6c4ca86df Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 4 Feb 2017 13:11:12 +0100 Subject: [PATCH] - did some preparations to ParseDrawTextureTags to allow using the same code for parsing tag lists generated by the VM. - removed the fixed point alpha tag from DrawTexture and replaced all uses with the floating point version. --- src/am_map.cpp | 2 +- src/c_console.cpp | 14 +-- src/g_shared/hudmessages.cpp | 24 +++--- src/g_shared/shared_hud.cpp | 24 +++--- src/g_statusbar/sbarinfo.cpp | 12 +-- src/g_statusbar/strife_sbar.cpp | 20 ++--- src/intermission/intermission.cpp | 2 +- src/menu/menu.cpp | 2 +- src/menu/readthis.cpp | 2 +- src/p_conversation.cpp | 4 +- src/r_things.cpp | 2 +- src/v_draw.cpp | 139 ++++++++++++++++++------------ src/v_video.h | 3 +- src/wi_stuff.cpp | 2 +- 14 files changed, 139 insertions(+), 113 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index fad6a13ac..19f10f067 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2935,7 +2935,7 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust, DTA_ClipRight, f_x + f_w, DTA_FlipX, flip, DTA_Translation, TranslationToTable(translation), - DTA_AlphaF, alpha, + DTA_Alpha, alpha, DTA_FillColor, fillcolor, DTA_RenderStyle, DWORD(renderstyle), TAG_DONE); diff --git a/src/c_console.cpp b/src/c_console.cpp index a9cd97557..4340cc3f8 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1003,23 +1003,23 @@ void FNotifyBuffer::Draw() { if (!center) screen->DrawText (SmallFont, color, 0, line, notify.Text, - DTA_CleanNoMove, true, DTA_AlphaF, alpha, TAG_DONE); + DTA_CleanNoMove, true, DTA_Alpha, alpha, TAG_DONE); else screen->DrawText (SmallFont, color, (SCREENWIDTH - SmallFont->StringWidth (notify.Text)*CleanXfac)/2, line, notify.Text, DTA_CleanNoMove, true, - DTA_AlphaF, alpha, TAG_DONE); + DTA_Alpha, alpha, TAG_DONE); } else if (active_con_scaletext() == 1) { if (!center) screen->DrawText (SmallFont, color, 0, line, notify.Text, - DTA_AlphaF, alpha, TAG_DONE); + DTA_Alpha, alpha, TAG_DONE); else screen->DrawText (SmallFont, color, (SCREENWIDTH - SmallFont->StringWidth (notify.Text))/2, line, notify.Text, - DTA_AlphaF, alpha, TAG_DONE); + DTA_Alpha, alpha, TAG_DONE); } else { @@ -1028,7 +1028,7 @@ void FNotifyBuffer::Draw() DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(), DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(), DTA_KeepRatio, true, - DTA_AlphaF, alpha, TAG_DONE); + DTA_Alpha, alpha, TAG_DONE); else screen->DrawText (SmallFont, color, (screen->GetWidth() - SmallFont->StringWidth (notify.Text) * active_con_scaletext()) / 2 / active_con_scaletext(), @@ -1036,7 +1036,7 @@ void FNotifyBuffer::Draw() DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(), DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(), DTA_KeepRatio, true, - DTA_AlphaF, alpha, TAG_DONE); + DTA_Alpha, alpha, TAG_DONE); } line += lineadv; canskip = false; @@ -1117,7 +1117,7 @@ void C_DrawConsole (bool hw2d) DTA_DestWidth, screen->GetWidth(), DTA_DestHeight, screen->GetHeight(), DTA_ColorOverlay, conshade, - DTA_AlphaF, (hw2d && gamestate != GS_FULLCONSOLE) ? (double)con_alpha : 1., + DTA_Alpha, (hw2d && gamestate != GS_FULLCONSOLE) ? (double)con_alpha : 1., DTA_Masked, false, TAG_DONE); if (conline && visheight < screen->GetHeight()) diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index 0db6d4743..86ddc4bfd 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -457,7 +457,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) { screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_RenderStyle, Style, TAG_DONE); } @@ -466,7 +466,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_RenderStyle, Style, DTA_KeepRatio, true, TAG_DONE); @@ -481,7 +481,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) DTA_ClipRight, ClipRight, DTA_ClipTop, ClipTop, DTA_ClipBottom, ClipBot, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_RenderStyle, Style, TAG_DONE); } @@ -560,7 +560,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh { screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, TAG_DONE); } @@ -569,7 +569,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, DTA_KeepRatio, true, TAG_DONE); @@ -584,7 +584,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh DTA_ClipRight, ClipRight, DTA_ClipTop, ClipTop, DTA_ClipBottom, ClipBot, - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, TAG_DONE); } @@ -660,7 +660,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu { screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, TAG_DONE); } @@ -669,7 +669,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, DTA_KeepRatio, true, TAG_DONE); @@ -684,7 +684,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu DTA_ClipRight, ClipRight, DTA_ClipTop, ClipTop, DTA_ClipBottom, ClipBot, - DTA_AlphaF, trans, + DTA_Alpha, trans, DTA_RenderStyle, Style, TAG_DONE); } @@ -842,7 +842,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, DTA_TextLen, LineVisible, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_RenderStyle, Style, TAG_DONE); } @@ -853,7 +853,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), DTA_KeepRatio, true, DTA_TextLen, LineVisible, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_RenderStyle, Style, TAG_DONE); } @@ -867,7 +867,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in DTA_ClipRight, ClipRight, DTA_ClipTop, ClipTop, DTA_ClipBottom, ClipBot, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_TextLen, LineVisible, DTA_RenderStyle, Style, TAG_DONE); diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 37312748c..4ab0c8133 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -138,7 +138,7 @@ void SetHUDIcon(PClassInventory *cls, FTextureID tex) // center of the box. The image is scaled down if it doesn't fit // //--------------------------------------------------------------------------- -static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans=0xc000) +static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, double trans = 0.75) { double scale1, scale2; @@ -174,7 +174,7 @@ static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans // //--------------------------------------------------------------------------- -static void DrawHudText(FFont *font, int color, char * text, int x, int y, int trans=0xc000) +static void DrawHudText(FFont *font, int color, char * text, int x, int y, double trans = 0.75) { int zerowidth; FTexture *tex_zero = font->GetChar('0', &zerowidth); @@ -207,7 +207,7 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t // //--------------------------------------------------------------------------- -static void DrawHudNumber(FFont *font, int color, int num, int x, int y, int trans=0xc000) +static void DrawHudNumber(FFont *font, int color, int num, int x, int y, double trans = 0.75) { char text[15]; @@ -227,11 +227,11 @@ static void DrawStatLine(int x, int &y, const char *prefix, const char *string) y -= SmallFont->GetHeight()-1; screen->DrawText(SmallFont, hudcolor_statnames, x, y, prefix, DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75, TAG_DONE); screen->DrawText(SmallFont, hudcolor_stats, x+statspace, y, string, DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75, TAG_DONE); } static void DrawStatus(player_t * CPlayer, int x, int y) @@ -654,7 +654,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y) FTextureID icon = !AltIcon.isNull()? AltIcon : inv->Icon; if (!icon.isValid()) continue; - int trans= (wi && (type==wi->AmmoType1 || type==wi->AmmoType2)) ? 0xc000:0x6000; + double trans= (wi && (type==wi->AmmoType1 || type==wi->AmmoType2)) ? 0.75 : 0.375; int maxammo = inv->MaxAmount; int ammo = ammoitem? ammoitem->Amount : 0; @@ -731,16 +731,16 @@ FTextureID GetInventoryIcon(AInventory *item, DWORD flags, bool *applyscale=NULL static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon) { - int trans; + double trans; // Powered up weapons and inherited sister weapons are not displayed. if (weapon->WeaponFlags & WIF_POWERED_UP) return; if (weapon->SisterWeapon && weapon->IsKindOf(weapon->SisterWeapon->GetClass())) return; - trans=0x6666; + trans=0.4; if (CPlayer->ReadyWeapon) { - if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans=0xd999; + if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans = 0.85; } FTextureID picnum = GetInventoryIcon(weapon, DI_ALTICONFIRST); @@ -809,7 +809,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y) { screen->DrawTexture(invgems[!!(level.time&4)], x-10, y, DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE); } for(i=0;iNextInv()) @@ -820,7 +820,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y) if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) ) { - int trans = rover==CPlayer->mo->InvSel ? 0x10000 : 0x6666; + double trans = rover==CPlayer->mo->InvSel ? 1.0 : 0.4; DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans); if (rover->Amount>1) @@ -845,7 +845,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y) { screen->DrawTexture(invgems[2 + !!(level.time&4)], x-10, y, DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE); } } } diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index d6e5f6dbf..33b47f15d 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -1270,7 +1270,7 @@ public: DTA_Translation, translate ? GetTranslation() : 0, DTA_ColorOverlay, dim ? DIM_OVERLAY : 0, DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_AlphaChannel, alphaMap, DTA_FillColor, 0, TAG_DONE); @@ -1287,7 +1287,7 @@ public: DTA_Translation, translate ? GetTranslation() : 0, DTA_ColorOverlay, dim ? DIM_OVERLAY : 0, DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, TAG_DONE); } } @@ -1347,7 +1347,7 @@ public: DTA_Translation, translate ? GetTranslation() : 0, DTA_ColorOverlay, dim ? DIM_OVERLAY : 0, DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, DTA_AlphaChannel, alphaMap, DTA_FillColor, 0, TAG_DONE); @@ -1364,7 +1364,7 @@ public: DTA_Translation, translate ? GetTranslation() : 0, DTA_ColorOverlay, dim ? DIM_OVERLAY : 0, DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, TAG_DONE); } } @@ -1487,7 +1487,7 @@ public: screen->DrawTexture(character, srx, sry, DTA_DestWidthF, rw, DTA_DestHeightF, rh, - DTA_AlphaF, salpha, + DTA_Alpha, salpha, DTA_FillColor, 0, TAG_DONE); } @@ -1495,7 +1495,7 @@ public: DTA_DestWidthF, rw, DTA_DestHeightF, rh, DTA_Translation, remap, - DTA_AlphaF, Alpha, + DTA_Alpha, Alpha, TAG_DONE); if(script->spacingCharacter == '\0') ax += width + spacing - (character->LeftOffset+1); diff --git a/src/g_statusbar/strife_sbar.cpp b/src/g_statusbar/strife_sbar.cpp index d2511c42d..4ce1cf198 100644 --- a/src/g_statusbar/strife_sbar.cpp +++ b/src/g_statusbar/strife_sbar.cpp @@ -451,7 +451,7 @@ private: screen->DrawTexture (Images[CursorImage], 42 + 35*i + ST_X, 12 + ST_Y, DTA_Bottom320x200, Scaled, - DTA_AlphaF, 1. - ItemFlash, + DTA_Alpha, 1. - ItemFlash, TAG_DONE); } if (item->Icon.isValid()) @@ -523,7 +523,7 @@ private: DTA_HUDRules, HUD_Normal, DTA_LeftOffset, cursor->GetWidth(), DTA_TopOffset, cursor->GetHeight(), - DTA_AlphaF, ItemFlash, + DTA_Alpha, ItemFlash, TAG_DONE); } DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7); @@ -547,7 +547,7 @@ private: { screen->DrawTexture (Images[CursorImage], -100+i*35, -21, DTA_HUDRules, HUD_HorizCenter, - DTA_Alpha, TRANSLUC75, + DTA_Alpha, 0.75, TAG_DONE); } if (item->Icon.isValid()) @@ -580,7 +580,7 @@ private: left = screen->GetWidth()/2 - 160*CleanXfac; top = bottom + height * yscale; - screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_AlphaF, 0.75, TAG_DONE); + screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, 0.75, TAG_DONE); screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE); @@ -874,7 +874,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center, else if (val == 0) { screen->DrawTexture(Images[imgINumbers], x + 1, y + 1, - DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, + DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE); screen->DrawTexture(Images[imgINumbers], x, y, DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE); @@ -888,7 +888,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center, while (val != 0) { screen->DrawTexture(Images[imgINumbers + val % 10], x + 1, y + 1, - DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, + DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE); x -= w; val /= 10; @@ -896,7 +896,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center, if (negative) { screen->DrawTexture(Images[imgNEGATIVE], x + 1, y + 1, - DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, + DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE); } @@ -947,7 +947,7 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size pic = BigFont->GetChar('0', &v); screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2, DTA_HUDRules, HUD_Normal, - DTA_AlphaF, HR_SHADOW, + DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); @@ -972,7 +972,7 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size pic = BigFont->GetChar('0' + val % 10, &v); screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2, DTA_HUDRules, HUD_Normal, - DTA_AlphaF, HR_SHADOW, + DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); @@ -986,7 +986,7 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size { screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2, DTA_HUDRules, HUD_Normal, - DTA_AlphaF, HR_SHADOW, + DTA_Alpha, HR_SHADOW, DTA_FillColor, 0, DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED), TAG_DONE); diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 2612bdd63..9c3353b60 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -630,7 +630,7 @@ void DIntermissionScreenCast::Drawer () DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y, DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X, DTA_RenderStyle, mDefaults->RenderStyle, - DTA_AlphaF, mDefaults->Alpha, + DTA_Alpha, mDefaults->Alpha, DTA_Translation, casttranslation, TAG_DONE); } diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index acec65f90..c047a145d 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -305,7 +305,7 @@ void DMenu::Drawer () } else { - screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_AlphaF, BackbuttonAlpha, TAG_DONE); + screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, TAG_DONE); } } } diff --git a/src/menu/readthis.cpp b/src/menu/readthis.cpp index f1e82cd51..06d4620da 100644 --- a/src/menu/readthis.cpp +++ b/src/menu/readthis.cpp @@ -105,7 +105,7 @@ void DReadThisMenu::Drawer() { screen->DrawTexture (prevpic, 0, 0, DTA_Fullscreen, true, TAG_DONE); } - screen->DrawTexture (tex, 0, 0, DTA_Fullscreen, true, DTA_AlphaF, alpha, TAG_DONE); + screen->DrawTexture (tex, 0, 0, DTA_Fullscreen, true, DTA_Alpha, alpha, TAG_DONE); } diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index ac6c2bc23..a77a7358d 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1061,10 +1061,10 @@ public: mysnprintf(goldstr, countof(goldstr), "%d", coin != NULL ? coin->Amount : 0); screen->DrawText(SmallFont, CR_GRAY, 21, 191, goldstr, DTA_320x200, true, - DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE); + DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); screen->DrawTexture(TexMan(((AInventory *)GetDefaultByType(cointype))->Icon), 3, 190, DTA_320x200, true, - DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE); + DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); screen->DrawText(SmallFont, CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE); screen->DrawTexture(TexMan(((AInventory *)GetDefaultByType(cointype))->Icon), 2, 189, DTA_320x200, true, TAG_DONE); diff --git a/src/r_things.cpp b/src/r_things.cpp index 730448706..8aaf0dcfe 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1720,7 +1720,7 @@ void R_DrawRemainingPlayerSprites() DTA_ClipTop, viewwindowy, DTA_ClipRight, viewwindowx + viewwidth, DTA_ClipBottom, viewwindowy + viewheight, - DTA_AlphaF, vis->Style.Alpha, + DTA_Alpha, vis->Style.Alpha, DTA_RenderStyle, vis->RenderStyle, DTA_FillColor, vis->FillColor, DTA_SpecialColormap, special, diff --git a/src/v_draw.cpp b/src/v_draw.cpp index cf1e4c688..e5896958a 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -431,6 +431,37 @@ bool DCanvas::SetTextureParms(DrawParms *parms, FTexture *img, double xx, double return false; } +static void ListEnd(va_list &tags) +{ + va_end(tags); +} + +static int ListGetInt(va_list &tags) +{ + return va_arg(tags, int); +} + +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) +{ + return va_arg(tags, FSpecialColormap *); +} + +static inline FColormapStyle * ListGetColormapStyle(va_list &tags) +{ + return va_arg(tags, FColormapStyle *); +} + bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag, va_list tags, DrawParms *parms, bool fortext) const { INTBOOL boolval; @@ -442,7 +473,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag { if (img == NULL || img->UseType == FTexture::TEX_Null) { - va_end(tags); + ListEnd(tags); return false; } } @@ -450,7 +481,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag // Do some sanity checks on the coordinates. if (x < -16383 || x > 16383 || y < -16383 || y > 16383) { - va_end(tags); + ListEnd(tags); return false; } @@ -497,39 +528,39 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag switch (tag) { default: - data = va_arg(tags, DWORD); + ListGetInt(tags); break; case DTA_DestWidth: assert(fortext == false); if (fortext) return false; parms->cleanmode = DTA_Base; - parms->destwidth = va_arg(tags, int); + parms->destwidth = ListGetInt(tags); break; case DTA_DestWidthF: assert(fortext == false); if (fortext) return false; parms->cleanmode = DTA_Base; - parms->destwidth = va_arg(tags, double); + parms->destwidth = ListGetDouble(tags); break; case DTA_DestHeight: assert(fortext == false); if (fortext) return false; parms->cleanmode = DTA_Base; - parms->destheight = va_arg(tags, int); + parms->destheight = ListGetInt(tags); break; case DTA_DestHeightF: assert(fortext == false); if (fortext) return false; parms->cleanmode = DTA_Base; - parms->destheight = va_arg(tags, double); + parms->destheight = ListGetDouble(tags); break; case DTA_Clean: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { parms->scalex = 1; @@ -539,7 +570,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_CleanNoMove: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { parms->scalex = CleanXfac; @@ -549,7 +580,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_CleanNoMove_1: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { parms->scalex = CleanXfac_1; @@ -559,7 +590,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_320x200: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { parms->cleanmode = DTA_Base; @@ -571,7 +602,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_Bottom320x200: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { parms->cleanmode = DTA_Base; @@ -584,32 +615,32 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_HUDRules: - intval = va_arg(tags, int); + intval = ListGetInt(tags); parms->cleanmode = intval == HUD_HorizCenter ? DTA_HUDRulesC : DTA_HUDRules; break; case DTA_VirtualWidth: parms->cleanmode = DTA_Base; - parms->virtWidth = va_arg(tags, int); + parms->virtWidth = ListGetInt(tags); break; case DTA_VirtualWidthF: parms->cleanmode = DTA_Base; - parms->virtWidth = va_arg(tags, double); + parms->virtWidth = ListGetDouble(tags); break; case DTA_VirtualHeight: parms->cleanmode = DTA_Base; - parms->virtHeight = va_arg(tags, int); + parms->virtHeight = ListGetInt(tags); break; case DTA_VirtualHeightF: parms->cleanmode = DTA_Base; - parms->virtHeight = va_arg(tags, double); + parms->virtHeight = ListGetDouble(tags); break; case DTA_Fullscreen: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { assert(fortext == false); @@ -621,24 +652,20 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_Alpha: - parms->Alpha = FIXED2FLOAT(MIN(OPAQUE, va_arg (tags, fixed_t))); - break; - - case DTA_AlphaF: - parms->Alpha = (float)(MIN(1., va_arg(tags, double))); + parms->Alpha = (float)(MIN(1., ListGetDouble(tags))); break; case DTA_AlphaChannel: - parms->alphaChannel = va_arg(tags, INTBOOL); + parms->alphaChannel = ListGetInt(tags); break; case DTA_FillColor: - parms->fillcolor = va_arg(tags, uint32); + parms->fillcolor = ListGetInt(tags); fillcolorset = true; break; case DTA_Translation: - parms->remap = va_arg(tags, FRemapTable *); + parms->remap = ListGetTranslation(tags); if (parms->remap != NULL && parms->remap->Inactive) { // If it's inactive, pretend we were passed NULL instead. parms->remap = NULL; @@ -646,41 +673,41 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_ColorOverlay: - parms->colorOverlay = va_arg(tags, DWORD); + parms->colorOverlay = ListGetInt(tags); break; case DTA_FlipX: - parms->flipX = va_arg(tags, INTBOOL); + parms->flipX = ListGetInt(tags); break; case DTA_TopOffset: assert(fortext == false); if (fortext) return false; - parms->top = va_arg(tags, int); + parms->top = ListGetInt(tags); break; case DTA_TopOffsetF: assert(fortext == false); if (fortext) return false; - parms->top = va_arg(tags, double); + parms->top = ListGetDouble(tags); break; case DTA_LeftOffset: assert(fortext == false); if (fortext) return false; - parms->left = va_arg(tags, int); + parms->left = ListGetInt(tags); break; case DTA_LeftOffsetF: assert(fortext == false); if (fortext) return false; - parms->left = va_arg(tags, double); + parms->left = ListGetDouble(tags); break; case DTA_CenterOffset: assert(fortext == false); if (fortext) return false; - if (va_arg(tags, int)) + if (ListGetInt(tags)) { parms->left = img->GetScaledWidthDouble() * 0.5; parms->top = img->GetScaledHeightDouble() * 0.5; @@ -690,7 +717,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag case DTA_CenterBottomOffset: assert(fortext == false); if (fortext) return false; - if (va_arg(tags, int)) + if (ListGetInt(tags)) { parms->left = img->GetScaledWidthDouble() * 0.5; parms->top = img->GetScaledHeightDouble(); @@ -700,29 +727,29 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag case DTA_WindowLeft: assert(fortext == false); if (fortext) return false; - parms->windowleft = va_arg(tags, int); + parms->windowleft = ListGetInt(tags); break; case DTA_WindowLeftF: assert(fortext == false); if (fortext) return false; - parms->windowleft = va_arg(tags, double); + parms->windowleft = ListGetDouble(tags); break; case DTA_WindowRight: assert(fortext == false); if (fortext) return false; - parms->windowright = va_arg(tags, int); + parms->windowright = ListGetInt(tags); break; case DTA_WindowRightF: assert(fortext == false); if (fortext) return false; - parms->windowright = va_arg(tags, double); + parms->windowright = ListGetDouble(tags); break; case DTA_ClipTop: - parms->uclip = va_arg(tags, int); + parms->uclip = ListGetInt(tags); if (parms->uclip < 0) { parms->uclip = 0; @@ -730,7 +757,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_ClipBottom: - parms->dclip = va_arg(tags, int); + parms->dclip = ListGetInt(tags); if (parms->dclip > this->GetHeight()) { parms->dclip = this->GetHeight(); @@ -738,7 +765,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_ClipLeft: - parms->lclip = va_arg(tags, int); + parms->lclip = ListGetInt(tags); if (parms->lclip < 0) { parms->lclip = 0; @@ -746,7 +773,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_ClipRight: - parms->rclip = va_arg(tags, int); + parms->rclip = ListGetInt(tags); if (parms->rclip > this->GetWidth()) { parms->rclip = this->GetWidth(); @@ -754,18 +781,18 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_ShadowAlpha: - parms->shadowAlpha = MIN(OPAQUE, va_arg (tags, fixed_t)); + parms->shadowAlpha = (float)MIN(1., ListGetDouble(tags)); break; case DTA_ShadowColor: - parms->shadowColor = va_arg(tags, int); + parms->shadowColor = ListGetInt(tags); break; case DTA_Shadow: - boolval = va_arg(tags, INTBOOL); + boolval = ListGetInt(tags); if (boolval) { - parms->shadowAlpha = FRACUNIT/2; + parms->shadowAlpha = 0.5; parms->shadowColor = 0; } else @@ -775,45 +802,45 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag break; case DTA_Masked: - parms->masked = va_arg(tags, INTBOOL); + parms->masked = ListGetInt(tags); break; case DTA_BilinearFilter: - parms->bilinear = va_arg(tags, INTBOOL); + parms->bilinear = ListGetInt(tags); break; case DTA_KeepRatio: // I think this is a terribly misleading name, since it actually turns // *off* aspect ratio correction. - parms->keepratio = va_arg(tags, INTBOOL); + parms->keepratio = ListGetInt(tags); break; case DTA_RenderStyle: - parms->style.AsDWORD = va_arg(tags, DWORD); + parms->style.AsDWORD = ListGetInt(tags); break; case DTA_SpecialColormap: - parms->specialcolormap = va_arg(tags, FSpecialColormap *); + parms->specialcolormap = ListGetSpecialColormap(tags); break; case DTA_ColormapStyle: - parms->colormapstyle = va_arg(tags, FColormapStyle *); + parms->colormapstyle = ListGetColormapStyle(tags); break; case DTA_TextLen: - parms->maxstrlen = va_arg(tags, int); + parms->maxstrlen = ListGetInt(tags); break; case DTA_CellX: - parms->cellx = va_arg(tags, int); + parms->cellx = ListGetInt(tags); break; case DTA_CellY: - parms->celly = va_arg(tags, int); + parms->celly = ListGetInt(tags); break; } - tag = va_arg(tags, DWORD); + tag = ListGetInt(tags); } va_end (tags); diff --git a/src/v_video.h b/src/v_video.h index e9bb1f6a4..a33ea22f2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -75,7 +75,6 @@ enum DTA_DestWidth, // width of area to draw to DTA_DestHeight, // height of area to draw to DTA_Alpha, // alpha value for translucency - DTA_AlphaF, // 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_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor @@ -163,7 +162,7 @@ struct DrawParms uint32 colorOverlay; INTBOOL alphaChannel; INTBOOL flipX; - fixed_t shadowAlpha; + float shadowAlpha; int shadowColor; INTBOOL keepratio; INTBOOL masked; diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index eb1c7d2fa..46be7d8c9 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -724,7 +724,7 @@ static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRang int width; screen->DrawTexture(font->GetChar(charcode, &width), x, y, nomove ? DTA_CleanNoMove : DTA_Clean, true, - DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : OPAQUE/2, + DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : 0.5, DTA_Translation, font->GetColorTranslation(translation), TAG_DONE); return x - width;