From: Rudolf Polzer Date: Sun, 11 Sep 2011 13:40:31 +0000 (+0200) Subject: factor out player jump checking into a CheckPlayerJump() function X-Git-Tag: xonotic-v0.6.0~40^2~149 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cd3dd8d8b737e0dc7acc0db1f38e1598549f7732;p=xonotic%2Fxonotic-data.pk3dir.git factor out player jump checking into a CheckPlayerJump() function --- diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 7d14fbdae..1ffccefd2 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -180,7 +180,6 @@ void PlayerJump (void) 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) } - void CheckWaterJump() { local vector start, end; @@ -209,6 +208,25 @@ void CheckWaterJump() } } }; +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 + self.flags |= FL_JUMPRELEASED; + + if (self.waterlevel == WATERLEVEL_SWIMMING) + CheckWaterJump (); + self.prevjumpbutton = self.BUTTON_JUMP; +} float racecar_angle(float forward, float down) { @@ -938,24 +956,7 @@ void SV_PlayerPhysics() self.wasFlying = 1; if(self.classname == "player") - { - 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 - self.flags |= FL_JUMPRELEASED; - - if (self.waterlevel == WATERLEVEL_SWIMMING) - CheckWaterJump (); - self.prevjumpbutton = self.BUTTON_JUMP; - } + CheckPlayerJump(); if (self.flags & FL_WATERJUMP ) {