From db95e3144d1fe8e59b294d0319ec46e9783f96ef Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 25 Nov 2022 17:59:18 +0000 Subject: [PATCH] Re-add mid-game rankings - gc_rankings, bound to TAB by default - Now a toggle, rather than a hold behaviour - Rearrange HU_Drawer to have chat (and cecho/music credits) render over everything else (like, say, tab rankings) - Update PROFILEVER to 2 so we can add the new control to old profiles --- src/g_input.c | 27 +++++++------- src/g_input.h | 1 + src/hu_stuff.c | 92 +++++++++++++++++++++--------------------------- src/k_menudef.c | 3 ++ src/k_profiles.c | 16 +++++++-- src/k_profiles.h | 2 +- 6 files changed, 73 insertions(+), 68 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 9fbf89bf0..08d7ab2ed 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -525,19 +525,20 @@ void G_DefineDefaultControls(void) { // These defaults are bad & temporary. // Keyboard controls - gamecontroldefault[gc_up ][0] = KEY_UPARROW; - gamecontroldefault[gc_down ][0] = KEY_DOWNARROW; - gamecontroldefault[gc_left ][0] = KEY_LEFTARROW; - gamecontroldefault[gc_right][0] = KEY_RIGHTARROW; - gamecontroldefault[gc_a ][0] = 'z'; - gamecontroldefault[gc_b ][0] = 'x'; - gamecontroldefault[gc_c ][0] = 'c'; - gamecontroldefault[gc_x ][0] = 'a'; - gamecontroldefault[gc_y ][0] = 's'; - gamecontroldefault[gc_z ][0] = 'd'; - gamecontroldefault[gc_l ][0] = 'q'; - gamecontroldefault[gc_r ][0] = 'e'; - gamecontroldefault[gc_start][0] = KEY_ESCAPE; // * + gamecontroldefault[gc_up ][0] = KEY_UPARROW; + gamecontroldefault[gc_down ][0] = KEY_DOWNARROW; + gamecontroldefault[gc_left ][0] = KEY_LEFTARROW; + gamecontroldefault[gc_right ][0] = KEY_RIGHTARROW; + gamecontroldefault[gc_a ][0] = 'z'; + gamecontroldefault[gc_b ][0] = 'x'; + gamecontroldefault[gc_c ][0] = 'c'; + gamecontroldefault[gc_x ][0] = 'a'; + gamecontroldefault[gc_y ][0] = 's'; + gamecontroldefault[gc_z ][0] = 'd'; + gamecontroldefault[gc_l ][0] = 'q'; + gamecontroldefault[gc_r ][0] = 'e'; + gamecontroldefault[gc_start ][0] = KEY_ESCAPE; // * + gamecontroldefault[gc_rankings][0] = KEY_TAB; // Gamepad controls gamecontroldefault[gc_up ][1] = KEY_HAT1+0; // D-Pad Up diff --git a/src/g_input.h b/src/g_input.h index 14aa5aba3..17ecb9281 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -78,6 +78,7 @@ typedef enum gc_console, gc_talk, gc_teamtalk, + gc_rankings, gc_screenshot, gc_recordgif, diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 3fbcddd7f..dcfc8cf78 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -980,18 +980,27 @@ static void HU_TickSongCredits(void) void HU_Ticker(void) { + static boolean hu_holdscores = false; + if (dedicated) return; hu_tick++; hu_tick &= 7; // currently only to blink chat input cursor - /* - if (PlayerInputDown(1, gc_scores)) - hu_showscores = !chat_on; + // Rankings + if (G_PlayerInputDown(0, gc_rankings, 0)) + { + if (!hu_holdscores) + { + hu_showscores ^= true; + } + hu_holdscores = true; + } else - hu_showscores = false; - */ + { + hu_holdscores = false; + } hu_keystrokes = false; @@ -2066,35 +2075,8 @@ void HU_DrawSongCredits(void) // void HU_Drawer(void) { - if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1))) - V_DrawVhsEffect(demo.rewinding); - - // draw chat string plus cursor - if (chat_on) - { - if (!OLDCHAT) - HU_DrawChat(); - else - HU_DrawChat_Old(); - } - else - { - typelines = 1; - chat_scrolltime = 0; - - if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden) - HU_drawMiniChat(); // draw messages in a cool fashion. - } - - if (cechotimer) - HU_DrawCEcho(); - - if (!( Playing() || demo.playback ) - || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE - || gamestate == GS_CREDITS || gamestate == GS_EVALUATION - || gamestate == GS_ENDING || gamestate == GS_GAMEEND - || gamestate == GS_VOTING || gamestate == GS_WAITINGPLAYERS) // SRB2kart - return; + if (gamestate != GS_LEVEL) + goto drawchat; // draw multiplayer rankings if (hu_showscores) @@ -2117,12 +2099,8 @@ void HU_Drawer(void) } } - if (gamestate != GS_LEVEL) - return; - - // draw song credits - if (cv_songcredits.value && !( hu_showscores && (netgame || multiplayer) )) - HU_DrawSongCredits(); + if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1))) + V_DrawVhsEffect(demo.rewinding); // draw desynch text if (hu_redownloadinggamestate) @@ -2138,20 +2116,30 @@ void HU_Drawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_YELLOWMAP | V_ALLOWLOWERCASE, resynch_text); } - if (modeattacking && pausedelay > 0 && !pausebreakkey) +drawchat: + // draw chat string plus cursor + if (chat_on) { - INT32 strength = ((pausedelay - 1 - NEWTICRATE/2)*10)/(NEWTICRATE/3); - INT32 x = BASEVIDWIDTH/2, y = BASEVIDHEIGHT/2; // obviously incorrect values while we scrap hudinfo - - V_DrawThinString(x, y, - ((leveltime & 4) ? V_SKYMAP : V_BLUEMAP), - "HOLD TO RETRY..."); - - if (strength > 9) - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); - else if (strength > 0) - V_DrawFadeScreen(0, strength); + if (!OLDCHAT) + HU_DrawChat(); + else + HU_DrawChat_Old(); } + else + { + typelines = 1; + chat_scrolltime = 0; + + if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden) + HU_drawMiniChat(); // draw messages in a cool fashion. + } + + if (cechotimer) + HU_DrawCEcho(); + + // draw song credits + if (cv_songcredits.value && !( hu_showscores && (netgame || multiplayer) )) + HU_DrawSongCredits(); } //====================================================================== diff --git a/src/k_menudef.c b/src/k_menudef.c index 4fb6b2262..f080ff4e5 100644 --- a/src/k_menudef.c +++ b/src/k_menudef.c @@ -653,6 +653,9 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_CONTROL, "OPEN TEAM CHAT", "Do we even have team gamemodes?", NULL, {.routine = M_ProfileSetControl}, gc_teamtalk, 0}, + {IT_CONTROL, "SHOW RANKINGS", "Show mid-game rankings.", + NULL, {.routine = M_ProfileSetControl}, gc_rankings, 0}, + {IT_CONTROL, "OPEN CONSOLE", "Opens the developer options console.", NULL, {.routine = M_ProfileSetControl}, gc_console, 0}, diff --git a/src/k_profiles.c b/src/k_profiles.c index 05cd60155..8b3712ed0 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -327,8 +327,8 @@ void PR_LoadProfiles(void) { profilesList[i] = Z_Malloc(sizeof(profile_t), PU_STATIC, NULL); - // Version. - profilesList[i]->version = version; + // Version. (We always update this on successful forward step) + profilesList[i]->version = PROFILEVER; // Names. READSTRINGN(save_p, profilesList[i]->profilename, PROFILENAMELEN); @@ -382,6 +382,18 @@ void PR_LoadProfiles(void) // Controls. for (j = 0; j < num_gamecontrols; j++) { +#ifdef DEVELOP + // Profile update 1-->2: Add gc_rankings. + if (j == gc_rankings && version < 2) + { + for (k = 0; k < MAXINPUTMAPPING; k++) + { + profilesList[i]->controls[j][k] = gamecontroldefault[j][k]; + } + continue; + } +#endif + for (k = 0; k < MAXINPUTMAPPING; k++) { profilesList[i]->controls[j][k] = READINT32(save_p); diff --git a/src/k_profiles.h b/src/k_profiles.h index 0a254bef5..961ac807b 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -27,7 +27,7 @@ #define SKINNAMESIZE 16 #define PROFILENAMELEN 6 -#define PROFILEVER 1 +#define PROFILEVER 2 #define MAXPROFILES 16 #define PROFILESFILE "ringprofiles.prf" #define PROFILE_GUEST 0