2 .float bgmscriptangular;
3 .float lodmodelindex0, lodmodelindex1, lodmodelindex2;
4 .float loddistance1, loddistance2;
13 if(self.bgmscriptangular)
14 self.angles = self.saved;
16 self.origin = self.saved;
18 if(self.lodmodelindex1)
24 self.modelindex = self.lodmodelindex0;
25 else if(d == 2 || !self.lodmodelindex2)
26 self.modelindex = self.lodmodelindex1;
28 self.modelindex = self.lodmodelindex2;
32 d = vlen(NearestPointOnBox(self, view_origin) - view_origin);
33 if(d < self.loddistance1)
34 self.modelindex = self.lodmodelindex0;
35 else if(!self.lodmodelindex2 || d < self.loddistance2)
36 self.modelindex = self.lodmodelindex1;
38 self.modelindex = self.lodmodelindex2;
42 InterpolateOrigin_Do();
44 if(self.bgmscriptangular)
45 self.saved = self.angles;
47 self.saved = self.origin;
52 if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip)
53 self.alpha = 1 + self.lip * f;
54 else // > 0: alpha goes from 1-|lip| to 1 when toggled (toggling adds lip)
55 self.alpha = 1 - self.lip * (1 - f);
56 self.fld = self.fld + self.movedir * f;
61 if(self.alpha >= ALPHA_MIN_VISIBLE)
62 self.drawmask = MASK_NORMAL;
67 void Ent_Wall_Remove()
70 strunzone(self.bgmscript);
71 self.bgmscript = string_null;
77 InterpolateOrigin_Undo();
78 self.iflags = IFLAG_ANGLES;
80 if(self.bgmscriptangular)
81 self.angles = self.saved;
83 self.origin = self.saved;
90 self.colormap = ReadShort();
97 self.origin_x = ReadCoord();
98 self.origin_y = ReadCoord();
99 self.origin_z = ReadCoord();
106 self.angles_x = ReadAngle();
107 self.angles_y = ReadAngle();
108 self.angles_z = ReadAngle();
111 self.angles = '0 0 0';
118 self.lodmodelindex0 = ReadShort();
119 self.loddistance1 = ReadShort();
120 self.lodmodelindex1 = ReadShort();
121 self.loddistance2 = ReadShort();
122 self.lodmodelindex2 = ReadShort();
126 self.modelindex = ReadShort();
127 self.loddistance1 = 0;
128 self.loddistance2 = 0;
130 self.solid = ReadByte();
131 self.scale = ReadShort() / 256.0;
134 self.mins_x = ReadCoord();
135 self.mins_y = ReadCoord();
136 self.mins_z = ReadCoord();
137 self.maxs_x = ReadCoord();
138 self.maxs_y = ReadCoord();
139 self.maxs_z = ReadCoord();
142 self.mins = self.maxs = '0 0 0';
145 strunzone(self.bgmscript);
146 self.bgmscript = ReadString();
147 if(substring(self.bgmscript, 0, 1) == "<")
149 self.bgmscript = strzone(substring(self.bgmscript, 1, -1));
150 self.bgmscriptangular = 1;
154 self.bgmscript = strzone(self.bgmscript);
155 self.bgmscriptangular = 0;
157 if(self.bgmscript != "")
159 self.bgmscriptattack = ReadByte() / 64.0;
160 self.bgmscriptdecay = ReadByte() / 64.0;
161 self.bgmscriptsustain = ReadByte() / 255.0;
162 self.bgmscriptrelease = ReadByte() / 64.0;
163 self.movedir_x = ReadCoord();
164 self.movedir_y = ReadCoord();
165 self.movedir_z = ReadCoord();
166 self.lip = ReadByte() / 255.0;
168 BGMScript_InitEntity(self);
171 InterpolateOrigin_Note();
173 if(self.bgmscriptangular)
174 self.saved = self.angles;
176 self.saved = self.origin;
178 self.entremove = Ent_Wall_Remove;
179 self.draw = Ent_Wall_Draw;