re3/src/objects/ParticleObject.h

110 lines
3.4 KiB
C
Raw Normal View History

2019-05-15 14:52:37 +00:00
#pragma once
2020-04-19 16:34:08 +00:00
2019-08-15 01:43:00 +00:00
#include "AudioManager.h"
2020-04-19 16:34:08 +00:00
#include "ParticleType.h"
#include "Placeable.h"
2019-08-15 01:43:00 +00:00
2020-07-02 23:18:06 +00:00
#define MAX_PARTICLEOBJECTS 70
2019-08-15 01:43:00 +00:00
#define MAX_AUDIOHYDRANTS 8
2019-05-15 14:52:37 +00:00
enum eParticleObjectType
{
2020-07-02 23:18:06 +00:00
POBJECT_PAVEMENT_STEAM = 0,
2019-05-15 14:52:37 +00:00
POBJECT_PAVEMENT_STEAM_SLOWMOTION,
POBJECT_WALL_STEAM,
POBJECT_WALL_STEAM_SLOWMOTION,
POBJECT_DARK_SMOKE,
POBJECT_FIRE_HYDRANT,
POBJECT_CAR_WATER_SPLASH,
POBJECT_PED_WATER_SPLASH,
POBJECT_SPLASHES_AROUND,
POBJECT_SMALL_FIRE,
POBJECT_BIG_FIRE,
POBJECT_DRY_ICE,
POBJECT_DRY_ICE_SLOWMOTION,
2020-07-02 23:18:06 +00:00
POBJECT_WATER_FOUNTAIN_VERT,
POBJECT_WATER_FOUNTAIN_HORIZ,
2019-05-15 14:52:37 +00:00
POBJECT_FIRE_TRAIL,
POBJECT_SMOKE_TRAIL,
POBJECT_FIREBALL_AND_SMOKE,
POBJECT_ROCKET_TRAIL,
POBJECT_EXPLOSION_ONCE,
POBJECT_CATALINAS_GUNFLASH,
POBJECT_CATALINAS_SHOTGUNFLASH,
};
2019-08-15 01:43:00 +00:00
enum eParticleObjectState
{
POBJECTSTATE_INITIALISED = 0,
POBJECTSTATE_UPDATE_CLOSE,
POBJECTSTATE_UPDATE_FAR,
POBJECTSTATE_FREE,
};
class CParticle;
2020-02-15 11:53:42 +00:00
class CParticleObject : public CPlaceable
2019-05-15 14:52:37 +00:00
{
public:
2019-08-15 01:43:00 +00:00
CParticleObject *m_pNext;
CParticleObject *m_pPrev;
CParticle *m_pParticle;
uint32 m_nRemoveTimer;
eParticleObjectType m_Type;
tParticleType m_ParticleType;
uint8 m_nNumEffectCycles;
uint8 m_nSkipFrames;
uint16 m_nFrameCounter;
uint16 m_nState;
CVector m_vecTarget;
float m_fRandVal;
float m_fSize;
CRGBA m_Color;
uint8 m_bRemove;
int8 m_nCreationChance;
2020-04-17 05:54:14 +00:00
static CParticleObject *pCloseListHead;
static CParticleObject *pFarListHead;
static CParticleObject *pUnusedListHead;
2019-08-15 01:43:00 +00:00
CParticleObject();
~CParticleObject();
static void Initialise(void);
2020-07-02 23:18:06 +00:00
static CParticleObject *AddObject(uint16 type, CVector const &pos, uint8 remove);
static CParticleObject *AddObject(uint16 type, CVector const &pos, float size, uint8 remove);
static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint8 remove);
static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, RwRGBA const &color, uint8 remove);
static CParticleObject *AddObject(tParticleType type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, uint8 numEffectCycles, uint8 skipFrames, uint16 creationChance, uint8 remove);
2019-08-15 01:43:00 +00:00
void RemoveObject(void);
static void UpdateAll(void);
void UpdateClose(void);
void UpdateFar(void);
static bool SaveParticle(uint8 *buffer, uint32 *length);
static bool LoadParticle(uint8 *buffer, uint32 length);
2020-07-02 23:18:06 +00:00
static void RemoveAllExpireableParticleObjects(void);
2019-08-15 01:43:00 +00:00
static void RemoveAllParticleObjects(void);
static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj);
2019-05-15 14:52:37 +00:00
};
2019-08-15 01:43:00 +00:00
2020-04-17 05:54:14 +00:00
extern CParticleObject gPObjectArray[MAX_PARTICLEOBJECTS];
2019-08-15 01:43:00 +00:00
class CAudioHydrant
{
public:
int32 AudioEntity;
CParticleObject *pParticleObject;
CAudioHydrant() :
AudioEntity(AEHANDLE_NONE),
2020-07-03 17:26:35 +00:00
pParticleObject(nil)
2019-08-15 01:43:00 +00:00
{ }
static bool Add (CParticleObject *particleobject);
static void Remove(CParticleObject *particleobject);
};