]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Refactor game/mod cvar defaults
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 8 May 2024 21:16:53 +0000 (07:16 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 9 May 2024 03:07:40 +0000 (13:07 +1000)
Adds gamegroup defaults.
This avoids the need to specify the same Quake defaults for every Quake
expansion/mod.
Fixes newly-added Quake mods (quake15, ad) having global defaults
instead of Quake defaults.

Moves comments in front of the cvars they refer to, some were unclear.

Removes redundant cvars, they're no longer needed because global
defaults and Quake defaults are correctly restored when switching
gamedirs, see 32c99c7b0a58545b273fa713d81d6bbfb3b8ebe6 and
205931f2f5b7333523ca4f6c3cae7974a8f516c8.

See also: 34e819a626f6a7ff2ad190a8e7d42e38ca8cef0e

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cmd.c
com_game.h
sv_main.c

diff --git a/cmd.c b/cmd.c
index de0ae7fed6cc3120f7270ad0573fef2bd19364c3..110378ffcbb6c44af376bc749b9a14924cb80a24 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -548,163 +548,45 @@ static void Cmd_Exec(cmd_state_t *cmd, const char *filename)
        if (isdefaultcfg)
        {
                // special defaults for specific games go here, these execute before default.cfg
+               // and after gamegroup defaults (see below)
                switch(gamemode)
                {
-               case GAME_NORMAL:
-                       Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 0\n"
-"sv_gameplayfix_findradiusdistancetobox 0\n"
-"sv_gameplayfix_grenadebouncedownslopes 0\n"
-"sv_gameplayfix_slidemoveprojectiles 0\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
-"sv_gameplayfix_setmodelrealbox 0\n"
-"sv_gameplayfix_droptofloorstartsolid 0\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
-"sv_gameplayfix_noairborncorpse 0\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
-"sv_gameplayfix_easierwaterjump 0\n"
-"sv_gameplayfix_delayprojectiles 0\n"
-"sv_gameplayfix_multiplethinksperframe 0\n"
-"sv_gameplayfix_fixedcheckwatertransition 0\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
-"sv_gameplayfix_swiminbmodels 0\n"
-"sv_gameplayfix_downtracesupportsongroundflag 0\n"
-"sys_ticrate 0.01388889\n"
-"r_shadow_gloss 1\n"
-"r_shadow_bumpscale_basetexture 0\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
-                               );
-                       break;
-               // Nehahra pushable crates malfunction in some levels if this is on
-               // Nehahra NPC AI is confused by blowupfallenzombies
                case GAME_NEHAHRA:
                        Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 0\n"
-"sv_gameplayfix_findradiusdistancetobox 0\n"
-"sv_gameplayfix_grenadebouncedownslopes 0\n"
-"sv_gameplayfix_slidemoveprojectiles 0\n"
+// Nehahra pushable crates malfunction in some levels if this is on
 "sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
-"sv_gameplayfix_setmodelrealbox 0\n"
-"sv_gameplayfix_droptofloorstartsolid 0\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
-"sv_gameplayfix_noairborncorpse 0\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
-"sv_gameplayfix_easierwaterjump 0\n"
-"sv_gameplayfix_delayprojectiles 0\n"
-"sv_gameplayfix_multiplethinksperframe 0\n"
-"sv_gameplayfix_fixedcheckwatertransition 0\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
-"sv_gameplayfix_swiminbmodels 0\n"
-"sv_gameplayfix_downtracesupportsongroundflag 0\n"
-"sys_ticrate 0.01388889\n"
-"r_shadow_gloss 1\n"
-"r_shadow_bumpscale_basetexture 0\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
+// Nehahra NPC AI is confused by blowupfallenzombies
+"sv_gameplayfix_blowupfallenzombies 0\n"
                                );
                        break;
-               // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
-               // hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
-               // hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
                case GAME_HIPNOTIC:
                case GAME_QUOTH:
                        Cbuf_InsertText(cmd, "\n"
+// hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
 "sv_gameplayfix_blowupfallenzombies 0\n"
-"sv_gameplayfix_findradiusdistancetobox 0\n"
-"sv_gameplayfix_grenadebouncedownslopes 0\n"
-"sv_gameplayfix_slidemoveprojectiles 0\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
-"sv_gameplayfix_setmodelrealbox 0\n"
-"sv_gameplayfix_droptofloorstartsolid 0\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
-"sv_gameplayfix_noairborncorpse 0\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
-"sv_gameplayfix_easierwaterjump 0\n"
-"sv_gameplayfix_delayprojectiles 0\n"
-"sv_gameplayfix_multiplethinksperframe 0\n"
-"sv_gameplayfix_fixedcheckwatertransition 0\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
-"sv_gameplayfix_swiminbmodels 0\n"
-"sv_gameplayfix_downtracesupportsongroundflag 0\n"
+// hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
 "sys_ticrate 0.02\n"
-"r_shadow_gloss 1\n"
-"r_shadow_bumpscale_basetexture 0\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
+// hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
+"sv_gameplayfix_slidemoveprojectiles 0\n"
                                );
                        break;
-               // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
-               // On r2m3 3 of the 4 monster_lava_man are placed in solid clips so droptofloor() moves them to a lower level if tracebox can
-               // move them out of solid, if it can't they're stuck (original behaviour), only proper fix is to move them with a .ent file.
                case GAME_ROGUE:
                        Cbuf_InsertText(cmd, "\n"
-"mod_q1bsp_traceoutofsolid 0\n"
+// rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
 "sv_gameplayfix_blowupfallenzombies 0\n"
-"sv_gameplayfix_findradiusdistancetobox 0\n"
-"sv_gameplayfix_grenadebouncedownslopes 0\n"
-"sv_gameplayfix_slidemoveprojectiles 0\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
-"sv_gameplayfix_setmodelrealbox 0\n"
-"sv_gameplayfix_droptofloorstartsolid 0\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
-"sv_gameplayfix_noairborncorpse 0\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
-"sv_gameplayfix_easierwaterjump 0\n"
-"sv_gameplayfix_delayprojectiles 0\n"
-"sv_gameplayfix_multiplethinksperframe 0\n"
-"sv_gameplayfix_fixedcheckwatertransition 0\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
-"sv_gameplayfix_swiminbmodels 0\n"
-"sv_gameplayfix_downtracesupportsongroundflag 0\n"
-"sys_ticrate 0.01388889\n"
-"r_shadow_gloss 1\n"
-"r_shadow_bumpscale_basetexture 0\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
+// On r2m3 3 of the 4 monster_lava_man are placed in solid clips so droptofloor() moves them to a lower level if tracebox can
+// move them out of solid, if it can't they're stuck (original behaviour), only proper fix is to move them with a .ent file.
+"mod_q1bsp_traceoutofsolid 0\n"
                                );
                        break;
                case GAME_TENEBRAE:
                        Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 0\n"
-"sv_gameplayfix_findradiusdistancetobox 0\n"
-"sv_gameplayfix_grenadebouncedownslopes 0\n"
-"sv_gameplayfix_slidemoveprojectiles 0\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
-"sv_gameplayfix_setmodelrealbox 0\n"
-"sv_gameplayfix_droptofloorstartsolid 0\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
-"sv_gameplayfix_noairborncorpse 0\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
-"sv_gameplayfix_easierwaterjump 0\n"
-"sv_gameplayfix_delayprojectiles 0\n"
-"sv_gameplayfix_multiplethinksperframe 0\n"
-"sv_gameplayfix_fixedcheckwatertransition 0\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
-"sv_gameplayfix_swiminbmodels 0\n"
-"sv_gameplayfix_downtracesupportsongroundflag 0\n"
-"sys_ticrate 0.01388889\n"
 "r_shadow_gloss 2\n"
 "r_shadow_bumpscale_basetexture 4\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
                                );
                        break;
                case GAME_NEXUIZ:
                        Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 1\n"
