This commit is contained in:
parent
cbb222889a
commit
a5eec330cd
91
source/fx/fxbaseemitter.cpp
Normal file
91
source/fx/fxbaseemitter.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/**************************/
|
||||
/*** Emitter 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"
|
||||
#include "FX\FXEmitter.h"
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::init(DVECTOR const &_Pos)
|
||||
{
|
||||
CFX::init();
|
||||
Pos=_Pos;
|
||||
SetFrame(0,0);
|
||||
Scale=ONE;
|
||||
BirthCount=0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::setUp(int W,int H,int Rate,int Amount,int Life)
|
||||
{
|
||||
SetSize(W,H);
|
||||
SetRate(Rate,Amount);
|
||||
SetLife(L);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::think(int _frames)
|
||||
{
|
||||
CFX::think(_frames);
|
||||
|
||||
BirthCount-=_frames;
|
||||
if (BirthCount<=0)
|
||||
{
|
||||
BirthCount=BirthRate;
|
||||
Create(_frames);
|
||||
}
|
||||
Life--;
|
||||
if (Life
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::Create(int _frames)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Render ******************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CFXEmitter::render()
|
||||
{
|
||||
DVECTOR renderPos;
|
||||
if (MapEmitter)
|
||||
{
|
||||
CFX::render();
|
||||
if (!canRender()) return;
|
||||
renderPos=getRenderPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderPos=getPos()
|
||||
}
|
||||
|
||||
POLY_F4 *f4;
|
||||
f4=GetPrimF4();
|
||||
setPolyF4(f4);
|
||||
setXYWH(f4,renderPos.vx,renderPos.vy,Width.Height);
|
||||
setSemiTrans(f4,1);
|
||||
setShadeTex(f4,0);
|
||||
setRGB0(f4,30,40,50);
|
||||
AddPrimToList(f4,0);
|
||||
}
|
79
source/fx/fxbaseemitter.h
Normal file
79
source/fx/fxbaseemitter.h
Normal file
@ -0,0 +1,79 @@
|
||||
/**************************/
|
||||
/*** Emitter Base Class ***/
|
||||
/**************************/
|
||||
|
||||
#ifndef __FX_FX_EMITTER_HEADER__
|
||||
#define __FX_FX_EMITTER_HEADER__
|
||||
|
||||
#include "fx/fx.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
class CFXEmitter : public CFX
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
virtual void setUp(int W,int H,int Rate,int Amount,int Life);
|
||||
|
||||
virtual void create(int _frames);
|
||||
|
||||
void SetSize(int W,int H) {Width=W; Height=H;}
|
||||
void SetRate(int Rate,int Amount) {BirthRate=Rate; BirthAmount=Amount;}
|
||||
void SetLife(int L) {Life=L;}
|
||||
|
||||
protected:
|
||||
s16 Width,Height;
|
||||
s16 BirthRate,BirthAmount;
|
||||
s16 BirthCount;
|
||||
s16 Life;
|
||||
bool MapEmitter;
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
int m_x,m_y,m_w,m_h; // Size and position of emitter
|
||||
s16 m_birthRate,m_birthAmount; // birthAmount bubicles born every birthRate frames
|
||||
s16 m_life; // -1 for infinite life
|
||||
s16 m_applyMapOffset; // Is bubicle position relative to the map or not?
|
||||
|
||||
BubicleData m_bubicleBase;
|
||||
BubicleData m_bubicleRange;
|
||||
} BubicleEmitterData;
|
||||
|
||||
class CBubicleEmitter
|
||||
{
|
||||
public:
|
||||
void kill();
|
||||
void setPos(int _x,int _y);
|
||||
void setSize(int _w,int _h);
|
||||
void setPosAndSize(int _x,int _y,int _w,int _h) {setPos(_x,_y);setSize(_w,_h);}
|
||||
|
||||
int isActive() {return m_active;}
|
||||
|
||||
|
||||
private:
|
||||
CBubicleEmitter() {;}
|
||||
|
||||
void create();
|
||||
void init(BubicleEmitterData *_init);
|
||||
|
||||
void think(int _frames);
|
||||
#ifdef SHOW_BUBICLE_EMITTERS
|
||||
void render();
|
||||
#endif
|
||||
|
||||
|
||||
u8 m_active;
|
||||
BubicleEmitterData m_data;
|
||||
int m_frameCount;
|
||||
s16 m_spawnFrameCount;
|
||||
|
||||
friend class CBubicleFactory;
|
||||
};
|
||||
*/
|
Loading…
Reference in New Issue
Block a user