This commit is contained in:
parent
74503a35a6
commit
2f804ee307
72
source/fx/fxsmoke.cpp
Normal file
72
source/fx/fxsmoke.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/******************/
|
||||
/*** Smoke Puff ***/
|
||||
/******************/
|
||||
|
||||
#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"
|
||||
|
||||
#include "FX\FXSmokePuff.h"
|
||||
|
||||
int SmokePuffStartScale=ONE*2;
|
||||
int SmokePuffScaleInc=128;
|
||||
int SmokePuffAngleInc=128;
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXSmokePuff::init(DVECTOR const &_Pos)
|
||||
{
|
||||
CFX::init(_Pos);
|
||||
Velocity.vy=-1;
|
||||
|
||||
CurrentAngle=0;
|
||||
CurrentScale=SmokePuffStartScale;
|
||||
RGBDec=255/(CurrentScale/SmokePuffScaleInc);
|
||||
RGB.R=RGB.G=RGB.B=255;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CFXSmokePuff::think(int _frames)
|
||||
{
|
||||
CFX::think(_frames);
|
||||
|
||||
CurrentScale-=SmokePuffScaleInc;
|
||||
RGB.R-=RGBDec;
|
||||
RGB.G-=RGBDec;
|
||||
RGB.B-=RGBDec;
|
||||
|
||||
CurrentAngle+=SmokePuffAngleInc;
|
||||
CurrentAngle&=4095;
|
||||
if (CurrentScale<0)
|
||||
{
|
||||
killFX();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*** Render ******************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CFXSmokePuff::render()
|
||||
{
|
||||
DVECTOR RenderPos;
|
||||
|
||||
getFXRenderPos(RenderPos);
|
||||
if (!canRender()) return;
|
||||
|
||||
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(FRM__SMOKE,RenderPos.vx,RenderPos.vy,CurrentScale,CurrentScale,CurrentAngle,OtPos);
|
||||
setShadeTex(Ft4,0);
|
||||
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
|
||||
setSemiTrans(Ft4,1);
|
||||
Ft4->tpage|=3<<5;
|
||||
Frame=Ft4;
|
||||
}
|
||||
|
||||
|
27
source/fx/fxsmoke.h
Normal file
27
source/fx/fxsmoke.h
Normal file
@ -0,0 +1,27 @@
|
||||
/***********************/
|
||||
/*** Anim Base Class ***/
|
||||
/***********************/
|
||||
|
||||
#ifndef __FX_FX_SMOKE_PUFF_HEADER__
|
||||
#define __FX_FX_SMOKE_PUFF_HEADER__
|
||||
|
||||
#include "fx/fx.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
class CFXSmokePuff : public CFX
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
protected:
|
||||
POLY_FT4 *Frame;
|
||||
|
||||
s32 CurrentScale;
|
||||
s32 CurrentAngle;
|
||||
s16 RGBDec;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user