SBSPSS/source/fx/fxbaseanim.cpp

72 lines
1.9 KiB
C++
Raw Normal View History

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();
POLY_FT4 *Ft4;
int ThisFrame=(MaxFrame-Frame)>>FrameShift;
printf("%i\n",ThisFrame);
Ft4=m_spriteBank->printRotatedScaledSprite(BaseFrame+ThisFrame,RenderPos.vx,RenderPos.vy,Scale,Scale,0,OtPos*0);
setRGB0(Ft4,R,G,B);
}