Improve header text handling

- Text on the header
    - If they won, show [skin realname] GOT THROUGH ROUND
        - This branch was showing this previously but inexplicably only had the skin realname when in GP
    - If they retired, show NO CONTEST...
    - Else, show spectator non-participation text
        - if GT_VERSUS, show Boss name
        - if battleprisons, "PRISON BREAK"
        - else, "[gametype name] STAGE"
            - Matches S1/S2 "SPECIAL STAGE" non-completion text
- Scrolls with the page
    - Second page text always reads "TOTAL RANKINGS"
This commit is contained in:
toaster 2023-05-07 14:11:25 +01:00
parent 4ffb5f2e10
commit 208f7d3b81

View file

@ -69,7 +69,7 @@ typedef struct
UINT8 numplayers; // Number of players being displayed UINT8 numplayers; // Number of players being displayed
char levelstring[64]; // holds levelnames up to 64 characters char headerstring[64]; // holds levelnames up to 64 characters
// SRB2kart // SRB2kart
INT16 increase[MAXPLAYERS]; // how much did the score increase by? INT16 increase[MAXPLAYERS]; // how much did the score increase by?
@ -79,6 +79,7 @@ typedef struct
UINT8 pos[MAXPLAYERS]; // player positions. used for ties UINT8 pos[MAXPLAYERS]; // player positions. used for ties
boolean rankingsmode; // rankings mode boolean rankingsmode; // rankings mode
boolean gotthrough; // show "got through"
boolean encore; // encore mode boolean encore; // encore mode
} y_data; } y_data;
@ -164,48 +165,65 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
; ;
else if ((data.rankingsmode = (boolean)rankingsmode)) else if ((data.rankingsmode = (boolean)rankingsmode))
{ {
sprintf(data.levelstring, "* Total Rankings *"); sprintf(data.headerstring, "Total Rankings");
data.encore = false; data.gotthrough = false;
} }
else else
{ {
// set up the levelstring UINT8 whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (bossinfo.valid == true && bossinfo.enemyname)
data.headerstring[0] = '\0';
data.gotthrough = false;
if (whiteplayer < MAXPLAYERS
&& playeringame[whiteplayer]
&& players[whiteplayer].spectator == false
)
{ {
snprintf(data.levelstring, if (!(players[whiteplayer].pflags & PF_NOCONTEST))
sizeof data.levelstring, {
"* %s *", data.gotthrough = true;
bossinfo.enemyname);
} if (players[whiteplayer].skin < numskins)
else if (mapheaderinfo[prevmap]->levelflags & LF_NOZONE) {
{ snprintf(data.headerstring,
if (mapheaderinfo[prevmap]->actnum > 0) sizeof data.headerstring,
snprintf(data.levelstring, "%s",
sizeof data.levelstring, skins[players[whiteplayer].skin].realname);
"* %s %d *", }
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum); }
else else
snprintf(data.levelstring, {
sizeof data.levelstring, snprintf(data.headerstring,
"* %s *", sizeof data.headerstring,
mapheaderinfo[prevmap]->lvlttl); "NO CONTEST...");
}
} }
else else
{ {
const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "ZONE"); if (bossinfo.valid == true && bossinfo.enemyname)
if (mapheaderinfo[prevmap]->actnum > 0) {
snprintf(data.levelstring, snprintf(data.headerstring,
sizeof data.levelstring, sizeof data.headerstring,
"* %s %s %d *", "%s",
mapheaderinfo[prevmap]->lvlttl, zonttl, mapheaderinfo[prevmap]->actnum); bossinfo.enemyname);
}
else if (battleprisons == true)
{
snprintf(data.headerstring,
sizeof data.headerstring,
"PRISON BREAK");
}
else else
snprintf(data.levelstring, {
sizeof data.levelstring, snprintf(data.headerstring,
"* %s %s *", sizeof data.headerstring,
mapheaderinfo[prevmap]->lvlttl, zonttl); "%s STAGE",
gametypes[gametype]->name);
}
} }
data.levelstring[sizeof data.levelstring - 1] = '\0'; data.headerstring[sizeof data.headerstring - 1] = '\0';
data.encore = encoremode; data.encore = encoremode;
@ -676,20 +694,32 @@ skiptallydrawer:
} }
// Draw the header bar // Draw the header bar
V_DrawMappedPatch(20, 24, 0, rtpbr, NULL);
// Draw "GOT THROUGH ROUND"
V_DrawMappedPatch(50, 42, 0, gthro, NULL);
// Draw round numbers
if (roundqueue.roundnum > 0)
{ {
patch_t *roundpatch = V_DrawMappedPatch(20 + xoffset, 24, 0, rtpbr, NULL);
W_CachePatchName(
va("TT_RND%d", roundqueue.roundnum), if (data.gotthrough)
PU_PATCH {
); // Draw "GOT THROUGH ROUND"
V_DrawMappedPatch(240, 39, 0, roundpatch, NULL); V_DrawMappedPatch(50 + xoffset, 42, 0, gthro, NULL);
// Draw round numbers
if (roundqueue.roundnum > 0 && !(grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE))
{
patch_t *roundpatch =
W_CachePatchName(
va("TT_RND%d", roundqueue.roundnum),
PU_PATCH
);
V_DrawMappedPatch(240 + xoffset, 39, 0, roundpatch, NULL);
}
// Draw the player's name
V_DrawTitleCardString(51 + xoffset, 7, data.headerstring, V_6WIDTHSPACE, false, 0, 0);
}
else
{
V_DrawTitleCardString(51 + xoffset, 17, data.headerstring, V_6WIDTHSPACE, false, 0, 0);
}
} }
{ {
@ -1004,9 +1034,6 @@ skiptallydrawer:
// Draw the player's rank icon // Draw the player's rank icon
V_DrawMappedPatch(rankx + 1, ranky + 1, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); V_DrawMappedPatch(rankx + 1, ranky + 1, 0, faceprefix[*data.character[i]][FACE_RANK], colormap);
// Draw the player's name
V_DrawTitleCardString(51, 7, skins[*data.character[i]].realname, V_6WIDTHSPACE, false, 0, 0);
} }
} }
} }