Y_IntermissionDrawer: Improved header string handling

- Center generalised text without the "got through round" backing
- For spectators observing a Round Queue, show "ROUND (n)" at the top instead of the more generalised fallback strings
This commit is contained in:
toaster 2023-05-15 17:47:39 +01:00
parent 33bec3c99c
commit 6711887179
2 changed files with 56 additions and 15 deletions

View file

@ -211,6 +211,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
memset(data.character, 0, sizeof (data.character));
memset(completed, 0, sizeof (completed));
data.numplayers = 0;
data.roundnum = 0;
for (j = 0; j < numplayersingame; j++)
{
@ -351,6 +352,15 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
"%s",
skins[players[i].skin].realname);
}
if (roundqueue.size > 0
&& roundqueue.roundnum > 0
&& (grandprixinfo.gp == false
|| grandprixinfo.eventmode == GPEVENT_NONE)
)
{
data.roundnum = roundqueue.roundnum;
}
}
else
{
@ -361,7 +371,19 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
}
else
{
if (bossinfo.valid == true && bossinfo.enemyname)
if (roundqueue.size > 0
&& roundqueue.roundnum > 0
&& (grandprixinfo.gp == false
|| grandprixinfo.eventmode == GPEVENT_NONE)
)
{
snprintf(data.headerstring,
sizeof data.headerstring,
"ROUND");
data.roundnum = roundqueue.roundnum;
}
else if (bossinfo.valid == true && bossinfo.enemyname)
{
snprintf(data.headerstring,
sizeof data.headerstring,
@ -1274,30 +1296,48 @@ void Y_IntermissionDrawer(void)
patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH);
V_DrawMappedPatch(20 + x, 24, 0, rtpbr, NULL);
INT32 headerx, headery, headerwidth = 0;
if (data.gotthrough)
{
// GOT THROUGH ROUND
patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH);
V_DrawMappedPatch(50 + x, 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 + x, 39, 0, roundpatch, NULL);
}
// Draw the player's name
V_DrawTitleCardString(51 + x, 7, data.headerstring, V_6WIDTHSPACE, false, 0, 0);
headerx = 51;
headery = 7;
}
else
{
V_DrawTitleCardString(51 + x, 17, data.headerstring, V_6WIDTHSPACE, false, 0, 0);
headerwidth = V_TitleCardStringWidth(data.headerstring);
headerx = (BASEVIDWIDTH - headerwidth)/2;
headery = 17;
}
// Draw round numbers
if (data.roundnum > 0 && data.roundnum <= 10)
{
patch_t *roundpatch =
W_CachePatchName(
va("TT_RND%d", data.roundnum),
PU_PATCH
);
INT32 roundx = 240;
if (headerwidth != 0)
{
const INT32 roundoffset = 8 + SHORT(roundpatch->width);
roundx = headerx + roundoffset;
headerx -= roundoffset/2;
}
V_DrawMappedPatch(x + roundx, 39, 0, roundpatch, NULL);
}
V_DrawTitleCardString(x + headerx, headery, data.headerstring, 0, false, 0, 0);
}
// Returns early if there's no players to draw

View file

@ -22,6 +22,7 @@ typedef struct
boolean gotthrough; // show "got through"
boolean showrank; // show rank-restricted queue entry at the end, if it exists
boolean encore; // encore mode
UINT8 roundnum; // round number
char headerstring[64]; // holds levelnames up to 64 characters