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
This commit is contained in:
toaster 2022-12-27 16:06:10 +00:00
parent 1ac0c44f77
commit f8999bea36

View file

@ -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);
}