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_ready;
+.float prevjumpbutton;
+
+.float nexspeed;
+
/*
=============
PlayerJump
return;
}
+ if (cvar("g_multijump"))
+ {
+ if (self.prevjumpbutton == FALSE && !(self.flags & FL_ONGROUND)) // 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
+ else
+ self.multijump_ready = FALSE;
+ }
+
+ if(!doublejump && self.multijump_ready && self.multijump_count < cvar("g_multijump") && self.velocity_z > cvar("g_multijump_speed"))
+ {
+ // doublejump = FALSE; // checked above in the if
+ if (cvar("g_multijump") > 0)
+ {
+ if (cvar("g_multijump_add") == 0) // in this case we make the z velocity == jumpvelocity
+ {
+ if (self.velocity_z < mjumpheight)
+ {
+ doublejump = TRUE;
+ self.velocity_z = 0;
+ }
+ }
+ else
+ doublejump = TRUE;
+
+ if(doublejump)
+ {
+ if(self.movement_x != 0 || self.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+ {
+ float curspeed;
+ vector wishvel, wishdir;
+
+ curspeed = max(
+ vlen(vec2(self.velocity)), // current xy speed
+ vlen(vec2(antilag_takebackavgvelocity(self, max(self.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
+ );
+ makevectors(self.v_angle_y * '0 1 0');
+ wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+ wishdir = normalize(wishvel);
+
+ self.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
+ self.velocity_y = wishdir_y * curspeed;
+ // keep velocity_z unchanged!
+ }
+ self.multijump_count += 1;
+ }
+ }
+ self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
+ }
+
if (!doublejump)
- if (!(self.flags & FL_ONGROUND))
- return;
+ if (!(self.flags & FL_ONGROUND))
+ return;
if(!sv_pogostick)
if (!(self.flags & FL_JUMPRELEASED))
float mt;
rigvel_z -= frametime * sv_gravity; // 4x gravity plays better
- rigvel_xy = rigvel;
- rigvel_xy_z = 0;
+ rigvel_xy = vec2(rigvel);
if(g_bugrigs_planar_movement_car_jumping && !g_touchexplode) // touchexplode is a better way to handle collisions
mt = MOVE_NORMAL;
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);
}
vel_straight = self.velocity * wishdir;
vel_z = self.velocity_z;
- vel_xy = self.velocity - vel_z * '0 0 1';
+ vel_xy = vec2(self.velocity);
vel_perpend = vel_xy - vel_straight * wishdir;
step = accel * frametime * wishspeed0;
float speedaward_speed;
string speedaward_holder;
+string speedaward_uid;
void race_send_speedaward(float msg)
{
// send the best speed of the round
float speedaward_alltimebest;
string speedaward_alltimebest_holder;
+string speedaward_alltimebest_uid;
void race_send_speedaward_alltimebest(float msg)
{
// send the best speed
string GetMapname(void);
float speedaward_lastupdate;
float speedaward_lastsent;
-var float autocvar_g_movement_highspeed = 1;
void SV_PlayerPhysics()
{
local vector wishvel, wishdir, v;
float buttons_prev;
float not_allowed_to_move;
string c;
-
+
// fix physics stats for g_movement_highspeed
self.stat_sv_airaccel_qw = AdjustAirAccelQW(sv_airaccel_qw, autocvar_g_movement_highspeed);
if(sv_airstrafeaccel_qw)
if(self.classname == "player")
{
+ 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
+ }
+
if (self.BUTTON_JUMP)
PlayerJump ();
else
if (self.waterlevel == WATERLEVEL_SWIMMING)
CheckWaterJump ();
+ self.prevjumpbutton = self.BUTTON_JUMP;
}
if (self.flags & FL_WATERJUMP )
// 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);
if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed) {
speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1');
speedaward_holder = self.netname;
+ if(speedaward_uid)
+ strunzone(speedaward_uid);
+ speedaward_uid = strzone(self.crypto_idfp);
speedaward_lastupdate = time;
}
if(speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1) {
speedaward_alltimebest_holder = speedaward_holder;
db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed"), ftos(speedaward_alltimebest));
db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/netname"), speedaward_alltimebest_holder);
+ db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp"), speedaward_alltimebest_holder);
race_send_speedaward_alltimebest(MSG_ALL);
}
}
}
+
+ float xyspeed;
+ xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
+ if(self.weapon == WEP_NEX && cvar("g_balance_nex_charge") && cvar("g_balance_nex_charge_velocity_rate") && xyspeed > cvar("g_balance_nex_charge_minspeed"))
+ {
+ // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
+ xyspeed = min(xyspeed, cvar("g_balance_nex_charge_maxspeed"));
+ f = (xyspeed - cvar("g_balance_nex_charge_minspeed")) / (cvar("g_balance_nex_charge_maxspeed") - cvar("g_balance_nex_charge_minspeed"));
+ // add the extra charge
+ self.nex_charge = min(1, self.nex_charge + cvar("g_balance_nex_charge_velocity_rate") * f * frametime);
+ }
:end
if(self.flags & FL_ONGROUND)
self.lastground = time;