SBSPSS/source/fx/fx.h

138 lines
3.0 KiB
C
Raw Normal View History

2001-05-05 20:12:30 +02:00
/*********************/
/*** FX Base Class ***/
/*********************/
#ifndef __FX_FX_HEADER__
#define __FX_FX_HEADER__
#include "thing/thing.h"
/*****************************************************************************/
2001-06-19 23:19:01 +02:00
enum FX_FLAG
{
FX_FLAG_LOOP =1<<0,
FX_FLAG_COLLIDE_KILL =1<<1,
FX_FLAG_HAS_GRAVITY =1<<2,
FX_FLAG_INJURE_PLAYER =1<<3,
FX_FLAG_TRANS =1<<4,
FX_FLAG_NO_THINK_KILL =1<<13,
FX_FLAG_HIDDEN =1<<14,
FX_FLAG_SCREEN_FX =1<<15,
};
2001-05-05 20:12:30 +02:00
class CFX : public CFXThing
{
public:
enum FX_TYPE
{
2001-06-18 18:31:24 +02:00
FX_TYPE_NONE=0,
2001-05-31 22:07:48 +02:00
2001-06-19 23:19:01 +02:00
FX_TYPE_DROP_WATER,
FX_TYPE_DROP_ACID,
FX_TYPE_DROP_LAVA,
FX_TYPE_DROP_OIL,
2001-05-31 22:07:48 +02:00
FX_TYPE_SPLASH_WATER,
FX_TYPE_SPLASH_ACID,
FX_TYPE_SPLASH_LAVA,
FX_TYPE_SPLASH_OIL,
FX_TYPE_BUBBLE_WATER,
FX_TYPE_BUBBLE_ACID,
FX_TYPE_BUBBLE_LAVA,
FX_TYPE_BUBBLE_OIL,
2001-06-19 23:19:01 +02:00
FX_TYPE_GEYSER_WATER,
FX_TYPE_GEYSER_ACID,
FX_TYPE_GEYSER_LAVA,
FX_TYPE_GEYSER_OIL,
2001-06-12 01:37:59 +02:00
2001-06-12 22:20:52 +02:00
FX_TYPE_THWACK,
2001-05-05 20:12:30 +02:00
FX_TYPE_LIGHTNING_BOLT,
2001-06-19 23:19:01 +02:00
2001-05-18 22:54:43 +02:00
FX_TYPE_STEAM,
2001-05-21 20:11:30 +02:00
FX_TYPE_SMOKE,
FX_TYPE_GAS,
2001-05-05 20:12:30 +02:00
FX_TYPE_FLAMES,
2001-05-31 00:05:41 +02:00
2001-06-18 18:31:24 +02:00
FX_TYPE_JELLYFISH_LEGS,
FX_TYPE_FALLINGTILE,
FX_TYPE_EXPLODE,
2001-05-31 00:05:41 +02:00
FX_TYPE_NRG_BAR,
2001-06-18 18:31:24 +02:00
FX_TYPE_LASER,
2001-05-25 20:43:47 +02:00
FX_TYPE_MAX
};
enum
{ // For Dynamic ThingCache
MAX_SUBTYPE =FX_TYPE_MAX,
2001-05-05 20:12:30 +02:00
};
2001-06-19 23:19:01 +02:00
struct sFXRGB
{
u8 R,G,B;
};
enum FX_RGB
{
FX_RGB_WATER,
FX_RGB_ACID,
FX_RGB_LAVA,
FX_RGB_OIL,
FX_RGB_MAX
};
2001-05-16 21:06:02 +02:00
static CFX *Create(const FX_TYPE Type);
2001-05-05 20:12:30 +02:00
static CFX *Create(const FX_TYPE Type,CThing *Parent);
2001-05-16 21:06:02 +02:00
static CFX *Create(const FX_TYPE Type,DVECTOR const &Pos);
2001-06-19 23:19:01 +02:00
virtual bool alwaysThink() {return(Flags & FX_FLAG_SCREEN_FX);}
virtual void leftThinkZone(int _frames) {if (Flags & FX_FLAG_NO_THINK_KILL) killFX();}
2001-05-05 20:12:30 +02:00
virtual void init();
2001-05-31 22:07:48 +02:00
virtual void init(DVECTOR const &Pos);
2001-05-05 20:12:30 +02:00
virtual void shutdown();
virtual void think(int _frames);
virtual void render();
2001-06-19 23:19:01 +02:00
virtual int canCollide() {return(Flags & FX_FLAG_INJURE_PLAYER);}
2001-05-09 21:57:57 +02:00
virtual void SetOtPos(int Ot) {OtPos=Ot;}
2001-05-23 00:30:36 +02:00
virtual void setLife(int L) {Life=L;}
2001-05-31 22:07:48 +02:00
virtual void getFXRenderPos(DVECTOR &Pos);
virtual bool getFXParentPos(DVECTOR &Pos);
2001-06-19 23:19:01 +02:00
virtual void killFX();
virtual void toggleVisible() {Flags ^=FX_FLAG_HIDDEN;}
2001-05-09 21:57:57 +02:00
2001-05-05 20:12:30 +02:00
protected:
2001-06-19 23:19:01 +02:00
void collidedWith(CThing *_thisThing);
// Def Data
public:
virtual void setData(void *Data){}
virtual void setBaseData(void *Data);
void setRGB(u8 R,u8 G,u8 B) {RGB.R=R; RGB.G=G; RGB.B=B;}
void setRGB(sFXRGB &rgb) {setRGB(rgb.R,rgb.G,rgb.B);}
void setRGB(FX_RGB T) {setRGB(FXRGBTable[T]);}
void setAfterEffect(FX_TYPE Type) {AfterEffect=Type;}
//protected:
2001-05-23 00:30:36 +02:00
s16 Life;
2001-06-19 23:19:01 +02:00
u16 Flags;
sFXRGB RGB;
FX_TYPE AfterEffect;
DVECTOR Velocity;
s32 OtPos;
static sFXRGB FXRGBTable[FX_RGB_MAX];
2001-05-23 00:30:36 +02:00
2001-05-05 20:12:30 +02:00
};
2001-05-21 20:11:30 +02:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-06-12 01:37:59 +02:00
void TestFX(DVECTOR Pos,CThing *Parent);
2001-05-21 20:11:30 +02:00
2001-05-05 20:12:30 +02:00
#endif