2016-02-13 09:02:47 +00:00
|
|
|
#ifndef __PSHAG_CPARTICLEDATAFACTORY_HPP__
|
|
|
|
#define __PSHAG_CPARTICLEDATAFACTORY_HPP__
|
2016-02-05 01:27:03 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "IObj.hpp"
|
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "IOStreams.hpp"
|
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace pshag
|
2016-02-05 01:27:03 +00:00
|
|
|
{
|
|
|
|
class CGenDescription;
|
|
|
|
class CSwooshDescription;
|
|
|
|
class CElectricDescription;
|
|
|
|
class CSimplePool;
|
|
|
|
class CVParamTransfer;
|
|
|
|
class CModel;
|
|
|
|
class CUVElement;
|
|
|
|
class CColorElement;
|
|
|
|
class CModVectorElement;
|
|
|
|
class CEmitterElement;
|
|
|
|
class CVectorElement;
|
|
|
|
class CRealElement;
|
|
|
|
class CIntElement;
|
|
|
|
|
|
|
|
struct SParticleModel
|
|
|
|
{
|
2016-02-15 02:31:46 +00:00
|
|
|
TLockedToken<CModel> m_token;
|
2016-02-06 00:34:40 +00:00
|
|
|
bool m_found = false;
|
2016-02-15 02:31:46 +00:00
|
|
|
CModel* m_model = nullptr;
|
2016-02-17 03:42:27 +00:00
|
|
|
SParticleModel() = default;
|
|
|
|
SParticleModel(CToken&& tok, bool found)
|
|
|
|
: m_token(std::move(tok)), m_found(found) {}
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SChildGeneratorDesc
|
|
|
|
{
|
2016-02-15 02:31:46 +00:00
|
|
|
TLockedToken<CGenDescription> m_token;
|
2016-02-06 00:34:40 +00:00
|
|
|
bool m_found = false;
|
2016-02-15 02:31:46 +00:00
|
|
|
CGenDescription* m_gen = nullptr;
|
2016-02-17 03:42:27 +00:00
|
|
|
SChildGeneratorDesc() = default;
|
|
|
|
SChildGeneratorDesc(CToken&& tok, bool found)
|
|
|
|
: m_token(std::move(tok)), m_found(found) {}
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SSwooshGeneratorDesc
|
|
|
|
{
|
2016-02-15 02:31:46 +00:00
|
|
|
TLockedToken<CSwooshDescription> m_token;
|
2016-02-06 00:34:40 +00:00
|
|
|
bool m_found = false;
|
2016-02-15 02:31:46 +00:00
|
|
|
CSwooshDescription* m_swoosh = nullptr;
|
2016-02-17 03:42:27 +00:00
|
|
|
SSwooshGeneratorDesc() = default;
|
|
|
|
SSwooshGeneratorDesc(CToken&& tok, bool found)
|
|
|
|
: m_token(std::move(tok)), m_found(found) {}
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SElectricGeneratorDesc
|
|
|
|
{
|
2016-02-15 02:31:46 +00:00
|
|
|
TLockedToken<CElectricDescription> m_token;
|
2016-02-06 00:34:40 +00:00
|
|
|
bool m_found = false;
|
2016-02-15 02:31:46 +00:00
|
|
|
CElectricDescription* m_electric = nullptr;
|
2016-02-17 03:42:27 +00:00
|
|
|
SElectricGeneratorDesc() = default;
|
|
|
|
SElectricGeneratorDesc(CToken&& tok, bool found)
|
|
|
|
: m_token(std::move(tok)), m_found(found) {}
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CParticleDataFactory
|
|
|
|
{
|
2016-02-10 22:54:47 +00:00
|
|
|
friend class CDecalDataFactory;
|
2016-02-16 07:01:55 +00:00
|
|
|
friend class CCollisionResponseData;
|
2016-02-10 22:54:47 +00:00
|
|
|
friend class CParticleElectricDataFactory;
|
|
|
|
friend class CParticleSwooshDataFactory;
|
2016-02-13 19:05:59 +00:00
|
|
|
friend class CProjectileWeaponDataFactory;
|
2016-02-10 22:54:47 +00:00
|
|
|
|
2016-02-05 01:27:03 +00:00
|
|
|
static SParticleModel GetModel(CInputStream& in, CSimplePool* resPool);
|
2016-02-07 07:25:34 +00:00
|
|
|
static SChildGeneratorDesc GetChildGeneratorDesc(TResId res, CSimplePool* resPool, const std::vector<TResId>& tracker);
|
|
|
|
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<TResId>& tracker);
|
2016-02-05 01:27:03 +00:00
|
|
|
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
|
|
|
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
|
|
|
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
|
|
|
|
static CColorElement* GetColorElement(CInputStream& in);
|
|
|
|
static CModVectorElement* GetModVectorElement(CInputStream& in);
|
|
|
|
static CEmitterElement* GetEmitterElement(CInputStream& in);
|
|
|
|
static CVectorElement* GetVectorElement(CInputStream& in);
|
|
|
|
static CRealElement* GetRealElement(CInputStream& in);
|
|
|
|
static CIntElement* GetIntElement(CInputStream& in);
|
|
|
|
|
|
|
|
static float GetReal(CInputStream& in);
|
|
|
|
static int32_t GetInt(CInputStream& in);
|
|
|
|
static bool GetBool(CInputStream& in);
|
|
|
|
static FourCC GetClassID(CInputStream& in);
|
2016-02-07 07:25:34 +00:00
|
|
|
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<TResId>& tracker,
|
|
|
|
TResId resId, CSimplePool* resPool);
|
2016-02-05 01:27:03 +00:00
|
|
|
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
|
2016-02-07 07:25:34 +00:00
|
|
|
std::vector<TResId>& tracker, CSimplePool* resPool);
|
2016-02-05 01:27:03 +00:00
|
|
|
static void LoadGPSMTokens(CGenDescription* desc);
|
2016-02-15 02:31:46 +00:00
|
|
|
public:
|
|
|
|
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
#endif // __PSHAG_CPARTICLEDATAFACTORY_HPP__
|