metaforce/DataSpec/DNACommon/WPSC.hpp

61 lines
2.0 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-03-29 00:07:38 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/ParticleCommon.hpp"
namespace DataSpec {
class PAKEntryReadStream;
}
namespace hecl {
class ProjectPath;
}
2016-03-29 00:07:38 +00:00
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAParticle {
template <class IDType>
struct _WPSM {
static constexpr ParticleType Type = ParticleType::WPSM;
#define INT_ENTRY(name, identifier) IntElementFactory identifier;
#define U32_ENTRY(name, identifier) uint32_t identifier = ~0;
#define REAL_ENTRY(name, identifier) RealElementFactory identifier;
#define VECTOR_ENTRY(name, identifier) VectorElementFactory identifier;
#define MOD_VECTOR_ENTRY(name, identifier) ModVectorElementFactory identifier;
#define COLOR_ENTRY(name, identifier) ColorElementFactory identifier;
#define UV_ENTRY(name, identifier) UVElementFactory<IDType> identifier;
#define RES_ENTRY(name, identifier) ChildResourceFactory<IDType> identifier;
#define BOOL_ENTRY(name, identifier, def) bool identifier = def;
#include "WPSC.def"
2021-06-07 19:29:18 +00:00
template <typename _Func>
void constexpr Enumerate(_Func f) {
#define ENTRY(name, identifier) f(FOURCC(name), identifier);
#define BOOL_ENTRY(name, identifier, def) f(FOURCC(name), identifier, def);
#include "WPSC.def"
2018-12-08 05:30:43 +00:00
}
2021-06-07 19:29:18 +00:00
template <typename _Func>
bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
#define ENTRY(name, identifier) \
case SBIG(name): \
f(identifier); \
return true;
#include "WPSC.def"
2021-06-07 19:29:18 +00:00
default:
return false;
}
}
2016-03-29 00:07:38 +00:00
};
template <class IDType>
using WPSM = PPImpl<_WPSM<IDType>>;
2016-03-29 00:07:38 +00:00
template <class IDType>
bool ExtractWPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteWPSM(const WPSM<IDType>& wpsm, const hecl::ProjectPath& outPath);
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAParticle