Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
teleport_dest.qc
Go to the documentation of this file.
1#include "teleport_dest.qh"
2REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST)
3
4#ifdef SVQC
5
6bool teleport_dest_send(entity this, entity to, int sendflags)
7{
8 WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST);
9 WriteByte(MSG_ENTITY, sendflags);
10
11 if(sendflags & SF_TRIGGER_INIT)
12 {
16 WriteVector(MSG_ENTITY, this.origin);
17 WriteAngleVector(MSG_ENTITY, this.mangle);
18 }
19
20 return true;
21}
22
24{
25 Net_LinkEntity(this, false, 0, teleport_dest_send);
27}
28
29spawnfunc(info_teleport_destination)
30{
31 this.mangle = this.angles;
32 this.angles = '0 0 0';
33
34 //setorigin(this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
35 setorigin(this, this.origin);
36
37 if(!this.targetname || this.targetname == "")
38 {
39 objerror (this, "^3Teleport destination without a targetname");
40 return; // don't link it to CSQC in this case!
41 }
42
44}
45
46spawnfunc(misc_teleporter_dest)
47{
48 spawnfunc_info_teleport_destination(this);
49}
50
51#elif defined(CSQC)
52
53void teleport_dest_remove(entity this)
54{
55 // strfree(this.classname);
56 strfree(this.targetname);
57}
58
59NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
60{
61 int sendflags = ReadByte();
62
63 if(sendflags & SF_TRIGGER_INIT)
64 {
65 this.classname = "info_teleport_destination";
66 this.cnt = ReadByte();
67 this.speed = ReadCoord();
69 this.origin = ReadVector();
70 this.mangle = ReadAngleVector();
71
72 setorigin(this, this.origin);
73
74 this.drawmask = MASK_NORMAL;
75 this.entremove = teleport_dest_remove;
76 }
77
78 return = true;
79}
80
81#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define ReadString
float cnt
Definition powerups.qc:24
string classname
float drawmask
const float MASK_NORMAL
vector origin
const int SF_TRIGGER_INIT
Definition defs.qh:22
float speed
Definition dynlight.qc:9
ent angles
Definition ent_cs.qc:121
int SendFlags
Definition net.qh:118
#define NET_HANDLE(id, param)
Definition net.qh:15
const int MSG_ENTITY
Definition net.qh:115
#define ReadVector()
Definition net.qh:367
#define ReadAngleVector()
Definition net.qh:369
#define WriteHeader(to, id)
Definition net.qh:221
#define REGISTER_NET_LINKED(id)
Definition net.qh:55
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
int ReadByte()
void WriteString(string data, float dest, float desto)
void WriteCoord(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
string strzone(string s)
#define objerror
Definition pre.qh:8
#define spawnfunc(id)
Definition spawnfunc.qh:96
#define strfree(this)
Definition string.qh:59
vector mangle
Definition subs.qh:51
bool teleport_dest_send(entity this, entity to, int sendflags)
void teleport_dest_link(entity this)
string targetname
Definition triggers.qh:56