]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
Merge branch 'Mario/qc_updates' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index d0ddefe35eb0be80e70e6ee5a034585922fad776..337342333c0b0230b6d2362d5c1a4119b79d350a 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;
 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;
+       float doublejump = false;
        float mjumpheight = autocvar_sv_jumpvelocity;
 
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
-               return TRUE;
+               return true;
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
@@ -42,7 +68,7 @@ float PlayerJump (void)
                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)
                {
-                       doublejump = TRUE;
+                       doublejump = true;
 
                        // we MUST clip velocity here!
                        float f;
@@ -55,7 +81,7 @@ float PlayerJump (void)
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
-               return TRUE;
+               return true;
        }
 
        if (!doublejump)
@@ -64,7 +90,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 *
@@ -116,14 +142,14 @@ float PlayerJump (void)
        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()
 {
@@ -132,17 +158,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;
@@ -177,7 +203,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)
@@ -185,7 +211,7 @@ void CheckPlayerJump()
        }
        else
        {
-               self.jetpack_stopped = FALSE;
+               self.jetpack_stopped = false;
                self.items &= ~IT_USING_JETPACK;
        }
        if (!self.BUTTON_JUMP)
@@ -396,9 +422,9 @@ 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);
@@ -422,7 +448,7 @@ void RaceCarPhysics()
 
 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 = remainder(angle, 360) / 45;
@@ -584,7 +610,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)
@@ -667,7 +693,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;
 
@@ -756,7 +782,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;
                }
        }
 
@@ -1058,10 +1084,10 @@ void SV_PlayerPhysics()
                // 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;
@@ -1123,7 +1149,7 @@ void SV_PlayerPhysics()
 
                wishvel.x *= fxy;
                wishvel.y *= fxy;
-               wishvel_z = (wishvel.z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
+               wishvel.z = (wishvel.z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
 
                float fvel;
                fvel = min(1, vlen(wishvel) / best);
@@ -1168,7 +1194,7 @@ void SV_PlayerPhysics()
                }
 
                v = self.velocity;
-               v_z = 0;
+               v.z = 0;
                f = vlen(v);
                if(f > 0)
                {
@@ -1259,7 +1285,7 @@ void SV_PlayerPhysics()
                        {
                                vector curdir;
                                curdir = self.velocity;
-                               curdir_z = 0;
+                               curdir.z = 0;
                                curdir = normalize(curdir);
                                airaccel = airaccel + (autocvar_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
                        }