Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
corner.qc
Go to the documentation of this file.
1#include "corner.qh"
2REGISTER_NET_LINKED(ENT_CLIENT_CORNER)
3
4#ifdef SVQC
5bool corner_send(entity this, entity to, int sf)
6{
7 WriteHeader(MSG_ENTITY, ENT_CLIENT_CORNER);
8
10
11 WriteVector(MSG_ENTITY, this.origin);
12
13 sf = 0;
14 sf = BITSET(sf, BIT(0), this.target_random);
15
16 sf = BITSET(sf, BIT(1), this.target && this.target != "");
17 sf = BITSET(sf, BIT(2), this.target2 && this.target2 != "");
18 sf = BITSET(sf, BIT(3), this.target3 && this.target3 != "");
19 sf = BITSET(sf, BIT(4), this.target4 && this.target4 != "");
20 sf = BITSET(sf, BIT(5), this.targetname && this.targetname != "");
21
23 if(sf & BIT(1))
25 if(sf & BIT(2))
27 if(sf & BIT(3))
29 if(sf & BIT(4))
31 if(sf & BIT(5))
33
35
36 return true;
37}
38
40{
41 //Net_LinkEntity(this, false, 0, corner_send);
42}
43
44spawnfunc(path_corner)
45{
46 // setup values for overriding train movement
47 // if a second value does not exist, both start and end speeds are the single value specified
49
50 corner_link(this);
51}
52#elif defined(CSQC)
53
54void corner_remove(entity this)
55{
56 strfree(this.target);
57 strfree(this.target2);
58 strfree(this.target3);
59 strfree(this.target4);
60 strfree(this.targetname);
62}
63
64NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
65{
67
68 this.origin = ReadVector();
69 setorigin(this, this.origin);
70
71 int targbits = ReadByte();
72 this.target_random = (targbits & BIT(0));
73
74 this.target = ((targbits & BIT(1)) ? strzone(ReadString()) : string_null);
75 this.target2 = ((targbits & BIT(2)) ? strzone(ReadString()) : string_null);
76 this.target3 = ((targbits & BIT(3)) ? strzone(ReadString()) : string_null);
77 this.target4 = ((targbits & BIT(4)) ? strzone(ReadString()) : string_null);
78 this.targetname = ((targbits & BIT(5)) ? strzone(ReadString()) : string_null);
79
80 this.wait = ReadByte();
81
82 return = true;
83
84 this.classname = "path_corner";
85 this.drawmask = MASK_NORMAL;
86 this.entremove = corner_remove;
87
89}
90
91#endif
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITSET(var, mask, flag)
Definition bits.qh:11
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define ReadString
float wait
Definition items.qc:17
bool corner_send(entity this, entity to, int sf)
Definition corner.qc:5
void corner_link(entity this)
Definition corner.qc:39
string classname
float drawmask
const float MASK_NORMAL
vector origin
#define NET_HANDLE(id, param)
Definition net.qh:15
const int MSG_ENTITY
Definition net.qh:115
#define ReadVector()
Definition net.qh:367
#define WriteHeader(to, id)
Definition net.qh:221
#define REGISTER_NET_LINKED(id)
Definition net.qh:55
int ReadByte()
void WriteString(string data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
string strzone(string s)
string string_null
Definition nil.qh:9
bool set_platmovetype(entity e, string s)
Definition platforms.qc:209
#define spawnfunc(id)
Definition spawnfunc.qh:96
#define strfree(this)
Definition string.qh:59
string target4
Definition subs.qh:55
string target3
Definition subs.qh:54
float target_random
Definition subs.qh:57
string platmovetype
Definition subs.qh:43
string target2
string targetname
Definition triggers.qh:56
string target
Definition triggers.qh:55