]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/swamp.qc
Remove SELFPARAM() from .think and .touch
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / swamp.qc
index 474eb24673194a51ea5c182d6195978338ee8048..3a1cf9530b0c44ceed0c5b797f27ae4e38b5ea62 100644 (file)
@@ -1,11 +1,10 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
-       #include "../../../dpdefs/progsdefs.qh"
-    #include "../../../warpzonelib/util_server.qh"
-    #include "../../weapons/weapons.qh"
-    #include "../../../server/defs.qh"
-    #include "../../deathtypes.qh"
+    #include <lib/warpzone/util_server.qh>
+    #include <common/weapons/all.qh>
+    #include <server/defs.qh>
+    #include <common/deathtypes/all.qh>
 #endif
 
 /*
 .entity swampslug;
 
 #ifdef SVQC
-void spawnfunc_trigger_swamp(void);
+spawnfunc(trigger_swamp);
 #endif
-void swamp_touch(void);
-void swampslug_think();
+void swamp_touch(entity this);
+void swampslug_think(entity this);
 
 
 /*
@@ -37,7 +36,7 @@ void swampslug_think();
 *
 * I do it this way becuz there is no "untouch" event.
 */
-void swampslug_think(void)
+void swampslug_think(entity this)
 {
        //Slowly kill the slug
        self.health = self.health - 1;
@@ -55,17 +54,17 @@ void swampslug_think(void)
        // Or we have exited it very recently.
        // Do the damage and renew the timer.
 #ifdef SVQC
-       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
+       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0');
 #endif
 
        self.nextthink = time + self.swamp_interval;
 }
 
-void swamp_touch(void)
+void swamp_touch(entity this)
 {
        // If whatever thats touching the swamp is not a player
        // or if its a dead player, just dont care abt it.
-       if(!IS_PLAYER(other) || PHYS_DEAD(other))
+       if(!IS_PLAYER(other) || IS_DEAD(other))
                return;
 
        EXACTTRIGGER_TOUCH;
@@ -77,7 +76,7 @@ void swamp_touch(void)
                //centerprint(other,"Entering swamp!\n");
                other.swampslug = spawn();
                other.swampslug.health = 2;
-               other.swampslug.think = swampslug_think;
+               setthink(other.swampslug, swampslug_think);
                other.swampslug.nextthink = time;
                other.swampslug.owner = other;
                other.swampslug.dmg = self.dmg;
@@ -93,100 +92,65 @@ void swamp_touch(void)
        other.swampslug.health = 2;
 }
 
+REGISTER_NET_LINKED(ENT_CLIENT_SWAMP)
+
 #ifdef SVQC
-float swamp_send(entity to, float sf)
+float swamp_send(entity this, entity to, float sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
-
-       WriteByte(MSG_ENTITY, self.warpzone_isboxy);
-       WriteByte(MSG_ENTITY, self.scale);
-       WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
-       WriteByte(MSG_ENTITY, self.swamp_slowdown);
-       WriteByte(MSG_ENTITY, self.swamp_interval);
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
-
-       WriteCoord(MSG_ENTITY, self.mins_x);
-       WriteCoord(MSG_ENTITY, self.mins_y);
-       WriteCoord(MSG_ENTITY, self.mins_z);
-       WriteCoord(MSG_ENTITY, self.maxs_x);
-       WriteCoord(MSG_ENTITY, self.maxs_y);
-       WriteCoord(MSG_ENTITY, self.maxs_z);
-
-       WriteCoord(MSG_ENTITY, self.movedir_x);
-       WriteCoord(MSG_ENTITY, self.movedir_y);
-       WriteCoord(MSG_ENTITY, self.movedir_z);
-
-       WriteAngle(MSG_ENTITY, self.angles_x);
-       WriteAngle(MSG_ENTITY, self.angles_y);
-       WriteAngle(MSG_ENTITY, self.angles_z);
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_SWAMP);
+
+       WriteByte(MSG_ENTITY, this.dmg); // can probably get away with using a single byte here
+       WriteByte(MSG_ENTITY, this.swamp_slowdown);
+       WriteByte(MSG_ENTITY, this.swamp_interval);
+
+       trigger_common_write(this, false);
 
        return true;
 }
 
-void swamp_link()
+void swamp_link(entity this)
 {
-       Net_LinkEntity(self, false, 0, func_ladder_send);
+       trigger_link(this, swamp_send);
 }
 
 /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
 Players gettin into the swamp will
 get slowd down and damaged
 */
-void spawnfunc_trigger_swamp(void)
+spawnfunc(trigger_swamp)
 {
        // Init stuff
-       EXACTTRIGGER_INIT;
-       self.touch = swamp_touch;
+       trigger_init(this);
+       settouch(this, swamp_touch);
 
        // Setup default keys, if missing
-       if(self.dmg <= 0)
-               self.dmg = 5;
-       if(self.swamp_interval <= 0)
-               self.swamp_interval = 1;
-       if(self.swamp_slowdown <= 0)
-               self.swamp_slowdown = 0.5;
-
-       swamp_link();
+       if(this.dmg <= 0)
+               this.dmg = 5;
+       if(this.swamp_interval <= 0)
+               this.swamp_interval = 1;
+       if(this.swamp_slowdown <= 0)
+               this.swamp_slowdown = 0.5;
+
+       swamp_link(this);
 }
 
 #elif defined(CSQC)
 
-void ent_swamp()
+NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew)
 {
-       self.warpzone_isboxy = ReadByte();
-       self.scale = ReadByte();
-       self.dmg = ReadByte();
-       self.swamp_slowdown = ReadByte();
-       self.swamp_interval = ReadByte();
-
-       self.origin_x = ReadCoord();
-       self.origin_y = ReadCoord();
-       self.origin_z = ReadCoord();
-       setorigin(self, self.origin);
-
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       setsize(self, self.mins, self.maxs);
-
-       self.movedir_x = ReadCoord();
-       self.movedir_y = ReadCoord();
-       self.movedir_z = ReadCoord();
-
-       self.angles_x = ReadAngle();
-       self.angles_y = ReadAngle();
-       self.angles_z = ReadAngle();
-
-       self.classname = "trigger_swamp";
-       self.solid = SOLID_TRIGGER;
-       self.draw = trigger_draw_generic;
-       self.trigger_touch = swamp_touch;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
+       this.dmg = ReadByte();
+       this.swamp_slowdown = ReadByte();
+       this.swamp_interval = ReadByte();
+
+       trigger_common_read(this, false);
+
+       return = true;
+
+       this.classname = "trigger_swamp";
+       this.solid = SOLID_TRIGGER;
+       settouch(this, swamp_touch);
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
+       this.entremove = trigger_remove_generic;
 }
 #endif