X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fgibs.qc;h=0302f184150f81525487e63b5ca272c9052be29e;hb=5efd9a9feabb8a403dc35cef67e1d0cd1941593a;hp=835d14a1ee6f3b6d9336ae96ffdbef27ac6c6cc6;hpb=85119d4a165562bcd7206c151255b8e680000367;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 835d14a1e..0302f1841 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -1,11 +1,23 @@ -.float silent; +#include "gibs.qh" +#include "_all.qh" + +#include "rubble.qh" + +#include "../common/constants.qh" +#include "../common/movetypes/movetypes.qh" +#include "../common/util.qh" + +.float scale; +.float alpha; +.float cnt; +.float gravity; void Gib_Delete() -{ +{SELFPARAM(); remove(self); } -string species_prefix(float specnum) +string species_prefix(int specnum) { switch(specnum) { @@ -20,7 +32,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) { @@ -30,9 +42,9 @@ void Gib_setmodel(entity gib, string mdlname, float specnum) if(specnum != SPECIES_ROBOT_SOLID || mdlname == "models/gibs/chunk.mdl") { if(mdlname == "models/gibs/bloodyskull.md3") - setmodel(gib, "models/gibs/robo.md3"); + setmodel(gib, MDL_GIB_ROBO); else - setmodel(gib, strcat("models/gibs/robo", ftos(floor(random() * 8) + 1), ".md3")); + setmodel(gib, MDL_GIB_ROBO_RANDOM()); if(specnum == SPECIES_ROBOT_SHINY) { gib.skin = 1; @@ -42,13 +54,13 @@ void Gib_setmodel(entity gib, string mdlname, float specnum) break; } default: - setmodel(gib, mdlname); + _setmodel(gib, mdlname); gib.skin = specnum; break; } } -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; @@ -63,7 +75,7 @@ void SUB_RemoveOnNoImpact() } void Gib_Touch() -{ +{SELFPARAM(); // TODO maybe bounce of walls, make more gibs, etc. if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) @@ -74,13 +86,13 @@ void Gib_Touch() if(!self.silent) 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); + pointparticles(_particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10); Gib_Delete(); } void Gib_Draw() -{ +{SELFPARAM(); vector oldorg; oldorg = self.origin; @@ -90,9 +102,9 @@ void Gib_Draw() 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); + trailparticles(self, _particleeffectnum(strcat(species_prefix(self.cnt), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, self.origin); else - trailparticles(self, particleeffectnum(strcat(species_prefix(self.cnt), "TR_BLOOD")), oldorg, self.origin); + trailparticles(self, _particleeffectnum(strcat(species_prefix(self.cnt), EFFECT_TR_BLOOD.eent_eff_name)), oldorg, self.origin); self.renderflags = 0; @@ -109,7 +121,7 @@ void Gib_Draw() } } -void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent) +void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, int specnum, bool destroyontouch, bool issilent) { entity gib; @@ -151,21 +163,22 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector RubbleLimit("gib", autocvar_cl_gibs_maxcount, Gib_Delete); } -void Ent_GibSplash(float isNew) -{ - float amount, type, specnum; +void Ent_GibSplash(bool isNew) +{SELFPARAM(); + int amount, type, specnum; vector org, vel; string specstr; - float issilent; + bool issilent; string gentle_prefix = "morphed_"; - float c, randomvalue; + float randomvalue; + int c; type = ReadByte(); // gibbage type amount = ReadByte() / 16.0; // gibbage amount - org_x = ReadShort() * 4 + 2; - org_y = ReadShort() * 4 + 2; - org_z = ReadShort() * 4 + 2; + org.x = ReadShort() * 4 + 2; + org.y = ReadShort() * 4 + 2; + org.z = ReadShort() * 4 + 2; vel = decompressShortVector(ReadShort()); float cl_gentle_gibs = autocvar_cl_gentle_gibs; @@ -209,7 +222,7 @@ void Ent_GibSplash(float isNew) if(prandom() < amount) TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent); - new_te_bloodshower(particleeffectnum(strcat(specstr, "bloodshower")), org, 1200, amount); + 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); @@ -242,17 +255,17 @@ void Ent_GibSplash(float isNew) } break; case 0x02: - pointparticles(particleeffectnum(strcat(specstr, "blood")), org, vel, amount * 16); + pointparticles(_particleeffectnum(strcat(specstr, "blood")), org, vel, amount * 16); break; case 0x03: if(prandom() < amount) 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); + pointparticles(_particleeffectnum(strcat(gentle_prefix, "damage_dissolve")), org, vel, amount); break; case 0x82: - pointparticles(particleeffectnum(strcat(gentle_prefix, "damage_hit")), org, vel, amount * 16); + pointparticles(_particleeffectnum(strcat(gentle_prefix, "damage_hit")), org, vel, amount * 16); break; case 0x83: // no gibs in gentle mode, sorry @@ -262,25 +275,6 @@ void Ent_GibSplash(float isNew) void GibSplash_Precache() { - precache_model("models/gibs/chunk.mdl"); - precache_model("models/gibs/leg1.md3"); - precache_model("models/gibs/leg2.md3"); - precache_model("models/gibs/chest.md3"); - precache_model("models/gibs/smallchest.md3"); - precache_model("models/gibs/arm.md3"); - precache_model("models/gibs/bloodyskull.md3"); - precache_model("models/gibs/eye.md3"); - - precache_model("models/gibs/robo.md3"); - precache_model("models/gibs/robo1.md3"); - precache_model("models/gibs/robo2.md3"); - precache_model("models/gibs/robo3.md3"); - precache_model("models/gibs/robo4.md3"); - precache_model("models/gibs/robo5.md3"); - precache_model("models/gibs/robo6.md3"); - precache_model("models/gibs/robo7.md3"); - precache_model("models/gibs/robo8.md3"); - precache_sound ("misc/gib.wav"); precache_sound ("misc/gib_splat01.wav"); precache_sound ("misc/gib_splat02.wav");