X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Feffects%2Fqc%2Fcasings.qc;h=d0befbb7ed04705feb92bb01e63d291011003bed;hb=34e7f534e2015466228eb3a78c9857741b736dca;hp=6763519ef49b55543bac9a1d150c6054861beccf;hpb=10c0be8573ea4ab40c24c4a4267f445e00b63857;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 6763519ef..d0befbb7e 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -1,3 +1,8 @@ +#include "casings.qh" +#ifdef SVQC +void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity); +#endif + #ifdef IMPLEMENTATION #include @@ -10,11 +15,10 @@ REGISTER_NET_TEMP(casings) #ifdef SVQC -void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner) -{SELFPARAM(); - .entity weaponentity = weaponentities[0]; // TODO: parameter - entity wep = self.(weaponentity); - vector org = self.origin + self.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up; +void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity) +{ + entity wep = casingowner.(weaponentity); + vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up; if (!sound_allowed(MSG_BROADCAST, casingowner)) casingtype |= 0x80; @@ -40,16 +44,16 @@ class(Casing) .float cnt; void Casing_Delete(entity this) { - remove(this); + delete(this); } void Casing_Draw(entity this) { - if (this.move_flags & FL_ONGROUND) + if (IS_ONGROUND(this)) { - this.move_angles_x = 0; - this.move_angles_z = 0; - UNSET_ONGROUND(this); + this.angles_x = 0; + this.angles_z = 0; + //UNSET_ONGROUND(this); } Movetype_Physics_MatchTicrate(this, autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy); @@ -79,23 +83,23 @@ Sound SND_CASINGS_RANDOM() { return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3)); } -void Casing_Touch() -{SELFPARAM(); +void Casing_Touch(entity this, entity toucher) +{ if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { - Casing_Delete(self); + Casing_Delete(this); return; } - if (!self.silent) + if (!this.silent) if (!trace_ent || trace_ent.solid == SOLID_BSP) { - if(vdist(self.velocity, >, 50)) + if(vdist(this.velocity, >, 50)) { - if (time >= self.nextthink) + if (time >= this.nextthink) { Sound s; - switch (self.state) + switch (this.state) { case 1: s = SND_CASINGS_RANDOM(); @@ -105,20 +109,20 @@ void Casing_Touch() break; } - sound (self, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE); + sound (this, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE); } } } - self.nextthink = time + 0.2; + this.nextthink = time + 0.2; } void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce) { if (thisforce.z < 0) thisforce.z = 0; - this.move_velocity = this.move_velocity + thisforce + '0 0 100'; - this.move_flags &= ~FL_ONGROUND; + this.velocity = this.velocity + thisforce + '0 0 100'; + UNSET_ONGROUND(this); } NET_HANDLE(casings, bool isNew) @@ -147,12 +151,11 @@ NET_HANDLE(casings, bool isNew) casing.drawmask = MASK_NORMAL; casing.draw = Casing_Draw; - casing.move_origin = casing.origin; - casing.move_velocity = casing.velocity + 2 * prandomvec(); - casing.move_angles = casing.angles; - casing.move_avelocity = '0 250 0' + 100 * prandomvec(); - casing.move_movetype = MOVETYPE_BOUNCE; - casing.move_touch = Casing_Touch; + if (isNew) IL_PUSH(g_drawables, casing); + casing.velocity = casing.velocity + 2 * prandomvec(); + casing.avelocity = '0 250 0' + 100 * prandomvec(); + set_movetype(casing, MOVETYPE_BOUNCE); + settouch(casing, Casing_Touch); casing.move_time = time; casing.event_damage = Casing_Damage; casing.solid = SOLID_TRIGGER;