]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index 14747fa99aabe535d9074e7e03ae6391adcebf80..3244f37afe04ee847bb2a3a341f37ffcbdd4a296 100644 (file)
@@ -1,3 +1,30 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qc"
+    #include "../dpdefs/dpextensions.qc"
+    #include "sys-post.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/animdecide.qh"
+    #include "../common/monsters/sv_monsters.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../common/mapinfo.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "anticheat.qh"
+    #include "cheats.qh"
+    #include "g_hook.qh"
+    #include "race.qh"
+    #include "playerdemo.qh"
+#endif
+
 .float race_penalty;
 .float restart_jump;
 
 PlayerJump
 
 When you press the jump key
+returns true if handled
 =============
 */
-void PlayerJump (void)
+float PlayerJump (void)
 {
        if(self.frozen)
-               return; // no jumping in freezetag when frozen
+               return true; // no jumping in freezetag when frozen
 
        if(self.player_blocked)
-               return; // no jumping while blocked
+               return true; // no jumping while blocked
 
-       float doublejump = FALSE;
+       float doublejump = false;
        float mjumpheight = autocvar_sv_jumpvelocity;
 
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
-               return;
+               return true;
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
@@ -39,9 +67,9 @@ void PlayerJump (void)
        if (autocvar_sv_doublejump)
        {
                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)
+               if (trace_fraction < 1 && trace_plane_normal.z > 0.7)
                {
-                       doublejump = TRUE;
+                       doublejump = true;
 
                        // we MUST clip velocity here!
                        float f;
@@ -54,16 +82,16 @@ void PlayerJump (void)
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
-               return;
+               return true;
        }
 
        if (!doublejump)
                if (!(self.flags & FL_ONGROUND))
-                       return;
+                       return !(self.flags & FL_JUMPRELEASED);
 
        if(self.cvar_cl_movement_track_canjump)
                if (!(self.flags & FL_JUMPRELEASED))
-                       return;
+                       return true;
 
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
@@ -75,8 +103,8 @@ void PlayerJump (void)
 
                minjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_min);
 
-               if (self.velocity_z < minjumpspeed)
-                       mjumpheight += minjumpspeed - self.velocity_z;
+               if (self.velocity.z < minjumpspeed)
+                       mjumpheight += minjumpspeed - self.velocity.z;
        }
 
        if(autocvar_sv_jumpspeedcap_max != "")
@@ -84,14 +112,14 @@ void PlayerJump (void)
                // don't do jump speedcaps on ramps to preserve old xonotic ramjump style
                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.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps))
+               if(!(trace_fraction < 1 && trace_plane_normal.z < 0.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps))
                {
                        float maxjumpspeed;
 
                        maxjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_max);
 
-                       if (self.velocity_z > maxjumpspeed)
-                               mjumpheight -= self.velocity_z - maxjumpspeed;
+                       if (self.velocity.z > maxjumpspeed)
+                               mjumpheight -= self.velocity.z - maxjumpspeed;
                }
        }
 
@@ -109,19 +137,20 @@ void PlayerJump (void)
                self.jumppadcount = 0;
        }
 
-       self.velocity_z = self.velocity_z + mjumpheight;
-       self.oldvelocity_z = self.velocity_z;
+       self.velocity_z = self.velocity.z + mjumpheight;
+       self.oldvelocity_z = self.velocity.z;
 
        self.flags &= ~FL_ONGROUND;
        self.flags &= ~FL_JUMPRELEASED;
 
