From: MirceaKitsune Date: Sat, 3 Mar 2012 14:14:23 +0000 (+0200) Subject: Improve code in the last commit X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=839103a349de3a9e9facce149197a8e767ef147d;p=voretournament%2Fvoretournament.git Improve code in the last commit --- diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index e2f26c8c..25eaaf93 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -106,25 +106,22 @@ void CreatureFrame (void) */ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) { - float micro_to_normal, normal_to_macro; + // if healthsize is enabled, play effects based on player size if(cvar("g_healthsize")) { - micro_to_normal = 1 - playersize_micro(self); - normal_to_macro = playersize_macro(self); + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) + GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1)); + else + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1)); + sound(self, CHAN_AUTO, "misc/macro_footstep.wav", bound(0, VOL_BASE * normal_to_macro, 1), ATTN_NORM); } else { - // healthsize is disabled, always play normal sounds - micro_to_normal = 1; - normal_to_macro = 0; + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) + GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE, 1)); + else + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE, 1)); } - - if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) - GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1)); - else - GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1)); - - sound(self, CHAN_AUTO, "misc/macro_footstep.wav", bound(0, VOL_BASE * normal_to_macro, 1), ATTN_NORM); } } }