#include "wall.qh"
+#include "autocvars.qh"
+#include "main.qh"
#include "bgmscript.qh"
.float scale;
.vector movedir;
-void Ent_Wall_PreDraw()
-{SELFPARAM();
- if (self.inactive)
+void Ent_Wall_PreDraw(entity this)
+{
+ if (this.inactive)
{
- self.alpha = 0;
+ this.alpha = 0;
}
else
{
vector org = getpropertyvec(VF_ORIGIN);
- if(!checkpvs(org, self))
- self.alpha = 0;
- else if(self.fade_start || self.fade_end) {
+ if(!checkpvs(org, this))
+ this.alpha = 0;
+ else if(this.fade_start || this.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)
+ offset_z = this.fade_vertical_offset;
+ float player_dist = vlen(org - this.origin - 0.5 * (this.mins + this.maxs) + offset);
+ if (this.fade_end == this.fade_start)
{
- if (player_dist >= self.fade_start)
- self.alpha = 0;
+ if (player_dist >= this.fade_start)
+ this.alpha = 0;
else
- self.alpha = 1;
+ this.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;
+ this.alpha = (this.alpha_min + this.alpha_max * bound(0,
+ (this.fade_end - player_dist)
+ / (this.fade_end - this.fade_start), 1)) / 100.0;
}
}
else
{
- self.alpha = 1;
+ this.alpha = 1;
}
}
- if(self.alpha <= 0)
- self.drawmask = 0;
+ if(this.alpha <= 0)
+ this.drawmask = 0;
else
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
}
void Ent_Wall_Draw(entity this)
void Ent_Wall_Remove(entity this)
{
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.bgmscript = string_null;
+ strfree(this.bgmscript);
}
NET_HANDLE(ENT_CLIENT_WALL, bool isnew)
this.colormap = ReadShort();
else
this.colormap = 0;
+ this.skin = ReadByte();
}
if(f & 2)
{
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
setorigin(this, this.origin);
}
this.scale = ReadShort() / 256.0;
if(f & 0x20)
{
- this.mins_x = ReadCoord();
- this.mins_y = ReadCoord();
- this.mins_z = ReadCoord();
- this.maxs_x = ReadCoord();
- this.maxs_y = ReadCoord();
- this.maxs_z = ReadCoord();
+ this.mins = ReadVector();
+ this.maxs = ReadVector();
}
else
this.mins = this.maxs = '0 0 0';
setsize(this, this.mins, this.maxs);
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.bgmscript = ReadString();
- if(substring(this.bgmscript, 0, 1) == "<")
+ string s = ReadString();
+ if(substring(s, 0, 1) == "<")
{
- this.bgmscript = strzone(substring(this.bgmscript, 1, -1));
+ strcpy(this.bgmscript, substring(s, 1, -1));
this.bgmscriptangular = 1;
}
else
{
- this.bgmscript = strzone(this.bgmscript);
+ strcpy(this.bgmscript, s);
this.bgmscriptangular = 0;
}
if(this.bgmscript != "")
this.bgmscriptdecay = ReadByte() / 64.0;
this.bgmscriptsustain = ReadByte() / 255.0;
this.bgmscriptrelease = ReadByte() / 64.0;
- this.movedir_x = ReadCoord();
- this.movedir_y = ReadCoord();
- this.movedir_z = ReadCoord();
+ this.movedir = ReadVector();
this.lip = ReadByte() / 255.0;
}
- this.fade_start = ReadShort();
- this.fade_end = ReadShort();
- this.alpha_max = ReadShort();
- this.alpha_min = ReadShort();
- this.inactive = ReadShort();
+ this.fade_start = ReadByte();
+ this.fade_end = ReadByte();
+ this.alpha_max = ReadByte();
+ this.alpha_min = ReadByte();
+ this.inactive = ReadByte();
this.fade_vertical_offset = ReadShort();
BGMScript_InitEntity(this);
}
this.entremove = Ent_Wall_Remove;
this.draw = Ent_Wall_Draw;
- this.predraw = Ent_Wall_PreDraw;
+ if (isnew) IL_PUSH(g_drawables, this);
+ setpredraw(this, Ent_Wall_PreDraw);
}