SBSPSS/source/fx/fxfallingtile.cpp

72 lines
2.0 KiB
C++
Raw Normal View History

2001-05-16 21:06:02 +02:00
/********************/
/*** Falling Tile ***/
/********************/
2001-05-16 16:53:09 +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"
2001-06-28 23:01:28 +02:00
#include "level\layertile3d.h"
2001-07-23 23:19:15 +02:00
#include "system\vid.h"
2001-07-24 22:17:50 +02:00
#include "gfx\actor.h"
2001-05-16 16:53:09 +02:00
2001-05-16 21:06:02 +02:00
#include "FX\FXfallingTile.h"
2001-05-16 16:53:09 +02:00
2001-05-16 21:06:02 +02:00
/*****************************************************************************/
2001-05-17 21:15:45 +02:00
const int FallingTile_DefVY=-2;
2001-06-12 22:40:20 +02:00
const int FallingTile_DefLife=64;
2001-05-16 21:06:02 +02:00
2001-05-16 16:53:09 +02:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-05-16 21:06:02 +02:00
void CFXFallingTile::init(DVECTOR const &_Pos)
2001-05-16 16:53:09 +02:00
{
CFX::init();
2001-05-16 21:06:02 +02:00
sLevelHdr *LevelHdr=CLevel::getLevelHdr();
2001-06-28 19:48:30 +02:00
ElemBank3d=LevelHdr->ElemBank3d;
2001-05-16 21:06:02 +02:00
TriList=LevelHdr->TriList;
QuadList=LevelHdr->QuadList;
VtxList=LevelHdr->VtxList;
Pos=_Pos;
Velocity.vx=getRndRange(7)-4;
Velocity.vy=FallingTile_DefVY;
Life=FallingTile_DefLife;
2001-07-29 21:17:01 +02:00
CSoundMediator::playSfx(CSoundMediator::SFX_ANY_OBJECT_FALLING,false,true);
2001-08-04 23:06:19 +02:00
if (!isOnScreen(_Pos)) setToShutdown();
2001-05-16 16:53:09 +02:00
}
/*****************************************************************************/
/*** Think *******************************************************************/
/*****************************************************************************/
2001-05-16 21:06:02 +02:00
void CFXFallingTile::think(int _frames)
2001-05-16 16:53:09 +02:00
{
2001-08-04 20:21:12 +02:00
if (Tile==0) setToShutdown();
2001-05-16 16:53:09 +02:00
CFX::think(_frames);
2001-05-16 21:06:02 +02:00
Pos.vx+=Velocity.vx;
Pos.vy+=Velocity.vy;
Velocity.vy++;
2001-08-04 20:21:12 +02:00
Flags |=FX_FLAG_NO_THINK_KILL;
2001-05-16 16:53:09 +02:00
}
/*****************************************************************************/
/*** Render ******************************************************************/
/*****************************************************************************/
2001-05-16 21:06:02 +02:00
void CFXFallingTile::render()
2001-05-16 16:53:09 +02:00
{
2001-05-16 21:06:02 +02:00
CFX::render();
2001-05-31 22:07:48 +02:00
if (!canRender()) return;
2001-05-16 21:06:02 +02:00
DVECTOR &RenderPos=getRenderPos();
2001-06-28 23:01:28 +02:00
u16 TileIdx=Tile>>2;
2001-07-24 22:17:50 +02:00
CModelGfx::RenderTile(RenderPos,TileIdx);
2001-05-16 16:53:09 +02:00
}