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