]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/wall.qc
use fall.ogg name
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / wall.qc
1 .float lip;
2 .float bgmscriptangular;
3
4 void Ent_Wall_Draw()
5 {
6         float f;
7         vector save;
8         var .vector fld;
9
10         InterpolateOrigin_Do();
11
12         if(self.bgmscriptangular)
13                 fld = angles;
14         else
15                 fld = origin;
16         
17         save = self.fld;
18         f = BGMScript(self);
19         if(f >= 0)
20         {
21                 if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip)
22                         self.alpha = 1 + self.lip * f;
23                 else // > 0: alpha goes from 1-|lip| to 1 when toggled (toggling adds lip)
24                         self.alpha = 1 - self.lip * (1 - f);
25                 self.fld = self.fld + self.movedir * f;
26         }
27         else
28                 self.alpha = 1;
29
30         if(self.alpha >= ALPHA_MIN_VISIBLE)
31                 R_AddEntity(self);
32
33         self.fld = save;
34 }
35
36 void Ent_Wall_Remove()
37 {
38         if(self.bgmscript)
39                 strunzone(self.bgmscript);
40         self.bgmscript = string_null;
41 }
42
43 void Ent_Wall()
44 {
45         float f;
46         InterpolateOrigin_Undo();
47         self.iflags = IFLAG_ANGLES;
48
49         f = ReadByte();
50
51         if(f & 1)
52         {
53                 if(f & 0x40)
54                         self.colormap = ReadShort();
55                 else
56                         self.colormap = 0;
57         }
58
59         if(f & 2)
60         {
61                 self.origin_x = ReadCoord();
62                 self.origin_y = ReadCoord();
63                 self.origin_z = ReadCoord();
64         }
65
66         if(f & 4)
67         {
68                 if(f & 0x10)
69                 {
70                         self.angles_x = ReadAngle();
71                         self.angles_y = ReadAngle();
72                         self.angles_z = ReadAngle();
73                 }
74                 else
75                         self.angles = '0 0 0';
76         }
77
78         if(f & 8)
79         {
80                 self.modelindex = ReadShort();
81                 self.solid = ReadByte();
82                 self.scale = ReadByte() / 16.0;
83                 if(f & 0x20)
84                 {
85                         self.mins_x = ReadCoord();
86                         self.mins_y = ReadCoord();
87                         self.mins_z = ReadCoord();
88                         self.maxs_x = ReadCoord();
89                         self.maxs_y = ReadCoord();
90                         self.maxs_z = ReadCoord();
91                 }
92                 else
93                         self.mins = self.maxs = '0 0 0';
94
95                 if(self.bgmscript)
96                         strunzone(self.bgmscript);
97                 self.bgmscript = ReadString();
98                 if(substring(self.bgmscript, 0, 1) == "<")
99                 {
100                         self.bgmscript = strzone(substring(self.bgmscript, 1, -1));
101                         self.bgmscriptangular = 1;
102                 }
103                 else
104                 {
105                         self.bgmscript = strzone(self.bgmscript);
106                         self.bgmscriptangular = 0;
107                 }
108                 if(self.bgmscript != "")
109                 {
110                         self.bgmscriptattack = ReadByte() / 64.0;
111                         self.bgmscriptdecay = ReadByte() / 64.0;
112                         self.bgmscriptsustain = ReadByte() / 255.0;
113                         self.bgmscriptrelease = ReadByte() / 64.0;
114                         self.movedir_x = ReadCoord();
115                         self.movedir_y = ReadCoord();
116                         self.movedir_z = ReadCoord();
117                         self.lip = ReadByte() / 255.0;
118                 }
119                 BGMScript_InitEntity(self);
120         }
121
122         InterpolateOrigin_Note();
123
124         self.entremove = Ent_Wall_Remove;
125         self.draw = Ent_Wall_Draw;
126 }