This commit is contained in:
Daveo 2001-07-03 16:55:37 +00:00
parent b7f6568e30
commit 3d1889c964
5 changed files with 20 additions and 37 deletions

View File

@ -74,7 +74,7 @@ CFXBaseAnim::sFXBaseData FXFireBaseData=
CFXBaseAnim::sFXBaseData FXBubbleBaseData=
{
FRM__BUBBLE_2,FRM__BUBBLE_2,1,
FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_NO_THINK_KILL,
FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_NO_THINK_KILL | FX_FLAG_HAS_LIFE,
};
/*****************************************************************************/
@ -329,7 +329,7 @@ CThing *Parent=getParent();
CFXThing::think(_frames);
if (Life>0)
if (Flags & FX_FLAG_HAS_LIFE)
{
Life-=_frames;
if (Life<=0)

View File

@ -16,6 +16,7 @@ enum FX_FLAG
FX_FLAG_INJURE_PLAYER =1<<3,
FX_FLAG_TRANS =1<<4,
FX_FLAG_COLLIDE_BOUNCE =1<<5,
FX_FLAG_HAS_LIFE =1<<6,
FX_FLAG_NO_THINK_KILL =1<<13,
FX_FLAG_HIDDEN =1<<14,

View File

@ -22,6 +22,7 @@ void CFXBaseAnim::init(DVECTOR const &_Pos)
CurrentScaleX=CurrentScaleY=ONE;
CurrentHeading = 0;
HasInit=false;
Life=-1;
}
@ -42,15 +43,6 @@ void CFXBaseAnim::think(int _frames)
MaxFrame=((BaseData->EndFrame-BaseData->StartFrame)<<BaseData->FrameShift)-1;
Flags|=BaseData->Flags;
renderFrame=BaseData->StartFrame;
if (Flags & FX_FLAG_LOOP)
{
Life=-1;
}
else
{
Life=MaxFrame;
}
HasInit=true;
}
@ -62,7 +54,15 @@ void CFXBaseAnim::think(int _frames)
if (CurrentFrame>MaxFrame)
{
CurrentFrame=0;
if (Flags & FX_FLAG_LOOP)
{
CurrentFrame=0;
}
else
{
CurrentFrame=MaxFrame;
killFX();
}
}
int ThisFrame=CurrentFrame>>BaseData->FrameShift;
renderFrame=BaseData->StartFrame+ThisFrame;

View File

@ -22,27 +22,18 @@ void CFXBubble::init(DVECTOR const &_Pos)
Life=32+getRndRange(63);
Velocity.vy=-(getRndRange(4)+1);
CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2);
Die=0;
XIdx=getRnd()&15;
Lifetime = 2 * GameState::getOneSecondInFrames();
}
/*****************************************************************************/
/*** Think *******************************************************************/
/*****************************************************************************/
int XT[16]={ 0,+1,+0,+1,+0, 0,-1,+0,-1,+0,0,+1,+0,+1,+0,};
static const s16 XT[16]={ 0,+1,+0,+1,+0, 0,-1,+0,-1,+0,0,+1,+0,+1,+0,};
void CFXBubble::think(int _frames)
{
if (Lifetime > 0)
{
Lifetime -= _frames;
}
else
{
Die = true;
}
if (Die)
if (Life<=0)
{
if (renderFrame!=FRM__BUBBLEPOP)
{
@ -60,10 +51,3 @@ void CFXBubble::think(int _frames)
XIdx&=15;
}
}
/*****************************************************************************/
void CFXBubble::killFX()
{
Die=1;
}

View File

@ -11,14 +11,12 @@
class CFXBubble : public CFXBaseAnim
{
public:
virtual void init(DVECTOR const &Pos);
virtual void think(int _frames);
virtual void killFX();
void init(DVECTOR const &Pos);
void think(int _frames);
void killFX(){};
protected:
s8 Die;
u16 XIdx;
s32 Lifetime;
};
#endif