From 274c9904e6744ac017e92ad4af3910e6c7c2e47a Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 04:12:51 +0100 Subject: [PATCH 1/5] forgor to delet this --- src/y_inter.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 7aa4c4d6f..a436b9080 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -345,10 +345,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) return; } - INT32 i, whiteplayer = MAXPLAYERS; - - if (!splitscreen) - whiteplayer = (demo.playback ? displayplayers[0] : consoleplayer); + INT32 i;; #define NUMFORNEWCOLUMN 8 INT32 y = 41, gutter = ((standings->numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2)); From 0e1f843f5078158458ebafba6f2dee20529a9e1c Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 05:52:01 +0100 Subject: [PATCH 2/5] ; --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index a436b9080..985057571 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -345,7 +345,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) return; } - INT32 i;; + INT32 i; #define NUMFORNEWCOLUMN 8 INT32 y = 41, gutter = ((standings->numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2)); From bc1f21961c10e9405e591835eb04af08b0a6b9a1 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Jan 2025 06:29:17 +0100 Subject: [PATCH 3/5] smol cleanup localskin ranking shit --- src/k_kart.c | 16 +++++----------- src/y_inter.c | 25 ++++++++++--------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f5b220a04..a2392e487 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8590,7 +8590,6 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I continue; //ignore them. const boolean whiteplayer = _isHighlightedPlayer(&players[pnum]); - const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(players[pnum].skincolor) : 0); if (netgame // don't draw it offline @@ -8606,21 +8605,16 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (players[pnum].mo->color) { - colormap = R_GetTranslationColormap(players[pnum].skin, players[pnum].mo->color, GTC_CACHE); - if (players[pnum].mo->colorized) colormap = R_GetTranslationColormap(TC_RAINBOW, players[pnum].mo->color, GTC_CACHE); else colormap = R_GetTranslationColormap(players[pnum].skin, players[pnum].mo->color, GTC_CACHE); - { - player_t *p; - p = &players[pnum]; - if (cv_highresportrait.value) - V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(p), colormap); - else - V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); - } + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(&players[pnum]), colormap); + else + V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(&players[pnum]), colormap); + /*if (G_BattleGametype() && players[pnum].kartstuff[k_bumper] > 0) -- not enough space for this { INT32 bumperx = x+19; diff --git a/src/y_inter.c b/src/y_inter.c index 985057571..86072e904 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -406,24 +406,19 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) if (standings->color[i] != SKINCOLOR_NONE) { UINT8 *colormap = R_GetTranslationColormap(*standings->character[i], *standings->color[i], GTC_CACHE); + INT32 skinnum = (players[pnum].localskin ? (players[pnum].localskin - 1) : *standings->character[i]); + patch_t *faceprefix = NULL; - // i fucking hate this i fucking hate this i hate this so much if (!players[pnum].skinlocal) - { - int skinIndex = (players[pnum].localskin ? (players[pnum].localskin - 1) : *standings->character[i]); - - if (cv_highresportrait.value) - V_DrawSmallMappedPatch(x + 16, y - 4, 0, facewantprefix[skinIndex], colormap); - else - V_DrawMappedPatch(x + 16, y - 4, 0, facerankprefix[skinIndex], colormap); - } + faceprefix = (cv_highresportrait.value ? facewantprefix[skinnum] : facerankprefix[skinnum]); else - { - if (cv_highresportrait.value) - V_DrawSmallMappedPatch(x + 16, y - 4, 0, localfacewantprefix[players[pnum].localskin - 1], colormap); - else - V_DrawMappedPatch(x + 16, y - 4, 0, localfacerankprefix[players[pnum].localskin - 1], colormap); - } + faceprefix = (cv_highresportrait.value ? localfacewantprefix[skinnum] : localfacerankprefix[skinnum]); + + + if (cv_highresportrait.value) + V_DrawSmallMappedPatch(x + 16, y - 4, 0, faceprefix, colormap); + else + V_DrawMappedPatch(x + 16, y - 4, 0, faceprefix, colormap); } if (pnum == whiteplayer) From 1e972cbb658f0227dd289e7a543d84a6dbf763b2 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 25 Jan 2025 22:44:22 +0100 Subject: [PATCH 4/5] reduce scope of those makes it look slightly neater --- src/screen.c | 18 ++++++++++-------- src/y_inter.c | 3 +-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/screen.c b/src/screen.c index 249c7225c..6b25c2ce0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -443,22 +443,20 @@ void SCR_CalculateFPS(void) void SCR_DisplayTicRate(void) { - const UINT8 *ticcntcolor = NULL; UINT32 cap = R_GetFramerateCap(); UINT32 benchmark = (cap == 0) ? I_GetRefreshRate() : cap; - INT32 x = 318; double fps = round(averageFPS); INT32 fpsflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT; - const char *fps_string; - - INT32 ticcntcolor2 = 0; - + if (gamestate == GS_NULL) return; // new kart counter if (cv_ticrate.value == 1 || cv_ticrate.value == 2) { + const UINT8 *ticcntcolor = NULL; + INT32 x = 318; + // draw "FPS" if (cv_ticrate.value == 1) V_DrawFixedPatch(306< (benchmark - 5)) ticcntcolor2 = V_GREENMAP; else if (fps < 20) @@ -502,7 +503,8 @@ void SCR_DisplayTicRate(void) fps_string = va("%d/%d\x82", (INT32)fps, cap); else fps_string = va("%d\x82", (INT32)fps); - + + // draw "FPS" if (cv_ticrate.value == 3) V_DrawRightAlignedString(319, 181, V_YELLOWMAP|fpsflags, "FPS"); @@ -518,7 +520,7 @@ void SCR_DisplayLocalPing(void) UINT32 ping = playerpingtable[consoleplayer]; // consoleplayer's ping is everyone's ping in a splitnetgame :P INT32 pingflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT; - if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level + if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level { INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain diff --git a/src/y_inter.c b/src/y_inter.c index 86072e904..77e49f206 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -314,7 +314,7 @@ static void Y_AnimatedVoteScreenCheck(void) currentAnimFrame = 0; INT32 i = 1; - while(!stopSearching) + while (!stopSearching) { boolean normalLumpExists = W_LumpExists(va("%sC%d", tmpPrefix, i)); boolean wideLumpExists = W_LumpExists(va("%sW%d", tmpPrefix, i)); @@ -414,7 +414,6 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) else faceprefix = (cv_highresportrait.value ? localfacewantprefix[skinnum] : localfacerankprefix[skinnum]); - if (cv_highresportrait.value) V_DrawSmallMappedPatch(x + 16, y - 4, 0, faceprefix, colormap); else From 16b74190e5169a5a83c1197a8f51ddc3ce2d9694 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 16 Mar 2025 11:22:15 +0100 Subject: [PATCH 5/5] put player into var in rankingsdrawer --- src/k_kart.c | 41 +++++++++++++++++++++-------------------- src/y_inter.c | 12 +++++++----- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 274a85c32..d9a4e9db1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9075,14 +9075,15 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { char strtime[MAXPLAYERNAME+1]; const UINT8 pnum = tab[i].num; + player_t *player = &players[pnum]; - if (players[pnum].spectator || !players[pnum].mo) + if (player->spectator || !player->mo) continue; //ignore them. - const boolean whiteplayer = _isHighlightedPlayer(&players[pnum]); - const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(players[pnum].skincolor) : 0); + const boolean whiteplayer = _isHighlightedPlayer(player); + const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(player->skincolor) : 0); - if ((netgame && pnum != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(&players[pnum]))) + if ((netgame && pnum != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(player))) { HU_drawPlayerPing(x + ((i < 8) ? -17 : rightoffset + 11), y-4, pnum, 0); } @@ -9094,23 +9095,23 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I else V_DrawString(x + 20, y, philicol|V_ALLOWLOWERCASE, strtime); - if (players[pnum].mo->color) + if (player->mo->color) { - if (players[pnum].mo->colorized) - colormap = R_GetTranslationColormap(TC_RAINBOW, players[pnum].mo->color, GTC_CACHE); + if (player->mo->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, player->mo->color, GTC_CACHE); else - colormap = R_GetTranslationColormap(players[pnum].skin, players[pnum].mo->color, GTC_CACHE); + colormap = R_GetTranslationColormap(player->skin, player->mo->color, GTC_CACHE); if (cv_highresportrait.value) - V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(&players[pnum]), colormap); + V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(player), colormap); else - V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(&players[pnum]), colormap); + V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(player), colormap); - /*if (G_BattleGametype() && players[pnum].kartstuff[k_bumper] > 0) -- not enough space for this + /*if (G_BattleGametype() && player->kartstuff[k_bumper] > 0) -- not enough space for this { INT32 bumperx = x+19; V_DrawMappedPatch(bumperx-2, y-4, 0, kp_tinybumper[0], colormap); - for (j = 1; j < players[pnum].kartstuff[k_bumper]; j++) + for (j = 1; j < player->kartstuff[k_bumper]; j++) { bumperx += 5; V_DrawMappedPatch(bumperx, y-4, 0, kp_tinybumper[1], colormap); @@ -9121,11 +9122,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (whiteplayer) V_DrawScaledPatch(x, y-4, 0, kp_facehighlight[(leveltime / 4) % 8]); - if (G_BattleGametype() && players[pnum].kartstuff[k_bumper] <= 0) + if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) V_DrawScaledPatch(x-4, y-7, 0, kp_ranknobumpers); else { - INT32 pos = players[pnum].kartstuff[k_position]; + INT32 pos = player->kartstuff[k_position]; if (pos < 0 || pos > MAXPLAYERS) pos = 0; // Draws the little number over the face @@ -9137,18 +9138,18 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I #define timestring(time) va("%i'%02i\"%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time)) if (scorelines > 8) { - if (players[pnum].exiting) - V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(players[pnum].realtime)); - else if (players[pnum].pflags & PF_TIMEOVER) + if (player->exiting) + V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(player->realtime)); + else if (player->pflags & PF_TIMEOVER) V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, "NO CONTEST."); else if (circuitmap) V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, va("Lap %d", tab[i].count)); } else { - if (players[pnum].exiting) - V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[pnum].realtime)); - else if (players[pnum].pflags & PF_TIMEOVER) + if (player->exiting) + V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(player->realtime)); + else if (player->pflags & PF_TIMEOVER) V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST."); else if (circuitmap) V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count)); diff --git a/src/y_inter.c b/src/y_inter.c index b8bd6f53c..14adc386f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -385,17 +385,18 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) for (i = 0; i < standings->numplayers; i++) { const UINT8 pnum = standings->num[i]; + player_t *player = &players[pnum]; if (pnum == MAXPLAYERS) ; - else if (!playeringame[pnum] || players[pnum].spectator == true) + else if (!playeringame[pnum] || player->spectator) standings->num[i] = MAXPLAYERS; // this should be the only field setting in this function else { char strtime[MAXPLAYERNAME+1]; - const boolean whiteplayer = _isHighlightedPlayer(&players[pnum]); - const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(players[pnum].skincolor) : 0); + const boolean whiteplayer = _isHighlightedPlayer(player); + const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(player->skincolor) : 0); // Apply the jitter offset (later reversed) if (standings->jitter[pnum] > 0) @@ -403,13 +404,14 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol) V_DrawCenteredString(x+6, y, 0, va("%d", standings->pos[i])); + // localskins are amazing if (standings->color[i] != SKINCOLOR_NONE) { UINT8 *colormap = R_GetTranslationColormap(*standings->character[i], *standings->color[i], GTC_CACHE); - INT32 skinnum = (players[pnum].localskin ? (players[pnum].localskin - 1) : *standings->character[i]); + INT32 skinnum = (player->localskin ? (player->localskin - 1) : *standings->character[i]); patch_t *faceprefix = NULL; - if (!players[pnum].skinlocal) + if (!player->skinlocal) faceprefix = (cv_highresportrait.value ? facewantprefix[skinnum] : facerankprefix[skinnum]); else faceprefix = (cv_highresportrait.value ? localfacewantprefix[skinnum] : localfacerankprefix[skinnum]);