diff --git a/source/fx/fxfire.cpp b/source/fx/fxfire.cpp new file mode 100644 index 000000000..ff5c12ce3 --- /dev/null +++ b/source/fx/fxfire.cpp @@ -0,0 +1,53 @@ +/*****************/ +/*** Bubble FX ***/ +/*****************/ + +#include "system\global.h" +#include +#include "utils\utils.h" +#include "gfx\prim.h" +#include "gfx\sprbank.h" +#include +#include "level\level.h" +#include "game\game.h" +#include "level\layercollision.h" +#include "FX\FXBaseAnim.h" +#include "FX\FXBubble.h" + + +/*****************************************************************************/ +void CFXBubble::init(DVECTOR const &_Pos) +{ + CFXBaseAnim::init(_Pos); + Life=32+getRndRange(63); + Velocity.vy=-(getRndRange(4)+1); + CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2); + XIdx=getRnd()&15; +} + +/*****************************************************************************/ +/*** Think *******************************************************************/ +/*****************************************************************************/ +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) +{ + Life-=_frames; + if (Life<=0) + { + if (renderFrame!=FRM__BUBBLEPOP) + { + renderFrame=FRM__BUBBLEPOP; + } + else + { + killFX(); + } + } + else + { + CFXBaseAnim::think(_frames); + Pos.vx+=XT[XIdx++]; + XIdx&=15; + } +} diff --git a/source/fx/fxfire.h b/source/fx/fxfire.h new file mode 100644 index 000000000..d94544ec3 --- /dev/null +++ b/source/fx/fxfire.h @@ -0,0 +1,21 @@ +/*****************/ +/*** Bubble FX ***/ +/*****************/ + +#ifndef __FX_FX_BUBBLE_HEADER__ +#define __FX_FX_BUBBLE_HEADER__ + +#include "fx/fxbaseanim.h" + +/*****************************************************************************/ +class CFXBubble : public CFXBaseAnim +{ +public: + void init(DVECTOR const &Pos); + void think(int _frames); + +protected: + u16 XIdx; +}; + +#endif