Skip to content

Commit

Permalink
Refactor game/mod cvar defaults
Browse files Browse the repository at this point in the history
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 32c99c7 and
205931f.

See also: 34e819a

Signed-off-by: bones_was_here <[email protected]>
  • Loading branch information
bones-was-here committed May 9, 2024
1 parent fca405f commit 316549d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 172 deletions.
215 changes: 44 additions & 171 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions com_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"};

This comment has been minimized.

Copy link
@rwzd

rwzd May 10, 2024

CVar description does not match the updated value, FYI @bones-was-here

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)"};
Expand Down

0 comments on commit 316549d

Please sign in to comment.