From a4f3d4867da9f3f8c5c81142742c5af19f0dae70 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 18:07:05 -0400 Subject: [PATCH] Change dummysplitplayers into splitplayers, unhide it, and set it when joining and not just hosting Silly oversight --- src/d_clisrv.c | 7 +++++-- src/d_netcmd.c | 2 ++ src/g_game.h | 1 + src/m_menu.c | 18 +++++++++--------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 66bde9bd..1385bfcc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2377,8 +2377,11 @@ static void Command_connect(void) CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); } - splitscreen = 3; // TEMPORARY TESTING MEASURE - SplitScreen_OnChange(); + if (splitscreen != cv_splitplayers.value-1) + { + splitscreen = cv_splitplayers.value-1; + SplitScreen_OnChange(); + } botingame = false; botskin = 0; CL_ConnectToServer(viams); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 582649eb..975f7701 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -759,6 +759,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_playername4); CV_RegisterVar(&cv_playercolor4); CV_RegisterVar(&cv_skin4); + // preferred number of players + CV_RegisterVar(&cv_splitplayers); #ifdef SEENAMES CV_RegisterVar(&cv_seenames); diff --git a/src/g_game.h b/src/g_game.h index 10eb4c68..40e21035 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -62,6 +62,7 @@ extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3; extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; +extern consvar_t cv_splitplayers; typedef enum { diff --git a/src/m_menu.c b/src/m_menu.c index 45803c6c..f4f5ae3e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -463,9 +463,9 @@ consvar_t cv_ghost_staff = {"ghost_staff", "Show", CV_SAVE, ghost2_cons_ //todo: add a way to use non-console variables in the menu // or make these consvars legitimate like color or skin. #ifndef NOFOURPLAYER -static void Dummysplitplayers_OnChange(void); -static CV_PossibleValue_t dummysplitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; -static consvar_t cv_dummysplitplayers = {"dummysplitplayers", "One", CV_HIDEN|CV_CALL, dummysplitplayers_cons_t, Dummysplitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; +static void Splitplayers_OnChange(void); +CV_PossibleValue_t splitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; +consvar_t cv_splitplayers = {"splitplayers", "One", CV_CALL, splitplayers_cons_t, Splitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; @@ -949,7 +949,7 @@ menuitem_t PlayerMenu[32] = static menuitem_t MP_SetPlayersMenu[] = { #ifndef NOFOURPLAYER - {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_dummysplitplayers, 10}, + {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_splitplayers, 10}, #endif #ifdef NOFOURPLAYER @@ -1002,13 +1002,13 @@ static menuitem_t MP_OfflineServerMenu[] = }; #ifndef NOFOURPLAYER -static void Dummysplitplayers_OnChange(void) +static void Splitplayers_OnChange(void) { UINT8 i = 1; // player 1 is the last unchanging setup while (i < 4) { - if (i < cv_dummysplitplayers.value) + if (i < cv_splitplayers.value) MP_SetPlayersMenu[i+1].status = IT_STRING|IT_CALL; else MP_SetPlayersMenu[i+1].status = IT_GRAYEDOUT; @@ -3144,7 +3144,7 @@ void M_Init(void) // Menu hacks #ifndef NOFOURPLAYER - CV_RegisterVar(&cv_dummysplitplayers); + CV_RegisterVar(&cv_splitplayers); #endif CV_RegisterVar(&cv_dummyteam); CV_RegisterVar(&cv_dummyscramble); @@ -7398,7 +7398,7 @@ static void M_StartServer(INT32 choice) #ifdef NOFOURPLAYER 1; #else - cv_dummysplitplayers.value-1; + cv_splitplayers.value-1; #endif (void)choice; @@ -7643,7 +7643,7 @@ static void M_DrawServerMenu(void) pskin = 0; #ifndef NOFOURPLAYER - if (!trans && i > cv_dummysplitplayers.value) + if (!trans && i > cv_splitplayers.value) trans = V_TRANSLUCENT; #endif