-       animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
+       animdecide_setaction(self, ANIMACTION_JUMP, true);
 
        if(autocvar_g_jump_grunt)
                PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
 
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
+       return true;
 }
 void CheckWaterJump()
 {
@@ -130,17 +159,17 @@ void CheckWaterJump()
 // check for a jump-out-of-water
        makevectors (self.angles);
        start = self.origin;
-       start_z = start_z + 8;
+       start_z = start.z + 8;
        v_forward_z = 0;
        normalize(v_forward);
        end = start + v_forward*24;
-       traceline (start, end, TRUE, self);
+       traceline (start, end, true, self);
        if (trace_fraction < 1)
        {       // solid at waist
-               start_z = start_z + self.maxs_z - 8;
+               start_z = start.z + self.maxs.z - 8;
                end = start + v_forward*24;
                self.movedir = trace_plane_normal * -50;
-               traceline (start, end, TRUE, self);
+               traceline (start, end, true, self);
                if (trace_fraction == 1)
                {       // open at eye level
                        self.flags |= FL_WATERJUMP;
@@ -151,11 +180,42 @@ void CheckWaterJump()
                }
        }
 }
+
+.float jetpack_stopped;
+// Hack: shouldn't need to know about this
+.float multijump_count;
 void CheckPlayerJump()
 {
-       if (self.BUTTON_JUMP)
-               PlayerJump ();
+       float was_flying = self.items & IT_USING_JETPACK;
+
+       if (self.cvar_cl_jetpack_jump < 2)
+               self.items &= ~IT_USING_JETPACK;
+
+       if (self.BUTTON_JUMP || self.BUTTON_JETPACK)
+       {
+               float air_jump = !PlayerJump() || self.multijump_count > 0; // PlayerJump() has important side effects
+               float activate = self.cvar_cl_jetpack_jump && air_jump && self.BUTTON_JUMP || self.BUTTON_JETPACK;
+               float has_fuel = !autocvar_g_jetpack_fuel || self.ammo_fuel || self.items & IT_UNLIMITED_WEAPON_AMMO;
+               if (!(self.items & IT_JETPACK)) { }
+               else if (self.jetpack_stopped) { }
+               else if (!has_fuel)
+               {
+                       if (was_flying) // TODO: ran out of fuel message
+                               Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+                       else if (activate)
+                               Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+                       self.jetpack_stopped = true;
+                       self.items &= ~IT_USING_JETPACK;
+               }
+               else if (activate && !self.frozen)
+                       self.items |= IT_USING_JETPACK;
+       }
        else
+       {
+               self.jetpack_stopped = false;
+               self.items &= ~IT_USING_JETPACK;
+       }
+       if (!self.BUTTON_JUMP)
                self.flags |= FL_JUMPRELEASED;
 
        if (self.waterlevel == WATERLEVEL_SWIMMING)
@@ -191,8 +251,8 @@ void RaceCarPhysics()
        vector angles_save, rigvel;
 
        angles_save = self.angles;
-       accel = bound(-1, self.movement_x / self.stat_sv_maxspeed, 1);
-       steer = bound(-1, self.movement_y / self.stat_sv_maxspeed, 1);
+       accel = bound(-1, self.movement.x / self.stat_sv_maxspeed, 1);
+       steer = bound(-1, self.movement.y / self.stat_sv_maxspeed, 1);
 
        if(g_bugrigs_reverse_speeding)
        {
@@ -292,7 +352,7 @@ void RaceCarPhysics()
                vector rigvel_xy, neworigin, up;
                float mt;
 
-               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
+               rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                rigvel_xy = vec2(rigvel);
 
                if(g_bugrigs_planar_movement_car_jumping)
@@ -308,7 +368,7 @@ void RaceCarPhysics()
                tracebox(trace_endpos, self.mins, self.maxs, trace_endpos + rigvel_xy * frametime, mt, self);
 
                // align to surface
-               tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel_z * frametime, mt, self);
+               tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel.z * frametime, mt, self);
 
                if(trace_fraction < 0.5)
                {
@@ -322,11 +382,11 @@ void RaceCarPhysics()
                {
                        // now set angles_x so that the car points parallel to the surface
                        self.angles = vectoangles(
-                                       '1 0 0' * v_forward_x * trace_plane_normal_z
+                                       '1 0 0' * v_forward.x * trace_plane_normal.z
                                        +
-                                       '0 1 0' * v_forward_y * 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)
+                                       '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y)
                                        );
                        self.flags |= FL_ONGROUND;
                }
@@ -341,7 +401,7 @@ void RaceCarPhysics()
        }
        else
        {
-               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
+               rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                self.velocity = rigvel;
                self.movetype = MOVETYPE_FLY;
        }
@@ -351,11 +411,11 @@ void RaceCarPhysics()
        if(trace_fraction != 1)
        {
                self.angles = vectoangles2(
-                               '1 0 0' * v_forward_x * trace_plane_normal_z
+                               '1 0 0' * v_forward.x * trace_plane_normal.z
                                +
-                               '0 1 0' * v_forward_y * 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),
+                               '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y),
                                trace_plane_normal
                                );
        }
@@ -367,8 +427,8 @@ void RaceCarPhysics()
                vel_local_y = v_right * self.velocity;
                vel_local_z = v_up * self.velocity;
 
-               self.angles_x = racecar_angle(vel_local_x, vel_local_z);
-               self.angles_z = racecar_angle(-vel_local_y, vel_local_z);
+               self.angles_x = racecar_angle(vel_local.x, vel_local.z);
+               self.angles_z = racecar_angle(-vel_local.y, vel_local.z);
        }
 
        // smooth the angles
@@ -383,15 +443,15 @@ void RaceCarPhysics()
        vf1 = vf1 + v_forward * (1 - f);
        vu1 = vu1 + v_up * (1 - f);
        smoothangles = vectoangles2(vf1, vu1);
-       self.angles_x = -smoothangles_x;
-       self.angles_z =  smoothangles_z;
+       self.angles_x = -smoothangles.x;
+       self.angles_z =  smoothangles.z;
 }
 
 float IsMoveInDirection(vector mv, float angle) // key mix factor
 {
        if(mv_x == 0 && mv_y == 0)
                return 0; // avoid division by zero
-       angle -= RAD2DEG * atan2(mv_y, mv_x);
+       angle -= RAD2DEG * atan2(mv.y, mv.x);
        angle = remainder(angle, 360) / 45;
        if(angle >  1)
                return 0;
@@ -425,7 +485,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
 #if 0
        // this doesn't play well with analog input
-       if(self.movement_x == 0 || self.movement_y != 0)
+       if(self.movement_x == 0 || self.movement.y != 0)
                return; // can't control movement if not moving forward or backward
        k = 32;
 #else
@@ -436,7 +496,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
        k *= bound(0, wishspeed / autocvar_sv_maxairspeed, 1);
 
-       zspeed = self.velocity_z;
+       zspeed = self.velocity.z;
        self.velocity_z = 0;
        xyspeed = vlen(self.velocity); self.velocity = normalize(self.velocity);
 
@@ -467,7 +527,7 @@ float AdjustAirAccelQW(float accelqw, float factor)
 void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
 {
        float vel_straight;
-       float vel_z;
+       float velZ;
        vector vel_perpend;
        float step;
 
@@ -490,7 +550,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
                wishspeed0 = wishspeed;
 
        vel_straight = self.velocity * wishdir;
-       vel_z = self.velocity_z;
+       velZ = self.velocity.z;
        vel_xy = vec2(self.velocity);
        vel_perpend = vel_xy - vel_straight * wishdir;
 
@@ -538,7 +598,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
                }
        }
 
-       self.velocity = vel_xy + vel_z * '0 0 1';
+       self.velocity = vel_xy + velZ * '0 0 1';
 }
 
 void PM_AirAccelerate(vector wishdir, float wishspeed)
@@ -669,7 +729,7 @@ void SV_PlayerPhysics()
 
        anticheat_physics();
 
-       buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement_x < 0) + 256 * (self.movement_x > 0) + 512 * (self.movement_y < 0) + 1024 * (self.movement_y > 0);
+       buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement.x < 0) + 256 * (self.movement.x > 0) + 512 * (self.movement.y < 0) + 1024 * (self.movement.y > 0);
 
        if(!buttons)
                c = "x";
