From 1bd44b7730c95f8450a6b85ad1cb8109d7bcce91 Mon Sep 17 00:00:00 2001 From: Daveo Date: Tue, 22 May 2001 22:30:36 +0000 Subject: [PATCH] --- source/fx/fx.cpp | 13 +++++++++++++ source/fx/fx.h | 6 ++++++ source/fx/fxsteam.cpp | 43 +++++++++++++++++++------------------------ source/fx/fxsteam.h | 3 +-- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/source/fx/fx.cpp b/source/fx/fx.cpp index f97be99c1..7318f95ea 100644 --- a/source/fx/fx.cpp +++ b/source/fx/fx.cpp @@ -70,6 +70,8 @@ void TestFX(DVECTOR Pos) if (!TestFXPtr) { TestFXPtr=(CFXSteam*)CFX::Create(CFX::FX_TYPE_STEAM,Pos); + TestFXPtr->setLife(32); + TestFXPtr=0; } else { @@ -167,6 +169,8 @@ void CFX::init() m_spriteBank=new ("FX Sprite") SpriteBank(); m_spriteBank->load(SPRITES_SPRITES_SPR); OtPos=OTPOS__ACTOR_POS; + + Life=-1; } /*****************************************************************************/ @@ -180,6 +184,15 @@ void CFX::shutdown() void CFX::think(int _frames) { CFXThing::think(_frames); + if (Life>0) + { + Life--; + if (Life==0 && !DieOut) + { + setDie(); + } + } + } /*****************************************************************************/ diff --git a/source/fx/fx.h b/source/fx/fx.h index 6af9881ef..41d48baaf 100644 --- a/source/fx/fx.h +++ b/source/fx/fx.h @@ -61,10 +61,16 @@ virtual void render(); virtual int canCollide() {return false;} virtual void SetOtPos(int Ot) {OtPos=Ot;} +virtual void setDie() {DieOut=true;} +virtual void setLife(int L) {Life=L;} protected: SpriteBank *m_spriteBank; s32 OtPos; + + u8 DieOut; + s16 Life; + }; /*****************************************************************************/ diff --git a/source/fx/fxsteam.cpp b/source/fx/fxsteam.cpp index e35b521c5..992e21037 100644 --- a/source/fx/fxsteam.cpp +++ b/source/fx/fxsteam.cpp @@ -12,11 +12,11 @@ #include "FX\FXSteam.h" -static const int Size=2; -static const int AngleInc=999; -static const int ShadeBase=255; -static const int ShadeDec=8; -static const int ShadeDieDec=24; +static const int DefSize=4; +static const int DefAngleInc=999; +static const int DefShadeBase=255; +static const int DefShadeDec=8; +static const int DefShadeDieDec=24; /*****************************************************************************/ /*****************************************************************************/ @@ -25,11 +25,10 @@ void CFXSteam::init(DVECTOR const &_Pos) { CFXTrail::init(_Pos); - Angle=0; Trans=3; - ShadeDec=ShadeDec; + ShadeDec=DefShadeDec; DieOut=false; - SetSize(Size); + SetSize(DefSize); } /*****************************************************************************/ @@ -49,14 +48,14 @@ void CFXSteam::SetSize(int Size) /*****************************************************************************/ void CFXSteam::setDie() { - CFXTrail::setDie(); - for (int i=0; iONE*2) ThisElem.Scale=ONE*2; - ThisElem.Shade-=ShadeDec; if (ThisElem.Shade<0) ThisElem.Shade=0; TotalLife+=ThisElem.Shade; diff --git a/source/fx/fxsteam.h b/source/fx/fxsteam.h index 5a6db4b81..f7c3ef0c1 100644 --- a/source/fx/fxsteam.h +++ b/source/fx/fxsteam.h @@ -15,13 +15,12 @@ public: virtual void init(DVECTOR const &Pos); virtual void shutdown(); virtual void think(int _frames); +virtual void setDie(); void SetSize(int Size); -virtual void setDie(); protected: DVECTOR BaseVel; - s16 Angle; s16 ScaleInc; s16 ShadeDec;