// --------------------------------------------------------------------------
// BEGIN OPTIONAL CSQC FUNCTIONS
-void Ent_Remove();
+.void(entity) predraw_qc;
+void PreDraw_self()
+{
+ if(self.predraw_qc)
+ self.predraw_qc(self);
+}
-void Ent_RemovePlayerScore()
+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)
{
- SELFPARAM();
if(this.owner) {
SetTeam(this.owner, -1);
this.owner.gotscores = 0;
//print("A CSQC entity changed its owner!\n");
LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
isNew = true;
- Ent_Remove();
+ Ent_Remove(this);
}
#endif
void CSQC_Ent_Update(bool isnew)
{
SELFPARAM();
- this.sourceLocLine = __LINE__;
- this.sourceLocFile = __FILE__;
+ this.sourceLoc = __FILE__ ":" STR(__LINE__);
int t = ReadByte();
// set up the "time" global for received entities to be correct for interpolation purposes
if (t != this.enttype || isnew)
{
LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
- Ent_Remove();
+ Ent_Remove(this);
clearentity(this);
isnew = true;
}
// Destructor, but does NOT deallocate the entity by calling remove(). Also
// used when an entity changes its type. For an entity that someone interacts
// with others, make sure it can no longer do so.
-void Ent_Remove()
+void Ent_Remove(entity this)
{
- SELFPARAM();
- if(this.entremove) this.entremove();
+ if(this.entremove) this.entremove(this);
if(this.skeletonindex)
{
LOG_WARNING("CSQC_Ent_Remove called for already removed entity. Packet loss?\n");
return;
}
- if (this.enttype) Ent_Remove();
+ if (this.enttype) Ent_Remove(this);
remove(this);
}