metaforce/Runtime/Character/IMetaAnim.hpp

72 lines
2.2 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-22 01:58:41 +00:00
#include <memory>
#include <optional>
2016-04-10 21:22:59 +00:00
#include <set>
2015-08-22 01:58:41 +00:00
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Character/CCharAnimTime.hpp"
2021-04-10 08:42:06 +00:00
namespace metaforce {
2016-04-10 21:22:59 +00:00
class CAnimTreeNode;
class CPrimitive;
2016-04-11 07:10:28 +00:00
class IAnimReader;
struct CAnimSysContext;
struct CMetaAnimTreeBuildOrders;
2016-04-10 21:22:59 +00:00
2018-12-08 05:30:43 +00:00
enum class EMetaAnimType { Play, Blend, PhaseBlend, Random, Sequence };
2015-08-22 01:58:41 +00:00
2018-12-08 05:30:43 +00:00
class CPreAdvanceIndicator {
bool x0_isTime;
CCharAnimTime x4_time;
const char* xc_string;
/*
u32 x10_;
u32 x14_;
2021-06-06 23:53:41 +00:00
u32 x18_fireTime;
u32 x1c_damageDelay;
2018-12-08 05:30:43 +00:00
u32 x20_;
u32 x24_;
u32 x28_;
u32 x2c_;
u32 x30_;
u32 x34_;
u32 x38_;
u16 x3c_;
*/
2016-04-11 07:10:28 +00:00
public:
explicit CPreAdvanceIndicator(const CCharAnimTime& time) : x0_isTime(true), x4_time(time) {}
explicit CPreAdvanceIndicator(const char* string) : x0_isTime(false), xc_string(string) {}
2018-12-08 05:30:43 +00:00
const char* GetString() const { return xc_string; }
bool IsString() const { return !x0_isTime; }
const CCharAnimTime& GetTime() const { return x4_time; }
bool IsTime() const { return x0_isTime; }
2016-04-11 07:10:28 +00:00
};
2018-12-08 05:30:43 +00:00
struct CMetaAnimTreeBuildOrders {
std::optional<CPreAdvanceIndicator> x0_recursiveAdvance;
std::optional<CPreAdvanceIndicator> x44_singleAdvance;
2018-12-08 05:30:43 +00:00
static CMetaAnimTreeBuildOrders NoSpecialOrders() { return {}; }
static CMetaAnimTreeBuildOrders PreAdvanceForAll(const CPreAdvanceIndicator& ind) {
CMetaAnimTreeBuildOrders ret;
ret.x44_singleAdvance.emplace(ind);
return ret;
}
2016-08-27 04:54:53 +00:00
};
2018-12-08 05:30:43 +00:00
class IMetaAnim {
2016-04-10 21:22:59 +00:00
public:
2018-12-08 05:30:43 +00:00
virtual ~IMetaAnim() = default;
virtual std::shared_ptr<CAnimTreeNode> GetAnimationTree(const CAnimSysContext& animSys,
const CMetaAnimTreeBuildOrders& orders) const;
virtual void GetUniquePrimitives(std::set<CPrimitive>& primsOut) const = 0;
virtual EMetaAnimType GetType() const = 0;
virtual std::shared_ptr<CAnimTreeNode> VGetAnimationTree(const CAnimSysContext& animSys,
const CMetaAnimTreeBuildOrders& orders) const = 0;
2016-04-11 07:10:28 +00:00
2018-12-08 05:30:43 +00:00
static void AdvanceAnim(IAnimReader& anim, const CCharAnimTime& dt);
static CCharAnimTime GetTime(const CPreAdvanceIndicator& ind, const IAnimReader& anim);
2015-08-22 01:58:41 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce