From 9d27514adfb3067fe11e5532e584ffd6815d7d00 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Mon, 15 Jun 2020 17:22:32 +0000 Subject: [PATCH] Add cvar to disable engine stats >= 220. Suppresses warnings in Xonotic This is transitional until proper infrastructure to handle stats in a generic fashion is implemented. This stuff doesn't really belong in the engine if the eventual goal is to move native gamecode out of it. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12678 d7cf8633-e32d-0410-b094-e92efae38249 --- cmd.c | 1 + sv_main.c | 87 ++++++++++++++++++++++++++++------------------------- svvm_cmds.c | 6 ++-- 3 files changed, 51 insertions(+), 43 deletions(-) diff --git a/cmd.c b/cmd.c index 48ab043a..348825eb 100644 --- a/cmd.c +++ b/cmd.c @@ -668,6 +668,7 @@ static void Cmd_Exec(cmd_state_t *cmd, const char *filename) Cbuf_InsertText(cmd, "\n" "csqc_polygons_defaultmaterial_nocullface 1\n" "con_chatsound_team_mask 13\n" +"sv_gameplayfix_customstats 1\n" ); break; // Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1 diff --git a/sv_main.c b/sv_main.c index 5be93255..71855eff 100644 --- a/sv_main.c +++ b/sv_main.c @@ -124,6 +124,7 @@ cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {CVAR_SERVER, "sv_gameplayf cvar_t sv_gameplayfix_unstickplayers = {CVAR_SERVER, "sv_gameplayfix_unstickplayers", "1", "big hack to try and fix the rare case of MOVETYPE_WALK entities getting stuck in the world clipping hull."}; cvar_t sv_gameplayfix_unstickentities = {CVAR_SERVER, "sv_gameplayfix_unstickentities", "1", "hack to check if entities are crossing world collision hull and try to move them to the right position"}; cvar_t sv_gameplayfix_fixedcheckwatertransition = {CVAR_SERVER, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"}; +cvar_t sv_gameplayfix_customstats = {CVAR_SERVER | CVAR_READONLY, "sv_gameplayfix_customstats", "0", "Disable stats higher than 220, for use by certain games such as Xonotic"}; cvar_t sv_gravity = {CVAR_SERVER | CVAR_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"}; cvar_t sv_init_frame_count = {CVAR_SERVER, "sv_init_frame_count", "2", "number of frames to run to allow everything to settle before letting clients connect"}; cvar_t sv_idealpitchscale = {CVAR_SERVER, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"}; @@ -548,6 +549,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_unstickplayers); Cvar_RegisterVariable (&sv_gameplayfix_unstickentities); Cvar_RegisterVariable (&sv_gameplayfix_fixedcheckwatertransition); + Cvar_RegisterVariable (&sv_gameplayfix_customstats); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_init_frame_count); Cvar_RegisterVariable (&sv_idealpitchscale); @@ -2115,47 +2117,50 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t //stats[STAT_SECRETS] = PRVM_serverglobalfloat(found_secrets); //stats[STAT_MONSTERS] = PRVM_serverglobalfloat(killed_monsters); - // movement settings for prediction - // note: these are not sent in protocols with lower MAX_CL_STATS limits - stats[STAT_MOVEFLAGS] = MOVEFLAG_VALID - | (sv_gameplayfix_q2airaccelerate.integer ? MOVEFLAG_Q2AIRACCELERATE : 0) - | (sv_gameplayfix_nogravityonground.integer ? MOVEFLAG_NOGRAVITYONGROUND : 0) - | (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0) - ; - statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value; - statsf[STAT_MOVEVARS_TIMESCALE] = host_timescale.value; - statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value; - statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value; - statsf[STAT_MOVEVARS_MAXSPEED] = sv_maxspeed.value; - statsf[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_maxspeed.value; // FIXME: QW has a separate cvar for this - statsf[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value; - statsf[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value >= 0 ? sv_airaccelerate.value : sv_accelerate.value; - statsf[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value >= 0 ? sv_wateraccelerate.value : sv_accelerate.value; - statsf[STAT_MOVEVARS_ENTGRAVITY] = gravity; - statsf[STAT_MOVEVARS_JUMPVELOCITY] = sv_jumpvelocity.value; - statsf[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value; - statsf[STAT_MOVEVARS_MAXAIRSPEED] = sv_maxairspeed.value; - statsf[STAT_MOVEVARS_STEPHEIGHT] = sv_stepheight.value; - statsf[STAT_MOVEVARS_AIRACCEL_QW] = sv_airaccel_qw.value; - statsf[STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR] = sv_airaccel_qw_stretchfactor.value; - statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_airaccel_sideways_friction.value; - statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value; - statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value; - statsf[STAT_MOVEVARS_AIRSTOPACCELERATE] = sv_airstopaccelerate.value; - statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE] = sv_airstrafeaccelerate.value; - statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED] = sv_maxairstrafespeed.value; - statsf[STAT_MOVEVARS_AIRSTRAFEACCEL_QW] = sv_airstrafeaccel_qw.value; - statsf[STAT_MOVEVARS_AIRCONTROL] = sv_aircontrol.value; - statsf[STAT_MOVEVARS_AIRCONTROL_POWER] = sv_aircontrol_power.value; - statsf[STAT_MOVEVARS_AIRCONTROL_PENALTY] = sv_aircontrol_penalty.value; - statsf[STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL] = sv_warsowbunny_airforwardaccel.value; - statsf[STAT_MOVEVARS_WARSOWBUNNY_ACCEL] = sv_warsowbunny_accel.value; - statsf[STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED] = sv_warsowbunny_topspeed.value; - statsf[STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL] = sv_warsowbunny_turnaccel.value; - statsf[STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO] = sv_warsowbunny_backtosideratio.value; - statsf[STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW] = sv_airspeedlimit_nonqw.value; - statsf[STAT_FRAGLIMIT] = fraglimit.value; - statsf[STAT_TIMELIMIT] = timelimit.value; + if(!sv_gameplayfix_customstats.integer) + { + statsf[STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR] = sv_airaccel_qw_stretchfactor.value; + statsf[STAT_MOVEVARS_AIRCONTROL_PENALTY] = sv_aircontrol_penalty.value; + statsf[STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW] = sv_airspeedlimit_nonqw.value; + statsf[STAT_MOVEVARS_AIRSTRAFEACCEL_QW] = sv_airstrafeaccel_qw.value; + statsf[STAT_MOVEVARS_AIRCONTROL_POWER] = sv_aircontrol_power.value; + // movement settings for prediction + // note: these are not sent in protocols with lower MAX_CL_STATS limits + stats[STAT_MOVEFLAGS] = MOVEFLAG_VALID + | (sv_gameplayfix_q2airaccelerate.integer ? MOVEFLAG_Q2AIRACCELERATE : 0) + | (sv_gameplayfix_nogravityonground.integer ? MOVEFLAG_NOGRAVITYONGROUND : 0) + | (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0) + ; + statsf[STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL] = sv_warsowbunny_airforwardaccel.value; + statsf[STAT_MOVEVARS_WARSOWBUNNY_ACCEL] = sv_warsowbunny_accel.value; + statsf[STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED] = sv_warsowbunny_topspeed.value; + statsf[STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL] = sv_warsowbunny_turnaccel.value; + statsf[STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO] = sv_warsowbunny_backtosideratio.value; + statsf[STAT_MOVEVARS_AIRSTOPACCELERATE] = sv_airstopaccelerate.value; + statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE] = sv_airstrafeaccelerate.value; + statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED] = sv_maxairstrafespeed.value; + statsf[STAT_MOVEVARS_AIRCONTROL] = sv_aircontrol.value; + statsf[STAT_FRAGLIMIT] = fraglimit.value; + statsf[STAT_TIMELIMIT] = timelimit.value; + statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value; + statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value; + statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value; + statsf[STAT_MOVEVARS_TIMESCALE] = host_timescale.value; + statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value; + statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value; + statsf[STAT_MOVEVARS_MAXSPEED] = sv_maxspeed.value; + statsf[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_maxspeed.value; // FIXME: QW has a separate cvar for this + statsf[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value; + statsf[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value >= 0 ? sv_airaccelerate.value : sv_accelerate.value; + statsf[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value >= 0 ? sv_wateraccelerate.value : sv_accelerate.value; + statsf[STAT_MOVEVARS_ENTGRAVITY] = gravity; + statsf[STAT_MOVEVARS_JUMPVELOCITY] = sv_jumpvelocity.value; + statsf[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value; + statsf[STAT_MOVEVARS_MAXAIRSPEED] = sv_maxairspeed.value; + statsf[STAT_MOVEVARS_STEPHEIGHT] = sv_stepheight.value; + statsf[STAT_MOVEVARS_AIRACCEL_QW] = sv_airaccel_qw.value; + statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_airaccel_sideways_friction.value; + } if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3 || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5) { diff --git a/svvm_cmds.c b/svvm_cmds.c index 015c6b9d..93376ee9 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1681,6 +1681,8 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms } } +extern cvar_t sv_gameplayfix_customstats; + // void(float index, float type, .void field) SV_AddStat = #232; // Set up an auto-sent player stat. // Client's get thier own fields sent to them. Index may not be less than 32. @@ -1730,9 +1732,9 @@ static void VM_SV_AddStat(prvm_prog_t *prog) // these are hazardous to override but sort of allowed if one wants to be adventurous... and enjoys warnings. if (i < MIN_VM_STAT) VM_Warning(prog, "PF_SV_AddStat: index (%i) < MIN_VM_STAT (%i) may conflict with engine stats - allowed, but this may break things\n", i, MIN_VM_STAT); - else if (i >= MAX_VM_STAT) + else if (i >= MAX_VM_STAT && !sv_gameplayfix_customstats.integer) VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_VM_STAT (%i) conflicts with engine stats - allowed, but this may break slowmo and stuff\n", i, MAX_VM_STAT); - else if (i > (MAX_VM_STAT - 4) && type == 1) + else if (i > (MAX_VM_STAT - 4) && type == 1 && !sv_gameplayfix_customstats.integer) VM_Warning(prog, "PF_SV_AddStat: index (%i) >= MAX_VM_STAT (%i) - 4 with string type won't fit within MAX_VM_STAT, thus conflicting with engine stats - allowed, but this may break slowmo and stuff\n", i, MAX_VM_STAT); vm_customstats[i].type = type; -- 2.39.2