2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 23:47:42 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:30:43 -10:00
parent 41ae32be31
commit 636c82a568
1451 changed files with 171430 additions and 203303 deletions

View File

@@ -6,8 +6,7 @@
#include "CToken.hpp"
#include "IOStreams.hpp"
namespace urde
{
namespace urde {
class CGenDescription;
class CSwooshDescription;
class CElectricDescription;
@@ -22,86 +21,79 @@ class CVectorElement;
class CRealElement;
class CIntElement;
struct SParticleModel
{
TLockedToken<CModel> m_token;
bool m_found = false;
CModel* m_model = nullptr;
SParticleModel() = default;
SParticleModel(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
struct SParticleModel {
TLockedToken<CModel> m_token;
bool m_found = false;
CModel* m_model = nullptr;
SParticleModel() = default;
SParticleModel(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
};
struct SChildGeneratorDesc
{
TLockedToken<CGenDescription> m_token;
bool m_found = false;
CGenDescription* m_gen = nullptr;
SChildGeneratorDesc() = default;
SChildGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
struct SChildGeneratorDesc {
TLockedToken<CGenDescription> m_token;
bool m_found = false;
CGenDescription* m_gen = nullptr;
SChildGeneratorDesc() = default;
SChildGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
};
struct SSwooshGeneratorDesc
{
TLockedToken<CSwooshDescription> m_token;
bool m_found = false;
CSwooshDescription* m_swoosh = nullptr;
SSwooshGeneratorDesc() = default;
SSwooshGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
struct SSwooshGeneratorDesc {
TLockedToken<CSwooshDescription> m_token;
bool m_found = false;
CSwooshDescription* m_swoosh = nullptr;
SSwooshGeneratorDesc() = default;
SSwooshGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
};
struct SElectricGeneratorDesc
{
TLockedToken<CElectricDescription> m_token;
bool m_found = false;
CElectricDescription* m_electric = nullptr;
SElectricGeneratorDesc() = default;
SElectricGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
struct SElectricGeneratorDesc {
TLockedToken<CElectricDescription> m_token;
bool m_found = false;
CElectricDescription* m_electric = nullptr;
SElectricGeneratorDesc() = default;
SElectricGeneratorDesc(CToken&& tok, bool found) : m_token(std::move(tok)), m_found(found) {}
operator bool() const { return m_found; }
};
class CParticleDataFactory
{
friend class CDecalDataFactory;
friend class CCollisionResponseData;
friend class CParticleElectricDataFactory;
friend class CParticleSwooshDataFactory;
friend class CProjectileWeaponDataFactory;
class CParticleDataFactory {
friend class CDecalDataFactory;
friend class CCollisionResponseData;
friend class CParticleElectricDataFactory;
friend class CParticleSwooshDataFactory;
friend class CProjectileWeaponDataFactory;
static SParticleModel GetModel(CInputStream& in, CSimplePool* resPool);
static SChildGeneratorDesc GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool, const std::vector<CAssetId>& tracker);
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<CAssetId>& tracker);
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static std::unique_ptr<CUVElement> GetTextureElement(CInputStream& in, CSimplePool* resPool);
static std::unique_ptr<CColorElement> GetColorElement(CInputStream& in);
static std::unique_ptr<CModVectorElement> GetModVectorElement(CInputStream& in);
static std::unique_ptr<CEmitterElement> GetEmitterElement(CInputStream& in);
static std::unique_ptr<CVectorElement> GetVectorElement(CInputStream& in);
static std::unique_ptr<CRealElement> GetRealElement(CInputStream& in);
static std::unique_ptr<CIntElement> GetIntElement(CInputStream& in);
static SParticleModel GetModel(CInputStream& in, CSimplePool* resPool);
static SChildGeneratorDesc GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool,
const std::vector<CAssetId>& tracker);
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool,
const std::vector<CAssetId>& tracker);
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static std::unique_ptr<CUVElement> GetTextureElement(CInputStream& in, CSimplePool* resPool);
static std::unique_ptr<CColorElement> GetColorElement(CInputStream& in);
static std::unique_ptr<CModVectorElement> GetModVectorElement(CInputStream& in);
static std::unique_ptr<CEmitterElement> GetEmitterElement(CInputStream& in);
static std::unique_ptr<CVectorElement> GetVectorElement(CInputStream& in);
static std::unique_ptr<CRealElement> GetRealElement(CInputStream& in);
static std::unique_ptr<CIntElement> GetIntElement(CInputStream& in);
static float GetReal(CInputStream& in);
static s32 GetInt(CInputStream& in);
static bool GetBool(CInputStream& in);
static FourCC GetClassID(CInputStream& in);
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<CAssetId>& tracker, CAssetId resId,
CSimplePool* resPool);
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in, std::vector<CAssetId>& tracker,
CSimplePool* resPool);
static void LoadGPSMTokens(CGenDescription* desc);
static float GetReal(CInputStream& in);
static s32 GetInt(CInputStream& in);
static bool GetBool(CInputStream& in);
static FourCC GetClassID(CInputStream& in);
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<CAssetId>& tracker,
CAssetId resId, CSimplePool* resPool);
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
std::vector<CAssetId>& tracker, CSimplePool* resPool);
static void LoadGPSMTokens(CGenDescription* desc);
public:
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
};
CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
CObjectReference* selfRef);
}
} // namespace urde