Missing animated sprite cleanup
This commit is contained in:
parent
79db5ac5fe
commit
d244904f84
2 changed files with 43 additions and 29 deletions
|
@ -8,7 +8,8 @@
|
|||
|
||||
.float framerate;
|
||||
|
||||
void Sprite_AnimateThink( void ) {
|
||||
void Sprite_AnimateThink(void)
|
||||
{
|
||||
if( self.frame >= self.maxframe ) {
|
||||
if (self.health == 1) {
|
||||
remove(self);
|
||||
|
@ -22,34 +23,45 @@ void Sprite_AnimateThink( void ) {
|
|||
self.nextthink = time + ( 1 / self.framerate );
|
||||
}
|
||||
|
||||
void Sprite_Animated( vector vPos, float fIndex, float fFPS, float fScale, float fAlpha, float fEffects ) {
|
||||
self.modelindex = fIndex;
|
||||
setorigin( self, vPos );
|
||||
self.scale = fScale;
|
||||
self.alpha = fAlpha;
|
||||
self.effects = fEffects;
|
||||
self.framerate = fFPS;
|
||||
void Sprite_Animated(void)
|
||||
{
|
||||
self.origin_x = readcoord();
|
||||
self.origin_y = readcoord();
|
||||
self.origin_z = readcoord();
|
||||
self.modelindex = readfloat();
|
||||
self.framerate = readfloat();
|
||||
self.scale = readfloat();
|
||||
self.alpha = readfloat();
|
||||
self.effects = readfloat();
|
||||
self.colormod[0] = readfloat();
|
||||
self.colormod[1] = readfloat();
|
||||
self.colormod[2] = readfloat();
|
||||
self.think = Sprite_AnimateThink;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
self.nextthink = time + ( 1 / self.framerate );
|
||||
self.maxframe = modelframecount( self.modelindex );
|
||||
self.health = 0; /* repeats */
|
||||
setorigin(self, self.origin);
|
||||
}
|
||||
|
||||
void Sprite_ParseEvent(void)
|
||||
{
|
||||
entity sprite = spawn();
|
||||
sprite.origin_x = readcoord();
|
||||
sprite.origin_y = readcoord();
|
||||
sprite.origin_z = readcoord();
|
||||
sprite.origin[0] = readcoord();
|
||||
sprite.origin[1] = readcoord();
|
||||
sprite.origin[2] = readcoord();
|
||||
sprite.modelindex = readfloat();
|
||||
sprite.framerate = readfloat();
|
||||
sprite.scale = readfloat();
|
||||
sprite.alpha = readfloat();
|
||||
sprite.effects = readfloat();
|
||||
sprite.colormod[0] = readfloat();
|
||||
sprite.colormod[1] = readfloat();
|
||||
sprite.colormod[2] = readfloat();
|
||||
sprite.think = Sprite_AnimateThink;
|
||||
sprite.drawmask = MASK_ENGINE;
|
||||
sprite.nextthink = time + ( 1 / self.framerate );
|
||||
sprite.maxframe = modelframecount( self.modelindex );
|
||||
sprite.health = 1; /* does not repeat */
|
||||
setorigin(sprite, self.origin);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ class env_sprite:CBaseTrigger
|
|||
int m_iToggled;
|
||||
float m_flFramerate;
|
||||
float m_flScale;
|
||||
float m_flAlpha;
|
||||
float m_flEffects;
|
||||
|
||||
void() env_sprite;
|
||||
|
@ -34,29 +33,35 @@ float env_sprite::Network(entity pvsent, float flags)
|
|||
return FALSE;
|
||||
}
|
||||
WriteByte(MSG_ENTITY, ENT_SPRITE);
|
||||
WriteCoord(MSG_ENTITY, origin_x);
|
||||
WriteCoord(MSG_ENTITY, origin_y);
|
||||
WriteCoord(MSG_ENTITY, origin_z);
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
WriteFloat(MSG_ENTITY, modelindex);
|
||||
WriteFloat(MSG_ENTITY, m_flFramerate);
|
||||
WriteFloat(MSG_ENTITY, m_flScale);
|
||||
WriteFloat(MSG_ENTITY, m_flAlpha);
|
||||
WriteFloat(MSG_ENTITY, alpha);
|
||||
WriteFloat(MSG_ENTITY, effects);
|
||||
WriteFloat(MSG_ENTITY, colormod[0]);
|
||||
WriteFloat(MSG_ENTITY, colormod[1]);
|
||||
WriteFloat(MSG_ENTITY, colormod[2]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void env_sprite::NetworkOnce(void)
|
||||
{
|
||||
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
|
||||
WriteByte(MSG_ENTITY, EV_SPRITE);
|
||||
WriteCoord(MSG_ENTITY, origin_x);
|
||||
WriteCoord(MSG_ENTITY, origin_y);
|
||||
WriteCoord(MSG_ENTITY, origin_z);
|
||||
WriteFloat(MSG_ENTITY, modelindex);
|
||||
WriteFloat(MSG_ENTITY, m_flFramerate);
|
||||
WriteFloat(MSG_ENTITY, m_flScale);
|
||||
WriteFloat(MSG_ENTITY, m_flAlpha);
|
||||
WriteFloat(MSG_ENTITY, effects);
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET );
|
||||
WriteByte(MSG_MULTICAST, EV_SPRITE);
|
||||
WriteCoord(MSG_MULTICAST, origin[0]);
|
||||
WriteCoord(MSG_MULTICAST, origin[1]);
|
||||
WriteCoord(MSG_MULTICAST, origin[2]);
|
||||
WriteFloat(MSG_MULTICAST, modelindex);
|
||||
WriteFloat(MSG_MULTICAST, m_flFramerate);
|
||||
WriteFloat(MSG_MULTICAST, m_flScale);
|
||||
WriteFloat(MSG_MULTICAST, alpha);
|
||||
WriteFloat(MSG_MULTICAST, effects);
|
||||
WriteFloat(MSG_MULTICAST, colormod[0]);
|
||||
WriteFloat(MSG_MULTICAST, colormod[1]);
|
||||
WriteFloat(MSG_MULTICAST, colormod[2]);
|
||||
msg_entity = this;
|
||||
multicast( origin, MULTICAST_PVS );
|
||||
}
|
||||
|
@ -81,9 +86,6 @@ void env_sprite::env_sprite(void)
|
|||
case "scale":
|
||||
m_flScale = stof(argv(i + 1));
|
||||
break;
|
||||
case "alpha":
|
||||
m_flAlpha = stof(argv(i + 1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue