]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
Merge branch 'master' into Mario/physics
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index 2e29f88b7acee6991c154e4b8f8d133661b6db5b..81c3cfd8b2719b9a66fd837950b210c6c9cd45fd 100644 (file)
@@ -1,3 +1,29 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.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;
 
@@ -5,7 +31,7 @@
 .entity ladder_entity;
 .float gravity;
 .float swamp_slowdown;
-.float lastflags;
+.int lastflags;
 .float lastground;
 .float wasFlying;
 .float spectatorspeed;
@@ -39,24 +65,24 @@ float Physics_ClientOption(entity pl, string option)
 PlayerJump
 
 When you press the jump key
-returns TRUE if handled
+returns true if handled
 =============
 */
 float PlayerJump (void)
 {
        if(self.frozen)
-               return TRUE; // no jumping in freezetag when frozen
+               return true; // no jumping in freezetag when frozen
 
        if(self.player_blocked)
-               return TRUE; // no jumping while blocked
+               return true; // no jumping while blocked
 
-       float doublejump = FALSE;
+       bool doublejump = false;
        float mjumpheight = self.stat_sv_jumpvelocity;
 
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
-               return TRUE;
+               return true;
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
@@ -64,9 +90,9 @@ float 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;
@@ -79,7 +105,7 @@ float PlayerJump (void)
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
-               return TRUE;
+               return true;
        }
 
        if (!doublejump)
@@ -88,7 +114,7 @@ float PlayerJump (void)
 
        if(self.cvar_cl_movement_track_canjump)
                if (!(self.flags & FL_JUMPRELEASED))
-                       return TRUE;
+                       return true;
 
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
@@ -100,8 +126,8 @@ float 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 != "")
@@ -109,14 +135,14 @@ float 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;
                }
        }
 
@@ -134,20 +160,20 @@ float 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;
+       return true;
 }
 void CheckWaterJump()
 {
@@ -156,17 +182,17 @@ void CheckWaterJump()
 // check for a jump-out-of-water
        makevectors (self.angles);
        start = self.origin;
-       start_z = start_z + 8;
-       v_forward_z = 0;
+       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;
@@ -201,7 +227,7 @@ void CheckPlayerJump()
                                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.jetpack_stopped = true;
                        self.items &= ~IT_USING_JETPACK;
                }
                else if (activate && !self.frozen)
@@ -209,7 +235,7 @@ void CheckPlayerJump()
        }
        else
        {
-               self.jetpack_stopped = FALSE;
+               self.jetpack_stopped = false;
                self.items &= ~IT_USING_JETPACK;
        }
        if (!self.BUTTON_JUMP)
@@ -248,8 +274,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)
        {
@@ -349,7 +375,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)
@@ -365,7 +391,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)
                {
@@ -379,11 +405,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;
                }
@@ -398,7 +424,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;
        }
@@ -408,11 +434,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
                                );
        }
@@ -420,12 +446,12 @@ void RaceCarPhysics()
        {
                vector vel_local;
 
-               vel_local_x = v_forward * self.velocity;
-               vel_local_y = v_right * self.velocity;
-               vel_local_z = v_up * self.velocity;
+               vel_local.x = v_forward * self.velocity;
+               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
@@ -440,15 +466,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)
+       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;
@@ -482,7 +508,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
@@ -493,7 +519,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
        k *= bound(0, wishspeed / self.stat_sv_maxairspeed, 1);
 
-       zspeed = self.velocity_z;
+       zspeed = self.velocity.z;
        self.velocity_z = 0;
        xyspeed = vlen(self.velocity); self.velocity = normalize(self.velocity);
 
@@ -524,7 +550,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;
 
@@ -547,7 +573,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;
 
@@ -595,7 +621,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)
@@ -608,7 +634,7 @@ void PM_AirAccelerate(vector wishdir, float wishspeed)
                return;
 
        curvel = self.velocity;
-       curvel_z = 0;
+       curvel.z = 0;
        curspeed = vlen(curvel);
 
        if(wishspeed > curspeed * 1.01)
@@ -691,7 +717,7 @@ void SV_PlayerPhysics()
        vector wishvel, wishdir, v;
        float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod, buttons;
        string temps;
-       float buttons_prev;
+       int buttons_prev;
        float not_allowed_to_move;
        string c;
 
@@ -747,7 +773,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";
@@ -801,7 +827,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;
                }
        }
 
@@ -839,7 +865,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;
 
@@ -875,9 +900,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';
@@ -956,7 +981,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;
        }
 
@@ -991,8 +1016,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;
@@ -1011,7 +1036,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * self.stat_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);
@@ -1027,7 +1052,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
 
@@ -1061,7 +1086,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * self.stat_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")
                {
@@ -1070,12 +1095,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
                        {
@@ -1098,16 +1123,16 @@ void SV_PlayerPhysics()
        {
                //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 = self.stat_sv_maxairspeed*max(1, maxspd_mod);
                // fix speedhacks :P
                wishvel = normalize(wishvel) * min(vlen(wishvel) / maxairspd, 1);
                // add the unused velocity as up component
-               wishvel_z = 0;
+               wishvel.z = 0;
 
                // if(self.BUTTON_JUMP)
-                       wishvel_z = sqrt(max(0, 1 - wishvel * wishvel));
+                       wishvel.z = sqrt(max(0, 1 - wishvel * wishvel));
 
                // it is now normalized, so...
                float a_side, a_up, a_add, a_diff;
@@ -1115,10 +1140,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;
@@ -1161,15 +1186,15 @@ 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);
 
-               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);
@@ -1199,8 +1224,8 @@ void SV_PlayerPhysics()
                        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))
                {
@@ -1214,7 +1239,7 @@ void SV_PlayerPhysics()
                }
 
                v = self.velocity;
-               v_z = 0;
+               v.z = 0;
                f = vlen(v);
                if(f > 0)
                {
@@ -1278,8 +1303,8 @@ void SV_PlayerPhysics()
                        airaccel = self.stat_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);
@@ -1305,7 +1330,7 @@ void SV_PlayerPhysics()
                        {
                                vector curdir;
                                curdir = self.velocity;
-                               curdir_z = 0;
+                               curdir.z = 0;
                                curdir = normalize(curdir);
                                airaccel = airaccel + (self.stat_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
                        }
@@ -1326,7 +1351,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(self.stat_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0)
+                       if(self.stat_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement.x != 0)
                                PM_AirAccelerate(wishdir, wishspeed);
                        else
                                PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, self.stat_sv_airaccel_qw_stretchfactor, self.stat_sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
@@ -1338,9 +1363,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;
@@ -1364,7 +1389,7 @@ void SV_PlayerPhysics()
 
        // WEAPONTODO
        float xyspeed;
-       xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
+       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