this.cp_bob_spd = this.cp_bob_spd + 1.875 * frametime;
this.colormod = '1 1 1' * (2 - bound(0, (this.pain_finished - time) / 10, 1));
- if(!this.iscaptured) this.alpha = this.health / this.max_health;
+ if(!this.iscaptured) this.alpha = GetResource(this, RES_HEALTH) / this.max_health;
if(this.iscaptured)
{
setsize(this, CPICON_MIN, CPICON_MAX);
}
-void cpicon_construct(entity this)
+void cpicon_construct(entity this, bool isnew)
{
this.netname = "Control Point Icon";
this.cp_origin = this.origin;
this.cp_bob_origin = '0 0 0.1';
this.cp_bob_spd = 0;
+
+ if(isnew)
+ IL_PUSH(g_drawables, this);
}
.vector glowmod;
if(sf & CPSF_SETUP)
{
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
setorigin(this, this.origin);
- this.health = ReadByte();
+ SetResourceExplicit(this, RES_HEALTH, ReadByte());
this.max_health = ReadByte();
this.count = ReadByte();
this.team = ReadByte();
this.iscaptured = ReadByte();
if(!this.count)
- this.count = (this.health - this.max_health) * frametime;
+ this.count = (GetResource(this, RES_HEALTH) - this.max_health) * frametime;
cpicon_changeteam(this);
- cpicon_construct(this);
+ cpicon_construct(this, isnew);
}
if(sf & CPSF_STATUS)
_tmp = ReadByte();
- if(_tmp != this.health)
+ if(_tmp != GetResource(this, RES_HEALTH))
cpicon_damage(this, _tmp);
- this.health = _tmp;
+ SetResourceExplicit(this, RES_HEALTH, _tmp);
}
}