1 #include "teleport_dest.qh"
2 REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST)
6 bool teleport_dest_send(entity this, entity to, int sendflags)
8 WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST);
9 WriteByte(MSG_ENTITY, sendflags);
11 if(sendflags & SF_TRIGGER_INIT)
13 WriteByte(MSG_ENTITY, this.cnt);
14 WriteCoord(MSG_ENTITY, this.speed);
15 WriteString(MSG_ENTITY, this.targetname);
16 WriteVector(MSG_ENTITY, this.origin);
17 WriteAngleVector(MSG_ENTITY, this.mangle);
23 void teleport_dest_link(entity this)
25 Net_LinkEntity(this, false, 0, teleport_dest_send);
26 this.SendFlags |= SF_TRIGGER_INIT;
29 spawnfunc(info_teleport_destination)
31 this.classname = "info_teleport_destination";
33 this.mangle = this.angles;
34 this.angles = '0 0 0';
36 //setorigin(this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
37 setorigin(this, this.origin);
39 if(!this.targetname || this.targetname == "")
41 objerror (this, "^3Teleport destination without a targetname");
42 return; // don't link it to CSQC in this case!
45 teleport_dest_link(this);
48 spawnfunc(misc_teleporter_dest)
50 spawnfunc_info_teleport_destination(this);
55 void teleport_dest_remove(entity this)
57 // strfree(this.classname);
58 strfree(this.targetname);
61 NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
63 int sendflags = ReadByte();
65 if(sendflags & SF_TRIGGER_INIT)
67 this.classname = "info_teleport_destination";
68 this.cnt = ReadByte();
69 this.speed = ReadCoord();
70 this.targetname = strzone(ReadString());
71 this.origin = ReadVector();
72 this.mangle = ReadAngleVector();
74 setorigin(this, this.origin);
76 this.drawmask = MASK_NORMAL;
77 this.entremove = teleport_dest_remove;