X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fsv_main.qc;h=eb4bb6b4bc68dbb94a8913e31aa693a4e296d7de;hp=92819c2cf3b8a850be0ba19b0682656652859866;hb=HEAD;hpb=f7e84feee94756e67a20c7f570e85ef8b54cff7b diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index 92819c2c..eb4bb6b4 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -69,13 +69,16 @@ void CreatureFrame (void) // check for falling damage if(!(g_cts && !cvar("g_cts_selfdamage"))) { + // if we are smaller or larger, take more or less falling damage + float scalefac; + scalefac = cvar("g_healthsize") ? pow(self.scale, cvar("g_healthsize_falldamagefactor")) : 1; + dm = vlen(self.oldvelocity) - vlen(self.velocity); // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (self.deadflag) - dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * cvar("g_balance_falldamage_factor"); + dm = (dm - cvar("g_balance_falldamage_deadminspeed") * scalefac) * cvar("g_balance_falldamage_factor"); else - dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); - if(cvar("g_healthsize")) // if we are smaller or larger, we take more or less falling damage - dm *= (1 + cvar("g_healthsize_movementfactor")) - cvar("g_healthsize_movementfactor") * self.scale; + dm = min((dm - cvar("g_balance_falldamage_minspeed") * scalefac) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); + dm /= scalefac; if (dm > 0) Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); else if(vlen(self.velocity) > 100000 && cvar("developer")) @@ -106,25 +109,49 @@ 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 * playersize_macro(self), 1), ATTN_NORM); + + // earthquake effect for nearby players when a macro walks by + if(cvar("g_healthsize_quake_step")) + { + entity head; + for(head = findradius(self.origin, cvar("g_healthsize_quake_step_radius")); head; head = head.chain) + { + if not(head.classname == "player" || head.classname == "spectator") + continue; + if(head == self || head.spectatee_status == num_for_edict(self)) + continue; // not for self + if not(head.flags & FL_ONGROUND) + continue; // we only feel the ground shaking if we are sitting on it + if(head.stat_eaten) + continue; // not for prey + + float shake; + shake = vlen(head.origin - self.origin); + if(shake) + shake = 1 - bound(0, shake / cvar("g_healthsize_quake_step_radius"), 1); + shake *= playersize_macro(self) * cvar("g_healthsize_quake_step"); + + head.punchvector_x += crandom() * shake; + head.punchvector_y += crandom() * shake; + head.punchvector_z += crandom() * shake; + } + } } 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, VOL_BASE); + else + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE); } - - 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", VOL_BASE, ATTN_NORM); } } }