From: TimePath Date: Thu, 3 Dec 2015 08:22:39 +0000 (+1100) Subject: Player_Footsteps: move to physics X-Git-Tag: xonotic-v0.8.2~1576 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3f492ed6c57f81f20a8abe03ac92aafeefde1ec1;p=xonotic%2Fxonotic-data.pk3dir.git Player_Footsteps: move to physics --- diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 2fd3dbaa7..ad795a2b6 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -742,8 +742,6 @@ void PM_check_frozen(entity this) void PM_check_hitground(entity this) { #ifdef SVQC - if (!IS_PLAYER(this)) return; // no fall sounds for observers thank you very much - if (!IS_ONGROUND(this)) return; if (!this.wasFlying) return; this.wasFlying = false; if (this.waterlevel >= WATERLEVEL_SWIMMING) return; @@ -752,9 +750,32 @@ void PM_check_hitground(entity this) this.nextstep = time + 0.3 + random() * 0.1; trace_dphitq3surfaceflags = 0; tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this); - if ((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)) return; - entity fall = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) ? GS_FALL_METAL : GS_FALL; - GlobalSound(this, fall, CH_PLAYER, VOICETYPE_PLAYERSOUND); + if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) return; + entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) + ? GS_FALL_METAL + : GS_FALL; + GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND); +#endif +} + +void PM_Footsteps(entity this) +{ +#ifdef SVQC + if (!g_footsteps) return; + if (IS_DUCKED(this)) return; + if (time >= this.lastground + 0.2) return; + if (vdist(this.velocity, <=, autocvar_sv_maxspeed * 0.6)) return; + if ((time > this.nextstep) || (time < (this.nextstep - 10.0))) + { + this.nextstep = time + 0.3 + random() * 0.1; + trace_dphitq3surfaceflags = 0; + tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this); + if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) return; + entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) + ? GS_STEP_METAL + : GS_STEP; + GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND); + } #endif } @@ -1398,7 +1419,11 @@ void PM_Main(entity this) this.angles = '0 1 0' * this.v_angle.y; #endif - PM_check_hitground(this); + if (IS_PLAYER(this) && IS_ONGROUND(this)) + { + PM_check_hitground(this); + PM_Footsteps(this); + } if(IsFlying(this)) this.wasFlying = 1; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 9ba9cb1b2..e63a9afbc 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2520,34 +2520,6 @@ void PlayerPreThink () self.clip_load = self.clip_size = 0; } -void Player_Footsteps(entity this) -{ - // play stupid sounds - if (g_footsteps && !gameover && (this.flags & FL_ONGROUND)) - if (!this.crouch && (vlen(this.velocity) > autocvar_sv_maxspeed * 0.6) && this.deadflag == DEAD_NO && time < this.lastground + 0.2) - { - if((time > this.nextstep) || (time < (this.nextstep - 10.0))) - { - this.nextstep = time + 0.3 + random() * 0.1; - trace_dphitq3surfaceflags = 0; - tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this); - /* - if(trace_fraction == 1) - dprint("nohit\n"); - else - dprint(ftos(trace_dphitq3surfaceflags), "\n"); - */ - if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)) - { - if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) - GlobalSound(this, GS_STEP_METAL, CH_PLAYER, VOICETYPE_PLAYERSOUND); - else - GlobalSound(this, GS_STEP, CH_PLAYER, VOICETYPE_PLAYERSOUND); - } - } - } -} - void DrownPlayer(entity this) { if(this.deadflag != DEAD_NO) @@ -2622,7 +2594,6 @@ void PlayerPostThink () if(IS_PLAYER(self)) { DrownPlayer(self); - Player_Footsteps(self); CheckRules_Player(); UpdateChatBubble(); if (self.impulse)