-"sv_gameplayfix_findradiusdistancetobox 1\n"
-"sv_gameplayfix_grenadebouncedownslopes 1\n"
-"sv_gameplayfix_slidemoveprojectiles 1\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 1\n"
-"sv_gameplayfix_setmodelrealbox 1\n"
-"sv_gameplayfix_droptofloorstartsolid 1\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 1\n"
-"sv_gameplayfix_noairborncorpse 1\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 1\n"
-"sv_gameplayfix_easierwaterjump 1\n"
-"sv_gameplayfix_delayprojectiles 1\n"
-"sv_gameplayfix_multiplethinksperframe 1\n"
-"sv_gameplayfix_fixedcheckwatertransition 1\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 1\n"
-"sv_gameplayfix_swiminbmodels 1\n"
-"sv_gameplayfix_downtracesupportsongroundflag 1\n"
-"sys_ticrate 0.01388889\n"
 "sv_gameplayfix_q2airaccelerate 1\n"
 "sv_gameplayfix_stepmultipletimes 1\n"
 "csqc_polygons_defaultmaterial_nocullface 1\n"
@@ -713,75 +595,66 @@ static void Cmd_Exec(cmd_state_t *cmd, const char *filename)
                        break;
                case GAME_XONOTIC:
                case GAME_VORETOURNAMENT:
-                       // compatibility for versions prior to 2020-05-25, this can be overridden in newer versions to get the default behavior and be consistent with FTEQW engine
                        Cbuf_InsertText(cmd, "\n"
+// compatibility for versions prior to 2020-05-25, this can be overridden in newer versions to get the default behavior and be consistent with FTEQW engine
 "csqc_polygons_defaultmaterial_nocullface 1\n"
 "con_chatsound_team_mask 13\n"
 "sv_qcstats 1\n"
 "mod_q1bsp_zero_hullsize_cutoff 8.03125\n"
                                );
                        break;
-               // Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1
                case GAME_STEELSTORM:
                        Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 1\n"
-"sv_gameplayfix_findradiusdistancetobox 1\n"
-"sv_gameplayfix_grenadebouncedownslopes 1\n"
-"sv_gameplayfix_slidemoveprojectiles 1\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 1\n"
-"sv_gameplayfix_setmodelrealbox 1\n"
-"sv_gameplayfix_droptofloorstartsolid 1\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 1\n"
-"sv_gameplayfix_noairborncorpse 1\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 1\n"
-"sv_gameplayfix_easierwaterjump 1\n"
-"sv_gameplayfix_delayprojectiles 1\n"
-"sv_gameplayfix_multiplethinksperframe 1\n"
-"sv_gameplayfix_fixedcheckwatertransition 1\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 1\n"
-"sv_gameplayfix_swiminbmodels 1\n"
-"sv_gameplayfix_downtracesupportsongroundflag 1\n"
-"sys_ticrate 0.01388889\n"
+// Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1
 "cl_csqc_generatemousemoveevents 0\n"
 "csqc_polygons_defaultmaterial_nocullface 1\n"
                                );
                        break;
                case GAME_QUAKE15:
                        Cbuf_InsertText(cmd, "\n"
+// Corpses slide around without this bug from old DP versions
 "sv_gameplayfix_impactbeforeonground 1\n"
+// Reduce likelihood of incorrectly placed corpses sinking into the ground
 "sv_gameplayfix_unstickentities 1\n"
                        );
                        break;
-               // Arcane Dimensions V1.80 Patch 1 assumes engines that don't pass values to CSQC_Init() are DP,
-               // instead of doing a workaround there we can give it what it really wants (fixes offscreen HUD).
                case GAME_AD:
                        Cbuf_InsertText(cmd, "\n"
+// Arcane Dimensions V1.80 Patch 1 assumes engines that don't pass values to CSQC_Init() are DP,
+// instead of doing a workaround there we can give it what it really wants (fixes offscreen HUD).
 "csqc_lowres 1\n"
                        );
                        break;
                default:
