-#ifdef IMPLEMENTATION
+#include "gibs.qh"
+
REGISTER_NET_TEMP(net_gibsplash)
#ifdef SVQC
}
void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
-{SELFPARAM();
+{
if(g_cts) // no gibs in CTS
return;
e.state = type; // should stay smaller than 15
if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker))
e.state |= 0x40; // "silence" bit
- e.state |= 8 * self.species; // gib type, ranges from 0 to 15
+ e.state |= 8 * gibowner.species; // gib type, ranges from 0 to 15
// if this is a copied dead body, send the num of its player instead
// TODO: remove this field, read from model txt files
- if(self.classname == "body")
- e.team = num_for_edict(self.enemy);
+ if(gibowner.classname == "body")
+ e.team = etof(gibowner.enemy);
else
- e.team = num_for_edict(self);
+ e.team = etof(gibowner);
setorigin(e, org);
e.velocity = dir;
e.oldorigin_x = compressShortVector(e.velocity);
- entity cl; FOR_EACH_REALCLIENT(cl) Violence_GibSplash_SendEntity(e, cl, 0);
- remove(e);
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), Violence_GibSplash_SendEntity(e, it, 0));
+ delete(e);
}
void Violence_GibSplash(entity source, float type, float amount, entity attacker)
.bool silent;
#include "rubble.qh"
-#include "../common/movetypes/movetypes.qh"
+#include <common/physics/movetypes/movetypes.qh>
.float scale;
.float alpha;
.float cnt;
.float gravity;
-void Gib_Delete()
-{SELFPARAM();
- remove(self);
+void Gib_Delete(entity this)
+{
+ delete(this);
}
string species_prefix(int specnum);
__pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50);
}
-void SUB_RemoveOnNoImpact()
+void SUB_RemoveOnNoImpact(entity this, entity toucher)
{
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
- Gib_Delete();
+ Gib_Delete(this);
}
-void Gib_Touch()
-{SELFPARAM();
+void Gib_Touch(entity this, entity toucher)
+{
// TODO maybe bounce of walls, make more gibs, etc.
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
- Gib_Delete();
+ Gib_Delete(this);
return;
}
- if(!self.silent)
- sound(self, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM);
- __pointparticles(_particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10);
+ if(!this.silent)
+ sound(this, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM);
+ __pointparticles(_particleeffectnum(strcat(species_prefix(this.cnt), "blood")), this.origin + '0 0 1', '0 0 30', 10);
- Gib_Delete();
+ Gib_Delete(this);
}
void Gib_Draw(entity this)
{
vector oldorg;
- oldorg = self.origin;
+ oldorg = this.origin;
- Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
- if(wasfreed(self))
+ Movetype_Physics_MatchTicrate(this, autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
+ if(wasfreed(this))
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), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, self.origin);
+ if(gettouch(this) == Gib_Touch) // don't do this for the "chunk" thingie...
+ // TODO somehow make it spray in a direction dependent on this.angles
+ __trailparticles(this, _particleeffectnum(strcat(species_prefix(this.cnt), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, this.origin);
else
- __trailparticles(self, _particleeffectnum(strcat(species_prefix(self.cnt), EFFECT_TR_BLOOD.eent_eff_name)), oldorg, self.origin);
+ __trailparticles(this, _particleeffectnum(strcat(species_prefix(this.cnt), EFFECT_TR_BLOOD.eent_eff_name)), oldorg, this.origin);
- self.renderflags = 0;
+ this.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);
+ this.nextthink -= frametime * (1 / bound(0.01, view_quality, 1.00) - 1);
- self.alpha = bound(0, self.nextthink - time, 1);
+ this.alpha = bound(0, this.nextthink - time, 1);
- if(self.alpha < ALPHA_MIN_VISIBLE)
+ if(this.alpha < ALPHA_MIN_VISIBLE)
{
- self.drawmask = 0;
- Gib_Delete();
+ this.drawmask = 0;
+ Gib_Delete(this);
}
}
// TODO remove some gibs according to cl_nogibs
gib = RubbleNew("gib");
- gib.move_movetype = MOVETYPE_BOUNCE;
+ set_movetype(gib, MOVETYPE_BOUNCE);
gib.gravity = 1;
gib.solid = SOLID_CORPSE;
gib.cnt = specnum;
setsize (gib, '-8 -8 -8', '8 8 8');
gib.draw = Gib_Draw;
+ IL_PUSH(g_drawables, gib);
if(destroyontouch)
- gib.move_touch = Gib_Touch;
+ settouch(gib, Gib_Touch);
else
- gib.move_touch = SUB_RemoveOnNoImpact;
+ settouch(gib, SUB_RemoveOnNoImpact);
// don't spawn gibs inside solid - just don't
if(org != safeorg)
org = trace_endpos;
}
- 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) * autocvar_cl_gibs_avelocity_scale;
+ gib.velocity = vconst * autocvar_cl_gibs_velocity_scale + vrand * autocvar_cl_gibs_velocity_random + '0 0 1' * autocvar_cl_gibs_velocity_up;
+ gib.avelocity = prandomvec() * vlen(gib.velocity) * autocvar_cl_gibs_avelocity_scale;
gib.move_time = time;
gib.damageforcescale = autocvar_cl_gibs_damageforcescale;
// no gibs in gentle mode, sorry
break;
}
- remove(this);
+ delete(this);
}
#endif
-
-#endif