float sv_airstrafeaccel_qw;
float sv_aircontrol;
float sv_aircontrol_power;
+float sv_aircontrol_penalty;
float sv_warsowbunny_airforwardaccel;
float sv_warsowbunny_accel;
float sv_warsowbunny_topspeed;
.float wasFlying;
.float spectatorspeed;
+.float multijump_count;
+.float multijump_delay;
+.float multijump_ready;
+
/*
=============
PlayerJump
return;
}
- if (!doublejump)
- if (!(self.flags & FL_ONGROUND))
- return;
+ if (cvar("g_multijump"))
+ {
+ if ((self.flags & FL_JUMPRELEASED) && !(self.flags & FL_ONGROUND))
+ self.multijump_ready = TRUE; // this is necessary to check that we released the jump button and pressed it again
+ else if (self.flags & FL_ONGROUND)
+ {
+ if (cvar("g_multijump") > 0)
+ self.multijump_count = 0;
+ else
+ self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
+ self.multijump_ready = FALSE;
+ }
+ }
+
+ if(self.multijump_ready && time > self.multijump_delay && self.multijump_count < cvar("g_multijump") && self.velocity_z > cvar("g_multijump_speed"))
+ {
+ if (cvar("g_multijump") > 0)
+ {
+ if (cvar("g_multijump_add") == 0) // in this case we make the z velocity == jumpvelocity
+ self.velocity_z = 0;
+ self.multijump_count += 1;
+ }
+ self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
+ }
+ else if (!doublejump)
+ if (!(self.flags & FL_ONGROUND))
+ return;
if(!sv_pogostick)
if (!(self.flags & FL_JUMPRELEASED))
self.flags &~= FL_ONGROUND;
self.flags &~= FL_JUMPRELEASED;
+ if (cvar("g_multijump"))
+ self.multijump_delay = time + cvar("g_multijump_delay");
+
if (self.crouch)
setanim(self, self.anim_duckjump, FALSE, TRUE, TRUE);
else
if(dot > 0) // we can't change direction while slowing down
{
- k *= fabs(sv_aircontrol)*pow(dot, sv_aircontrol_power)*frametime;
+ k *= pow(dot, sv_aircontrol_power)*frametime;
+ xyspeed = max(0, xyspeed - sv_aircontrol_penalty * sqrt(max(0, 1 - dot*dot)) * k/32);
+ k *= sv_aircontrol;
self.velocity = normalize(self.velocity * xyspeed + wishdir * k);
}
string GetMapname(void);
float speedaward_lastupdate;
float speedaward_lastsent;
-var float autocvar_g_movement_highspeed = 1;
void SV_PlayerPhysics()
{
local vector wishvel, wishdir, v;
// CPM
if(sv_airstopaccelerate)
- if(self.velocity * wishdir < 0)
- airaccel = sv_airstopaccelerate*maxspd_mod;
+ {
+ vector curdir;
+ curdir = self.velocity;
+ curdir_z = 0;
+ curdir = normalize(curdir);
+ airaccel = airaccel + (sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
+ }
// note that for straight forward jumping:
// step = accel * frametime * wishspeed0;
// accel = bound(0, wishspeed - vel_xy_current, step) * accelqw + step * (1 - accelqw);