// --------------------------------------------------------------------------
// BEGIN OPTIONAL CSQC FUNCTIONS
+.void(entity) predraw_qc;
+void PreDraw_self()
+{
+ if(self.predraw_qc)
+ self.predraw_qc(self);
+}
+
+void setpredraw(entity this, void(entity) pdfunc)
+{
+ this.predraw = PreDraw_self;
+ this.predraw_qc = pdfunc;
+}
+
void Ent_Remove(entity this);
void Ent_RemovePlayerScore(entity this)
#define DATABUF_NEXT (5*maxclients)
+void setpredraw(entity this, void(entity) pdfunc);
+
// --------------------------------------------------------------------------
// Onslaught
.float scale;
.vector movedir;
-void Ent_Wall_PreDraw()
-{SELFPARAM();
+void Ent_Wall_PreDraw(entity this)
+{
if (this.inactive)
{
this.alpha = 0;
this.entremove = Ent_Wall_Remove;
this.draw = Ent_Wall_Draw;
- this.predraw = Ent_Wall_PreDraw;
+ setpredraw(this, Ent_Wall_PreDraw);
}
Item_SetAlpha(this);
}
-void Item_PreDraw()
-{SELFPARAM();
+void Item_PreDraw(entity this)
+{
if(warpzone_warpzones_exist)
{
// just incase warpzones were initialized last, reset these
- //self.alpha = 1; // alpha is already set by the draw function
- self.drawmask = MASK_NORMAL;
+ //this.alpha = 1; // alpha is already set by the draw function
+ this.drawmask = MASK_NORMAL;
return;
}
float alph;
vector org = getpropertyvec(VF_ORIGIN);
- if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones
+ if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
alph = 0;
- else if(self.fade_start)
- alph = bound(0, (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) / (self.fade_end - self.fade_start), 1);
+ else if(this.fade_start)
+ alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
else
alph = 1;
- //printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
- if(!hud && (self.ItemStatus & ITS_AVAILABLE))
- self.alpha = alph;
+ //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
+ if(!hud && (this.ItemStatus & ITS_AVAILABLE))
+ this.alpha = alph;
if(alph <= 0)
- self.drawmask = 0;
+ this.drawmask = 0;
else
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
}
void ItemRemove(entity this)
self.fade_end = ReadShort();
self.fade_start = ReadShort();
if(self.fade_start && !autocvar_cl_items_nofade)
- self.predraw = Item_PreDraw;
+ setpredraw(self, Item_PreDraw);
if(self.mdl)
strunzone(self.mdl);
#endif
}
-void CSQCModel_Draw()
-{SELFPARAM();
+void CSQCModel_Draw(entity this)
+{
// some nice flags for CSQCMODEL_IF and the hooks
- bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
- noref bool islocalplayer = (self.entnum == player_localnum + 1);
- noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+ bool isplayer = (this.entnum >= 1 && this.entnum <= maxclients);
+ noref bool islocalplayer = (this.entnum == player_localnum + 1);
+ noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1));
// we don't do this for the local player as that one is already handled
// by CSQCPlayer_SetCamera()
if (!CSQCPlayer_IsLocalPlayer(this)) InterpolateOrigin_Do(this);
- CSQCModel_InterpolateAnimation_Do();
+ WITH(entity, self, this, CSQCModel_InterpolateAnimation_Do());
{ CSQCMODEL_HOOK_PREDRAW }
// inherit draw flags easily
- entity root = self;
+ entity root = this;
while(root.tag_entity)
root = root.tag_entity;
- if(self != root)
+ if(this != root)
{
- self.renderflags &= ~(RF_EXTERNALMODEL | RF_VIEWMODEL);
- self.renderflags |= (root.renderflags & (RF_EXTERNALMODEL | RF_VIEWMODEL));
+ this.renderflags &= ~(RF_EXTERNALMODEL | RF_VIEWMODEL);
+ this.renderflags |= (root.renderflags & (RF_EXTERNALMODEL | RF_VIEWMODEL));
}
// we're drawn, now teleporting is over
- self.csqcmodel_teleported = 0;
+ this.csqcmodel_teleported = 0;
}
entity CSQCModel_players[255]; // 255 is engine limit on maxclients
// draw it
this.drawmask = MASK_NORMAL;
- this.predraw = CSQCModel_Draw;
+ setpredraw(this, CSQCModel_Draw);
return true;
}
#elif defined(SVQC)
#endif
-void WarpZone_Fade_PreDraw()
-{SELFPARAM();
+void WarpZone_Fade_PreDraw(entity this)
+{
vector org;
org = getpropertyvec(VF_ORIGIN);
- if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones
- self.alpha = 0;
- else if(self.warpzone_fadestart)
- self.alpha = bound(0, (self.warpzone_fadeend - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart), 1);
+ if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
+ this.alpha = 0;
+ else if(this.warpzone_fadestart)
+ this.alpha = bound(0, (this.warpzone_fadeend - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.warpzone_fadeend - this.warpzone_fadestart), 1);
else
- self.alpha = 1;
- //printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
- if(self.alpha <= 0)
- self.drawmask = 0;
+ this.alpha = 1;
+ //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
+ if(this.alpha <= 0)
+ this.drawmask = 0;
else
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
}
void WarpZone_Touch ();
// how to draw
// engine currently wants this
- self.predraw = WarpZone_Fade_PreDraw;
+ setpredraw(self, WarpZone_Fade_PreDraw);
//self.move_touch = WarpZone_Touch;
return true;
// how to draw
// engine currently wants this
- self.predraw = WarpZone_Fade_PreDraw;
+ setpredraw(self, WarpZone_Fade_PreDraw);
return true;
}