X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fgibs.qc;h=2d8f48b1a7db5f75517771979f728adea19ef630;hb=bb9450d7c9e2d77e39d5cfcce7a0a74b76de3cf5;hp=b40de4aa90f1f2c479ff55ecac75988224eeb63c;hpb=6e528e497cb051a75dd11966d535f3131d43dd03;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index b40de4aa9..2d8f48b1a 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -1,11 +1,11 @@ -.float silent; +#include "gibs.qh" void Gib_Delete() { remove(self); } -string species_prefix(float specnum) +string species_prefix(int specnum) { switch(specnum) { @@ -20,7 +20,7 @@ string species_prefix(float specnum) } } -void Gib_setmodel(entity gib, string mdlname, float specnum) +void Gib_setmodel(entity gib, string mdlname, int specnum) { switch(specnum) { @@ -48,12 +48,12 @@ void Gib_setmodel(entity gib, string mdlname, float specnum) } } -void new_te_bloodshower (float ef, vector org, float explosionspeed, float howmany) +void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany) { 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, CH_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, ATTEN_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 safeorg, 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, int specnum, bool destroyontouch, bool issilent) { entity gib; @@ -115,7 +121,6 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector gib.solid = SOLID_CORPSE; gib.cnt = specnum; gib.silent = issilent; - gib.team = gibownernum - 1; Gib_setmodel(gib, mdlname, specnum); setsize (gib, '-8 -8 -8', '8 8 8'); @@ -133,9 +138,10 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector org = trace_endpos; } - gib.move_origin = gib.origin = org; + gib.move_origin = org; + setorigin(gib, 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; @@ -145,19 +151,19 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector RubbleLimit("gib", autocvar_cl_gibs_maxcount, Gib_Delete); } -void Ent_GibSplash(float isNew) +void Ent_GibSplash(bool isNew) { - float amount, type, specnum, entnumber; + int amount, type, specnum; vector org, vel; string specstr; - float issilent; - string gentle_prefix; + bool issilent; + string gentle_prefix = "morphed_"; - float c, randomvalue; + float randomvalue; + int c; type = ReadByte(); // gibbage type amount = ReadByte() / 16.0; // gibbage amount - entnumber = ReadByte(); // player num org_x = ReadShort() * 4 + 2; org_y = ReadShort() * 4 + 2; org_z = ReadShort() * 4 + 2; @@ -171,10 +177,8 @@ void Ent_GibSplash(float isNew) { if(cl_gentle_gibs == 2) gentle_prefix = ""; - else if(cl_gentle_gibs == 3) + else if(cl_gentle_gibs == 3) gentle_prefix = "happy_"; - else - gentle_prefix = "morphed_"; } else if(autocvar_cl_particlegibs) { @@ -182,7 +186,7 @@ void Ent_GibSplash(float isNew) gentle_prefix = "particlegibs_"; } - if not(cl_gentle_gibs || autocvar_cl_gentle) + if (!(cl_gentle_gibs || autocvar_cl_gentle)) amount *= 1 - autocvar_cl_nogibs; if(autocvar_ekg) @@ -191,7 +195,7 @@ void Ent_GibSplash(float isNew) if(amount <= 0 || !isNew) return; - self.origin = org; // for the sounds + setorigin(self, org); // for the sounds specnum = (type & 0x78) / 8; // blood/gibmodel type: using four bits (0..7, bit indexes 3,4,5) issilent = (type & 0x40); @@ -202,40 +206,40 @@ void Ent_GibSplash(float isNew) { case 0x01: if(!issilent) - sound (self, CH_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_PAIN, "misc/gib.wav", VOL_BASE, ATTEN_NORM); if(prandom() < amount) - TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent, entnumber); + TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent); new_te_bloodshower(particleeffectnum(strcat(specstr, "bloodshower")), org, 1200, amount); if(prandom() < amount) - TossGib ("models/gibs/bloodyskull.md3", org, 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); for(c = 0; c < amount; ++c) { randomvalue = amount - c; if(prandom() < randomvalue) - TossGib ("models/gibs/arm.md3", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/arm.md3", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/chest.md3", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/smallchest.md3", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/leg1.md3", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/leg2.md3", org, 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); // these splat on impact if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org, 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); if(prandom() < randomvalue) - TossGib ("models/gibs/chunk.mdl", org, 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); } break; case 0x02: @@ -243,7 +247,7 @@ void Ent_GibSplash(float isNew) break; case 0x03: if(prandom() < amount) - TossGib ("models/gibs/chunk.mdl", org, 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); // TODO maybe adjust to more randomization? break; case 0x81: pointparticles(particleeffectnum(strcat(gentle_prefix, "damage_dissolve")), org, vel, amount);