From f8999bea363480e0c4495dde3f96555ef252d444 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 27 Dec 2022 16:06:10 +0000 Subject: [PATCH] Changes to tab rankings * No longer has gametype-specific highlight * Shows Grand Prix and Capsules instead of gametype name if relevant * Operates on a heirarchy for important information * Shows grand prix round on left if in GP (resolves #360) * Shows capsules remaining on right if in BTC * Attempts to draw timelimit and pointlimit on both left and right * Number of laps remaining/gamespeed is least priority for left and right sides --- src/hu_stuff.c | 113 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 84 insertions(+), 29 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 95087a389..2a75663e2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -55,6 +55,8 @@ // SRB2Kart #include "s_sound.h" // song credits #include "k_kart.h" +#include "k_battle.h" +#include "k_grandprix.h" #include "k_color.h" #include "k_hud.h" #include "r_fps.h" @@ -2391,51 +2393,67 @@ static inline void HU_DrawSpectatorTicker(void) static void HU_DrawRankings(void) { playersort_t tab[MAXPLAYERS]; - INT32 i, j, scorelines, hilicol, numplayersingame = 0; + INT32 i, j, scorelines, numplayersingame = 0, hilicol = highlightflags; boolean completed[MAXPLAYERS]; UINT32 whiteplayer = MAXPLAYERS; + boolean timedone = false, pointsdone = false; V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances. - if (modeattacking) - hilicol = V_ORANGEMAP; - else - hilicol = ((gametype == GT_RACE) ? V_SKYMAP : V_REDMAP); - // draw the current gametype in the lower right - if (modeattacking) - V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Record Attack"); + if (grandprixinfo.gp == true) + V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Grand Prix"); + else if (battlecapsules) + V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Capsules"); else if (gametype >= 0 && gametype < numgametypes) V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametypes[gametype]->name); - if ((gametyperules & (GTR_TIMELIMIT|GTR_POINTLIMIT))) + // Left hand side + if (grandprixinfo.gp == true) { - if ((gametyperules & GTR_TIMELIMIT) && timelimitintics > 0) + const char *roundstr = NULL; + V_DrawCenteredString(64, 8, 0, "ROUND"); + switch (grandprixinfo.eventmode) { - UINT32 timeval = (timelimitintics + starttime + 1 - leveltime); - if (timeval > timelimitintics+1) - timeval = timelimitintics+1; - timeval /= TICRATE; + case GPEVENT_BONUS: + roundstr = "BONUS"; + break; + case GPEVENT_SPECIAL: + roundstr = "SPECIAL"; + break; + default: + roundstr = va("%d", grandprixinfo.roundnum); + break; + } + V_DrawCenteredString(64, 16, hilicol, roundstr); + } + else if ((gametyperules & GTR_TIMELIMIT) && timelimitintics > 0) + { + UINT32 timeval = (timelimitintics + starttime + 1 - leveltime); + if (timeval > timelimitintics+1) + timeval = timelimitintics+1; + timeval /= TICRATE; - if (leveltime <= (timelimitintics + starttime)) - { - V_DrawCenteredString(64, 8, 0, "TIME LEFT"); - V_DrawCenteredString(64, 16, hilicol, va("%u", timeval)); - } - - // overtime - if (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value) - { - V_DrawCenteredString(64, 8, 0, "TIME LEFT"); - V_DrawCenteredString(64, 16, hilicol, "OVERTIME"); - } + if (leveltime <= (timelimitintics + starttime)) + { + V_DrawCenteredString(64, 8, 0, "TIME LEFT"); + V_DrawCenteredString(64, 16, hilicol, va("%u", timeval)); } - if ((gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0) + // overtime + if (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value) { - V_DrawCenteredString(256, 8, 0, "POINT LIMIT"); - V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value)); + V_DrawCenteredString(64, 8, 0, "TIME LEFT"); + V_DrawCenteredString(64, 16, hilicol, "OVERTIME"); } + + timedone = true; + } + else if ((gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0) + { + V_DrawCenteredString(64, 8, 0, "POINT LIMIT"); + V_DrawCenteredString(64, 16, hilicol, va("%d", cv_pointlimit.value)); + pointsdone = true; } else if (gametyperules & GTR_CIRCUIT) { @@ -2444,7 +2462,44 @@ static void HU_DrawRankings(void) V_DrawCenteredString(64, 8, 0, "LAP COUNT"); V_DrawCenteredString(64, 16, hilicol, va("%d", numlaps)); } + } + // Right hand side + if (battlecapsules == true) + { + if (numtargets < maptargets) + { + V_DrawCenteredString(256, 8, 0, "CAPSULES"); + V_DrawCenteredString(256, 16, hilicol, va("%d", maptargets - numtargets)); + } + } + else if (!timedone && (gametyperules & GTR_TIMELIMIT) && timelimitintics > 0) + { + UINT32 timeval = (timelimitintics + starttime + 1 - leveltime); + if (timeval > timelimitintics+1) + timeval = timelimitintics+1; + timeval /= TICRATE; + + if (leveltime <= (timelimitintics + starttime)) + { + V_DrawCenteredString(256, 8, 0, "TIME LEFT"); + V_DrawCenteredString(256, 16, hilicol, va("%u", timeval)); + } + + // overtime + if (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value) + { + V_DrawCenteredString(256, 8, 0, "TIME LEFT"); + V_DrawCenteredString(256, 16, hilicol, "OVERTIME"); + } + } + else if (!pointsdone && (gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0) + { + V_DrawCenteredString(256, 8, 0, "POINT LIMIT"); + V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value)); + } + else if (gametyperules & GTR_CIRCUIT) + { V_DrawCenteredString(256, 8, 0, "GAME SPEED"); V_DrawCenteredString(256, 16, hilicol, kartspeed_cons_t[1+gamespeed].strvalue); }