]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/misc/teleport_dest.qc
Merge branch 'master' into Lyberta/PrintMove
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / misc / teleport_dest.qc
index b3a242076a28b49e6406237ef33ad911adce0563..126a20ea26ec08e254c1ee6e9d9473479b084dda 100644 (file)
@@ -1,20 +1,19 @@
+#include "teleport_dest.qh"
 REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST)
 
 #ifdef SVQC
 
-bool teleport_dest_send(entity this, entity to, int sf)
+bool teleport_dest_send(entity this, entity to, int sendflags)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST);
-       WriteByte(MSG_ENTITY, sf);
+       WriteByte(MSG_ENTITY, sendflags);
 
-       if(sf & 1)
+       if(sendflags & SF_TRIGGER_INIT)
        {
                WriteByte(MSG_ENTITY, this.cnt);
                WriteCoord(MSG_ENTITY, this.speed);
                WriteString(MSG_ENTITY, this.targetname);
-               WriteCoord(MSG_ENTITY, this.origin_x);
-               WriteCoord(MSG_ENTITY, this.origin_y);
-               WriteCoord(MSG_ENTITY, this.origin_z);
+               WriteVector(MSG_ENTITY, this.origin);
 
                WriteAngle(MSG_ENTITY, this.mangle_x);
                WriteAngle(MSG_ENTITY, this.mangle_y);
@@ -27,7 +26,7 @@ bool teleport_dest_send(entity this, entity to, int sf)
 void teleport_dest_link(entity this)
 {
        Net_LinkEntity(this, false, 0, teleport_dest_send);
-       this.SendFlags |= 1; // update
+       this.SendFlags |= SF_TRIGGER_INIT;
 }
 
 spawnfunc(info_teleport_destination)
@@ -37,14 +36,14 @@ spawnfunc(info_teleport_destination)
        this.mangle = this.angles;
        this.angles = '0 0 0';
 
-       //setorigin (this, this.origin + '0 0 27');     // To fix a mappers' habit as old as Quake
-       setorigin (this, this.origin);
+       //setorigin(this, this.origin + '0 0 27');      // To fix a mappers' habit as old as Quake
+       setorigin(this, this.origin);
 
        IFTARGETED
        {
        }
        else
-               objerror ("^3Teleport destination without a targetname");
+               objerror (this, "^3Teleport destination without a targetname");
 
        teleport_dest_link(this);
 }
@@ -54,37 +53,25 @@ spawnfunc(misc_teleporter_dest)
        spawnfunc_info_teleport_destination(this);
 }
 
-spawnfunc(target_teleporter)
-{
-       spawnfunc_info_teleport_destination(this);
-}
-
 #elif defined(CSQC)
 
 void teleport_dest_remove(entity this)
 {
-       //if(this.classname)
-               //strunzone(this.classname);
-       //this.classname = string_null;
-
-       if(this.targetname)
-               strunzone(this.targetname);
-       this.targetname = string_null;
+    // strfree(this.classname);
+    strfree(this.targetname);
 }
 
 NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
 {
-       int sf = ReadByte();
+       int sendflags = ReadByte();
 
-       if(sf & 1)
+       if(sendflags & SF_TRIGGER_INIT)
        {
                this.classname = "info_teleport_destination";
                this.cnt = ReadByte();
                this.speed = ReadCoord();
                this.targetname = strzone(ReadString());
-               this.origin_x = ReadCoord();
-               this.origin_y = ReadCoord();
-               this.origin_z = ReadCoord();
+               this.origin = ReadVector();
 
                this.mangle_x = ReadAngle();
                this.mangle_y = ReadAngle();