.float wasFlying;
.float spectatorspeed;
-.float multijump_count;
-.float multijump_ready;
-.float prevjumpbutton;
-
/*
=============
PlayerJump
if(self.frozen)
return; // no jumping in freezetag when frozen
- float mjumpheight;
- float doublejump;
+ if(self.player_blocked)
+ return; // no jumping while blocked
+
+ float doublejump = FALSE;
+ float mjumpheight = autocvar_sv_jumpvelocity;
+
+ player_multijump = doublejump;
+ player_jumpheight = mjumpheight;
+ if(MUTATOR_CALLHOOK(PlayerJump))
+ return;
+
+ doublejump = player_multijump;
+ mjumpheight = player_jumpheight;
- doublejump = FALSE;
if (autocvar_sv_doublejump)
{
tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
}
}
- mjumpheight = autocvar_sv_jumpvelocity;
if (self.waterlevel >= WATERLEVEL_SWIMMING)
{
self.velocity_z = self.stat_sv_maxspeed * 0.7;
return;
}
- if (autocvar_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 < autocvar_g_multijump && self.velocity_z > autocvar_g_multijump_speed)
- {
- // doublejump = FALSE; // checked above in the if
- if (autocvar_g_multijump)
- {
- if (autocvar_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!
- }
- if (autocvar_g_multijump > 0)
- 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_JUMPRELEASED))
return;
- if(self.health <= g_bloodloss)
- return;
-
// sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
// velocity bounds. Final velocity is bound between (jumpheight *
// min + jumpheight) and (jumpheight * max + jumpheight);
self.velocity_z = self.velocity_z + mjumpheight;
self.oldvelocity_z = self.velocity_z;
- self.flags &~= FL_ONGROUND;
- self.flags &~= FL_JUMPRELEASED;
+ self.flags &= ~FL_ONGROUND;
+ self.flags &= ~FL_JUMPRELEASED;
animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
- if(g_jump_grunt)
+ if(autocvar_g_jump_grunt)
PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
self.restart_jump = -1; // restart jump anim next time
{ // open at eye level
self.flags |= FL_WATERJUMP;
self.velocity_z = 225;
- self.flags &~= FL_JUMPRELEASED;
+ self.flags &= ~FL_JUMPRELEASED;
self.teleport_time = time + 2; // safety net
return;
}
}
void CheckPlayerJump()
{
- if(self.flags & FL_ONGROUND)
- {
- if (autocvar_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;
}
float racecar_angle(float forward, float down)
else
{
// now set angles_x so that the car points forward, but is tilted in velocity direction
- self.flags &~= FL_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
}
self.velocity = (neworigin - self.origin) * (1.0 / frametime);
}
else
vel_perpend = vel_perpend * max(0, 1 - frametime * wishspeed * sidefric);
-
+
vel_xy = vel_straight * wishdir + vel_perpend;
-
+
if(speedclamp >= 0)
{
float vel_xy_preclamp;
string c;
WarpZone_PlayerPhysics_FixVAngle();
-
+
maxspd_mod = 1;
if(self.ballcarried)
- if(g_nexball)
- maxspd_mod *= autocvar_g_nexball_basketball_carrier_highspeed;
- else if(g_keepaway)
+ if(g_keepaway)
maxspd_mod *= autocvar_g_keepaway_ballcarrier_highspeed;
maxspd_mod *= autocvar_g_movement_highspeed;
return;
bot_think();
}
-
- self.items &~= IT_USING_JETPACK;
+
+ self.items &= ~IT_USING_JETPACK;
if(IS_PLAYER(self))
{
self.disableclientprediction = 0;
if(time < self.ladder_time)
self.disableclientprediction = 1;
-
+
+ if(time < self.spider_slowness)
+ {
+ self.stat_sv_maxspeed *= 0.5; // half speed while slow from spider
+ self.stat_sv_airspeedlimit_nonqw *= 0.5;
+ }
+
if(self.frozen)
{
- self.movement = '0 0 0';
+ if(autocvar_sv_dodging_frozen && IS_REAL_CLIENT(self))
+ {
+ self.movement_x = bound(-5, self.movement_x, 5);
+ self.movement_y = bound(-5, self.movement_y, 5);
+ self.movement_z = bound(-5, self.movement_z, 5);
+ }
+ else
+ self.movement = '0 0 0';
self.disableclientprediction = 1;
+
+ vector midpoint = ((self.absmin + self.absmax) * 0.5);
+ if(pointcontents(midpoint) == CONTENT_WATER)
+ {
+ self.velocity = self.velocity * 0.5;
+
+ if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
+ { self.velocity_z = 200; }
+ }
}
MUTATOR_CALLHOOK(PlayerPhysics);
if(self.conveyor.state)
self.velocity -= self.conveyor.movedir;
- if not(IS_PLAYER(self))
+ if (!IS_PLAYER(self))
{
maxspd_mod = autocvar_sv_spectator_speed_multiplier;
if(!self.spectatorspeed)
self.spectatorspeed = maxspd_mod;
- if(self.impulse && self.impulse <= 19 || self.impulse >= 200 && self.impulse <= 209 || self.impulse >= 220 && self.impulse <= 229)
+ if(self.impulse && self.impulse <= 19 || (self.impulse >= 200 && self.impulse <= 209) || (self.impulse >= 220 && self.impulse <= 229))
{
if(self.lastclassname != "player")
{
- if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || self.impulse >= 200 && self.impulse <= 209)
+ if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209))
self.spectatorspeed = bound(1, self.spectatorspeed + 0.5, 5);
else if(self.impulse == 11)
self.spectatorspeed = maxspd_mod;
- else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19 || self.impulse >= 220 && self.impulse <= 229)
+ else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229))
self.spectatorspeed = bound(1, self.spectatorspeed - 0.5, 5);
else if(self.impulse >= 1 && self.impulse <= 9)
self.spectatorspeed = 1 + 0.5 * (self.impulse - 1);
if(self.waterlevel < WATERLEVEL_SWIMMING)
if(time >= self.ladder_time)
- if not(self.hook)
+ if (!self.hook)
{
self.nextstep = time + 0.3 + random() * 0.1;
trace_dphitq3surfaceflags = 0;
tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
- if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)
+ if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS))
{
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
self.velocity_y = self.movedir_y;
if (time > self.teleport_time || self.waterlevel == WATERLEVEL_NONE)
{
- self.flags &~= FL_WATERJUMP;
+ self.flags &= ~FL_WATERJUMP;
self.teleport_time = 0;
}
}
else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY)
{
// noclipping or flying
- self.flags &~= FL_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
makevectors(self.v_angle);
else if (self.waterlevel >= WATERLEVEL_SWIMMING)
{
// swimming
- self.flags &~= FL_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
makevectors(self.v_angle);
//wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
else if (time < self.ladder_time)
{
// on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
- self.flags &~= FL_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
float g;
g = autocvar_sv_gravity * frametime;
else
fz = bound(0, 1 + self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
- float fvel;
- fvel = vlen(wishvel);
wishvel_x *= fxy;
wishvel_y *= fxy;
wishvel_z = (wishvel_z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
+ float fvel;
fvel = min(1, vlen(wishvel) / best);
if(autocvar_g_jetpack_fuel && !(self.items & IT_UNLIMITED_WEAPON_AMMO))
f = min(1, self.ammo_fuel / (autocvar_g_jetpack_fuel * frametime * fvel));
if (f > 0 && wishvel != '0 0 0')
{
self.velocity = self.velocity + wishvel * f * frametime;
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
self.ammo_fuel -= autocvar_g_jetpack_fuel * frametime * fvel * f;
- self.flags &~= FL_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
self.items |= IT_USING_JETPACK;
// jetpack also inhibits health regeneration, but only for 1 second
}
}
- if((g_cts || g_race) && !IS_OBSERVER(self)) {
- if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed) {
+ if((g_cts || g_race) && !IS_OBSERVER(self))
+ {
+ 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;
speedaward_uid = self.crypto_idfp;
speedaward_lastupdate = time;
}
- if(speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1) {
- string rr;
- if(g_cts)
- rr = CTS_RECORD;
- else
- rr = RACE_RECORD;
+ if(speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1)
+ {
+ string rr = (g_cts) ? CTS_RECORD : RACE_RECORD;
race_send_speedaward(MSG_ALL);
speedaward_lastsent = speedaward_speed;
- if (speedaward_speed > speedaward_alltimebest && speedaward_uid != "") {
+ if (speedaward_speed > speedaward_alltimebest && speedaward_uid != "")
+ {
speedaward_alltimebest = speedaward_speed;
speedaward_alltimebest_holder = speedaward_holder;
speedaward_alltimebest_uid = speedaward_uid;
}
}
+ // WEAPONTODO
float xyspeed;
xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
- if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge && autocvar_g_balance_nex_charge_velocity_rate && xyspeed > autocvar_g_balance_nex_charge_minspeed)
+ if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, 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, autocvar_g_balance_nex_charge_maxspeed);
- f = (xyspeed - autocvar_g_balance_nex_charge_minspeed) / (autocvar_g_balance_nex_charge_maxspeed - autocvar_g_balance_nex_charge_minspeed);
+ xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
+ f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
// add the extra charge
- self.nex_charge = min(1, self.nex_charge + autocvar_g_balance_nex_charge_velocity_rate * f * frametime);
+ self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * frametime);
}
:end
if(self.flags & FL_ONGROUND)