From 37dfbfc77bea086b24dc33a35464700fdb92d3db Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 22 May 2016 22:20:45 +1000 Subject: [PATCH] CSQC: use touch accessors --- qcsrc/client/weapons/projectile.qc | 16 ++++++++-------- qcsrc/common/effects/qc/casings.qc | 2 +- qcsrc/common/effects/qc/gibs.qc | 4 ++-- qcsrc/common/mutators/mutator/nades/nades.qc | 2 +- qcsrc/common/physics/movetypes/movetypes.qc | 12 ++++++------ qcsrc/common/physics/movetypes/movetypes.qh | 1 - qcsrc/common/triggers/func/ladder.qc | 2 +- qcsrc/common/triggers/teleporters.qc | 5 +---- qcsrc/common/triggers/trigger/impulse.qc | 6 +++--- qcsrc/common/triggers/trigger/jumppads.qc | 2 +- qcsrc/common/triggers/trigger/swamp.qc | 2 +- qcsrc/dpdefs/csprogsdefs.qh | 1 + 12 files changed, 26 insertions(+), 29 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index ea2f5f3d6..8763ba237 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -337,7 +337,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.mins = '0 0 0'; this.maxs = '0 0 0'; this.colormod = '0 0 0'; - this.move_touch = SUB_Stop_self; + settouch(this, SUB_Stop_self); this.move_movetype = MOVETYPE_TOSS; this.alphamod = 1; @@ -349,7 +349,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.mins = '0 0 -4'; this.maxs = '0 0 -4'; this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); this.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor); this.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop); break; @@ -367,7 +367,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.mins = '-3 -3 -3'; this.maxs = '3 3 3'; this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); this.move_bounce_factor = WEP_CVAR(mortar, bouncefactor); this.move_bounce_stopspeed = WEP_CVAR(mortar, bouncestop); break; @@ -385,21 +385,21 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.colormod = '2 1 1'; this.alphamod = 0.5; this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); break; case PROJECTILE_PORTO_BLUE: this.colormod = '1 1 2'; this.alphamod = 0.5; this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); break; case PROJECTILE_HAGAR_BOUNCING: this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); break; case PROJECTILE_CRYLINK_BOUNCING: this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); break; case PROJECTILE_FIREBALL: loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM); @@ -409,7 +409,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) case PROJECTILE_FIREMINE: loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM); this.move_movetype = MOVETYPE_BOUNCE; - this.move_touch = func_null; + settouch(this, func_null); this.mins = '-4 -4 -4'; this.maxs = '4 4 4'; break; diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 0e01e01e0..bb954e2eb 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -156,7 +156,7 @@ NET_HANDLE(casings, bool isNew) casing.move_angles = casing.angles; casing.move_avelocity = '0 250 0' + 100 * prandomvec(); casing.move_movetype = MOVETYPE_BOUNCE; - casing.move_touch = Casing_Touch; + settouch(casing, Casing_Touch); casing.move_time = time; casing.event_damage = Casing_Damage; casing.solid = SOLID_TRIGGER; diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index a72536b05..eaf725048 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -182,9 +182,9 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector gib.draw = Gib_Draw; 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) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index c33ccf05b..96f346164 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -84,7 +84,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile) } self.colormod = nade_type.m_color; self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; + settouch(self, func_null); self.scale = 1.5; self.avelocity = randomvec() * 720; diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 33c56216a..6ec82ab66 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -317,20 +317,20 @@ void _Movetype_Impact(entity this, entity oth) // SV_Impact { entity oldother = other; - if(this.move_touch) + if(gettouch(this)) { other = oth; - WITHSELF(this, this.move_touch()); + WITHSELF(this, gettouch(this)()); other = oldother; } - if(oth.move_touch) + if(gettouch(oth)) { other = this; - WITHSELF(oth, oth.move_touch()); + WITHSELF(oth, gettouch(oth)()); other = oldother; } @@ -346,7 +346,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr FOREACH_ENTITY_RADIUS(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, { if (it.solid == SOLID_TRIGGER && it != this) if (it.move_nomonsters != MOVE_NOMONSTERS && it.move_nomonsters != MOVE_WORLDONLY) - if (it.move_touch && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) + if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) { other = this; @@ -360,7 +360,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr trace_plane_dist = 0; trace_ent = this; - WITHSELF(it, it.move_touch()); + WITHSELF(it, gettouch(it)()); } }); diff --git a/qcsrc/common/physics/movetypes/movetypes.qh b/qcsrc/common/physics/movetypes/movetypes.qh index ada026df9..7c08c41ab 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qh +++ b/qcsrc/common/physics/movetypes/movetypes.qh @@ -19,7 +19,6 @@ .int move_flags; .int move_watertype; .int move_waterlevel; -.void()move_touch; .void(float, float)contentstransition; .float move_bounce_factor; .float move_bounce_stopspeed; diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index a853fb4e2..18b720685 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -75,7 +75,7 @@ NET_HANDLE(ENT_CLIENT_LADDER, bool isnew) trigger_common_read(this, false); this.solid = SOLID_TRIGGER; - this.move_touch = func_ladder_touch; + settouch(this, func_ladder_touch); this.drawmask = MASK_NORMAL; this.move_time = time; this.entremove = func_ladder_remove; diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 68e006c2c..c4322e943 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -280,12 +280,9 @@ void teleport_findtarget(entity this) } // now enable touch -#ifdef SVQC settouch(this, Teleport_Touch); - +#ifdef SVQC trigger_teleport_link(this); -#elif defined(CSQC) - this.move_touch = Teleport_Touch; #endif } diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index 112516901..f5feccef0 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -231,8 +231,8 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew) this.entremove = trigger_remove_generic; this.move_time = time; - if(this.radius) { this.move_touch = trigger_impulse_touch3; } - else if(this.target) { this.move_touch = trigger_impulse_touch1; } - else { this.move_touch = trigger_impulse_touch2; } + if (this.radius) { settouch(this, trigger_impulse_touch3); } + else if (this.target) { settouch(this, trigger_impulse_touch1); } + else { settouch(this, trigger_impulse_touch2); } } #endif diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 474afb213..c578622e0 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -447,7 +447,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) this.entremove = trigger_remove_generic; this.solid = SOLID_TRIGGER; - this.move_touch = trigger_push_touch; + settouch(this, trigger_push_touch); this.move_time = time; defer(this, 0.25, trigger_push_findtarget); diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index 32999b71a..a09c69f70 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -148,7 +148,7 @@ NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew) this.classname = "trigger_swamp"; this.solid = SOLID_TRIGGER; - this.move_touch = swamp_touch; + settouch(this, swamp_touch); this.drawmask = MASK_NORMAL; this.move_time = time; this.entremove = trigger_remove_generic; diff --git a/qcsrc/dpdefs/csprogsdefs.qh b/qcsrc/dpdefs/csprogsdefs.qh index d0125b5e3..f424d1a5d 100644 --- a/qcsrc/dpdefs/csprogsdefs.qh +++ b/qcsrc/dpdefs/csprogsdefs.qh @@ -43,5 +43,6 @@ #define use use1 .void(entity this, entity actor, entity trigger) use; +#define touch move_touch #endif -- 2.39.2