From 33bec3c99c48b9a683f7fa0bd0588b8a19fd621e Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 15 May 2023 17:26:13 +0100 Subject: [PATCH 1/3] Y_IntermissionDrawer: Draw the foreground border on widescreen resolutions Also changes the position of the Replay Save message to not get cut off --- src/y_inter.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 41e3a3ec9..f0f9488ed 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1331,14 +1331,14 @@ finalcounter: INT32 buttonx = BASEVIDWIDTH; INT32 buttony = 2; - K_drawButtonAnim(buttonx - 76, buttony, V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_b[1], replayprompttic); - V_DrawRightAlignedThinString(buttonx - 55, buttony, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "or"); - K_drawButtonAnim(buttonx - 55, buttony, V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_x[1], replayprompttic); - V_DrawRightAlignedThinString(buttonx - 2, buttony, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Save replay"); + K_drawButtonAnim(buttonx - 76, buttony, 0, kp_button_b[1], replayprompttic); + V_DrawRightAlignedThinString(buttonx - 55, buttony, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "or"); + K_drawButtonAnim(buttonx - 55, buttony, 0, kp_button_x[1], replayprompttic); + V_DrawRightAlignedThinString(buttonx - 2, buttony, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Save replay"); break; } case DSM_SAVED: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Replay saved!"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Replay saved!"); break; case DSM_TITLEENTRY: @@ -1364,6 +1364,8 @@ finalcounter: va("%d", tickDown) ); } + + M_DrawMenuForeground(); } // From 671188717979527b52a0e8753724bcbbb735ad21 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 15 May 2023 17:47:39 +0100 Subject: [PATCH 2/3] 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 --- src/y_inter.c | 70 ++++++++++++++++++++++++++++++++++++++++----------- src/y_inter.h | 1 + 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f0f9488ed..f35dc9419 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -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 diff --git a/src/y_inter.h b/src/y_inter.h index 1afe04585..7483e0ba8 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -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 From b95c537cdfb31b1a606d805f13458b835a0cd700 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 15 May 2023 17:55:43 +0100 Subject: [PATCH 3/3] Got_Mapcmd: Handle the case where netcommunicated roundqueue data with a size less than the client's would be silently ignored. --- src/d_netcmd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 6533a0bcf..a9e7afa28 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3121,7 +3121,12 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) } roundqueue.position = position; - while (roundqueue.size < size) + if (size < roundqueue.size) + { + // Bafooliganism afoot - set to zero if the size is zero! ~toast 150523 + roundqueue.size = size; + } + else while (roundqueue.size < size) { // We wipe rather than provide full data to prevent bloating the packet, // and because only this data is necessary for sync. ~toast 100423