SBSPSS/source/fx/fxthwack.cpp

49 lines
1.2 KiB
C++
Raw Normal View History

2001-06-12 22:20:52 +02:00
/*****************/
/*** Thwack!!! ***/
/*****************/
2001-06-12 18:12: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"
#include "game\game.h"
2001-06-12 22:20:52 +02:00
#include "gfx\otpos.h"
2001-06-12 18:12:09 +02:00
2001-06-12 22:20:52 +02:00
#include "FX\FXThwack.h"
2001-06-12 18:12:09 +02:00
2001-06-12 22:20:52 +02:00
const int ThwackLife=12;
2001-06-12 18:12:09 +02:00
/*****************************************************************************/
2001-06-12 22:20:52 +02:00
void CFXThwack::init(DVECTOR const &_Pos)
2001-06-12 18:12:09 +02:00
{
2001-06-12 22:20:52 +02:00
CFX::init(_Pos);
Life=ThwackLife;
OtPos=OTPOS__ACTOR_POS-1;
Angle=getRnd()&4095;
Scale=2048+1024+(getRnd()&2047);
2001-06-12 18:12:09 +02:00
}
/*****************************************************************************/
/*** Render ******************************************************************/
/*****************************************************************************/
2001-06-12 22:20:52 +02:00
void CFXThwack::render()
{
DVECTOR RenderPos;
2001-06-12 18:12:09 +02:00
2001-06-12 22:20:52 +02:00
getFXRenderPos(RenderPos);
2001-06-19 23:19:01 +02:00
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
2001-06-12 18:12:09 +02:00
2001-06-12 22:20:52 +02:00
SpriteBank *SprBank=CGameScene::getSpriteBank();
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(FRM__THWACK,RenderPos.vx,RenderPos.vy,Scale,Scale,Angle,OtPos);
setSemiTrans(Ft4,1);
Ft4->tpage|=1<<5;
int Col=(256/ThwackLife)*Life;
setRGB0(Ft4,Col,Col,Col);
2001-06-12 18:12:09 +02:00
}