From 9364d0b479f917f766b04ccf7aa7555c8616a599 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Tue, 24 May 2022 01:50:00 +0200 Subject: [PATCH] better defaults in menus to make navigation easier when you just want to go fast --- src/d_netcmd.c | 14 +++++++++----- src/d_netcmd.h | 4 ++++ src/k_menu.h | 9 +++++++++ src/k_menufunc.c | 14 ++++++++++---- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 9d6fe0c0b..9554590b5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -317,6 +317,9 @@ consvar_t cv_lastprofile[MAXSPLITSCREENPLAYERS] = { // You choose this profile when starting the game, this will also set lastprofile[0] consvar_t cv_currprofile = CVAR_INIT ("currprofile", "-1", CV_HIDDEN, lastprofile_cons_t, NULL); +// This one is used exclusively for the titlescreen +consvar_t cv_ttlprofilen = CVAR_INIT ("ttlprofilen", "0", CV_SAVE, lastprofile_cons_t, NULL); + // Cvar for using splitscreen with 1 device. consvar_t cv_splitdevice = CVAR_INIT ("splitdevice", "Off", CV_HIDDEN, CV_OnOff, NULL); @@ -889,6 +892,7 @@ void D_RegisterClientCommands(void) } CV_RegisterVar(&cv_currprofile); + CV_RegisterVar(&cv_ttlprofilen); CV_RegisterVar(&cv_splitdevice); // preferred number of players @@ -1316,7 +1320,7 @@ UINT8 CanChangeSkin(INT32 playernum) if (cv_restrictskinchange.value) { UINT8 i; - + // Can change skin during initial countdown. if (leveltime < starttime) return true; @@ -1324,23 +1328,23 @@ UINT8 CanChangeSkin(INT32 playernum) // Not in game, so you can change if (players[playernum].spectator || players[playernum].playerstate == PST_DEAD || players[playernum].playerstate == PST_REBORN) return true; - + // Check for freeeplay for (i = 0; i < MAXPLAYERS; i++) { if (i == consoleplayer) continue; - if (playeringame[i] && !players[i].spectator && gamestate == GS_LEVEL) + if (playeringame[i] && !players[i].spectator && gamestate == GS_LEVEL) return false; // Not freeplay! } - + // if we've gotten here, then it's freeplay, and switching anytime is fair game. return true; } // if restrictskinchange is off and we're trying to change skins, don't allow changing skins while moving after the race has started. else if (gamestate == GS_LEVEL && leveltime >= starttime) return (!P_PlayerMoving(playernum)); - + return true; } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index e9c9b8f32..a352f9096 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -29,6 +29,10 @@ extern consvar_t cv_lastprofile[MAXSPLITSCREENPLAYERS]; // Used to know how to make the options menu behave among other things. extern consvar_t cv_currprofile; +// This is used to save the last profile you used on the title screen. +// that way you can mash n all... +extern consvar_t cv_ttlprofilen; + // CVar that allows starting as many splitscreens as you want with one device // Intended for use with testing extern consvar_t cv_splitdevice; diff --git a/src/k_menu.h b/src/k_menu.h index b8648541d..e69c8d907 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -192,6 +192,15 @@ extern menu_t PLAY_TimeAttackDef; extern menuitem_t PLAY_MP_OptSelect[]; extern menu_t PLAY_MP_OptSelectDef; +typedef enum +{ + mhost_sname = 0, + mhost_public, + mhost_maxp, + mhost_gametype, + mhost_go, +} mhost_e; + extern menuitem_t PLAY_MP_Host[]; extern menu_t PLAY_MP_HostDef; diff --git a/src/k_menufunc.c b/src/k_menufunc.c index e7966dfc0..0bb66ec94 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1065,7 +1065,7 @@ void M_StartControlPanel(void) { // we need to do this before setting ApplyProfile otherwise funky things are going to happen. currentMenu = &MAIN_ProfilesDef; - optionsmenu.profilen = cv_lastprofile[0].value; + optionsmenu.profilen = cv_ttlprofilen.value; // options don't need initializing here. PR_ApplyProfile(0, 0); // apply guest profile to player 0 by default. @@ -1074,6 +1074,8 @@ void M_StartControlPanel(void) // make sure we don't overstep that. if (optionsmenu.profilen > PR_GetNumProfiles()) optionsmenu.profilen = PR_GetNumProfiles(); + else if (optionsmenu.profilen < 0) + optionsmenu.profilen = 0; itemOn = 0; @@ -3092,7 +3094,6 @@ void M_SetupDifficultySelect(INT32 choice) // setup the difficulty menu and then remove choices depending on choice PLAY_RaceDifficultyDef.prevMenu = currentMenu; - M_SetupNextMenu(&PLAY_RaceDifficultyDef, false); PLAY_RaceDifficulty[0].status = IT_STRING|IT_CVAR; PLAY_RaceDifficulty[1].status = IT_DISABLED; @@ -3107,15 +3108,17 @@ void M_SetupDifficultySelect(INT32 choice) PLAY_RaceDifficulty[2].status = IT_STRING2|IT_CVAR; // CPUs on/off use string2 to signify not to use the normal gm font drawer PLAY_RaceDifficulty[3].status = IT_STRING2|IT_CVAR; // Encore on/off use string2 to signify not to use the normal gm font drawer PLAY_RaceDifficulty[5].status = IT_STRING|IT_CALL; // Level Select (Match Race) - itemOn = 5; // Select cup select by default. + PLAY_RaceDifficultyDef.lastOn = 5; // Select cup select by default. } else // GP { PLAY_RaceDifficulty[3].status = IT_STRING2|IT_CVAR; // Encore on/off use string2 to signify not to use the normal gm font drawer PLAY_RaceDifficulty[4].status = IT_STRING|IT_CALL; // Level Select (GP) - itemOn = 4; // Select cup select by default. + PLAY_RaceDifficultyDef.lastOn = 4; // Select cup select by default. } + + M_SetupNextMenu(&PLAY_RaceDifficultyDef, false); } // calls the above but changes the cvar we set @@ -3683,6 +3686,7 @@ void M_MPHostInit(INT32 choice) (void)choice; mpmenu.modewinextend[0][0] = 1; M_SetupNextMenu(&PLAY_MP_HostDef, true); + itemOn = mhost_go; } void M_MPSetupNetgameMapSelect(INT32 choice) @@ -4087,6 +4091,7 @@ static void M_FirstPickProfile(INT32 c) // Tell the game this is the last profile we picked. CV_StealthSetValue(&cv_lastprofile[0], optionsmenu.profilen); + CV_StealthSetValue(&cv_ttlprofilen, optionsmenu.profilen); // Save em! PR_SaveProfiles(); @@ -4972,6 +4977,7 @@ static void M_EraseProfileResponse(INT32 choice) if (optionsmenu.eraseprofilen == cv_currprofile.value) { CV_StealthSetValue(&cv_currprofile, -1); + CV_StealthSetValue(&cv_ttlprofilen, 0); F_StartIntro(); M_ClearMenus(true); }