From 1e2c3b86572889109bd112c48473273a893f5db2 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 12 Feb 2023 23:54:31 -0600 Subject: [PATCH 01/57] Dummy out old intermission code, draw level icon as background --- src/y_inter.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/y_inter.c b/src/y_inter.c index c69e21ad6..b08d98e93 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -290,6 +290,9 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) // void Y_IntermissionDrawer(void) { + +// dummy ALL OF THIS SHIT out, we're gonnas be starting over. +#if 0 INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = highlightflags; // If we early return, skip drawing the 3D scene (software buffer) so it doesn't clobber the frame for the wipe @@ -584,6 +587,13 @@ skiptallydrawer: } M_DrawMenuForeground(); +#endif + UINT8 *color = NULL; + + if (intertype == int_none || rendermode == render_none) + return; + + K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Mon, 20 Feb 2023 23:32:05 -0600 Subject: [PATCH 02/57] New intermission base Very incomplete. Currently draws the background and most of the necessary patches. Ignore some of the stupid shit I did here, it'll be cleaned up later. --- src/y_inter.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index b08d98e93..c414a776c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -47,6 +47,7 @@ #include "k_boss.h" #include "k_pwrlv.h" #include "k_grandprix.h" +#include "k_color.h" #ifdef HWRENDER #include "hardware/hw_main.h" @@ -291,7 +292,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) void Y_IntermissionDrawer(void) { -// dummy ALL OF THIS SHIT out, we're gonnas be starting over. +// dummy ALL OF THIS SHIT out, we're gonna be starting over. #if 0 INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = highlightflags; @@ -588,12 +589,106 @@ skiptallydrawer: M_DrawMenuForeground(); #endif - UINT8 *color = NULL; + + // Patches + patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); + patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); + patch_t *rmbg1 = W_CachePatchName("R_RMBG1", PU_PATCH); + patch_t *rmbg2 = W_CachePatchName("R_RMBG2", PU_PATCH); + patch_t *rmbg3 = W_CachePatchName("R_RMBG3", PU_PATCH); + patch_t *rmbg4 = W_CachePatchName("R_RMBG4", PU_PATCH); + patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); + patch_t *rrmrk1 = W_CachePatchName("R_RRMRK1", PU_PATCH); + patch_t *rrmrk2 = W_CachePatchName("R_RRMRK2", PU_PATCH); + patch_t *rrmrk3 = W_CachePatchName("R_RRMRK3", PU_PATCH); + patch_t *rrmrk4 = W_CachePatchName("R_RRMRK4", PU_PATCH); + patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); + patch_t *rrmln2 = W_CachePatchName("R_RRMLN2", PU_PATCH); + patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); + patch_t *rrmls2 = W_CachePatchName("R_RRMLS2", PU_PATCH); + patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); + + UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me + UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); + + K_RainbowColormap(color, SKINCOLOR_YELLOW); if (intertype == int_none || rendermode == render_none) return; + if (renderisnewtic) + { + LUA_HUD_ClearDrawList(luahuddrawlist_intermission); + LUA_HookHUD(luahuddrawlist_intermission, HUD_HOOK(intermission)); + } + LUA_HUD_DrawList(luahuddrawlist_intermission); + + //if (!LUA_HudEnabled(hud_intermissiontally)) + //goto skiptallydrawer; + + // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Thu, 23 Feb 2023 22:16:22 -0600 Subject: [PATCH 03/57] lines --- src/y_inter.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index c414a776c..9fae679a8 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -604,8 +604,10 @@ skiptallydrawer: patch_t *rrmrk4 = W_CachePatchName("R_RRMRK4", PU_PATCH); patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); patch_t *rrmln2 = W_CachePatchName("R_RRMLN2", PU_PATCH); + patch_t *rrmln5 = W_CachePatchName("R_RRMLN5", PU_PATCH); patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); patch_t *rrmls2 = W_CachePatchName("R_RRMLS2", PU_PATCH); + patch_t *rrmls3 = W_CachePatchName("R_RRMLS3", PU_PATCH); patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me @@ -670,10 +672,28 @@ skiptallydrawer: // Draw the lines // Draw the shadows first, so they don't draw over the lines - //V_DrawFixedPatch(26< Date: Thu, 23 Feb 2023 22:25:02 -0600 Subject: [PATCH 04/57] V_DrawFixedPatch -> V_DrawMappedPatch --- src/y_inter.c | 94 +++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 9fae679a8..242eda079 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -632,83 +632,83 @@ skiptallydrawer: K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Thu, 23 Feb 2023 23:20:53 -0600 Subject: [PATCH 05/57] Draw marquee, checker, and player icon --- src/y_inter.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 242eda079..979fd4aa4 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -591,25 +591,43 @@ skiptallydrawer: #endif // Patches - patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); - patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); + + + patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); // GOT THROUGH ROUND + patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players + + // Background pieces patch_t *rmbg1 = W_CachePatchName("R_RMBG1", PU_PATCH); patch_t *rmbg2 = W_CachePatchName("R_RMBG2", PU_PATCH); patch_t *rmbg3 = W_CachePatchName("R_RMBG3", PU_PATCH); patch_t *rmbg4 = W_CachePatchName("R_RMBG4", PU_PATCH); + + // Progress markers patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); patch_t *rrmrk1 = W_CachePatchName("R_RRMRK1", PU_PATCH); patch_t *rrmrk2 = W_CachePatchName("R_RRMRK2", PU_PATCH); patch_t *rrmrk3 = W_CachePatchName("R_RRMRK3", PU_PATCH); patch_t *rrmrk4 = W_CachePatchName("R_RRMRK4", PU_PATCH); + + // Progression lines patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); patch_t *rrmln2 = W_CachePatchName("R_RRMLN2", PU_PATCH); patch_t *rrmln5 = W_CachePatchName("R_RRMLN5", PU_PATCH); + + // Shadows for progression lines patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); patch_t *rrmls2 = W_CachePatchName("R_RRMLS2", PU_PATCH); patch_t *rrmls3 = W_CachePatchName("R_RRMLS3", PU_PATCH); + + // Header bar patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); + // Checker scroll + patch_t *rbgchk = W_CachePatchName("R_RBGCHK", PU_PATCH); + + // Scrolling marquee + patch_t *rrmq = W_CachePatchName("R_RRMQ", PU_PATCH); + UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); @@ -631,6 +649,12 @@ skiptallydrawer: // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Thu, 23 Feb 2023 23:29:48 -0600 Subject: [PATCH 06/57] V_MODULATE -> V_SUBTRACT --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 979fd4aa4..27fac5516 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -650,10 +650,10 @@ skiptallydrawer: K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Sat, 25 Mar 2023 09:54:28 -0500 Subject: [PATCH 07/57] intermission skincolor + demolition of sanity --- src/deh_tables.c | 2 ++ src/doomdef.h | 2 ++ src/info.c | 4 +++- src/y_inter.c | 9 ++++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 7c96b5571..10a58d6eb 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6110,6 +6110,8 @@ const char *COLOR_ENUMS[] = { "POSNUM_BEST4", "POSNUM_BEST5", "POSNUM_BEST6", + + "INTERMISSION", }; const char *const KARTHUD_LIST[] = { diff --git a/src/doomdef.h b/src/doomdef.h index 890ace89a..0e09a6aa6 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -425,6 +425,8 @@ typedef enum SKINCOLOR_POSNUM_BEST4, SKINCOLOR_POSNUM_BEST5, SKINCOLOR_POSNUM_BEST6, + + SKINCOLOR_INTERMISSION, SKINCOLOR_FIRSTFREESLOT, SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1, diff --git a/src/info.c b/src/info.c index 572792499..3bfe157e3 100644 --- a/src/info.c +++ b/src/info.c @@ -29732,7 +29732,9 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Position Best 3", {112, 112, 113, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 110, 111, 30}, SKINCOLOR_NONE, 0, 0, false}, // SKINCOLOR_POSNUM_BEST3 {"Position Best 4", {255, 255, 122, 122, 123, 123, 141, 141, 142, 142, 143, 143, 138, 139, 254, 30}, SKINCOLOR_NONE, 0, 0, false}, // SKINCOLOR_POSNUM_BEST4 {"Position Best 5", {152, 152, 153, 153, 154, 154, 155, 155, 156, 156, 157, 158, 159, 253, 254, 30}, SKINCOLOR_NONE, 0, 0, false}, // SKINCOLOR_POSNUM_BEST5 - {"Position Best 6", {181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 187, 187, 29, 30}, SKINCOLOR_NONE, 0, 0, false} // SKINCOLOR_POSNUM_BEST6 + {"Position Best 6", {181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 187, 187, 29, 30}, SKINCOLOR_NONE, 0, 0, false}, // SKINCOLOR_POSNUM_BEST6 + + {"Intermission", {0,80,80,81,81,81,84,85,86,87,246,248,251,26,28,31}, SKINCOLOR_NONE, 0, 0, false} // SKINCOLOR_INTERMISSION }; /** Patches the mobjinfo, state, and skincolor tables. diff --git a/src/y_inter.c b/src/y_inter.c index 27fac5516..c78709902 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -628,10 +628,13 @@ skiptallydrawer: // Scrolling marquee patch_t *rrmq = W_CachePatchName("R_RRMQ", PU_PATCH); + // fuck me dude holy shit + patch_t *white = W_CachePatchName("R_WHIT", PU_PATCH); + UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); - K_RainbowColormap(color, SKINCOLOR_YELLOW); + K_RainbowColormap(color, SKINCOLOR_INTERMISSION); if (intertype == int_none || rendermode == render_none) return; @@ -649,6 +652,10 @@ skiptallydrawer: // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< Date: Sat, 25 Mar 2023 10:39:35 -0500 Subject: [PATCH 08/57] Use a more descriptive var name --- src/y_inter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index c78709902..1bea0f66c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -628,8 +628,8 @@ skiptallydrawer: // Scrolling marquee patch_t *rrmq = W_CachePatchName("R_RRMQ", PU_PATCH); - // fuck me dude holy shit - patch_t *white = W_CachePatchName("R_WHIT", PU_PATCH); + // Blending mask for the background + patch_t *mask = W_CachePatchName("R_MASK", PU_PATCH); UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); @@ -654,7 +654,7 @@ skiptallydrawer: // Drawfill over the BG to get the correct colorization //V_DrawFill(0, 0, BASEVIDWIDTH< Date: Tue, 28 Mar 2023 23:56:54 -0500 Subject: [PATCH 09/57] WIP: Marquee & Checker scrolling Bad numbers. Scroll is happening, just not the way we want it to. --- src/y_inter.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 1bea0f66c..a3921608c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -98,6 +98,10 @@ static INT32 endtic = -1; static INT32 sorttic = -1; static INT32 replayprompttic; +// FUCK YOU +static fixed_t mqscroll = 0; +static fixed_t chkscroll = 0; + intertype_t intertype = int_none; static huddrawlist_h luahuddrawlist_intermission; @@ -631,6 +635,9 @@ skiptallydrawer: // Blending mask for the background patch_t *mask = W_CachePatchName("R_MASK", PU_PATCH); + fixed_t mqloop = SHORT(rrmq->height)*FRACUNIT; + fixed_t chkloop = SHORT(rbgchk->width)*FRACUNIT; + UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); @@ -652,15 +659,30 @@ skiptallydrawer: // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< mqloop) + mqscroll -= mqloop; + + V_DrawFixedPatch(-chkscroll, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); + V_DrawFixedPatch(-chkscroll + chkloop, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); + + chkscroll += (6*renderdeltatics); + + while (chkscroll > chkloop) + chkscroll -= chkloop; // Draw the header bar V_DrawMappedPatch(20, 24, 0, rtpbr, 0); From aa94bdb7cc9624ba661c4c01177815254a35aa2b Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 29 Mar 2023 20:48:41 -0500 Subject: [PATCH 10/57] Fix scroll directions --- src/y_inter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index a3921608c..f6f7664d9 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -635,7 +635,7 @@ skiptallydrawer: // Blending mask for the background patch_t *mask = W_CachePatchName("R_MASK", PU_PATCH); - fixed_t mqloop = SHORT(rrmq->height)*FRACUNIT; + fixed_t mqloop = SHORT(rrmq->width)*FRACUNIT; fixed_t chkloop = SHORT(rbgchk->width)*FRACUNIT; UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me @@ -671,15 +671,15 @@ skiptallydrawer: V_DrawFixedPatch(-mqscroll, 154< mqloop) mqscroll -= mqloop; - V_DrawFixedPatch(-chkscroll, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); - V_DrawFixedPatch(-chkscroll + chkloop, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); + V_DrawFixedPatch(chkscroll, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); + V_DrawFixedPatch(chkscroll - chkloop, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); - chkscroll += (6*renderdeltatics); + chkscroll += (1*renderdeltatics); while (chkscroll > chkloop) chkscroll -= chkloop; From 582b76f1680f083666ba630cd7d680184948f58e Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 29 Mar 2023 19:19:15 -0700 Subject: [PATCH 11/57] Intermission: fix marquee scroll --- src/y_inter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f6f7664d9..bd755fccd 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -668,8 +668,14 @@ skiptallydrawer: // Draw the checker pattern (scroll pending) //V_DrawMappedPatch(0, 0, V_SUBTRACT, rbgchk, 0); - V_DrawFixedPatch(-mqscroll, 154< Date: Tue, 4 Apr 2023 22:26:12 -0500 Subject: [PATCH 12/57] Draw remaining assets, GP restriction --- src/y_inter.c | 148 +++++++++++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 63 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index bd755fccd..592a68822 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -594,6 +594,15 @@ skiptallydrawer: M_DrawMenuForeground(); #endif + // INFO SEGMENT + // Numbers are V_DrawRightAlignedThinString WITH v_6widthspace as flags + // TAILS GOT THROUGH ROUND, V_DrawTitleCardString, V_6WIDTHSPACE, T is 13x32, try (51,7) origin + // TT_RND lumps for round numbers 74x74, origin (204,2) + // resbar 1 (48,82) 5 (176, 82) + // 2 (48, 96) + + //player icon 1 (55,79) 2 (55,93) 5 (183,79) + // Patches @@ -696,6 +705,15 @@ skiptallydrawer: // Draw "GOT THROUGH ROUND" V_DrawMappedPatch(50, 42, 0, gthro, 0); + // Draw round numbers (in GP) + if (grandprixinfo.roundnum > 0) + { + char buf[9]; + sprintf(buf, "TT_RND%d", grandprixinfo.roundnum); + patch_t *roundpatch = W_CachePatchName(buf, PU_PATCH); + V_DrawMappedPatch(204, 2, 0, roundpatch, 0); + } + // TODO: Clean this bullshit up // Draw resbars @@ -710,71 +728,75 @@ skiptallydrawer: V_DrawMappedPatch(169, 126, 0, resbar, 0); // Draw bottom pieces - V_DrawMappedPatch(0, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(24, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(48, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(72, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(96, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(120, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(144, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(168, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(192, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(216, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(240, 167, 0, rmbg1, greymap); - - V_DrawMappedPatch(253, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(277, 167, 0, rmbg4, greymap); - V_DrawMappedPatch(301, 167, 0, rmbg1, greymap); - - // Draw the lines - // Draw the shadows first, so they don't draw over the lines - V_DrawMappedPatch(23, 178, 0, rrmls1, 0); - V_DrawMappedPatch(47, 178, 0, rrmls2, 0); - V_DrawMappedPatch(71, 178, 0, rrmls1, 0); - V_DrawMappedPatch(95, 178, 0, rrmls2, 0); - V_DrawMappedPatch(119, 178, 0, rrmls1, 0); - V_DrawMappedPatch(143, 178, 0, rrmls2, 0); - - // now draw the actual lines - V_DrawMappedPatch(23, 179, 0, rrmln1, 0); - V_DrawMappedPatch(47, 179, 0, rrmln2, 0); - V_DrawMappedPatch(71, 179, 0, rrmln1, 0); - V_DrawMappedPatch(95, 179, 0, rrmln2, 0); - V_DrawMappedPatch(119, 179, 0, rrmln1, 0); - V_DrawMappedPatch(143, 179, 0, rrmln2, 0); - - // haha funny 54-part progress bar - // i am a dumbass and there is probably a better way to do this - for (UINT16 x = 172; x < 284; x += 2) + if (grandprixinfo.gp) { - V_DrawMappedPatch(x, 177, 0, rrmls3, 0); - V_DrawMappedPatch(x, 179, 0, rrmln5, 0); - } - - // Draw the progress markers - V_DrawMappedPatch(16, 179, 0, rrmrk1, 0); - V_DrawMappedPatch(40, 171, 0, rrmrk2, 0); - V_DrawMappedPatch(64, 179, 0, rrmrk3, 0); - - V_DrawMappedPatch(88, 171, 0, rrmrk2, 0); - V_DrawMappedPatch(112, 179, 0, rrmrk2, 0); - V_DrawMappedPatch(136, 171, 0, rrmrk3, 0); - V_DrawMappedPatch(160, 179, 0, rrmrk2, 0); - - V_DrawMappedPatch(282, 179, 0, rrmrk4, 0); - - // Draw rank icon - V_DrawMappedPatch(14, 165, 0, rpmark, 0); - - for (SINT8 i = 0; i < data.numplayers; i++) - { - if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator && data.num[i] == consoleplayer) + V_DrawMappedPatch(0, 167, 0, rmbg1, greymap); + V_DrawMappedPatch(24, 167, 0, rmbg2, greymap); + V_DrawMappedPatch(48, 167, 0, rmbg3, greymap); + + V_DrawMappedPatch(72, 167, 0, rmbg2, greymap); + V_DrawMappedPatch(96, 167, 0, rmbg3, greymap); + + V_DrawMappedPatch(120, 167, 0, rmbg2, greymap); + V_DrawMappedPatch(144, 167, 0, rmbg3, greymap); + + V_DrawMappedPatch(168, 167, 0, rmbg1, greymap); + V_DrawMappedPatch(192, 167, 0, rmbg1, greymap); + V_DrawMappedPatch(216, 167, 0, rmbg1, greymap); + V_DrawMappedPatch(240, 167, 0, rmbg1, greymap); + + V_DrawMappedPatch(253, 167, 0, rmbg1, greymap); + V_DrawMappedPatch(277, 167, 0, rmbg4, greymap); + V_DrawMappedPatch(301, 167, 0, rmbg1, greymap); + + // Draw the lines + // Draw the shadows first, so they don't draw over the lines + V_DrawMappedPatch(23, 178, 0, rrmls1, 0); + V_DrawMappedPatch(47, 178, 0, rrmls2, 0); + V_DrawMappedPatch(71, 178, 0, rrmls1, 0); + V_DrawMappedPatch(95, 178, 0, rrmls2, 0); + V_DrawMappedPatch(119, 178, 0, rrmls1, 0); + V_DrawMappedPatch(143, 178, 0, rrmls2, 0); + + // now draw the actual lines + V_DrawMappedPatch(23, 179, 0, rrmln1, 0); + V_DrawMappedPatch(47, 179, 0, rrmln2, 0); + V_DrawMappedPatch(71, 179, 0, rrmln1, 0); + V_DrawMappedPatch(95, 179, 0, rrmln2, 0); + V_DrawMappedPatch(119, 179, 0, rrmln1, 0); + V_DrawMappedPatch(143, 179, 0, rrmln2, 0); + + // haha funny 54-part progress bar + // i am a dumbass and there is probably a better way to do this + for (UINT16 x = 172; x < 284; x += 2) { - UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - V_DrawMappedPatch(15, 166, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); // get an icon in there for now + V_DrawMappedPatch(x, 177, 0, rrmls3, 0); + V_DrawMappedPatch(x, 179, 0, rrmln5, 0); + } + + // Draw the progress markers + V_DrawMappedPatch(16, 179, 0, rrmrk1, 0); + V_DrawMappedPatch(40, 171, 0, rrmrk2, 0); + V_DrawMappedPatch(64, 179, 0, rrmrk3, 0); + + V_DrawMappedPatch(88, 171, 0, rrmrk2, 0); + V_DrawMappedPatch(112, 179, 0, rrmrk2, 0); + V_DrawMappedPatch(136, 171, 0, rrmrk3, 0); + V_DrawMappedPatch(160, 179, 0, rrmrk2, 0); + + V_DrawMappedPatch(282, 179, 0, rrmrk4, 0); + + // Draw rank icon + V_DrawMappedPatch(14, 165, 0, rpmark, 0); + + for (SINT8 i = 0; i < data.numplayers; i++) + { + if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator && data.num[i] == consoleplayer) + { + UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); + V_DrawMappedPatch(15, 166, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); // get an icon in there for now + V_DrawTitleCardString(51, 7, data.name[i], V_6WIDTHSPACE, false, 0, 0); + } } } } From 465369f383d663dd134ccb878a12a485943edc3b Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 5 Apr 2023 00:44:53 -0500 Subject: [PATCH 13/57] Logic for progress display markers --- src/y_inter.c | 56 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 592a68822..e16f52705 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -62,10 +62,10 @@ typedef struct typedef struct { - INT32 *character[MAXPLAYERS]; // Winner's character # - UINT16 *color[MAXPLAYERS]; // Winner's color # - SINT8 num[MAXPLAYERS]; // Winner's player # - char *name[MAXPLAYERS]; // Winner's name + INT32 *character[MAXPLAYERS]; // Character # + UINT16 *color[MAXPLAYERS]; // Color # + SINT8 num[MAXPLAYERS]; // Player # + char *name[MAXPLAYERS]; // Player's name UINT8 numplayers; // Number of players being displayed @@ -596,8 +596,6 @@ skiptallydrawer: // INFO SEGMENT // Numbers are V_DrawRightAlignedThinString WITH v_6widthspace as flags - // TAILS GOT THROUGH ROUND, V_DrawTitleCardString, V_6WIDTHSPACE, T is 13x32, try (51,7) origin - // TT_RND lumps for round numbers 74x74, origin (204,2) // resbar 1 (48,82) 5 (176, 82) // 2 (48, 96) @@ -621,6 +619,8 @@ skiptallydrawer: patch_t *rrmrk2 = W_CachePatchName("R_RRMRK2", PU_PATCH); patch_t *rrmrk3 = W_CachePatchName("R_RRMRK3", PU_PATCH); patch_t *rrmrk4 = W_CachePatchName("R_RRMRK4", PU_PATCH); + patch_t *rrmrk5 = W_CachePatchName("R_RRMRK5", PU_PATCH); + patch_t *rrmrk6 = W_CachePatchName("R_RRMRK6", PU_PATCH); // Progression lines patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); @@ -711,7 +711,7 @@ skiptallydrawer: char buf[9]; sprintf(buf, "TT_RND%d", grandprixinfo.roundnum); patch_t *roundpatch = W_CachePatchName(buf, PU_PATCH); - V_DrawMappedPatch(204, 2, 0, roundpatch, 0); + V_DrawMappedPatch(240, 39, 0, roundpatch, 0); } @@ -774,28 +774,38 @@ skiptallydrawer: V_DrawMappedPatch(x, 179, 0, rrmln5, 0); } - // Draw the progress markers - V_DrawMappedPatch(16, 179, 0, rrmrk1, 0); - V_DrawMappedPatch(40, 171, 0, rrmrk2, 0); - V_DrawMappedPatch(64, 179, 0, rrmrk3, 0); - - V_DrawMappedPatch(88, 171, 0, rrmrk2, 0); - V_DrawMappedPatch(112, 179, 0, rrmrk2, 0); - V_DrawMappedPatch(136, 171, 0, rrmrk3, 0); - V_DrawMappedPatch(160, 179, 0, rrmrk2, 0); - - V_DrawMappedPatch(282, 179, 0, rrmrk4, 0); - - // Draw rank icon - V_DrawMappedPatch(14, 165, 0, rpmark, 0); for (SINT8 i = 0; i < data.numplayers; i++) { if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator && data.num[i] == consoleplayer) { UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - V_DrawMappedPatch(15, 166, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); // get an icon in there for now - V_DrawTitleCardString(51, 7, data.name[i], V_6WIDTHSPACE, false, 0, 0); + UINT8 *oppositemap = R_GetTranslationColormap(*data.character[i], skincolors[*data.color[i]].invcolor, GTC_CACHE); + INT32 roundx[6] = {0, 14, 38, 86, 110, 158}; + INT32 roundy[6] = {0, 165, 157, 157, 165, 165}; + INT32 rankx = roundx[grandprixinfo.roundnum]; + INT32 ranky = roundy[grandprixinfo.roundnum]; + + // Draw the progress markers + V_DrawMappedPatch(16, 179, 0, grandprixinfo.roundnum > 0 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 1 ? oppositemap : colormap); + V_DrawMappedPatch(40, 171, 0, grandprixinfo.roundnum > 1 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 2 ? oppositemap : colormap); + V_DrawMappedPatch(64, 179, 0, grandprixinfo.roundnum > 2 ? rrmrk5 : rrmrk3, colormap); // CAPSULE + + V_DrawMappedPatch(88, 171, 0, grandprixinfo.roundnum > 2 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 3 ? oppositemap : colormap); + V_DrawMappedPatch(112, 179, 0, grandprixinfo.roundnum > 3 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 4 ? oppositemap : colormap); + V_DrawMappedPatch(136, 171, 0, grandprixinfo.roundnum > 4 ? rrmrk5 : rrmrk3, colormap); // CAPSULE + V_DrawMappedPatch(160, 179, 0, grandprixinfo.roundnum > 4 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 5 ? oppositemap : colormap); + + V_DrawMappedPatch(282, 179, 0, grandprixinfo.roundnum > 5 ? rrmrk6 : rrmrk4, colormap); // EMERALD + + // Draw outline for rank icon + V_DrawMappedPatch(rankx, ranky, 0, rpmark, 0); + + // Draw the player's rank icon + 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); } } } From 7712074b290083b4b21cec2e5a19b19408a23876 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 5 Apr 2023 01:14:06 -0500 Subject: [PATCH 14/57] Make line colors reflect progress --- src/y_inter.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index e16f52705..6e6e35eee 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -625,7 +625,10 @@ skiptallydrawer: // Progression lines patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); patch_t *rrmln2 = W_CachePatchName("R_RRMLN2", PU_PATCH); + patch_t *rrmln3 = W_CachePatchName("R_RRMLN3", PU_PATCH); + patch_t *rrmln4 = W_CachePatchName("R_RRMLN4", PU_PATCH); patch_t *rrmln5 = W_CachePatchName("R_RRMLN5", PU_PATCH); + patch_t *rrmln6 = W_CachePatchName("R_RRMLN6", PU_PATCH); // Shadows for progression lines patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); @@ -758,22 +761,6 @@ skiptallydrawer: V_DrawMappedPatch(119, 178, 0, rrmls1, 0); V_DrawMappedPatch(143, 178, 0, rrmls2, 0); - // now draw the actual lines - V_DrawMappedPatch(23, 179, 0, rrmln1, 0); - V_DrawMappedPatch(47, 179, 0, rrmln2, 0); - V_DrawMappedPatch(71, 179, 0, rrmln1, 0); - V_DrawMappedPatch(95, 179, 0, rrmln2, 0); - V_DrawMappedPatch(119, 179, 0, rrmln1, 0); - V_DrawMappedPatch(143, 179, 0, rrmln2, 0); - - // haha funny 54-part progress bar - // i am a dumbass and there is probably a better way to do this - for (UINT16 x = 172; x < 284; x += 2) - { - V_DrawMappedPatch(x, 177, 0, rrmls3, 0); - V_DrawMappedPatch(x, 179, 0, rrmln5, 0); - } - for (SINT8 i = 0; i < data.numplayers; i++) { @@ -786,6 +773,23 @@ skiptallydrawer: INT32 rankx = roundx[grandprixinfo.roundnum]; INT32 ranky = roundy[grandprixinfo.roundnum]; + // now draw the actual lines + V_DrawMappedPatch(23, 179, 0, grandprixinfo.roundnum > 1 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 1 ? colormap : 0); + V_DrawMappedPatch(47, 179, 0, grandprixinfo.roundnum > 2 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 2 ? colormap : 0); + V_DrawMappedPatch(71, 179, 0, grandprixinfo.roundnum > 2 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 2 ? colormap : 0); + V_DrawMappedPatch(95, 179, 0, grandprixinfo.roundnum > 3 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 3 ? colormap : 0); + V_DrawMappedPatch(119, 179, 0, grandprixinfo.roundnum > 4 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 4 ? colormap : 0); + V_DrawMappedPatch(143, 179, 0, grandprixinfo.roundnum > 4 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 4 ? colormap : 0); + + // haha funny 54-part progress bar + // i am a dumbass and there is probably a better way to do this + for (UINT16 x = 172; x < 284; x += 2) + { + // does not account for colormap since at the moment that will never be seen + V_DrawMappedPatch(x, 177, 0, rrmls3, 0); + V_DrawMappedPatch(x, 179, 0, rrmln5, 0); + } + // Draw the progress markers V_DrawMappedPatch(16, 179, 0, grandprixinfo.roundnum > 0 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 1 ? oppositemap : colormap); V_DrawMappedPatch(40, 171, 0, grandprixinfo.roundnum > 1 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 2 ? oppositemap : colormap); From ae7830b9ab8456fa5de946c5ae138e22bd741492 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 6 May 2023 17:05:45 +0100 Subject: [PATCH 15/57] Compilation fixes - grandprixinfo.roundnum --> roundqueue.roundnum - comment out unused patch --- src/y_inter.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 6e6e35eee..ba3892ddb 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -628,7 +628,7 @@ skiptallydrawer: patch_t *rrmln3 = W_CachePatchName("R_RRMLN3", PU_PATCH); patch_t *rrmln4 = W_CachePatchName("R_RRMLN4", PU_PATCH); patch_t *rrmln5 = W_CachePatchName("R_RRMLN5", PU_PATCH); - patch_t *rrmln6 = W_CachePatchName("R_RRMLN6", PU_PATCH); + //patch_t *rrmln6 = W_CachePatchName("R_RRMLN6", PU_PATCH); // Shadows for progression lines patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); @@ -709,10 +709,10 @@ skiptallydrawer: V_DrawMappedPatch(50, 42, 0, gthro, 0); // Draw round numbers (in GP) - if (grandprixinfo.roundnum > 0) + if (roundqueue.roundnum > 0) { char buf[9]; - sprintf(buf, "TT_RND%d", grandprixinfo.roundnum); + sprintf(buf, "TT_RND%d", roundqueue.roundnum); patch_t *roundpatch = W_CachePatchName(buf, PU_PATCH); V_DrawMappedPatch(240, 39, 0, roundpatch, 0); } @@ -731,7 +731,7 @@ skiptallydrawer: V_DrawMappedPatch(169, 126, 0, resbar, 0); // Draw bottom pieces - if (grandprixinfo.gp) + if (roundqueue.size > 0) { V_DrawMappedPatch(0, 167, 0, rmbg1, greymap); V_DrawMappedPatch(24, 167, 0, rmbg2, greymap); @@ -770,16 +770,16 @@ skiptallydrawer: UINT8 *oppositemap = R_GetTranslationColormap(*data.character[i], skincolors[*data.color[i]].invcolor, GTC_CACHE); INT32 roundx[6] = {0, 14, 38, 86, 110, 158}; INT32 roundy[6] = {0, 165, 157, 157, 165, 165}; - INT32 rankx = roundx[grandprixinfo.roundnum]; - INT32 ranky = roundy[grandprixinfo.roundnum]; + INT32 rankx = roundx[roundqueue.roundnum]; + INT32 ranky = roundy[roundqueue.roundnum]; // now draw the actual lines - V_DrawMappedPatch(23, 179, 0, grandprixinfo.roundnum > 1 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 1 ? colormap : 0); - V_DrawMappedPatch(47, 179, 0, grandprixinfo.roundnum > 2 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 2 ? colormap : 0); - V_DrawMappedPatch(71, 179, 0, grandprixinfo.roundnum > 2 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 2 ? colormap : 0); - V_DrawMappedPatch(95, 179, 0, grandprixinfo.roundnum > 3 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 3 ? colormap : 0); - V_DrawMappedPatch(119, 179, 0, grandprixinfo.roundnum > 4 ? rrmln3 : rrmln1, grandprixinfo.roundnum > 4 ? colormap : 0); - V_DrawMappedPatch(143, 179, 0, grandprixinfo.roundnum > 4 ? rrmln4 : rrmln2, grandprixinfo.roundnum > 4 ? colormap : 0); + V_DrawMappedPatch(23, 179, 0, roundqueue.roundnum > 1 ? rrmln3 : rrmln1, roundqueue.roundnum > 1 ? colormap : NULL); + V_DrawMappedPatch(47, 179, 0, roundqueue.roundnum > 2 ? rrmln4 : rrmln2, roundqueue.roundnum > 2 ? colormap : NULL); + V_DrawMappedPatch(71, 179, 0, roundqueue.roundnum > 2 ? rrmln3 : rrmln1, roundqueue.roundnum > 2 ? colormap : NULL); + V_DrawMappedPatch(95, 179, 0, roundqueue.roundnum > 3 ? rrmln4 : rrmln2, roundqueue.roundnum > 3 ? colormap : NULL); + V_DrawMappedPatch(119, 179, 0, roundqueue.roundnum > 4 ? rrmln3 : rrmln1, roundqueue.roundnum > 4 ? colormap : NULL); + V_DrawMappedPatch(143, 179, 0, roundqueue.roundnum > 4 ? rrmln4 : rrmln2, roundqueue.roundnum > 4 ? colormap : NULL); // haha funny 54-part progress bar // i am a dumbass and there is probably a better way to do this @@ -791,16 +791,16 @@ skiptallydrawer: } // Draw the progress markers - V_DrawMappedPatch(16, 179, 0, grandprixinfo.roundnum > 0 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 1 ? oppositemap : colormap); - V_DrawMappedPatch(40, 171, 0, grandprixinfo.roundnum > 1 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 2 ? oppositemap : colormap); - V_DrawMappedPatch(64, 179, 0, grandprixinfo.roundnum > 2 ? rrmrk5 : rrmrk3, colormap); // CAPSULE + V_DrawMappedPatch(16, 179, 0, roundqueue.roundnum > 0 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 1 ? oppositemap : colormap); + V_DrawMappedPatch(40, 171, 0, roundqueue.roundnum > 1 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 2 ? oppositemap : colormap); + V_DrawMappedPatch(64, 179, 0, roundqueue.roundnum > 2 ? rrmrk5 : rrmrk3, colormap); // CAPSULE - V_DrawMappedPatch(88, 171, 0, grandprixinfo.roundnum > 2 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 3 ? oppositemap : colormap); - V_DrawMappedPatch(112, 179, 0, grandprixinfo.roundnum > 3 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 4 ? oppositemap : colormap); - V_DrawMappedPatch(136, 171, 0, grandprixinfo.roundnum > 4 ? rrmrk5 : rrmrk3, colormap); // CAPSULE - V_DrawMappedPatch(160, 179, 0, grandprixinfo.roundnum > 4 ? rrmrk1 : rrmrk2, grandprixinfo.roundnum == 5 ? oppositemap : colormap); + V_DrawMappedPatch(88, 171, 0, roundqueue.roundnum > 2 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 3 ? oppositemap : colormap); + V_DrawMappedPatch(112, 179, 0, roundqueue.roundnum > 3 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 4 ? oppositemap : colormap); + V_DrawMappedPatch(136, 171, 0, roundqueue.roundnum > 4 ? rrmrk5 : rrmrk3, colormap); // CAPSULE + V_DrawMappedPatch(160, 179, 0, roundqueue.roundnum > 4 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 5 ? oppositemap : colormap); - V_DrawMappedPatch(282, 179, 0, grandprixinfo.roundnum > 5 ? rrmrk6 : rrmrk4, colormap); // EMERALD + V_DrawMappedPatch(282, 179, 0, roundqueue.roundnum > 5 ? rrmrk6 : rrmrk4, colormap); // EMERALD // Draw outline for rank icon V_DrawMappedPatch(rankx, ranky, 0, rpmark, 0); From 06c4a898e20bd33e9b3ed11df951f8892d82b295 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 6 May 2023 22:06:44 +0100 Subject: [PATCH 16/57] First steps at reimplementing functionality - Re-add demo save HUD - Re-add skip for drawing 3D scene required since Twodee - Re-add Lua-controlled HUD disabling - Cleanup for 0 instead of NULL in pointer field of patch drawer macros - Cleanup for more extra tabs than the browser session of someone with ADHD --- src/y_inter.c | 144 ++++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index ba3892ddb..cb5d016df 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -561,34 +561,6 @@ skiptallydrawer: va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); } } - - if ((modeattacking == ATTACKING_NONE) && (demo.recording || demo.savemode == DSM_SAVED) && !demo.playback) - { - switch (demo.savemode) - { - case DSM_NOTSAVING: - { - 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|hilicol, "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|hilicol, "Save replay"); - break; - } - case DSM_SAVED: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|hilicol, "Replay saved!"); - break; - - case DSM_TITLEENTRY: - ST_DrawDemoTitleEntry(); - break; - - default: // Don't render any text here - break; - } - } } M_DrawMenuForeground(); @@ -598,12 +570,28 @@ skiptallydrawer: // Numbers are V_DrawRightAlignedThinString WITH v_6widthspace as flags // resbar 1 (48,82) 5 (176, 82) // 2 (48, 96) - + //player icon 1 (55,79) 2 (55,93) 5 (183,79) + // If we early return, skip drawing the 3D scene (software buffer) so it doesn't clobber the frame for the wipe + g_wipeskiprender = true; + + if (intertype == int_none || rendermode == render_none) + return; + + g_wipeskiprender = false; + + UINT8 i = 0; + fixed_t x, y, xoffset = 0; + + INT32 hilicol = highlightflags; + INT32 whiteplayer = MAXPLAYERS; + + if (!r_splitscreen) + whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; + // Patches - - + patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); // GOT THROUGH ROUND patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players @@ -637,27 +625,23 @@ skiptallydrawer: // Header bar patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); - + // Checker scroll patch_t *rbgchk = W_CachePatchName("R_RBGCHK", PU_PATCH); - + // Scrolling marquee patch_t *rrmq = W_CachePatchName("R_RRMQ", PU_PATCH); - + // Blending mask for the background patch_t *mask = W_CachePatchName("R_MASK", PU_PATCH); - + fixed_t mqloop = SHORT(rrmq->width)*FRACUNIT; fixed_t chkloop = SHORT(rbgchk->width)*FRACUNIT; - + UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me - UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); - + K_RainbowColormap(color, SKINCOLOR_INTERMISSION); - - if (intertype == int_none || rendermode == render_none) - return; - + if (renderisnewtic) { LUA_HUD_ClearDrawList(luahuddrawlist_intermission); @@ -665,50 +649,40 @@ skiptallydrawer: } LUA_HUD_DrawList(luahuddrawlist_intermission); - //if (!LUA_HudEnabled(hud_intermissiontally)) - //goto skiptallydrawer; + if (!LUA_HudEnabled(hud_intermissiontally)) + goto skiptallydrawer; // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< mqloop) - mqscroll -= mqloop; + mqscroll = (mqscroll + renderdeltatics) % mqloop; V_DrawFixedPatch(chkscroll, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); V_DrawFixedPatch(chkscroll - chkloop, 0, FRACUNIT, V_SUBTRACT, rbgchk, NULL); - chkscroll += (1*renderdeltatics); + chkscroll = (chkscroll + renderdeltatics) % chkloop; - while (chkscroll > chkloop) - chkscroll -= chkloop; - // Draw the header bar - V_DrawMappedPatch(20, 24, 0, rtpbr, 0); - + V_DrawMappedPatch(20, 24, 0, rtpbr, NULL); + // Draw "GOT THROUGH ROUND" - V_DrawMappedPatch(50, 42, 0, gthro, 0); - - // Draw round numbers (in GP) + V_DrawMappedPatch(50, 42, 0, gthro, NULL); + + // Draw round numbers if (roundqueue.roundnum > 0) { char buf[9]; @@ -729,8 +703,42 @@ skiptallydrawer: V_DrawMappedPatch(169, 98, 0, resbar, 0); V_DrawMappedPatch(169, 112, 0, resbar, 0); V_DrawMappedPatch(169, 126, 0, resbar, 0); - - // Draw bottom pieces + + // Draw bottom (and top) pieces +skiptallydrawer: + { + if ((modeattacking == ATTACKING_NONE) && (demo.recording || demo.savemode == DSM_SAVED) && !demo.playback) + { + switch (demo.savemode) + { + case DSM_NOTSAVING: + { + 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|hilicol, "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|hilicol, "Save replay"); + break; + } + case DSM_SAVED: + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|hilicol, "Replay saved!"); + break; + + case DSM_TITLEENTRY: + ST_DrawDemoTitleEntry(); + break; + + default: // Don't render any text here + break; + } + } + } + + if (!LUA_HudEnabled(hud_intermissionmessages)) + return; + if (roundqueue.size > 0) { V_DrawMappedPatch(0, 167, 0, rmbg1, greymap); From aa925be7c52ad57cfebb18408a44627c56aefbb6 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 6 May 2023 22:26:44 +0100 Subject: [PATCH 17/57] Reimplement player result data - A series of bars with stuff on them. - Player position num - Player character + color (via minimap icon) - Uses MINIDEAD if a bot NO CONTESTs - Player name (Aqua text instead of white if you're the main player) - Player TIME/SCORE/RANK/PWR depending on context - NO CONTEST now reads "RETIRED." - More economical use of more limited space - Gives failure a slightly different flavor to the previous entry in the series - Re-implements the slide when switching from TIME/SCORE to RANK/PWR - These are automatically spaced in varying degrees to try and use as much or as little space as possible, given the bars are fixed width. - 1 to 3 players: Center-aligned column of result bars - 4 to 6 players: Two columns of result bars, 1 extra pixel of vertical spacing - 7 to 10 players: Two columns of result bars - 11 to 16 players: Two columns of result bars, 1 less pixel of vertical spacing TODO: - "LAGLESS" host name-and-shame, which the revamped screen was not designed around - Adjusting position of other entries on the screen to accomodate higher quantities of players - Adjust spacing of other graphics on the screen to prevent overlap --- src/y_inter.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 171 insertions(+), 13 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index cb5d016df..37e85220d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -676,6 +676,18 @@ skiptallydrawer: chkscroll = (chkscroll + renderdeltatics) % chkloop; + if (sorttic != -1 && intertic > sorttic) + { + INT32 count = (intertic - sorttic); + + if (count < 8) + xoffset = -((count * vid.width) / (8 * vid.dupx)); + else if (count == 8) + goto skiptallydrawer; + else if (count < 16) + xoffset = (((16 - count) * vid.width) / (8 * vid.dupx)); + } + // Draw the header bar V_DrawMappedPatch(20, 24, 0, rtpbr, NULL); @@ -690,19 +702,165 @@ skiptallydrawer: patch_t *roundpatch = W_CachePatchName(buf, PU_PATCH); V_DrawMappedPatch(240, 39, 0, roundpatch, 0); } - - - // TODO: Clean this bullshit up - // Draw resbars - V_DrawMappedPatch(41, 84, 0, resbar, 0); - V_DrawMappedPatch(41, 98, 0, resbar, 0); - V_DrawMappedPatch(41, 112, 0, resbar, 0); - V_DrawMappedPatch(41, 126, 0, resbar, 0); - - V_DrawMappedPatch(169, 84, 0, resbar, 0); - V_DrawMappedPatch(169, 98, 0, resbar, 0); - V_DrawMappedPatch(169, 112, 0, resbar, 0); - V_DrawMappedPatch(169, 126, 0, resbar, 0); + + { + SINT8 yspacing = 14; + fixed_t heightcount = (data.numplayers - 1); + fixed_t returny; + + boolean verticalresults = (data.numplayers < 4); + + if (verticalresults) + { + x = (BASEVIDWIDTH/2) - 61; + } + else + { + x = 29 + xoffset; + heightcount /= 2; + } + + if (data.numplayers > 10) + { + yspacing--; + } + else if (data.numplayers <= 6) + { + yspacing++; + if (verticalresults) + { + yspacing++; + } + } + + y = returny = 106 - (heightcount * yspacing)/2; + + for (i = 0; i < data.numplayers; i++) + { + boolean dojitter = data.jitter[data.num[i]] > 0; + data.jitter[data.num[i]] = 0; + + if (data.num[i] == MAXPLAYERS) + ; + else if (!playeringame[data.num[i]] || players[data.num[i]].spectator == true) + data.num[i] = MAXPLAYERS; // this should be the only field setting in this function + else + { + char strtime[MAXPLAYERNAME+1]; + + if (dojitter) + y--; + + V_DrawMappedPatch(x, y, 0, resbar, NULL); + + V_DrawRightAlignedThinString(x+13, y-2, 0, va("%d", data.pos[i])); + + if (data.color[i]) + { + UINT8 *charcolormap; + if (data.rankingsmode == 0 && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) + { + // RETIRED !! + charcolormap = R_GetTranslationColormap(TC_DEFAULT, *data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, W_CachePatchName("MINIDEAD", PU_CACHE), charcolormap); + } + else + { + charcolormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, faceprefix[*data.character[i]][FACE_MINIMAP], charcolormap); + } + } + + STRBUFCPY(strtime, data.name[i]); + +/* y2 = y; + + if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) + { + static UINT8 alagles_timer = 0; + patch_t *alagles; + + y2 = ( y - 4 ); + + V_DrawScaledPatch(x + 36, y2, 0, W_CachePatchName(va("BLAGLES%d", (intertic / 3) % 6), PU_CACHE)); + // every 70 tics + if (( leveltime % 70 ) == 0) + { + alagles_timer = 9; + } + if (alagles_timer > 0) + { + alagles = W_CachePatchName(va("ALAGLES%d", alagles_timer), PU_CACHE); + V_DrawScaledPatch(x + 36, y2, 0, alagles); + if (( leveltime % 2 ) == 0) + alagles_timer--; + } + else + { + alagles = W_CachePatchName("ALAGLES0", PU_CACHE); + V_DrawScaledPatch(x + 36, y2, 0, alagles); + } + + y2 += SHORT (alagles->height) + 1; + }*/ + + V_DrawThinString(x+27, y-2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); + + strtime[0] = '\0'; + + if (data.rankingsmode) + { + if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) + { + // No power level (guests) + STRBUFCPY(strtime, "----"); + } + else + { + /*if (data.increase[data.num[i]] != INT16_MIN) + { + snprintf(strtime, sizeof strtime, " (%d)", data.increase[data.num[i]]); + + V_DrawThinString(x+118, y-2, V_6WIDTHSPACE, strtime); + }*/ + + snprintf(strtime, sizeof strtime, "%d", data.val[i]); + } + } + else + { + if (data.val[i] == (UINT32_MAX-1)) + STRBUFCPY(strtime, "RETIRED."); + else + { + if (intertype == int_time) + { + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), + G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); + strtime[sizeof strtime - 1] = '\0'; + } + else + { + snprintf(strtime, sizeof strtime, "%d", data.val[i]); + } + } + } + + V_DrawRightAlignedThinString(x+118, y-2, V_6WIDTHSPACE, strtime); + + if (dojitter) + y++; + } + + y += yspacing; + + if (verticalresults == false && i == (data.numplayers-1)/2) + { + x = 169 + xoffset; + y = returny; + } + } + } // Draw bottom (and top) pieces skiptallydrawer: From 2ca9f1aee54e53bdd7ced5f61f70cbbe858ebad8 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 6 May 2023 22:31:46 +0100 Subject: [PATCH 18/57] Rename and rearrange the difficult-to-interpret patch variable names for the GP bottom progression visual `rrmrk1` is now `level_dot[BPP_DONE]`, for example. BPP is short for "Bottom Progression Patch" This is a necessary prerequisite to making the roundqueue visuals dynamic, but that is not yet the case --- src/y_inter.c | 203 ++++++++++++++++++++++++++++---------------------- 1 file changed, 114 insertions(+), 89 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 37e85220d..1b390dbb5 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -287,6 +287,15 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) } } +typedef enum +{ + BPP_AHEAD, + BPP_DONE, + BPP_MAIN, + BPP_SHADOW = BPP_MAIN, + BPP_MAX +} bottomprogressionpatch_t; + // // Y_IntermissionDrawer // @@ -594,35 +603,7 @@ skiptallydrawer: patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); // GOT THROUGH ROUND patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players - - // Background pieces - patch_t *rmbg1 = W_CachePatchName("R_RMBG1", PU_PATCH); - patch_t *rmbg2 = W_CachePatchName("R_RMBG2", PU_PATCH); - patch_t *rmbg3 = W_CachePatchName("R_RMBG3", PU_PATCH); - patch_t *rmbg4 = W_CachePatchName("R_RMBG4", PU_PATCH); - - // Progress markers - patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); - patch_t *rrmrk1 = W_CachePatchName("R_RRMRK1", PU_PATCH); - patch_t *rrmrk2 = W_CachePatchName("R_RRMRK2", PU_PATCH); - patch_t *rrmrk3 = W_CachePatchName("R_RRMRK3", PU_PATCH); - patch_t *rrmrk4 = W_CachePatchName("R_RRMRK4", PU_PATCH); - patch_t *rrmrk5 = W_CachePatchName("R_RRMRK5", PU_PATCH); - patch_t *rrmrk6 = W_CachePatchName("R_RRMRK6", PU_PATCH); - - // Progression lines - patch_t *rrmln1 = W_CachePatchName("R_RRMLN1", PU_PATCH); - patch_t *rrmln2 = W_CachePatchName("R_RRMLN2", PU_PATCH); - patch_t *rrmln3 = W_CachePatchName("R_RRMLN3", PU_PATCH); - patch_t *rrmln4 = W_CachePatchName("R_RRMLN4", PU_PATCH); - patch_t *rrmln5 = W_CachePatchName("R_RRMLN5", PU_PATCH); - //patch_t *rrmln6 = W_CachePatchName("R_RRMLN6", PU_PATCH); - - // Shadows for progression lines - patch_t *rrmls1 = W_CachePatchName("R_RRMLS1", PU_PATCH); - patch_t *rrmls2 = W_CachePatchName("R_RRMLS2", PU_PATCH); - patch_t *rrmls3 = W_CachePatchName("R_RRMLS3", PU_PATCH); - + // Header bar patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); @@ -697,10 +678,12 @@ skiptallydrawer: // Draw round numbers if (roundqueue.roundnum > 0) { - char buf[9]; - sprintf(buf, "TT_RND%d", roundqueue.roundnum); - patch_t *roundpatch = W_CachePatchName(buf, PU_PATCH); - V_DrawMappedPatch(240, 39, 0, roundpatch, 0); + patch_t *roundpatch = + W_CachePatchName( + va("TT_RND%d", roundqueue.roundnum), + PU_PATCH + ); + V_DrawMappedPatch(240, 39, 0, roundpatch, NULL); } { @@ -899,36 +882,67 @@ skiptallydrawer: if (roundqueue.size > 0) { - V_DrawMappedPatch(0, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(24, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(48, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(72, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(96, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(120, 167, 0, rmbg2, greymap); - V_DrawMappedPatch(144, 167, 0, rmbg3, greymap); - - V_DrawMappedPatch(168, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(192, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(216, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(240, 167, 0, rmbg1, greymap); - - V_DrawMappedPatch(253, 167, 0, rmbg1, greymap); - V_DrawMappedPatch(277, 167, 0, rmbg4, greymap); - V_DrawMappedPatch(301, 167, 0, rmbg1, greymap); - + UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); + + // Background pieces + patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); + patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); + patch_t *queuebg_down = W_CachePatchName("R_RMBG3", PU_PATCH); + patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); + + V_DrawMappedPatch(0, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(24, 167, 0, queuebg_upwa, greymap); + V_DrawMappedPatch(48, 167, 0, queuebg_down, greymap); + + V_DrawMappedPatch(72, 167, 0, queuebg_upwa, greymap); + V_DrawMappedPatch(96, 167, 0, queuebg_down, greymap); + + V_DrawMappedPatch(120, 167, 0, queuebg_upwa, greymap); + V_DrawMappedPatch(144, 167, 0, queuebg_down, greymap); + + V_DrawMappedPatch(168, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(192, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(216, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(240, 167, 0, queuebg_flat, greymap); + + V_DrawMappedPatch(253, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(277, 167, 0, queuebg_prize, greymap); + V_DrawMappedPatch(301, 167, 0, queuebg_flat, greymap); + + // Progress markers + patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); + patch_t *level_dot[BPP_MAIN]; + patch_t *capsu_dot[BPP_MAIN]; + patch_t *prize_dot[BPP_MAIN]; + + level_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK2", PU_PATCH); + level_dot[BPP_DONE] = W_CachePatchName("R_RRMRK1", PU_PATCH); + + capsu_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK3", PU_PATCH); + capsu_dot[BPP_DONE] = W_CachePatchName("R_RRMRK5", PU_PATCH); + + prize_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK4", PU_PATCH); + prize_dot[BPP_DONE] = W_CachePatchName("R_RRMRK6", PU_PATCH); + + // Progression lines + patch_t *line_upwa[BPP_MAX]; + patch_t *line_down[BPP_MAX]; + patch_t *line_flat[BPP_MAX]; + line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); + line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); + line_upwa[BPP_SHADOW] = W_CachePatchName("R_RRMLS1", PU_PATCH); + + line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); + line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); + line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); + + line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); + line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); + line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); + // Draw the lines - // Draw the shadows first, so they don't draw over the lines - V_DrawMappedPatch(23, 178, 0, rrmls1, 0); - V_DrawMappedPatch(47, 178, 0, rrmls2, 0); - V_DrawMappedPatch(71, 178, 0, rrmls1, 0); - V_DrawMappedPatch(95, 178, 0, rrmls2, 0); - V_DrawMappedPatch(119, 178, 0, rrmls1, 0); - V_DrawMappedPatch(143, 178, 0, rrmls2, 0); - - - for (SINT8 i = 0; i < data.numplayers; i++) + + for (i = 0; i < data.numplayers; i++) { if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator && data.num[i] == consoleplayer) { @@ -938,42 +952,53 @@ skiptallydrawer: INT32 roundy[6] = {0, 165, 157, 157, 165, 165}; INT32 rankx = roundx[roundqueue.roundnum]; INT32 ranky = roundy[roundqueue.roundnum]; - - // now draw the actual lines - V_DrawMappedPatch(23, 179, 0, roundqueue.roundnum > 1 ? rrmln3 : rrmln1, roundqueue.roundnum > 1 ? colormap : NULL); - V_DrawMappedPatch(47, 179, 0, roundqueue.roundnum > 2 ? rrmln4 : rrmln2, roundqueue.roundnum > 2 ? colormap : NULL); - V_DrawMappedPatch(71, 179, 0, roundqueue.roundnum > 2 ? rrmln3 : rrmln1, roundqueue.roundnum > 2 ? colormap : NULL); - V_DrawMappedPatch(95, 179, 0, roundqueue.roundnum > 3 ? rrmln4 : rrmln2, roundqueue.roundnum > 3 ? colormap : NULL); - V_DrawMappedPatch(119, 179, 0, roundqueue.roundnum > 4 ? rrmln3 : rrmln1, roundqueue.roundnum > 4 ? colormap : NULL); - V_DrawMappedPatch(143, 179, 0, roundqueue.roundnum > 4 ? rrmln4 : rrmln2, roundqueue.roundnum > 4 ? colormap : NULL); - + + // now draw the actual lines + V_DrawMappedPatch(23, 178, 0, line_upwa[BPP_SHADOW], NULL); + V_DrawMappedPatch(23, 179, 0, line_upwa[roundqueue.roundnum > 1 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 1 ? colormap : NULL); + + V_DrawMappedPatch(47, 178, 0, line_down[BPP_SHADOW], NULL); + V_DrawMappedPatch(47, 179, 0, line_down[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 2 ? colormap : NULL); + + V_DrawMappedPatch(71, 178, 0, line_upwa[BPP_SHADOW], NULL); + V_DrawMappedPatch(71, 179, 0, line_upwa[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 2 ? colormap : NULL); + + V_DrawMappedPatch(95, 178, 0, line_down[BPP_SHADOW], NULL); + V_DrawMappedPatch(95, 179, 0, line_down[roundqueue.roundnum > 3 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 3 ? colormap : NULL); + + V_DrawMappedPatch(119, 178, 0, line_upwa[BPP_SHADOW], NULL); + V_DrawMappedPatch(119, 179, 0, line_upwa[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 4 ? colormap : NULL); + + V_DrawMappedPatch(143, 178, 0, line_down[BPP_SHADOW], NULL); + V_DrawMappedPatch(143, 179, 0, line_down[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 4 ? colormap : NULL); + // haha funny 54-part progress bar // i am a dumbass and there is probably a better way to do this - for (UINT16 x = 172; x < 284; x += 2) + for (UINT16 x2 = 172; x2 < 284; x2 += 2) { // does not account for colormap since at the moment that will never be seen - V_DrawMappedPatch(x, 177, 0, rrmls3, 0); - V_DrawMappedPatch(x, 179, 0, rrmln5, 0); + V_DrawMappedPatch(x2, 177, 0, line_flat[BPP_SHADOW], NULL); + V_DrawMappedPatch(x2, 179, 0, line_flat[BPP_AHEAD], NULL); } - + // Draw the progress markers - V_DrawMappedPatch(16, 179, 0, roundqueue.roundnum > 0 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 1 ? oppositemap : colormap); - V_DrawMappedPatch(40, 171, 0, roundqueue.roundnum > 1 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 2 ? oppositemap : colormap); - V_DrawMappedPatch(64, 179, 0, roundqueue.roundnum > 2 ? rrmrk5 : rrmrk3, colormap); // CAPSULE - - V_DrawMappedPatch(88, 171, 0, roundqueue.roundnum > 2 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 3 ? oppositemap : colormap); - V_DrawMappedPatch(112, 179, 0, roundqueue.roundnum > 3 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 4 ? oppositemap : colormap); - V_DrawMappedPatch(136, 171, 0, roundqueue.roundnum > 4 ? rrmrk5 : rrmrk3, colormap); // CAPSULE - V_DrawMappedPatch(160, 179, 0, roundqueue.roundnum > 4 ? rrmrk1 : rrmrk2, roundqueue.roundnum == 5 ? oppositemap : colormap); - - V_DrawMappedPatch(282, 179, 0, roundqueue.roundnum > 5 ? rrmrk6 : rrmrk4, colormap); // EMERALD - + V_DrawMappedPatch(16, 179, 0, level_dot[roundqueue.roundnum > 0 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 1 ? oppositemap : colormap); + V_DrawMappedPatch(40, 171, 0, level_dot[roundqueue.roundnum > 1 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 2 ? oppositemap : colormap); + V_DrawMappedPatch(64, 179, 0, capsu_dot[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], colormap); // CAPSULE + + V_DrawMappedPatch(88, 171, 0, level_dot[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 3 ? oppositemap : colormap); + V_DrawMappedPatch(112, 179, 0, level_dot[roundqueue.roundnum > 3 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 4 ? oppositemap : colormap); + V_DrawMappedPatch(136, 171, 0, capsu_dot[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], colormap); // CAPSULE + V_DrawMappedPatch(160, 179, 0, level_dot[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 5 ? oppositemap : colormap); + + V_DrawMappedPatch(282, 179, 0, prize_dot[roundqueue.roundnum > 5 ? BPP_DONE : BPP_AHEAD], colormap); // EMERALD + // Draw outline for rank icon - V_DrawMappedPatch(rankx, ranky, 0, rpmark, 0); - + V_DrawMappedPatch(rankx, ranky, 0, rpmark, NULL); + // Draw the player's rank icon 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); } From 4ffb5f2e10c26ad08bd26c01817f70d6e9bf3155 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 7 May 2023 13:08:24 +0100 Subject: [PATCH 19/57] Improvements to background handling - Don't draw Lua HUD hook behind the background - Flip background in Encore mode - Only animate scrolling elements when not paused or P_AutoPause - Don't clobber the (TC_DEFAULT, SKINCOLOR_YELLOW) cache, instead use (TC_RAINBOW, SKINCOLOR_INTERMISSION) directly - Clearer variable name for background colormap (color to bgcolor) --- src/y_inter.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 1b390dbb5..6be3a82b4 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -619,22 +619,10 @@ skiptallydrawer: fixed_t mqloop = SHORT(rrmq->width)*FRACUNIT; fixed_t chkloop = SHORT(rbgchk->width)*FRACUNIT; - UINT8 *color = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); // I don't even know how necessary this is anymore but I don't want the game yelling at me + UINT8 *bgcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_INTERMISSION, GTC_CACHE); - K_RainbowColormap(color, SKINCOLOR_INTERMISSION); - - if (renderisnewtic) - { - LUA_HUD_ClearDrawList(luahuddrawlist_intermission); - LUA_HookHUD(luahuddrawlist_intermission, HUD_HOOK(intermission)); - } - LUA_HUD_DrawList(luahuddrawlist_intermission); - - if (!LUA_HudEnabled(hud_intermissiontally)) - goto skiptallydrawer; - // Draw the background - K_DrawMapThumbnail(0, 0, BASEVIDWIDTH< mqloop) + mqscroll %= mqloop; + + chkscroll += renderdeltatics; + if (chkscroll > chkloop) + chkscroll %= chkloop; + } + + if (renderisnewtic) + { + LUA_HUD_ClearDrawList(luahuddrawlist_intermission); + LUA_HookHUD(luahuddrawlist_intermission, HUD_HOOK(intermission)); + } + LUA_HUD_DrawList(luahuddrawlist_intermission); + + if (!LUA_HudEnabled(hud_intermissiontally)) + goto skiptallydrawer; if (sorttic != -1 && intertic > sorttic) { From 208f7d3b8183313e5bc7e9011c1e1e31dbb602ad Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 7 May 2023 14:11:25 +0100 Subject: [PATCH 20/57] 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" --- src/y_inter.c | 123 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 6be3a82b4..420e3ad9e 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -69,7 +69,7 @@ typedef struct 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 INT16 increase[MAXPLAYERS]; // how much did the score increase by? @@ -79,6 +79,7 @@ typedef struct UINT8 pos[MAXPLAYERS]; // player positions. used for ties boolean rankingsmode; // rankings mode + boolean gotthrough; // show "got through" boolean encore; // encore mode } y_data; @@ -164,48 +165,65 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) ; else if ((data.rankingsmode = (boolean)rankingsmode)) { - sprintf(data.levelstring, "* Total Rankings *"); - data.encore = false; + sprintf(data.headerstring, "Total Rankings"); + data.gotthrough = false; } else { - // set up the levelstring - if (bossinfo.valid == true && bossinfo.enemyname) + UINT8 whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; + + data.headerstring[0] = '\0'; + data.gotthrough = false; + + if (whiteplayer < MAXPLAYERS + && playeringame[whiteplayer] + && players[whiteplayer].spectator == false + ) { - snprintf(data.levelstring, - sizeof data.levelstring, - "* %s *", - bossinfo.enemyname); - } - else if (mapheaderinfo[prevmap]->levelflags & LF_NOZONE) - { - if (mapheaderinfo[prevmap]->actnum > 0) - snprintf(data.levelstring, - sizeof data.levelstring, - "* %s %d *", - mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum); + if (!(players[whiteplayer].pflags & PF_NOCONTEST)) + { + data.gotthrough = true; + + if (players[whiteplayer].skin < numskins) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s", + skins[players[whiteplayer].skin].realname); + } + } else - snprintf(data.levelstring, - sizeof data.levelstring, - "* %s *", - mapheaderinfo[prevmap]->lvlttl); + { + snprintf(data.headerstring, + sizeof data.headerstring, + "NO CONTEST..."); + } } else { - const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "ZONE"); - if (mapheaderinfo[prevmap]->actnum > 0) - snprintf(data.levelstring, - sizeof data.levelstring, - "* %s %s %d *", - mapheaderinfo[prevmap]->lvlttl, zonttl, mapheaderinfo[prevmap]->actnum); + if (bossinfo.valid == true && bossinfo.enemyname) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s", + bossinfo.enemyname); + } + else if (battleprisons == true) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "PRISON BREAK"); + } else - snprintf(data.levelstring, - sizeof data.levelstring, - "* %s %s *", - mapheaderinfo[prevmap]->lvlttl, zonttl); + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s STAGE", + gametypes[gametype]->name); + } } - data.levelstring[sizeof data.levelstring - 1] = '\0'; + data.headerstring[sizeof data.headerstring - 1] = '\0'; data.encore = encoremode; @@ -676,20 +694,32 @@ skiptallydrawer: } // 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 = - W_CachePatchName( - va("TT_RND%d", roundqueue.roundnum), - PU_PATCH - ); - V_DrawMappedPatch(240, 39, 0, roundpatch, NULL); + V_DrawMappedPatch(20 + xoffset, 24, 0, rtpbr, NULL); + + if (data.gotthrough) + { + // Draw "GOT THROUGH ROUND" + 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 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); } } } From 84a2a94b280d78a6d7f2ba66df8d744caac1c53d Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 7 May 2023 21:28:46 +0100 Subject: [PATCH 21/57] Reimplement bottom progression bar - Actually accomodates variable-length cups/roundqueues - Uses player skin and color for position indicator instead of iterating through results TODO: Make the Sealed Star entry a special case --- src/y_inter.c | 263 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 172 insertions(+), 91 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 420e3ad9e..cdd3a1513 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -924,27 +924,25 @@ skiptallydrawer: patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); patch_t *queuebg_down = W_CachePatchName("R_RMBG3", PU_PATCH); - patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); + //patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); - V_DrawMappedPatch(0, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(24, 167, 0, queuebg_upwa, greymap); - V_DrawMappedPatch(48, 167, 0, queuebg_down, greymap); + // Progression lines + patch_t *line_upwa[BPP_MAX]; + patch_t *line_down[BPP_MAX]; +// patch_t *line_flat[BPP_MAX]; - V_DrawMappedPatch(72, 167, 0, queuebg_upwa, greymap); - V_DrawMappedPatch(96, 167, 0, queuebg_down, greymap); - - V_DrawMappedPatch(120, 167, 0, queuebg_upwa, greymap); - V_DrawMappedPatch(144, 167, 0, queuebg_down, greymap); - - V_DrawMappedPatch(168, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(192, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(216, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(240, 167, 0, queuebg_flat, greymap); - - V_DrawMappedPatch(253, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(277, 167, 0, queuebg_prize, greymap); - V_DrawMappedPatch(301, 167, 0, queuebg_flat, greymap); + line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); + line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); + line_upwa[BPP_SHADOW] = W_CachePatchName("R_RRMLS1", PU_PATCH); + line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); + line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); + line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); +/* + line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); + line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); + line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); +*/ // Progress markers patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); patch_t *level_dot[BPP_MAIN]; @@ -960,82 +958,165 @@ skiptallydrawer: prize_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK4", PU_PATCH); prize_dot[BPP_DONE] = W_CachePatchName("R_RRMRK6", PU_PATCH); - // Progression lines - patch_t *line_upwa[BPP_MAX]; - patch_t *line_down[BPP_MAX]; - patch_t *line_flat[BPP_MAX]; - line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); - line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); - line_upwa[BPP_SHADOW] = W_CachePatchName("R_RRMLS1", PU_PATCH); + UINT8 *colormap = NULL, *oppositemap = NULL; + UINT8 pskin = MAXSKINS; + UINT16 pcolor = SKINCOLOR_NONE; - line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); - line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); - line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); - - line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); - line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); - line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); - - // Draw the lines - - for (i = 0; i < data.numplayers; i++) + if (whiteplayer < MAXPLAYERS + && playeringame[whiteplayer] + && players[whiteplayer].spectator == false + && players[whiteplayer].skin < numskins + && players[whiteplayer].skincolor < numskincolors + ) { - if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator && data.num[i] == consoleplayer) - { - UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - UINT8 *oppositemap = R_GetTranslationColormap(*data.character[i], skincolors[*data.color[i]].invcolor, GTC_CACHE); - INT32 roundx[6] = {0, 14, 38, 86, 110, 158}; - INT32 roundy[6] = {0, 165, 157, 157, 165, 165}; - INT32 rankx = roundx[roundqueue.roundnum]; - INT32 ranky = roundy[roundqueue.roundnum]; - - // now draw the actual lines - V_DrawMappedPatch(23, 178, 0, line_upwa[BPP_SHADOW], NULL); - V_DrawMappedPatch(23, 179, 0, line_upwa[roundqueue.roundnum > 1 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 1 ? colormap : NULL); - - V_DrawMappedPatch(47, 178, 0, line_down[BPP_SHADOW], NULL); - V_DrawMappedPatch(47, 179, 0, line_down[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 2 ? colormap : NULL); - - V_DrawMappedPatch(71, 178, 0, line_upwa[BPP_SHADOW], NULL); - V_DrawMappedPatch(71, 179, 0, line_upwa[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 2 ? colormap : NULL); - - V_DrawMappedPatch(95, 178, 0, line_down[BPP_SHADOW], NULL); - V_DrawMappedPatch(95, 179, 0, line_down[roundqueue.roundnum > 3 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 3 ? colormap : NULL); - - V_DrawMappedPatch(119, 178, 0, line_upwa[BPP_SHADOW], NULL); - V_DrawMappedPatch(119, 179, 0, line_upwa[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 4 ? colormap : NULL); - - V_DrawMappedPatch(143, 178, 0, line_down[BPP_SHADOW], NULL); - V_DrawMappedPatch(143, 179, 0, line_down[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum > 4 ? colormap : NULL); - - // haha funny 54-part progress bar - // i am a dumbass and there is probably a better way to do this - for (UINT16 x2 = 172; x2 < 284; x2 += 2) - { - // does not account for colormap since at the moment that will never be seen - V_DrawMappedPatch(x2, 177, 0, line_flat[BPP_SHADOW], NULL); - V_DrawMappedPatch(x2, 179, 0, line_flat[BPP_AHEAD], NULL); - } - - // Draw the progress markers - V_DrawMappedPatch(16, 179, 0, level_dot[roundqueue.roundnum > 0 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 1 ? oppositemap : colormap); - V_DrawMappedPatch(40, 171, 0, level_dot[roundqueue.roundnum > 1 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 2 ? oppositemap : colormap); - V_DrawMappedPatch(64, 179, 0, capsu_dot[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], colormap); // CAPSULE - - V_DrawMappedPatch(88, 171, 0, level_dot[roundqueue.roundnum > 2 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 3 ? oppositemap : colormap); - V_DrawMappedPatch(112, 179, 0, level_dot[roundqueue.roundnum > 3 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 4 ? oppositemap : colormap); - V_DrawMappedPatch(136, 171, 0, capsu_dot[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], colormap); // CAPSULE - V_DrawMappedPatch(160, 179, 0, level_dot[roundqueue.roundnum > 4 ? BPP_DONE : BPP_AHEAD], roundqueue.roundnum == 5 ? oppositemap : colormap); - - V_DrawMappedPatch(282, 179, 0, prize_dot[roundqueue.roundnum > 5 ? BPP_DONE : BPP_AHEAD], colormap); // EMERALD - - // Draw outline for rank icon - V_DrawMappedPatch(rankx, ranky, 0, rpmark, NULL); - - // Draw the player's rank icon - V_DrawMappedPatch(rankx + 1, ranky + 1, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); - } + pskin = players[whiteplayer].skin; + pcolor = players[whiteplayer].skincolor; } + + if (pcolor != SKINCOLOR_NONE) + { + colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); + oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); + } + + //x = 24; + x = (BASEVIDWIDTH - 24*(roundqueue.size - 1)) / 2; + + // Fill in background to left edge of screen + fixed_t xiter = x; + while (xiter > 0) + { + xiter -= 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + } + + for (i = 0; i < roundqueue.size; i++) + { + // Draw the background, and grab the appropriate line, to the right of the dot + patch_t **choose_line = NULL; + + if (i & 1) + { + y = 171; + + V_DrawMappedPatch(x, 167, 0, queuebg_down, greymap); + + if (i+1 != roundqueue.size) // no more line? + { + choose_line = line_down; + } + } + else + { + y = 179; + + if (i+1 != roundqueue.size) // no more line? + { + V_DrawMappedPatch(x, 167, 0, queuebg_upwa, greymap); + + choose_line = line_upwa; + } + else + { + V_DrawMappedPatch(x, 167, 0, queuebg_flat, greymap); + } + } + + // Draw the line to the right of the dot (if valid) + if (choose_line != NULL) + { + V_DrawMappedPatch( + x - 1, 178, + 0, + choose_line[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + x - 1, 179, + 0, + choose_line[roundqueue.position > i+1 ? BPP_DONE : BPP_AHEAD], + roundqueue.position > i+1 ? colormap : NULL + ); + } + + // Now draw the dot + patch_t **chose_dot = NULL; + + if (roundqueue.entries[i].rankrestricted == true) + { + chose_dot = prize_dot; + } + else if (grandprixinfo.gp == true + && roundqueue.entries[i].gametype != roundqueue.entries[0].gametype + ) + { + chose_dot = capsu_dot; + } + else + { + chose_dot = level_dot; + } + + if (chose_dot) + { + V_DrawMappedPatch( + x - 8, y, + 0, + chose_dot[roundqueue.position >= i+1 ? BPP_DONE : BPP_AHEAD], + roundqueue.position == i+1 ? oppositemap : colormap + ); + } + + // Draw the player position through the round queue! + if (roundqueue.position == i+1) + { + // Draw outline for rank icon + V_DrawMappedPatch( + x - 10, y - 14, + 0, rpmark, + NULL + ); + + if (pskin < numskins + && pcolor != SKINCOLOR_NONE + ) + { + // Draw the player's rank icon + V_DrawMappedPatch( + x - 9, y - 13, + 0, + faceprefix[pskin][FACE_RANK], + R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) + ); + } + } + + x += 24; + } + + // Fill in background to right edge of screen + xiter = x; + while (xiter < BASEVIDWIDTH) + { + V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + xiter += 24; + } + +/* + V_DrawMappedPatch(253, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(277, 167, 0, queuebg_prize, greymap); + V_DrawMappedPatch(301, 167, 0, queuebg_flat, greymap); + + // haha funny 54-part progress bar + // i am a dumbass and there is probably a better way to do this + for (UINT16 x2 = 172; x2 < 284; x2 += 2) + { + // does not account for colormap since at the moment that will never be seen + V_DrawMappedPatch(x2, 177, 0, line_flat[BPP_SHADOW], NULL); + V_DrawMappedPatch(x2, 179, 0, line_flat[BPP_AHEAD], NULL); + } +*/ } } From f4f52ede322b37f008b17d0620ed652fef0fbeec Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 7 May 2023 23:02:14 +0100 Subject: [PATCH 22/57] New consistent between-round countdowns using SmallNums - Intermission - Unlike before, shows in all contexts, not just netgame/netreplay - Voting - Replaces currently extant counter --- src/k_vote.c | 12 ++++++++---- src/y_inter.c | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/k_vote.c b/src/k_vote.c index 96c4c590f..3fb2c1375 100644 --- a/src/k_vote.c +++ b/src/k_vote.c @@ -846,10 +846,14 @@ void Y_VoteDrawer(void) { const INT32 tickDown = (vote.timer + 1) / TICRATE; - V_DrawCenteredString( - BASEVIDWIDTH/2, 188, - V_YELLOWMAP, - va("Vote ends in %d", tickDown) + // See also y_inter.c + V__DrawOneScaleString( + 2*FRACUNIT, + (BASEVIDHEIGHT - (2+8))*FRACUNIT, + FRACUNIT, + 0, NULL, + OPPRF_FONT, + va("%d", tickDown) ); } diff --git a/src/y_inter.c b/src/y_inter.c index cdd3a1513..620e0088d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1118,6 +1118,20 @@ skiptallydrawer: } */ } + + { + const INT32 tickDown = (timer + 1)/TICRATE; + + // See also k_vote.c + V__DrawOneScaleString( + 2*FRACUNIT, + (BASEVIDHEIGHT - (2+8))*FRACUNIT, + FRACUNIT, + 0, NULL, + OPPRF_FONT, + va("%d", tickDown) + ); + } } // From 0d9f8076f8deb36b706ca18f3cf0d71acf6e99c3 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 13:02:17 +0100 Subject: [PATCH 23/57] Re-add Auto gamespeed scramble text (temporary height) --- src/y_inter.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/y_inter.c b/src/y_inter.c index 620e0088d..2b47d61b5 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1119,6 +1119,15 @@ skiptallydrawer: */ } + if (netgame) + { + if (speedscramble != -1 && speedscramble != gamespeed) + { + V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, hilicol|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, + va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); + } + } + { const INT32 tickDown = (timer + 1)/TICRATE; From a333b265b44a19332f604fcfd2bc0896a950a084 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 13:04:25 +0100 Subject: [PATCH 24/57] Clean up material that is no longer necessary to keep around --- src/y_inter.c | 272 -------------------------------------------------- 1 file changed, 272 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 2b47d61b5..dede6ca84 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -99,7 +99,6 @@ static INT32 endtic = -1; static INT32 sorttic = -1; static INT32 replayprompttic; -// FUCK YOU static fixed_t mqscroll = 0; static fixed_t chkscroll = 0; @@ -322,277 +321,6 @@ typedef enum // void Y_IntermissionDrawer(void) { - -// dummy ALL OF THIS SHIT out, we're gonna be starting over. -#if 0 - INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = highlightflags; - - // If we early return, skip drawing the 3D scene (software buffer) so it doesn't clobber the frame for the wipe - g_wipeskiprender = true; - - if (intertype == int_none || rendermode == render_none) - return; - - g_wipeskiprender = false; - - // the merge was kind of a mess, how does this work -- toast 171021 - { - M_DrawMenuBackground(); - } - - if (renderisnewtic) - { - LUA_HUD_ClearDrawList(luahuddrawlist_intermission); - LUA_HookHUD(luahuddrawlist_intermission, HUD_HOOK(intermission)); - } - LUA_HUD_DrawList(luahuddrawlist_intermission); - - if (!LUA_HudEnabled(hud_intermissiontally)) - goto skiptallydrawer; - - if (!r_splitscreen) - whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; - - if (sorttic != -1 && intertic > sorttic) - { - INT32 count = (intertic - sorttic); - - if (count < 8) - x -= ((count * vid.width) / (8 * vid.dupx)); - else if (count == 8) - goto skiptallydrawer; - else if (count < 16) - x += (((16 - count) * vid.width) / (8 * vid.dupx)); - } - - if (intertype == int_time || intertype == int_score) - { -#define NUMFORNEWCOLUMN 8 - INT32 y = 41, gutter = ((data.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2)); - INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2; - const char *timeheader; - int y2; - - if (data.rankingsmode) - { - if (powertype == PWRLV_DISABLED) - { - timeheader = "RANK"; - } - else - { - timeheader = "PWR.LV"; - } - } - else - { - switch (intertype) - { - case int_score: - timeheader = "SCORE"; - break; - default: - timeheader = "TIME"; - break; - } - } - - // draw the level name - V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12, 0, data.levelstring); - V_DrawFill((x-3) - duptweak, 34, dupadjust-2, 1, 0); - - if (data.encore) - V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12-8, hilicol, "ENCORE MODE"); - - if (data.numplayers > NUMFORNEWCOLUMN) - { - V_DrawFill(x+156, 24, 1, 158, 0); - V_DrawFill((x-3) - duptweak, 182, dupadjust-2, 1, 0); - - V_DrawCenteredString(x+6+(BASEVIDWIDTH/2), 24, hilicol, "#"); - V_DrawString(x+36+(BASEVIDWIDTH/2), 24, hilicol, "NAME"); - - V_DrawRightAlignedString(x+152, 24, hilicol, timeheader); - } - - V_DrawCenteredString(x+6, 24, hilicol, "#"); - V_DrawString(x+36, 24, hilicol, "NAME"); - - V_DrawRightAlignedString(x+(BASEVIDWIDTH/2)+152, 24, hilicol, timeheader); - - for (i = 0; i < data.numplayers; i++) - { - boolean dojitter = data.jitter[data.num[i]]; - data.jitter[data.num[i]] = 0; - - if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator) - { - char strtime[MAXPLAYERNAME+1]; - - if (dojitter) - y--; - - V_DrawCenteredString(x+6, y, 0, va("%d", data.pos[i])); - - if (data.color[i]) - { - UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - V_DrawMappedPatch(x+16, y-4, 0, faceprefix[*data.character[i]][FACE_RANK], colormap); - } - - if (data.num[i] == whiteplayer) - { - UINT8 cursorframe = (intertic / 4) % 8; - V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE)); - } - - if ((players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) - { - // RETIRED!! - V_DrawScaledPatch(x+12, y-7, 0, W_CachePatchName("K_NOBLNS", PU_CACHE)); - } - - STRBUFCPY(strtime, data.name[i]); - - y2 = y; - - if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) - { - static int alagles_timer = 0; - patch_t *alagles; - - y2 = ( y - 4 ); - - V_DrawScaledPatch(x + 36, y2, 0, W_CachePatchName(va("BLAGLES%d", (intertic / 3) % 6), PU_CACHE)); - // every 70 tics - if (( leveltime % 70 ) == 0) - { - alagles_timer = 9; - } - if (alagles_timer > 0) - { - alagles = W_CachePatchName(va("ALAGLES%d", alagles_timer), PU_CACHE); - V_DrawScaledPatch(x + 36, y2, 0, alagles); - if (( leveltime % 2 ) == 0) - alagles_timer--; - } - else - { - alagles = W_CachePatchName("ALAGLES0", PU_CACHE); - V_DrawScaledPatch(x + 36, y2, 0, alagles); - } - - y2 += SHORT (alagles->height) + 1; - } - - if (data.numplayers > NUMFORNEWCOLUMN) - V_DrawThinString(x+36, y2-1, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); - else - V_DrawString(x+36, y2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime); - - if (data.rankingsmode) - { - if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) - { - // No power level (guests) - STRBUFCPY(strtime, "----"); - } - else - { - if (data.increase[data.num[i]] != INT16_MIN) - { - snprintf(strtime, sizeof strtime, "(%d)", data.increase[data.num[i]]); - - if (data.numplayers > NUMFORNEWCOLUMN) - V_DrawRightAlignedThinString(x+133+gutter, y-1, V_6WIDTHSPACE, strtime); - else - V_DrawRightAlignedString(x+118+gutter, y, 0, strtime); - } - - snprintf(strtime, sizeof strtime, "%d", data.val[i]); - } - - if (data.numplayers > NUMFORNEWCOLUMN) - V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime); - else - V_DrawRightAlignedString(x+152+gutter, y, 0, strtime); - } - else - { - if (data.val[i] == (UINT32_MAX-1)) - V_DrawRightAlignedThinString(x+152+gutter, y-1, (data.numplayers > NUMFORNEWCOLUMN ? V_6WIDTHSPACE : 0), "NO CONTEST."); - else - { - if (intertype == int_time) - { - snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), - G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); - strtime[sizeof strtime - 1] = '\0'; - - if (data.numplayers > NUMFORNEWCOLUMN) - V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime); - else - V_DrawRightAlignedString(x+152+gutter, y, 0, strtime); - } - else - { - if (data.numplayers > NUMFORNEWCOLUMN) - V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, va("%i", data.val[i])); - else - V_DrawRightAlignedString(x+152+gutter, y, 0, va("%i", data.val[i])); - } - } - } - - if (dojitter) - y++; - } - else - data.num[i] = MAXPLAYERS; // this should be the only field setting in this function - - y += 18; - - if (i == NUMFORNEWCOLUMN-1) - { - y = 41; - x += BASEVIDWIDTH/2; - } -#undef NUMFORNEWCOLUMN - } - } - -skiptallydrawer: - if (!LUA_HudEnabled(hud_intermissionmessages)) - return; - - if (timer) - { - if (netgame || demo.netgame) - { - char *string; - INT32 tickdown = (timer+1)/TICRATE; - - if (demo.playback) - string = va("Replay ends in %d", tickdown); - else if ((nextmapoverride != 0) - || (roundqueue.size > 0 && roundqueue.position < roundqueue.size)) - string = va("Next starts in %d", tickdown); - else - string = va("%s starts in %d", cv_advancemap.string, tickdown); - - V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol, string); - - if (speedscramble != -1 && speedscramble != gamespeed) - { - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, hilicol|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, - va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); - } - } - } - - M_DrawMenuForeground(); -#endif - // INFO SEGMENT // Numbers are V_DrawRightAlignedThinString WITH v_6widthspace as flags // resbar 1 (48,82) 5 (176, 82) From 4cb639307c43fe7cbb71bea2c7e97c0bbe5e81bb Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 15:00:16 +0100 Subject: [PATCH 25/57] Roundqueue rank-restricted entry special case visual - Show if you've ever visited a Special Stage - Show if you're on the final non-Special Stage cup round and you're on pace to enter - A horizontal line to the Prize option, which has its own unique bump around it. - Frustratingly has to be done inside the loop, due to overlap and order of operation issues. --- src/g_game.c | 1 + src/y_inter.c | 192 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 144 insertions(+), 49 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2798b516f..c88cca879 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4165,6 +4165,7 @@ static void G_GetNextMap(void) } else if (roundqueue.size > 0) { + // See also Y_CalculateMatchData boolean permitrank = false; if (grandprixinfo.gp == true && grandprixinfo.gamespeed >= KARTSPEED_NORMAL) diff --git a/src/y_inter.c b/src/y_inter.c index dede6ca84..a0438e2cf 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -80,6 +80,7 @@ typedef struct boolean rankingsmode; // rankings mode boolean gotthrough; // show "got through" + boolean showrank; // show rank-restricted queue entry at the end, if it exists boolean encore; // encore mode } y_data; @@ -224,6 +225,32 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) data.headerstring[sizeof data.headerstring - 1] = '\0'; + if (gamedata->everseenspecial == true) + { + data.showrank = true; + } + else + { + // See also G_GetNextMap + data.showrank = false; + if (grandprixinfo.gp == true + && grandprixinfo.gamespeed >= KARTSPEED_NORMAL + && roundqueue.size > 1 + && roundqueue.entries[roundqueue.size - 1].rankrestricted == true + ) + { + if (roundqueue.position == roundqueue.size) + { + data.showrank = true; + } + else if (roundqueue.position == roundqueue.size-1) + { + // On A rank pace? Then you get a chance for S rank! + data.showrank = (K_CalculateGPGrade(&grandprixinfo.rank) >= GRADE_A); + } + } + } + data.encore = encoremode; memset(data.jitter, 0, sizeof (data.jitter)); @@ -652,12 +679,12 @@ skiptallydrawer: patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); patch_t *queuebg_down = W_CachePatchName("R_RMBG3", PU_PATCH); - //patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); + patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); // Progression lines patch_t *line_upwa[BPP_MAX]; patch_t *line_down[BPP_MAX]; -// patch_t *line_flat[BPP_MAX]; + patch_t *line_flat[BPP_MAX]; line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); @@ -666,11 +693,11 @@ skiptallydrawer: line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); -/* + line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); -*/ + // Progress markers patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); patch_t *level_dot[BPP_MAIN]; @@ -687,6 +714,7 @@ skiptallydrawer: prize_dot[BPP_DONE] = W_CachePatchName("R_RRMRK6", PU_PATCH); UINT8 *colormap = NULL, *oppositemap = NULL; + fixed_t playerx = 0, playery = 0; UINT8 pskin = MAXSKINS; UINT16 pcolor = SKINCOLOR_NONE; @@ -707,8 +735,29 @@ skiptallydrawer: oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); } - //x = 24; - x = (BASEVIDWIDTH - 24*(roundqueue.size - 1)) / 2; + UINT8 workingqueuesize = roundqueue.size; + boolean upwa = false; + + if (roundqueue.size > 1 + && roundqueue.entries[roundqueue.size - 1].rankrestricted == true + ) + { + if (roundqueue.size & 1) + { + upwa = true; + } + + workingqueuesize--; + } + + if (data.showrank == true) + { + x = 24; + } + else + { + x = (BASEVIDWIDTH - 24*(workingqueuesize - 1)) / 2; + } // Fill in background to left edge of screen fixed_t xiter = x; @@ -718,18 +767,19 @@ skiptallydrawer: V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); } - for (i = 0; i < roundqueue.size; i++) + for (i = 0; i < workingqueuesize; i++) { // Draw the background, and grab the appropriate line, to the right of the dot patch_t **choose_line = NULL; - if (i & 1) + upwa ^= true; + if (upwa == false) { y = 171; V_DrawMappedPatch(x, 167, 0, queuebg_down, greymap); - if (i+1 != roundqueue.size) // no more line? + if (i+1 != workingqueuesize) // no more line? { choose_line = line_down; } @@ -738,7 +788,7 @@ skiptallydrawer: { y = 179; - if (i+1 != roundqueue.size) // no more line? + if (i+1 != workingqueuesize) // no more line? { V_DrawMappedPatch(x, 167, 0, queuebg_upwa, greymap); @@ -750,9 +800,10 @@ skiptallydrawer: } } - // Draw the line to the right of the dot (if valid) if (choose_line != NULL) { + // Draw the line to the right of the dot + V_DrawMappedPatch( x - 1, 178, 0, @@ -767,12 +818,68 @@ skiptallydrawer: roundqueue.position > i+1 ? colormap : NULL ); } + else + { + // No more line! Fill in background to right edge of screen + xiter = x; + while (xiter < BASEVIDWIDTH) + { + xiter += 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + } + + // Handle special entry on the end + // (has to be drawn before the semifinal dot due to overlap) + if (data.showrank == true) + { + const fixed_t x2 = 290; + + if (roundqueue.position == roundqueue.size) + { + playerx = x2; + playery = y; + } + + // Special background bump + V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); + + // Draw the final line + xiter = x + 6; + while (xiter < x2 - 6) + { + V_DrawMappedPatch( + xiter - 1, 177, + 0, + line_flat[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + xiter - 1, 179, + 0, + line_flat[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], + roundqueue.position == roundqueue.size ? colormap : NULL + ); + + xiter += 2; + } + + // Draw the final dot + V_DrawMappedPatch( + x2 - 8, y, + 0, + prize_dot[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], + roundqueue.position == roundqueue.size ? oppositemap : colormap + ); + } + } // Now draw the dot patch_t **chose_dot = NULL; if (roundqueue.entries[i].rankrestricted == true) { + // This shouldn't show up in regular play, but don't hide it entirely. chose_dot = prize_dot; } else if (grandprixinfo.gp == true @@ -796,55 +903,42 @@ skiptallydrawer: ); } - // Draw the player position through the round queue! if (roundqueue.position == i+1) { - // Draw outline for rank icon - V_DrawMappedPatch( - x - 10, y - 14, - 0, rpmark, - NULL - ); - - if (pskin < numskins - && pcolor != SKINCOLOR_NONE - ) - { - // Draw the player's rank icon - V_DrawMappedPatch( - x - 9, y - 13, - 0, - faceprefix[pskin][FACE_RANK], - R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) - ); - } + playerx = x; + playery = y; } x += 24; } - // Fill in background to right edge of screen - xiter = x; - while (xiter < BASEVIDWIDTH) + // Draw the player position through the round queue! + if (playery != 0) { - V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); - xiter += 24; - } + // Change alignment + playerx -= 10; + playery -= 14; -/* - V_DrawMappedPatch(253, 167, 0, queuebg_flat, greymap); - V_DrawMappedPatch(277, 167, 0, queuebg_prize, greymap); - V_DrawMappedPatch(301, 167, 0, queuebg_flat, greymap); + // Draw outline for rank icon + V_DrawMappedPatch( + playerx, playery, + 0, rpmark, + NULL + ); - // haha funny 54-part progress bar - // i am a dumbass and there is probably a better way to do this - for (UINT16 x2 = 172; x2 < 284; x2 += 2) - { - // does not account for colormap since at the moment that will never be seen - V_DrawMappedPatch(x2, 177, 0, line_flat[BPP_SHADOW], NULL); - V_DrawMappedPatch(x2, 179, 0, line_flat[BPP_AHEAD], NULL); + if (pskin < numskins + && pcolor != SKINCOLOR_NONE + ) + { + // Draw the player's rank icon + V_DrawMappedPatch( + playerx + 1, playery + 1, + 0, + faceprefix[pskin][FACE_RANK], + R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) + ); + } } -*/ } if (netgame) From 1ed022d69791db4fec92af2a99bd03dd6b2a2992 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 15:01:39 +0100 Subject: [PATCH 26/57] K_CeremonyDrawer: Adjust "EMERALD" option in case we don't come back to this later - Show as "???" if you've never been in a Special round before - Show as "PRIZE" if the cup doesn't use an Emerald --- src/k_podium.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/k_podium.c b/src/k_podium.c index 519c654e3..0a33844de 100644 --- a/src/k_podium.c +++ b/src/k_podium.c @@ -529,8 +529,21 @@ void K_CeremonyDrawer(void) } case 7: { + const char *emeraldstr = "???"; + if (gamedata->everseenspecial == true) + { + emeraldstr = + (grandprixinfo.gp == true + && grandprixinfo.cup != NULL + && grandprixinfo.cup->emeraldnum > 0) + ? "EMERALD" + : "PRIZE"; + } + V_DrawString(x, y, V_ALLOWLOWERCASE, - va("EMERALD: %s", (podiumData.rank.specialWon == true) ? "YES" : "NO") + va("%s: %s", + emeraldstr, + (podiumData.rank.specialWon == true) ? "YES" : "NO") ); break; } From b63246ccaf2df0ab1f769b84a678e46eb8fa4e8e Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 15:07:12 +0100 Subject: [PATCH 27/57] Fix erroneous case if there wasn't a special stage in the cup but gamedata->everseenspecial was true --- src/y_inter.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index a0438e2cf..49684b744 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -225,11 +225,6 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) data.headerstring[sizeof data.headerstring - 1] = '\0'; - if (gamedata->everseenspecial == true) - { - data.showrank = true; - } - else { // See also G_GetNextMap data.showrank = false; @@ -239,7 +234,8 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) && roundqueue.entries[roundqueue.size - 1].rankrestricted == true ) { - if (roundqueue.position == roundqueue.size) + if (gamedata->everseenspecial == true + || roundqueue.position == roundqueue.size) { data.showrank = true; } From 679e901e5fd42efabe255ff27a3515a9a397d63a Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 15:09:47 +0100 Subject: [PATCH 28/57] Fix not having a background ramp upwards when the first entry in the round queue is on the "upper level" of the zigzag --- src/y_inter.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/y_inter.c b/src/y_inter.c index 49684b744..524030cce 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -757,6 +757,13 @@ skiptallydrawer: // Fill in background to left edge of screen fixed_t xiter = x; + + if (upwa == true) + { + xiter -= 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_upwa, greymap); + } + while (xiter > 0) { xiter -= 24; From 9352b3ef07d4dd9e33a2681bcc608e35bd2ed7f1 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 15:18:54 +0100 Subject: [PATCH 29/57] Make the one-round case of the roundqueue more visually interesting --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 524030cce..7c0ba3410 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -732,7 +732,7 @@ skiptallydrawer: } UINT8 workingqueuesize = roundqueue.size; - boolean upwa = false; + boolean upwa = (roundqueue.size == 1); // Make the one round queued case more visually interesting if (roundqueue.size > 1 && roundqueue.entries[roundqueue.size - 1].rankrestricted == true From 6aea8859fe2ba9ee57980c2b246b038e33c5ccf8 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 17:46:25 +0100 Subject: [PATCH 30/57] G_MapIntoRoundQueue: Fix infinite loop if Cup has more bonus stages than regular stages --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index c88cca879..2047262e1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4066,7 +4066,7 @@ void G_MapIntoRoundQueue(UINT16 map, UINT8 setgametype, boolean setencore, boole void G_GPCupIntoRoundQueue(cupheader_t *cup, UINT8 setgametype, boolean setencore) { UINT8 i, levelindex = 0, bonusindex = 0; - UINT8 bonusmodulo = (cup->numlevels+1)/(cup->numbonus+1); + UINT8 bonusmodulo = max(1, (cup->numlevels+1)/(cup->numbonus+1)); UINT16 cupLevelNum; // Levels are added to the queue in the following pattern. From 9fca550ab6ac45e6eb9b3db50b57049f84cff598 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 23:58:24 +0100 Subject: [PATCH 31/57] Line meter fill animation for grade at the end of the race rounds in GP TODO: - Interpolation - Sounds --- src/y_inter.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 7c0ba3410..98c1d8c52 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -82,6 +82,8 @@ typedef struct boolean gotthrough; // show "got through" boolean showrank; // show rank-restricted queue entry at the end, if it exists boolean encore; // encore mode + + tic_t linemeter; // For GP only } y_data; static y_data data; @@ -234,16 +236,25 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) && roundqueue.entries[roundqueue.size - 1].rankrestricted == true ) { + if (roundqueue.position == roundqueue.size-1) + { + // On A rank pace? Then you get a chance for S rank! + gp_rank_e rankforline = K_CalculateGPGrade(&grandprixinfo.rank); + + data.showrank = (rankforline >= GRADE_A); + + data.linemeter = + (min(rankforline, GRADE_A) + * (2 * TICRATE) + ) / GRADE_A; + } + if (gamedata->everseenspecial == true || roundqueue.position == roundqueue.size) { + // Additional cases in which it should always be shown. data.showrank = true; } - else if (roundqueue.position == roundqueue.size-1) - { - // On A rank pace? Then you get a chance for S rank! - data.showrank = (K_CalculateGPGrade(&grandprixinfo.rank) >= GRADE_A); - } } } @@ -434,7 +445,7 @@ void Y_IntermissionDrawer(void) if (sorttic != -1 && intertic > sorttic) { - INT32 count = (intertic - sorttic); + const INT32 count = (intertic - sorttic); if (count < 8) xoffset = -((count * vid.width) / (8 * vid.dupx)); @@ -842,6 +853,24 @@ skiptallydrawer: playerx = x2; playery = y; } + else if (roundqueue.position == roundqueue.size-1 + && timer <= 2*TICRATE) + { + const fixed_t percent = FixedDiv( + min( + data.linemeter, + ((2*TICRATE) - (timer - 1)) + ) * FRACUNIT, + (2*TICRATE) * FRACUNIT + ); + + playerx = x + + FixedMul( + (x2 - x) * FRACUNIT, + percent + ) / FRACUNIT; + playery = y; + } // Special background bump V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); @@ -860,8 +889,8 @@ skiptallydrawer: V_DrawMappedPatch( xiter - 1, 179, 0, - line_flat[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], - roundqueue.position == roundqueue.size ? colormap : NULL + line_flat[(xiter < playerx) ? BPP_DONE : BPP_AHEAD], + (xiter < playerx) ? colormap : NULL ); xiter += 2; @@ -906,7 +935,7 @@ skiptallydrawer: ); } - if (roundqueue.position == i+1) + if (roundqueue.position == i+1 && playery == 0) { playerx = x; playery = y; From 5a20a4756f231405fb096242c510007e0387c49d Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 9 May 2023 17:11:41 +0100 Subject: [PATCH 32/57] Judder on incomplete fill for rank-based progression to Sealed Star - Cleaner handling of player arrow position through addition rather than overwrite - Cleaner inputs to FixedDiv --- src/y_inter.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 98c1d8c52..b1ca69304 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -83,7 +83,7 @@ typedef struct boolean showrank; // show rank-restricted queue entry at the end, if it exists boolean encore; // encore mode - tic_t linemeter; // For GP only + INT32 linemeter; // For GP only } y_data; static y_data data; @@ -814,6 +814,12 @@ skiptallydrawer: } } + if (roundqueue.position == i+1) + { + playerx = x; + playery = y; + } + if (choose_line != NULL) { // Draw the line to the right of the dot @@ -856,20 +862,30 @@ skiptallydrawer: else if (roundqueue.position == roundqueue.size-1 && timer <= 2*TICRATE) { + const INT32 through = ((2*TICRATE) - (timer - 1)); const fixed_t percent = FixedDiv( - min( - data.linemeter, - ((2*TICRATE) - (timer - 1)) - ) * FRACUNIT, + min( data.linemeter, through ) * FRACUNIT, (2*TICRATE) * FRACUNIT ); - playerx = x + + playerx += FixedMul( (x2 - x) * FRACUNIT, percent ) / FRACUNIT; - playery = y; + + if (timer > 2) + { + // Small judder + if (through == (data.linemeter + 1)) + { + playerx++; + } + else if (through == (data.linemeter + 2)) + { + playerx--; + } + } } // Special background bump @@ -935,12 +951,6 @@ skiptallydrawer: ); } - if (roundqueue.position == i+1 && playery == 0) - { - playerx = x; - playery = y; - } - x += 24; } From 0c63b76364399b2beaf0036b704d1c10237f58b6 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 9 May 2023 18:35:00 +0100 Subject: [PATCH 33/57] Funny little parabola for player pin on progression bar when progressing to new round --- src/y_inter.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index b1ca69304..cd884153e 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -818,6 +818,40 @@ skiptallydrawer: { playerx = x; playery = y; + + // If there's standard progression ahead of us, visibly move along it. + if (choose_line != NULL && timer <= 2*TICRATE) + { + // 8 tics is chosen because it plays nice + // with both the x and y distance to cover. + INT32 through = min((2*TICRATE) - (timer - 1), 8); + + // 24 pixels when all is said and done + playerx += through * 3; + + if (upwa == false) + { + playery += through; + } + else + { + playery -= through; + } + + if ((2*TICRATE) - (timer - 1) == 8) + { + // Impactful landing. + playery++; + } + else if (through > 0 && through < 8) + { + // Hoparabola and a skip. + const INT32 jumpfactor = (through - 4); + // jumpfactor squared goes through 36 -> 0 -> 36. + // 12 pixels is an arbitrary jump height, but we match it to invert the parabola. + playery -= (12 - ((jumpfactor * jumpfactor) / 3)); + } + } } if (choose_line != NULL) @@ -831,12 +865,69 @@ skiptallydrawer: NULL ); + boolean lineisfull = false, recttoclear = false; + + if (roundqueue.position > i+1) + { + lineisfull = true; + } + else if (roundqueue.position == i+1 && timer <= 2*TICRATE) + { + // 8 tics is chosen because it plays nice + // with both the x and y distance to cover. + const INT32 through = (2*TICRATE) - (timer - 1); + + if (through == 0) + { + ; // no change... + } + else if (through >= 8) + { + lineisfull = true; + } + else + { + const fixed_t lineborder = (playerx + 1) << FRACBITS; + V_SetClipRect( + 0, + 0, + lineborder, + BASEVIDHEIGHT << FRACBITS, + 0 + ); + + V_DrawMappedPatch( + x - 1, 179, + 0, + choose_line[BPP_DONE], + colormap + ); + + V_ClearClipRect(); + + V_SetClipRect( + lineborder, + 0, + BASEVIDWIDTH << FRACBITS, + BASEVIDHEIGHT << FRACBITS, + 0 + ); + + recttoclear = true; + } + } + V_DrawMappedPatch( x - 1, 179, 0, - choose_line[roundqueue.position > i+1 ? BPP_DONE : BPP_AHEAD], - roundqueue.position > i+1 ? colormap : NULL + choose_line[lineisfull ? BPP_DONE : BPP_AHEAD], + lineisfull ? colormap : NULL ); + + if (recttoclear == true) + { + V_ClearClipRect(); + } } else { From d7e0df8bd8065054bf427cf36032a49fa1a37fd0 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 9 May 2023 19:11:57 +0100 Subject: [PATCH 34/57] Change y coordinate of Song Credit on intermission screen to be along bottom --- src/hu_stuff.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 8b0c5c6a9..8fda4c111 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2131,17 +2131,24 @@ static void HU_DrawDemoInfo(void) // void HU_DrawSongCredits(void) { - fixed_t x; - fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT; - INT32 bgt; - if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def { return; } - bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2); - x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x); + fixed_t x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x); + fixed_t y; + + if (gamestate == GS_INTERMISSION) + { + y = (BASEVIDHEIGHT - 13) * FRACUNIT; + } + else + { + y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT; + } + + INT32 bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2); if (bgt < NUMTRANSMAPS) { From 9788df79e77cf2c47a88275d0b5a57f488609a37 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 9 May 2023 19:14:52 +0100 Subject: [PATCH 35/57] Hide song credit in artificial fade on menu-caused playsim start Technically unrelated but it was annoying me, and since I modified songcredit here I can attach it as a second bullet point --- src/menus/play-local-race-time-attack.c | 2 ++ src/menus/transient/cup-select.c | 4 ++++ src/menus/transient/level-select.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/menus/play-local-race-time-attack.c b/src/menus/play-local-race-time-attack.c index fac09dcc0..b44d6aba6 100644 --- a/src/menus/play-local-race-time-attack.c +++ b/src/menus/play-local-race-time-attack.c @@ -500,6 +500,8 @@ void M_StartTimeAttack(INT32 choice) paused = false; + S_StopMusicCredit(); + // Early fadeout to let the sound finish playing F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); diff --git a/src/menus/transient/cup-select.c b/src/menus/transient/cup-select.c index a83d5f2c9..c97246e04 100644 --- a/src/menus/transient/cup-select.c +++ b/src/menus/transient/cup-select.c @@ -108,6 +108,10 @@ void M_CupSelectHandler(INT32 choice) S_StartSound(NULL, sfx_s3k63); + paused = false; + + S_StopMusicCredit(); + // Early fadeout to let the sound finish playing F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 776789dc1..db6e257bb 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -538,6 +538,8 @@ void M_LevelSelected(INT16 add) paused = false; + S_StopMusicCredit(); + // Early fadeout to let the sound finish playing F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); From f42192f21d5226d353028bebbdce50b0ece79678 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 01:00:29 +0100 Subject: [PATCH 36/57] data.mainplayer Instead of using whiteplayer (which isn't handled in splitscreen) - Get the highest-ranked non-spectator player who's local (or display if demo.playback) - Show an alternate arrow (currently not in assets) if - no player was found - OR the player becomes a spectator - OR has otherwise invalid properties - Use SKINCOLOR_WHITE (and its invcolor) for associated colormaps in this case --- src/y_inter.c | 208 +++++++++++++++++++++++++++++++------------------- 1 file changed, 129 insertions(+), 79 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index cd884153e..3decc621f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -68,10 +68,10 @@ typedef struct char *name[MAXPLAYERS]; // Player's name UINT8 numplayers; // Number of players being displayed + UINT8 mainplayer; // Most successful local player char headerstring[64]; // holds levelnames up to 64 characters - // SRB2kart INT16 increase[MAXPLAYERS]; // how much did the score increase by? UINT8 jitter[MAXPLAYERS]; // wiggle @@ -161,6 +161,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) INT32 i, j; boolean completed[MAXPLAYERS]; INT32 numplayersingame = 0; + boolean getmainplayer = false; // Initialize variables if (rankingsmode > 1) @@ -172,60 +173,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) } else { - UINT8 whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; - - data.headerstring[0] = '\0'; - data.gotthrough = false; - - if (whiteplayer < MAXPLAYERS - && playeringame[whiteplayer] - && players[whiteplayer].spectator == false - ) - { - if (!(players[whiteplayer].pflags & PF_NOCONTEST)) - { - data.gotthrough = true; - - if (players[whiteplayer].skin < numskins) - { - snprintf(data.headerstring, - sizeof data.headerstring, - "%s", - skins[players[whiteplayer].skin].realname); - } - } - else - { - snprintf(data.headerstring, - sizeof data.headerstring, - "NO CONTEST..."); - } - } - else - { - if (bossinfo.valid == true && bossinfo.enemyname) - { - snprintf(data.headerstring, - sizeof data.headerstring, - "%s", - bossinfo.enemyname); - } - else if (battleprisons == true) - { - snprintf(data.headerstring, - sizeof data.headerstring, - "PRISON BREAK"); - } - else - { - snprintf(data.headerstring, - sizeof data.headerstring, - "%s STAGE", - gametypes[gametype]->name); - } - } - - data.headerstring[sizeof data.headerstring - 1] = '\0'; + getmainplayer = true; { // See also G_GetNextMap @@ -336,6 +284,93 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) data.numplayers++; } + + if (getmainplayer == true) + { + i = MAXPLAYERS; + + for (j = 0; j < data.numplayers; j++) + { + i = data.num[j]; + + if (i >= MAXPLAYERS + || playeringame[i] == false + || players[i].spectator == true) + { + continue; + } + + if (demo.playback) + { + if (!P_IsDisplayPlayer(&players[i])) + { + continue; + } + + break; + } + + if (!P_IsLocalPlayer(&players[i])) + { + continue; + } + + break; + } + + data.headerstring[0] = '\0'; + data.gotthrough = false; + data.mainplayer = MAXPLAYERS; + + if (j < data.numplayers) + { + data.mainplayer = i; + + if (!(players[i].pflags & PF_NOCONTEST)) + { + data.gotthrough = true; + + if (players[i].skin < numskins) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s", + skins[players[i].skin].realname); + } + } + else + { + snprintf(data.headerstring, + sizeof data.headerstring, + "NO CONTEST..."); + } + } + else + { + if (bossinfo.valid == true && bossinfo.enemyname) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s", + bossinfo.enemyname); + } + else if (battleprisons == true) + { + snprintf(data.headerstring, + sizeof data.headerstring, + "PRISON BREAK"); + } + else + { + snprintf(data.headerstring, + sizeof data.headerstring, + "%s STAGE", + gametypes[gametype]->name); + } + } + + data.headerstring[sizeof data.headerstring - 1] = '\0'; + } } typedef enum @@ -706,11 +741,14 @@ skiptallydrawer: line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); // Progress markers - patch_t *rpmark = W_CachePatchName("R_RPMARK", PU_PATCH); + patch_t *rpmark[2]; patch_t *level_dot[BPP_MAIN]; patch_t *capsu_dot[BPP_MAIN]; patch_t *prize_dot[BPP_MAIN]; + rpmark[0] = W_CachePatchName("R_RPMARK", PU_PATCH); + rpmark[1] = W_CachePatchName("R_R2MARK", PU_PATCH); + level_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK2", PU_PATCH); level_dot[BPP_DONE] = W_CachePatchName("R_RRMRK1", PU_PATCH); @@ -723,24 +761,28 @@ skiptallydrawer: UINT8 *colormap = NULL, *oppositemap = NULL; fixed_t playerx = 0, playery = 0; UINT8 pskin = MAXSKINS; - UINT16 pcolor = SKINCOLOR_NONE; + UINT16 pcolor = SKINCOLOR_WHITE; - if (whiteplayer < MAXPLAYERS - && playeringame[whiteplayer] - && players[whiteplayer].spectator == false - && players[whiteplayer].skin < numskins - && players[whiteplayer].skincolor < numskincolors + if (data.mainplayer == MAXPLAYERS) + { + ; + } + else if (playeringame[data.mainplayer] == false) + { + data.mainplayer = MAXPLAYERS; + } + else if (players[data.mainplayer].spectator == false + && players[data.mainplayer].skin < numskins + && players[data.mainplayer].skincolor != SKINCOLOR_NONE + && players[data.mainplayer].skincolor < numskincolors ) { - pskin = players[whiteplayer].skin; - pcolor = players[whiteplayer].skincolor; + pskin = players[data.mainplayer].skin; + pcolor = players[data.mainplayer].skincolor; } - if (pcolor != SKINCOLOR_NONE) - { - colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); - oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); - } + colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); + oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); UINT8 workingqueuesize = roundqueue.size; boolean upwa = (roundqueue.size == 1); // Make the one round queued case more visually interesting @@ -1052,17 +1094,15 @@ skiptallydrawer: playerx -= 10; playery -= 14; - // Draw outline for rank icon - V_DrawMappedPatch( - playerx, playery, - 0, rpmark, - NULL - ); - - if (pskin < numskins - && pcolor != SKINCOLOR_NONE - ) + if (pskin < numskins) { + // Draw outline for rank icon + V_DrawMappedPatch( + playerx, playery, + 0, rpmark[0], + NULL + ); + // Draw the player's rank icon V_DrawMappedPatch( playerx + 1, playery + 1, @@ -1071,6 +1111,16 @@ skiptallydrawer: R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) ); } + else + { + // Draw mini arrow + V_DrawMappedPatch( + playerx, playery, + 0, rpmark[1], + NULL + ); + + } } } From b4a1b7daf3388bd6f46072086644fa306bafdac0 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 01:04:30 +0100 Subject: [PATCH 37/57] Fix horizontal page scroll for cases where player results are centered --- src/y_inter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 3decc621f..27b784022 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -526,13 +526,15 @@ void Y_IntermissionDrawer(void) boolean verticalresults = (data.numplayers < 4); + x = xoffset; + if (verticalresults) { - x = (BASEVIDWIDTH/2) - 61; + x += (BASEVIDWIDTH/2) - 61; } else { - x = 29 + xoffset; + x += 29; heightcount /= 2; } From db5734b64dbd409a3388ebe47dd41e9998d7fa8e Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 01:09:35 +0100 Subject: [PATCH 38/57] On second thoughts, do not make the one-round roundqueue start in the upward position This is so the two-round roundqueue condition where the second round is a Sealed Star will not give the game away early, or be discontinuous --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 27b784022..1358a8e86 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -787,7 +787,7 @@ skiptallydrawer: oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); UINT8 workingqueuesize = roundqueue.size; - boolean upwa = (roundqueue.size == 1); // Make the one round queued case more visually interesting + boolean upwa = false; if (roundqueue.size > 1 && roundqueue.entries[roundqueue.size - 1].rankrestricted == true From cc4dbe48cf136d35249f0470ca860c20b08a57fb Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 12:46:34 +0100 Subject: [PATCH 39/57] Adjust timing of player pin hop impact --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 1358a8e86..861426608 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -882,7 +882,7 @@ skiptallydrawer: playery -= through; } - if ((2*TICRATE) - (timer - 1) == 8) + if ((2*TICRATE) - (timer - 1) == 9) { // Impactful landing. playery++; From d0daa096370dcf2a501eced01cd05d218d2bba8a Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 13:55:06 +0100 Subject: [PATCH 40/57] Interpolation of the Player Pin when moving to new round - Known hack: A one-frame offset if R_UsingFrameInterpolation() returns true - This permits the Sealed Star rank progression bar fill to reach the end. - It also allows us to match possible sound cue events between interp and non-interp frames. --- src/y_inter.c | 136 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 89 insertions(+), 47 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 861426608..9aedee949 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -32,6 +32,7 @@ #include "p_setup.h" #include "r_local.h" +#include "r_fps.h" #include "p_local.h" #include "m_cond.h" // condition sets @@ -475,6 +476,15 @@ void Y_IntermissionDrawer(void) } LUA_HUD_DrawList(luahuddrawlist_intermission); + // The following is functionally a hack. + // Due to how interpolation works, it's functionally one frame behind. + // So we offset certain interpolated timers by this to make our lives easier! + // This permits cues handled in the ticker and visuals to match up, + // like the player pin reaching the Sealed Star the frame of the fade. + // We also do this rather than doing extrapoleration because that would + // still put 35fps in the future. ~toast 100523 + SINT8 interpoffs = (R_UsingFrameInterpolation() ? 1 : 0); + if (!LUA_HudEnabled(hud_intermissiontally)) goto skiptallydrawer; @@ -860,15 +870,33 @@ skiptallydrawer: if (roundqueue.position == i+1) { - playerx = x; - playery = y; + playerx = (x * FRACUNIT); + playery = (y * FRACUNIT); // If there's standard progression ahead of us, visibly move along it. - if (choose_line != NULL && timer <= 2*TICRATE) + if (choose_line != NULL && timer - interpoffs <= 2*TICRATE) { // 8 tics is chosen because it plays nice // with both the x and y distance to cover. - INT32 through = min((2*TICRATE) - (timer - 1), 8); + fixed_t through = (2*TICRATE) - (timer - interpoffs - 1);; + + if (through > 8) + { + if (through == 9 + interpoffs) + { + // Impactful landing + playery += FRACUNIT; + } + + through = 8 * FRACUNIT; + } + else + { + through = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ); + } // 24 pixels when all is said and done playerx += through * 3; @@ -882,18 +910,15 @@ skiptallydrawer: playery -= through; } - if ((2*TICRATE) - (timer - 1) == 9) - { - // Impactful landing. - playery++; - } - else if (through > 0 && through < 8) + if (through > 0 && through < 8 * FRACUNIT) { // Hoparabola and a skip. - const INT32 jumpfactor = (through - 4); + const fixed_t jumpfactor = through - (4 * FRACUNIT); // jumpfactor squared goes through 36 -> 0 -> 36. // 12 pixels is an arbitrary jump height, but we match it to invert the parabola. - playery -= (12 - ((jumpfactor * jumpfactor) / 3)); + playery -= ((12 * FRACUNIT) + - (FixedMul(jumpfactor, jumpfactor) / 3) + ); } } } @@ -915,23 +940,23 @@ skiptallydrawer: { lineisfull = true; } - else if (roundqueue.position == i+1 && timer <= 2*TICRATE) + else if (roundqueue.position == i+1 && timer - interpoffs <= 2*TICRATE) { // 8 tics is chosen because it plays nice // with both the x and y distance to cover. - const INT32 through = (2*TICRATE) - (timer - 1); + const INT32 through = (2*TICRATE) - (timer - interpoffs - 1); if (through == 0) { ; // no change... } - else if (through >= 8) + else if (through > 8) { lineisfull = true; } else { - const fixed_t lineborder = (playerx + 1) << FRACBITS; + const fixed_t lineborder = playerx + FRACUNIT; V_SetClipRect( 0, 0, @@ -991,15 +1016,43 @@ skiptallydrawer: if (roundqueue.position == roundqueue.size) { - playerx = x2; - playery = y; + playerx = (x2 * FRACUNIT); + playery = (y * FRACUNIT); } else if (roundqueue.position == roundqueue.size-1 - && timer <= 2*TICRATE) + && timer - interpoffs <= 2*TICRATE) { - const INT32 through = ((2*TICRATE) - (timer - 1)); + const INT32 through = ((2*TICRATE) - (timer - interpoffs - 1)); + fixed_t linefill; + + if (through > data.linemeter) + { + linefill = data.linemeter * FRACUNIT; + + // Small judder if there's enough time for it + if (timer <= 2) + { + ; + } + else if (through == (data.linemeter + 1 + interpoffs)) + { + playerx += FRACUNIT; + } + else if (through == (data.linemeter + 2 + interpoffs)) + { + playerx -= FRACUNIT; + } + } + else + { + linefill = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ); + } + const fixed_t percent = FixedDiv( - min( data.linemeter, through ) * FRACUNIT, + linefill, (2*TICRATE) * FRACUNIT ); @@ -1007,20 +1060,7 @@ skiptallydrawer: FixedMul( (x2 - x) * FRACUNIT, percent - ) / FRACUNIT; - - if (timer > 2) - { - // Small judder - if (through == (data.linemeter + 1)) - { - playerx++; - } - else if (through == (data.linemeter + 2)) - { - playerx--; - } - } + ); } // Special background bump @@ -1028,6 +1068,7 @@ skiptallydrawer: // Draw the final line xiter = x + 6; + const fixed_t fillend = (playerx / FRACUNIT); while (xiter < x2 - 6) { V_DrawMappedPatch( @@ -1040,8 +1081,8 @@ skiptallydrawer: V_DrawMappedPatch( xiter - 1, 179, 0, - line_flat[(xiter < playerx) ? BPP_DONE : BPP_AHEAD], - (xiter < playerx) ? colormap : NULL + line_flat[(xiter < fillend) ? BPP_DONE : BPP_AHEAD], + (xiter < fillend) ? colormap : NULL ); xiter += 2; @@ -1093,22 +1134,23 @@ skiptallydrawer: if (playery != 0) { // Change alignment - playerx -= 10; - playery -= 14; + playerx -= (10 * FRACUNIT); + playery -= (14 * FRACUNIT); if (pskin < numskins) { // Draw outline for rank icon - V_DrawMappedPatch( + V_DrawFixedPatch( playerx, playery, - 0, rpmark[0], + FRACUNIT, 0, + rpmark[0], NULL ); // Draw the player's rank icon - V_DrawMappedPatch( - playerx + 1, playery + 1, - 0, + V_DrawFixedPatch( + playerx + FRACUNIT, playery + FRACUNIT, + FRACUNIT, 0, faceprefix[pskin][FACE_RANK], R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) ); @@ -1116,12 +1158,12 @@ skiptallydrawer: else { // Draw mini arrow - V_DrawMappedPatch( + V_DrawFixedPatch( playerx, playery, - 0, rpmark[1], + FRACUNIT, 0, + rpmark[1], NULL ); - } } } From 174b58c0439d8f6603315dd4c03a9fba9b25d195 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 14:40:55 +0100 Subject: [PATCH 41/57] Pixel perfect progression bar filling - Final line now ALSO uses ClipRect - Reduce existing overreliance on ClipRect. A little overdraw is fine to prevent gaps --- src/y_inter.c | 103 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 28 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 9aedee949..b04281b87 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -956,15 +956,6 @@ skiptallydrawer: } else { - const fixed_t lineborder = playerx + FRACUNIT; - V_SetClipRect( - 0, - 0, - lineborder, - BASEVIDHEIGHT << FRACBITS, - 0 - ); - V_DrawMappedPatch( x - 1, 179, 0, @@ -972,10 +963,8 @@ skiptallydrawer: colormap ); - V_ClearClipRect(); - V_SetClipRect( - lineborder, + playerx + FRACUNIT, 0, BASEVIDWIDTH << FRACBITS, BASEVIDHEIGHT << FRACBITS, @@ -1067,25 +1056,83 @@ skiptallydrawer: V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); // Draw the final line - xiter = x + 6; - const fixed_t fillend = (playerx / FRACUNIT); - while (xiter < x2 - 6) + const fixed_t barstart = x + 6; + const fixed_t barend = x2 - 6; + + if (barend - 2 >= barstart) { - V_DrawMappedPatch( - xiter - 1, 177, - 0, - line_flat[BPP_SHADOW], - NULL - ); + boolean lineisfull = false, recttoclear = false; - V_DrawMappedPatch( - xiter - 1, 179, - 0, - line_flat[(xiter < fillend) ? BPP_DONE : BPP_AHEAD], - (xiter < fillend) ? colormap : NULL - ); + xiter = barstart; - xiter += 2; + if (playerx >= (barend + 1) * FRACUNIT) + { + lineisfull = true; + } + else if (playerx <= (barstart - 1) * FRACUNIT) + { + ; + } + else + { + const fixed_t fillend = min((playerx / FRACUNIT) + 2, barend); + + while (xiter < fillend) + { + V_DrawMappedPatch( + xiter - 1, 177, + 0, + line_flat[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + xiter - 1, 179, + 0, + line_flat[BPP_DONE], + colormap + ); + + xiter += 2; + } + + // Undo the last step so we can draw the unfilled area of the patch. + xiter -= 2; + + V_SetClipRect( + playerx, + 0, + BASEVIDWIDTH << FRACBITS, + BASEVIDHEIGHT << FRACBITS, + 0 + ); + + recttoclear = true; + } + + while (xiter < barend) + { + V_DrawMappedPatch( + xiter - 1, 177, + 0, + line_flat[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + xiter - 1, 179, + 0, + line_flat[lineisfull ? BPP_DONE : BPP_AHEAD], + lineisfull ? colormap : NULL + ); + + xiter += 2; + } + + if (recttoclear == true) + { + V_ClearClipRect(); + } } // Draw the final dot From e3c3a8c80a4704da7eb697a372d5a3d64e9057f7 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 10 May 2023 20:40:01 +0100 Subject: [PATCH 42/57] Sliding of the progression bar - On the last non-rank-restricted round in the queue, if the final entry is visible (you've been to it before OR you're just about to go to it for the first time), slide over before the bar fills up. - Adds one second to the timer to give it extra breathing room --- src/y_inter.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 6 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index b04281b87..440bf91fc 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -49,6 +49,7 @@ #include "k_pwrlv.h" #include "k_grandprix.h" #include "k_color.h" +#include "m_easing.h" #ifdef HWRENDER #include "hardware/hw_main.h" @@ -180,6 +181,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) // See also G_GetNextMap data.showrank = false; if (grandprixinfo.gp == true + && netgame == false // TODO netgame Special Mode support && grandprixinfo.gamespeed >= KARTSPEED_NORMAL && roundqueue.size > 1 && roundqueue.entries[roundqueue.size - 1].rankrestricted == true @@ -196,6 +198,9 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) (min(rankforline, GRADE_A) * (2 * TICRATE) ) / GRADE_A; + + // A little extra time to take it all in + timer += TICRATE; } if (gamedata->everseenspecial == true @@ -811,13 +816,64 @@ skiptallydrawer: workingqueuesize--; } + INT32 widthofroundqueue = 24*(workingqueuesize - 1); + + x = (BASEVIDWIDTH - widthofroundqueue) / 2; + + const INT32 desiredx2 = 290; + const INT32 spacetospecial = max(desiredx2 - widthofroundqueue - 24, 16); + + // The following block handles horizontal easing of the + // progression bar on the last non-rankrestricted round. if (data.showrank == true) { - x = 24; - } - else - { - x = (BASEVIDWIDTH - 24*(workingqueuesize - 1)) / 2; + fixed_t percentslide = 0; + SINT8 deferxoffs = 0; + + if (roundqueue.position == roundqueue.size) + { + percentslide = FRACUNIT; + } + else if (roundqueue.position == roundqueue.size-1 + && timer - interpoffs <= 3*TICRATE) + { + const INT32 through = (3*TICRATE) - (timer - interpoffs - 1); + const INT32 slidetime = (TICRATE/2); + + if (through >= slidetime) + { + percentslide = FRACUNIT; + } + else + { + percentslide = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ) / slidetime; + } + } + + if (percentslide == 0) + { + ; + } + else + { + const INT32 differencetocover = (x + widthofroundqueue + spacetospecial - desiredx2); + + if (percentslide == FRACUNIT) + { + x -= (differencetocover + deferxoffs); + } + else + { + x -= Easing_OutCubic( + percentslide, + 0, + differencetocover * FRACUNIT + ) / FRACUNIT; + } + } } // Fill in background to left edge of screen @@ -1001,7 +1057,7 @@ skiptallydrawer: // (has to be drawn before the semifinal dot due to overlap) if (data.showrank == true) { - const fixed_t x2 = 290; + const fixed_t x2 = x + spacetospecial; if (roundqueue.position == roundqueue.size) { From 0a7e8d9bf36710efcdb655f238cee4e79dc1a745 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 14:07:07 +0100 Subject: [PATCH 43/57] Y_RoundQueueDrawer Reduces how absolutely monolithic Y_IntermissionDrawer is. --- src/y_inter.c | 1113 +++++++++++++++++++++++++------------------------ src/y_inter.h | 3 + 2 files changed, 567 insertions(+), 549 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 440bf91fc..1b599a94b 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -388,6 +388,568 @@ typedef enum BPP_MAX } bottomprogressionpatch_t; +// +// Y_RoundQueueDrawer +// +// Handles drawing the bottom-of-screen progression. +// Currently requires intermission y_data to be active, but abstraction is feasible. +// +void Y_RoundQueueDrawer(void) +{ + if (roundqueue.size == 0) + { + return; + } + + // The following is functionally a hack. + // Due to how interpolation works, it's functionally one frame behind. + // So we offset certain interpolated timers by this to make our lives easier! + // This permits cues handled in the ticker and visuals to match up, + // like the player pin reaching the Sealed Star the frame of the fade. + // We also do this rather than doing extrapoleration because that would + // still put 35fps in the future. ~toast 100523 + SINT8 interpoffs = (R_UsingFrameInterpolation() ? 1 : 0); + + UINT8 i; + + UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); + + // Background pieces + patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); + patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); + patch_t *queuebg_down = W_CachePatchName("R_RMBG3", PU_PATCH); + patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); + + // Progression lines + patch_t *line_upwa[BPP_MAX]; + patch_t *line_down[BPP_MAX]; + patch_t *line_flat[BPP_MAX]; + + line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); + line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); + line_upwa[BPP_SHADOW] = W_CachePatchName("R_RRMLS1", PU_PATCH); + + line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); + line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); + line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); + + line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); + line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); + line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); + + // Progress markers + patch_t *level_dot[BPP_MAIN]; + patch_t *capsu_dot[BPP_MAIN]; + patch_t *prize_dot[BPP_MAIN]; + + level_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK2", PU_PATCH); + level_dot[BPP_DONE] = W_CachePatchName("R_RRMRK1", PU_PATCH); + + capsu_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK3", PU_PATCH); + capsu_dot[BPP_DONE] = W_CachePatchName("R_RRMRK5", PU_PATCH); + + prize_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK4", PU_PATCH); + prize_dot[BPP_DONE] = W_CachePatchName("R_RRMRK6", PU_PATCH); + + UINT8 *colormap = NULL, *oppositemap = NULL; + fixed_t playerx = 0, playery = 0; + UINT8 pskin = MAXSKINS; + UINT16 pcolor = SKINCOLOR_WHITE; + + if (data.mainplayer == MAXPLAYERS) + { + ; + } + else if (playeringame[data.mainplayer] == false) + { + data.mainplayer = MAXPLAYERS; + } + else if (players[data.mainplayer].spectator == false + && players[data.mainplayer].skin < numskins + && players[data.mainplayer].skincolor != SKINCOLOR_NONE + && players[data.mainplayer].skincolor < numskincolors + ) + { + pskin = players[data.mainplayer].skin; + pcolor = players[data.mainplayer].skincolor; + } + + colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); + oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); + + UINT8 workingqueuesize = roundqueue.size; + boolean upwa = false; + + if (roundqueue.size > 1 + && roundqueue.entries[roundqueue.size - 1].rankrestricted == true + ) + { + if (roundqueue.size & 1) + { + upwa = true; + } + + workingqueuesize--; + } + + INT32 widthofroundqueue = 24*(workingqueuesize - 1); + + INT32 x = (BASEVIDWIDTH - widthofroundqueue) / 2; + INT32 y; + + INT32 spacetospecial = 0; + + // The following block handles horizontal easing of the + // progression bar on the last non-rankrestricted round. + if (data.showrank == true) + { + fixed_t percentslide = 0; + SINT8 deferxoffs = 0; + + const INT32 desiredx2 = 290; + spacetospecial = max(desiredx2 - widthofroundqueue - 24, 16); + + if (roundqueue.position == roundqueue.size) + { + percentslide = FRACUNIT; + } + else if (roundqueue.position == roundqueue.size-1 + && timer - interpoffs <= 3*TICRATE) + { + const INT32 through = (3*TICRATE) - (timer - interpoffs - 1); + const INT32 slidetime = (TICRATE/2); + + if (through >= slidetime) + { + percentslide = FRACUNIT; + } + else + { + percentslide = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ) / slidetime; + } + } + + if (percentslide != 0) + { + const INT32 differencetocover = (x + widthofroundqueue + spacetospecial - desiredx2); + + if (percentslide == FRACUNIT) + { + x -= (differencetocover + deferxoffs); + } + else + { + x -= Easing_OutCubic( + percentslide, + 0, + differencetocover * FRACUNIT + ) / FRACUNIT; + } + } + } + + // Fill in background to left edge of screen + fixed_t xiter = x; + + if (upwa == true) + { + xiter -= 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_upwa, greymap); + } + + while (xiter > 0) + { + xiter -= 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + } + + for (i = 0; i < workingqueuesize; i++) + { + // Draw the background, and grab the appropriate line, to the right of the dot + patch_t **choose_line = NULL; + + upwa ^= true; + if (upwa == false) + { + y = 171; + + V_DrawMappedPatch(x, 167, 0, queuebg_down, greymap); + + if (i+1 != workingqueuesize) // no more line? + { + choose_line = line_down; + } + } + else + { + y = 179; + + if (i+1 != workingqueuesize) // no more line? + { + V_DrawMappedPatch(x, 167, 0, queuebg_upwa, greymap); + + choose_line = line_upwa; + } + else + { + V_DrawMappedPatch(x, 167, 0, queuebg_flat, greymap); + } + } + + if (roundqueue.position == i+1) + { + playerx = (x * FRACUNIT); + playery = (y * FRACUNIT); + + // If there's standard progression ahead of us, visibly move along it. + if (choose_line != NULL && timer - interpoffs <= 2*TICRATE) + { + // 8 tics is chosen because it plays nice + // with both the x and y distance to cover. + fixed_t through = (2*TICRATE) - (timer - interpoffs - 1);; + + if (through > 8) + { + if (through == 9 + interpoffs) + { + // Impactful landing + playery += FRACUNIT; + } + + through = 8 * FRACUNIT; + } + else + { + through = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ); + } + + // 24 pixels when all is said and done + playerx += through * 3; + + if (upwa == false) + { + playery += through; + } + else + { + playery -= through; + } + + if (through > 0 && through < 8 * FRACUNIT) + { + // Hoparabola and a skip. + const fixed_t jumpfactor = through - (4 * FRACUNIT); + // jumpfactor squared goes through 36 -> 0 -> 36. + // 12 pixels is an arbitrary jump height, but we match it to invert the parabola. + playery -= ((12 * FRACUNIT) + - (FixedMul(jumpfactor, jumpfactor) / 3) + ); + } + } + } + + if (choose_line != NULL) + { + // Draw the line to the right of the dot + + V_DrawMappedPatch( + x - 1, 178, + 0, + choose_line[BPP_SHADOW], + NULL + ); + + boolean lineisfull = false, recttoclear = false; + + if (roundqueue.position > i+1) + { + lineisfull = true; + } + else if (roundqueue.position == i+1 && timer - interpoffs <= 2*TICRATE) + { + // 8 tics is chosen because it plays nice + // with both the x and y distance to cover. + const INT32 through = (2*TICRATE) - (timer - interpoffs - 1); + + if (through == 0) + { + ; // no change... + } + else if (through > 8) + { + lineisfull = true; + } + else + { + V_DrawMappedPatch( + x - 1, 179, + 0, + choose_line[BPP_DONE], + colormap + ); + + V_SetClipRect( + playerx + FRACUNIT, + 0, + BASEVIDWIDTH << FRACBITS, + BASEVIDHEIGHT << FRACBITS, + 0 + ); + + recttoclear = true; + } + } + + V_DrawMappedPatch( + x - 1, 179, + 0, + choose_line[lineisfull ? BPP_DONE : BPP_AHEAD], + lineisfull ? colormap : NULL + ); + + if (recttoclear == true) + { + V_ClearClipRect(); + } + } + else + { + // No more line! Fill in background to right edge of screen + xiter = x; + while (xiter < BASEVIDWIDTH) + { + xiter += 24; + V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + } + + // Handle special entry on the end + // (has to be drawn before the semifinal dot due to overlap) + if (data.showrank == true) + { + const fixed_t x2 = x + spacetospecial; + + if (roundqueue.position == roundqueue.size) + { + playerx = (x2 * FRACUNIT); + playery = (y * FRACUNIT); + } + else if (roundqueue.position == roundqueue.size-1 + && timer - interpoffs <= 2*TICRATE) + { + const INT32 through = ((2*TICRATE) - (timer - interpoffs - 1)); + fixed_t linefill; + + if (through > data.linemeter) + { + linefill = data.linemeter * FRACUNIT; + + // Small judder if there's enough time for it + if (timer <= 2) + { + ; + } + else if (through == (data.linemeter + 1 + interpoffs)) + { + playerx += FRACUNIT; + } + else if (through == (data.linemeter + 2 + interpoffs)) + { + playerx -= FRACUNIT; + } + } + else + { + linefill = R_InterpolateFixed( + (through - 1) * FRACUNIT, + (through * FRACUNIT) + ); + } + + const fixed_t percent = FixedDiv( + linefill, + (2*TICRATE) * FRACUNIT + ); + + playerx += + FixedMul( + (x2 - x) * FRACUNIT, + percent + ); + } + + // Special background bump + V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); + + // Draw the final line + const fixed_t barstart = x + 6; + const fixed_t barend = x2 - 6; + + if (barend - 2 >= barstart) + { + boolean lineisfull = false, recttoclear = false; + + xiter = barstart; + + if (playerx >= (barend + 1) * FRACUNIT) + { + lineisfull = true; + } + else if (playerx <= (barstart - 1) * FRACUNIT) + { + ; + } + else + { + const fixed_t fillend = min((playerx / FRACUNIT) + 2, barend); + + while (xiter < fillend) + { + V_DrawMappedPatch( + xiter - 1, 177, + 0, + line_flat[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + xiter - 1, 179, + 0, + line_flat[BPP_DONE], + colormap + ); + + xiter += 2; + } + + // Undo the last step so we can draw the unfilled area of the patch. + xiter -= 2; + + V_SetClipRect( + playerx, + 0, + BASEVIDWIDTH << FRACBITS, + BASEVIDHEIGHT << FRACBITS, + 0 + ); + + recttoclear = true; + } + + while (xiter < barend) + { + V_DrawMappedPatch( + xiter - 1, 177, + 0, + line_flat[BPP_SHADOW], + NULL + ); + + V_DrawMappedPatch( + xiter - 1, 179, + 0, + line_flat[lineisfull ? BPP_DONE : BPP_AHEAD], + lineisfull ? colormap : NULL + ); + + xiter += 2; + } + + if (recttoclear == true) + { + V_ClearClipRect(); + } + } + + // Draw the final dot + V_DrawMappedPatch( + x2 - 8, y, + 0, + prize_dot[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], + roundqueue.position == roundqueue.size ? oppositemap : colormap + ); + } + } + + // Now draw the dot + patch_t **chose_dot = NULL; + + if (roundqueue.entries[i].rankrestricted == true) + { + // This shouldn't show up in regular play, but don't hide it entirely. + chose_dot = prize_dot; + } + else if (grandprixinfo.gp == true + && roundqueue.entries[i].gametype != roundqueue.entries[0].gametype + ) + { + chose_dot = capsu_dot; + } + else + { + chose_dot = level_dot; + } + + if (chose_dot) + { + V_DrawMappedPatch( + x - 8, y, + 0, + chose_dot[roundqueue.position >= i+1 ? BPP_DONE : BPP_AHEAD], + roundqueue.position == i+1 ? oppositemap : colormap + ); + } + + x += 24; + } + + // Draw the player position through the round queue! + if (playery != 0) + { + patch_t *rpmark[2]; + rpmark[0] = W_CachePatchName("R_RPMARK", PU_PATCH); + rpmark[1] = W_CachePatchName("R_R2MARK", PU_PATCH); + + // Change alignment + playerx -= (10 * FRACUNIT); + playery -= (14 * FRACUNIT); + + if (pskin < numskins) + { + // Draw outline for rank icon + V_DrawFixedPatch( + playerx, playery, + FRACUNIT, 0, + rpmark[0], + NULL + ); + + // Draw the player's rank icon + V_DrawFixedPatch( + playerx + FRACUNIT, playery + FRACUNIT, + FRACUNIT, 0, + faceprefix[pskin][FACE_RANK], + R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) + ); + } + else + { + // Draw mini arrow + V_DrawFixedPatch( + playerx, playery, + FRACUNIT, 0, + rpmark[1], + NULL + ); + } + } +} + // // Y_IntermissionDrawer // @@ -481,15 +1043,6 @@ void Y_IntermissionDrawer(void) } LUA_HUD_DrawList(luahuddrawlist_intermission); - // The following is functionally a hack. - // Due to how interpolation works, it's functionally one frame behind. - // So we offset certain interpolated timers by this to make our lives easier! - // This permits cues handled in the ticker and visuals to match up, - // like the player pin reaching the Sealed Star the frame of the fade. - // We also do this rather than doing extrapoleration because that would - // still put 35fps in the future. ~toast 100523 - SINT8 interpoffs = (R_UsingFrameInterpolation() ? 1 : 0); - if (!LUA_HudEnabled(hud_intermissiontally)) goto skiptallydrawer; @@ -730,546 +1283,8 @@ skiptallydrawer: if (!LUA_HudEnabled(hud_intermissionmessages)) return; - if (roundqueue.size > 0) - { - UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); - - // Background pieces - patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); - patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); - patch_t *queuebg_down = W_CachePatchName("R_RMBG3", PU_PATCH); - patch_t *queuebg_prize = W_CachePatchName("R_RMBG4", PU_PATCH); - - // Progression lines - patch_t *line_upwa[BPP_MAX]; - patch_t *line_down[BPP_MAX]; - patch_t *line_flat[BPP_MAX]; - - line_upwa[BPP_AHEAD] = W_CachePatchName("R_RRMLN1", PU_PATCH); - line_upwa[BPP_DONE] = W_CachePatchName("R_RRMLN3", PU_PATCH); - line_upwa[BPP_SHADOW] = W_CachePatchName("R_RRMLS1", PU_PATCH); - - line_down[BPP_AHEAD] = W_CachePatchName("R_RRMLN2", PU_PATCH); - line_down[BPP_DONE] = W_CachePatchName("R_RRMLN4", PU_PATCH); - line_down[BPP_SHADOW] = W_CachePatchName("R_RRMLS2", PU_PATCH); - - line_flat[BPP_AHEAD] = W_CachePatchName("R_RRMLN5", PU_PATCH); - line_flat[BPP_DONE] = W_CachePatchName("R_RRMLN6", PU_PATCH); - line_flat[BPP_SHADOW] = W_CachePatchName("R_RRMLS3", PU_PATCH); - - // Progress markers - patch_t *rpmark[2]; - patch_t *level_dot[BPP_MAIN]; - patch_t *capsu_dot[BPP_MAIN]; - patch_t *prize_dot[BPP_MAIN]; - - rpmark[0] = W_CachePatchName("R_RPMARK", PU_PATCH); - rpmark[1] = W_CachePatchName("R_R2MARK", PU_PATCH); - - level_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK2", PU_PATCH); - level_dot[BPP_DONE] = W_CachePatchName("R_RRMRK1", PU_PATCH); - - capsu_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK3", PU_PATCH); - capsu_dot[BPP_DONE] = W_CachePatchName("R_RRMRK5", PU_PATCH); - - prize_dot[BPP_AHEAD] = W_CachePatchName("R_RRMRK4", PU_PATCH); - prize_dot[BPP_DONE] = W_CachePatchName("R_RRMRK6", PU_PATCH); - - UINT8 *colormap = NULL, *oppositemap = NULL; - fixed_t playerx = 0, playery = 0; - UINT8 pskin = MAXSKINS; - UINT16 pcolor = SKINCOLOR_WHITE; - - if (data.mainplayer == MAXPLAYERS) - { - ; - } - else if (playeringame[data.mainplayer] == false) - { - data.mainplayer = MAXPLAYERS; - } - else if (players[data.mainplayer].spectator == false - && players[data.mainplayer].skin < numskins - && players[data.mainplayer].skincolor != SKINCOLOR_NONE - && players[data.mainplayer].skincolor < numskincolors - ) - { - pskin = players[data.mainplayer].skin; - pcolor = players[data.mainplayer].skincolor; - } - - colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); - oppositemap = R_GetTranslationColormap(TC_DEFAULT, skincolors[pcolor].invcolor, GTC_CACHE); - - UINT8 workingqueuesize = roundqueue.size; - boolean upwa = false; - - if (roundqueue.size > 1 - && roundqueue.entries[roundqueue.size - 1].rankrestricted == true - ) - { - if (roundqueue.size & 1) - { - upwa = true; - } - - workingqueuesize--; - } - - INT32 widthofroundqueue = 24*(workingqueuesize - 1); - - x = (BASEVIDWIDTH - widthofroundqueue) / 2; - - const INT32 desiredx2 = 290; - const INT32 spacetospecial = max(desiredx2 - widthofroundqueue - 24, 16); - - // The following block handles horizontal easing of the - // progression bar on the last non-rankrestricted round. - if (data.showrank == true) - { - fixed_t percentslide = 0; - SINT8 deferxoffs = 0; - - if (roundqueue.position == roundqueue.size) - { - percentslide = FRACUNIT; - } - else if (roundqueue.position == roundqueue.size-1 - && timer - interpoffs <= 3*TICRATE) - { - const INT32 through = (3*TICRATE) - (timer - interpoffs - 1); - const INT32 slidetime = (TICRATE/2); - - if (through >= slidetime) - { - percentslide = FRACUNIT; - } - else - { - percentslide = R_InterpolateFixed( - (through - 1) * FRACUNIT, - (through * FRACUNIT) - ) / slidetime; - } - } - - if (percentslide == 0) - { - ; - } - else - { - const INT32 differencetocover = (x + widthofroundqueue + spacetospecial - desiredx2); - - if (percentslide == FRACUNIT) - { - x -= (differencetocover + deferxoffs); - } - else - { - x -= Easing_OutCubic( - percentslide, - 0, - differencetocover * FRACUNIT - ) / FRACUNIT; - } - } - } - - // Fill in background to left edge of screen - fixed_t xiter = x; - - if (upwa == true) - { - xiter -= 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_upwa, greymap); - } - - while (xiter > 0) - { - xiter -= 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); - } - - for (i = 0; i < workingqueuesize; i++) - { - // Draw the background, and grab the appropriate line, to the right of the dot - patch_t **choose_line = NULL; - - upwa ^= true; - if (upwa == false) - { - y = 171; - - V_DrawMappedPatch(x, 167, 0, queuebg_down, greymap); - - if (i+1 != workingqueuesize) // no more line? - { - choose_line = line_down; - } - } - else - { - y = 179; - - if (i+1 != workingqueuesize) // no more line? - { - V_DrawMappedPatch(x, 167, 0, queuebg_upwa, greymap); - - choose_line = line_upwa; - } - else - { - V_DrawMappedPatch(x, 167, 0, queuebg_flat, greymap); - } - } - - if (roundqueue.position == i+1) - { - playerx = (x * FRACUNIT); - playery = (y * FRACUNIT); - - // If there's standard progression ahead of us, visibly move along it. - if (choose_line != NULL && timer - interpoffs <= 2*TICRATE) - { - // 8 tics is chosen because it plays nice - // with both the x and y distance to cover. - fixed_t through = (2*TICRATE) - (timer - interpoffs - 1);; - - if (through > 8) - { - if (through == 9 + interpoffs) - { - // Impactful landing - playery += FRACUNIT; - } - - through = 8 * FRACUNIT; - } - else - { - through = R_InterpolateFixed( - (through - 1) * FRACUNIT, - (through * FRACUNIT) - ); - } - - // 24 pixels when all is said and done - playerx += through * 3; - - if (upwa == false) - { - playery += through; - } - else - { - playery -= through; - } - - if (through > 0 && through < 8 * FRACUNIT) - { - // Hoparabola and a skip. - const fixed_t jumpfactor = through - (4 * FRACUNIT); - // jumpfactor squared goes through 36 -> 0 -> 36. - // 12 pixels is an arbitrary jump height, but we match it to invert the parabola. - playery -= ((12 * FRACUNIT) - - (FixedMul(jumpfactor, jumpfactor) / 3) - ); - } - } - } - - if (choose_line != NULL) - { - // Draw the line to the right of the dot - - V_DrawMappedPatch( - x - 1, 178, - 0, - choose_line[BPP_SHADOW], - NULL - ); - - boolean lineisfull = false, recttoclear = false; - - if (roundqueue.position > i+1) - { - lineisfull = true; - } - else if (roundqueue.position == i+1 && timer - interpoffs <= 2*TICRATE) - { - // 8 tics is chosen because it plays nice - // with both the x and y distance to cover. - const INT32 through = (2*TICRATE) - (timer - interpoffs - 1); - - if (through == 0) - { - ; // no change... - } - else if (through > 8) - { - lineisfull = true; - } - else - { - V_DrawMappedPatch( - x - 1, 179, - 0, - choose_line[BPP_DONE], - colormap - ); - - V_SetClipRect( - playerx + FRACUNIT, - 0, - BASEVIDWIDTH << FRACBITS, - BASEVIDHEIGHT << FRACBITS, - 0 - ); - - recttoclear = true; - } - } - - V_DrawMappedPatch( - x - 1, 179, - 0, - choose_line[lineisfull ? BPP_DONE : BPP_AHEAD], - lineisfull ? colormap : NULL - ); - - if (recttoclear == true) - { - V_ClearClipRect(); - } - } - else - { - // No more line! Fill in background to right edge of screen - xiter = x; - while (xiter < BASEVIDWIDTH) - { - xiter += 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); - } - - // Handle special entry on the end - // (has to be drawn before the semifinal dot due to overlap) - if (data.showrank == true) - { - const fixed_t x2 = x + spacetospecial; - - if (roundqueue.position == roundqueue.size) - { - playerx = (x2 * FRACUNIT); - playery = (y * FRACUNIT); - } - else if (roundqueue.position == roundqueue.size-1 - && timer - interpoffs <= 2*TICRATE) - { - const INT32 through = ((2*TICRATE) - (timer - interpoffs - 1)); - fixed_t linefill; - - if (through > data.linemeter) - { - linefill = data.linemeter * FRACUNIT; - - // Small judder if there's enough time for it - if (timer <= 2) - { - ; - } - else if (through == (data.linemeter + 1 + interpoffs)) - { - playerx += FRACUNIT; - } - else if (through == (data.linemeter + 2 + interpoffs)) - { - playerx -= FRACUNIT; - } - } - else - { - linefill = R_InterpolateFixed( - (through - 1) * FRACUNIT, - (through * FRACUNIT) - ); - } - - const fixed_t percent = FixedDiv( - linefill, - (2*TICRATE) * FRACUNIT - ); - - playerx += - FixedMul( - (x2 - x) * FRACUNIT, - percent - ); - } - - // Special background bump - V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); - - // Draw the final line - const fixed_t barstart = x + 6; - const fixed_t barend = x2 - 6; - - if (barend - 2 >= barstart) - { - boolean lineisfull = false, recttoclear = false; - - xiter = barstart; - - if (playerx >= (barend + 1) * FRACUNIT) - { - lineisfull = true; - } - else if (playerx <= (barstart - 1) * FRACUNIT) - { - ; - } - else - { - const fixed_t fillend = min((playerx / FRACUNIT) + 2, barend); - - while (xiter < fillend) - { - V_DrawMappedPatch( - xiter - 1, 177, - 0, - line_flat[BPP_SHADOW], - NULL - ); - - V_DrawMappedPatch( - xiter - 1, 179, - 0, - line_flat[BPP_DONE], - colormap - ); - - xiter += 2; - } - - // Undo the last step so we can draw the unfilled area of the patch. - xiter -= 2; - - V_SetClipRect( - playerx, - 0, - BASEVIDWIDTH << FRACBITS, - BASEVIDHEIGHT << FRACBITS, - 0 - ); - - recttoclear = true; - } - - while (xiter < barend) - { - V_DrawMappedPatch( - xiter - 1, 177, - 0, - line_flat[BPP_SHADOW], - NULL - ); - - V_DrawMappedPatch( - xiter - 1, 179, - 0, - line_flat[lineisfull ? BPP_DONE : BPP_AHEAD], - lineisfull ? colormap : NULL - ); - - xiter += 2; - } - - if (recttoclear == true) - { - V_ClearClipRect(); - } - } - - // Draw the final dot - V_DrawMappedPatch( - x2 - 8, y, - 0, - prize_dot[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], - roundqueue.position == roundqueue.size ? oppositemap : colormap - ); - } - } - - // Now draw the dot - patch_t **chose_dot = NULL; - - if (roundqueue.entries[i].rankrestricted == true) - { - // This shouldn't show up in regular play, but don't hide it entirely. - chose_dot = prize_dot; - } - else if (grandprixinfo.gp == true - && roundqueue.entries[i].gametype != roundqueue.entries[0].gametype - ) - { - chose_dot = capsu_dot; - } - else - { - chose_dot = level_dot; - } - - if (chose_dot) - { - V_DrawMappedPatch( - x - 8, y, - 0, - chose_dot[roundqueue.position >= i+1 ? BPP_DONE : BPP_AHEAD], - roundqueue.position == i+1 ? oppositemap : colormap - ); - } - - x += 24; - } - - // Draw the player position through the round queue! - if (playery != 0) - { - // Change alignment - playerx -= (10 * FRACUNIT); - playery -= (14 * FRACUNIT); - - if (pskin < numskins) - { - // Draw outline for rank icon - V_DrawFixedPatch( - playerx, playery, - FRACUNIT, 0, - rpmark[0], - NULL - ); - - // Draw the player's rank icon - V_DrawFixedPatch( - playerx + FRACUNIT, playery + FRACUNIT, - FRACUNIT, 0, - faceprefix[pskin][FACE_RANK], - R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) - ); - } - else - { - // Draw mini arrow - V_DrawFixedPatch( - playerx, playery, - FRACUNIT, 0, - rpmark[1], - NULL - ); - } - } - } + // Returns early if there's no roundqueue entries to draw + Y_RoundQueueDrawer(); if (netgame) { diff --git a/src/y_inter.h b/src/y_inter.h index fe094ffe5..d6ed11232 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -19,6 +19,9 @@ extern "C" { void Y_IntermissionDrawer(void); void Y_Ticker(void); +// Specific sub-drawers +void Y_RoundQueueDrawer(void); + void Y_StartIntermission(void); void Y_EndIntermission(void); From 7ddbd23f98c7737b3b99d8609df3bae923c1deea Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 14:24:49 +0100 Subject: [PATCH 44/57] Y_PlayerStandingsDrawer *Also* reduces how absolutely monolithic Y_IntermissionDrawer is. --- src/y_inter.c | 384 ++++++++++++++++++++++++++------------------------ src/y_inter.h | 1 + 2 files changed, 202 insertions(+), 183 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 1b599a94b..a2696cf66 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -388,6 +388,190 @@ typedef enum BPP_MAX } bottomprogressionpatch_t; +// +// Y_PlayerStandingsDrawer +// +// Handles drawing the center-of-screen player standings. +// Currently requires intermission y_data to be active, but abstraction is feasible. +// +void Y_PlayerStandingsDrawer(INT32 xoffset) +{ + if (data.numplayers == 0) + { + return; + } + + UINT8 i; + + SINT8 yspacing = 14; + INT32 heightcount = (data.numplayers - 1); + + INT32 x, y, returny; + + boolean verticalresults = (data.numplayers < 4); + + INT32 hilicol = highlightflags; + INT32 whiteplayer = MAXPLAYERS; + + if (!r_splitscreen) + whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; + + patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players + + if (verticalresults) + { + x = (BASEVIDWIDTH/2) - 61; + } + else + { + x = 29; + heightcount /= 2; + } + + x += xoffset; + + if (data.numplayers > 10) + { + yspacing--; + } + else if (data.numplayers <= 6) + { + yspacing++; + if (verticalresults) + { + yspacing++; + } + } + + y = returny = 106 - (heightcount * yspacing)/2; + + for (i = 0; i < data.numplayers; i++) + { + boolean dojitter = data.jitter[data.num[i]] > 0; + data.jitter[data.num[i]] = 0; + + if (data.num[i] == MAXPLAYERS) + ; + else if (!playeringame[data.num[i]] || players[data.num[i]].spectator == true) + data.num[i] = MAXPLAYERS; // this should be the only field setting in this function + else + { + char strtime[MAXPLAYERNAME+1]; + + if (dojitter) + y--; + + V_DrawMappedPatch(x, y, 0, resbar, NULL); + + V_DrawRightAlignedThinString(x+13, y-2, 0, va("%d", data.pos[i])); + + if (data.color[i]) + { + UINT8 *charcolormap; + if (data.rankingsmode == 0 && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) + { + // RETIRED !! + charcolormap = R_GetTranslationColormap(TC_DEFAULT, *data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, W_CachePatchName("MINIDEAD", PU_CACHE), charcolormap); + } + else + { + charcolormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, faceprefix[*data.character[i]][FACE_MINIMAP], charcolormap); + } + } + + STRBUFCPY(strtime, data.name[i]); + +/* y2 = y; + + if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) + { + static UINT8 alagles_timer = 0; + patch_t *alagles; + + y2 = ( y - 4 ); + + V_DrawScaledPatch(x + 36, y2, 0, W_CachePatchName(va("BLAGLES%d", (intertic / 3) % 6), PU_CACHE)); + // every 70 tics + if (( leveltime % 70 ) == 0) + { + alagles_timer = 9; + } + if (alagles_timer > 0) + { + alagles = W_CachePatchName(va("ALAGLES%d", alagles_timer), PU_CACHE); + V_DrawScaledPatch(x + 36, y2, 0, alagles); + if (( leveltime % 2 ) == 0) + alagles_timer--; + } + else + { + alagles = W_CachePatchName("ALAGLES0", PU_CACHE); + V_DrawScaledPatch(x + 36, y2, 0, alagles); + } + + y2 += SHORT (alagles->height) + 1; + }*/ + + V_DrawThinString(x+27, y-2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); + + strtime[0] = '\0'; + + if (data.rankingsmode) + { + if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) + { + // No power level (guests) + STRBUFCPY(strtime, "----"); + } + else + { + /*if (data.increase[data.num[i]] != INT16_MIN) + { + snprintf(strtime, sizeof strtime, " (%d)", data.increase[data.num[i]]); + + V_DrawThinString(x+118, y-2, V_6WIDTHSPACE, strtime); + }*/ + + snprintf(strtime, sizeof strtime, "%d", data.val[i]); + } + } + else + { + if (data.val[i] == (UINT32_MAX-1)) + STRBUFCPY(strtime, "RETIRED."); + else + { + if (intertype == int_time) + { + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), + G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); + strtime[sizeof strtime - 1] = '\0'; + } + else + { + snprintf(strtime, sizeof strtime, "%d", data.val[i]); + } + } + } + + V_DrawRightAlignedThinString(x+118, y-2, V_6WIDTHSPACE, strtime); + + if (dojitter) + y++; + } + + y += yspacing; + + if (verticalresults == false && i == (data.numplayers-1)/2) + { + x = 169 + xoffset; + y = returny; + } + } +} + // // Y_RoundQueueDrawer // @@ -973,19 +1157,10 @@ void Y_IntermissionDrawer(void) g_wipeskiprender = false; - UINT8 i = 0; - fixed_t x, y, xoffset = 0; + fixed_t x; - INT32 hilicol = highlightflags; - INT32 whiteplayer = MAXPLAYERS; - - if (!r_splitscreen) - whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; - - // Patches - - patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); // GOT THROUGH ROUND - patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players + // GOT THROUGH ROUND + patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); // Header bar patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); @@ -1046,26 +1221,27 @@ void Y_IntermissionDrawer(void) if (!LUA_HudEnabled(hud_intermissiontally)) goto skiptallydrawer; + x = 0; if (sorttic != -1 && intertic > sorttic) { const INT32 count = (intertic - sorttic); if (count < 8) - xoffset = -((count * vid.width) / (8 * vid.dupx)); + x = -((count * vid.width) / (8 * vid.dupx)); else if (count == 8) goto skiptallydrawer; else if (count < 16) - xoffset = (((16 - count) * vid.width) / (8 * vid.dupx)); + x = (((16 - count) * vid.width) / (8 * vid.dupx)); } // Draw the header bar { - V_DrawMappedPatch(20 + xoffset, 24, 0, rtpbr, NULL); + V_DrawMappedPatch(20 + x, 24, 0, rtpbr, NULL); if (data.gotthrough) { // Draw "GOT THROUGH ROUND" - V_DrawMappedPatch(50 + xoffset, 42, 0, gthro, NULL); + V_DrawMappedPatch(50 + x, 42, 0, gthro, NULL); // Draw round numbers if (roundqueue.roundnum > 0 && !(grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)) @@ -1075,178 +1251,20 @@ void Y_IntermissionDrawer(void) va("TT_RND%d", roundqueue.roundnum), PU_PATCH ); - V_DrawMappedPatch(240 + xoffset, 39, 0, roundpatch, NULL); + V_DrawMappedPatch(240 + x, 39, 0, roundpatch, NULL); } // Draw the player's name - V_DrawTitleCardString(51 + xoffset, 7, data.headerstring, V_6WIDTHSPACE, false, 0, 0); + V_DrawTitleCardString(51 + x, 7, data.headerstring, V_6WIDTHSPACE, false, 0, 0); } else { - V_DrawTitleCardString(51 + xoffset, 17, data.headerstring, V_6WIDTHSPACE, false, 0, 0); + V_DrawTitleCardString(51 + x, 17, data.headerstring, V_6WIDTHSPACE, false, 0, 0); } } - { - SINT8 yspacing = 14; - fixed_t heightcount = (data.numplayers - 1); - fixed_t returny; - - boolean verticalresults = (data.numplayers < 4); - - x = xoffset; - - if (verticalresults) - { - x += (BASEVIDWIDTH/2) - 61; - } - else - { - x += 29; - heightcount /= 2; - } - - if (data.numplayers > 10) - { - yspacing--; - } - else if (data.numplayers <= 6) - { - yspacing++; - if (verticalresults) - { - yspacing++; - } - } - - y = returny = 106 - (heightcount * yspacing)/2; - - for (i = 0; i < data.numplayers; i++) - { - boolean dojitter = data.jitter[data.num[i]] > 0; - data.jitter[data.num[i]] = 0; - - if (data.num[i] == MAXPLAYERS) - ; - else if (!playeringame[data.num[i]] || players[data.num[i]].spectator == true) - data.num[i] = MAXPLAYERS; // this should be the only field setting in this function - else - { - char strtime[MAXPLAYERNAME+1]; - - if (dojitter) - y--; - - V_DrawMappedPatch(x, y, 0, resbar, NULL); - - V_DrawRightAlignedThinString(x+13, y-2, 0, va("%d", data.pos[i])); - - if (data.color[i]) - { - UINT8 *charcolormap; - if (data.rankingsmode == 0 && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) - { - // RETIRED !! - charcolormap = R_GetTranslationColormap(TC_DEFAULT, *data.color[i], GTC_CACHE); - V_DrawMappedPatch(x+14, y-5, 0, W_CachePatchName("MINIDEAD", PU_CACHE), charcolormap); - } - else - { - charcolormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - V_DrawMappedPatch(x+14, y-5, 0, faceprefix[*data.character[i]][FACE_MINIMAP], charcolormap); - } - } - - STRBUFCPY(strtime, data.name[i]); - -/* y2 = y; - - if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) - { - static UINT8 alagles_timer = 0; - patch_t *alagles; - - y2 = ( y - 4 ); - - V_DrawScaledPatch(x + 36, y2, 0, W_CachePatchName(va("BLAGLES%d", (intertic / 3) % 6), PU_CACHE)); - // every 70 tics - if (( leveltime % 70 ) == 0) - { - alagles_timer = 9; - } - if (alagles_timer > 0) - { - alagles = W_CachePatchName(va("ALAGLES%d", alagles_timer), PU_CACHE); - V_DrawScaledPatch(x + 36, y2, 0, alagles); - if (( leveltime % 2 ) == 0) - alagles_timer--; - } - else - { - alagles = W_CachePatchName("ALAGLES0", PU_CACHE); - V_DrawScaledPatch(x + 36, y2, 0, alagles); - } - - y2 += SHORT (alagles->height) + 1; - }*/ - - V_DrawThinString(x+27, y-2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); - - strtime[0] = '\0'; - - if (data.rankingsmode) - { - if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) - { - // No power level (guests) - STRBUFCPY(strtime, "----"); - } - else - { - /*if (data.increase[data.num[i]] != INT16_MIN) - { - snprintf(strtime, sizeof strtime, " (%d)", data.increase[data.num[i]]); - - V_DrawThinString(x+118, y-2, V_6WIDTHSPACE, strtime); - }*/ - - snprintf(strtime, sizeof strtime, "%d", data.val[i]); - } - } - else - { - if (data.val[i] == (UINT32_MAX-1)) - STRBUFCPY(strtime, "RETIRED."); - else - { - if (intertype == int_time) - { - snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), - G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); - strtime[sizeof strtime - 1] = '\0'; - } - else - { - snprintf(strtime, sizeof strtime, "%d", data.val[i]); - } - } - } - - V_DrawRightAlignedThinString(x+118, y-2, V_6WIDTHSPACE, strtime); - - if (dojitter) - y++; - } - - y += yspacing; - - if (verticalresults == false && i == (data.numplayers-1)/2) - { - x = 169 + xoffset; - y = returny; - } - } - } + // Returns early if there's no players to draw + Y_PlayerStandingsDrawer(x); // Draw bottom (and top) pieces skiptallydrawer: @@ -1261,13 +1279,13 @@ skiptallydrawer: 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|hilicol, "or"); + 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|hilicol, "Save replay"); + V_DrawRightAlignedThinString(buttonx - 2, buttony, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Save replay"); break; } case DSM_SAVED: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|hilicol, "Replay saved!"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Replay saved!"); break; case DSM_TITLEENTRY: @@ -1290,7 +1308,7 @@ skiptallydrawer: { if (speedscramble != -1 && speedscramble != gamespeed) { - V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, hilicol|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, + V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); } } diff --git a/src/y_inter.h b/src/y_inter.h index d6ed11232..6105fe0c8 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -20,6 +20,7 @@ void Y_IntermissionDrawer(void); void Y_Ticker(void); // Specific sub-drawers +void Y_PlayerStandingsDrawer(INT32 xoffset); void Y_RoundQueueDrawer(void); void Y_StartIntermission(void); From 0757d39930a5d87d38c8ad457d5d0de60b364360 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 14:32:41 +0100 Subject: [PATCH 45/57] Slight cleanup after extraction Fixes Lua being able to hide the timer in the corner --- src/y_inter.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index a2696cf66..26dd00aee 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -836,6 +836,7 @@ void Y_RoundQueueDrawer(void) ); } } + // End of the moving along } if (choose_line != NULL) @@ -1058,6 +1059,7 @@ void Y_RoundQueueDrawer(void) roundqueue.position == roundqueue.size ? oppositemap : colormap ); } + // End of the special entry handling } // Now draw the dot @@ -1159,12 +1161,6 @@ void Y_IntermissionDrawer(void) fixed_t x; - // GOT THROUGH ROUND - patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); - - // Header bar - patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); - // Checker scroll patch_t *rbgchk = W_CachePatchName("R_RBGCHK", PU_PATCH); @@ -1236,11 +1232,14 @@ void Y_IntermissionDrawer(void) // Draw the header bar { + // Header bar + patch_t *rtpbr = W_CachePatchName("R_RTPBR", PU_PATCH); V_DrawMappedPatch(20 + x, 24, 0, rtpbr, NULL); if (data.gotthrough) { - // Draw "GOT THROUGH ROUND" + // GOT THROUGH ROUND + patch_t *gthro = W_CachePatchName("R_GTHRO", PU_PATCH); V_DrawMappedPatch(50 + x, 42, 0, gthro, NULL); // Draw round numbers @@ -1268,6 +1267,22 @@ void Y_IntermissionDrawer(void) // Draw bottom (and top) pieces skiptallydrawer: + if (!LUA_HudEnabled(hud_intermissionmessages)) + goto finalcounter; + + // Returns early if there's no roundqueue entries to draw + Y_RoundQueueDrawer(); + + if (netgame) + { + if (speedscramble != -1 && speedscramble != gamespeed) + { + V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, + va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); + } + } + +finalcounter: { if ((modeattacking == ATTACKING_NONE) && (demo.recording || demo.savemode == DSM_SAVED) && !demo.playback) { @@ -1298,21 +1313,6 @@ skiptallydrawer: } } - if (!LUA_HudEnabled(hud_intermissionmessages)) - return; - - // Returns early if there's no roundqueue entries to draw - Y_RoundQueueDrawer(); - - if (netgame) - { - if (speedscramble != -1 && speedscramble != gamespeed) - { - V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, - va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); - } - } - { const INT32 tickDown = (timer + 1)/TICRATE; From d581389c9cdf5ffa7b9c7d86d2c2eb600fa8be04 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 14:44:27 +0100 Subject: [PATCH 46/57] Y_PlayerStandingsDrawer: All local splitscreen players are now highlighted on the results screen - Uses function pointers to highlight display players instead in demo playback - Was previously doing this to avoid all players being highlighted in local splitscreen, but this is now relevant there too thanks to bots --- src/y_inter.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 26dd00aee..3373ce369 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -411,10 +411,6 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) boolean verticalresults = (data.numplayers < 4); INT32 hilicol = highlightflags; - INT32 whiteplayer = MAXPLAYERS; - - if (!r_splitscreen) - whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; patch_t *resbar = W_CachePatchName("R_RESBAR", PU_PATCH); // Results bars for players @@ -445,6 +441,12 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) y = returny = 106 - (heightcount * yspacing)/2; + boolean (*_isHighlightedPlayer)(player_t *) = + (demo.playback + ? P_IsDisplayPlayer + : P_IsLocalPlayer + ); + for (i = 0; i < data.numplayers; i++) { boolean dojitter = data.jitter[data.num[i]] > 0; @@ -514,7 +516,15 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) y2 += SHORT (alagles->height) + 1; }*/ - V_DrawThinString(x+27, y-2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); + V_DrawThinString( + x+27, y-2, + ( + _isHighlightedPlayer(&players[data.num[i]]) + ? hilicol + : 0 + )|V_ALLOWLOWERCASE|V_6WIDTHSPACE, + strtime + ); strtime[0] = '\0'; From 77aa563a74e171f7d929aaf47cc54afd66db7e5d Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 16:16:36 +0100 Subject: [PATCH 47/57] Depointerify several properties on y_data - character is written directly - color is written directly - no more duplication of the player_names pointer --- src/y_inter.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 3373ce369..f8f913747 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -64,10 +64,9 @@ typedef struct typedef struct { - INT32 *character[MAXPLAYERS]; // Character # - UINT16 *color[MAXPLAYERS]; // Color # + UINT8 character[MAXPLAYERS]; // Character # + UINT16 color[MAXPLAYERS]; // Color # SINT8 num[MAXPLAYERS]; // Player # - char *name[MAXPLAYERS]; // Player's name UINT8 numplayers; // Number of players being displayed UINT8 mainplayer; // Most successful local player @@ -252,9 +251,8 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) completed[i] = true; - data.color[data.numplayers] = &players[i].skincolor; - data.character[data.numplayers] = &players[i].skin; - data.name[data.numplayers] = player_names[i]; + data.color[data.numplayers] = players[i].skincolor; + data.character[data.numplayers] = players[i].skin; if (data.numplayers && (data.val[data.numplayers] == data.val[data.numplayers-1])) { @@ -280,9 +278,9 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) { G_WriteStanding( data.pos[data.numplayers], - data.name[data.numplayers], - *data.character[data.numplayers], - *data.color[data.numplayers], + player_names[i], + data.character[data.numplayers], + data.color[data.numplayers], data.val[data.numplayers] ); } @@ -473,18 +471,16 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) if (data.rankingsmode == 0 && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) { // RETIRED !! - charcolormap = R_GetTranslationColormap(TC_DEFAULT, *data.color[i], GTC_CACHE); + charcolormap = R_GetTranslationColormap(TC_DEFAULT, data.color[i], GTC_CACHE); V_DrawMappedPatch(x+14, y-5, 0, W_CachePatchName("MINIDEAD", PU_CACHE), charcolormap); } else { - charcolormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); - V_DrawMappedPatch(x+14, y-5, 0, faceprefix[*data.character[i]][FACE_MINIMAP], charcolormap); + charcolormap = R_GetTranslationColormap(data.character[i], data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, faceprefix[data.character[i]][FACE_MINIMAP], charcolormap); } } - STRBUFCPY(strtime, data.name[i]); - /* y2 = y; if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) @@ -523,7 +519,7 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) ? hilicol : 0 )|V_ALLOWLOWERCASE|V_6WIDTHSPACE, - strtime + player_names[data.num[i]] ); strtime[0] = '\0'; From c712cd745212f1cb97e43bf3e3f8c6c0865f74e6 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 16:37:06 +0100 Subject: [PATCH 48/57] Prepare value string for intermission screen once, rather than every rendered frame ("RETIRED.", "0:24:13", "27", "1004", "----", etc) --- src/y_inter.c | 115 +++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f8f913747..2114fdac0 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -64,26 +64,28 @@ typedef struct typedef struct { - UINT8 character[MAXPLAYERS]; // Character # - UINT16 color[MAXPLAYERS]; // Color # - SINT8 num[MAXPLAYERS]; // Player # - - UINT8 numplayers; // Number of players being displayed - UINT8 mainplayer; // Most successful local player - - char headerstring[64]; // holds levelnames up to 64 characters - - INT16 increase[MAXPLAYERS]; // how much did the score increase by? - UINT8 jitter[MAXPLAYERS]; // wiggle - - UINT32 val[MAXPLAYERS]; // Gametype-specific value - UINT8 pos[MAXPLAYERS]; // player positions. used for ties - boolean rankingsmode; // rankings mode boolean gotthrough; // show "got through" boolean showrank; // show rank-restricted queue entry at the end, if it exists boolean encore; // encore mode + char headerstring[64]; // holds levelnames up to 64 characters + + UINT8 numplayers; // Number of players being displayed + UINT8 mainplayer; // Most successful local player + + SINT8 num[MAXPLAYERS]; // Player # + UINT8 pos[MAXPLAYERS]; // player positions. used for ties + + UINT8 character[MAXPLAYERS]; // Character # + UINT16 color[MAXPLAYERS]; // Color # + + UINT32 val[MAXPLAYERS]; // Gametype-specific value + char strval[MAXPLAYERS][MAXPLAYERNAME+1]; + + INT16 increase[MAXPLAYERS]; // how much did the score increase by? + UINT8 jitter[MAXPLAYERS]; // wiggle + INT32 linemeter; // For GP only } y_data; @@ -263,6 +265,10 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) data.pos[data.numplayers] = data.numplayers+1; } +#define strtime data.strval[data.numplayers] + + data.strval[data.numplayers][0] = '\0'; + if (!rankingsmode) { if ((powertype == PWRLV_DISABLED) @@ -284,7 +290,38 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) data.val[data.numplayers] ); } + + if (data.val[data.numplayers] == (UINT32_MAX-1)) + STRBUFCPY(strtime, "RETIRED."); + else + { + if (intertype == int_time) + { + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[data.numplayers], true), + G_TicsToSeconds(data.val[data.numplayers]), G_TicsToCentiseconds(data.val[data.numplayers])); + } + else + { + snprintf(strtime, sizeof strtime, "%d", data.val[data.numplayers]); + } + } } + else + { + if (powertype != PWRLV_DISABLED && !clientpowerlevels[i][powertype]) + { + // No power level (guests) + STRBUFCPY(strtime, "----"); + } + else + { + snprintf(strtime, sizeof strtime, "%d", data.val[data.numplayers]); + } + } + + strtime[sizeof strtime - 1] = '\0'; + +#undef strtime data.numplayers++; } @@ -456,8 +493,6 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) data.num[i] = MAXPLAYERS; // this should be the only field setting in this function else { - char strtime[MAXPLAYERNAME+1]; - if (dojitter) y--; @@ -522,47 +557,11 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) player_names[data.num[i]] ); - strtime[0] = '\0'; - - if (data.rankingsmode) - { - if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) - { - // No power level (guests) - STRBUFCPY(strtime, "----"); - } - else - { - /*if (data.increase[data.num[i]] != INT16_MIN) - { - snprintf(strtime, sizeof strtime, " (%d)", data.increase[data.num[i]]); - - V_DrawThinString(x+118, y-2, V_6WIDTHSPACE, strtime); - }*/ - - snprintf(strtime, sizeof strtime, "%d", data.val[i]); - } - } - else - { - if (data.val[i] == (UINT32_MAX-1)) - STRBUFCPY(strtime, "RETIRED."); - else - { - if (intertype == int_time) - { - snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), - G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); - strtime[sizeof strtime - 1] = '\0'; - } - else - { - snprintf(strtime, sizeof strtime, "%d", data.val[i]); - } - } - } - - V_DrawRightAlignedThinString(x+118, y-2, V_6WIDTHSPACE, strtime); + V_DrawRightAlignedThinString( + x+118, y-2, + V_6WIDTHSPACE, + data.strval[i] + ); if (dojitter) y++; From efa849c8cc013997c70e3cd735e10512093f2da3 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 16:46:03 +0100 Subject: [PATCH 49/57] Y_PlayerStandingsDrawer: Make player index referencing in loop cleaner --- src/y_inter.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 2114fdac0..84fe1b268 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -484,12 +484,14 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) for (i = 0; i < data.numplayers; i++) { - boolean dojitter = data.jitter[data.num[i]] > 0; - data.jitter[data.num[i]] = 0; + const UINT8 pnum = data.num[i]; - if (data.num[i] == MAXPLAYERS) + boolean dojitter = data.jitter[pnum] > 0; + data.jitter[pnum] = 0; + + if (pnum == MAXPLAYERS) ; - else if (!playeringame[data.num[i]] || players[data.num[i]].spectator == true) + else if (!playeringame[pnum] || players[pnum].spectator == true) data.num[i] = MAXPLAYERS; // this should be the only field setting in this function else { @@ -503,7 +505,7 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) if (data.color[i]) { UINT8 *charcolormap; - if (data.rankingsmode == 0 && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) + if (data.rankingsmode == 0 && (players[pnum].pflags & PF_NOCONTEST) && players[pnum].bot) { // RETIRED !! charcolormap = R_GetTranslationColormap(TC_DEFAULT, data.color[i], GTC_CACHE); @@ -518,7 +520,7 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) /* y2 = y; - if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) + if ((netgame || (demo.playback && demo.netgame)) && playerconsole[pnum] == 0 && server_lagless && !players[pnum].bot) { static UINT8 alagles_timer = 0; patch_t *alagles; @@ -550,11 +552,11 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) V_DrawThinString( x+27, y-2, ( - _isHighlightedPlayer(&players[data.num[i]]) + _isHighlightedPlayer(&players[pnum]) ? hilicol : 0 )|V_ALLOWLOWERCASE|V_6WIDTHSPACE, - player_names[data.num[i]] + player_names[pnum] ); V_DrawRightAlignedThinString( From 7081e98d9bce09ce133c0380c6eb5e543b36c11d Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 17:06:22 +0100 Subject: [PATCH 50/57] Y_PlayerStandingsDrawer: Abstract y_data_t inputs In the process, fix a longstanding interp bug where the jitter on tally increase would be for only one rendered frame, not one full tic. --- src/y_inter.c | 89 ++++++++++++++++++++------------------------------- src/y_inter.h | 29 ++++++++++++++++- 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 84fe1b268..9f570e997 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -62,34 +62,7 @@ typedef struct UINT8 display; } y_bonus_t; -typedef struct -{ - boolean rankingsmode; // rankings mode - boolean gotthrough; // show "got through" - boolean showrank; // show rank-restricted queue entry at the end, if it exists - boolean encore; // encore mode - - char headerstring[64]; // holds levelnames up to 64 characters - - UINT8 numplayers; // Number of players being displayed - UINT8 mainplayer; // Most successful local player - - SINT8 num[MAXPLAYERS]; // Player # - UINT8 pos[MAXPLAYERS]; // player positions. used for ties - - UINT8 character[MAXPLAYERS]; // Character # - UINT16 color[MAXPLAYERS]; // Color # - - UINT32 val[MAXPLAYERS]; // Gametype-specific value - char strval[MAXPLAYERS][MAXPLAYERNAME+1]; - - INT16 increase[MAXPLAYERS]; // how much did the score increase by? - UINT8 jitter[MAXPLAYERS]; // wiggle - - INT32 linemeter; // For GP only -} y_data; - -static y_data data; +static y_data_t data; // graphics static patch_t *bgpatch = NULL; // INTERSCR @@ -267,7 +240,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) #define strtime data.strval[data.numplayers] - data.strval[data.numplayers][0] = '\0'; + strtime[0] = '\0'; if (!rankingsmode) { @@ -427,11 +400,10 @@ typedef enum // Y_PlayerStandingsDrawer // // Handles drawing the center-of-screen player standings. -// Currently requires intermission y_data to be active, but abstraction is feasible. // -void Y_PlayerStandingsDrawer(INT32 xoffset) +void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) { - if (data.numplayers == 0) + if (standings->numplayers == 0) { return; } @@ -439,11 +411,11 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) UINT8 i; SINT8 yspacing = 14; - INT32 heightcount = (data.numplayers - 1); + INT32 heightcount = (standings->numplayers - 1); INT32 x, y, returny; - boolean verticalresults = (data.numplayers < 4); + boolean verticalresults = (standings->numplayers < 4); INT32 hilicol = highlightflags; @@ -461,11 +433,11 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) x += xoffset; - if (data.numplayers > 10) + if (standings->numplayers > 10) { yspacing--; } - else if (data.numplayers <= 6) + else if (standings->numplayers <= 6) { yspacing++; if (verticalresults) @@ -482,39 +454,37 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) : P_IsLocalPlayer ); - for (i = 0; i < data.numplayers; i++) + for (i = 0; i < standings->numplayers; i++) { - const UINT8 pnum = data.num[i]; - - boolean dojitter = data.jitter[pnum] > 0; - data.jitter[pnum] = 0; + const UINT8 pnum = standings->num[i]; if (pnum == MAXPLAYERS) ; else if (!playeringame[pnum] || players[pnum].spectator == true) - data.num[i] = MAXPLAYERS; // this should be the only field setting in this function + standings->num[i] = MAXPLAYERS; // this should be the only field setting in this function else { - if (dojitter) + // Apply the jitter offset (later reversed) + if (standings->jitter[pnum] > 0) y--; V_DrawMappedPatch(x, y, 0, resbar, NULL); - V_DrawRightAlignedThinString(x+13, y-2, 0, va("%d", data.pos[i])); + V_DrawRightAlignedThinString(x+13, y-2, 0, va("%d", standings->pos[i])); - if (data.color[i]) + if (standings->color[i] != SKINCOLOR_NONE) { UINT8 *charcolormap; - if (data.rankingsmode == 0 && (players[pnum].pflags & PF_NOCONTEST) && players[pnum].bot) + if ((players[pnum].pflags & PF_NOCONTEST) && players[pnum].bot) { // RETIRED !! - charcolormap = R_GetTranslationColormap(TC_DEFAULT, data.color[i], GTC_CACHE); + charcolormap = R_GetTranslationColormap(TC_DEFAULT, standings->color[i], GTC_CACHE); V_DrawMappedPatch(x+14, y-5, 0, W_CachePatchName("MINIDEAD", PU_CACHE), charcolormap); } else { - charcolormap = R_GetTranslationColormap(data.character[i], data.color[i], GTC_CACHE); - V_DrawMappedPatch(x+14, y-5, 0, faceprefix[data.character[i]][FACE_MINIMAP], charcolormap); + charcolormap = R_GetTranslationColormap(standings->character[i], standings->color[i], GTC_CACHE); + V_DrawMappedPatch(x+14, y-5, 0, faceprefix[standings->character[i]][FACE_MINIMAP], charcolormap); } } @@ -561,17 +531,18 @@ void Y_PlayerStandingsDrawer(INT32 xoffset) V_DrawRightAlignedThinString( x+118, y-2, - V_6WIDTHSPACE, - data.strval[i] + V_ALLOWLOWERCASE|V_6WIDTHSPACE, + standings->strval[i] ); - if (dojitter) + // Reverse the jitter offset + if (standings->jitter[pnum] > 0) y++; } y += yspacing; - if (verticalresults == false && i == (data.numplayers-1)/2) + if (verticalresults == false && i == (standings->numplayers-1)/2) { x = 169 + xoffset; y = returny; @@ -1270,7 +1241,7 @@ void Y_IntermissionDrawer(void) } // Returns early if there's no players to draw - Y_PlayerStandingsDrawer(x); + Y_PlayerStandingsDrawer(&data, x); // Draw bottom (and top) pieces skiptallydrawer: @@ -1383,8 +1354,16 @@ void Y_Ticker(void) return; } - if (intertic < TICRATE || intertic & 1 || endtic != -1) + if (intertic < TICRATE || endtic != -1) + { return; + } + + if (data.rankingsmode && intertic & 1) + { + memset(data.jitter, 0, sizeof (data.jitter)); + return; + } if (intertype == int_time || intertype == int_score) { diff --git a/src/y_inter.h b/src/y_inter.h index 6105fe0c8..127ddb968 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -16,11 +16,38 @@ extern "C" { #endif +typedef struct +{ + boolean rankingsmode; // rankings mode + boolean gotthrough; // show "got through" + boolean showrank; // show rank-restricted queue entry at the end, if it exists + boolean encore; // encore mode + + char headerstring[64]; // holds levelnames up to 64 characters + + UINT8 numplayers; // Number of players being displayed + + SINT8 num[MAXPLAYERS]; // Player # + UINT8 pos[MAXPLAYERS]; // player positions. used for ties + + UINT8 character[MAXPLAYERS]; // Character # + UINT16 color[MAXPLAYERS]; // Color # + + UINT32 val[MAXPLAYERS]; // Gametype-specific value + char strval[MAXPLAYERS][MAXPLAYERNAME+1]; + + INT16 increase[MAXPLAYERS]; // how much did the score increase by? + UINT8 jitter[MAXPLAYERS]; // wiggle + + UINT8 mainplayer; // Most successful local player + INT32 linemeter; // For GP only +} y_data_t; + void Y_IntermissionDrawer(void); void Y_Ticker(void); // Specific sub-drawers -void Y_PlayerStandingsDrawer(INT32 xoffset); +void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset); void Y_RoundQueueDrawer(void); void Y_StartIntermission(void); From 36d8bce14dc220f978211eabe1a788999240a6d8 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 18:11:40 +0100 Subject: [PATCH 51/57] Replace K_DrawTabRankings with Y_PlayerStandingsDrawer TODO: Ping, LAGLESS --- src/hu_stuff.c | 107 ++++++++++++++++++++++++++--------- src/hu_stuff.h | 13 ----- src/k_hud.c | 150 ------------------------------------------------- src/k_hud.h | 1 - src/typedef.h | 3 - 5 files changed, 80 insertions(+), 194 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 8fda4c111..2681ffa56 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -60,6 +60,7 @@ #include "k_color.h" #include "k_hud.h" #include "r_fps.h" +#include "y_inter.h" // Y_PlayerStandingsDrawer // coords are scaled #define HU_INPUTX 0 @@ -2520,10 +2521,7 @@ static inline void HU_DrawSpectatorTicker(void) // static void HU_DrawRankings(void) { - playersort_t tab[MAXPLAYERS]; - INT32 i, j, scorelines, numplayersingame = 0, hilicol = highlightflags; - boolean completed[MAXPLAYERS]; - UINT32 whiteplayer = MAXPLAYERS; + INT32 i, j, hilicol = highlightflags; boolean timedone = false, pointsdone = false; if (!automapactive) @@ -2632,23 +2630,21 @@ static void HU_DrawRankings(void) V_DrawCenteredString(256, 16, hilicol, kartspeed_cons_t[1+gamespeed].strvalue); } - // When you play, you quickly see your score because your name is displayed in white. - // When playing back a demo, you quickly see who's the view. - if (!r_splitscreen) - whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; + boolean completed[MAXPLAYERS]; + y_data_t standings; - scorelines = 0; memset(completed, 0, sizeof (completed)); - memset(tab, 0, sizeof (playersort_t)*MAXPLAYERS); + memset(&standings, 0, sizeof (standings)); + + UINT8 numplayersingame = 0; for (i = 0; i < MAXPLAYERS; i++) { - tab[i].num = -1; - tab[i].name = NULL; - tab[i].count = INT32_MAX; - if (!playeringame[i] || players[i].spectator || !players[i].mo) + { + completed[i] = true; continue; + } numplayersingame++; } @@ -2658,40 +2654,97 @@ static void HU_DrawRankings(void) UINT8 lowestposition = MAXPLAYERS+1; for (i = 0; i < MAXPLAYERS; i++) { - if (completed[i] || !playeringame[i] || players[i].spectator || !players[i].mo) + if (completed[i]) continue; if (players[i].position >= lowestposition) continue; - tab[scorelines].num = i; + standings.num[standings.numplayers] = i; lowestposition = players[i].position; } - i = tab[scorelines].num; + i = standings.num[standings.numplayers]; completed[i] = true; - tab[scorelines].name = player_names[i]; + standings.character[standings.numplayers] = players[i].skin; + standings.color[standings.numplayers] = players[i].skincolor; + standings.pos[standings.numplayers] = players[i].position; - if ((gametyperules & GTR_CIRCUIT)) +#define strtime standings.strval[standings.numplayers] + + if (players[i].pflags & PF_NOCONTEST) { - tab[scorelines].count = players[i].laps; + standings.val[standings.numplayers] = (UINT32_MAX-1); + STRBUFCPY(strtime, "RETIRED."); + } + else if ((gametyperules & GTR_CIRCUIT)) + { + standings.val[standings.numplayers] = players[i].laps; + + if (players[i].exiting) + { + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(standings.val[standings.numplayers], true), + G_TicsToSeconds(standings.val[standings.numplayers]), G_TicsToCentiseconds(standings.val[standings.numplayers])); + } + else + { + snprintf(strtime, sizeof strtime, "Lap %d", standings.val[standings.numplayers]); + } } else { - tab[scorelines].count = players[i].roundscore; + standings.val[standings.numplayers] = players[i].roundscore; + snprintf(strtime, sizeof strtime, "%d", standings.val[standings.numplayers]); } - scorelines++; +#undef strtime -#if MAXPLAYERS > 16 - if (scorelines > 16) - break; //dont draw past bottom of screen, show the best only -#endif + standings.numplayers++; } - K_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol); + // Returns early if there's no players to draw + Y_PlayerStandingsDrawer(&standings, 0); + + /*i = MAXPLAYERS; + + for (j = 0; j < standings.numplayers; j++) + { + i = standings.num[j]; + + if (i >= MAXPLAYERS + || playeringame[i] == false + || players[i].spectator == true) + { + continue; + } + + if (demo.playback) + { + if (!P_IsDisplayPlayer(&players[i])) + { + continue; + } + + break; + } + + if (!P_IsLocalPlayer(&players[i])) + { + continue; + } + + break; + } + + if (i != MAXPLAYERS) + { + standings.mainplayer = i; + } + + // Returns early if there's no roundqueue entries to draw + Y_RoundQueueDrawer();*/ // draw spectators in a ticker across the bottom if (netgame && G_GametypeHasSpectators()) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index eaef0a59d..084a7d51b 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -95,17 +95,6 @@ enum extern char *shiftxform; // english translation shift table extern char english_shiftxform[]; -//------------------------------------ -// sorted player lines -//------------------------------------ - -struct playersort_t -{ - UINT32 count; - INT32 num; - const char *name; -}; - //------------------------------------ // chat stuff //------------------------------------ @@ -160,8 +149,6 @@ void HU_clearChatChars(void); void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, INT32 flags, boolean offline); // Lat': Ping drawer for scoreboard. void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); -INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]); - // CECHO interface. void HU_ClearCEcho(void); void HU_SetCEchoDuration(INT32 seconds); diff --git a/src/k_hud.c b/src/k_hud.c index 0b9886e24..5211080a4 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2277,156 +2277,6 @@ static void K_drawKartEmeralds(void) } } -// -// HU_DrawTabRankings -- moved here to take advantage of kart stuff! -// -void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol) -{ - static tic_t alagles_timer = 9; - INT32 i, rightoffset = 240; - const UINT8 *colormap; - INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2; - int basey = y, basex = x, y2; - - //this function is designed for 9 or less score lines only - //I_Assert(scorelines <= 9); -- not today bitch, kart fixed it up - - V_DrawFill(1-duptweak, 26, dupadjust-2, 1, 0); // Draw a horizontal line because it looks nice! - - scorelines--; - if (scorelines >= 8) - { - V_DrawFill(160, 26, 1, 147, 0); // Draw a vertical line to separate the two sides. - V_DrawFill(1-duptweak, 173, dupadjust-2, 1, 0); // And a horizontal line near the bottom. - rightoffset = (BASEVIDWIDTH/2) - 4 - x; - x = (BASEVIDWIDTH/2) + 4; - y += 18*(scorelines-8); - } - else - { - y += 18*scorelines; - } - - for (i = scorelines; i >= 0; i--) - { - char strtime[MAXPLAYERNAME+1]; - - if (players[tab[i].num].spectator || !players[tab[i].num].mo) - continue; //ignore them. - - if (netgame) // don't draw ping offline - { - if (players[tab[i].num].bot) - { - V_DrawScaledPatch(x + ((i < 8) ? -25 : rightoffset + 3), y-2, 0, kp_cpu); - } - else if (tab[i].num != serverplayer || !server_lagless) - { - HU_drawPing((x + ((i < 8) ? -17 : rightoffset + 11)) * FRACUNIT, (y-4) * FRACUNIT, playerpingtable[tab[i].num], 0, false); - } - } - - STRBUFCPY(strtime, tab[i].name); - - y2 = y; - - if (netgame && playerconsole[tab[i].num] == 0 && server_lagless && !players[tab[i].num].bot) - { - y2 = ( y - 4 ); - - V_DrawScaledPatch(x + 20, y2, 0, kp_blagles[(leveltime / 3) % 6]); - // every 70 tics - if (( leveltime % 70 ) == 0) - { - alagles_timer = 9; - } - if (alagles_timer > 0) - { - V_DrawScaledPatch(x + 20, y2, 0, kp_alagles[alagles_timer]); - if (( leveltime % 2 ) == 0) - alagles_timer--; - } - else - V_DrawScaledPatch(x + 20, y2, 0, kp_alagles[0]); - - y2 += SHORT (kp_alagles[0]->height) + 1; - } - - if (scorelines >= 8) - V_DrawThinString(x + 20, y2, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); - else - V_DrawString(x + 20, y2, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime); - - if (players[tab[i].num].mo->color) - { - colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE); - if (players[tab[i].num].mo->colorized) - colormap = R_GetTranslationColormap(TC_RAINBOW, players[tab[i].num].mo->color, GTC_CACHE); - else - colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE); - - V_DrawMappedPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin][FACE_RANK], colormap); - /*if ((gametyperules & GTR_BUMPERS) && players[tab[i].num].bumpers > 0) -- not enough space for this - { - INT32 bumperx = x+19; - V_DrawMappedPatch(bumperx-2, y-4, 0, kp_tinybumper[0], colormap); - for (j = 1; j < players[tab[i].num].bumpers; j++) - { - bumperx += 5; - V_DrawMappedPatch(bumperx, y-4, 0, kp_tinybumper[1], colormap); - } - }*/ - } - - if (tab[i].num == whiteplayer) - V_DrawScaledPatch(x, y-4, 0, kp_facehighlight[(leveltime / 4) % 8]); - - if ((gametyperules & GTR_BUMPERS) && (players[tab[i].num].pflags & PF_ELIMINATED)) - V_DrawScaledPatch(x-4, y-7, 0, kp_ranknobumpers); - else - { - INT32 pos = players[tab[i].num].position; - if (pos < 0 || pos > MAXPLAYERS) - pos = 0; - // Draws the little number over the face - V_DrawScaledPatch(x-5, y+6, 0, kp_facenum[pos]); - } - - if ((gametyperules & GTR_CIRCUIT)) - { -#define timestring(time) va("%i'%02i\"%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time)) - if (scorelines >= 8) - { - if (players[tab[i].num].exiting) - V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(players[tab[i].num].realtime)); - else if (players[tab[i].num].pflags & PF_NOCONTEST) - V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, "NO CONTEST."); - else - V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, va("Lap %d", tab[i].count)); - } - else - { - if (players[tab[i].num].exiting) - V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[tab[i].num].realtime)); - else if (players[tab[i].num].pflags & PF_NOCONTEST) - V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST."); - else - V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count)); - } -#undef timestring - } - else - V_DrawRightAlignedString(x+rightoffset, y, 0, va("%u", tab[i].count)); - - y -= 18; - if (i == 8) - { - y = basey + 7*18; - x = basex; - } - } -} - static void K_drawKartLaps(void) { INT32 splitflags = V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN; diff --git a/src/k_hud.h b/src/k_hud.h index 5bdc53a9e..c16a45b69 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -41,7 +41,6 @@ void K_LoadKartHUDGraphics(void); void K_drawKartHUD(void); void K_drawKartFreePlay(void); void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, UINT8 mode); -void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol); void K_DrawMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap); void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap); void K_drawTargetHUD(const vector3_t *origin, player_t *player); diff --git a/src/typedef.h b/src/typedef.h index ebe816913..eaddda5e9 100644 --- a/src/typedef.h +++ b/src/typedef.h @@ -139,9 +139,6 @@ TYPEDEF (demoghost); TYPEDEF (roundentry_t); TYPEDEF (mapsearchfreq_t); -// hu_stuff.h -TYPEDEF (playersort_t); - // i_joy.h TYPEDEF (JoyType_t); From c1eb01c03d47ab5a22d8d87adf9af3ad86dfdc2f Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 21:39:06 +0100 Subject: [PATCH 52/57] Ping for Y_PlayerStandingsDrawer TODO: CPU indicator --- src/hu_stuff.c | 39 +++++++++++++++++++++++++++++++-------- src/hu_stuff.h | 2 +- src/screen.c | 2 +- src/y_inter.c | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 68 insertions(+), 11 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 2681ffa56..ae4e41efd 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2343,12 +2343,13 @@ Ping_gfx_color (int lag) // // HU_drawPing // -void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, INT32 flags, boolean offline) +void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, INT32 flags, boolean offline, SINT8 toside) { UINT8 *colormap = NULL; INT32 measureid = cv_pingmeasurement.value ? 1 : 0; INT32 gfxnum; // gfx to draw boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value); + fixed_t x2, y2; if (!server && lag <= (tic_t)cv_mindelay.value) { @@ -2356,13 +2357,35 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, INT32 flags, boolean offline) drawlocal = true; } + x2 = x; + y2 = y + FRACUNIT; + + if (toside == 0) + { + if (measureid == 1) + { + x2 += ((11 - pingmeasure[measureid]->width) * FRACUNIT); + } + else + { + x2 += (10 * FRACUNIT); + } + + y2 += (8 * FRACUNIT); + } + else if (toside > 0) + { + x2 += (20 * FRACUNIT); + } + //else if (toside < 0) + gfxnum = Ping_gfx_num(lag); if (measureid == 1) { V_DrawFixedPatch( - x + ((11 - pingmeasure[measureid]->width) * FRACUNIT), - y + (9 * FRACUNIT), + x2, + y2, FRACUNIT, flags, pingmeasure[measureid], NULL @@ -2403,9 +2426,9 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, INT32 flags, boolean offline) lag = (INT32)(lag * (1000.00f / TICRATE)); } - x = V_DrawPingNum( - x + (((measureid == 1) ? 11 - pingmeasure[measureid]->width : 10) * FRACUNIT), - y + (9 * FRACUNIT), + x2 = V_DrawPingNum( + x2, + y2, flags, lag, colormap ); @@ -2413,8 +2436,8 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, INT32 flags, boolean offline) if (measureid == 0) { V_DrawFixedPatch( - x + ((1 - pingmeasure[measureid]->width) * FRACUNIT), - y + (9 * FRACUNIT), + x2 + ((1 - pingmeasure[measureid]->width) * FRACUNIT), + y2, FRACUNIT, flags, pingmeasure[measureid], NULL diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 084a7d51b..6e647e401 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -146,7 +146,7 @@ void HU_TickSongCredits(void); char HU_dequeueChatChar(void); void HU_Erase(void); void HU_clearChatChars(void); -void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, INT32 flags, boolean offline); // Lat': Ping drawer for scoreboard. +void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, INT32 flags, boolean offline, SINT8 toside); // Lat': Ping drawer for scoreboard. void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // CECHO interface. diff --git a/src/screen.c b/src/screen.c index 1b10c0373..b584cb9f8 100644 --- a/src/screen.c +++ b/src/screen.c @@ -660,7 +660,7 @@ void SCR_DisplayLocalPing(void) { INT32 dispy = cv_ticrate.value ? 160 : 181; offline = (consoleplayer == serverplayer); - HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS, offline); + HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS, offline, 0); } } diff --git a/src/y_inter.c b/src/y_inter.c index 9f570e997..7c15b4453 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -413,9 +413,12 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) SINT8 yspacing = 14; INT32 heightcount = (standings->numplayers - 1); - INT32 x, y, returny; + INT32 x, y; + INT32 x2, returny; boolean verticalresults = (standings->numplayers < 4); + boolean datarightofcolumn = false; + boolean drawping = (netgame && gamestate == GS_LEVEL); INT32 hilicol = highlightflags; @@ -424,6 +427,11 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) if (verticalresults) { x = (BASEVIDWIDTH/2) - 61; + + if (drawping) + { + x += 9; + } } else { @@ -432,6 +440,7 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) } x += xoffset; + x2 = x - 9; if (standings->numplayers > 10) { @@ -535,6 +544,28 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) standings->strval[i] ); + if (drawping) + { + if (players[pnum].bot) + { + /*V_DrawScaledPatch( + x2, y-1, + 0, + kp_cpu + );*/ + } + else if (pnum != serverplayer || !server_lagless) + { + HU_drawPing( + (x2 - 2) * FRACUNIT, (y-2) * FRACUNIT, + playerpingtable[pnum], + 0, + false, + (datarightofcolumn ? 1 : -1) + ); + } + } + // Reverse the jitter offset if (standings->jitter[pnum] > 0) y++; @@ -546,6 +577,9 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) { x = 169 + xoffset; y = returny; + + datarightofcolumn = true; + x2 = x + 118 + 5; } } } From c9b438d50d909c13b563d489f6b9c3bc7d7a1c23 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 22:44:09 +0100 Subject: [PATCH 53/57] Show Round Queue on Pause menu Also includes secret support for widescreen. I was planning to put this on tab rankings, which doesn't have borders. Pause menu does, but it would be a waste to strip it back out again. --- src/g_game.c | 2 +- src/hu_stuff.c | 39 ---------------- src/k_menudraw.c | 27 +++++++++++ src/y_inter.c | 118 +++++++++++++++++++++++++++-------------------- src/y_inter.h | 2 +- 5 files changed, 97 insertions(+), 91 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2047262e1..37399c561 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4165,7 +4165,7 @@ static void G_GetNextMap(void) } else if (roundqueue.size > 0) { - // See also Y_CalculateMatchData + // See also Y_CalculateMatchData, M_DrawPause boolean permitrank = false; if (grandprixinfo.gp == true && grandprixinfo.gamespeed >= KARTSPEED_NORMAL) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ae4e41efd..f1d4b07b6 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2730,45 +2730,6 @@ static void HU_DrawRankings(void) // Returns early if there's no players to draw Y_PlayerStandingsDrawer(&standings, 0); - /*i = MAXPLAYERS; - - for (j = 0; j < standings.numplayers; j++) - { - i = standings.num[j]; - - if (i >= MAXPLAYERS - || playeringame[i] == false - || players[i].spectator == true) - { - continue; - } - - if (demo.playback) - { - if (!P_IsDisplayPlayer(&players[i])) - { - continue; - } - - break; - } - - if (!P_IsLocalPlayer(&players[i])) - { - continue; - } - - break; - } - - if (i != MAXPLAYERS) - { - standings.mainplayer = i; - } - - // Returns early if there's no roundqueue entries to draw - Y_RoundQueueDrawer();*/ - // draw spectators in a ticker across the bottom if (netgame && G_GametypeHasSpectators()) HU_DrawSpectatorTicker(); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 8286a265e..326d2093a 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -52,6 +52,8 @@ #include "doomstat.h" // MAXSPLITSCREENPLAYERS #include "k_grandprix.h" // K_CanChangeRules +#include "y_inter.h" // Y_RoundQueueDrawer + #include "i_joy.h" // for joystick menu controls // Condition Sets @@ -4074,6 +4076,31 @@ void M_DrawPause(void) if (word2len) V_DrawCenteredLSTitleLowString(220 + offset*2, 103, 0, word2); } + + y_data_t standings; + memset(&standings, 0, sizeof (standings)); + + standings.mainplayer = (demo.playback ? displayplayers[0] : consoleplayer); + + // See also G_GetNextMap, Y_CalculateMatchData + if ( + grandprixinfo.gp == true + && netgame == false // TODO netgame Special Mode support + && grandprixinfo.gamespeed >= KARTSPEED_NORMAL + && roundqueue.size > 1 + && roundqueue.entries[roundqueue.size - 1].rankrestricted == true + && ( + gamedata->everseenspecial == true + || roundqueue.position == roundqueue.size + ) + ) + { + // Additional cases in which it should always be shown. + standings.showrank = true; + } + + // Returns early if there's no roundqueue entries to draw + Y_RoundQueueDrawer(&standings, false, false); } void M_DrawPlaybackMenu(void) diff --git a/src/y_inter.c b/src/y_inter.c index 7c15b4453..54608faf1 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -152,7 +152,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) getmainplayer = true; { - // See also G_GetNextMap + // See also G_GetNextMap, M_DrawPause data.showrank = false; if (grandprixinfo.gp == true && netgame == false // TODO netgame Special Mode support @@ -590,7 +590,7 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) // Handles drawing the bottom-of-screen progression. // Currently requires intermission y_data to be active, but abstraction is feasible. // -void Y_RoundQueueDrawer(void) +void Y_RoundQueueDrawer(y_data_t *standings, boolean doanimations, boolean widescreen) { if (roundqueue.size == 0) { @@ -610,6 +610,9 @@ void Y_RoundQueueDrawer(void) UINT8 *greymap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_CACHE); + INT32 baseflags = (widescreen ? V_SNAPTOBOTTOM : 0); + INT32 bufferspace = ((vid.width/vid.dupx) - BASEVIDWIDTH) / 2; + // Background pieces patch_t *queuebg_flat = W_CachePatchName("R_RMBG1", PU_PATCH); patch_t *queuebg_upwa = W_CachePatchName("R_RMBG2", PU_PATCH); @@ -652,22 +655,22 @@ void Y_RoundQueueDrawer(void) UINT8 pskin = MAXSKINS; UINT16 pcolor = SKINCOLOR_WHITE; - if (data.mainplayer == MAXPLAYERS) + if (standings->mainplayer == MAXPLAYERS) { ; } - else if (playeringame[data.mainplayer] == false) + else if (playeringame[standings->mainplayer] == false) { - data.mainplayer = MAXPLAYERS; + standings->mainplayer = MAXPLAYERS; } - else if (players[data.mainplayer].spectator == false - && players[data.mainplayer].skin < numskins - && players[data.mainplayer].skincolor != SKINCOLOR_NONE - && players[data.mainplayer].skincolor < numskincolors + else if (players[standings->mainplayer].spectator == false + && players[standings->mainplayer].skin < numskins + && players[standings->mainplayer].skincolor != SKINCOLOR_NONE + && players[standings->mainplayer].skincolor < numskincolors ) { - pskin = players[data.mainplayer].skin; - pcolor = players[data.mainplayer].skincolor; + pskin = players[standings->mainplayer].skin; + pcolor = players[standings->mainplayer].skincolor; } colormap = R_GetTranslationColormap(TC_DEFAULT, pcolor, GTC_CACHE); @@ -697,19 +700,20 @@ void Y_RoundQueueDrawer(void) // The following block handles horizontal easing of the // progression bar on the last non-rankrestricted round. - if (data.showrank == true) + if (standings->showrank == true) { fixed_t percentslide = 0; SINT8 deferxoffs = 0; - const INT32 desiredx2 = 290; - spacetospecial = max(desiredx2 - widthofroundqueue - 24, 16); + const INT32 desiredx2 = (290 + bufferspace); + spacetospecial = max(desiredx2 - widthofroundqueue - (24 - bufferspace), 16); if (roundqueue.position == roundqueue.size) { percentslide = FRACUNIT; } - else if (roundqueue.position == roundqueue.size-1 + else if (doanimations + && roundqueue.position == roundqueue.size-1 && timer - interpoffs <= 3*TICRATE) { const INT32 through = (3*TICRATE) - (timer - interpoffs - 1); @@ -753,13 +757,13 @@ void Y_RoundQueueDrawer(void) if (upwa == true) { xiter -= 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_upwa, greymap); + V_DrawMappedPatch(xiter, 167, baseflags, queuebg_upwa, greymap); } - while (xiter > 0) + while (xiter > -bufferspace) { xiter -= 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(xiter, 167, baseflags, queuebg_flat, greymap); } for (i = 0; i < workingqueuesize; i++) @@ -772,7 +776,7 @@ void Y_RoundQueueDrawer(void) { y = 171; - V_DrawMappedPatch(x, 167, 0, queuebg_down, greymap); + V_DrawMappedPatch(x, 167, baseflags, queuebg_down, greymap); if (i+1 != workingqueuesize) // no more line? { @@ -785,13 +789,13 @@ void Y_RoundQueueDrawer(void) if (i+1 != workingqueuesize) // no more line? { - V_DrawMappedPatch(x, 167, 0, queuebg_upwa, greymap); + V_DrawMappedPatch(x, 167, baseflags, queuebg_upwa, greymap); choose_line = line_upwa; } else { - V_DrawMappedPatch(x, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(x, 167, baseflags, queuebg_flat, greymap); } } @@ -801,7 +805,11 @@ void Y_RoundQueueDrawer(void) playery = (y * FRACUNIT); // If there's standard progression ahead of us, visibly move along it. - if (choose_line != NULL && timer - interpoffs <= 2*TICRATE) + if ( + doanimations + && choose_line != NULL + && timer - interpoffs <= 2*TICRATE + ) { // 8 tics is chosen because it plays nice // with both the x and y distance to cover. @@ -857,7 +865,7 @@ void Y_RoundQueueDrawer(void) V_DrawMappedPatch( x - 1, 178, - 0, + baseflags, choose_line[BPP_SHADOW], NULL ); @@ -868,7 +876,11 @@ void Y_RoundQueueDrawer(void) { lineisfull = true; } - else if (roundqueue.position == i+1 && timer - interpoffs <= 2*TICRATE) + else if ( + doanimations == true + && roundqueue.position == i+1 + && timer - interpoffs <= 2*TICRATE + ) { // 8 tics is chosen because it plays nice // with both the x and y distance to cover. @@ -886,7 +898,7 @@ void Y_RoundQueueDrawer(void) { V_DrawMappedPatch( x - 1, 179, - 0, + baseflags, choose_line[BPP_DONE], colormap ); @@ -894,9 +906,9 @@ void Y_RoundQueueDrawer(void) V_SetClipRect( playerx + FRACUNIT, 0, - BASEVIDWIDTH << FRACBITS, + (BASEVIDWIDTH + bufferspace) << FRACBITS, BASEVIDHEIGHT << FRACBITS, - 0 + baseflags ); recttoclear = true; @@ -905,7 +917,7 @@ void Y_RoundQueueDrawer(void) V_DrawMappedPatch( x - 1, 179, - 0, + baseflags, choose_line[lineisfull ? BPP_DONE : BPP_AHEAD], lineisfull ? colormap : NULL ); @@ -919,15 +931,15 @@ void Y_RoundQueueDrawer(void) { // No more line! Fill in background to right edge of screen xiter = x; - while (xiter < BASEVIDWIDTH) + while (xiter < BASEVIDWIDTH + bufferspace) { xiter += 24; - V_DrawMappedPatch(xiter, 167, 0, queuebg_flat, greymap); + V_DrawMappedPatch(xiter, 167, baseflags, queuebg_flat, greymap); } // Handle special entry on the end // (has to be drawn before the semifinal dot due to overlap) - if (data.showrank == true) + if (standings->showrank == true) { const fixed_t x2 = x + spacetospecial; @@ -936,26 +948,29 @@ void Y_RoundQueueDrawer(void) playerx = (x2 * FRACUNIT); playery = (y * FRACUNIT); } - else if (roundqueue.position == roundqueue.size-1 - && timer - interpoffs <= 2*TICRATE) + else if ( + doanimations == true + && roundqueue.position == roundqueue.size-1 + && timer - interpoffs <= 2*TICRATE + ) { const INT32 through = ((2*TICRATE) - (timer - interpoffs - 1)); fixed_t linefill; - if (through > data.linemeter) + if (through > standings->linemeter) { - linefill = data.linemeter * FRACUNIT; + linefill = standings->linemeter * FRACUNIT; // Small judder if there's enough time for it if (timer <= 2) { ; } - else if (through == (data.linemeter + 1 + interpoffs)) + else if (through == (standings->linemeter + 1 + interpoffs)) { playerx += FRACUNIT; } - else if (through == (data.linemeter + 2 + interpoffs)) + else if (through == (standings->linemeter + 2 + interpoffs)) { playerx -= FRACUNIT; } @@ -981,7 +996,7 @@ void Y_RoundQueueDrawer(void) } // Special background bump - V_DrawMappedPatch(x2 - 13, 167, 0, queuebg_prize, greymap); + V_DrawMappedPatch(x2 - 13, 167, baseflags, queuebg_prize, greymap); // Draw the final line const fixed_t barstart = x + 6; @@ -1009,14 +1024,14 @@ void Y_RoundQueueDrawer(void) { V_DrawMappedPatch( xiter - 1, 177, - 0, + baseflags, line_flat[BPP_SHADOW], NULL ); V_DrawMappedPatch( xiter - 1, 179, - 0, + baseflags, line_flat[BPP_DONE], colormap ); @@ -1030,9 +1045,9 @@ void Y_RoundQueueDrawer(void) V_SetClipRect( playerx, 0, - BASEVIDWIDTH << FRACBITS, + (BASEVIDWIDTH + bufferspace) << FRACBITS, BASEVIDHEIGHT << FRACBITS, - 0 + baseflags ); recttoclear = true; @@ -1042,14 +1057,14 @@ void Y_RoundQueueDrawer(void) { V_DrawMappedPatch( xiter - 1, 177, - 0, + baseflags, line_flat[BPP_SHADOW], NULL ); V_DrawMappedPatch( xiter - 1, 179, - 0, + baseflags, line_flat[lineisfull ? BPP_DONE : BPP_AHEAD], lineisfull ? colormap : NULL ); @@ -1066,7 +1081,7 @@ void Y_RoundQueueDrawer(void) // Draw the final dot V_DrawMappedPatch( x2 - 8, y, - 0, + baseflags, prize_dot[roundqueue.position == roundqueue.size ? BPP_DONE : BPP_AHEAD], roundqueue.position == roundqueue.size ? oppositemap : colormap ); @@ -1097,7 +1112,7 @@ void Y_RoundQueueDrawer(void) { V_DrawMappedPatch( x - 8, y, - 0, + baseflags, chose_dot[roundqueue.position >= i+1 ? BPP_DONE : BPP_AHEAD], roundqueue.position == i+1 ? oppositemap : colormap ); @@ -1122,7 +1137,8 @@ void Y_RoundQueueDrawer(void) // Draw outline for rank icon V_DrawFixedPatch( playerx, playery, - FRACUNIT, 0, + FRACUNIT, + baseflags, rpmark[0], NULL ); @@ -1130,7 +1146,8 @@ void Y_RoundQueueDrawer(void) // Draw the player's rank icon V_DrawFixedPatch( playerx + FRACUNIT, playery + FRACUNIT, - FRACUNIT, 0, + FRACUNIT, + baseflags, faceprefix[pskin][FACE_RANK], R_GetTranslationColormap(pskin, pcolor, GTC_CACHE) ); @@ -1140,7 +1157,8 @@ void Y_RoundQueueDrawer(void) // Draw mini arrow V_DrawFixedPatch( playerx, playery, - FRACUNIT, 0, + FRACUNIT, + baseflags, rpmark[1], NULL ); @@ -1283,7 +1301,7 @@ skiptallydrawer: goto finalcounter; // Returns early if there's no roundqueue entries to draw - Y_RoundQueueDrawer(); + Y_RoundQueueDrawer(&data, true, false); if (netgame) { diff --git a/src/y_inter.h b/src/y_inter.h index 127ddb968..1afe04585 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -48,7 +48,7 @@ void Y_Ticker(void); // Specific sub-drawers void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset); -void Y_RoundQueueDrawer(void); +void Y_RoundQueueDrawer(y_data_t *standings, boolean doanimations, boolean widescreen); void Y_StartIntermission(void); void Y_EndIntermission(void); From 27dc9a3006a88eb4b67d0fe44e98c3b3918b9204 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 23:06:39 +0100 Subject: [PATCH 54/57] M_DrawPause: Only draw roundqueue outside of GS_INTERMISSION - that's already drawing it --- src/k_menudraw.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 326d2093a..335a26a5e 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -4077,30 +4077,33 @@ void M_DrawPause(void) V_DrawCenteredLSTitleLowString(220 + offset*2, 103, 0, word2); } - y_data_t standings; - memset(&standings, 0, sizeof (standings)); - - standings.mainplayer = (demo.playback ? displayplayers[0] : consoleplayer); - - // See also G_GetNextMap, Y_CalculateMatchData - if ( - grandprixinfo.gp == true - && netgame == false // TODO netgame Special Mode support - && grandprixinfo.gamespeed >= KARTSPEED_NORMAL - && roundqueue.size > 1 - && roundqueue.entries[roundqueue.size - 1].rankrestricted == true - && ( - gamedata->everseenspecial == true - || roundqueue.position == roundqueue.size - ) - ) + if (gamestate != GS_INTERMISSION) { - // Additional cases in which it should always be shown. - standings.showrank = true; - } + y_data_t standings; + memset(&standings, 0, sizeof (standings)); - // Returns early if there's no roundqueue entries to draw - Y_RoundQueueDrawer(&standings, false, false); + standings.mainplayer = (demo.playback ? displayplayers[0] : consoleplayer); + + // See also G_GetNextMap, Y_CalculateMatchData + if ( + grandprixinfo.gp == true + && netgame == false // TODO netgame Special Mode support + && grandprixinfo.gamespeed >= KARTSPEED_NORMAL + && roundqueue.size > 1 + && roundqueue.entries[roundqueue.size - 1].rankrestricted == true + && ( + gamedata->everseenspecial == true + || roundqueue.position == roundqueue.size + ) + ) + { + // Additional cases in which it should always be shown. + standings.showrank = true; + } + + // Returns early if there's no roundqueue entries to draw + Y_RoundQueueDrawer(&standings, false, false); + } } void M_DrawPlaybackMenu(void) From 39682a241d9100fb95210bcef2de1fe4451d21a0 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 23:08:26 +0100 Subject: [PATCH 55/57] Y_PlayerStandingsDrawer: Set a minimum y height to prevent overlap with the header text --- src/y_inter.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 54608faf1..f313137e1 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -455,7 +455,15 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) } } - y = returny = 106 - (heightcount * yspacing)/2; + y = 106 - (heightcount * yspacing)/2; + + if (y < 70) + { + // One sanity check. + y = 70; + } + + returny = y; boolean (*_isHighlightedPlayer)(player_t *) = (demo.playback From 9179e6fd869544164c82a12d874c6f79d9cd0501 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 May 2023 23:12:57 +0100 Subject: [PATCH 56/57] Since intermission is bordered, don't do widescreen accomodation for the Standings xoffset slide --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f313137e1..064196d15 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1261,11 +1261,11 @@ void Y_IntermissionDrawer(void) const INT32 count = (intertic - sorttic); if (count < 8) - x = -((count * vid.width) / (8 * vid.dupx)); + x = -((count * BASEVIDWIDTH) / 8); else if (count == 8) goto skiptallydrawer; else if (count < 16) - x = (((16 - count) * vid.width) / (8 * vid.dupx)); + x = (((16 - count) * BASEVIDWIDTH) / 8); } // Draw the header bar From 9ec6a6bbe0ae210ac7571863019dc9e180f47169 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 12 May 2023 00:02:51 +0100 Subject: [PATCH 57/57] HU_DrawRankings: Fix finish time (was using laps converted to seconds instead of realtime) --- src/hu_stuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f1d4b07b6..258297f39 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2708,8 +2708,8 @@ static void HU_DrawRankings(void) if (players[i].exiting) { - snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(standings.val[standings.numplayers], true), - G_TicsToSeconds(standings.val[standings.numplayers]), G_TicsToCentiseconds(standings.val[standings.numplayers])); + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(players[i].realtime, true), + G_TicsToSeconds(players[i].realtime), G_TicsToCentiseconds(players[i].realtime)); } else {