SBSPSS/source/fx/fxbubble.cpp

54 lines
1.2 KiB
C++
Raw Normal View History

2001-06-01 17:10:05 +02:00
/*****************/
/*** Bubble FX ***/
/*****************/
2001-06-01 16:05:21 +02:00
#include "system\global.h"
#include <DStructs.h>
#include "utils\utils.h"
#include "gfx\prim.h"
#include "gfx\sprbank.h"
#include <sprites.h>
#include "level\level.h"
#include "game\game.h"
#include "level\layercollision.h"
#include "FX\FXBaseAnim.h"
2001-06-01 17:10:05 +02:00
#include "FX\FXBubble.h"
2001-06-01 16:05:21 +02:00
/*****************************************************************************/
2001-06-01 17:10:05 +02:00
void CFXBubble::init(DVECTOR const &_Pos)
2001-06-01 16:05:21 +02:00
{
2001-06-01 17:10:05 +02:00
CFXBaseAnim::init(_Pos);
Life=32+getRndRange(63);
2001-06-19 23:19:01 +02:00
Velocity.vy=-(getRndRange(4)+1);
CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2);
2001-06-01 17:10:05 +02:00
XIdx=getRnd()&15;
2001-06-01 16:05:21 +02:00
}
/*****************************************************************************/
/*** Think *******************************************************************/
/*****************************************************************************/
2001-07-03 18:55:37 +02:00
static const s16 XT[16]={ 0,+1,+0,+1,+0, 0,-1,+0,-1,+0,0,+1,+0,+1,+0,};
2001-06-01 17:10:05 +02:00
void CFXBubble::think(int _frames)
2001-06-01 16:05:21 +02:00
{
2001-07-13 21:55:22 +02:00
Life-=_frames;
2001-07-03 18:55:37 +02:00
if (Life<=0)
2001-06-01 16:05:21 +02:00
{
2001-06-01 17:10:05 +02:00
if (renderFrame!=FRM__BUBBLEPOP)
2001-06-01 16:05:21 +02:00
{
2001-06-01 17:10:05 +02:00
renderFrame=FRM__BUBBLEPOP;
}
else
{
2001-07-13 21:55:22 +02:00
killFX();
2001-06-01 16:05:21 +02:00
}
}
2001-06-01 17:10:05 +02:00
else
{
CFXBaseAnim::think(_frames);
Pos.vx+=XT[XIdx++];
XIdx&=15;
}
2001-06-01 16:05:21 +02:00
}