From: Martin Taibr Date: Thu, 17 Aug 2017 16:27:05 +0000 (+0200) Subject: explain common_factor, commend out debug stmts, kill unnecessary check X-Git-Tag: xonotic-v0.8.5~2430^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a5a1059d8884b586aec8fe440ed2f818934a1f6f;p=xonotic%2Fxonotic-data.pk3dir.git explain common_factor, commend out debug stmts, kill unnecessary check --- diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 2fb8603e4..aeddcdb70 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -184,6 +184,7 @@ bool PM_dodging_checkpressedkeys(entity this) bool can_air_dodge = (PHYS_DODGING_AIR && (PHYS_DODGING_AIR_MAXSPEED == 0 || vdist(this.velocity, <, PHYS_DODGING_AIR_MAXSPEED))); if (!can_dodge && !can_wall_dodge && !can_air_dodge) return false; + //LOG_INFOF("dodge delay %f\n", time - this.last_dodging_time); // TODO lowest i got with double press: 0.63 this.last_dodging_time = time; this.dodging_action = 1; @@ -229,14 +230,12 @@ void PM_dodging(entity this) // will be called ramp_time/frametime times = 2 times. so, we need to // add 0.5 * the total speed each frame until the dodge action is done.. float common_factor = PHYS_DODGING_FRAMETIME / PHYS_DODGING_RAMP_TIME; - //common_factor /= 2; // FIXME this is WRONG but this function is called twice per frame!!! - - // if ramp time is smaller than frametime we get problems ;D - common_factor = min(common_factor, 1); // TODO necessary with dodging_force_remaining? + // NOTE: depending on cl_netfps the client may (and probably will) send more input frames during each server frame + // but common_factor uses server frame rate so players with higher cl_netfps will ramp slightly faster float velocity_increase = min(common_factor * this.dodging_force_total, this.dodging_force_remaining); this.dodging_force_remaining -= velocity_increase; - LOG_INFOF("time %f velocity_increase: %f\n", time, velocity_increase); + //LOG_INFOF("time %f velocity_increase: %f\n", time, velocity_increase); this.velocity += this.dodging_direction.x * velocity_increase * v_forward + this.dodging_direction.y * velocity_increase * v_right;