X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fgibs.qc;h=a93f62d830b0bd818df3b3967ccd2e377a8ad6ca;hp=b899eb22c85900834c97a55cfd83ba969d83de58;hb=c6c371883dde697e1f237d498c08e09788b6af6b;hpb=84b6651f9766fecf9fac970fb6856ee06452e76d diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index b899eb22c8..a93f62d830 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -52,8 +52,8 @@ void new_te_bloodshower (float ef, vector org, float explosionspeed, float howma { float i, pmod; pmod = autocvar_cl_particles_quality; - for (i = 0; i < 250 * pmod; ++i) - pointparticles(ef, org, randomvec() * explosionspeed, howmany / 250); + for (i = 0; i < 50 * pmod; ++i) + pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50); } void SUB_RemoveOnNoImpact() @@ -73,7 +73,7 @@ void Gib_Touch() } if(!self.silent) - sound(self, CHAN_PAIN, strcat("misc/gib_splat0", ftos(floor(prandom() * 4 + 1)), ".wav"), VOL_BASE, ATTN_NORM); + sound(self, CH_PAIN, strcat("misc/gib_splat0", ftos(floor(prandom() * 4 + 1)), ".wav"), VOL_BASE, ATTN_NORM); pointparticles(particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10); Gib_Delete(); @@ -89,11 +89,17 @@ void Gib_Draw() return; if(self.touch == Gib_Touch) // don't do this for the "chunk" thingie... + // TODO somehow make it spray in a direction dependent on self.angles trailparticles(self, particleeffectnum(strcat(species_prefix(self.cnt), "TR_SLIGHTBLOOD")), oldorg, self.origin); else trailparticles(self, particleeffectnum(strcat(species_prefix(self.cnt), "TR_BLOOD")), oldorg, self.origin); self.renderflags = 0; + + // make gibs die faster at low view quality + // if view_quality is 0.5, we want to have them die twice as fast + self.nextthink -= frametime * (1 / bound(0.01, view_quality, 1.00) - 1); + self.alpha = bound(0, self.nextthink - time, 1); if(self.alpha < ALPHA_MIN_VISIBLE) @@ -103,7 +109,7 @@ void Gib_Draw() } } -void TossGib (string mdlname, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent, float gibownernum) +void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent, float gibownernum) { entity gib; @@ -115,7 +121,7 @@ void TossGib (string mdlname, vector org, vector vconst, vector vrand, float spe gib.solid = SOLID_CORPSE; gib.cnt = specnum; gib.silent = issilent; - gib.team = gibownernum; + gib.team = gibownernum - 1; Gib_setmodel(gib, mdlname, specnum); setsize (gib, '-8 -8 -8', '8 8 8'); @@ -126,9 +132,16 @@ void TossGib (string mdlname, vector org, vector vconst, vector vrand, float spe else gib.move_touch = SUB_RemoveOnNoImpact; + // don't spawn gibs inside solid - just don't + if(org != safeorg) + { + tracebox(safeorg, gib.mins, gib.maxs, org, MOVE_NOMONSTERS, gib); + org = trace_endpos; + } + gib.move_origin = gib.origin = org; gib.move_velocity = vconst * autocvar_cl_gibs_velocity_scale + vrand * autocvar_cl_gibs_velocity_random + '0 0 1' * autocvar_cl_gibs_velocity_up; - gib.move_avelocity = prandomvec() * vlen(gib.move_velocity); + gib.move_avelocity = prandomvec() * vlen(gib.move_velocity) * autocvar_cl_gibs_avelocity_scale; gib.move_time = time; gib.damageforcescale = autocvar_cl_gibs_damageforcescale; @@ -195,40 +208,40 @@ void Ent_GibSplash(float isNew) { case 0x01: if(!issilent) - sound (self, CHAN_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM); if(prandom() < amount) - TossGib ("models/gibs/eye.md3", org, vel, prandomvec() * 150, specnum, 0, issilent, entnumber); + TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent, entnumber); new_te_bloodshower(particleeffectnum(strcat(specstr, "bloodshower")), org, 1200, amount); if(prandom() < amount) - TossGib ("models/gibs/bloodyskull.md3", org + 16 * prandomvec(), vel, prandomvec() * 100, specnum, 0, issilent, entnumber); + TossGib ("models/gibs/bloodyskull.md3", org, org + 16 * prandomvec(), vel, prandomvec() * 100, specnum, 0, issilent, entnumber); for(c = 0; c < amount; ++c) { randomvalue = amount - c; if(prandom() < randomvalue) - TossGib ("models/gibs/arm.md3", org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber); + TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/arm.md3", org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber); + TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/chest.md3", org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber); + TossGib ("models/gibs/chest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/smallchest.md3", org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber); + TossGib ("models/gibs/smallchest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/leg1.md3", org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber); + TossGib ("models/gibs/leg1.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/leg2.md3", org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber); + TossGib ("models/gibs/leg2.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber); // these splat on impact if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); + TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); + TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); + TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); + TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber); } break; case 0x02: @@ -236,7 +249,7 @@ void Ent_GibSplash(float isNew) break; case 0x03: if(prandom() < amount) - TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * (prandom() * 30 + 20), specnum, 1, issilent, entnumber); // TODO maybe adjust to more randomization? + TossGib ("models/gibs/chunk.mdl", org, org, vel, prandomvec() * (prandom() * 30 + 20), specnum, 1, issilent, entnumber); // TODO maybe adjust to more randomization? break; case 0x81: pointparticles(particleeffectnum(strcat(gentle_prefix, "damage_dissolve")), org, vel, amount); @@ -277,56 +290,3 @@ void GibSplash_Precache() precache_sound ("misc/gib_splat03.wav"); precache_sound ("misc/gib_splat04.wav"); } - -void Ent_DamageEffect() -{ - float type, specnum1, specnum2, entnumber; - vector org; - string specstr, effectnum; - entity e; - - type = ReadByte(); // damage weapon - specnum1 = ReadByte(); // player species - entnumber = ReadByte(); // player entnum - org_x = ReadCoord(); - org_y = ReadCoord(); - org_z = ReadCoord(); - - if not(autocvar_cl_damageeffect) - return; - if(autocvar_cl_gentle || autocvar_cl_gentle_damage) - return; - // if we aren't in third person mode, hide our own damage effect - if(entnumber == player_localentnum && !autocvar_chase_active) - return; - - e = get_weaponinfo(type); - - specnum2 = (specnum1 & 0x78) / 8; // blood type: using four bits (0..7, bit indexes 3,4,5) - specstr = species_prefix(specnum2); - - effectnum = strcat("weapondamage_", e.netname); - // If the weapon is a bullet weapon, its damage effect is blood. - // Since blood is species dependent, we make this effect per-species. - if(type == WEP_SHOTGUN || type == WEP_UZI || type == WEP_SNIPERRIFLE) - if(specstr != "") - { - effectnum = strcat(effectnum, "_", specstr); - effectnum = substring(effectnum, 0, strlen(effectnum) - 1); // remove the _ symbol at the end of the species name - } - - entity head; - - // Scan the owner of all gibs in the world. If a gib owner is the same as the player we're applying the - // effect to, it means our player is gibbed. Therefore, apply the particles to the gibs as well. - for(head = world; (head = find(head, classname, "gib")); ) - { - if(head.team == entnumber) - if(random() < autocvar_cl_damageeffect_gib_probability) - pointparticles(particleeffectnum(effectnum), head.origin, '0 0 0', autocvar_cl_damageeffect); - } - - // Now apply the effect to the player. This shouldn't be done on gibbed bodies, but there's no way - // to tell between them and the respawned player, if both have damage effects at the same time. - pointparticles(particleeffectnum(effectnum), org, '0 0 0', autocvar_cl_damageeffect); -}