SBSPSS/source/fx/fxtvexplode.cpp

81 lines
1.9 KiB
C++
Raw Normal View History

2001-07-02 21:29:20 +02:00
/******************/
/*** TV Explode ***/
/******************/
2001-07-02 20:20:01 +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 "gfx\otpos.h"
2001-07-02 21:29:20 +02:00
#include "FX\FXTVExplode.h"
#include "FX\FXBaseAnim.h"
2001-07-02 20:20:01 +02:00
/*****************************************************************************/
2001-07-02 21:29:20 +02:00
CFXBaseAnim::sFXBaseData FXCogBaseData=
2001-07-02 20:20:01 +02:00
{
2001-07-02 21:29:20 +02:00
FRM__COG01,FRM__COG01,3,
2001-08-04 20:21:12 +02:00
FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY,
2001-07-02 21:29:20 +02:00
};
2001-07-02 20:20:01 +02:00
2001-07-02 21:29:20 +02:00
CFXBaseAnim::sFXBaseData FXValveBaseData=
2001-07-02 20:20:01 +02:00
{
2001-07-02 21:29:20 +02:00
FRM__ELECVALVE,FRM__ELECVALVE,1,
2001-08-04 20:21:12 +02:00
FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY,
2001-07-02 21:29:20 +02:00
};
2001-07-02 20:20:01 +02:00
/*****************************************************************************/
2001-07-03 00:51:10 +02:00
static const int TVExplodeVel=8;
static const int TVExplodeCogs=4;
static const int TVExplodeValves=4;
/*****************************************************************************/
void CFXTVExplode::init(DVECTOR const &_Pos)
{
CFX::init(_Pos);
}
/*****************************************************************************/
void CFXTVExplode::think(int _frames)
2001-07-02 20:20:01 +02:00
{
2001-07-02 21:29:20 +02:00
CFX *NewFX;
2001-07-02 20:20:01 +02:00
2001-07-02 21:29:20 +02:00
int VelX,VelY;
2001-07-02 20:20:01 +02:00
2001-07-02 21:29:20 +02:00
NewFX=CFX::Create(CFX::FX_TYPE_SMOKE_PUFF,Pos);
2001-07-03 00:51:10 +02:00
NewFX->SetOtPos(1);
2001-07-02 20:20:01 +02:00
2001-07-02 21:29:20 +02:00
NewFX=CFX::Create(CFX::FX_TYPE_EXPLODE,Pos);
((CFXBaseAnim*)NewFX)->SetScale(ONE*2);
2001-07-03 00:51:10 +02:00
NewFX->SetOtPos(1);
2001-07-02 20:20:01 +02:00
2001-07-02 21:29:20 +02:00
for (int i=0;i<TVExplodeCogs; i++)
2001-07-02 20:20:01 +02:00
{
2001-07-02 21:29:20 +02:00
NewFX=CFX::Create(CFX::FX_TYPE_BASE_ANIM,Pos);
NewFX->setBaseData(&FXCogBaseData);
VelX=getRndRange(TVExplodeVel*2)-TVExplodeVel;
VelY=-getRndRange(TVExplodeVel);
NewFX->setVelocity(VelX,VelY);
2001-07-03 00:51:10 +02:00
NewFX->SetOtPos(1);
2001-07-02 20:20:01 +02:00
}
2001-07-02 21:29:20 +02:00
for (int i=0;i<TVExplodeValves; i++)
2001-07-02 20:20:01 +02:00
{
2001-07-02 21:29:20 +02:00
NewFX=CFX::Create(CFX::FX_TYPE_BASE_ANIM,Pos);
NewFX->setBaseData(&FXValveBaseData);
VelX=getRndRange(TVExplodeVel*2)-TVExplodeVel;
VelY=-getRndRange(TVExplodeVel);
NewFX->setVelocity(VelX,VelY);
2001-07-03 00:51:10 +02:00
NewFX->SetOtPos(1);
2001-07-02 20:20:01 +02:00
}
2001-07-03 00:51:10 +02:00
2001-07-02 21:29:20 +02:00
killFX();
2001-07-02 20:20:01 +02:00
}