]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CSQC: use touch accessors
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 12:20:45 +0000 (22:20 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 12:20:45 +0000 (22:20 +1000)
12 files changed:
qcsrc/client/weapons/projectile.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/dpdefs/csprogsdefs.qh

index ea2f5f3d6dc87be3ac19515754715556755dd638..8763ba2379b99817ef5702ff9be0fe744ccd7d70 100644 (file)
@@ -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;
index 0e01e01e0ed9db193be1b1cf0c24135f831482fd..bb954e2eb17640aea3b75c035276c3af1cc16367 100644 (file)
@@ -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;
index a72536b0591420e9dd68382c7c1feeee6d1da68c..eaf725048990991e6416e11cf2bd0490b611f086 100644 (file)
@@ -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)
index c33ccf05baa8740489451e019827d16a776bbadf..96f346164f03c2eb946ed61e57dcec1c4e35957a 100644 (file)
@@ -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;
 
index 33c56216a5d71b8ad053f9c3a05236af65ae5509..6ec82ab6627f8f5ac680da6ed16321891e6ca0eb 100644 (file)
@@ -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)());
                }
     });
 
index ada026df9f93cdc5dc6f3613cb311c455031e97d..7c08c41abc6a8545814f2812252603f7b4df875d 100644 (file)
@@ -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;
index a853fb4e246a6c02e958a0961c50217a76e01a4a..18b72068581d4ca123d056928f11bb83c1a3b7f7 100644 (file)
@@ -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;
index 68e006c2c097ab0d0b6b852a1b877435146ce72f..c4322e94382ed8de8b2cf20418c0935efac2e612 100644 (file)
@@ -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
 }
 
index 1125169011ee6f5c25596ca7df17958f9d842b84..f5feccef0d4b0f4714d79f63a684ff5cf6f59067 100644 (file)
@@ -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
index 474afb2134acfbf4f0af39503c09cd7069908683..c578622e001a8b832abff3b54ee8b0a0ce639335 100644 (file)
@@ -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);
 
index 32999b71adb9c829e57926fb4abb0e92ee2694e6..a09c69f7088eaad47c36f7c1ddcbed27c7abb850 100644 (file)
@@ -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;
index d0125b5e315c83d2a11c57da8a54785b8157211d..f424d1a5de4dcfec5323851cabb41a712eed6adb 100644 (file)
@@ -43,5 +43,6 @@
 
 #define use use1
 .void(entity this, entity actor, entity trigger) use;
+#define touch move_touch
 
 #endif