From: Mario Date: Sun, 29 Nov 2015 03:49:04 +0000 (+1000) Subject: This commit is dedicated to TimePath X-Git-Tag: xonotic-v0.8.2~1609^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bda4e58210275f23266f9a1231de949b6bc64893;p=xonotic%2Fxonotic-data.pk3dir.git This commit is dedicated to TimePath # Conflicts: # qcsrc/common/movetypes/movetypes.qc # qcsrc/common/movetypes/toss.qc # qcsrc/common/mutators/mutator/dodging/dodging.qc # qcsrc/common/mutators/mutator/multijump/multijump.qc # qcsrc/common/physics.qc # qcsrc/common/physics.qh # qcsrc/common/stats.qh # qcsrc/server/autocvars.qh --- bda4e58210275f23266f9a1231de949b6bc64893 diff --cc qcsrc/common/movetypes/movetypes.qc index fb49f93fa,6cf3969e6..dd7a4572f --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@@ -44,15 -44,15 +44,15 @@@ int _Movetype_FlyMove(entity this, floa if(applygravity) { - self.move_didgravity = 1; - grav = dt * (PHYS_ENTGRAVITY(self) ? PHYS_ENTGRAVITY(self) : 1) * PHYS_GRAVITY(this); + this.move_didgravity = 1; - grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY; ++ grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY(this); - if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(self.move_flags & FL_ONGROUND)) + if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.move_flags & FL_ONGROUND)) { - if(GRAVITY_UNAFFECTED_BY_TICRATE) + if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.move_velocity_z -= grav * 0.5; + this.move_velocity_z -= grav * 0.5; else - self.move_velocity_z -= grav; + this.move_velocity_z -= grav; } } @@@ -232,10 -232,10 +232,10 @@@ if(applygravity) { - if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(self.move_flags & FL_ONGROUND)) + if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.move_flags & FL_ONGROUND)) { - if(GRAVITY_UNAFFECTED_BY_TICRATE) + if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.move_velocity_z -= grav * 0.5f; + this.move_velocity_z -= grav * 0.5f; } } @@@ -634,36 -632,36 +632,36 @@@ void Movetype_Physics_MatchTicrate(enti return; } - self.avelocity = self.move_avelocity; + this.avelocity = this.move_avelocity; - if(dt > 0 && self.move_movetype != MOVETYPE_NONE && !(self.move_flags & FL_ONGROUND)) + if(dt > 0 && this.move_movetype != MOVETYPE_NONE && !(this.move_flags & FL_ONGROUND)) { // now continue the move from move_time to time - self.velocity = self.move_velocity; + this.velocity = this.move_velocity; - if(self.move_didgravity > 0) + if(this.move_didgravity > 0) { - self.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) - this.velocity_z -= (GRAVITY_UNAFFECTED_BY_TICRATE ? 0.5 : 1) ++ this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) * dt - * (self.gravity ? self.gravity : 1) + * (this.gravity ? this.gravity : 1) - * PHYS_GRAVITY; + * PHYS_GRAVITY(this); } - self.angles = self.move_angles + dt * self.avelocity; + this.angles = this.move_angles + dt * this.avelocity; - if(sloppy || self.move_movetype == MOVETYPE_NOCLIP) + if(sloppy || this.move_movetype == MOVETYPE_NOCLIP) { - setorigin(self, self.move_origin + dt * self.velocity); + setorigin(this, this.move_origin + dt * this.velocity); } else { - _Movetype_PushEntityTrace(dt * self.velocity); + _Movetype_PushEntityTrace(this, dt * this.velocity); if(!trace_startsolid) - setorigin(self, trace_endpos); + setorigin(this, trace_endpos); } - if(self.move_didgravity > 0 && GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.velocity_z -= 0.5 * dt * (self.gravity ? self.gravity : 1) * PHYS_GRAVITY(this); - if(this.move_didgravity > 0 && GRAVITY_UNAFFECTED_BY_TICRATE) - this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY; ++ if(this.move_didgravity > 0 && GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) ++ this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this); } else { diff --cc qcsrc/common/movetypes/toss.qc index 6f18fbf2a,06302090f..51d6b6e13 --- a/qcsrc/common/movetypes/toss.qc +++ b/qcsrc/common/movetypes/toss.qc @@@ -19,20 -19,20 +19,20 @@@ void _Movetype_Physics_Toss(entity this } } - self.move_suspendedinair = false; + this.move_suspendedinair = false; - _Movetype_CheckVelocity(); + _Movetype_CheckVelocity(this); - if (self.move_movetype == MOVETYPE_BOUNCE || self.move_movetype == MOVETYPE_TOSS) + if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS) { - self.move_didgravity = 1; - self.move_velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) + this.move_didgravity = 1; - this.move_velocity_z -= (GRAVITY_UNAFFECTED_BY_TICRATE ? 0.5 : 1) ++ this.move_velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1) * dt - * (self.gravity ? self.gravity : 1) + * (this.gravity ? this.gravity : 1) - * PHYS_GRAVITY; + * PHYS_GRAVITY(this); } - self.move_angles = self.move_angles + self.move_avelocity * dt; + this.move_angles = this.move_angles + this.move_avelocity * dt; float movetime = dt; for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; ++bump) @@@ -55,26 -55,26 +55,26 @@@ movetime *= 1 - min(1, trace_fraction); - if (self.move_movetype == MOVETYPE_BOUNCEMISSILE) + if (this.move_movetype == MOVETYPE_BOUNCEMISSILE) { - self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 2.0); - self.move_flags &= ~FL_ONGROUND; + this.move_velocity = _Movetype_ClipVelocity(this.move_velocity, trace_plane_normal, 2.0); + this.move_flags &= ~FL_ONGROUND; } - else if (self.move_movetype == MOVETYPE_BOUNCE) + else if (this.move_movetype == MOVETYPE_BOUNCE) { - 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(this); + float bouncefac = this.move_bounce_factor; if (!bouncefac) bouncefac = 0.5; + float bouncestop = this.move_bounce_stopspeed; if (!bouncestop) bouncestop = 60 / 800; - bouncestop *= (this.gravity ? this.gravity : 1) * PHYS_GRAVITY; ++ bouncestop *= (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this); - self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1 + bouncefac); + this.move_velocity = _Movetype_ClipVelocity(this.move_velocity, trace_plane_normal, 1 + bouncefac); - float d = trace_plane_normal * self.move_velocity; + float d = trace_plane_normal * this.move_velocity; if (trace_plane_normal.z > 0.7 && d < bouncestop && d > -bouncestop) { - self.move_flags |= FL_ONGROUND; - self.move_groundentity = trace_ent; - self.move_velocity = '0 0 0'; - self.move_avelocity = '0 0 0'; + this.move_flags |= FL_ONGROUND; + this.move_groundentity = trace_ent; + this.move_velocity = '0 0 0'; + this.move_avelocity = '0 0 0'; } else { @@@ -108,8 -108,8 +108,8 @@@ break; } - 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); - if (GRAVITY_UNAFFECTED_BY_TICRATE && this.move_didgravity > 0 && !(this.move_flags & FL_ONGROUND)) - this.move_velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY; ++ if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !(this.move_flags & FL_ONGROUND)) ++ this.move_velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this); - _Movetype_CheckWaterTransition(self); + _Movetype_CheckWaterTransition(this); } diff --cc qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc index 000000000,9eb16b040..194341383 mode 000000,100644..100644 --- a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc +++ b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc @@@ -1,0 -1,406 +1,314 @@@ + #ifdef IMPLEMENTATION + #ifdef SVQC + #include "../../../../server/antilag.qh" + #endif + #include "../../../physics.qh" + + + #if defined(SVQC) + void bugrigs_SetVars(); -void bugrigs_AddStats(); + + REGISTER_MUTATOR(bugrigs, cvar("g_bugrigs")) + { + MUTATOR_ONADD + { + bugrigs_SetVars(); - bugrigs_AddStats(); + } + return false; + } + #elif defined(CSQC) + REGISTER_MUTATOR(bugrigs, true); + #endif + + -#ifdef CSQC - -#define PHYS_BUGRIGS getstati(STAT_BUGRIGS) -#define PHYS_BUGRIGS_ANGLE_SMOOTHING getstati(STAT_BUGRIGS_ANGLE_SMOOTHING) -#define PHYS_BUGRIGS_PLANAR_MOVEMENT getstati(STAT_BUGRIGS_PLANAR_MOVEMENT) -#define PHYS_BUGRIGS_REVERSE_SPEEDING getstati(STAT_BUGRIGS_REVERSE_SPEEDING) -#define PHYS_BUGRIGS_FRICTION_FLOOR getstatf(STAT_BUGRIGS_FRICTION_FLOOR) -#define PHYS_BUGRIGS_AIR_STEERING getstati(STAT_BUGRIGS_AIR_STEERING) -#define PHYS_BUGRIGS_FRICTION_BRAKE getstatf(STAT_BUGRIGS_FRICTION_BRAKE) -#define PHYS_BUGRIGS_ACCEL getstatf(STAT_BUGRIGS_ACCEL) -#define PHYS_BUGRIGS_SPEED_REF getstatf(STAT_BUGRIGS_SPEED_REF) -#define PHYS_BUGRIGS_SPEED_POW getstatf(STAT_BUGRIGS_SPEED_POW) -#define PHYS_BUGRIGS_STEER getstatf(STAT_BUGRIGS_STEER) -#define PHYS_BUGRIGS_FRICTION_AIR getstatf(STAT_BUGRIGS_FRICTION_AIR) -#define PHYS_BUGRIGS_CAR_JUMPING getstatf(STAT_BUGRIGS_CAR_JUMPING) -#define PHYS_BUGRIGS_REVERSE_SPINNING getstatf(STAT_BUGRIGS_REVERSE_SPINNING) -#define PHYS_BUGRIGS_REVERSE_STOPPING getstatf(STAT_BUGRIGS_REVERSE_STOPPING) - -#elif defined(SVQC) - -bool g_bugrigs; -bool g_bugrigs_planar_movement; -bool 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; - -#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 - -.float stat_bugrigs; -.float stat_bugrigs_angle_smoothing; -.float stat_bugrigs_planar_movement; -.float stat_bugrigs_reverse_speeding; -.float stat_bugrigs_friction_floor; -.float stat_bugrigs_air_steering; -.float stat_bugrigs_friction_brake; -.float stat_bugrigs_accel; -.float stat_bugrigs_speed_ref; -.float stat_bugrigs_speed_pow; -.float stat_bugrigs_steer; -.float stat_bugrigs_friction_air; -.float stat_bugrigs_car_jumping; -.float stat_bugrigs_reverse_spinning; -.float stat_bugrigs_reverse_stopping; ++#define PHYS_BUGRIGS(s) STAT(BUGRIGS, s) ++#define PHYS_BUGRIGS_ACCEL(s) STAT(BUGRIGS_ACCEL, s) ++#define PHYS_BUGRIGS_AIR_STEERING(s) STAT(BUGRIGS_AIR_STEERING, s) ++#define PHYS_BUGRIGS_ANGLE_SMOOTHING(s) STAT(BUGRIGS_ANGLE_SMOOTHING, s) ++#define PHYS_BUGRIGS_CAR_JUMPING(s) STAT(BUGRIGS_CAR_JUMPING, s) ++#define PHYS_BUGRIGS_FRICTION_AIR(s) STAT(BUGRIGS_FRICTION_AIR, s) ++#define PHYS_BUGRIGS_FRICTION_BRAKE(s) STAT(BUGRIGS_FRICTION_BRAKE, s) ++#define PHYS_BUGRIGS_FRICTION_FLOOR(s) STAT(BUGRIGS_FRICTION_FLOOR, s) ++#define PHYS_BUGRIGS_PLANAR_MOVEMENT(s) STAT(BUGRIGS_PLANAR_MOVEMENT, s) ++#define PHYS_BUGRIGS_REVERSE_SPEEDING(s) STAT(BUGRIGS_REVERSE_SPEEDING, s) ++#define PHYS_BUGRIGS_REVERSE_SPINNING(s) STAT(BUGRIGS_REVERSE_SPINNING, s) ++#define PHYS_BUGRIGS_REVERSE_STOPPING(s) STAT(BUGRIGS_REVERSE_STOPPING, s) ++#define PHYS_BUGRIGS_SPEED_POW(s) STAT(BUGRIGS_SPEED_POW, s) ++#define PHYS_BUGRIGS_SPEED_REF(s) STAT(BUGRIGS_SPEED_REF, s) ++#define PHYS_BUGRIGS_STEER(s) STAT(BUGRIGS_STEER, s) ++ ++#if defined(SVQC) + + void bugrigs_SetVars() + { + g_bugrigs = cvar("g_bugrigs"); + g_bugrigs_planar_movement = cvar("g_bugrigs_planar_movement"); + g_bugrigs_planar_movement_car_jumping = cvar("g_bugrigs_planar_movement_car_jumping"); + g_bugrigs_reverse_spinning = cvar("g_bugrigs_reverse_spinning"); + g_bugrigs_reverse_speeding = cvar("g_bugrigs_reverse_speeding"); + g_bugrigs_reverse_stopping = cvar("g_bugrigs_reverse_stopping"); + g_bugrigs_air_steering = cvar("g_bugrigs_air_steering"); + g_bugrigs_angle_smoothing = cvar("g_bugrigs_angle_smoothing"); + g_bugrigs_friction_floor = cvar("g_bugrigs_friction_floor"); + g_bugrigs_friction_brake = cvar("g_bugrigs_friction_brake"); + g_bugrigs_friction_air = cvar("g_bugrigs_friction_air"); + g_bugrigs_accel = cvar("g_bugrigs_accel"); + g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref"); + g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow"); + g_bugrigs_steer = cvar("g_bugrigs_steer"); + } + -void bugrigs_UpdateStats(entity this) -{ - this.stat_bugrigs = PHYS_BUGRIGS; - this.stat_bugrigs_angle_smoothing = PHYS_BUGRIGS_ANGLE_SMOOTHING; - this.stat_bugrigs_planar_movement = PHYS_BUGRIGS_PLANAR_MOVEMENT; - this.stat_bugrigs_reverse_speeding = PHYS_BUGRIGS_REVERSE_SPEEDING; - this.stat_bugrigs_friction_floor = PHYS_BUGRIGS_FRICTION_FLOOR; - this.stat_bugrigs_air_steering = PHYS_BUGRIGS_AIR_STEERING; - this.stat_bugrigs_friction_brake = PHYS_BUGRIGS_FRICTION_BRAKE; - this.stat_bugrigs_accel = PHYS_BUGRIGS_ACCEL; - this.stat_bugrigs_speed_ref = PHYS_BUGRIGS_SPEED_REF; - this.stat_bugrigs_speed_pow = PHYS_BUGRIGS_SPEED_POW; - this.stat_bugrigs_steer = PHYS_BUGRIGS_STEER; - this.stat_bugrigs_friction_air = PHYS_BUGRIGS_FRICTION_AIR; - this.stat_bugrigs_car_jumping = PHYS_BUGRIGS_CAR_JUMPING; - this.stat_bugrigs_reverse_spinning = PHYS_BUGRIGS_REVERSE_SPINNING; - this.stat_bugrigs_reverse_stopping = PHYS_BUGRIGS_REVERSE_STOPPING; -} - -void bugrigs_AddStats() -{ - addstat(STAT_BUGRIGS, AS_INT, stat_bugrigs); - addstat(STAT_BUGRIGS_ANGLE_SMOOTHING, AS_INT, stat_bugrigs_angle_smoothing); - addstat(STAT_BUGRIGS_PLANAR_MOVEMENT, AS_INT, stat_bugrigs_planar_movement); - addstat(STAT_BUGRIGS_REVERSE_SPEEDING, AS_INT, stat_bugrigs_reverse_speeding); - addstat(STAT_BUGRIGS_FRICTION_FLOOR, AS_FLOAT, stat_bugrigs_friction_floor); - addstat(STAT_BUGRIGS_AIR_STEERING, AS_INT, stat_bugrigs_air_steering); - addstat(STAT_BUGRIGS_FRICTION_BRAKE, AS_FLOAT, stat_bugrigs_friction_brake); - addstat(STAT_BUGRIGS_ACCEL, AS_FLOAT, stat_bugrigs_accel); - addstat(STAT_BUGRIGS_SPEED_REF, AS_FLOAT, stat_bugrigs_speed_ref); - addstat(STAT_BUGRIGS_SPEED_POW, AS_FLOAT, stat_bugrigs_speed_pow); - addstat(STAT_BUGRIGS_STEER, AS_FLOAT, stat_bugrigs_steer); - addstat(STAT_BUGRIGS_FRICTION_AIR, AS_FLOAT, stat_bugrigs_friction_air); - addstat(STAT_BUGRIGS_CAR_JUMPING, AS_FLOAT, stat_bugrigs_car_jumping); - addstat(STAT_BUGRIGS_REVERSE_SPINNING, AS_FLOAT, stat_bugrigs_reverse_spinning); - addstat(STAT_BUGRIGS_REVERSE_STOPPING, AS_FLOAT, stat_bugrigs_reverse_stopping); -} - + #endif + + void RaceCarPhysics(entity this) + { + // using this move type for "big rigs" + // the engine does not push the entity! + + vector rigvel; + + vector angles_save = this.angles; + float accel = bound(-1, this.movement.x / PHYS_MAXSPEED(this), 1); + float steer = bound(-1, this.movement.y / PHYS_MAXSPEED(this), 1); + - if (PHYS_BUGRIGS_REVERSE_SPEEDING) ++ if (PHYS_BUGRIGS_REVERSE_SPEEDING(this)) + { + if (accel < 0) + { + // back accel is DIGITAL + // to prevent speedhack + if (accel < -0.5) + accel = -1; + else + accel = 0; + } + } + + this.angles_x = 0; + this.angles_z = 0; + makevectors(this.angles); // new forward direction! + - if (IS_ONGROUND(this) || PHYS_BUGRIGS_AIR_STEERING) ++ if (IS_ONGROUND(this) || PHYS_BUGRIGS_AIR_STEERING(this)) + { + float myspeed = this.velocity * v_forward; + float upspeed = this.velocity * v_up; + + // responsiveness factor for steering and acceleration - float f = 1 / (1 + pow(max(-myspeed, myspeed) / PHYS_BUGRIGS_SPEED_REF, PHYS_BUGRIGS_SPEED_POW)); - //MAXIMA: f(v) := 1 / (1 + (v / PHYS_BUGRIGS_SPEED_REF) ^ PHYS_BUGRIGS_SPEED_POW); ++ float f = 1 / (1 + pow(max(-myspeed, myspeed) / PHYS_BUGRIGS_SPEED_REF(this), PHYS_BUGRIGS_SPEED_POW(this))); ++ //MAXIMA: f(v) := 1 / (1 + (v / PHYS_BUGRIGS_SPEED_REF(this)) ^ PHYS_BUGRIGS_SPEED_POW(this)); + + float steerfactor; - if (myspeed < 0 && PHYS_BUGRIGS_REVERSE_SPINNING) - steerfactor = -myspeed * PHYS_BUGRIGS_STEER; ++ if (myspeed < 0 && PHYS_BUGRIGS_REVERSE_SPINNING(this)) ++ steerfactor = -myspeed * PHYS_BUGRIGS_STEER(this); + else - steerfactor = -myspeed * f * PHYS_BUGRIGS_STEER; ++ steerfactor = -myspeed * f * PHYS_BUGRIGS_STEER(this); + + float accelfactor; - if (myspeed < 0 && PHYS_BUGRIGS_REVERSE_SPEEDING) - accelfactor = PHYS_BUGRIGS_ACCEL; ++ if (myspeed < 0 && PHYS_BUGRIGS_REVERSE_SPEEDING(this)) ++ accelfactor = PHYS_BUGRIGS_ACCEL(this); + else - accelfactor = f * PHYS_BUGRIGS_ACCEL; - //MAXIMA: accel(v) := f(v) * PHYS_BUGRIGS_ACCEL; ++ accelfactor = f * PHYS_BUGRIGS_ACCEL(this); ++ //MAXIMA: accel(v) := f(v) * PHYS_BUGRIGS_ACCEL(this); + + if (accel < 0) + { + if (myspeed > 0) + { - myspeed = max(0, myspeed - PHYS_INPUT_TIMELENGTH * (PHYS_BUGRIGS_FRICTION_FLOOR - PHYS_BUGRIGS_FRICTION_BRAKE * accel)); ++ myspeed = max(0, myspeed - PHYS_INPUT_TIMELENGTH * (PHYS_BUGRIGS_FRICTION_FLOOR(this) - PHYS_BUGRIGS_FRICTION_BRAKE(this) * accel)); + } + else + { - if (!PHYS_BUGRIGS_REVERSE_SPEEDING) - myspeed = min(0, myspeed + PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_FRICTION_FLOOR); ++ if (!PHYS_BUGRIGS_REVERSE_SPEEDING(this)) ++ myspeed = min(0, myspeed + PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_FRICTION_FLOOR(this)); + } + } + else + { + if (myspeed >= 0) + { - myspeed = max(0, myspeed - PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_FRICTION_FLOOR); ++ myspeed = max(0, myspeed - PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_FRICTION_FLOOR(this)); + } + else + { - if (PHYS_BUGRIGS_REVERSE_STOPPING) ++ if (PHYS_BUGRIGS_REVERSE_STOPPING(this)) + myspeed = 0; + else - myspeed = min(0, myspeed + PHYS_INPUT_TIMELENGTH * (PHYS_BUGRIGS_FRICTION_FLOOR + PHYS_BUGRIGS_FRICTION_BRAKE * accel)); ++ myspeed = min(0, myspeed + PHYS_INPUT_TIMELENGTH * (PHYS_BUGRIGS_FRICTION_FLOOR(this) + PHYS_BUGRIGS_FRICTION_BRAKE(this) * accel)); + } + } + // terminal velocity = velocity at which 50 == accelfactor, that is, 1549 units/sec - //MAXIMA: friction(v) := PHYS_BUGRIGS_FRICTION_FLOOR; ++ //MAXIMA: friction(v) := PHYS_BUGRIGS_FRICTION_FLOOR(this); + + this.angles_y += steer * PHYS_INPUT_TIMELENGTH * steerfactor; // apply steering + makevectors(this.angles); // new forward direction! + + myspeed += accel * accelfactor * PHYS_INPUT_TIMELENGTH; + + rigvel = myspeed * v_forward + '0 0 1' * upspeed; + } + else + { + float myspeed = vlen(this.velocity); + + // responsiveness factor for steering and acceleration - float f = 1 / (1 + pow(max(0, myspeed / PHYS_BUGRIGS_SPEED_REF), PHYS_BUGRIGS_SPEED_POW)); ++ float f = 1 / (1 + pow(max(0, myspeed / PHYS_BUGRIGS_SPEED_REF(this)), PHYS_BUGRIGS_SPEED_POW(this))); + float steerfactor = -myspeed * f; + this.angles_y += steer * PHYS_INPUT_TIMELENGTH * steerfactor; // apply steering + + rigvel = this.velocity; + makevectors(this.angles); // new forward direction! + } + - rigvel *= max(0, 1 - vlen(rigvel) * PHYS_BUGRIGS_FRICTION_AIR * PHYS_INPUT_TIMELENGTH); - //MAXIMA: airfriction(v) := v * v * PHYS_BUGRIGS_FRICTION_AIR; ++ rigvel *= max(0, 1 - vlen(rigvel) * PHYS_BUGRIGS_FRICTION_AIR(this) * PHYS_INPUT_TIMELENGTH); ++ //MAXIMA: airfriction(v) := v * v * PHYS_BUGRIGS_FRICTION_AIR(this); + //MAXIMA: total_acceleration(v) := accel(v) - friction(v) - airfriction(v); + //MAXIMA: solve(total_acceleration(v) = 0, v); + - if (PHYS_BUGRIGS_PLANAR_MOVEMENT) ++ if (PHYS_BUGRIGS_PLANAR_MOVEMENT(this)) + { + 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 (PHYS_BUGRIGS_CAR_JUMPING) ++ if (PHYS_BUGRIGS_CAR_JUMPING(this)) + mt = MOVE_NORMAL; + else + mt = MOVE_NOMONSTERS; + + tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 1024', mt, this); + up = trace_endpos - this.origin; + + // BUG RIGS: align the move to the surface instead of doing collision testing + // can we move? + tracebox(trace_endpos, this.mins, this.maxs, trace_endpos + rigvel_xy * PHYS_INPUT_TIMELENGTH, mt, this); + + // align to surface + tracebox(trace_endpos, this.mins, this.maxs, trace_endpos - up + '0 0 1' * rigvel_z * PHYS_INPUT_TIMELENGTH, mt, this); + + if (trace_fraction < 0.5) + { + trace_fraction = 1; + neworigin = this.origin; + } + else + neworigin = trace_endpos; + + if (trace_fraction < 1) + { + // now set angles_x so that the car points parallel to the surface + this.angles = vectoangles( + '1 0 0' * v_forward_x * trace_plane_normal_z + + + '0 1 0' * v_forward_y * trace_plane_normal_z + + + '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y) + ); + SET_ONGROUND(this); + } + else + { + // now set angles_x so that the car points forward, but is tilted in velocity direction + UNSET_ONGROUND(this); + } + + this.velocity = (neworigin - this.origin) * (1.0 / PHYS_INPUT_TIMELENGTH); + this.movetype = MOVETYPE_NOCLIP; + } + else + { - rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY; // 4x gravity plays better ++ rigvel_z -= PHYS_INPUT_TIMELENGTH * PHYS_GRAVITY(this); // 4x gravity plays better + this.velocity = rigvel; + this.movetype = MOVETYPE_FLY; + } + + trace_fraction = 1; + tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this); + if (trace_fraction != 1) + { + this.angles = vectoangles2( + '1 0 0' * v_forward_x * trace_plane_normal_z + + + '0 1 0' * v_forward_y * trace_plane_normal_z + + + '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y), + trace_plane_normal + ); + } + else + { + vector vel_local; + + vel_local_x = v_forward * this.velocity; + vel_local_y = v_right * this.velocity; + vel_local_z = v_up * this.velocity; + + this.angles_x = racecar_angle(vel_local_x, vel_local_z); + this.angles_z = racecar_angle(-vel_local_y, vel_local_z); + } + + // smooth the angles + vector vf1, vu1, smoothangles; + makevectors(this.angles); - float f = bound(0, PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_ANGLE_SMOOTHING, 1); ++ float f = bound(0, PHYS_INPUT_TIMELENGTH * PHYS_BUGRIGS_ANGLE_SMOOTHING(this), 1); + if (f == 0) + f = 1; + vf1 = v_forward * f; + vu1 = v_up * f; + makevectors(angles_save); + vf1 = vf1 + v_forward * (1 - f); + vu1 = vu1 + v_up * (1 - f); + smoothangles = vectoangles2(vf1, vu1); + this.angles_x = -smoothangles_x; + this.angles_z = smoothangles_z; + + PM_ClientMovement_Move(this); + } + + #ifdef SVQC + .vector bugrigs_prevangles; + #endif + MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics) + { - if(!PHYS_BUGRIGS || !IS_PLAYER(self)) { return false; } ++ if(!PHYS_BUGRIGS(self) || !IS_PLAYER(self)) { return false; } + + #ifdef SVQC + self.angles = self.bugrigs_prevangles; + #endif + + RaceCarPhysics(self); + return true; + } + + MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics) + { - if(!PHYS_BUGRIGS) { return false; } ++ if(!PHYS_BUGRIGS(self)) { return false; } + #ifdef SVQC + self.bugrigs_prevangles = self.angles; - - bugrigs_UpdateStats(self); + #endif + return false; + } + + #ifdef SVQC + + MUTATOR_HOOKFUNCTION(bugrigs, ClientConnect) + { + stuffcmd(self, "cl_cmd settemp chase_active 1\n"); + return false; + } + + MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsString) + { + ret_string = strcat(ret_string, ":bugrigs"); + return false; + } + + MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsPrettyString) + { + ret_string = strcat(ret_string, ", Bug rigs"); + return false; + } + + #endif + #endif diff --cc qcsrc/common/mutators/mutator/dodging/dodging.qc index 4f724cfbf,327f78b1d..b25de6125 --- a/qcsrc/common/mutators/mutator/dodging/dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/dodging.qc @@@ -85,9 -130,25 +87,9 @@@ REGISTER_MUTATOR(dodging, true) .int pressedkeys; #endif -void dodging_UpdateStats(entity this) -{ -#ifdef SVQC - this.stat_dodging = PHYS_DODGING; - this.stat_dodging_delay = PHYS_DODGING_DELAY; - this.stat_dodging_horiz_speed_frozen = PHYS_DODGING_HORIZ_SPEED_FROZEN; - this.stat_dodging_frozen = PHYS_DODGING_FROZEN; - this.stat_dodging_frozen_nodoubletap = PHYS_DODGING_FROZEN_NODOUBLETAP; - this.stat_dodging_height_threshold = PHYS_DODGING_HEIGHT_THRESHOLD; - this.stat_dodging_distance_threshold = PHYS_DODGING_DISTANCE_THRESHOLD; - this.stat_dodging_ramp_time = PHYS_DODGING_RAMP_TIME; - this.stat_dodging_up_speed = PHYS_DODGING_UP_SPEED; - this.stat_dodging_wall = PHYS_DODGING_WALL; -#endif -} - // returns 1 if the player is close to a wall - bool check_close_to_wall(float threshold) - {SELFPARAM(); + bool check_close_to_wall(entity this, float threshold) + { if (PHYS_DODGING_WALL == 0) { return false; } #define X(OFFSET) \ @@@ -174,7 -235,9 +176,7 @@@ void PM_dodging(entity this if (!PHYS_DODGING) return; - if (PHYS_DEAD(self)) - dodging_UpdateStats(this); - + if (PHYS_DEAD(this)) return; // when swimming, no dodging allowed.. diff --cc qcsrc/common/mutators/mutator/doublejump/doublejump.qc index 000000000,a2bd9ca0c..7a09b81e1 mode 000000,100644..100644 --- a/qcsrc/common/mutators/mutator/doublejump/doublejump.qc +++ b/qcsrc/common/mutators/mutator/doublejump/doublejump.qc @@@ -1,0 -1,90 +1,45 @@@ + #ifdef IMPLEMENTATION + #ifdef SVQC + #include "../../../../server/antilag.qh" + #endif + #include "../../../physics.qh" + - -#if defined(SVQC) -void doublejump_AddStats(); - -REGISTER_MUTATOR(doublejump, true) -{ - MUTATOR_ONADD - { - doublejump_AddStats(); - } - return false; -} -#elif defined(CSQC) + REGISTER_MUTATOR(doublejump, true); -#endif - - -#ifdef CSQC - -#define PHYS_DOUBLEJUMP getstati(STAT_DOUBLEJUMP) - -#elif defined(SVQC) - -bool autocvar_sv_doublejump; - -#define PHYS_DOUBLEJUMP autocvar_sv_doublejump + -.int stat_doublejump; - -void doublejump_UpdateStats(entity this) -{ - this.stat_doublejump = PHYS_DOUBLEJUMP; -} - -void doublejump_AddStats() -{ - addstat(STAT_DOUBLEJUMP, AS_INT, stat_doublejump); -} - -#endif ++#define PHYS_DOUBLEJUMP(s) STAT(DOUBLEJUMP, s) + + + MUTATOR_HOOKFUNCTION(doublejump, PlayerJump) + { - if (PHYS_DOUBLEJUMP) ++ if (PHYS_DOUBLEJUMP(self)) + { + tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self); + if (trace_fraction < 1 && trace_plane_normal_z > 0.7) + { + player_multijump = true; + + // we MUST clip velocity here! + float f = self.velocity * trace_plane_normal; + if (f < 0) + self.velocity -= f * trace_plane_normal; + } + } + return false; + } + -MUTATOR_HOOKFUNCTION(doublejump, PlayerPhysics) -{ -#ifdef SVQC - doublejump_UpdateStats(self); -#endif - return false; -} - + #ifdef SVQC + + MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsString) + { + ret_string = strcat(ret_string, ":doublejump"); + return false; + } + + MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsPrettyString) + { + ret_string = strcat(ret_string, ", Double jump"); + return false; + } + + #endif + #endif diff --cc qcsrc/common/mutators/mutator/multijump/multijump.qc index e65e7e8b4,6472c83ae..68ccecaab --- a/qcsrc/common/mutators/mutator/multijump/multijump.qc +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qc @@@ -4,43 -4,102 +4,50 @@@ #endif #include "../../../physics.qh" - .int multijump_count; - .bool multijump_ready; - .bool cvar_cl_multijump; + + #if defined(SVQC) -void multijump_AddStats(); - + REGISTER_MUTATOR(multijump, cvar("g_multijump")) + { + MUTATOR_ONADD + { - multijump_AddStats(); ++ addstat(STAT_MULTIJUMP_COUNT.m_id, AS_INT, multijump_count); + } - return false; + } + #elif defined(CSQC) + REGISTER_MUTATOR(multijump, true); + #endif -.int multijump_count; +#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) ++#define PHYS_MULTIJUMP_COUNT(s) STAT(MULTIJUMP_COUNT, s) + - void PM_multijump() - {SELFPARAM(); - if(!PHYS_MULTIJUMP) { return; } + .bool multijump_ready; - if(IS_ONGROUND(self)) - { - self.multijump_count = 0; - } - } + #ifdef CSQC ++bool autocvar_cl_multijump = false; - bool PM_multijump_checkjump() - {SELFPARAM(); - if(!PHYS_MULTIJUMP) { return false; } -bool autocvar_cl_multijump = true; - -#define PHYS_MULTIJUMP getstati(STAT_MULTIJUMP) -#define PHYS_MULTIJUMP_SPEED getstatf(STAT_MULTIJUMP_SPEED) -#define PHYS_MULTIJUMP_ADD getstati(STAT_MULTIJUMP_ADD) -#define PHYS_MULTIJUMP_MAXSPEED getstatf(STAT_MULTIJUMP_MAXSPEED) -#define PHYS_MULTIJUMP_DODGING getstati(STAT_MULTIJUMP_DODGING) -#define PHYS_MULTIJUMP_COUNT(s) getstati(STAT_MULTIJUMP_COUNT) -#define PHYS_MULTIJUMP_CLIENT(s) autocvar_cl_multijump - ++ #define PHYS_MULTIJUMP_CLIENT(s) autocvar_cl_multijump + #elif defined(SVQC) - + .bool cvar_cl_multijump; - #ifdef SVQC - bool client_multijump = self.cvar_cl_multijump; - #elif defined(CSQC) - bool client_multijump = cvar("cl_multijump"); -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 -#define PHYS_MULTIJUMP_COUNT(s) (s).multijump_count -#define PHYS_MULTIJUMP_CLIENT(s) (s).cvar_cl_multijump - -.float stat_multijump; -.float stat_multijump_speed; -.float stat_multijump_add; -.float stat_multijump_maxspeed; -.float stat_multijump_dodging; - -void multijump_UpdateStats(entity this) -{ - this.stat_multijump = PHYS_MULTIJUMP; - this.stat_multijump_speed = PHYS_MULTIJUMP_SPEED; - this.stat_multijump_add = PHYS_MULTIJUMP_ADD; - this.stat_multijump_maxspeed = PHYS_MULTIJUMP_MAXSPEED; - this.stat_multijump_dodging = PHYS_MULTIJUMP_DODGING; -} - -void multijump_AddStats() -{ - addstat(STAT_MULTIJUMP, AS_INT, stat_multijump); - addstat(STAT_MULTIJUMP_SPEED, AS_FLOAT, stat_multijump_speed); - addstat(STAT_MULTIJUMP_ADD, AS_INT, stat_multijump_add); - addstat(STAT_MULTIJUMP_MAXSPEED, AS_FLOAT, stat_multijump_maxspeed); - addstat(STAT_MULTIJUMP_DODGING, AS_INT, stat_multijump_dodging); - addstat(STAT_MULTIJUMP_COUNT, AS_INT, multijump_count); -} - ++ #define PHYS_MULTIJUMP_CLIENT(s) (s).cvar_cl_multijump + #endif + -void PM_multijump(entity this) -{ - if(!PHYS_MULTIJUMP) { return; } - - if(IS_ONGROUND(this)) - this.multijump_count = 0; -} - + bool PM_multijump_checkjump(entity this) + { + if(!PHYS_MULTIJUMP) { return false; } - if(cvar("cl_multijump") > 1) + int client_multijump = PHYS_MULTIJUMP_CLIENT(this); + if(client_multijump > 1) return false; // nope - #endif - if (!IS_JUMP_HELD(self) && !IS_ONGROUND(self) && client_multijump) // jump button pressed this frame and we are in midair - self.multijump_ready = true; // this is necessary to check that we released the jump button and pressed it again + if (!IS_JUMP_HELD(this) && !IS_ONGROUND(this) && client_multijump) // jump button pressed this frame and we are in midair + this.multijump_ready = true; // this is necessary to check that we released the jump button and pressed it again else - self.multijump_ready = false; + this.multijump_ready = false; int phys_multijump = PHYS_MULTIJUMP; @@@ -100,13 -155,14 +103,15 @@@ return false; } - #ifdef SVQC - REGISTER_MUTATOR(multijump, cvar("g_multijump")); - MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics) { - PM_multijump(); -#ifdef SVQC - multijump_UpdateStats(self); -#elif defined(CSQC) ++#ifdef CSQC + self.multijump_count = PHYS_MULTIJUMP_COUNT(self); + #endif - PM_multijump(self); ++ if(!PHYS_MULTIJUMP) { return; } + ++ if(IS_ONGROUND(self)) ++ self.multijump_count = 0; return false; } diff --cc qcsrc/common/physics.qc index 0526742b4,285321a9a..482135ed6 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@@ -1127,19 -973,19 +868,19 @@@ void PM_swim(entity this, float maxspd_ } } // water acceleration - PM_Accelerate(wishdir, wishspeed, wishspeed, PHYS_ACCELERATE * maxspd_mod, 1, 0, 0, 0); - PM_ClientMovement_Move(); + PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this) * maxspd_mod, 1, 0, 0, 0); + PM_ClientMovement_Move(this); } - void PM_ladder(float maxspd_mod) - {SELFPARAM(); + void PM_ladder(entity this, float maxspd_mod) + { // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water - UNSET_ONGROUND(self); + UNSET_ONGROUND(this); float g; - g = PHYS_GRAVITY * PHYS_INPUT_TIMELENGTH; + g = PHYS_GRAVITY(this) * PHYS_INPUT_TIMELENGTH; - if (PHYS_ENTGRAVITY(self)) - g *= PHYS_ENTGRAVITY(self); + if (PHYS_ENTGRAVITY(this)) + g *= PHYS_ENTGRAVITY(this); if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) { g *= 0.5; @@@ -1251,21 -1097,21 +992,21 @@@ void PM_jetpack(entity this, float maxs //print("best possible acceleration: ", ftos(best), "\n"); 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); + fxy = bound(0, 1 - (this.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); + fz = bound(0, 1 - this.velocity_z / PHYS_JETPACK_MAXSPEED_UP, 1); else - fz = bound(0, 1 + self.velocity_z / PHYS_JETPACK_MAXSPEED_UP, 1); + fz = bound(0, 1 + this.velocity_z / PHYS_JETPACK_MAXSPEED_UP, 1); float fvel; 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)) - f = min(1, PHYS_AMMO_FUEL(self) / (PHYS_JETPACK_FUEL * PHYS_INPUT_TIMELENGTH * fvel)); + if (PHYS_JETPACK_FUEL && !(ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO)) + f = min(1, PHYS_AMMO_FUEL(this) / (PHYS_JETPACK_FUEL * PHYS_INPUT_TIMELENGTH * fvel)); else f = 1; @@@ -1288,15 -1134,21 +1029,21 @@@ } #ifdef CSQC - float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; - if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.velocity_z -= g * 0.5; - else - self.velocity_z -= g; - PM_ClientMovement_Move(); - if (!IS_ONGROUND(self) || !(GAMEPLAYFIX_NOGRAVITYONGROUND)) - float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; ++ float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; + if(autocvar_cl_movement != 3) + { if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.velocity_z -= g * 0.5; + this.velocity_z -= g * 0.5; + else + this.velocity_z -= g; + } + PM_ClientMovement_Move(this); + if(autocvar_cl_movement != 3) + { + if (!IS_ONGROUND(this) || !(GAMEPLAYFIX_NOGRAVITYONGROUND)) + if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) + this.velocity_z -= g * 0.5; + } #endif } @@@ -1369,24 -1221,32 +1116,32 @@@ void PM_walk(entity this, float maxspd_ const float addspeed = wishspeed - this.velocity * wishdir; if (addspeed > 0) { - const float accelspeed = min(PHYS_ACCELERATE * PHYS_INPUT_TIMELENGTH * wishspeed, addspeed); + const float accelspeed = min(PHYS_ACCELERATE(this) * PHYS_INPUT_TIMELENGTH * wishspeed, addspeed); this.velocity += accelspeed * wishdir; } - const float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; - if (!(GAMEPLAYFIX_NOGRAVITYONGROUND)) - this.velocity_z -= g * (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1); + #ifdef CSQC - const float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; ++ float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; + if(autocvar_cl_movement != 3) + { + if (!(GAMEPLAYFIX_NOGRAVITYONGROUND)) + this.velocity_z -= g * (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1); + } if (vdist(this.velocity, >, 0)) - PM_ClientMovement_Move(); - if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - if (!IS_ONGROUND(this) || !GAMEPLAYFIX_NOGRAVITYONGROUND) - this.velocity_z -= g * 0.5; + PM_ClientMovement_Move(this); + if(autocvar_cl_movement != 3) + { + if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) + if (!IS_ONGROUND(this) || !GAMEPLAYFIX_NOGRAVITYONGROUND) + this.velocity_z -= g * 0.5; + } + #endif } - void PM_air(float buttons_prev, float maxspd_mod) - {SELFPARAM(); - makevectors(self.v_angle.y * '0 1 0'); - vector wishvel = v_forward * self.movement.x - + v_right * self.movement.y; + void PM_air(entity this, float buttons_prev, float maxspd_mod) + { + makevectors(this.v_angle.y * '0 1 0'); + vector wishvel = v_forward * this.movement.x + + v_right * this.movement.y; // acceleration vector wishdir = normalize(wishvel); float wishspeed = vlen(wishvel); @@@ -1424,35 -1284,41 +1179,41 @@@ // dv/dt = accel * maxspeed * (1 - accelqw) (when fast) // log dv/dt = logaccel + logmaxspeed (when slow) // log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast) - float strafity = IsMoveInDirection(self.movement, -90) + IsMoveInDirection(self.movement, +90); // if one is nonzero, other is always zero - if (PHYS_MAXAIRSTRAFESPEED) - wishspeed = min(wishspeed, GeomLerp(PHYS_MAXAIRSPEED(self)*maxspd_mod, strafity, PHYS_MAXAIRSTRAFESPEED*maxspd_mod)); - if (PHYS_AIRSTRAFEACCELERATE(self)) - airaccel = GeomLerp(airaccel, strafity, PHYS_AIRSTRAFEACCELERATE(self)*maxspd_mod); - if (PHYS_AIRSTRAFEACCEL_QW(self)) + float strafity = IsMoveInDirection(this.movement, -90) + IsMoveInDirection(this.movement, +90); // if one is nonzero, other is always zero + if (PHYS_MAXAIRSTRAFESPEED(this)) + wishspeed = min(wishspeed, GeomLerp(PHYS_MAXAIRSPEED(this)*maxspd_mod, strafity, PHYS_MAXAIRSTRAFESPEED(this)*maxspd_mod)); + if (PHYS_AIRSTRAFEACCELERATE(this)) + airaccel = GeomLerp(airaccel, strafity, PHYS_AIRSTRAFEACCELERATE(this)*maxspd_mod); + if (PHYS_AIRSTRAFEACCEL_QW(this)) airaccelqw = - (((strafity > 0.5 ? PHYS_AIRSTRAFEACCEL_QW(self) : PHYS_AIRACCEL_QW(self)) >= 0) ? +1 : -1) + (((strafity > 0.5 ? PHYS_AIRSTRAFEACCEL_QW(this) : PHYS_AIRACCEL_QW(this)) >= 0) ? +1 : -1) * - (1 - GeomLerp(1 - fabs(PHYS_AIRACCEL_QW(self)), strafity, 1 - fabs(PHYS_AIRSTRAFEACCEL_QW(self)))); + (1 - GeomLerp(1 - fabs(PHYS_AIRACCEL_QW(this)), strafity, 1 - fabs(PHYS_AIRSTRAFEACCEL_QW(this)))); // !CPM - if (PHYS_WARSOWBUNNY_TURNACCEL && accelerating && self.movement.y == 0 && self.movement.x != 0) - PM_AirAccelerate(wishdir, wishspeed2); + if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0) + PM_AirAccelerate(this, wishdir, wishspeed2); else - PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(self), PHYS_AIRACCEL_SIDEWAYS_FRICTION / maxairspd, PHYS_AIRSPEEDLIMIT_NONQW(self)); + PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd, PHYS_AIRSPEEDLIMIT_NONQW(this)); - if (PHYS_AIRCONTROL) - CPM_PM_Aircontrol(wishdir, wishspeed2); + if (PHYS_AIRCONTROL(this)) + CPM_PM_Aircontrol(this, wishdir, wishspeed2); } - float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(self) * PHYS_INPUT_TIMELENGTH; + #ifdef CSQC - float g = PHYS_GRAVITY * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; ++ float g = PHYS_GRAVITY(this) * PHYS_ENTGRAVITY(this) * PHYS_INPUT_TIMELENGTH; + if(autocvar_cl_movement != 3) if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.velocity_z -= g * 0.5; + this.velocity_z -= g * 0.5; else - self.velocity_z -= g; - PM_ClientMovement_Move(); - if (!IS_ONGROUND(self) || !(GAMEPLAYFIX_NOGRAVITYONGROUND)) + this.velocity_z -= g; + #endif + PM_ClientMovement_Move(this); + #ifdef CSQC + if(autocvar_cl_movement != 3) + if (!IS_ONGROUND(this) || !(GAMEPLAYFIX_NOGRAVITYONGROUND)) if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) - self.velocity_z -= g * 0.5; + this.velocity_z -= g * 0.5; + #endif } // used for calculating airshots diff --cc qcsrc/common/physics.qh index fb396d159,a9ad9f3eb..b266c3c0f --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@@ -24,91 -24,6 +24,73 @@@ float AdjustAirAccelQW(float accelqw, f bool IsFlying(entity a); +#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_ACCELERATE(s) STAT(MOVEVARS_ACCELERATE, s) ++#define PHYS_AIRACCELERATE(s) STAT(MOVEVARS_AIRACCELERATE, s) +#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_AIRACCEL_SIDEWAYS_FRICTION(s) STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, s) ++#define PHYS_AIRCONTROL(s) STAT(MOVEVARS_AIRCONTROL, s) ++#define PHYS_AIRCONTROL_PENALTY(s) STAT(MOVEVARS_AIRCONTROL_PENALTY, s) ++#define PHYS_AIRCONTROL_POWER(s) STAT(MOVEVARS_AIRCONTROL_POWER, s) +#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_AIRSTOPACCELERATE(s) STAT(MOVEVARS_AIRSTOPACCELERATE, s) ++#define PHYS_AIRSTRAFEACCELERATE(s) STAT(MOVEVARS_AIRSTRAFEACCELERATE, s) +#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(s) STAT(MOVEVARS_FRICTION, s) +#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_JUMPVELOCITY(s) STAT(MOVEVARS_JUMPVELOCITY, s) + +#define PHYS_MAXAIRSPEED(s) STAT(MOVEVARS_MAXAIRSPEED, s) - #define PHYS_MAXAIRSTRAFESPEED STAT(MOVEVARS_MAXAIRSTRAFESPEED, this) ++#define PHYS_MAXAIRSTRAFESPEED(s) STAT(MOVEVARS_MAXAIRSTRAFESPEED, s) +#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_STOPSPEED(s) STAT(MOVEVARS_STOPSPEED, s) + +#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 PHYS_WARSOWBUNNY_ACCEL(s) STAT(MOVEVARS_WARSOWBUNNY_ACCEL, s) ++#define PHYS_WARSOWBUNNY_AIRFORWARDACCEL(s) STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, s) ++#define PHYS_WARSOWBUNNY_BACKTOSIDERATIO(s) STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, s) ++#define PHYS_WARSOWBUNNY_TOPSPEED(s) STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, s) ++#define PHYS_WARSOWBUNNY_TURNACCEL(s) STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, s) + +#define UPWARD_VELOCITY_CLEARS_ONGROUND STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, this) + #ifdef CSQC const int FL_WATERJUMP = 2048; // player jumping out of water diff --cc qcsrc/common/stats.qh index a57555edf,ed3d077f9..d8a211745 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@@ -37,218 -99,196 +37,219 @@@ REGISTER_STAT(STRENGTH_FINISHED, float REGISTER_STAT(INVINCIBLE_FINISHED, float) /** arc heat in [0,1] */ REGISTER_STAT(ARC_HEAT, float) +REGISTER_STAT(PRESSED_KEYS, int) +/** this stat could later contain some other bits of info, like, more server-side particle config */ +REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool) +REGISTER_STAT(FUEL, int) +REGISTER_STAT(NB_METERSTART, float) +/** compressShotOrigin */ +REGISTER_STAT(SHOTORG, int) +REGISTER_STAT(LEADLIMIT, float) +REGISTER_STAT(WEAPON_CLIPLOAD, int) +REGISTER_STAT(WEAPON_CLIPSIZE, int) + +REGISTER_STAT(VORTEX_CHARGE, float) +REGISTER_STAT(LAST_PICKUP, float) +REGISTER_STAT(HUD, int) +REGISTER_STAT(VORTEX_CHARGEPOOL, float) +REGISTER_STAT(HIT_TIME, float) +REGISTER_STAT(DAMAGE_DEALT_TOTAL, int) +REGISTER_STAT(TYPEHIT_TIME, float) +REGISTER_STAT(LAYED_MINES, int) +REGISTER_STAT(HAGAR_LOAD, int) +REGISTER_STAT(SWITCHINGWEAPON, int) +REGISTER_STAT(SUPERWEAPONS_FINISHED, float) +REGISTER_STAT(VEHICLESTAT_HEALTH, int) +REGISTER_STAT(VEHICLESTAT_SHIELD, int) +REGISTER_STAT(VEHICLESTAT_ENERGY, int) +REGISTER_STAT(VEHICLESTAT_AMMO1, int) +REGISTER_STAT(VEHICLESTAT_RELOAD1, int) +REGISTER_STAT(VEHICLESTAT_AMMO2, int) +REGISTER_STAT(VEHICLESTAT_RELOAD2, int) +REGISTER_STAT(VEHICLESTAT_W2MODE, int) +REGISTER_STAT(NADE_TIMER, float) +REGISTER_STAT(SECRETS_TOTAL, float) +REGISTER_STAT(SECRETS_FOUND, float) +REGISTER_STAT(RESPAWN_TIME, float) +REGISTER_STAT(ROUNDSTARTTIME, float) +REGISTER_STAT(MONSTERS_TOTAL, int) +REGISTER_STAT(MONSTERS_KILLED, int) +REGISTER_STAT(BUFFS, int) +REGISTER_STAT(NADE_BONUS, float) +REGISTER_STAT(NADE_BONUS_TYPE, int) +REGISTER_STAT(NADE_BONUS_SCORE, float) +REGISTER_STAT(HEALING_ORB, float) +REGISTER_STAT(HEALING_ORB_ALPHA, float) +REGISTER_STAT(PLASMA, int) +REGISTER_STAT(OK_AMMO_CHARGE, float) +REGISTER_STAT(OK_AMMO_CHARGEPOOL, float) +REGISTER_STAT(FROZEN, int) +REGISTER_STAT(REVIVE_PROGRESS, float) +REGISTER_STAT(ROUNDLOST, int) +REGISTER_STAT(BUFF_TIME, float) +REGISTER_STAT(CTF_FLAGSTATUS, 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_COUNT, int /*doesn't matter*/) +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; ++bool g_bugrigs; ++bool g_bugrigs_planar_movement; ++bool 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) +/** cvar loopback */ +REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, 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 -enum { - STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS, - - STAT_PRESSED_KEYS, - /** this stat could later contain some other bits of info, like, more server-side particle config */ STAT_ALLOW_OLDVORTEXBEAM, - STAT_FUEL, - STAT_NB_METERSTART, - /** compressShotOrigin */ STAT_SHOTORG, - STAT_LEADLIMIT, - STAT_WEAPON_CLIPLOAD, - STAT_WEAPON_CLIPSIZE, - STAT_VORTEX_CHARGE, - STAT_LAST_PICKUP, - STAT_HUD, - STAT_VORTEX_CHARGEPOOL, - STAT_HIT_TIME, - STAT_DAMAGE_DEALT_TOTAL, - STAT_TYPEHIT_TIME, - STAT_LAYED_MINES, - STAT_HAGAR_LOAD, - STAT_SWITCHINGWEAPON, - STAT_SUPERWEAPONS_FINISHED, - STAT_VEHICLESTAT_HEALTH, - STAT_VEHICLESTAT_SHIELD, - STAT_VEHICLESTAT_ENERGY, - STAT_VEHICLESTAT_AMMO1, - STAT_VEHICLESTAT_RELOAD1, - STAT_VEHICLESTAT_AMMO2, - STAT_VEHICLESTAT_RELOAD2, - STAT_VEHICLESTAT_W2MODE, - STAT_NADE_TIMER, - STAT_SECRETS_TOTAL, - STAT_SECRETS_FOUND, - STAT_RESPAWN_TIME, - STAT_ROUNDSTARTTIME, - STAT_MONSTERS_TOTAL, - STAT_MONSTERS_KILLED, - STAT_BUFFS, - STAT_NADE_BONUS, - STAT_NADE_BONUS_TYPE, - STAT_NADE_BONUS_SCORE, - STAT_HEALING_ORB, - STAT_HEALING_ORB_ALPHA, - STAT_PLASMA, - STAT_OK_AMMO_CHARGE, - STAT_OK_AMMO_CHARGEPOOL, - STAT_FROZEN, - STAT_REVIVE_PROGRESS, - STAT_ROUNDLOST, - STAT_BUFF_TIME, - STAT_CTF_FLAGSTATUS, - STAT_MULTIJUMP_DODGING, - STAT_MULTIJUMP_MAXSPEED, - STAT_GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, - STAT_BUGRIGS_REVERSE_STOPPING, - STAT_BUGRIGS_REVERSE_SPINNING, - STAT_BUGRIGS_CAR_JUMPING, - STAT_BUGRIGS_FRICTION_AIR, - STAT_BUGRIGS_STEER, - STAT_BUGRIGS_SPEED_POW, - STAT_BUGRIGS_SPEED_REF, - STAT_BUGRIGS_ACCEL, - STAT_BUGRIGS_FRICTION_BRAKE, - STAT_BUGRIGS_AIR_STEERING, - STAT_BUGRIGS_FRICTION_FLOOR, - STAT_BUGRIGS_REVERSE_SPEEDING, - STAT_BUGRIGS_PLANAR_MOVEMENT, - STAT_BUGRIGS_ANGLE_SMOOTHING, - STAT_BUGRIGS, - STAT_GAMEPLAYFIX_STEPDOWN, - STAT_MOVEVARS_JUMPSTEP, - STAT_NOSTEP, - STAT_GAMEPLAYFIX_UNSTICKPLAYERS, - STAT_GAMEPLAYFIX_STEPMULTIPLETIMES, - STAT_GAMEPLAYFIX_DOWNTRACEONGROUND, - STAT_GAMEPLAYFIX_EASIERWATERJUMP, - STAT_MOVEVARS_FRICTION_SLICK, - STAT_MOVEVARS_FRICTION_ONLAND, - STAT_MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, - STAT_MOVEVARS_TRACK_CANJUMP, - STAT_DOUBLEJUMP, - STAT_MOVEVARS_CL_TRACK_CANJUMP, - STAT_MULTIJUMP_ADD, - STAT_MULTIJUMP_SPEED, - STAT_MULTIJUMP, - STAT_DODGING_TIMEOUT, - STAT_DODGING_WALL, - STAT_DODGING_UP_SPEED, - STAT_DODGING_RAMP_TIME, - STAT_DODGING_HEIGHT_THRESHOLD, - STAT_DODGING_DISTANCE_THRESHOLD, - STAT_DODGING_HORIZ_SPEED, - STAT_DODGING_DELAY, - STAT_DODGING_FROZEN_NO_DOUBLETAP, - STAT_DODGING_HORIZ_SPEED_FROZEN, - STAT_DODGING, - STAT_DODGING_FROZEN, - STAT_JETPACK_MAXSPEED_UP, - STAT_JETPACK_MAXSPEED_SIDE, - STAT_JETPACK_FUEL, - STAT_JETPACK_ANTIGRAVITY, - STAT_JETPACK_ACCEL_SIDE, - STAT_JETPACK_ACCEL_UP, - STAT_MOVEVARS_HIGHSPEED, - STAT_MULTIJUMP_COUNT, - - STAT_LAST_MAIN -}; - -const int STAT_LAST = STAT_LAST_MAIN + 5; - -/* The following stats change depending on the gamemode, so can share the same ID */ - -// freeze tag, clan arena, jailbreak -enum { - STAT_REDALIVE = STAT_LAST_MAIN, - STAT_BLUEALIVE, - STAT_YELLOWALIVE, - STAT_PINKALIVE, -}; +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_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) + +// freeze tag, clan arena +REGISTER_STAT(REDALIVE, int) +REGISTER_STAT(BLUEALIVE, int) +REGISTER_STAT(YELLOWALIVE, int) +REGISTER_STAT(PINKALIVE, int) // domination -enum { - STAT_DOM_TOTAL_PPS = STAT_LAST_MAIN, - STAT_DOM_PPS_RED, - STAT_DOM_PPS_BLUE, - STAT_DOM_PPS_YELLOW, - STAT_DOM_PPS_PINK, -}; - -// vip -enum { - STAT_VIP = STAT_LAST_MAIN, - STAT_VIP_RED, - STAT_VIP_BLUE, - STAT_VIP_YELLOW, - STAT_VIP_PINK, -}; - -// key hunt -enum { - STAT_KH_REDKEY_TEAM = STAT_LAST_MAIN, - STAT_KH_BLUEKEY_TEAM, - STAT_KH_YELLOWKEY_TEAM, - STAT_KH_PINKKEY_TEAM, -}; - -#define ASSERT_LESS(name, var, const) noref int name[(const - var + 1)]; -ASSERT_LESS(stat_limit, STAT_LAST, 220) +REGISTER_STAT(DOM_TOTAL_PPS, float) +REGISTER_STAT(DOM_PPS_RED, float) +REGISTER_STAT(DOM_PPS_BLUE, float) +REGISTER_STAT(DOM_PPS_YELLOW, float) +REGISTER_STAT(DOM_PPS_PINK, float) + +#ifdef SVQC +#include "movetypes/movetypes.qh" +#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; -const int STAT_MOVEFLAGS = 225; -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; -// -Wdouble-declaration -// const int STAT_FRAGLIMIT = 235; -// -Wdouble-declaration -// const int STAT_TIMELIMIT = 236; -const int STAT_MOVEVARS_WALLFRICTION = 237; -const int STAT_MOVEVARS_FRICTION = 238; -const int STAT_MOVEVARS_WATERFRICTION = 239; -// -Wdouble-declaration -// const int STAT_MOVEVARS_TICRATE = 240; -// -Wdouble-declaration -// const int STAT_MOVEVARS_TIMESCALE = 241; -// -Wdouble-declaration -// const int STAT_MOVEVARS_GRAVITY = 242; -const int STAT_MOVEVARS_STOPSPEED = 243; -const int STAT_MOVEVARS_MAXSPEED = 244; -const int STAT_MOVEVARS_SPECTATORMAXSPEED = 245; -const int STAT_MOVEVARS_ACCELERATE = 246; -const int STAT_MOVEVARS_AIRACCELERATE = 247; -const int STAT_MOVEVARS_WATERACCELERATE = 248; -const int STAT_MOVEVARS_ENTGRAVITY = 249; -const int STAT_MOVEVARS_JUMPVELOCITY = 250; -const int STAT_MOVEVARS_EDGEFRICTION = 251; -const int STAT_MOVEVARS_MAXAIRSPEED = 252; -const int STAT_MOVEVARS_STEPHEIGHT = 253; -const int STAT_MOVEVARS_AIRACCEL_QW = 254; -const int STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION = 255; +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; +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; +// 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