SBSPSS/source/fx/fxbaseanim.cpp

71 lines
1.9 KiB
C++
Raw Normal View History

2001-05-23 22:22:06 +02:00
/***********************/
2001-05-23 21:28:42 +02:00
/*** Anim Base Class ***/
/***********************/
#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-05-23 22:00:25 +02:00
#include "FX\FXBaseAnim.h"
2001-05-23 21:28:42 +02:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-05-23 22:00:25 +02:00
void CFXBaseAnim::init(DVECTOR const &_Pos)
2001-05-23 21:28:42 +02:00
{
CFX::init();
Pos=_Pos;
SetFrame(0,0);
Scale=ONE;
}
/*****************************************************************************/
2001-05-23 22:00:25 +02:00
void CFXBaseAnim::shutdown()
2001-05-23 21:28:42 +02:00
{
CFX::shutdown();
}
/*****************************************************************************/
2001-05-23 22:00:25 +02:00
void CFXBaseAnim::SetFrame(int Base,int Count,int Shift=0)
2001-05-23 21:28:42 +02:00
{
Frame=0;
BaseFrame=Base;
FrameShift=Shift;
MaxFrame=(Count<<FrameShift)-1;
}
/*****************************************************************************/
/*** Think *******************************************************************/
/*****************************************************************************/
2001-05-23 22:00:25 +02:00
void CFXBaseAnim::think(int _frames)
2001-05-23 21:28:42 +02:00
{
CFX::think(_frames);
Frame+=_frames;
if (Frame>=MaxFrame) setToShutdown();
}
/*****************************************************************************/
/*** Render ******************************************************************/
/*****************************************************************************/
2001-05-23 22:00:25 +02:00
void CFXBaseAnim::render()
2001-05-23 21:28:42 +02:00
{
CFX::render();
if (!canRender() || isSetToShutdown()) return;
DVECTOR &RenderPos=getRenderPos();
2001-05-23 23:22:27 +02:00
int ThisFrame=Frame>>FrameShift;
2001-05-23 21:28:42 +02:00
2001-05-24 00:00:26 +02:00
POLY_FT4 *Ft4=m_spriteBank->printFT4Scaled(BaseFrame+ThisFrame,RenderPos.vx,RenderPos.vy,0,0,OtPos*0,Scale>>4);
Ft4->u1--; Ft4->u3--;
Ft4->v2--; Ft4->v3--;
2001-05-23 21:28:42 +02:00
setRGB0(Ft4,R,G,B);
}