From b5063ab8f6c81bb37d5cc8a332cd8921ce0e76d8 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 11:02:19 +0100 Subject: [PATCH 01/10] Rework min/max cvars to allow for "named" values outside their range! Kart-port round 3, with the original commit written by me, toaster. --- src/command.c | 74 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/src/command.c b/src/command.c index cfb36f02f..114b37489 100644 --- a/src/command.c +++ b/src/command.c @@ -1123,32 +1123,42 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth) if (var->PossibleValue[0].strvalue && !stricmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar { +#define MINVAL 0 +#define MAXVAL 1 INT32 i; - // search for maximum - for (i = 1; var->PossibleValue[i].strvalue; i++) - if (!stricmp(var->PossibleValue[i].strvalue, "MAX")) - break; #ifdef PARANOIA - if (!var->PossibleValue[i].strvalue) + if (!var->PossibleValue[MAXVAL].strvalue) I_Error("Bounded cvar \"%s\" without maximum!\n", var->name); #endif - if ((v != INT32_MIN && v < var->PossibleValue[0].value) || !stricmp(valstr, "MIN")) + // search for other + for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++) + if (v == var->PossibleValue[i].value || !stricmp(var->PossibleValue[i].strvalue, valstr)) + { + var->value = var->PossibleValue[i].value; + var->string = var->PossibleValue[i].strvalue; + goto finish; + } + + + if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || !stricmp(valstr, "MIN")) { - v = var->PossibleValue[0].value; - valstr = var->PossibleValue[0].strvalue; + v = var->PossibleValue[MINVAL].value; + valstr = var->PossibleValue[MINVAL].strvalue; override = true; overrideval = v; } - else if ((v != INT32_MIN && v > var->PossibleValue[i].value) || !stricmp(valstr, "MAX")) + else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || !stricmp(valstr, "MAX")) { - v = var->PossibleValue[i].value; - valstr = var->PossibleValue[i].strvalue; + v = var->PossibleValue[MAXVAL].value; + valstr = var->PossibleValue[MAXVAL].strvalue; override = true; overrideval = v; } if (v == INT32_MIN) goto badinput; +#undef MINVAL +#undef MAXVAL } else { @@ -1538,7 +1548,6 @@ void CV_AddValue(consvar_t *var, INT32 increment) if (var->PossibleValue) { -#define MINVAL 0 if (var == &cv_nextmap) { // Special case for the nextmap variable, used only directly from the menu @@ -1575,21 +1584,40 @@ void CV_AddValue(consvar_t *var, INT32 increment) return; } } +#define MINVAL 0 +#define MAXVAL 1 else if (var->PossibleValue[MINVAL].strvalue && !strcmp(var->PossibleValue[MINVAL].strvalue, "MIN")) { - // search the next to last - for (max = 0; var->PossibleValue[max+1].strvalue; max++) - ; +#ifdef PARANOIA + if (!var->PossibleValue[MAXVAL].strvalue) + I_Error("Bounded cvar \"%s\" without maximum!\n", var->name); +#endif - if (newvalue < var->PossibleValue[MINVAL].value) // add the max+1 - newvalue += var->PossibleValue[max].value - var->PossibleValue[MINVAL].value + 1; + if (newvalue < var->PossibleValue[MINVAL].value || newvalue > var->PossibleValue[MAXVAL].value) + { + INT32 currentindice = -1, newindice; + for (max = MAXVAL+1; var->PossibleValue[max].strvalue; max++) + if (var->PossibleValue[max].value == var->value) + currentindice = max; - newvalue = var->PossibleValue[MINVAL].value + (newvalue - var->PossibleValue[MINVAL].value) - % (var->PossibleValue[max].value - var->PossibleValue[MINVAL].value + 1); + if (currentindice == -1 && max != MAXVAL+1) + newindice = ((increment > 0) ? MAXVAL : max) + increment; + else + newindice = currentindice + increment; - CV_SetValue(var, newvalue); -#undef MINVAL + if (newindice >= max || newindice <= MAXVAL) + { + newvalue = var->PossibleValue[((increment > 0) ? MINVAL : MAXVAL)].value; + CV_SetValue(var, newvalue); + } + else + CV_Set(var, var->PossibleValue[newindice].strvalue); + } + else + CV_SetValue(var, newvalue); } +#undef MINVAL +#undef MAXVAL else { INT32 currentindice = -1, newindice; @@ -1599,8 +1627,6 @@ void CV_AddValue(consvar_t *var, INT32 increment) if (var->PossibleValue[max].value == var->value) currentindice = max; - max--; - if (var == &cv_chooseskin) { // Special case for the chooseskin variable, used only directly from the menu @@ -1632,7 +1658,7 @@ void CV_AddValue(consvar_t *var, INT32 increment) var->value); #endif - newindice = (currentindice + increment + max + 1) % (max+1); + newindice = (currentindice + increment + max) % max; CV_Set(var, var->PossibleValue[newindice].strvalue); } } From 8bab035279c5f9204b5ae6cdbb65d42a54703a90 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 11:49:37 +0100 Subject: [PATCH 02/10] Added some examples of cvars that can use named values. * Pandora's box now has infinite lives show up as "Infinite" instead of "-1". * `pointlimit None` * `timelimit None` * Ported `basenumlaps` (with "Map default" value) from Kart to replace `usemaplaps`, for if Circuit ever gets shown any love ever again. * `respawndelay Off` * `resynchattempts Don't` --- src/d_clisrv.c | 2 +- src/d_netcmd.c | 29 +++++++++++++++++++++-------- src/d_netcmd.h | 2 +- src/m_menu.c | 9 +++++---- src/p_setup.c | 7 +++++-- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 476bb1a1e..0ea4ec83f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2969,7 +2969,7 @@ consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_NETVAR, CV_OnOff, N consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}}; consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "Don't"}, {0, NULL}}; consvar_t cv_resynchattempts = {"resynchattempts", "10", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL }; consvar_t cv_blamecfail = {"blamecfail", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1e69d371e..f7a2bdeb7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -74,6 +74,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum); static void PointLimit_OnChange(void); static void TimeLimit_OnChange(void); static void NumLaps_OnChange(void); +static void BaseNumLaps_OnChange(void); static void Mute_OnChange(void); static void Hidetime_OnChange(void); @@ -210,7 +211,7 @@ consvar_t cv_allowteamchange = {"allowteamchange", "Yes", CV_NETVAR, CV_YesNo, N consvar_t cv_startinglives = {"startinglives", "3", CV_NETVAR|CV_CHEAT, startingliveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t respawntime_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t respawntime_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "Off"}, {0, NULL}}; consvar_t cv_respawntime = {"respawndelay", "3", CV_NETVAR|CV_CHEAT, respawntime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_competitionboxes = {"competitionboxes", "Mystery", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -315,16 +316,17 @@ consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0, static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}}; consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}}; -consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, +static CV_PossibleValue_t pointlimit_cons_t[] = {{1, "MIN"}, {999999990, "MAX"}, {0, "None"}, {0, NULL}}; +consvar_t cv_pointlimit = {"pointlimit", "None", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t timelimit_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}}; -consvar_t cv_timelimit = {"timelimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, timelimit_cons_t, +static CV_PossibleValue_t timelimit_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "None"}, {0, NULL}}; +consvar_t cv_timelimit = {"timelimit", "None", CV_NETVAR|CV_CALL|CV_NOINIT, timelimit_cons_t, TimeLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t numlaps_cons_t[] = {{0, "MIN"}, {50, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t numlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, NULL}}; consvar_t cv_numlaps = {"numlaps", "4", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_cons_t, NumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usemapnumlaps = {"usemaplaps", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}}; +consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; // log elemental hazards -- not a netvar, is local to current player consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -497,7 +499,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_friendlyfire); CV_RegisterVar(&cv_pointlimit); CV_RegisterVar(&cv_numlaps); - CV_RegisterVar(&cv_usemapnumlaps); + CV_RegisterVar(&cv_basenumlaps); CV_RegisterVar(&cv_hazardlog); @@ -4465,3 +4467,14 @@ static void Command_ShowTime_f(void) CONS_Printf(M_GetText("The current time is %f.\nThe timelimit is %f\n"), (double)leveltime/TICRATE, (double)timelimitintics/TICRATE); } + +static void BaseNumLaps_OnChange(void) +{ + if (gametype == GT_RACE) + { + if (cv_basenumlaps.value) + CONS_Printf(M_GetText("Number of laps will be changed to map defaults next round.\n")); + else + CONS_Printf(M_GetText("Number of laps will be changed to %d next round.\n"), cv_basenumlaps.value); + } +} diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 5076c8afa..3e3c61112 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -66,7 +66,7 @@ extern consvar_t cv_friendlyfire; extern consvar_t cv_pointlimit; extern consvar_t cv_timelimit; extern consvar_t cv_numlaps; -extern consvar_t cv_usemapnumlaps; +extern consvar_t cv_basenumlaps; extern UINT32 timelimitintics; extern consvar_t cv_allowexitlevel; diff --git a/src/m_menu.c b/src/m_menu.c index fb276f77d..66f7cf3ba 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -434,7 +434,8 @@ consvar_t cv_ghost_guest = {"ghost_guest", "Show", CV_SAVE, ghost2_cons_ static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; static CV_PossibleValue_t dummyscramble_cons_t[] = {{0, "Random"}, {1, "Points"}, {0, NULL}}; static CV_PossibleValue_t ringlimit_cons_t[] = {{0, "MIN"}, {9999, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t liveslimit_cons_t[] = {{-1, "MIN"}, {99, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t liveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {-1, "Infinite"}, {0, NULL}}; +static CV_PossibleValue_t contlimit_cons_t[] = {{0, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t dummymares_cons_t[] = { {-1, "END"}, {0,"Overall"}, {1,"Mare 1"}, {2,"Mare 2"}, {3,"Mare 3"}, {4,"Mare 4"}, {5,"Mare 5"}, {6,"Mare 6"}, {7,"Mare 7"}, {8,"Mare 8"}, {0,NULL} }; @@ -443,7 +444,7 @@ static consvar_t cv_dummyteam = {"dummyteam", "Spectator", CV_HIDEN, dummyteam_c static consvar_t cv_dummyscramble = {"dummyscramble", "Random", CV_HIDEN, dummyscramble_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummyrings = {"dummyrings", "0", CV_HIDEN, ringlimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummylives = {"dummylives", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static consvar_t cv_dummycontinues = {"dummycontinues", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static consvar_t cv_dummycontinues = {"dummycontinues", "0", CV_HIDEN, contlimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummymares = {"dummymares", "Overall", CV_HIDEN|CV_CALL, dummymares_cons_t, Dummymares_OnChange, 0, NULL, NULL, 0, 0, NULL}; // ========================================================================== @@ -6081,9 +6082,9 @@ static void M_PandorasBox(INT32 choice) else CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].rings, 0)); if (players[consoleplayer].lives == INFLIVES) - CV_StealthSetValue(&cv_dummylives, -1); + CV_StealthSet(&cv_dummylives, "Infinite"); else - CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives); + CV_StealthSetValue(&cv_dummylives, max(players[consoleplayer].lives, 1)); CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues); SR_PandorasBox[6].status = ((players[consoleplayer].charflags & SF_SUPER) #ifndef DEVELOP diff --git a/src/p_setup.c b/src/p_setup.c index c83c8cd5c..a362d2ec1 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3047,8 +3047,11 @@ boolean P_SetupLevel(boolean skipprecip) CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n")); } - else if (gametype == GT_RACE && server && cv_usemapnumlaps.value) - CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); + else if (gametype == GT_RACE && server) + CV_StealthSetValue(&cv_numlaps, + (cv_basenumlaps.value) + ? cv_basenumlaps.value + : mapheaderinfo[gamemap - 1]->numlaps); // =========== // landing point for netgames. From 021f49366437e692e20a42b4212fbd1348bb080a Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 11:55:40 +0100 Subject: [PATCH 03/10] Quick macro substitution to make sure MAXSCORE is consistent. --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f7a2bdeb7..d39c289cc 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -316,7 +316,7 @@ consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0, static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}}; consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t pointlimit_cons_t[] = {{1, "MIN"}, {999999990, "MAX"}, {0, "None"}, {0, NULL}}; +static CV_PossibleValue_t pointlimit_cons_t[] = {{1, "MIN"}, {MAXSCORE, "MAX"}, {0, "None"}, {0, NULL}}; consvar_t cv_pointlimit = {"pointlimit", "None", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t timelimit_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "None"}, {0, NULL}}; From 61a242cc95a744452680ed5bf1cc3a4b563b5e6c Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 12:24:31 +0100 Subject: [PATCH 04/10] * Fix cv_pointlimit's weird behaviour in match mode by standardising the switching between "named" and "range" values in CV_AddValue. * Optimise M_ChangeCvar. --- src/command.c | 46 +++++++++++++++++++++++++++++++++------------- src/m_menu.c | 22 +++++----------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/command.c b/src/command.c index 114b37489..b3181bd05 100644 --- a/src/command.c +++ b/src/command.c @@ -1525,6 +1525,9 @@ void CV_AddValue(consvar_t *var, INT32 increment) { INT32 newvalue, max; + if (!increment) + return; + // count pointlimit better if (var == &cv_pointlimit && (gametype == GT_MATCH)) increment *= 50; @@ -1553,7 +1556,6 @@ void CV_AddValue(consvar_t *var, INT32 increment) // Special case for the nextmap variable, used only directly from the menu INT32 oldvalue = var->value - 1, gt; gt = cv_newgametype.value; - if (increment != 0) // Going up! { newvalue = var->value - 1; do @@ -1597,21 +1599,39 @@ void CV_AddValue(consvar_t *var, INT32 increment) { INT32 currentindice = -1, newindice; for (max = MAXVAL+1; var->PossibleValue[max].strvalue; max++) - if (var->PossibleValue[max].value == var->value) - currentindice = max; - - if (currentindice == -1 && max != MAXVAL+1) - newindice = ((increment > 0) ? MAXVAL : max) + increment; - else - newindice = currentindice + increment; - - if (newindice >= max || newindice <= MAXVAL) { - newvalue = var->PossibleValue[((increment > 0) ? MINVAL : MAXVAL)].value; - CV_SetValue(var, newvalue); + if (var->PossibleValue[max].value == newvalue) + { + increment = 0; + currentindice = max; + } + else if (var->PossibleValue[max].value == var->value) + currentindice = max; + } + + if (increment) + { + increment = (increment > 0) ? 1 : -1; + if (currentindice == -1 && max != MAXVAL+1) + newindice = ((increment > 0) ? MAXVAL : max) + increment; + else + newindice = currentindice + increment; + + if (newindice >= max || newindice <= MAXVAL) + { + if (var == &cv_pointlimit && (gametype == GT_MATCH) && increment > 0) + CV_SetValue(var, 50); + else + { + newvalue = var->PossibleValue[((increment > 0) ? MINVAL : MAXVAL)].value; + CV_SetValue(var, newvalue); + } + } + else + CV_Set(var, var->PossibleValue[newindice].strvalue); } else - CV_Set(var, var->PossibleValue[newindice].strvalue); + CV_Set(var, var->PossibleValue[currentindice].strvalue); } else CV_SetValue(var, newvalue); diff --git a/src/m_menu.c b/src/m_menu.c index 66f7cf3ba..1935c76c6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2788,31 +2788,19 @@ static void M_ChangeCvar(INT32 choice) choice = (choice<<1) - 1; - if (((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_SLIDER) - ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_INVISSLIDER) - ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_NOMOD)) + if (cv->flags & CV_FLOAT) { - if (cv->flags & CV_FLOAT && (currentMenu->menuitems[itemOn].status & IT_CV_FLOATSLIDER) == IT_CV_FLOATSLIDER) + if (((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_SLIDER) + ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_INVISSLIDER) + ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_NOMOD) + || !(currentMenu->menuitems[itemOn].status & IT_CV_INTEGERSTEP)) { char s[20]; sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f)); CV_Set(cv,s); } else - CV_SetValue(cv,cv->value+(choice)); - } - else if (cv->flags & CV_FLOAT) - { - if (currentMenu->menuitems[itemOn].status & IT_CV_INTEGERSTEP) - { CV_SetValue(cv,FIXED_TO_FLOAT(cv->value)+(choice)); - } - else - { - char s[20]; - sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f)); - CV_Set(cv,s); - } } else CV_AddValue(cv,choice); From 69d43435f5a12a9cb712880ce3e743338c66d5f9 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 13:36:04 +0100 Subject: [PATCH 05/10] Improved "HELP" command! Ported from Kart, original commit also by me (toaster). --- src/command.c | 120 ++++++++++++++++++++++++++++++++++++------------- src/console.c | 6 +-- src/d_netcmd.c | 28 ++++++------ src/d_netcmd.h | 2 +- src/m_menu.c | 17 ++++--- 5 files changed, 118 insertions(+), 55 deletions(-) diff --git a/src/command.c b/src/command.c index b3181bd05..6bdd6e7d3 100644 --- a/src/command.c +++ b/src/command.c @@ -709,15 +709,21 @@ static void COM_Help_f(void) if (COM_Argc() > 1) { - cvar = CV_FindVar(COM_Argv(1)); + const char *help = COM_Argv(1); + cvar = CV_FindVar(help); if (cvar) { - CONS_Printf(M_GetText("Variable %s:\n"), cvar->name); + boolean floatmode = false; + const char *cvalue = NULL; + CONS_Printf("\x82""Variable %s:\n", cvar->name); CONS_Printf(M_GetText(" flags :")); if (cvar->flags & CV_SAVE) CONS_Printf("AUTOSAVE "); if (cvar->flags & CV_FLOAT) + { CONS_Printf("FLOAT "); + floatmode = true; + } if (cvar->flags & CV_NETVAR) CONS_Printf("NETVAR "); if (cvar->flags & CV_CALL) @@ -727,59 +733,109 @@ static void COM_Help_f(void) CONS_Printf("\n"); if (cvar->PossibleValue) { - if (stricmp(cvar->PossibleValue[0].strvalue, "MIN") == 0) - { - for (i = 1; cvar->PossibleValue[i].strvalue != NULL; i++) - if (!stricmp(cvar->PossibleValue[i].strvalue, "MAX")) - break; - CONS_Printf(M_GetText(" range from %d to %d\n"), cvar->PossibleValue[0].value, - cvar->PossibleValue[i].value); - CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value); - } + CONS_Printf(" Possible values:\n"); + if (cvar->PossibleValue == CV_YesNo) + CONS_Printf(" Yes or No (On or Off, 1 or 0)\n"); + else if (cvar->PossibleValue == CV_OnOff) + CONS_Printf(" On or Off (Yes or No, 1 or 0)\n"); else { - const char *cvalue = NULL; - CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name); + if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) + { + if (floatmode) + CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[0].value), + FIXED_TO_FLOAT(cvar->PossibleValue[1].value)); + else + CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, + cvar->PossibleValue[1].value); + i = 2; + } + + //CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name); while (cvar->PossibleValue[i].strvalue) { - CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, - cvar->PossibleValue[i].strvalue); + if (floatmode) + CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value), + cvar->PossibleValue[i].strvalue); + else + CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, + cvar->PossibleValue[i].strvalue); if (cvar->PossibleValue[i].value == cvar->value) cvalue = cvar->PossibleValue[i].strvalue; i++; } - if (cvalue) - CONS_Printf(M_GetText(" Current value: %s\n"), cvalue); - else - CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value); } } + + if (cvalue) + CONS_Printf(" Current value: %s\n", cvalue); + else if (cvar->string) + CONS_Printf(" Current value: %s\n", cvar->string); else - CONS_Printf(M_GetText(" Current value: %d\n"), cvar->value); + CONS_Printf(" Current value: %d\n", cvar->value); } else - CONS_Printf(M_GetText("No help for this command/variable\n")); + { + for (cmd = com_commands; cmd; cmd = cmd->next) + { + if (strcmp(cmd->name, help)) + continue; + + CONS_Printf("\x82""Command %s:\n", cmd->name); + CONS_Printf(" help is not available for commands"); + CONS_Printf("\x82""\nCheck wiki.srb2.org for more or try typing without arguments\n"); + return; + } + + CONS_Printf("No exact match, searching...\n"); + + // variables + CONS_Printf("\x82""Variables:\n"); + for (cvar = consvar_vars; cvar; cvar = cvar->next) + { + if ((cvar->flags & CV_NOSHOWHELP) || (!strstr(cvar->name, help))) + continue; + CONS_Printf("%s ", cvar->name); + i++; + } + + // commands + CONS_Printf("\x82""\nCommands:\n"); + for (cmd = com_commands; cmd; cmd = cmd->next) + { + if (!strstr(cmd->name, help)) + continue; + CONS_Printf("%s ",cmd->name); + i++; + } + + CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help \n"); + + CONS_Debug(DBG_GAMELOGIC, "\x87Total : %d\n", i); + } + return; } else { + // variables + CONS_Printf("\x82""Variables:\n"); + for (cvar = consvar_vars; cvar; cvar = cvar->next) + { + if (cvar->flags & CV_NOSHOWHELP) + continue; + CONS_Printf("%s ", cvar->name); + i++; + } + // commands - CONS_Printf("\x82%s", M_GetText("Commands\n")); + CONS_Printf("\x82""\nCommands:\n"); for (cmd = com_commands; cmd; cmd = cmd->next) { CONS_Printf("%s ",cmd->name); i++; } - // variables - CONS_Printf("\n\x82%s", M_GetText("Variables\n")); - for (cvar = consvar_vars; cvar; cvar = cvar->next) - { - if (!(cvar->flags & CV_NOSHOWHELP)) - CONS_Printf("%s ", cvar->name); - i++; - } - - CONS_Printf("\n\x82%s", M_GetText("Read help file for more or type help \n")); + CONS_Printf("\x82""\nCheck wiki.srb2.org for more or type help \n"); CONS_Debug(DBG_GAMELOGIC, "\x82Total : %d\n", i); } diff --git a/src/console.c b/src/console.c index 09a6cab45..11e236696 100644 --- a/src/console.c +++ b/src/console.c @@ -175,11 +175,11 @@ static void CONS_Clear_f(void) // Choose english keymap // -static void CONS_English_f(void) +/*static void CONS_English_f(void) { shiftxform = english_shiftxform; CONS_Printf(M_GetText("%s keymap.\n"), M_GetText("English")); -} +}*/ static char *bindtable[NUMINPUTS]; @@ -394,7 +394,7 @@ void CON_Init(void) // register our commands // COM_AddCommand("cls", CONS_Clear_f); - COM_AddCommand("english", CONS_English_f); + //COM_AddCommand("english", CONS_English_f); // set console full screen for game startup MAKE SURE VID_Init() done !!! con_destlines = vid.height; con_curlines = vid.height; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index d39c289cc..b897aafd6 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -65,7 +65,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum); static void Got_Addfilecmd(UINT8 **cp, INT32 playernum); static void Got_Pause(UINT8 **cp, INT32 playernum); -static void Got_Suicide(UINT8 **cp, INT32 playernum); +static void Got_Respawn(UINT8 **cp, INT32 playernum); static void Got_RandomSeed(UINT8 **cp, INT32 playernum); static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum); static void Got_Teamchange(UINT8 **cp, INT32 playernum); @@ -117,7 +117,7 @@ static void Command_Addfile(void); static void Command_ListWADS_f(void); static void Command_RunSOC(void); static void Command_Pause(void); -static void Command_Suicide(void); +static void Command_Respawn(void); static void Command_Version_f(void); #ifdef UPDATE_ALERT @@ -394,7 +394,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] = "REQADDFILE", "DELFILE", // replace next time we add an XD "SETMOTD", - "SUICIDE", + "RESPAWN", #ifdef HAVE_BLUA "LUACMD", "LUAVAR" @@ -429,7 +429,7 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd); RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd); RegisterNetXCmd(XD_PAUSE, Got_Pause); - RegisterNetXCmd(XD_SUICIDE, Got_Suicide); + RegisterNetXCmd(XD_RESPAWN, Got_Respawn); RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd); #ifdef HAVE_BLUA RegisterNetXCmd(XD_LUACMD, Got_Luacmd); @@ -464,7 +464,7 @@ void D_RegisterServerCommands(void) COM_AddCommand("runsoc", Command_RunSOC); COM_AddCommand("pause", Command_Pause); - COM_AddCommand("suicide", Command_Suicide); + COM_AddCommand("respawn", Command_Respawn); COM_AddCommand("gametype", Command_ShowGametype_f); COM_AddCommand("version", Command_Version_f); @@ -2029,7 +2029,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) } // Command for stuck characters in netgames, griefing, etc. -static void Command_Suicide(void) +static void Command_Respawn(void) { UINT8 buf[4]; UINT8 *cp = buf; @@ -2055,17 +2055,17 @@ static void Command_Suicide(void) return; } - SendNetXCmd(XD_SUICIDE, &buf, 4); + SendNetXCmd(XD_RESPAWN, &buf, 4); } -static void Got_Suicide(UINT8 **cp, INT32 playernum) +static void Got_Respawn(UINT8 **cp, INT32 playernum) { - INT32 suicideplayer = READINT32(*cp); + INT32 respawnplayer = READINT32(*cp); - // You can't suicide someone else. Nice try, there. - if (suicideplayer != playernum || (!G_PlatformGametype())) + // You can't respawn someone else. Nice try, there. + if (respawnplayer != playernum || (!G_PlatformGametype())) { - CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]); + CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); if (server) { UINT8 buf[2]; @@ -2077,8 +2077,8 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum) return; } - if (players[suicideplayer].mo) - P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 1, DMG_INSTAKILL); + if (players[respawnplayer].mo) + P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 1, DMG_INSTAKILL); } /** Deals with an ::XD_RANDOMSEED message in a netgame. diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 3e3c61112..22e5ffc60 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -136,7 +136,7 @@ typedef enum XD_REQADDFILE, // 17 XD_DELFILE, // 18 - replace next time we add an XD XD_SETMOTD, // 19 - XD_SUICIDE, // 20 + XD_RESPAWN, // 20 XD_DEMOTED, // 21 #ifdef HAVE_BLUA XD_LUACMD, // 22 diff --git a/src/m_menu.c b/src/m_menu.c index 1935c76c6..f87c5c37d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2885,6 +2885,15 @@ static void M_PrevOpt(void) // (in other words -- stop bullshit happening by mashing buttons in fades) static boolean noFurtherInput = false; +static void Command_Manual_f(void) +{ + if (modeattacking) + return; + M_StartControlPanel(); + currentMenu = &MISC_HelpDef; + itemOn = 0; +} + // // M_Responder // @@ -3035,11 +3044,7 @@ boolean M_Responder(event_t *ev) switch (ch) { case KEY_F1: // Help key - if (modeattacking) - return true; - M_StartControlPanel(); - currentMenu = &MISC_HelpDef; - itemOn = 0; + Command_Manual_f(); return true; case KEY_F2: // Empty @@ -3536,6 +3541,8 @@ void M_Init(void) { int i; + COM_AddCommand("manual", Command_Manual_f); + CV_RegisterVar(&cv_nextmap); CV_RegisterVar(&cv_newgametype); CV_RegisterVar(&cv_chooseskin); From effb5061202985913ca42da5b88770aa812e58cb Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 15 Oct 2019 13:46:45 +0100 Subject: [PATCH 06/10] Make use of MINVAL and MAXVAL consistent in COM_Help_f. --- src/command.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/command.c b/src/command.c index 6bdd6e7d3..464bf5216 100644 --- a/src/command.c +++ b/src/command.c @@ -740,16 +740,20 @@ static void COM_Help_f(void) CONS_Printf(" On or Off (Yes or No, 1 or 0)\n"); else { - if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) +#define MINVAL 0 +#define MAXVAL 1 + if (!stricmp(cvar->PossibleValue[MINVAL].strvalue, "MIN")) { if (floatmode) - CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[0].value), - FIXED_TO_FLOAT(cvar->PossibleValue[1].value)); + CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[MINVAL].value), + FIXED_TO_FLOAT(cvar->PossibleValue[MAXVAL].value)); else - CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, - cvar->PossibleValue[1].value); - i = 2; + CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[MINVAL].value, + cvar->PossibleValue[MAXVAL].value); + i = MAXVAL+1; } +#undef MINVAL +#undef MAXVAL //CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name); while (cvar->PossibleValue[i].strvalue) From 3e3ee8717fd6773555a719f68df879410d90cf8c Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 16 Oct 2019 11:38:09 +0100 Subject: [PATCH 07/10] Merge `retry` and `respawn` into one command, `respawn`. --- src/d_netcmd.c | 20 +++++++++++++++----- src/d_netcmd.h | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b897aafd6..9c25305f7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -454,7 +454,7 @@ void D_RegisterServerCommands(void) COM_AddCommand("map", Command_Map_f); COM_AddCommand("exitgame", Command_ExitGame_f); - COM_AddCommand("retry", Command_Retry_f); + //COM_AddCommand("retry", Command_Retry_f); COM_AddCommand("exitlevel", Command_ExitLevel_f); COM_AddCommand("showmap", Command_Showmap_f); COM_AddCommand("mapmd5", Command_Mapmd5_f); @@ -2034,8 +2034,6 @@ static void Command_Respawn(void) UINT8 buf[4]; UINT8 *cp = buf; - WRITEINT32(cp, consoleplayer); - if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) { CONS_Printf(M_GetText("You must be in a level to use this.\n")); @@ -2048,13 +2046,22 @@ static void Command_Respawn(void) return; } - // Retry is quicker. Probably should force people to use it. + // Retry is quicker. if (!(netgame || multiplayer)) { - CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n")); + if (!&players[consoleplayer] || players[consoleplayer].lives <= 1) + CONS_Printf(M_GetText("You can't use this without any lives remaining!\n")); + else if (G_IsSpecialStage(gamemap)) + CONS_Printf(M_GetText("You can't retry special stages!\n")); + else + { + M_ClearMenus(true); + G_SetRetryFlag(); + } return; } + WRITEINT32(cp, consoleplayer); SendNetXCmd(XD_RESPAWN, &buf, 4); } @@ -4119,6 +4126,8 @@ void Command_ExitGame_f(void) D_StartTitle(); } +// see Command_Respawn() +#if 0 void Command_Retry_f(void) { if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) @@ -4135,6 +4144,7 @@ void Command_Retry_f(void) G_SetRetryFlag(); } } +#endif #ifdef NETGAME_DEVMODE // Allow the use of devmode in netgames. diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 22e5ffc60..728b27680 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -192,7 +192,7 @@ void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); void D_SendPlayerConfig(void); void Command_ExitGame_f(void); -void Command_Retry_f(void); +//void Command_Retry_f(void); void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); boolean IsPlayerAdmin(INT32 playernum); From 036c6aa8290b5409aa112af56196d867f4190c97 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 16 Oct 2019 17:31:10 +0100 Subject: [PATCH 08/10] Just revert the `respawn`, `retry` and `suicide` stuff cuz it's apparently contentious. Who knew? --- src/d_netcmd.c | 43 ++++++++++++++++--------------------------- src/d_netcmd.h | 4 ++-- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 9c25305f7..52e2e3271 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -65,7 +65,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum); static void Got_Addfilecmd(UINT8 **cp, INT32 playernum); static void Got_Pause(UINT8 **cp, INT32 playernum); -static void Got_Respawn(UINT8 **cp, INT32 playernum); +static void Got_Suicide(UINT8 **cp, INT32 playernum); static void Got_RandomSeed(UINT8 **cp, INT32 playernum); static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum); static void Got_Teamchange(UINT8 **cp, INT32 playernum); @@ -117,7 +117,7 @@ static void Command_Addfile(void); static void Command_ListWADS_f(void); static void Command_RunSOC(void); static void Command_Pause(void); -static void Command_Respawn(void); +static void Command_Suicide(void); static void Command_Version_f(void); #ifdef UPDATE_ALERT @@ -394,7 +394,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] = "REQADDFILE", "DELFILE", // replace next time we add an XD "SETMOTD", - "RESPAWN", + "SUICIDE", #ifdef HAVE_BLUA "LUACMD", "LUAVAR" @@ -429,7 +429,7 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd); RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd); RegisterNetXCmd(XD_PAUSE, Got_Pause); - RegisterNetXCmd(XD_RESPAWN, Got_Respawn); + RegisterNetXCmd(XD_SUICIDE, Got_Suicide); RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd); #ifdef HAVE_BLUA RegisterNetXCmd(XD_LUACMD, Got_Luacmd); @@ -454,7 +454,7 @@ void D_RegisterServerCommands(void) COM_AddCommand("map", Command_Map_f); COM_AddCommand("exitgame", Command_ExitGame_f); - //COM_AddCommand("retry", Command_Retry_f); + COM_AddCommand("retry", Command_Retry_f); COM_AddCommand("exitlevel", Command_ExitLevel_f); COM_AddCommand("showmap", Command_Showmap_f); COM_AddCommand("mapmd5", Command_Mapmd5_f); @@ -464,7 +464,7 @@ void D_RegisterServerCommands(void) COM_AddCommand("runsoc", Command_RunSOC); COM_AddCommand("pause", Command_Pause); - COM_AddCommand("respawn", Command_Respawn); + COM_AddCommand("suicide", Command_Suicide); COM_AddCommand("gametype", Command_ShowGametype_f); COM_AddCommand("version", Command_Version_f); @@ -2029,7 +2029,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) } // Command for stuck characters in netgames, griefing, etc. -static void Command_Respawn(void) +static void Command_Suicide(void) { UINT8 buf[4]; UINT8 *cp = buf; @@ -2046,33 +2046,25 @@ static void Command_Respawn(void) return; } - // Retry is quicker. + // Retry is quicker. Probably should force people to use it. if (!(netgame || multiplayer)) { - if (!&players[consoleplayer] || players[consoleplayer].lives <= 1) - CONS_Printf(M_GetText("You can't use this without any lives remaining!\n")); - else if (G_IsSpecialStage(gamemap)) - CONS_Printf(M_GetText("You can't retry special stages!\n")); - else - { - M_ClearMenus(true); - G_SetRetryFlag(); - } + CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n")); return; } WRITEINT32(cp, consoleplayer); - SendNetXCmd(XD_RESPAWN, &buf, 4); + SendNetXCmd(XD_SUICIDE, &buf, 4); } -static void Got_Respawn(UINT8 **cp, INT32 playernum) +static void Got_Suicide(UINT8 **cp, INT32 playernum) { - INT32 respawnplayer = READINT32(*cp); + INT32 suicideplayer = READINT32(*cp); - // You can't respawn someone else. Nice try, there. + // You can't suicide someone else. Nice try, there. if (respawnplayer != playernum || (!G_PlatformGametype())) { - CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); + CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]); if (server) { UINT8 buf[2]; @@ -2084,8 +2076,8 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) return; } - if (players[respawnplayer].mo) - P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 1, DMG_INSTAKILL); + if (players[suicideplayer].mo) + P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 1, DMG_INSTAKILL); } /** Deals with an ::XD_RANDOMSEED message in a netgame. @@ -4126,8 +4118,6 @@ void Command_ExitGame_f(void) D_StartTitle(); } -// see Command_Respawn() -#if 0 void Command_Retry_f(void) { if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) @@ -4144,7 +4134,6 @@ void Command_Retry_f(void) G_SetRetryFlag(); } } -#endif #ifdef NETGAME_DEVMODE // Allow the use of devmode in netgames. diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 728b27680..3e3c61112 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -136,7 +136,7 @@ typedef enum XD_REQADDFILE, // 17 XD_DELFILE, // 18 - replace next time we add an XD XD_SETMOTD, // 19 - XD_RESPAWN, // 20 + XD_SUICIDE, // 20 XD_DEMOTED, // 21 #ifdef HAVE_BLUA XD_LUACMD, // 22 @@ -192,7 +192,7 @@ void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); void D_SendPlayerConfig(void); void Command_ExitGame_f(void); -//void Command_Retry_f(void); +void Command_Retry_f(void); void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); boolean IsPlayerAdmin(INT32 playernum); From ec20d04e6f4d041412340b67817b2b2b3bb84d34 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 16 Oct 2019 17:39:38 +0100 Subject: [PATCH 09/10] Compile fix. --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 52e2e3271..5aea32f8f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2062,7 +2062,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum) INT32 suicideplayer = READINT32(*cp); // You can't suicide someone else. Nice try, there. - if (respawnplayer != playernum || (!G_PlatformGametype())) + if (suicideplayer != playernum || (!G_PlatformGametype())) { CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]); if (server) From 465f9055aa7a520e3a623a2d7222b758b777eadc Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 23 Oct 2019 17:37:09 -0700 Subject: [PATCH 10/10] The console sucks, so "Don't" becomes "No" :lancer: --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 0ea4ec83f..37c4a72b1 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2969,7 +2969,7 @@ consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_NETVAR, CV_OnOff, N consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}}; consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "Don't"}, {0, NULL}}; +static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}}; consvar_t cv_resynchattempts = {"resynchattempts", "10", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL }; consvar_t cv_blamecfail = {"blamecfail", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };