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= CFXBaseAnim::sFXBaseData FXBubbleBaseData=
{ {
FRM__BUBBLE_2,FRM__BUBBLE_2,1, 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); CFXThing::think(_frames);
if (Life>0) if (Flags & FX_FLAG_HAS_LIFE)
{ {
Life-=_frames; Life-=_frames;
if (Life<=0) if (Life<=0)

View file

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

View file

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

View file

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

View file

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