X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_physics.qc;h=85d4cd00029c22160f8ab30f1fb36a155115e233;hp=7f43fe66ef9dc2a9d9d17d30106a27791817fdb8;hb=1b2f61baeeff5a7d004fafd3cfdd8269a0338a1e;hpb=6a6e16c95e08e57dd6c1534f12bf95a39db92353 diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 7f43fe66ef..85d4cd0002 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -34,7 +34,15 @@ void 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; + + // we MUST clip velocity here! + float f; + f = self.velocity * trace_plane_normal; + if(f < 0) + self.velocity -= f * trace_plane_normal; + } } mjumpheight = autocvar_sv_jumpvelocity; @@ -104,7 +112,7 @@ void PlayerJump (void) if (!(self.flags & FL_ONGROUND)) return; - if(!sv_pogostick) + if(self.cvar_cl_movement_track_canjump) if (!(self.flags & FL_JUMPRELEASED)) return; @@ -167,12 +175,11 @@ void PlayerJump (void) setanim(self, self.anim_jump, FALSE, TRUE, TRUE); if(g_jump_grunt) - PlayerSound(playersound_jump, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + 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) } - void CheckWaterJump() { local vector start, end; @@ -201,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) { @@ -904,6 +930,7 @@ void SV_PlayerPhysics() } if(self.flags & FL_ONGROUND) + if(self.classname == "player") // no fall sounds for observers thank you very much if(self.wasFlying) { self.wasFlying = 0; @@ -918,9 +945,9 @@ void SV_PlayerPhysics() if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) { if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) - GlobalSound(globalsound_metalfall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND); else - GlobalSound(globalsound_fall, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND); } } } @@ -929,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 ) { @@ -962,7 +972,7 @@ void SV_PlayerPhysics() { RaceCarPhysics(); } - else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY) + else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY) { // noclipping or flying self.flags &~= FL_ONGROUND;