]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mapobjects/misc/corner.qc
Merge branch 'martin-t/whoosh' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / misc / corner.qc
1 #include "corner.qh"
2 REGISTER_NET_LINKED(ENT_CLIENT_CORNER)
3
4 #ifdef SVQC
5 bool corner_send(entity this, entity to, int sf)
6 {
7         WriteHeader(MSG_ENTITY, ENT_CLIENT_CORNER);
8
9         WriteString(MSG_ENTITY, this.platmovetype);
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
22         WriteByte(MSG_ENTITY, sf);
23         if(sf & BIT(1))
24                 WriteString(MSG_ENTITY, this.target);
25         if(sf & BIT(2))
26                 WriteString(MSG_ENTITY, this.target2);
27         if(sf & BIT(3))
28                 WriteString(MSG_ENTITY, this.target3);
29         if(sf & BIT(4))
30                 WriteString(MSG_ENTITY, this.target4);
31         if(sf & BIT(5))
32                 WriteString(MSG_ENTITY, this.targetname);
33
34         WriteByte(MSG_ENTITY, this.wait);
35
36         return true;
37 }
38
39 void corner_link(entity this)
40 {
41         //Net_LinkEntity(this, false, 0, corner_send);
42 }
43
44 spawnfunc(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
48         set_platmovetype(this, this.platmovetype);
49
50         corner_link(this);
51 }
52 #elif defined(CSQC)
53
54 void 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);
61         strfree(this.platmovetype);
62 }
63
64 NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
65 {
66         this.platmovetype = strzone(ReadString());
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
88         set_platmovetype(this, this.platmovetype);
89 }
90
91 #endif