From a50a67b2735a9616179d65f96714a88ca620e0ac Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 28 Jun 2018 19:07:04 +0100 Subject: [PATCH] * Modified, maybe-improved title. May need to be selectively reverted, but... * To go with this, have the HUD fade in as the title goes away. * After complaints, only do dogear gametype indicators on the voting screen for levels which don't match the prevailing gametype, and use thin font to intrude on the level pic less. * Make the voting screen background a different graphic in battle. * Improve behaviour of DrawDiag in GL. --- src/hardware/hw_draw.c | 28 ++++++++++-------- src/k_kart.c | 25 +++++++++++++--- src/st_stuff.c | 65 +++++++++++++++++++++++------------------- src/v_video.c | 7 +++-- src/v_video.h | 2 ++ src/y_inter.c | 49 +++++++++++++++++-------------- 6 files changed, 105 insertions(+), 71 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index dc064b95..6d4d70d0 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -292,9 +292,9 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, { FSurfaceInfo Surf; Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; - if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; + if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[hudtrans]; + else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[hudtrans]; + else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[hudtrans]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); @@ -446,9 +446,9 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal { FSurfaceInfo Surf; Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; - if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; + if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[hudtrans]; + else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[hudtrans]; + else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[hudtrans]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); @@ -911,7 +911,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) { FOutVector v[4]; FSurfaceInfo Surf; - float fx, fy, fw, fh; + float fx, fy, fw, fh, fwait = 0; if (wh < 0) return; // consistency w/ software @@ -966,8 +966,11 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) if (fw <= 0 || fh <= 0) return; - /*if (fx + fw > vid.width) -- oh gee oh boy oh shit - fw = (float)vid.width - fx;*/ + if (fx + fw > vid.width) + { + fwait = fw - ((float)vid.width - fx); + fw = (float)vid.width - fx; + } if (fy + fh > vid.height) fh = (float)vid.height - fy; @@ -976,10 +979,11 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) fw = fw / (vid.width / 2); fh = fh / (vid.height / 2); - v[0].x = v[2].x = v[3].x = fx; - v[1].x = fx + fw; + v[0].x = v[3].x = fx; + v[2].x = v[1].x = fx + fw; v[0].y = v[1].y = fy; - v[2].y = v[3].y = fy - fh; + v[3].y = fy - fh; + v[2].y = fy - fwait; //Hurdler: do we still use this argb color? if not, we should remove it v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //; diff --git a/src/k_kart.c b/src/k_kart.c index 85f552d4..28b7dad4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4091,6 +4091,13 @@ static void K_initKartHUD(void) } } } + + if (timeinmap > 113) + hudtrans = cv_translucenthud.value; + else if (timeinmap > 105) + hudtrans = ((((INT32)timeinmap) - 105)*cv_translucenthud.value)/(113-105); + else + hudtrans = 0; } INT32 K_calcSplitFlags(INT32 snapflags) @@ -4845,8 +4852,7 @@ static void K_drawKartMinimap(void) patch_t *AutomapPic; INT32 i = 0; INT32 x, y; - const INT32 minimaptrans = ((10-cv_kartminimap.value)<width/2); y = MINI_Y - (AutomapPic->height/2); - if (splitscreen) - splitflags = 0; + if (timeinmap > 105) + { + minimaptrans = (splitscreen ? 10 : cv_kartminimap.value); + if (timeinmap <= 113) + minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105); + if (!minimaptrans) + return; + } + else + return; + + minimaptrans = ((10-minimaptrans)<width), y, splitflags|V_FLIP, AutomapPic); diff --git a/src/st_stuff.c b/src/st_stuff.c index a19bada6..2b3c770a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -755,23 +755,27 @@ static void ST_drawLevelTitle(void) char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart char *actnum = mapheaderinfo[gamemap-1]->actnum; INT32 lvlttlxpos; - INT32 subttlxpos = BASEVIDWIDTH/2; INT32 ttlnumxpos; INT32 zonexpos; + INT32 dupcalc = (vid.width/vid.dupx); + UINT8 gtc = G_GetGametypeColor(gametype); + INT32 sub = 0; + INT32 lvlttly = 145; + INT32 zoney = 169; + INT32 lvlw; - INT32 lvlttly; - INT32 zoney; - - if (!(timeinmap > 2 && timeinmap-3 < 110)) + if (timeinmap > 113) return; - if (strlen(actnum) > 0) - lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)) - V_LevelNameWidth(actnum); - else - lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)); + lvlw = V_LevelNameWidth(lvlttl); - ttlnumxpos = lvlttlxpos + V_LevelNameWidth(lvlttl); - if (strlen(zonttl) > 0) + if (strlen(actnum) > 0) + lvlttlxpos = ((BASEVIDWIDTH/2) - (lvlw/2)) - V_LevelNameWidth(actnum); + else + lvlttlxpos = ((BASEVIDWIDTH/2) - (lvlw/2)); + + ttlnumxpos = lvlttlxpos + lvlw; + if (zonttl[0]) zonexpos = ttlnumxpos - V_LevelNameWidth(zonttl); // SRB2kart else zonexpos = ttlnumxpos - V_LevelNameWidth(M_GetText("ZONE")); @@ -779,25 +783,29 @@ static void ST_drawLevelTitle(void) if (lvlttlxpos < 0) lvlttlxpos = 0; - // There's no consistent algorithm that can accurately define the old positions - // so I just ended up resorting to a single switct statement to define them - switch (timeinmap-3) + if (timeinmap > 105) { - case 0: zoney = 200; lvlttly = 0; break; - case 1: zoney = 188; lvlttly = 12; break; - case 2: zoney = 176; lvlttly = 24; break; - case 3: zoney = 164; lvlttly = 36; break; - case 4: zoney = 152; lvlttly = 48; break; - case 5: zoney = 140; lvlttly = 60; break; - case 6: zoney = 128; lvlttly = 72; break; - case 105: zoney = 80; lvlttly = 104; break; - case 106: zoney = 56; lvlttly = 128; break; - case 107: zoney = 32; lvlttly = 152; break; - case 108: zoney = 8; lvlttly = 176; break; - case 109: zoney = 0; lvlttly = 200; break; - default: zoney = 104; lvlttly = 80; break; + INT32 count = (113 - (INT32)(timeinmap)); + sub = dupcalc; + while (count-- > 0) + sub >>= 1; + sub = -sub; } + { + dupcalc = (dupcalc - BASEVIDWIDTH)>>1; + INT32 h = lvlttly + V_LevelNameHeight(lvlttl) + 2; + V_DrawFill(sub - dupcalc, h+9, lvlttlxpos + lvlw + 1 - dupcalc, 2, 31); + V_DrawDiag(sub + lvlttlxpos + lvlw + 1, h, 11, 31); + V_DrawFill(sub - dupcalc, h, lvlttlxpos + lvlw - dupcalc, 10, gtc); + V_DrawDiag(sub + lvlttlxpos + lvlw, h, 10, gtc); + V_DrawString(sub + lvlttlxpos, h+1, V_ALLOWLOWERCASE, subttl); + } + + ttlnumxpos += sub; + lvlttlxpos += sub; + zonexpos += sub; + if (strlen(actnum) > 0) V_DrawLevelTitle(ttlnumxpos+12, zoney, 0, actnum); @@ -807,9 +815,6 @@ static void ST_drawLevelTitle(void) V_DrawLevelTitle(zonexpos, zoney, 0, zonttl); else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) V_DrawLevelTitle(zonexpos, zoney, 0, M_GetText("ZONE")); - - if (lvlttly+48 < 200) - V_DrawCenteredString(subttlxpos, lvlttly+48, V_ALLOWLOWERCASE, subttl); } /* diff --git a/src/v_video.c b/src/v_video.c index e1cf2164..c1ca4ea7 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -305,6 +305,7 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3 //static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0}; static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5}; +UINT8 hudtrans = 0; static const UINT8 *v_colormap = NULL; static const UINT8 *v_translevel = NULL; @@ -359,11 +360,11 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) { if (alphalevel == 13) - alphalevel = hudminusalpha[cv_translucenthud.value]; + alphalevel = hudminusalpha[hudtrans]; else if (alphalevel == 14) - alphalevel = 10 - cv_translucenthud.value; + alphalevel = 10 - hudtrans; /*else if (alphalevel == 15) - alphalevel = hudplusalpha[cv_translucenthud.value];*/ + alphalevel = hudplusalpha[hudtrans];*/ if (alphalevel >= 10) return; // invis diff --git a/src/v_video.h b/src/v_video.h index 02e8bbca..2c28fd8a 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -43,6 +43,8 @@ const char *GetPalette(void); extern RGBA_t *pLocalPalette; +extern UINT8 hudtrans; + // Retrieve the ARGB value from a palette color index #define V_GetColor(color) (pLocalPalette[color&0xFF]) diff --git a/src/y_inter.c b/src/y_inter.c index d2359d3b..33d62157 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2187,7 +2187,7 @@ void Y_VoteDrawer(void) { char str[40]; patch_t *pic; - UINT8 sizeadd = selected[i], j, color, gtc = levelinfo[i].gtc; + UINT8 sizeadd = selected[i], j, color; if (i == 3) { @@ -2262,17 +2262,14 @@ void Y_VoteDrawer(void) V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, pic); V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 40+y, V_SNAPTORIGHT, str); + if (levelinfo[i].gts) { - INT32 w = 0; - if (levelinfo[i].gts) - { - w = V_StringWidth(levelinfo[i].gts, V_SNAPTORIGHT)+2; - V_DrawFill(BASEVIDWIDTH-100, y+9, w+1, 2, V_SNAPTORIGHT|31); - V_DrawFill(BASEVIDWIDTH-100, y, w, 10, V_SNAPTORIGHT|gtc); - V_DrawString(BASEVIDWIDTH-99, y+1, V_SNAPTORIGHT, levelinfo[i].gts); - } - V_DrawDiag(BASEVIDWIDTH-100+w+1, y, 11, V_SNAPTORIGHT|31); - V_DrawDiag(BASEVIDWIDTH-100+w, y, 10, V_SNAPTORIGHT|gtc); + INT32 w = V_ThinStringWidth(levelinfo[i].gts, V_SNAPTORIGHT)+1; + V_DrawFill(BASEVIDWIDTH-100, y+10, w+1, 2, V_SNAPTORIGHT|31); + V_DrawFill(BASEVIDWIDTH-100, y, w, 11, V_SNAPTORIGHT|levelinfo[i].gtc); + V_DrawDiag(BASEVIDWIDTH-100+w+1, y, 12, V_SNAPTORIGHT|31); + V_DrawDiag(BASEVIDWIDTH-100+w, y, 11, V_SNAPTORIGHT|levelinfo[i].gtc); + V_DrawThinString(BASEVIDWIDTH-99, y+1, V_SNAPTORIGHT, levelinfo[i].gts); } y += 50; @@ -2280,8 +2277,11 @@ void Y_VoteDrawer(void) else { V_DrawTinyScaledPatch(BASEVIDWIDTH-60, y, V_SNAPTORIGHT, pic); - V_DrawDiag(BASEVIDWIDTH-60, y, 8, V_SNAPTORIGHT|31); - V_DrawDiag(BASEVIDWIDTH-60, y, 6, V_SNAPTORIGHT|gtc); + if (levelinfo[i].gts) + { + V_DrawDiag(BASEVIDWIDTH-60, y, 8, V_SNAPTORIGHT|31); + V_DrawDiag(BASEVIDWIDTH-60, y, 6, V_SNAPTORIGHT|levelinfo[i].gtc); + } y += 25; } @@ -2299,7 +2299,6 @@ void Y_VoteDrawer(void) if ((playeringame[i] && !players[i].spectator) && votes[i] != -1) { patch_t *pic; - UINT8 gtc = levelinfo[votes[i]].gtc; if (votes[i] == 3 && (i != pickedvote || voteendtic == -1)) pic = randomlvl; @@ -2316,8 +2315,11 @@ void Y_VoteDrawer(void) } V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, pic); - V_DrawDiag(x, y, 8, V_SNAPTOLEFT|31); - V_DrawDiag(x, y, 6, V_SNAPTOLEFT|gtc); + if (levelinfo[votes[i]].gts) + { + V_DrawDiag(x, y, 8, V_SNAPTOLEFT|31); + V_DrawDiag(x, y, 6, V_SNAPTOLEFT|levelinfo[votes[i]].gtc); + } if (players[i].skincolor == 0) V_DrawSmallScaledPatch(x+24, y+9, V_SNAPTOLEFT, faceprefix[players[i].skin]); @@ -2552,8 +2554,8 @@ void Y_StartVote(void) I_Error("voteendtic is dirty"); #endif - widebgpatch = W_CachePatchName("INTERSCW", PU_STATIC); - bgpatch = W_CachePatchName("INTERSCR", PU_STATIC); + widebgpatch = W_CachePatchName(((gametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_STATIC); + bgpatch = W_CachePatchName(((gametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_STATIC); cursor = W_CachePatchName("M_CURSOR", PU_STATIC); cursor1 = W_CachePatchName("P1CURSOR", PU_STATIC); cursor2 = W_CachePatchName("P2CURSOR", PU_STATIC); @@ -2615,12 +2617,15 @@ void Y_StartVote(void) levelinfo[i].str[sizeof levelinfo[i].str - 1] = '\0'; // set up the gtc and gts - levelinfo[i].gtc = G_GetGametypeColor(votelevels[i][1]); levelinfo[i].gts = NULL; - for (j = 0; gametype_cons_t[j].strvalue; j++) + if (i == 2 && votelevels[i][1] != votelevels[0][1]) { - if (gametype_cons_t[j].value == votelevels[i][1]) - levelinfo[i].gts = gametype_cons_t[j].strvalue; + levelinfo[i].gtc = G_GetGametypeColor(votelevels[i][1]); + for (j = 0; gametype_cons_t[j].strvalue; j++) + { + if (gametype_cons_t[j].value == votelevels[i][1]) + levelinfo[i].gts = gametype_cons_t[j].strvalue; + } } // set up the pic