SBSPSS/source/fx/fxgeyser.cpp

85 lines
2.0 KiB
C++
Raw Normal View History

2001-06-19 21:56:41 +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"
#include "game\game.h"
2001-06-19 23:19:01 +02:00
#include "FX\FXGeyser.h"
2001-06-19 21:56:41 +02:00
2001-06-19 23:19:01 +02:00
int GeyserSpeed=4;
2001-06-19 21:56:41 +02:00
/*****************************************************************************/
2001-06-19 23:19:01 +02:00
void CFXGeyser::init(DVECTOR const &_Pos)
2001-06-19 21:56:41 +02:00
{
2001-06-19 23:19:01 +02:00
CFX::init(_Pos);
2001-06-19 21:56:41 +02:00
Height=TargetHeight=8;
2001-06-19 23:19:01 +02:00
currentFrame=FRM__GUSH000;
2001-06-19 21:56:41 +02:00
}
/*****************************************************************************/
2001-06-19 23:19:01 +02:00
void CFXGeyser::think(int Frames)
2001-06-19 21:56:41 +02:00
{
2001-06-19 23:19:01 +02:00
CFX::think(Frames);
2001-06-19 21:56:41 +02:00
2001-06-19 23:19:01 +02:00
currentFrame++;
if (currentFrame>FRM__GUSH003)
2001-06-19 21:56:41 +02:00
{
2001-06-19 23:19:01 +02:00
currentFrame=FRM__GUSH000;
2001-06-19 21:56:41 +02:00
}
2001-06-19 23:35:02 +02:00
// TargetHeight=MaxHeight;
2001-06-19 21:56:41 +02:00
}
2001-06-19 23:19:01 +02:00
2001-06-19 21:56:41 +02:00
/*****************************************************************************/
/*** Render ******************************************************************/
/*****************************************************************************/
2001-06-19 23:19:01 +02:00
void CFXGeyser::render()
2001-06-19 21:56:41 +02:00
{
2001-06-19 23:19:01 +02:00
DVECTOR RenderPos;
POLY_FT4 *Ft4;
SpriteBank *SprBank=CGameScene::getSpriteBank();
CThing *Parent=getParent();
getFXRenderPos(RenderPos);
2001-06-19 21:56:41 +02:00
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
2001-06-19 23:19:01 +02:00
// is it attached to a platform?
if (Parent)
{ // yes, so get pos, and return
Height=RenderPos.vy-Parent->getRenderPos().vy;
}
else
{
int HDiff=TargetHeight-Height;
Height+=(HDiff+(GeyserSpeed-1))/GeyserSpeed;
}
// top
Ft4=SprBank->printFT4(currentFrame,RenderPos.vx,RenderPos.vy-Height,0,0,OtPos);
setShadeTex(Ft4,0);
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
2001-06-19 21:56:41 +02:00
2001-06-19 23:19:01 +02:00
int FrameW=Ft4->x1-Ft4->x0;
setCollisionCentreOffset(FrameW>>1,-Height/2);
setCollisionCentreOffset(0,-Height/2);
setCollisionSize(FrameW,Height);
2001-06-19 21:56:41 +02:00
2001-06-19 23:19:01 +02:00
// Base
Ft4=SprBank->printFT4(FRM__GUSHBASE,RenderPos.vx,RenderPos.vy,0,0,OtPos);
setShadeTex(Ft4,0);
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
Ft4->y0=Ft4->y2-Height;
Ft4->y1=Ft4->y3-Height;
Ft4->v2--; Ft4->v3--;
2001-06-19 21:56:41 +02:00
}