Cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / misc / corner.qc
1 #ifdef SVQC
2 bool corner_send(entity to, int sf)
3 {SELFPARAM();
4         WriteHeader(MSG_ENTITY, ENT_CLIENT_CORNER);
5
6         WriteString(MSG_ENTITY, self.platmovetype);
7
8         WriteCoord(MSG_ENTITY, self.origin_x);
9         WriteCoord(MSG_ENTITY, self.origin_y);
10         WriteCoord(MSG_ENTITY, self.origin_z);
11
12         WriteString(MSG_ENTITY, self.target);
13         WriteString(MSG_ENTITY, self.target2);
14         WriteString(MSG_ENTITY, self.target3);
15         WriteString(MSG_ENTITY, self.target4);
16         WriteString(MSG_ENTITY, self.targetname);
17         WriteByte(MSG_ENTITY, self.target_random);
18
19         WriteByte(MSG_ENTITY, self.wait);
20
21         return true;
22 }
23
24 void corner_link()
25 {
26         //Net_LinkEntity(self, false, 0, corner_send);
27 }
28
29 spawnfunc(path_corner)
30 {
31         // setup values for overriding train movement
32         // if a second value does not exist, both start and end speeds are the single value specified
33         set_platmovetype(self, self.platmovetype);
34
35         corner_link();
36 }
37 #elif defined(CSQC)
38
39 void corner_remove()
40 {SELFPARAM();
41         if(self.target) { strunzone(self.target); }
42         self.target = string_null;
43
44         if(self.target2) { strunzone(self.target2); }
45         self.target2 = string_null;
46
47         if(self.target3) { strunzone(self.target3); }
48         self.target3 = string_null;
49
50         if(self.target4) { strunzone(self.target4); }
51         self.target4 = string_null;
52
53         if(self.targetname) { strunzone(self.targetname); }
54         self.targetname = string_null;
55
56         if(self.platmovetype) { strunzone(self.platmovetype); }
57         self.platmovetype = string_null;
58 }
59
60 NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
61 {
62         self.platmovetype = strzone(ReadString());
63
64         self.origin_x = ReadCoord();
65         self.origin_y = ReadCoord();
66         self.origin_z = ReadCoord();
67         setorigin(self, self.origin);
68
69         self.target = strzone(ReadString());
70         self.target2 = strzone(ReadString());
71         self.target3 = strzone(ReadString());
72         self.target4 = strzone(ReadString());
73         self.targetname = strzone(ReadString());
74         self.target_random = ReadByte();
75
76         self.wait = ReadByte();
77
78         return = true;
79
80         self.classname = "path_corner";
81         self.drawmask = MASK_NORMAL;
82         self.entremove = corner_remove;
83
84         set_platmovetype(self, self.platmovetype);
85 }
86
87 #endif