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-25 20:43:47 +02:00
|
|
|
#include "game\game.h"
|
2001-06-01 00:02:07 +02:00
|
|
|
#include "level\layercollision.h"
|
2001-05-23 22:00:25 +02:00
|
|
|
#include "FX\FXBaseAnim.h"
|
2001-05-23 21:28:42 +02:00
|
|
|
|
2001-06-01 00:02:07 +02:00
|
|
|
|
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
|
|
|
{
|
2001-05-31 22:07:48 +02:00
|
|
|
CFX::init(_Pos);
|
|
|
|
CurrentFrame=0;
|
2001-06-19 23:19:01 +02:00
|
|
|
CurrentScaleX=CurrentScaleY=ONE;
|
2001-06-04 21:01:17 +02:00
|
|
|
CurrentHeading = 0;
|
2001-06-19 23:19:01 +02:00
|
|
|
|
|
|
|
MaxFrame=((BaseData->EndFrame-BaseData->StartFrame)<<BaseData->FrameShift)-1;
|
|
|
|
Flags|=BaseData->Flags;
|
|
|
|
renderFrame=BaseData->StartFrame;
|
|
|
|
|
|
|
|
if (Flags & FX_FLAG_LOOP)
|
|
|
|
{
|
2001-06-01 00:02:07 +02:00
|
|
|
Life=-1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Life=MaxFrame;
|
|
|
|
}
|
2001-06-19 23:19:01 +02:00
|
|
|
}
|
2001-06-01 00:02:07 +02:00
|
|
|
|
2001-06-19 23:19:01 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
void CFXBaseAnim::setBaseData(void *Data)
|
|
|
|
{
|
|
|
|
CFX::setBaseData(Data);
|
|
|
|
BaseData=(sFXBaseData*)Data;
|
2001-05-23 21:28:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** 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);
|
2001-06-01 00:02:07 +02:00
|
|
|
|
2001-06-19 23:19:01 +02:00
|
|
|
if (BaseData->StartFrame!=BaseData->EndFrame)
|
2001-06-01 00:02:07 +02:00
|
|
|
{
|
2001-06-19 23:19:01 +02:00
|
|
|
// CurrentFrame+=_frames;
|
|
|
|
CurrentFrame+=1;
|
2001-06-01 00:02:07 +02:00
|
|
|
|
2001-06-19 23:19:01 +02:00
|
|
|
if (CurrentFrame>=MaxFrame)
|
2001-06-01 00:02:07 +02:00
|
|
|
{
|
2001-06-19 23:19:01 +02:00
|
|
|
CurrentFrame=0;
|
2001-06-01 00:02:07 +02:00
|
|
|
}
|
2001-06-19 23:19:01 +02:00
|
|
|
int ThisFrame=CurrentFrame>>BaseData->FrameShift;
|
|
|
|
renderFrame=BaseData->StartFrame+ThisFrame;
|
2001-06-01 00:02:07 +02:00
|
|
|
}
|
2001-05-23 21:28:42 +02:00
|
|
|
|
2001-06-01 00:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-05-23 21:28:42 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
/*** Render ******************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-05-23 22:00:25 +02:00
|
|
|
void CFXBaseAnim::render()
|
2001-05-23 21:28:42 +02:00
|
|
|
{
|
2001-05-31 22:07:48 +02:00
|
|
|
DVECTOR RenderPos;
|
|
|
|
|
|
|
|
getFXRenderPos(RenderPos);
|
2001-06-19 23:19:01 +02:00
|
|
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
2001-05-23 21:28:42 +02:00
|
|
|
|
2001-05-25 20:43:47 +02:00
|
|
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
2001-06-11 22:36:53 +02:00
|
|
|
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(renderFrame,RenderPos.vx,RenderPos.vy,CurrentScaleX,CurrentScaleY,CurrentHeading,OtPos);
|
2001-05-31 22:07:48 +02:00
|
|
|
setShadeTex(Ft4,0);
|
2001-06-19 23:19:01 +02:00
|
|
|
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
|
|
|
|
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
|
2001-06-12 01:37:59 +02:00
|
|
|
Frame=Ft4;
|
2001-05-23 21:28:42 +02:00
|
|
|
}
|
2001-06-07 18:33:19 +02:00
|
|
|
|
|
|
|
|