From: TimePath Date: Tue, 24 Nov 2015 11:42:29 +0000 (+1100) Subject: Stats: port 5 more X-Git-Tag: xonotic-v0.8.2~1609^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a00a3308f640b97e49094aa74024aca385aed5c2;p=xonotic%2Fxonotic-data.pk3dir.git Stats: port 5 more --- diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 755fc0aca..cbe41948d 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -55,10 +55,8 @@ void Physics_AddStats() addstat(STAT_PL_CROUCH_MAX3, AS_FLOAT, stat_pl_crouch_max_z); // g_movementspeed hack - addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed); addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); - addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw); addstat(STAT_MOVEVARS_HIGHSPEED, AS_FLOAT, stat_movement_highspeed); // jet pack @@ -86,15 +84,12 @@ void Physics_AddStats() // new properties addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_sv_jumpvelocity); - addstat(STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, AS_FLOAT, stat_sv_airaccel_qw_stretchfactor); 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_AIRCONTROL_POWER, AS_FLOAT, stat_sv_aircontrol_power); - addstat(STAT_MOVEVARS_AIRCONTROL_PENALTY, AS_FLOAT, stat_sv_aircontrol_penalty); 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); @@ -121,11 +116,10 @@ void Physics_UpdateStats(float maxspd_mod) self.stat_sv_airaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airaccel_qw"), maxspd_mod); - if(Physics_ClientOption(self, "airstrafeaccel_qw")) - self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airstrafeaccel_qw"), maxspd_mod); - else - self.stat_sv_airstrafeaccel_qw = 0; - self.stat_sv_airspeedlimit_nonqw = Physics_ClientOption(self, "airspeedlimit_nonqw") * maxspd_mod; + STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(self, "airstrafeaccel_qw")) + ? AdjustAirAccelQW(Physics_ClientOption(self, "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 self.stat_movement_highspeed = PHYS_HIGHSPEED; // TODO: remove this! @@ -148,15 +142,15 @@ void Physics_UpdateStats(float maxspd_mod) // old stats // fix some new settings - self.stat_sv_airaccel_qw_stretchfactor = Physics_ClientOption(self, "airaccel_qw_stretchfactor"); + 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"); - self.stat_sv_aircontrol_power = Physics_ClientOption(self, "aircontrol_power"); - self.stat_sv_aircontrol_penalty = Physics_ClientOption(self, "aircontrol_penalty"); + 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"); diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index 124518a58..344c0f173 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -128,15 +128,15 @@ bool IsFlying(entity a); #define PHYS_TRACK_CANJUMP(s) getstati(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) getstatf(STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR) + #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 getstatf(STAT_MOVEVARS_AIRCONTROL_PENALTY) - #define PHYS_AIRCONTROL_POWER getstatf(STAT_MOVEVARS_AIRCONTROL_POWER) - #define PHYS_AIRSPEEDLIMIT_NONQW(s) getstatf(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW) + #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) getstatf(STAT_MOVEVARS_AIRSTRAFEACCEL_QW) + #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) @@ -183,8 +183,7 @@ bool IsFlying(entity a); .vector stat_pl_crouch_max; .float stat_sv_airaccel_qw; - .float stat_sv_airstrafeaccel_qw; - .float stat_sv_airspeedlimit_nonqw; + .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW); .float stat_sv_maxspeed; .float stat_movement_highspeed; @@ -227,15 +226,12 @@ bool IsFlying(entity a); // new properties .float stat_sv_jumpvelocity; - .float stat_sv_airaccel_qw_stretchfactor; .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_aircontrol_power; - .float stat_sv_aircontrol_penalty; .float stat_sv_warsowbunny_airforwardaccel; .float stat_sv_warsowbunny_topspeed; .float stat_sv_warsowbunny_accel; @@ -329,15 +325,15 @@ bool IsFlying(entity a); #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) self.stat_sv_airaccel_qw_stretchfactor + #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 self.stat_sv_aircontrol_penalty - #define PHYS_AIRCONTROL_POWER self.stat_sv_aircontrol_power - #define PHYS_AIRSPEEDLIMIT_NONQW(s) s.stat_sv_airspeedlimit_nonqw + #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) s.stat_sv_airstrafeaccel_qw + #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 diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index b893feae7..afd6bd3c3 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -53,7 +53,7 @@ enum { STAT_LAST_VECTOR }; -const int REGISTERED_STATS = 59; +const int REGISTERED_STATS = 64; REGISTER_STAT(KH_KEYS, int) /** weapon requested to switch to; next WANTED weapon (for HUD) */ @@ -224,11 +224,11 @@ void GlobalStats_update(entity e) {} #define STAT_GLOBAL(T, x, expr) REGISTER_STAT(x, T) #endif -const int STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR = 220; -const int STAT_MOVEVARS_AIRCONTROL_PENALTY = 221; -const int STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222; -const int STAT_MOVEVARS_AIRSTRAFEACCEL_QW = 223; -const int STAT_MOVEVARS_AIRCONTROL_POWER = 224; +REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float) +REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float) +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) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index aebbf77c0..5b5bd90cf 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -765,27 +765,6 @@ spawnfunc(worldspawn) // physics Physics_AddStats(); - // new properties - addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_sv_jumpvelocity); - addstat(STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, AS_FLOAT, stat_sv_airaccel_qw_stretchfactor); - 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_AIRCONTROL_POWER, AS_FLOAT, stat_sv_aircontrol_power); - addstat(STAT_MOVEVARS_AIRCONTROL_PENALTY, AS_FLOAT, stat_sv_aircontrol_penalty); - 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); - next_pingtime = time + 5; detect_maptype();