]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
Merge branch 'Mario/quickmenu_merge' of http://nl.git.xonotic.org/xonotic/xonotic...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index 3dd91dfb4b4e9239942e718213e4b1de4125e9be..edad6d63f845881338547c06bc59d2a4285a0ce7 100644 (file)
@@ -24,11 +24,11 @@ void PlayerJump (void)
        player_multijump = doublejump;
        if(MUTATOR_CALLHOOK(PlayerJump))
                return;
-               
+
        doublejump = player_multijump;
 
        float mjumpheight;
-       
+
        if (autocvar_sv_doublejump)
        {
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
@@ -106,11 +106,14 @@ void PlayerJump (void)
        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(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)
 }
@@ -136,7 +139,7 @@ void CheckWaterJump()
                {       // 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;
                }
@@ -324,7 +327,7 @@ void RaceCarPhysics()
                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);
@@ -514,9 +517,9 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        }
        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;
@@ -630,7 +633,7 @@ void SV_PlayerPhysics()
        string c;
 
        WarpZone_PlayerPhysics_FixVAngle();
-       
+
        maxspd_mod = 1;
        if(self.ballcarried)
                if(g_nexball)
@@ -744,8 +747,8 @@ void SV_PlayerPhysics()
                        return;
                bot_think();
        }
-       
-       self.items &~= IT_USING_JETPACK;
+
+       self.items &= ~IT_USING_JETPACK;
 
        if(IS_PLAYER(self))
        {
@@ -801,20 +804,20 @@ void SV_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);
@@ -849,6 +852,29 @@ void SV_PlayerPhysics()
                self.angles_z = 0;
        }
 
+       if(self.flags & FL_ONGROUND)
+       if(IS_PLAYER(self)) // no fall sounds for observers thank you very much
+       if(self.wasFlying)
+       {
+               self.wasFlying = 0;
+
+               if(self.waterlevel < WATERLEVEL_SWIMMING)
+               if(time >= self.ladder_time)
+               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 (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS))
+                       {
+                               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+                                       GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+                               else
+                                       GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+                       }
+               }
+       }
+
        if(IsFlying(self))
                self.wasFlying = 1;
 
@@ -861,7 +887,7 @@ void SV_PlayerPhysics()
                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;
                }
        }
@@ -872,7 +898,7 @@ void SV_PlayerPhysics()
        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);
@@ -889,7 +915,7 @@ void SV_PlayerPhysics()
        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;
@@ -912,7 +938,7 @@ void SV_PlayerPhysics()
        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;
@@ -1050,9 +1076,9 @@ void SV_PlayerPhysics()
                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