From: MirceaKitsune Date: Sat, 3 Mar 2012 14:06:54 +0000 (+0200) Subject: Make the feature dependent on g_healthsize X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f7e84feee94756e67a20c7f570e85ef8b54cff7b;p=voretournament%2Fvoretournament.git Make the feature dependent on g_healthsize --- diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index 3d682845..bcf1c1d8 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -2605,10 +2605,14 @@ void defer(float fdelay, void() func) // returns 1 if player is at minimum size and 0 if player is at normal size float playersize_micro(entity e) { + if(!cvar("g_healthsize")) + return 0; return bound(0, (e.health / cvar("g_healthsize_center") - 1) / (cvar("g_healthsize_min") / cvar("g_healthsize_center") - 1), 1); } // returns 0 if player is at normal size and 1 if player is at maximum size float playersize_macro(entity e) { + if(!cvar("g_healthsize")) + return 0; return bound(0, (e.health / cvar("g_healthsize_max") - 1) / (cvar("g_healthsize_center") / cvar("g_healthsize_max") - 1), 1); } diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index fc146744..92819c2c 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -106,10 +106,23 @@ void CreatureFrame (void) */ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) { + float micro_to_normal, normal_to_macro; + if(cvar("g_healthsize")) + { + micro_to_normal = 1 - playersize_micro(self); + normal_to_macro = playersize_macro(self); + } + 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 - playersize_micro(self)), 1)); + 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 * (1 - playersize_micro(self)), 1)); + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1)); //sound(self, CHAN_AUTO, "misc/macro_footstep.wav", VOL_BASE, ATTN_NORM); }