#include "wall.qh"
+#include "_all.qh"
-#include "autocvars.qh"
#include "bgmscript.qh"
-#include "main.qh"
#include "../common/util.qh"
.float scale;
.vector movedir;
-void Ent_Wall_Draw()
+void Ent_Wall_PreDraw()
+{SELFPARAM();
+ if (self.inactive)
+ {
+ self.alpha = 0;
+ }
+ else
+ {
+ vector org = getpropertyvec(VF_ORIGIN);
+ if(!checkpvs(org, self))
+ self.alpha = 0;
+ else if(self.fade_start || self.fade_end) {
+ vector offset = '0 0 0';
+ offset_z = self.fade_vertical_offset;
+ float player_dist = vlen(org - self.origin - 0.5 * (self.mins + self.maxs) + offset);
+ if (self.fade_end == self.fade_start)
+ {
+ if (player_dist >= self.fade_start)
+ self.alpha = 0;
+ else
+ self.alpha = 1;
+ }
+ else
+ {
+ self.alpha = (self.alpha_min + self.alpha_max * bound(0,
+ (self.fade_end - player_dist)
+ / (self.fade_end - self.fade_start), 1)) / 100.0;
+ }
+ }
+ else
+ {
+ self.alpha = 1;
+ }
+ }
+ if(self.alpha <= 0)
+ self.drawmask = 0;
+ else
+ self.drawmask = MASK_NORMAL;
+}
+
+void Ent_Wall_Draw(entity this)
{
float f;
var .vector fld;
self.saved = self.(fld);
- f = BGMScript(self);
+ f = doBGMScript(self);
if(f >= 0)
{
if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip)
}
void Ent_Wall_Remove()
-{
+{SELFPARAM();
if(self.bgmscript)
strunzone(self.bgmscript);
self.bgmscript = string_null;
}
void Ent_Wall()
-{
+{SELFPARAM();
int f;
var .vector fld;
self.movedir_z = ReadCoord();
self.lip = ReadByte() / 255.0;
}
+ self.fade_start = ReadShort();
+ self.fade_end = ReadShort();
+ self.alpha_max = ReadShort();
+ self.alpha_min = ReadShort();
+ self.inactive = ReadShort();
+ self.fade_vertical_offset = ReadShort();
BGMScript_InitEntity(self);
}
self.entremove = Ent_Wall_Remove;
self.draw = Ent_Wall_Draw;
+ self.predraw = Ent_Wall_PreDraw;
}