From 3d1889c96419e49ebe7bf8790ad04704d05032a6 Mon Sep 17 00:00:00 2001 From: Daveo Date: Tue, 3 Jul 2001 16:55:37 +0000 Subject: [PATCH] --- source/fx/fx.cpp | 4 ++-- source/fx/fx.h | 1 + source/fx/fxbaseanim.cpp | 20 ++++++++++---------- source/fx/fxbubble.cpp | 24 ++++-------------------- source/fx/fxbubble.h | 8 +++----- 5 files changed, 20 insertions(+), 37 deletions(-) diff --git a/source/fx/fx.cpp b/source/fx/fx.cpp index 95a7e36f3..5371aaa5e 100644 --- a/source/fx/fx.cpp +++ b/source/fx/fx.cpp @@ -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) diff --git a/source/fx/fx.h b/source/fx/fx.h index 1992c476a..0c008379b 100644 --- a/source/fx/fx.h +++ b/source/fx/fx.h @@ -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, diff --git a/source/fx/fxbaseanim.cpp b/source/fx/fxbaseanim.cpp index 6e72b7477..9cd64513e 100644 --- a/source/fx/fxbaseanim.cpp +++ b/source/fx/fxbaseanim.cpp @@ -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)<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; diff --git a/source/fx/fxbubble.cpp b/source/fx/fxbubble.cpp index 166afac78..5e75851f1 100644 --- a/source/fx/fxbubble.cpp +++ b/source/fx/fxbubble.cpp @@ -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; -} - diff --git a/source/fx/fxbubble.h b/source/fx/fxbubble.h index cb1bd5afa..ab3010176 100644 --- a/source/fx/fxbubble.h +++ b/source/fx/fxbubble.h @@ -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