This commit is contained in:
Daveo 2001-05-22 22:30:36 +00:00
parent a61bc24396
commit 1bd44b7730
4 changed files with 39 additions and 26 deletions

View File

@ -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();
}
}
}
/*****************************************************************************/

View File

@ -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;
};
/*****************************************************************************/

View File

@ -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);
}
/*****************************************************************************/
@ -55,7 +54,7 @@ void CFXSteam::setDie()
sList &ThisElem=List[i];
ThisElem.Vel.vx+=getRndRange(9)-4; // give it x motion
}
ShadeDec=ShadeDieDec;
ShadeDec=DefShadeDieDec;
ScaleInc=0;
}
@ -64,12 +63,8 @@ void CFXSteam::setDie()
/*****************************************************************************/
void CFXSteam::think(int _frames)
{
int TotalLife=0;
CFX::think(_frames);
Angle+=AngleInc;
Angle&=4095;
if (!DieOut)
{ // Replace Head
DVECTOR Vel=BaseVel;
@ -79,13 +74,15 @@ int TotalLife=0;
Head.Ofs=Vel;
Head.Vel=Vel;
Head.Frame=FRM__SMOKE;
Head.Shade=ShadeBase;
Head.Shade=DefShadeBase;
Head.Scale=ScaleInc;
Head.Angle=getRndRange(ONE);
}
// Move em all
int Head=HeadIdx;
int TotalLife=0;
for (int i=0; i<ListCount; i++)
{
sList &ThisElem=List[Head];
@ -95,11 +92,9 @@ int Head=HeadIdx;
ThisElem.Ofs.vx+=ThisElem.Vel.vx;
ThisElem.Ofs.vy+=ThisElem.Vel.vy;
ThisElem.Angle+=AngleInc;
ThisElem.Angle+=DefAngleInc;
ThisElem.Angle&=4095;
ThisElem.Scale+=ScaleInc;
if (ThisElem.Scale>ONE*2) ThisElem.Scale=ONE*2;
ThisElem.Shade-=ShadeDec;
if (ThisElem.Shade<0) ThisElem.Shade=0;
TotalLife+=ThisElem.Shade;

View File

@ -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;