@@ -723,7 +783,7 @@ void SV_PlayerPhysics()
                        self.angles_x = random() * 360;
                        self.angles_y = random() * 360;
                        // at least I'm not forcing retardedview by also assigning to angles_z
-                       self.fixangle = TRUE;
+                       self.fixangle = true;
                }
        }
 
@@ -752,8 +812,6 @@ void SV_PlayerPhysics()
                bot_think();
        }
 
-       self.items &= ~IT_USING_JETPACK;
-
        if(IS_PLAYER(self))
        {
                if(self.race_penalty)
@@ -763,7 +821,6 @@ void SV_PlayerPhysics()
                not_allowed_to_move = 0;
                if(self.race_penalty)
                        not_allowed_to_move = 1;
-               if(!autocvar_sv_ready_restart_after_countdown)
                if(time < game_starttime)
                        not_allowed_to_move = 1;
 
@@ -799,9 +856,9 @@ void SV_PlayerPhysics()
        {
                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);
+                       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';
@@ -880,7 +937,7 @@ void SV_PlayerPhysics()
        if (!self.fixangle && !g_bugrigs)
        {
                self.angles_x = 0;
-               self.angles_y = self.v_angle_y;
+               self.angles_y = self.v_angle.y;
                self.angles_z = 0;
        }
 
@@ -915,8 +972,8 @@ void SV_PlayerPhysics()
 
        if (self.flags & FL_WATERJUMP )
        {
-               self.velocity_x = self.movedir_x;
-               self.velocity_y = self.movedir_y;
+               self.velocity_x = self.movedir.x;
+               self.velocity_y = self.movedir.y;
                if (time > self.teleport_time || self.waterlevel == WATERLEVEL_NONE)
                {
                        self.flags &= ~FL_WATERJUMP;
@@ -935,7 +992,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                // acceleration
                wishdir = normalize(wishvel);
                wishspeed = vlen(wishvel);
@@ -951,7 +1008,7 @@ void SV_PlayerPhysics()
 
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                if (wishvel == '0 0 0')
                        wishvel = '0 0 -60'; // drift towards bottom
 
@@ -985,7 +1042,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                self.velocity_z += g;
                if (self.ladder_entity.classname == "func_water")
                {
@@ -994,12 +1051,12 @@ void SV_PlayerPhysics()
                                wishvel = wishvel * (self.ladder_entity.speed / f);
 
                        self.watertype = self.ladder_entity.skin;
-                       f = self.ladder_entity.origin_z + self.ladder_entity.maxs_z;
-                       if ((self.origin_z + self.view_ofs_z) < f)
+                       f = self.ladder_entity.origin.z + self.ladder_entity.maxs.z;
+                       if ((self.origin.z + self.view_ofs.z) < f)
                                self.waterlevel = WATERLEVEL_SUBMERGED;
-                       else if ((self.origin_z + (self.mins_z + self.maxs_z) * 0.5) < f)
+                       else if ((self.origin.z + (self.mins.z + self.maxs.z) * 0.5) < f)
                                self.waterlevel = WATERLEVEL_SWIMMING;
-                       else if ((self.origin_z + self.mins_z + 1) < f)
+                       else if ((self.origin.z + self.mins.z + 1) < f)
                                self.waterlevel = WATERLEVEL_WETFEET;
                        else
                        {
@@ -1018,11 +1075,11 @@ void SV_PlayerPhysics()
                        PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
                }
        }
-       else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
+       else if (self.items & IT_USING_JETPACK)
        {
                //makevectors(self.v_angle_y * '0 1 0');
                makevectors(self.v_angle);
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
                // add remaining speed as Z component
                maxairspd = autocvar_sv_maxairspeed*max(1, maxspd_mod);
                // fix speedhacks :P
@@ -1039,10 +1096,10 @@ void SV_PlayerPhysics()
                a_up = autocvar_g_jetpack_acceleration_up;
                a_add = autocvar_g_jetpack_antigravity * autocvar_sv_gravity;
 
-               wishvel_x *= a_side;
-               wishvel_y *= a_side;
-               wishvel_z *= a_up;
-               wishvel_z += a_add;
+               wishvel.x *= a_side;
+               wishvel.y *= a_side;
+               wishvel.z *= a_up;
+               wishvel.z += a_add;
 
                float best;
                best = 0;
@@ -1085,18 +1142,17 @@ void SV_PlayerPhysics()
                //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')) / autocvar_g_jetpack_maxspeed_side, 1);
-               if(wishvel_z - autocvar_sv_gravity > 0)
-                       fz = bound(0, 1 - self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
+               fxy = bound(0, 1 - (self.velocity * normalize(wishvel.x * '1 0 0' + wishvel.y * '0 1 0')) / autocvar_g_jetpack_maxspeed_side, 1);
+               if(wishvel.z - autocvar_sv_gravity > 0)
+                       fz = bound(0, 1 - self.velocity.z / autocvar_g_jetpack_maxspeed_up, 1);
                else
-                       fz = bound(0, 1 + self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
+                       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;
+               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));
@@ -1121,11 +1177,11 @@ void SV_PlayerPhysics()
        {
                // we get here if we ran out of ammo
                if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
-                       sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 
                // walking
-               makevectors(self.v_angle_y * '0 1 0');
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               makevectors(self.v_angle.y * '0 1 0');
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
 
                if(!(self.lastflags & FL_ONGROUND))
                {
@@ -1138,20 +1194,6 @@ void SV_PlayerPhysics()
                        self.jumppadcount = 0;
                }
 
-#ifdef LETS_TEST_FTEQCC
-               if(self.velocity_x || self.velocity_y)
-               {
-                       // good
-               }
-               else
-               {
-                       if(self.velocity_x)
-                               checkclient();
-                       if(self.velocity_y)
-                               checkclient();
-               }
-#endif
-
                v = self.velocity;
                v_z = 0;
                f = vlen(v);
@@ -1204,7 +1246,7 @@ void SV_PlayerPhysics()
                float wishspeed0;
                // we get here if we ran out of ammo
                if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
-                       sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 
                if(maxspd_mod < 1)
                {
@@ -1217,8 +1259,8 @@ void SV_PlayerPhysics()
                        airaccel = autocvar_sv_airaccelerate;
                }
                // airborn
-               makevectors(self.v_angle_y * '0 1 0');
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               makevectors(self.v_angle.y * '0 1 0');
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
                // acceleration
                wishdir = normalize(wishvel);
                wishspeed = wishspeed0 = vlen(wishvel);
@@ -1265,7 +1307,7 @@ void SV_PlayerPhysics()
                                airaccelqw = copysign(1-GeomLerp(1-fabs(self.stat_sv_airaccel_qw), strafity, 1-fabs(self.stat_sv_airstrafeaccel_qw)), ((strafity > 0.5) ? self.stat_sv_airstrafeaccel_qw : self.stat_sv_airaccel_qw));
                        // !CPM
 
-                       if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0)
+                       if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement.x != 0)
                                PM_AirAccelerate(wishdir, wishspeed);
                        else
                                PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, autocvar_sv_airaccel_qw_stretchfactor, autocvar_sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
@@ -1277,9 +1319,9 @@ void SV_PlayerPhysics()
 
        if((g_cts || g_race) && !IS_OBSERVER(self))
        {
-               if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed)
+               if(vlen(self.velocity - self.velocity.z * '0 0 1') > speedaward_speed)
                {
-                       speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1');
+                       speedaward_speed = vlen(self.velocity - self.velocity.z * '0 0 1');
                        speedaward_holder = self.netname;
                        speedaward_uid = self.crypto_idfp;
                        speedaward_lastupdate = time;
@@ -1301,15 +1343,16 @@ void SV_PlayerPhysics()
                }
        }
 
+       // 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)
+       xyspeed = vlen('1 0 0' * self.velocity.x + '0 1 0' * self.velocity.y);
+       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)