X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_physics.qc;h=fb283bb2a3a488b0bc8bc6d2ed627d7f6917c26a;hb=5310c50bac3297a0f8f21db55e8095921f61c656;hp=1d47536608b3446f97663a2d4906b7091bb0412c;hpb=0c49159d4984f73681c0d54d720ec06dca2c70c7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 1d4753660..fb283bb2a 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -15,15 +15,16 @@ 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 mjumpheight = autocvar_sv_jumpvelocity; @@ -31,7 +32,7 @@ void PlayerJump (void) player_multijump = doublejump; player_jumpheight = mjumpheight; if(MUTATOR_CALLHOOK(PlayerJump)) - return; + return TRUE; doublejump = player_multijump; mjumpheight = player_jumpheight; @@ -54,16 +55,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 * @@ -122,6 +123,7 @@ 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) + return TRUE; } void CheckWaterJump() { @@ -151,11 +153,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) @@ -752,8 +785,6 @@ void SV_PlayerPhysics() bot_think(); } - self.items &= ~IT_USING_JETPACK; - if(IS_PLAYER(self)) { if(self.race_penalty) @@ -763,7 +794,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; @@ -1018,7 +1048,7 @@ 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); @@ -1120,7 +1150,7 @@ 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'); @@ -1189,7 +1219,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) {