+                       break;
+               }
+
+               // special defaults for game groups go here, these execute before the specific games above
+               switch (com_startupgamegroup)
+               {
+               case GAME_NORMAL: // id1 Quake and its mods
                        Cbuf_InsertText(cmd, "\n"
-"sv_gameplayfix_blowupfallenzombies 1\n"
-"sv_gameplayfix_findradiusdistancetobox 1\n"
-"sv_gameplayfix_grenadebouncedownslopes 1\n"
-"sv_gameplayfix_slidemoveprojectiles 1\n"
-"sv_gameplayfix_upwardvelocityclearsongroundflag 1\n"
-"sv_gameplayfix_setmodelrealbox 1\n"
-"sv_gameplayfix_droptofloorstartsolid 1\n"
-"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 1\n"
-"sv_gameplayfix_noairborncorpse 1\n"
-"sv_gameplayfix_noairborncorpse_allowsuspendeditems 1\n"
-"sv_gameplayfix_easierwaterjump 1\n"
-"sv_gameplayfix_delayprojectiles 1\n"
-"sv_gameplayfix_multiplethinksperframe 1\n"
-"sv_gameplayfix_fixedcheckwatertransition 1\n"
-"sv_gameplayfix_q1bsptracelinereportstexture 1\n"
-"sv_gameplayfix_swiminbmodels 1\n"
-"sv_gameplayfix_downtracesupportsongroundflag 1\n"
-"sys_ticrate 0.01388889\n"
-"csqc_polygons_defaultmaterial_nocullface 0\n"
+"sv_gameplayfix_blowupfallenzombies 0\n"
+"sv_gameplayfix_findradiusdistancetobox 0\n"
+"sv_gameplayfix_grenadebouncedownslopes 0\n"
+"sv_gameplayfix_slidemoveprojectiles 0\n"
+"sv_gameplayfix_upwardvelocityclearsongroundflag 0\n"
+"sv_gameplayfix_setmodelrealbox 0\n"
+"sv_gameplayfix_droptofloorstartsolid 0\n"
+"sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 0\n"
+"sv_gameplayfix_noairborncorpse 0\n"
+"sv_gameplayfix_noairborncorpse_allowsuspendeditems 0\n"
+"sv_gameplayfix_easierwaterjump 0\n"
+"sv_gameplayfix_delayprojectiles 0\n"
+"sv_gameplayfix_multiplethinksperframe 0\n"
+"sv_gameplayfix_fixedcheckwatertransition 0\n"
+"sv_gameplayfix_q1bsptracelinereportstexture 0\n"
+"sv_gameplayfix_swiminbmodels 0\n"
+"sv_gameplayfix_downtracesupportsongroundflag 0\n"
                                );
                        break;
+               default:
+                       break;
                }
        }
 }
index 2d4d04301d15783aadbf6a2f6ea1cba717f1332c..57358275e6427b7ad3dd0e1dbad8b1cf4bc2a564 100644 (file)
@@ -80,6 +80,8 @@ extern const char *gamescreenshotname;
 extern const char *gameuserdirname;
 extern char com_modname[MAX_OSPATH];
 
+extern gamemode_t com_startupgamegroup;
+
 void COM_InitGameType (void);
 int COM_ChangeGameTypeForGameDirs(unsigned numgamedirs, const char *gamedirs[], qbool failmissing, qbool init);
 
index 21a2e8dbbcb431898eecf30251991b3634b9efb7..c84272f12a290a4e8bb29f0d183987e8bed944cd 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -162,7 +162,7 @@ cvar_t sv_warsowbunny_backtosideratio = {CF_SERVER, "sv_warsowbunny_backtosidera
 cvar_t sv_onlycsqcnetworking = {CF_SERVER, "sv_onlycsqcnetworking", "0", "disables legacy entity networking code for higher performance (except on clients, which can still be legacy)"};
 cvar_t sv_areadebug = {CF_SERVER, "sv_areadebug", "0", "disables physics culling for debugging purposes (only for development)"};
 
-cvar_t sys_ticrate = {CF_SERVER | CF_ARCHIVE, "sys_ticrate","0.0138889", "how long a server frame is in seconds, 0.05 is 20fps server rate, 0.1 is 10fps (can not be set higher than 0.1), 0 runs as many server frames as possible (makes games against bots a little smoother, overwhelms network players), 0.0138889 matches QuakeWorld physics"};
+cvar_t sys_ticrate = {CF_SERVER | CF_ARCHIVE, "sys_ticrate","0.01388889", "how long a server frame is in seconds, 0.05 is 20fps server rate, 0.1 is 10fps (can not be set higher than 0.1), 0 runs as many server frames as possible (makes games against bots a little smoother, overwhelms network players), 0.0138889 matches QuakeWorld physics"};
 cvar_t sv_maxphysicsframesperserverframe = {CF_SERVER, "sv_maxphysicsframesperserverframe","10", "maximum number of physics frames per server frame"};
 cvar_t sv_lagreporting_always = {CF_SERVER, "sv_lagreporting_always", "0", "report lag even in singleplayer, listen, or an empty dedicated server"};
 cvar_t sv_lagreporting_strict = {CF_SERVER, "sv_lagreporting_strict", "0", "log any extra frames run to catch up after a holdup (only applies when sv_maxphysicsframesperserverframe > 1)"};