2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 03:07:41 +00:00

Character factory support classes

This commit is contained in:
Jack Andersen
2016-04-12 20:07:23 -10:00
parent 1d2c2bf31f
commit 5de5c3d85f
186 changed files with 898 additions and 553 deletions

View File

@@ -1,9 +1,10 @@
#ifndef __PSHAG_CFACTORYMGR_HPP__
#define __PSHAG_CFACTORYMGR_HPP__
#ifndef __URDE_CFACTORYMGR_HPP__
#define __URDE_CFACTORYMGR_HPP__
#include <unordered_map>
#include "RetroTypes.hpp"
#include "IOStreams.hpp"
#include "IFactory.hpp"
namespace urde
{
@@ -11,13 +12,6 @@ struct SObjectTag;
class CVParamTransfer;
class IObj;
using CFactoryFnReturn = std::unique_ptr<IObj>;
using FFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
urde::CInputStream& in,
const urde::CVParamTransfer& vparms)>;
using FMemFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms)>;
class CFactoryMgr
{
std::unordered_map<FourCC, FFactoryFunc> m_factories;
@@ -26,7 +20,9 @@ public:
CFactoryFnReturn MakeObject(const SObjectTag& tag, urde::CInputStream& in,
const CVParamTransfer& paramXfer);
bool CanMakeMemory(const urde::SObjectTag& tag) const;
CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag, std::unique_ptr<u8[]>&& buf, int size, bool compressed,
CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag,
std::unique_ptr<u8[]>&& buf,
int size, bool compressed,
const CVParamTransfer& paramXfer);
void AddFactory(FourCC key, FFactoryFunc func) {m_factories[key] = func;}
void AddFactory(FourCC key, FMemFactoryFunc func) {m_memFactories[key] = func;}
@@ -34,4 +30,4 @@ public:
}
#endif // __PSHAG_CFACTORYMGR_HPP__
#endif // __URDE_CFACTORYMGR_HPP__