From: TimePath Date: Sat, 28 Nov 2015 03:39:52 +0000 (+1100) Subject: Stats: port remaining movevars X-Git-Tag: xonotic-v0.8.2~1609^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=840cd0a61d5e67d1881c39825db792f277ab70b3;p=xonotic%2Fxonotic-data.pk3dir.git Stats: port remaining movevars --- diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index 8c96174f2..fb49f93fa 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -45,11 +45,11 @@ int _Movetype_FlyMove(float dt, bool applygravity, vector stepnormal, float step if(applygravity) { self.move_didgravity = 1; - grav = dt * (PHYS_ENTGRAVITY(self) ? PHYS_ENTGRAVITY(self) : 1) * PHYS_GRAVITY; + grav = dt * (PHYS_ENTGRAVITY(self) ? PHYS_ENTGRAVITY(self) : 1) * PHYS_GRAVITY(this); if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(self.move_flags & FL_ONGROUND)) { - if(GRAVITY_UNAFFECTED_BY_TICRATE) + if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) self.move_velocity_z -= grav * 0.5; else self.move_velocity_z -= grav; @@ -234,7 +234,7 @@ int _Movetype_FlyMove(float dt, bool applygravity, vector stepnormal, float step { if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(self.move_flags & FL_ONGROUND)) { - if(GRAVITY_UNAFFECTED_BY_TICRATE) + if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) self.move_velocity_z -= grav * 0.5f; } } @@ -643,10 +643,10 @@ void Movetype_Physics_MatchTicrate(float tr, bool sloppy) // SV_Physics_Entity if(self.move_didgravity > 0) { - self.velocity_z -= (GRAVITY_UNAFFECTED_BY_TICRATE ? 0.5 : 1) + self.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) * dt * (self.gravity ? self.gravity : 1) - * PHYS_GRAVITY; + * PHYS_GRAVITY(this); } self.angles = self.move_angles + dt * self.avelocity; @@ -662,8 +662,8 @@ void Movetype_Physics_MatchTicrate(float tr, bool sloppy) // SV_Physics_Entity setorigin(self, trace_endpos); } - if(self.move_didgravity > 0 && GRAVITY_UNAFFECTED_BY_TICRATE) - self.velocity_z -= 0.5 * dt * (self.gravity ? self.gravity : 1) * PHYS_GRAVITY; + if(self.move_didgravity > 0 && GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) + self.velocity_z -= 0.5 * dt * (self.gravity ? self.gravity : 1) * PHYS_GRAVITY(this); } else { diff --git a/qcsrc/common/movetypes/movetypes.qh b/qcsrc/common/movetypes/movetypes.qh index 8a4b99c07..5f04fc9db 100644 --- a/qcsrc/common/movetypes/movetypes.qh +++ b/qcsrc/common/movetypes/movetypes.qh @@ -27,20 +27,6 @@ // should match sv_gameplayfix_fixedcheckwatertransition float autocvar_cl_gameplayfix_fixedcheckwatertransition = 1; -#ifdef SVQC -.int stat_gameplayfix_upvelocityclearsonground = _STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND); - -#define GRAVITY_UNAFFECTED_BY_TICRATE autocvar_sv_gameplayfix_gravityunaffectedbyticrate -#define UPWARD_VELOCITY_CLEARS_ONGROUND autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag - -#define TICRATE sys_frametime -#elif defined(CSQC) -#define GRAVITY_UNAFFECTED_BY_TICRATE (STAT(MOVEFLAGS) & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE) -#define UPWARD_VELOCITY_CLEARS_ONGROUND STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND) - -#define TICRATE ticrate -#endif - .entity move_groundentity; // FIXME add move_groundnetworkentity? .float move_suspendedinair; .float move_didgravity; @@ -91,7 +77,7 @@ const int FL_ONGROUND = 512; const int MOVETYPE_FAKEPUSH = 13; -const int MOVEFLAG_VALID = BIT(31); +const int MOVEFLAG_VALID = BIT(23); const int MOVEFLAG_Q2AIRACCELERATE = BIT(0); const int MOVEFLAG_NOGRAVITYONGROUND = BIT(1); const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE = BIT(2); diff --git a/qcsrc/common/movetypes/toss.qc b/qcsrc/common/movetypes/toss.qc index 32ce9ca31..6f18fbf2a 100644 --- a/qcsrc/common/movetypes/toss.qc +++ b/qcsrc/common/movetypes/toss.qc @@ -26,10 +26,10 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss if (self.move_movetype == MOVETYPE_BOUNCE || self.move_movetype == MOVETYPE_TOSS) { self.move_didgravity = 1; - self.move_velocity_z -= (GRAVITY_UNAFFECTED_BY_TICRATE ? 0.5 : 1) + self.move_velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) * dt * (self.gravity ? self.gravity : 1) - * PHYS_GRAVITY; + * PHYS_GRAVITY(this); } self.move_angles = self.move_angles + self.move_avelocity * dt; @@ -64,7 +64,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss { float bouncefac = self.move_bounce_factor; if (!bouncefac) bouncefac = 0.5; float bouncestop = self.move_bounce_stopspeed; if (!bouncestop) bouncestop = 60 / 800; - bouncestop *= (self.gravity ? self.gravity : 1) * PHYS_GRAVITY; + bouncestop *= (self.gravity ? self.gravity : 1) * PHYS_GRAVITY(this); self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1 + bouncefac); @@ -108,8 +108,8 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss break; } - if (GRAVITY_UNAFFECTED_BY_TICRATE && self.move_didgravity > 0 && !(self.move_flags & FL_ONGROUND)) - self.move_velocity_z -= 0.5 * dt * (self.gravity ? self.gravity : 1) * PHYS_GRAVITY; + if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && self.move_didgravity > 0 && !(self.move_flags & FL_ONGROUND)) + self.move_velocity_z -= 0.5 * dt * (self.gravity ? self.gravity : 1) * PHYS_GRAVITY(this); _Movetype_CheckWaterTransition(self); } diff --git a/qcsrc/common/mutators/mutator/dodging/dodging.qc b/qcsrc/common/mutators/mutator/dodging/dodging.qc index c4deba5ea..4f724cfbf 100644 --- a/qcsrc/common/mutators/mutator/dodging/dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/dodging.qc @@ -1,49 +1,30 @@ #ifdef IMPLEMENTATION +#define PHYS_DODGING STAT(DODGING, this) +#define PHYS_DODGING_DELAY STAT(DODGING_DELAY, this) +#define PHYS_DODGING_DISTANCE_THRESHOLD STAT(DODGING_DISTANCE_THRESHOLD, this) +#define PHYS_DODGING_FROZEN_NODOUBLETAP STAT(DODGING_FROZEN_NO_DOUBLETAP, this) +#define PHYS_DODGING_HEIGHT_THRESHOLD STAT(DODGING_HEIGHT_THRESHOLD, this) +#define PHYS_DODGING_HORIZ_SPEED STAT(DODGING_HORIZ_SPEED, this) +#define PHYS_DODGING_HORIZ_SPEED_FROZEN STAT(DODGING_HORIZ_SPEED_FROZEN, this) +#define PHYS_DODGING_RAMP_TIME STAT(DODGING_RAMP_TIME, this) +#define PHYS_DODGING_UP_SPEED STAT(DODGING_UP_SPEED, this) +#define PHYS_DODGING_WALL STAT(DODGING_WALL, this) +#define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys + #ifdef CSQC #define PHYS_DODGING_FRAMETIME (1 / (frametime <= 0 ? 60 : frametime)) - #define PHYS_DODGING STAT(DODGING) - #define PHYS_DODGING_DELAY STAT(DODGING_DELAY) #define PHYS_DODGING_TIMEOUT(s) STAT(DODGING_TIMEOUT) - #define PHYS_DODGING_HORIZ_SPEED_FROZEN STAT(DODGING_HORIZ_SPEED_FROZEN) - #define PHYS_DODGING_FROZEN_NODOUBLETAP STAT(DODGING_FROZEN_NO_DOUBLETAP) - #define PHYS_DODGING_HORIZ_SPEED STAT(DODGING_HORIZ_SPEED) - #define PHYS_DODGING_PRESSED_KEYS(s) s.pressedkeys - #define PHYS_DODGING_HEIGHT_THRESHOLD STAT(DODGING_HEIGHT_THRESHOLD) - #define PHYS_DODGING_DISTANCE_THRESHOLD STAT(DODGING_DISTANCE_THRESHOLD) - #define PHYS_DODGING_RAMP_TIME STAT(DODGING_RAMP_TIME) - #define PHYS_DODGING_UP_SPEED STAT(DODGING_UP_SPEED) - #define PHYS_DODGING_WALL STAT(DODGING_WALL) #elif defined(SVQC) #define PHYS_DODGING_FRAMETIME sys_frametime - #define PHYS_DODGING g_dodging - #define PHYS_DODGING_DELAY autocvar_sv_dodging_delay #define PHYS_DODGING_TIMEOUT(s) s.cvar_cl_dodging_timeout - #define PHYS_DODGING_HORIZ_SPEED_FROZEN autocvar_sv_dodging_horiz_speed_frozen - #define PHYS_DODGING_FROZEN_NODOUBLETAP autocvar_sv_dodging_frozen_doubletap - #define PHYS_DODGING_HORIZ_SPEED autocvar_sv_dodging_horiz_speed - #define PHYS_DODGING_PRESSED_KEYS(s) s.pressedkeys - #define PHYS_DODGING_HEIGHT_THRESHOLD autocvar_sv_dodging_height_threshold - #define PHYS_DODGING_DISTANCE_THRESHOLD autocvar_sv_dodging_wall_distance_threshold - #define PHYS_DODGING_RAMP_TIME autocvar_sv_dodging_ramp_time - #define PHYS_DODGING_UP_SPEED autocvar_sv_dodging_up_speed - #define PHYS_DODGING_WALL autocvar_sv_dodging_wall_dodging - - float autocvar_sv_dodging_delay; - float autocvar_sv_dodging_height_threshold; - float autocvar_sv_dodging_horiz_speed; - float autocvar_sv_dodging_horiz_speed_frozen; - float autocvar_sv_dodging_ramp_time; - bool autocvar_sv_dodging_sound; - float autocvar_sv_dodging_up_speed; - float autocvar_sv_dodging_wall_distance_threshold; - bool autocvar_sv_dodging_wall_dodging; - bool autocvar_sv_dodging_frozen_doubletap; + + #endif #ifdef SVQC -float g_dodging; +bool autocvar_sv_dodging_sound; // set to 1 to indicate dodging has started.. reset by physics hook after dodge has been done.. .float dodging_action; @@ -56,18 +37,6 @@ float g_dodging; .float cvar_cl_dodging_timeout = _STAT(DODGING_TIMEOUT); -.float stat_dodging = _STAT(DODGING); -.float stat_dodging_delay = _STAT(DODGING_DELAY); -.float stat_dodging_horiz_speed_frozen = _STAT(DODGING_HORIZ_SPEED_FROZEN); -.float stat_dodging_frozen_nodoubletap = _STAT(DODGING_FROZEN_NO_DOUBLETAP); -.float stat_dodging_frozen = _STAT(DODGING_FROZEN); -.float stat_dodging_horiz_speed = _STAT(DODGING_HORIZ_SPEED); -.float stat_dodging_height_threshold = _STAT(DODGING_HEIGHT_THRESHOLD); -.float stat_dodging_distance_threshold = _STAT(DODGING_DISTANCE_THRESHOLD); -.float stat_dodging_ramp_time = _STAT(DODGING_RAMP_TIME); -.float stat_dodging_up_speed = _STAT(DODGING_UP_SPEED); -.float stat_dodging_wall = _STAT(DODGING_WALL); - REGISTER_MUTATOR(dodging, cvar("g_dodging")) { // this just turns on the cvar. @@ -114,23 +83,6 @@ REGISTER_MUTATOR(dodging, cvar("g_dodging")) #ifdef CSQC .int pressedkeys; - -#elif defined(SVQC) - -void dodging_UpdateStats() -{SELFPARAM(); - self.stat_dodging = PHYS_DODGING; - self.stat_dodging_delay = PHYS_DODGING_DELAY; - self.stat_dodging_horiz_speed_frozen = PHYS_DODGING_HORIZ_SPEED_FROZEN; - self.stat_dodging_frozen = PHYS_DODGING_FROZEN; - self.stat_dodging_frozen_nodoubletap = PHYS_DODGING_FROZEN_NODOUBLETAP; - self.stat_dodging_height_threshold = PHYS_DODGING_HEIGHT_THRESHOLD; - self.stat_dodging_distance_threshold = PHYS_DODGING_DISTANCE_THRESHOLD; - self.stat_dodging_ramp_time = PHYS_DODGING_RAMP_TIME; - self.stat_dodging_up_speed = PHYS_DODGING_UP_SPEED; - self.stat_dodging_wall = PHYS_DODGING_WALL; -} - #endif // returns 1 if the player is close to a wall @@ -222,10 +174,6 @@ void PM_dodging() if (!PHYS_DODGING) return; -#ifdef SVQC - dodging_UpdateStats(); -#endif - if (PHYS_DEAD(self)) return; diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qc b/qcsrc/common/mutators/mutator/multijump/multijump.qc index 688202cf9..e65e7e8b4 100644 --- a/qcsrc/common/mutators/mutator/multijump/multijump.qc +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qc @@ -8,44 +8,11 @@ .bool multijump_ready; .bool cvar_cl_multijump; -#ifdef CSQC - -#define PHYS_MULTIJUMP STAT(MULTIJUMP) -#define PHYS_MULTIJUMP_SPEED STAT(MULTIJUMP_SPEED) -#define PHYS_MULTIJUMP_ADD STAT(MULTIJUMP_ADD) -#define PHYS_MULTIJUMP_MAXSPEED STAT(MULTIJUMP_MAXSPEED) -#define PHYS_MULTIJUMP_DODGING STAT(MULTIJUMP_DODGING) - -#elif defined(SVQC) - -int autocvar_g_multijump; -float autocvar_g_multijump_add; -float autocvar_g_multijump_speed; -float autocvar_g_multijump_maxspeed; -float autocvar_g_multijump_dodging = 1; - -#define PHYS_MULTIJUMP autocvar_g_multijump -#define PHYS_MULTIJUMP_SPEED autocvar_g_multijump_speed -#define PHYS_MULTIJUMP_ADD autocvar_g_multijump_add -#define PHYS_MULTIJUMP_MAXSPEED autocvar_g_multijump_maxspeed -#define PHYS_MULTIJUMP_DODGING autocvar_g_multijump_dodging - -.float stat_multijump = _STAT(MULTIJUMP); -.float stat_multijump_speed = _STAT(MULTIJUMP_SPEED); -.float stat_multijump_add = _STAT(MULTIJUMP_ADD); -.float stat_multijump_maxspeed = _STAT(MULTIJUMP_MAXSPEED); -.float stat_multijump_dodging = _STAT(MULTIJUMP_DODGING); - -void multijump_UpdateStats() -{SELFPARAM(); - STAT(MULTIJUMP, this) = PHYS_MULTIJUMP; - STAT(MULTIJUMP_SPEED, this) = PHYS_MULTIJUMP_SPEED; - STAT(MULTIJUMP_ADD, this) = PHYS_MULTIJUMP_ADD; - STAT(MULTIJUMP_MAXSPEED, this) = PHYS_MULTIJUMP_MAXSPEED; - STAT(MULTIJUMP_DODGING, this) = PHYS_MULTIJUMP_DODGING; -} - -#endif +#define PHYS_MULTIJUMP STAT(MULTIJUMP, self) +#define PHYS_MULTIJUMP_SPEED STAT(MULTIJUMP_SPEED, self) +#define PHYS_MULTIJUMP_ADD STAT(MULTIJUMP_ADD, self) +#define PHYS_MULTIJUMP_MAXSPEED STAT(MULTIJUMP_MAXSPEED, self) +#define PHYS_MULTIJUMP_DODGING STAT(MULTIJUMP_DODGING, self) void PM_multijump() {SELFPARAM(); @@ -138,7 +105,6 @@ REGISTER_MUTATOR(multijump, cvar("g_multijump")); MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics) { - multijump_UpdateStats(); PM_multijump(); return false; diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 341a40f2e..f55bf3351 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -53,101 +53,48 @@ void Physics_AddStats() addstat(STAT_PL_CROUCH_MAX1, AS_FLOAT, stat_pl_crouch_max_x); addstat(STAT_PL_CROUCH_MAX2, AS_FLOAT, stat_pl_crouch_max_y); addstat(STAT_PL_CROUCH_MAX3, AS_FLOAT, stat_pl_crouch_max_z); - - // g_movementspeed hack - addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed); - addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); - - // new properties - addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_sv_jumpvelocity); - addstat(STAT_MOVEVARS_MAXAIRSTRAFESPEED, AS_FLOAT, stat_sv_maxairstrafespeed); - addstat(STAT_MOVEVARS_MAXAIRSPEED, AS_FLOAT, stat_sv_maxairspeed); - addstat(STAT_MOVEVARS_AIRSTRAFEACCELERATE, AS_FLOAT, stat_sv_airstrafeaccelerate); - addstat(STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL, AS_FLOAT, stat_sv_warsowbunny_turnaccel); - addstat(STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, AS_FLOAT, stat_sv_airaccel_sideways_friction); - addstat(STAT_MOVEVARS_AIRCONTROL, AS_FLOAT, stat_sv_aircontrol); - addstat(STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, AS_FLOAT, stat_sv_warsowbunny_airforwardaccel); - addstat(STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED, AS_FLOAT, stat_sv_warsowbunny_topspeed); - addstat(STAT_MOVEVARS_WARSOWBUNNY_ACCEL, AS_FLOAT, stat_sv_warsowbunny_accel); - addstat(STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, AS_FLOAT, stat_sv_warsowbunny_backtosideratio); - addstat(STAT_MOVEVARS_FRICTION, AS_FLOAT, stat_sv_friction); - addstat(STAT_MOVEVARS_ACCELERATE, AS_FLOAT, stat_sv_accelerate); - addstat(STAT_MOVEVARS_STOPSPEED, AS_FLOAT, stat_sv_stopspeed); - addstat(STAT_MOVEVARS_AIRACCELERATE, AS_FLOAT, stat_sv_airaccelerate); - addstat(STAT_MOVEVARS_AIRSTOPACCELERATE, AS_FLOAT, stat_sv_airstopaccelerate); } -void Physics_UpdateStats(float maxspd_mod) -{SELFPARAM(); +void Physics_UpdateStats(entity this, float maxspd_mod) +{ // blah - self.stat_pl_view_ofs = PL_VIEW_OFS; - self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS; - - self.stat_pl_min = PL_MIN; - self.stat_pl_max = PL_MAX; - self.stat_pl_crouch_min = PL_CROUCH_MIN; - self.stat_pl_crouch_max = PL_CROUCH_MAX; + this.stat_pl_view_ofs = PL_VIEW_OFS; + this.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS; + this.stat_pl_min = PL_MIN; + this.stat_pl_max = PL_MAX; + this.stat_pl_crouch_min = PL_CROUCH_MIN; + this.stat_pl_crouch_max = PL_CROUCH_MAX; - self.stat_sv_airaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airaccel_qw"), maxspd_mod); - STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(self, "airstrafeaccel_qw")) - ? AdjustAirAccelQW(Physics_ClientOption(self, "airstrafeaccel_qw"), maxspd_mod) + STAT(MOVEVARS_AIRACCEL_QW, this) = AdjustAirAccelQW(Physics_ClientOption(this, "airaccel_qw"), maxspd_mod); + STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(this, "airstrafeaccel_qw")) + ? AdjustAirAccelQW(Physics_ClientOption(this, "airstrafeaccel_qw"), maxspd_mod) : 0; - STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(self, "airspeedlimit_nonqw") * maxspd_mod; - self.stat_sv_maxspeed = Physics_ClientOption(self, "maxspeed") * maxspd_mod; // also slow walking - STAT(MOVEVARS_HIGHSPEED, this) = PHYS_HIGHSPEED; // TODO: remove this! - - STAT(DOUBLEJUMP, this) = PHYS_DOUBLEJUMP; - - STAT(JETPACK_ANTIGRAVITY, this) = PHYS_JETPACK_ANTIGRAVITY; - STAT(JETPACK_ACCEL_UP, this) = PHYS_JETPACK_ACCEL_UP; - STAT(JETPACK_ACCEL_SIDE, this) = PHYS_JETPACK_ACCEL_SIDE; - STAT(JETPACK_MAXSPEED_SIDE, this) = PHYS_JETPACK_MAXSPEED_SIDE; - STAT(JETPACK_MAXSPEED_UP, this) = PHYS_JETPACK_MAXSPEED_UP; - STAT(JETPACK_FUEL, this) = PHYS_JETPACK_FUEL; - - STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, this) = PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS; - - STAT(MOVEVARS_FRICTION_ONLAND, this) = PHYS_FRICTION_ONLAND; - STAT(MOVEVARS_FRICTION_SLICK, this) = PHYS_FRICTION_SLICK; - - STAT(MOVEVARS_JUMPSTEP, this) = PHYS_JUMPSTEP; - - STAT(GAMEPLAYFIX_STEPDOWN, this) = GAMEPLAYFIX_STEPDOWN; - - STAT(NOSTEP, this) = PHYS_NOSTEP; - - STAT(GAMEPLAYFIX_EASIERWATERJUMP, this) = GAMEPLAYFIX_EASIERWATERJUMP; - STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, this) = GAMEPLAYFIX_DOWNTRACEONGROUND; - STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, this) = GAMEPLAYFIX_STEPMULTIPLETIMES; - STAT(GAMEPLAYFIX_UNSTICKPLAYERS, this) = GAMEPLAYFIX_UNSTICKPLAYERS; - + STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw") * maxspd_mod; + STAT(MOVEVARS_MAXSPEED, this) = Physics_ClientOption(this, "maxspeed") * maxspd_mod; // also slow walking // old stats // fix some new settings - STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, this) = Physics_ClientOption(self, "airaccel_qw_stretchfactor"); - self.stat_sv_maxairstrafespeed = Physics_ClientOption(self, "maxairstrafespeed"); - self.stat_sv_maxairspeed = Physics_ClientOption(self, "maxairspeed"); - self.stat_sv_airstrafeaccelerate = Physics_ClientOption(self, "airstrafeaccelerate"); - self.stat_sv_warsowbunny_turnaccel = Physics_ClientOption(self, "warsowbunny_turnaccel"); - self.stat_sv_airaccel_sideways_friction = Physics_ClientOption(self, "airaccel_sideways_friction"); - self.stat_sv_aircontrol = Physics_ClientOption(self, "aircontrol"); - STAT(MOVEVARS_AIRCONTROL_POWER, this) = Physics_ClientOption(self, "aircontrol_power"); - STAT(MOVEVARS_AIRCONTROL_PENALTY, this) = Physics_ClientOption(self, "aircontrol_penalty"); - self.stat_sv_warsowbunny_airforwardaccel = Physics_ClientOption(self, "warsowbunny_airforwardaccel"); - self.stat_sv_warsowbunny_topspeed = Physics_ClientOption(self, "warsowbunny_topspeed"); - self.stat_sv_warsowbunny_accel = Physics_ClientOption(self, "warsowbunny_accel"); - self.stat_sv_warsowbunny_backtosideratio = Physics_ClientOption(self, "warsowbunny_backtosideratio"); - self.stat_sv_friction = Physics_ClientOption(self, "friction"); - self.stat_sv_accelerate = Physics_ClientOption(self, "accelerate"); - self.stat_sv_stopspeed = Physics_ClientOption(self, "stopspeed"); - self.stat_sv_airaccelerate = Physics_ClientOption(self, "airaccelerate"); - self.stat_sv_airstopaccelerate = Physics_ClientOption(self, "airstopaccelerate"); - self.stat_sv_jumpvelocity = Physics_ClientOption(self, "jumpvelocity"); - - STAT(MOVEVARS_TRACK_CANJUMP, this) = Physics_ClientOption(self, "track_canjump"); - - self.stat_gameplayfix_upvelocityclearsonground = UPWARD_VELOCITY_CLEARS_ONGROUND; + STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, this) = Physics_ClientOption(this, "airaccel_qw_stretchfactor"); + STAT(MOVEVARS_MAXAIRSTRAFESPEED, this) = Physics_ClientOption(this, "maxairstrafespeed"); + STAT(MOVEVARS_MAXAIRSPEED, this) = Physics_ClientOption(this, "maxairspeed"); + STAT(MOVEVARS_AIRSTRAFEACCELERATE, this) = Physics_ClientOption(this, "airstrafeaccelerate"); + STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, this) = Physics_ClientOption(this, "warsowbunny_turnaccel"); + STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, this) = Physics_ClientOption(this, "airaccel_sideways_friction"); + STAT(MOVEVARS_AIRCONTROL, this) = Physics_ClientOption(this, "aircontrol"); + STAT(MOVEVARS_AIRCONTROL_POWER, this) = Physics_ClientOption(this, "aircontrol_power"); + STAT(MOVEVARS_AIRCONTROL_PENALTY, this) = Physics_ClientOption(this, "aircontrol_penalty"); + STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, this) = Physics_ClientOption(this, "warsowbunny_airforwardaccel"); + STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, this) = Physics_ClientOption(this, "warsowbunny_topspeed"); + STAT(MOVEVARS_WARSOWBUNNY_ACCEL, this) = Physics_ClientOption(this, "warsowbunny_accel"); + STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, this) = Physics_ClientOption(this, "warsowbunny_backtosideratio"); + STAT(MOVEVARS_FRICTION, this) = Physics_ClientOption(this, "friction"); + STAT(MOVEVARS_ACCELERATE, this) = Physics_ClientOption(this, "accelerate"); + STAT(MOVEVARS_STOPSPEED, this) = Physics_ClientOption(this, "stopspeed"); + STAT(MOVEVARS_AIRACCELERATE, this) = Physics_ClientOption(this, "airaccelerate"); + STAT(MOVEVARS_AIRSTOPACCELERATE, this) = Physics_ClientOption(this, "airstopaccelerate"); + STAT(MOVEVARS_JUMPVELOCITY, this) = Physics_ClientOption(this, "jumpvelocity"); + STAT(MOVEVARS_TRACK_CANJUMP, this) = Physics_ClientOption(this, "track_canjump"); } #endif @@ -842,7 +789,7 @@ void RaceCarPhysics() vector rigvel_xy, neworigin, up; float mt; - rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY; // 4x gravity plays better + rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY(this); // 4x gravity plays better rigvel_xy = vec2(rigvel); if (g_bugrigs_planar_movement_car_jumping) @@ -891,7 +838,7 @@ void RaceCarPhysics() } else { - rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY; // 4x gravity plays better + rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY(this); // 4x gravity plays better self.velocity = rigvel; self.movetype = MOVETYPE_FLY; } @@ -1237,7 +1184,7 @@ void PM_ladder(float maxspd_mod) UNSET_ONGROUND(self); float g; - g = PHYS_GRAVITY * PHYS_INPUT_TIMELENGTH; + g = PHYS_GRAVITY(this) * PHYS_INPUT_TIMELENGTH; if (PHYS_ENTGRAVITY(self)) g *= PHYS_ENTGRAVITY(self); if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) @@ -1303,7 +1250,7 @@ void PM_jetpack(float maxspd_mod) // it is now normalized, so... float a_side = PHYS_JETPACK_ACCEL_SIDE; float a_up = PHYS_JETPACK_ACCEL_UP; - float a_add = PHYS_JETPACK_ANTIGRAVITY * PHYS_GRAVITY; + float a_add = PHYS_JETPACK_ANTIGRAVITY * PHYS_GRAVITY(this); wishvel_x *= a_side; wishvel_y *= a_side; @@ -1352,7 +1299,7 @@ void PM_jetpack(float maxspd_mod) float fxy, fz; fxy = bound(0, 1 - (self.velocity * normalize(wishvel_x * '1 0 0' + wishvel_y * '0 1 0')) / PHYS_JETPACK_MAXSPEED_SIDE, 1); - if (wishvel_z - PHYS_GRAVITY > 0) + if (wishvel_z - PHYS_GRAVITY(this) > 0) fz = bound(0, 1 - self.velocity_z / PHYS_JETPACK_MAXSPEED_UP, 1); else fz = bound(0, 1 + self.velocity_z / PHYS_JETPACK_MAXSPEED_UP, 1); @@ -1361,7 +1308,7 @@ void PM_jetpack(float maxspd_mod) fvel = vlen(wishvel); wishvel_x *= fxy; wishvel_y *= fxy; - wishvel_z = (wishvel_z - PHYS_GRAVITY) * fz + PHYS_GRAVITY; + wishvel_z = (wishvel_z - PHYS_GRAVITY(this)) * fz + PHYS_GRAVITY(this); fvel = min(1, vlen(wishvel) / best); if (PHYS_JETPACK_FUEL && !(ITEMS_STAT(self) & IT_UNLIMITED_WEAPON_AMMO)) @@ -1388,7 +1335,7 @@ void PM_jetpack(float maxspd_mod) } #ifdef CSQC - float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; + float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) self.velocity_z -= g * 0.5; else @@ -1475,7 +1422,7 @@ void PM_walk(float buttons_prev, float maxspd_mod) float accelspeed = min(PHYS_ACCELERATE * PHYS_INPUT_TIMELENGTH * wishspeed, addspeed); self.velocity += accelspeed * wishdir; } - float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; + float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; if (!(GAMEPLAYFIX_NOGRAVITYONGROUND)) self.velocity_z -= g * (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1); if (self.velocity * self.velocity) @@ -1547,7 +1494,7 @@ void PM_air(float buttons_prev, float maxspd_mod) if (PHYS_AIRCONTROL) CPM_PM_Aircontrol(wishdir, wishspeed2); } - float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; + float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) self.velocity_z -= g * 0.5; else @@ -1600,7 +1547,7 @@ void PM_Main() maxspeed_mod *= PHYS_HIGHSPEED; #ifdef SVQC - Physics_UpdateStats(maxspeed_mod); + Physics_UpdateStats(this, maxspeed_mod); if (self.PlayerPhysplug) if (self.PlayerPhysplug()) diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index e70b489fd..114d0418b 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -24,7 +24,90 @@ float AdjustAirAccelQW(float accelqw, float factor); bool IsFlying(entity a); -#define PHYS_AMMO_FUEL(s) STAT(FUEL, s) +#define BUFFS_STAT(s) STAT(BUFFS, s) + +#define GAMEPLAYFIX_DOWNTRACEONGROUND STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, this) +#define GAMEPLAYFIX_EASIERWATERJUMP STAT(GAMEPLAYFIX_EASIERWATERJUMP, this) +#define GAMEPLAYFIX_STEPDOWN STAT(GAMEPLAYFIX_STEPDOWN, this) +#define GAMEPLAYFIX_STEPMULTIPLETIMES STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, this) +#define GAMEPLAYFIX_UNSTICKPLAYERS STAT(GAMEPLAYFIX_UNSTICKPLAYERS, this) + +#define PHYS_ACCELERATE STAT(MOVEVARS_ACCELERATE, this) +#define PHYS_AIRACCELERATE STAT(MOVEVARS_AIRACCELERATE, this) +#define PHYS_AIRACCEL_QW(s) STAT(MOVEVARS_AIRACCEL_QW, s) +#define PHYS_AIRACCEL_QW_STRETCHFACTOR(s) STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, s) +#define PHYS_AIRACCEL_SIDEWAYS_FRICTION STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, this) +#define PHYS_AIRCONTROL STAT(MOVEVARS_AIRCONTROL, this) +#define PHYS_AIRCONTROL_PENALTY STAT(MOVEVARS_AIRCONTROL_PENALTY, this) +#define PHYS_AIRCONTROL_POWER STAT(MOVEVARS_AIRCONTROL_POWER, this) +#define PHYS_AIRSPEEDLIMIT_NONQW(s) STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, s) +#define PHYS_AIRSTOPACCELERATE STAT(MOVEVARS_AIRSTOPACCELERATE, this) +#define PHYS_AIRSTRAFEACCELERATE(s) STAT(MOVEVARS_AIRSTRAFEACCELERATE, this) +#define PHYS_AIRSTRAFEACCEL_QW(s) STAT(MOVEVARS_AIRSTRAFEACCEL_QW, s) + +#define PHYS_AMMO_FUEL(s) STAT(FUEL, s) + +#define PHYS_BUGRIGS STAT(BUGRIGS, this) +#define PHYS_BUGRIGS_ACCEL STAT(BUGRIGS_ACCEL, this) +#define PHYS_BUGRIGS_AIR_STEERING STAT(BUGRIGS_AIR_STEERING, this) +#define PHYS_BUGRIGS_ANGLE_SMOOTHING STAT(BUGRIGS_ANGLE_SMOOTHING, this) +#define PHYS_BUGRIGS_CAR_JUMPING STAT(BUGRIGS_CAR_JUMPING, this) +#define PHYS_BUGRIGS_FRICTION_AIR STAT(BUGRIGS_FRICTION_AIR, this) +#define PHYS_BUGRIGS_FRICTION_BRAKE STAT(BUGRIGS_FRICTION_BRAKE, this) +#define PHYS_BUGRIGS_FRICTION_FLOOR STAT(BUGRIGS_FRICTION_FLOOR, this) +#define PHYS_BUGRIGS_PLANAR_MOVEMENT STAT(BUGRIGS_PLANAR_MOVEMENT, this) +#define PHYS_BUGRIGS_REVERSE_SPEEDING STAT(BUGRIGS_REVERSE_SPEEDING, this) +#define PHYS_BUGRIGS_REVERSE_SPINNING STAT(BUGRIGS_REVERSE_SPINNING, this) +#define PHYS_BUGRIGS_REVERSE_STOPPING STAT(BUGRIGS_REVERSE_STOPPING, this) +#define PHYS_BUGRIGS_SPEED_POW STAT(BUGRIGS_SPEED_POW, this) +#define PHYS_BUGRIGS_SPEED_REF STAT(BUGRIGS_SPEED_REF, this) +#define PHYS_BUGRIGS_STEER STAT(BUGRIGS_STEER, this) + +#define PHYS_DODGING_FROZEN STAT(DODGING_FROZEN, this) + +#define PHYS_DOUBLEJUMP STAT(DOUBLEJUMP, this) + +#define PHYS_FRICTION STAT(MOVEVARS_FRICTION, this) +#define PHYS_FRICTION_ONLAND STAT(MOVEVARS_FRICTION_ONLAND, this) +#define PHYS_FRICTION_SLICK STAT(MOVEVARS_FRICTION_SLICK, this) + +#define PHYS_FROZEN(s) STAT(FROZEN, s) + +#define PHYS_GRAVITY(s) STAT(MOVEVARS_GRAVITY, s) + +#define PHYS_HIGHSPEED STAT(MOVEVARS_HIGHSPEED, this) + +#define PHYS_JETPACK_ACCEL_SIDE STAT(JETPACK_ACCEL_SIDE, this) +#define PHYS_JETPACK_ACCEL_UP STAT(JETPACK_ACCEL_UP, this) +#define PHYS_JETPACK_ANTIGRAVITY STAT(JETPACK_ANTIGRAVITY, this) +#define PHYS_JETPACK_FUEL STAT(JETPACK_FUEL, this) +#define PHYS_JETPACK_MAXSPEED_SIDE STAT(JETPACK_MAXSPEED_SIDE, this) +#define PHYS_JETPACK_MAXSPEED_UP STAT(JETPACK_MAXSPEED_UP, this) + +#define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, this) +#define PHYS_JUMPSTEP STAT(MOVEVARS_JUMPSTEP, this) +#define PHYS_JUMPVELOCITY STAT(MOVEVARS_JUMPVELOCITY, this) + +#define PHYS_MAXAIRSPEED(s) STAT(MOVEVARS_MAXAIRSPEED, s) +#define PHYS_MAXAIRSTRAFESPEED STAT(MOVEVARS_MAXAIRSTRAFESPEED, this) +#define PHYS_MAXSPEED(s) STAT(MOVEVARS_MAXSPEED, s) + +#define PHYS_NOSTEP STAT(NOSTEP, this) +#define PHYS_STEPHEIGHT STAT(MOVEVARS_STEPHEIGHT, this) + +#define PHYS_STOPSPEED STAT(MOVEVARS_STOPSPEED, this) + +#define PHYS_TRACK_CANJUMP(s) STAT(MOVEVARS_TRACK_CANJUMP, s) + +#define PHYS_WALLFRICTION STAT(MOVEVARS_WALLFRICTION, this) + +#define PHYS_WARSOWBUNNY_ACCEL STAT(MOVEVARS_WARSOWBUNNY_ACCEL, this) +#define PHYS_WARSOWBUNNY_AIRFORWARDACCEL STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, this) +#define PHYS_WARSOWBUNNY_BACKTOSIDERATIO STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, this) +#define PHYS_WARSOWBUNNY_TOPSPEED STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, this) +#define PHYS_WARSOWBUNNY_TURNACCEL STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, this) + +#define UPWARD_VELOCITY_CLEARS_ONGROUND STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, this) #ifdef CSQC @@ -49,6 +132,8 @@ bool IsFlying(entity a); //float player_multijump; //float player_jumpheight; + #define TICRATE ticrate + #define PHYS_INPUT_ANGLES(s) input_angles // TODO #define PHYS_WORLD_ANGLES(s) input_angles @@ -74,14 +159,9 @@ bool IsFlying(entity a); #define PHYS_DEAD(s) s.csqcmodel_isdead - #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE !!(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE) - #define GAMEPLAYFIX_NOGRAVITYONGROUND cvar("sv_gameplayfix_nogravityonground") - #define GAMEPLAYFIX_Q2AIRACCELERATE cvar("sv_gameplayfix_q2airaccelerate") - #define GAMEPLAYFIX_EASIERWATERJUMP STAT(GAMEPLAYFIX_EASIERWATERJUMP) - #define GAMEPLAYFIX_DOWNTRACEONGROUND STAT(GAMEPLAYFIX_DOWNTRACEONGROUND) - #define GAMEPLAYFIX_STEPMULTIPLETIMES STAT(GAMEPLAYFIX_STEPMULTIPLETIMES) - #define GAMEPLAYFIX_UNSTICKPLAYERS STAT(GAMEPLAYFIX_UNSTICKPLAYERS) - #define GAMEPLAYFIX_STEPDOWN STAT(GAMEPLAYFIX_STEPDOWN) + #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)) + #define GAMEPLAYFIX_NOGRAVITYONGROUND (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND)) + #define GAMEPLAYFIX_Q2AIRACCELERATE (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE)) #define IS_DUCKED(s) !!(s.flags & FL_DUCKED) #define SET_DUCKED(s) s.flags |= FL_DUCKED @@ -98,77 +178,13 @@ bool IsFlying(entity a); #define WAS_ONGROUND(s) !!(s.lastflags & FL_ONGROUND) #define ITEMS_STAT(s) (s).items - #define BUFFS_STAT(s) STAT(BUFFS) - - #define PHYS_FROZEN(s) STAT(FROZEN) - - #define PHYS_DOUBLEJUMP STAT(DOUBLEJUMP) - - #define PHYS_BUGRIGS STAT(BUGRIGS) - #define PHYS_BUGRIGS_ANGLE_SMOOTHING STAT(BUGRIGS_ANGLE_SMOOTHING) - #define PHYS_BUGRIGS_PLANAR_MOVEMENT STAT(BUGRIGS_PLANAR_MOVEMENT) - #define PHYS_BUGRIGS_REVERSE_SPEEDING STAT(BUGRIGS_REVERSE_SPEEDING) - #define PHYS_BUGRIGS_FRICTION_FLOOR STAT(BUGRIGS_FRICTION_FLOOR) - #define PHYS_BUGRIGS_AIR_STEERING STAT(BUGRIGS_AIR_STEERING) - #define PHYS_BUGRIGS_FRICTION_BRAKE STAT(BUGRIGS_FRICTION_BRAKE) - #define PHYS_BUGRIGS_ACCEL STAT(BUGRIGS_ACCEL) - #define PHYS_BUGRIGS_SPEED_REF STAT(BUGRIGS_SPEED_REF) - #define PHYS_BUGRIGS_SPEED_POW STAT(BUGRIGS_SPEED_POW) - #define PHYS_BUGRIGS_STEER STAT(BUGRIGS_STEER) - #define PHYS_BUGRIGS_FRICTION_AIR STAT(BUGRIGS_FRICTION_AIR) - #define PHYS_BUGRIGS_CAR_JUMPING STAT(BUGRIGS_CAR_JUMPING) - #define PHYS_BUGRIGS_REVERSE_SPINNING STAT(BUGRIGS_REVERSE_SPINNING) - #define PHYS_BUGRIGS_REVERSE_STOPPING STAT(BUGRIGS_REVERSE_STOPPING) #define PHYS_JUMPSPEEDCAP_MIN cvar_string("cl_jumpspeedcap_min") #define PHYS_JUMPSPEEDCAP_MAX cvar_string("cl_jumpspeedcap_max") - #define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS) - - #define PHYS_CL_TRACK_CANJUMP(s) STAT(MOVEVARS_CL_TRACK_CANJUMP) - #define PHYS_TRACK_CANJUMP(s) STAT(MOVEVARS_TRACK_CANJUMP) - #define PHYS_ACCELERATE getstatf(STAT_MOVEVARS_ACCELERATE) - #define PHYS_AIRACCEL_QW(s) getstatf(STAT_MOVEVARS_AIRACCEL_QW) - #define PHYS_AIRACCEL_QW_STRETCHFACTOR(s) STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, s) - #define PHYS_AIRACCEL_SIDEWAYS_FRICTION getstatf(STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION) - #define PHYS_AIRACCELERATE getstatf(STAT_MOVEVARS_AIRACCELERATE) - #define PHYS_AIRCONTROL getstatf(STAT_MOVEVARS_AIRCONTROL) - #define PHYS_AIRCONTROL_PENALTY STAT(MOVEVARS_AIRCONTROL_PENALTY) - #define PHYS_AIRCONTROL_POWER STAT(MOVEVARS_AIRCONTROL_POWER) - #define PHYS_AIRSPEEDLIMIT_NONQW(s) STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, s) - #define PHYS_AIRSTOPACCELERATE getstatf(STAT_MOVEVARS_AIRSTOPACCELERATE) - #define PHYS_AIRSTRAFEACCEL_QW(s) STAT(MOVEVARS_AIRSTRAFEACCEL_QW, s) - #define PHYS_AIRSTRAFEACCELERATE(s) getstatf(STAT_MOVEVARS_AIRSTRAFEACCELERATE) - #define PHYS_ENTGRAVITY(s) STAT(MOVEVARS_ENTGRAVITY) - #define PHYS_FRICTION getstatf(STAT_MOVEVARS_FRICTION) - #define PHYS_FRICTION_SLICK STAT(MOVEVARS_FRICTION_SLICK) - #define PHYS_FRICTION_ONLAND STAT(MOVEVARS_FRICTION_ONLAND) - #define PHYS_GRAVITY STAT(MOVEVARS_GRAVITY) - #define PHYS_HIGHSPEED STAT(MOVEVARS_HIGHSPEED) - #define PHYS_JUMPVELOCITY getstatf(STAT_MOVEVARS_JUMPVELOCITY) - #define PHYS_MAXAIRSPEED(s) getstatf(STAT_MOVEVARS_MAXAIRSPEED) - #define PHYS_MAXAIRSTRAFESPEED getstatf(STAT_MOVEVARS_MAXAIRSTRAFESPEED) - #define PHYS_MAXSPEED(s) getstatf(STAT_MOVEVARS_MAXSPEED) - #define PHYS_STEPHEIGHT STAT(MOVEVARS_STEPHEIGHT) - #define PHYS_STOPSPEED getstatf(STAT_MOVEVARS_STOPSPEED) - #define PHYS_WARSOWBUNNY_ACCEL getstatf(STAT_MOVEVARS_WARSOWBUNNY_ACCEL) - #define PHYS_WARSOWBUNNY_BACKTOSIDERATIO getstatf(STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO) - #define PHYS_WARSOWBUNNY_AIRFORWARDACCEL getstatf(STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL) - #define PHYS_WARSOWBUNNY_TOPSPEED getstatf(STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED) - #define PHYS_WARSOWBUNNY_TURNACCEL getstatf(STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL) - - #define PHYS_WALLFRICTION STAT(MOVEVARS_WALLFRICTION) - - #define PHYS_JETPACK_ACCEL_UP STAT(JETPACK_ACCEL_UP) - #define PHYS_JETPACK_ACCEL_SIDE STAT(JETPACK_ACCEL_SIDE) - #define PHYS_JETPACK_ANTIGRAVITY STAT(JETPACK_ANTIGRAVITY) - #define PHYS_JETPACK_FUEL STAT(JETPACK_FUEL) - #define PHYS_JETPACK_MAXSPEED_UP STAT(JETPACK_MAXSPEED_UP) - #define PHYS_JETPACK_MAXSPEED_SIDE STAT(JETPACK_MAXSPEED_SIDE) - - #define PHYS_DODGING_FROZEN STAT(DODGING_FROZEN) - - #define PHYS_NOSTEP STAT(NOSTEP) - #define PHYS_JUMPSTEP STAT(MOVEVARS_JUMPSTEP) + + #define PHYS_CL_TRACK_CANJUMP(s) STAT(MOVEVARS_CL_TRACK_CANJUMP, s) + // FIXME: 0 doesn't mean zero gravity + #define PHYS_ENTGRAVITY(s) STAT(MOVEVARS_ENTGRAVITY, s) #elif defined(SVQC) @@ -177,75 +193,16 @@ bool IsFlying(entity a); .vector stat_pl_view_ofs; .vector stat_pl_crouch_view_ofs; - .vector stat_pl_min; - .vector stat_pl_max; - .vector stat_pl_crouch_min; - .vector stat_pl_crouch_max; + .vector stat_pl_min, stat_pl_max; + .vector stat_pl_crouch_min, stat_pl_crouch_max; - .float stat_sv_airaccel_qw; .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW); - .float stat_sv_maxspeed; - .float stat_movement_highspeed = _STAT(MOVEVARS_HIGHSPEED); - - .float stat_sv_friction_on_land = _STAT(MOVEVARS_FRICTION_ONLAND); - .float stat_sv_friction_slick = _STAT(MOVEVARS_FRICTION_SLICK); - - .float stat_doublejump = _STAT(DOUBLEJUMP); - - .string stat_jumpspeedcap_min; - .string stat_jumpspeedcap_max; - .float stat_jumpspeedcap_disable_onramps = _STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS); - - .float stat_jetpack_accel_side = _STAT(JETPACK_ACCEL_SIDE); - .float stat_jetpack_accel_up = _STAT(JETPACK_ACCEL_UP); - .float stat_jetpack_antigravity = _STAT(JETPACK_ANTIGRAVITY); - .float stat_jetpack_fuel = _STAT(JETPACK_FUEL); - .float stat_jetpack_maxspeed_up = _STAT(JETPACK_MAXSPEED_UP); - .float stat_jetpack_maxspeed_side = _STAT(JETPACK_MAXSPEED_SIDE); - .float stat_gameplayfix_easierwaterjump = _STAT(GAMEPLAYFIX_EASIERWATERJUMP); - .float stat_gameplayfix_downtracesupportsongroundflag = _STAT(GAMEPLAYFIX_DOWNTRACEONGROUND); - .float stat_gameplayfix_stepmultipletimes = _STAT(GAMEPLAYFIX_STEPMULTIPLETIMES); - .float stat_gameplayfix_unstickplayers = _STAT(GAMEPLAYFIX_UNSTICKPLAYERS); - .float stat_gameplayfix_stepdown = _STAT(GAMEPLAYFIX_STEPDOWN); - - .float stat_bugrigs = _STAT(BUGRIGS); - .float stat_bugrigs_angle_smoothing = _STAT(BUGRIGS_ANGLE_SMOOTHING); - .float stat_bugrigs_planar_movement = _STAT(BUGRIGS_PLANAR_MOVEMENT); - .float stat_bugrigs_reverse_speeding = _STAT(BUGRIGS_REVERSE_SPEEDING); - .float stat_bugrigs_friction_floor = _STAT(BUGRIGS_FRICTION_FLOOR); - .float stat_bugrigs_air_steering = _STAT(BUGRIGS_AIR_STEERING); - .float stat_bugrigs_friction_brake = _STAT(BUGRIGS_FRICTION_BRAKE); - .float stat_bugrigs_accel = _STAT(BUGRIGS_ACCEL); - .float stat_bugrigs_speed_ref = _STAT(BUGRIGS_SPEED_REF); - .float stat_bugrigs_speed_pow = _STAT(BUGRIGS_SPEED_POW); - .float stat_bugrigs_steer = _STAT(BUGRIGS_STEER); - .float stat_bugrigs_friction_air = _STAT(BUGRIGS_FRICTION_AIR); - .float stat_bugrigs_car_jumping = _STAT(BUGRIGS_CAR_JUMPING); - .float stat_bugrigs_reverse_spinning = _STAT(BUGRIGS_REVERSE_SPINNING); - .float stat_bugrigs_reverse_stopping = _STAT(BUGRIGS_REVERSE_STOPPING); - - // new properties - .float stat_sv_jumpvelocity; - .float stat_sv_maxairstrafespeed; - .float stat_sv_maxairspeed; - .float stat_sv_airstrafeaccelerate; - .float stat_sv_warsowbunny_turnaccel; - .float stat_sv_airaccel_sideways_friction; - .float stat_sv_aircontrol; - .float stat_sv_warsowbunny_airforwardaccel; - .float stat_sv_warsowbunny_topspeed; - .float stat_sv_warsowbunny_accel; - .float stat_sv_warsowbunny_backtosideratio; - .float stat_sv_friction; - .float stat_sv_accelerate; - .float stat_sv_stopspeed; - .float stat_sv_airaccelerate; - .float stat_sv_airstopaccelerate; - - .float stat_nostep = _STAT(NOSTEP); - .float stat_jumpstep = _STAT(MOVEVARS_JUMPSTEP); - - .bool stat_sv_track_canjump = _STAT(MOVEVARS_TRACK_CANJUMP); + .float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED); + + /** Not real stats */ + .string stat_jumpspeedcap_min, stat_jumpspeedcap_max; + + #define TICRATE sys_frametime #define PHYS_INPUT_ANGLES(s) s.v_angle #define PHYS_WORLD_ANGLES(s) s.angles @@ -272,13 +229,8 @@ bool IsFlying(entity a); #define PHYS_DEAD(s) s.deadflag != DEAD_NO #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE autocvar_sv_gameplayfix_gravityunaffectedbyticrate - #define GAMEPLAYFIX_NOGRAVITYONGROUND cvar("sv_gameplayfix_nogravityonground") + #define GAMEPLAYFIX_NOGRAVITYONGROUND autocvar_sv_gameplayfix_nogravityonground #define GAMEPLAYFIX_Q2AIRACCELERATE autocvar_sv_gameplayfix_q2airaccelerate - #define GAMEPLAYFIX_EASIERWATERJUMP cvar("sv_gameplayfix_easierwaterjump") - #define GAMEPLAYFIX_DOWNTRACEONGROUND cvar("sv_gameplayfix_downtracesupportsongroundflag") - #define GAMEPLAYFIX_STEPMULTIPLETIMES cvar("sv_gameplayfix_stepmultipletimes") - #define GAMEPLAYFIX_UNSTICKPLAYERS cvar("sv_gameplayfix_unstickplayers") - #define GAMEPLAYFIX_STEPDOWN cvar("sv_gameplayfix_stepdown") #define IS_DUCKED(s) s.crouch #define SET_DUCKED(s) s.crouch = true @@ -295,77 +247,12 @@ bool IsFlying(entity a); #define WAS_ONGROUND(s) !!((s).lastflags & FL_ONGROUND) #define ITEMS_STAT(s) s.items - #define BUFFS_STAT(s) (s).buffs - - #define PHYS_FROZEN(s) s.frozen - - #define PHYS_DOUBLEJUMP autocvar_sv_doublejump - - #define PHYS_BUGRIGS g_bugrigs - #define PHYS_BUGRIGS_ANGLE_SMOOTHING g_bugrigs_angle_smoothing - #define PHYS_BUGRIGS_PLANAR_MOVEMENT g_bugrigs_planar_movement - #define PHYS_BUGRIGS_REVERSE_SPEEDING g_bugrigs_reverse_speeding - #define PHYS_BUGRIGS_FRICTION_FLOOR g_bugrigs_friction_floor - #define PHYS_BUGRIGS_AIR_STEERING g_bugrigs_air_steering - #define PHYS_BUGRIGS_FRICTION_BRAKE g_bugrigs_friction_brake - #define PHYS_BUGRIGS_ACCEL g_bugrigs_accel - #define PHYS_BUGRIGS_SPEED_REF g_bugrigs_speed_ref - #define PHYS_BUGRIGS_SPEED_POW g_bugrigs_speed_pow - #define PHYS_BUGRIGS_STEER g_bugrigs_steer - #define PHYS_BUGRIGS_FRICTION_AIR g_bugrigs_friction_air - #define PHYS_BUGRIGS_CAR_JUMPING g_bugrigs_planar_movement_car_jumping - #define PHYS_BUGRIGS_REVERSE_SPINNING g_bugrigs_reverse_spinning - #define PHYS_BUGRIGS_REVERSE_STOPPING g_bugrigs_reverse_stopping #define PHYS_JUMPSPEEDCAP_MIN autocvar_sv_jumpspeedcap_min #define PHYS_JUMPSPEEDCAP_MAX autocvar_sv_jumpspeedcap_max - #define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS autocvar_sv_jumpspeedcap_max_disable_on_ramps #define PHYS_CL_TRACK_CANJUMP(s) s.cvar_cl_movement_track_canjump - #define PHYS_TRACK_CANJUMP(s) s.stat_sv_track_canjump - #define PHYS_ACCELERATE self.stat_sv_accelerate - #define PHYS_AIRACCEL_QW(s) s.stat_sv_airaccel_qw - #define PHYS_AIRACCEL_QW_STRETCHFACTOR(s) STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, s) - #define PHYS_AIRACCEL_SIDEWAYS_FRICTION self.stat_sv_airaccel_sideways_friction - #define PHYS_AIRACCELERATE self.stat_sv_airaccelerate - #define PHYS_AIRCONTROL self.stat_sv_aircontrol - #define PHYS_AIRCONTROL_PENALTY STAT(MOVEVARS_AIRCONTROL_PENALTY, self) - #define PHYS_AIRCONTROL_POWER STAT(MOVEVARS_AIRCONTROL_POWER, self) - #define PHYS_AIRSPEEDLIMIT_NONQW(s) STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, s) - #define PHYS_AIRSTOPACCELERATE self.stat_sv_airstopaccelerate - #define PHYS_AIRSTRAFEACCEL_QW(s) STAT(MOVEVARS_AIRSTRAFEACCEL_QW, s) - #define PHYS_AIRSTRAFEACCELERATE(s) s.stat_sv_airstrafeaccelerate #define PHYS_ENTGRAVITY(s) s.gravity - #define PHYS_FRICTION self.stat_sv_friction - #define PHYS_FRICTION_SLICK autocvar_sv_friction_slick - #define PHYS_FRICTION_ONLAND autocvar_sv_friction_on_land - #define PHYS_GRAVITY autocvar_sv_gravity - #define PHYS_HIGHSPEED autocvar_g_movement_highspeed - #define PHYS_JUMPVELOCITY self.stat_sv_jumpvelocity - #define PHYS_MAXAIRSPEED(s) self.stat_sv_maxairspeed - #define PHYS_MAXAIRSTRAFESPEED self.stat_sv_maxairstrafespeed - #define PHYS_MAXSPEED(s) s.stat_sv_maxspeed - #define PHYS_STEPHEIGHT autocvar_sv_stepheight - #define PHYS_STOPSPEED self.stat_sv_stopspeed - #define PHYS_WARSOWBUNNY_ACCEL self.stat_sv_warsowbunny_accel - #define PHYS_WARSOWBUNNY_BACKTOSIDERATIO self.stat_sv_warsowbunny_backtosideratio - #define PHYS_WARSOWBUNNY_AIRFORWARDACCEL self.stat_sv_warsowbunny_airforwardaccel - #define PHYS_WARSOWBUNNY_TOPSPEED self.stat_sv_warsowbunny_topspeed - #define PHYS_WARSOWBUNNY_TURNACCEL self.stat_sv_warsowbunny_turnaccel - - #define PHYS_WALLFRICTION cvar("sv_wallfriction") - - #define PHYS_JETPACK_ACCEL_UP autocvar_g_jetpack_acceleration_up - #define PHYS_JETPACK_ACCEL_SIDE autocvar_g_jetpack_acceleration_side - #define PHYS_JETPACK_ANTIGRAVITY autocvar_g_jetpack_antigravity - #define PHYS_JETPACK_FUEL autocvar_g_jetpack_fuel - #define PHYS_JETPACK_MAXSPEED_UP autocvar_g_jetpack_maxspeed_up - #define PHYS_JETPACK_MAXSPEED_SIDE autocvar_g_jetpack_maxspeed_side - - #define PHYS_DODGING_FROZEN autocvar_sv_dodging_frozen - - #define PHYS_NOSTEP cvar("sv_nostep") - #define PHYS_JUMPSTEP cvar("sv_jumpstep") #endif #endif diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e8c05c718..2e28b0c1a 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -53,7 +53,7 @@ enum { STAT_LAST_VECTOR }; -const int REGISTERED_STATS = 121; +const int REGISTERED_STATS = 139; REGISTER_STAT(KH_KEYS, int) /** weapon requested to switch to; next WANTED weapon (for HUD) */ @@ -114,59 +114,109 @@ REGISTER_STAT(REVIVE_PROGRESS, float) REGISTER_STAT(ROUNDLOST, int) REGISTER_STAT(BUFF_TIME, float) REGISTER_STAT(CTF_FLAGSTATUS, int) -REGISTER_STAT(MULTIJUMP_DODGING, int) -REGISTER_STAT(MULTIJUMP_MAXSPEED, float) -REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int) -REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int) -REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int) -REGISTER_STAT(BUGRIGS_CAR_JUMPING, int) -REGISTER_STAT(BUGRIGS_FRICTION_AIR, float) -REGISTER_STAT(BUGRIGS_STEER, float) -REGISTER_STAT(BUGRIGS_SPEED_POW, float) -REGISTER_STAT(BUGRIGS_SPEED_REF, float) -REGISTER_STAT(BUGRIGS_ACCEL, float) -REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float) -REGISTER_STAT(BUGRIGS_AIR_STEERING, int) -REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float) -REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int) -REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int) -REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int) -REGISTER_STAT(BUGRIGS, int) -REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int) -REGISTER_STAT(MOVEVARS_JUMPSTEP, int) -REGISTER_STAT(NOSTEP, int) -REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int) -REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int) -REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int) -REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int) -REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float) -REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float) -REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int) + +#ifdef SVQC +int autocvar_g_multijump; +float autocvar_g_multijump_add; +float autocvar_g_multijump_speed; +float autocvar_g_multijump_maxspeed; +float autocvar_g_multijump_dodging = 1; +#endif +REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging) +REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed) +REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add) +REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed) +REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump) +REGISTER_STAT(DOUBLEJUMP, int, autocvar_sv_doublejump) + +#ifdef SVQC +float g_bugrigs; +float g_bugrigs_planar_movement; +float g_bugrigs_planar_movement_car_jumping; +float g_bugrigs_reverse_spinning; +float g_bugrigs_reverse_speeding; +float g_bugrigs_reverse_stopping; +float g_bugrigs_air_steering; +float g_bugrigs_angle_smoothing; +float g_bugrigs_friction_floor; +float g_bugrigs_friction_brake; +float g_bugrigs_friction_air; +float g_bugrigs_accel; +float g_bugrigs_speed_ref; +float g_bugrigs_speed_pow; +float g_bugrigs_steer; +#endif +REGISTER_STAT(BUGRIGS, int, g_bugrigs) +REGISTER_STAT(BUGRIGS_ACCEL, float, g_bugrigs_accel) +REGISTER_STAT(BUGRIGS_AIR_STEERING, int, g_bugrigs_air_steering) +REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int, g_bugrigs_angle_smoothing) +REGISTER_STAT(BUGRIGS_CAR_JUMPING, int, g_bugrigs_planar_movement_car_jumping) +REGISTER_STAT(BUGRIGS_FRICTION_AIR, float, g_bugrigs_friction_air) +REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float, g_bugrigs_friction_brake) +REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float, g_bugrigs_friction_floor) +REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int, g_bugrigs_planar_movement) +REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int, g_bugrigs_reverse_speeding) +REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int, g_bugrigs_reverse_spinning) +REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int, g_bugrigs_reverse_stopping) +REGISTER_STAT(BUGRIGS_SPEED_POW, float, g_bugrigs_speed_pow) +REGISTER_STAT(BUGRIGS_SPEED_REF, float, g_bugrigs_speed_ref) +REGISTER_STAT(BUGRIGS_STEER, float, g_bugrigs_steer) + +REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, cvar("sv_gameplayfix_downtracesupportsongroundflag")) +REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, cvar("sv_gameplayfix_easierwaterjump")) +REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int, cvar("sv_gameplayfix_stepdown")) +REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int, cvar("sv_gameplayfix_stepmultipletimes")) +REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, cvar("sv_gameplayfix_unstickplayers")) +REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag) + +REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep")) +REGISTER_STAT(NOSTEP, int, cvar("sv_nostep")) + +REGISTER_STAT(MOVEVARS_FRICTION, float) +REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float, autocvar_sv_friction_slick) +REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float, autocvar_sv_friction_on_land) + +REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int, autocvar_sv_jumpspeedcap_max_disable_on_ramps) REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int) -REGISTER_STAT(DOUBLEJUMP, int) +/** cvar loopback */ REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int) -REGISTER_STAT(MULTIJUMP_ADD, int) -REGISTER_STAT(MULTIJUMP_SPEED, float) -REGISTER_STAT(MULTIJUMP, int) + +#ifdef SVQC +int g_dodging; +float autocvar_sv_dodging_delay; +float autocvar_sv_dodging_wall_distance_threshold; +bool autocvar_sv_dodging_frozen; +bool autocvar_sv_dodging_frozen_doubletap; +float autocvar_sv_dodging_height_threshold; +float autocvar_sv_dodging_horiz_speed; +float autocvar_sv_dodging_horiz_speed_frozen; +float autocvar_sv_dodging_ramp_time; +float autocvar_sv_dodging_up_speed; +bool autocvar_sv_dodging_wall_dodging; +#endif + +REGISTER_STAT(DODGING, int, g_dodging) +REGISTER_STAT(DODGING_DELAY, float, autocvar_sv_dodging_delay) +REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float, autocvar_sv_dodging_wall_distance_threshold) +REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen) +REGISTER_STAT(DODGING_FROZEN_NO_DOUBLETAP, int, autocvar_sv_dodging_frozen_doubletap) +REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float, autocvar_sv_dodging_height_threshold) +REGISTER_STAT(DODGING_HORIZ_SPEED, float, autocvar_sv_dodging_horiz_speed) +REGISTER_STAT(DODGING_HORIZ_SPEED_FROZEN, float, autocvar_sv_dodging_horiz_speed_frozen) +REGISTER_STAT(DODGING_RAMP_TIME, float, autocvar_sv_dodging_ramp_time) +/** cvar loopback */ REGISTER_STAT(DODGING_TIMEOUT, float) -REGISTER_STAT(DODGING_WALL, int) -REGISTER_STAT(DODGING_UP_SPEED, float) -REGISTER_STAT(DODGING_RAMP_TIME, float) -REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float) -REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float) -REGISTER_STAT(DODGING_HORIZ_SPEED, float) -REGISTER_STAT(DODGING_DELAY, float) -REGISTER_STAT(DODGING_FROZEN_NO_DOUBLETAP, int) -REGISTER_STAT(DODGING_HORIZ_SPEED_FROZEN, float) -REGISTER_STAT(DODGING, int) -REGISTER_STAT(DODGING_FROZEN, int) -REGISTER_STAT(JETPACK_MAXSPEED_UP, float) -REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float) -REGISTER_STAT(JETPACK_FUEL, float) -REGISTER_STAT(JETPACK_ANTIGRAVITY, float) -REGISTER_STAT(JETPACK_ACCEL_SIDE, float) -REGISTER_STAT(JETPACK_ACCEL_UP, float) -REGISTER_STAT(MOVEVARS_HIGHSPEED, float) +REGISTER_STAT(DODGING_UP_SPEED, float, autocvar_sv_dodging_up_speed) +REGISTER_STAT(DODGING_WALL, int, autocvar_sv_dodging_wall_dodging) + +REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side) +REGISTER_STAT(JETPACK_ACCEL_UP, float, autocvar_g_jetpack_acceleration_up) +REGISTER_STAT(JETPACK_ANTIGRAVITY, float, autocvar_g_jetpack_antigravity) +REGISTER_STAT(JETPACK_FUEL, float, autocvar_g_jetpack_fuel) +REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float, autocvar_g_jetpack_maxspeed_side) +REGISTER_STAT(JETPACK_MAXSPEED_UP, float, autocvar_g_jetpack_maxspeed_up) + +REGISTER_STAT(MOVEVARS_HIGHSPEED, float, autocvar_g_movement_highspeed) enum { STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS, @@ -216,11 +266,7 @@ enum { ASSERT_LESS(stat_limit, STAT_LAST, 220) #ifdef SVQC -void GlobalStats_update(entity e) {} -#define STAT_GLOBAL(T, x, expr) REGISTER_STAT(x, T); [[accumulate]] void GlobalStats_update(entity e) { STAT(x, e) = (expr); } #include "movetypes/movetypes.qh" -#else -#define STAT_GLOBAL(T, x, expr) REGISTER_STAT(x, T) #endif REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float) @@ -229,36 +275,40 @@ REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float) REGISTER_STAT(MOVEVARS_AIRSTRAFEACCEL_QW, float) REGISTER_STAT(MOVEVARS_AIRCONTROL_POWER, float) noref bool autocvar_sv_gameplayfix_nogravityonground; -STAT_GLOBAL(int, MOVEFLAGS, MOVEFLAG_VALID - | (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0) - | (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0) - | (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0)) -const int STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL = 226; -const int STAT_MOVEVARS_WARSOWBUNNY_ACCEL = 227; -const int STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED = 228; -const int STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL = 229; -const int STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO = 230; -const int STAT_MOVEVARS_AIRSTOPACCELERATE = 231; -const int STAT_MOVEVARS_AIRSTRAFEACCELERATE = 232; -const int STAT_MOVEVARS_MAXAIRSTRAFESPEED = 233; -const int STAT_MOVEVARS_AIRCONTROL = 234; -STAT_GLOBAL(float, FRAGLIMIT, autocvar_fraglimit) -STAT_GLOBAL(float, TIMELIMIT, autocvar_timelimit) -noref float autocvar_sv_wallfriction; -STAT_GLOBAL(int, MOVEVARS_WALLFRICTION, autocvar_sv_wallfriction) -const int STAT_MOVEVARS_FRICTION = 238; -STAT_GLOBAL(float, MOVEVARS_TICRATE, autocvar_sys_ticrate) -STAT_GLOBAL(float, MOVEVARS_TIMESCALE, autocvar_slowmo) -STAT_GLOBAL(float, MOVEVARS_GRAVITY, autocvar_sv_gravity) -const int STAT_MOVEVARS_STOPSPEED = 243; -const int STAT_MOVEVARS_MAXSPEED = 244; -const int STAT_MOVEVARS_ACCELERATE = 246; -const int STAT_MOVEVARS_AIRACCELERATE = 247; +REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID + | (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0) + | (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0) + | (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0)) + +REGISTER_STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, float) +REGISTER_STAT(MOVEVARS_WARSOWBUNNY_ACCEL, float) +REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, float) +REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, float) +REGISTER_STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, float) + +REGISTER_STAT(MOVEVARS_AIRSTOPACCELERATE, float) +REGISTER_STAT(MOVEVARS_AIRSTRAFEACCELERATE, float) +REGISTER_STAT(MOVEVARS_MAXAIRSTRAFESPEED, float) +REGISTER_STAT(MOVEVARS_AIRCONTROL, float) +REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit) +REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit) +#ifdef SVQC +float autocvar_sv_wallfriction; +#endif +REGISTER_STAT(MOVEVARS_WALLFRICTION, int, autocvar_sv_wallfriction) +REGISTER_STAT(MOVEVARS_TICRATE, float, autocvar_sys_ticrate) +REGISTER_STAT(MOVEVARS_TIMESCALE, float, autocvar_slowmo) +REGISTER_STAT(MOVEVARS_GRAVITY, float, autocvar_sv_gravity) +REGISTER_STAT(MOVEVARS_STOPSPEED, float) +REGISTER_STAT(MOVEVARS_MAXSPEED, float) +REGISTER_STAT(MOVEVARS_ACCELERATE, float) +REGISTER_STAT(MOVEVARS_AIRACCELERATE, float) .float gravity; -STAT_GLOBAL(float, MOVEVARS_ENTGRAVITY, (e.gravity) ? e.gravity : 1) -const int STAT_MOVEVARS_JUMPVELOCITY = 250; -const int STAT_MOVEVARS_MAXAIRSPEED = 252; -STAT_GLOBAL(float, MOVEVARS_STEPHEIGHT, autocvar_sv_stepheight) -const int STAT_MOVEVARS_AIRACCEL_QW = 254; -const int STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION = 255; +// FIXME: Was 0 on server, 1 on client. Still want that? +REGISTER_STAT(MOVEVARS_ENTGRAVITY, float, (this.gravity) ? this.gravity : 1) +REGISTER_STAT(MOVEVARS_JUMPVELOCITY, float) +REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float) +REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight) +REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float) +REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float) #endif diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 0b3be0056..21c324781 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -37,7 +37,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5; - grav = PHYS_GRAVITY; + grav = PHYS_GRAVITY(other); if(PHYS_ENTGRAVITY(other)) grav *= PHYS_ENTGRAVITY(other); diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index ca42150dc..929c5902e 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -8,6 +8,7 @@ .int m_id; +#define REGISTER_STAT(...) EVAL(OVERLOAD(REGISTER_STAT, __VA_ARGS__)) #if defined(CSQC) /** Get all stats and store them as globals, access with `STAT(ID)` */ void stats_get() {} @@ -20,7 +21,7 @@ #define getstat_float(id) getstatf(id) #define _STAT(id) g_stat_##id - #define REGISTER_STAT(id, type) \ + #define REGISTER_STAT_2(id, type) \ type _STAT(id); \ REGISTER(RegisterStats, STAT, Stats, id, m_id, new(stat)) \ { \ @@ -30,6 +31,7 @@ { \ _STAT(id) = getstat_##type(STAT_##id.m_id); \ } + #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT(x, T) #elif defined(SVQC) /** Add all registered stats, access with `STAT(ID, player)` or `.type stat = _STAT(ID); player.stat` */ void stats_add() {} @@ -42,8 +44,18 @@ const int AS_INT = 2; const int AS_FLOAT = 8; + .int __stat_null; + /** Prevent engine stats being sent */ + STATIC_INIT(stats_clear) + { + int r = 32; + for (int i = 0, n = 256 - r; i < n; ++i) { + addstat(r + i, AS_INT, __stat_null); + } + } + #define _STAT(id) stat_##id - #define REGISTER_STAT(id, type) \ + #define REGISTER_STAT_2(id, type) \ .type _STAT(id); \ REGISTER(RegisterStats, STAT, Stats, id, m_id, new(stat)) \ { \ @@ -53,13 +65,16 @@ { \ addstat_##type(STAT_##id.m_id, _STAT(id)); \ } + void GlobalStats_update(entity this) {} + #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT(x, T); [[accumulate]] void GlobalStats_update(entity this) { STAT(x, this) = (expr); } #else - #define REGISTER_STAT(id, type) + #define REGISTER_STAT_2(id, type) + #define REGISTER_STAT_3(x, T, expr) #endif const int STATS_ENGINE_RESERVE = 32 + (8 * 3); // Not sure how to handle vector stats yet, reserve them too -REGISTRY(Stats, 220 - STATS_ENGINE_RESERVE) +REGISTRY(Stats, 256 - STATS_ENGINE_RESERVE) REGISTER_REGISTRY(RegisterStats) REGISTRY_SORT(Stats, 0) REGISTRY_CHECK(Stats) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 2910eb9bb..ac151c38c 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -347,7 +347,6 @@ string autocvar_sv_defaultplayermodel_pink; string autocvar_sv_defaultplayermodel_red; string autocvar_sv_defaultplayermodel_yellow; int autocvar_sv_defaultplayerskin; -bool autocvar_sv_dodging_frozen; bool autocvar_sv_doublejump; bool autocvar_sv_eventlog; bool autocvar_sv_eventlog_console; diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index ae0aa0e0a..c79add85b 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -267,22 +267,6 @@ float g_weapon_stay; float want_weapon(entity weaponinfo, float allguns); // WEAPONTODO: what still needs done? void readplayerstartcvars(); -float g_bugrigs; -float g_bugrigs_planar_movement; -float g_bugrigs_planar_movement_car_jumping; -float g_bugrigs_reverse_spinning; -float g_bugrigs_reverse_speeding; -float g_bugrigs_reverse_stopping; -float g_bugrigs_air_steering; -float g_bugrigs_angle_smoothing; -float g_bugrigs_friction_floor; -float g_bugrigs_friction_brake; -float g_bugrigs_friction_air; -float g_bugrigs_accel; -float g_bugrigs_speed_ref; -float g_bugrigs_speed_pow; -float g_bugrigs_steer; - float sv_autotaunt; float sv_taunt;