2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CANIMDATA_HPP__
|
|
|
|
#define __URDE_CANIMDATA_HPP__
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2016-04-12 22:28:08 +00:00
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "CCharacterInfo.hpp"
|
|
|
|
#include "CParticleDatabase.hpp"
|
|
|
|
#include "CPoseAsTransforms.hpp"
|
|
|
|
#include "CHierarchyPoseBuilder.hpp"
|
2016-04-19 00:17:49 +00:00
|
|
|
#include "CAdditiveAnimPlayback.hpp"
|
2016-08-23 03:12:50 +00:00
|
|
|
#include "CCharLayoutInfo.hpp"
|
2016-09-04 02:27:35 +00:00
|
|
|
#include "CAnimPlaybackParms.hpp"
|
2017-05-06 05:21:42 +00:00
|
|
|
#include "IAnimReader.hpp"
|
2016-04-14 03:32:27 +00:00
|
|
|
#include <set>
|
|
|
|
|
|
|
|
enum class EUserEventType
|
|
|
|
{
|
2017-05-18 10:58:15 +00:00
|
|
|
Projectile = 0,
|
|
|
|
EggLay = 1,
|
|
|
|
LoopedSoundStop = 2,
|
|
|
|
AlignTargetPos = 3,
|
|
|
|
AlignTargetRot = 4,
|
|
|
|
ChangeMaterial = 5,
|
|
|
|
Delete = 6,
|
|
|
|
GenerateEnd = 7,
|
|
|
|
DamageOn = 8,
|
|
|
|
DamageOff = 9,
|
|
|
|
AlignTargetPosStart = 10,
|
|
|
|
DeGenerate = 11,
|
|
|
|
Landing = 12,
|
|
|
|
TakeOff = 13,
|
|
|
|
FadeIn = 14,
|
|
|
|
FadeOut = 15,
|
|
|
|
ScreenShake = 16,
|
|
|
|
BeginAction = 17,
|
|
|
|
EndAction = 18,
|
|
|
|
BecomeRagDoll = 19,
|
|
|
|
IkLock = 20,
|
|
|
|
IkRelease = 21,
|
|
|
|
BreakLockOn = 22,
|
|
|
|
BecomeShootThrough = 23,
|
|
|
|
RemoveCollision = 24,
|
|
|
|
ObjectPickUp = 25,
|
|
|
|
ObjectDrop = 26,
|
|
|
|
EventStart = 27,
|
|
|
|
EventStop = 28,
|
|
|
|
Activate = 29,
|
|
|
|
Deactivate = 30,
|
|
|
|
SoundPlay = 31,
|
|
|
|
SoundStop = 32,
|
|
|
|
EffectOn = 33,
|
|
|
|
EffectOff = 34
|
2016-04-14 03:32:27 +00:00
|
|
|
};
|
2016-04-12 22:28:08 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-18 05:54:43 +00:00
|
|
|
{
|
2016-04-12 22:28:08 +00:00
|
|
|
class CCharLayoutInfo;
|
|
|
|
class CSkinnedModel;
|
2016-04-15 03:02:21 +00:00
|
|
|
class CMorphableSkinnedModel;
|
2016-05-21 03:02:09 +00:00
|
|
|
struct CAnimSysContext;
|
2016-04-12 22:28:08 +00:00
|
|
|
class CAnimationManager;
|
|
|
|
class CTransitionManager;
|
|
|
|
class CCharacterFactory;
|
|
|
|
class IMetaAnim;
|
2016-05-23 05:35:27 +00:00
|
|
|
struct CModelFlags;
|
2016-04-14 03:32:27 +00:00
|
|
|
class CVertexMorphEffect;
|
|
|
|
class CPrimitive;
|
|
|
|
class CRandom16;
|
|
|
|
class CStateManager;
|
|
|
|
class CCharAnimTime;
|
|
|
|
class CModel;
|
|
|
|
class CSkinRules;
|
|
|
|
class CAnimTreeNode;
|
|
|
|
class CSegIdList;
|
|
|
|
class CSegStatementSet;
|
2016-04-16 21:49:47 +00:00
|
|
|
class CBoolPOINode;
|
|
|
|
class CInt32POINode;
|
|
|
|
class CParticlePOINode;
|
|
|
|
class CSoundPOINode;
|
2016-08-21 20:39:18 +00:00
|
|
|
class IAnimReader;
|
2016-04-14 21:42:47 +00:00
|
|
|
struct SAdvancementDeltas;
|
2017-03-01 06:02:54 +00:00
|
|
|
struct SAdvancementResults;
|
2016-04-12 22:28:08 +00:00
|
|
|
|
2015-08-18 05:54:43 +00:00
|
|
|
class CAnimData
|
|
|
|
{
|
2016-04-14 21:42:47 +00:00
|
|
|
friend class CModelData;
|
2017-06-03 06:03:07 +00:00
|
|
|
friend class CActor;
|
2017-09-02 04:06:05 +00:00
|
|
|
friend class CPlayerGun;
|
2017-09-04 02:22:46 +00:00
|
|
|
friend class CGrappleArm;
|
2017-08-18 01:30:15 +00:00
|
|
|
public:
|
|
|
|
enum class EAnimDir
|
|
|
|
{
|
|
|
|
Forward,
|
|
|
|
Backward
|
|
|
|
};
|
|
|
|
private:
|
2017-06-03 06:03:07 +00:00
|
|
|
|
2016-04-12 22:28:08 +00:00
|
|
|
TLockedToken<CCharacterFactory> x0_charFactory;
|
|
|
|
CCharacterInfo xc_charInfo;
|
|
|
|
TLockedToken<CCharLayoutInfo> xcc_layoutData;
|
|
|
|
TCachedToken<CSkinnedModel> xd8_modelData;
|
2016-04-15 03:02:21 +00:00
|
|
|
TLockedToken<CMorphableSkinnedModel> xe4_iceModelData;
|
2016-04-12 22:28:08 +00:00
|
|
|
std::shared_ptr<CSkinnedModel> xf4_xrayModel;
|
|
|
|
std::shared_ptr<CSkinnedModel> xf8_infraModel;
|
|
|
|
std::shared_ptr<CAnimSysContext> xfc_animCtx;
|
|
|
|
std::shared_ptr<CAnimationManager> x100_animMgr;
|
2017-08-18 01:30:15 +00:00
|
|
|
EAnimDir x104_animDir = EAnimDir::Forward;
|
2016-04-12 22:28:08 +00:00
|
|
|
zeus::CAABox x108_aabb;
|
|
|
|
CParticleDatabase x120_particleDB;
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId x1d8_selfId;
|
2016-09-04 22:47:48 +00:00
|
|
|
zeus::CVector3f x1dc_alignPos;
|
|
|
|
zeus::CQuaternion x1e8_alignRot;
|
2016-09-04 02:27:35 +00:00
|
|
|
std::shared_ptr<CAnimTreeNode> x1f8_animRoot;
|
2016-04-12 22:28:08 +00:00
|
|
|
std::shared_ptr<CTransitionManager> x1fc_transMgr;
|
|
|
|
|
2016-08-21 20:39:18 +00:00
|
|
|
float x200_speedScale = 1.f;
|
2016-04-15 03:02:21 +00:00
|
|
|
u32 x204_charIdx;
|
|
|
|
u16 x208_defaultAnim;
|
2016-04-12 22:28:08 +00:00
|
|
|
u32 x20c_passedBoolCount = 0;
|
|
|
|
u32 x210_passedIntCount = 0;
|
|
|
|
u32 x214_passedParticleCount = 0;
|
|
|
|
u32 x218_passedSoundCount = 0;
|
2017-06-03 06:03:07 +00:00
|
|
|
u32 x21c_particleLightIdx = 0;
|
2016-04-12 22:28:08 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
2016-08-21 00:04:50 +00:00
|
|
|
u32 x220_flags = 0;
|
2016-04-12 22:28:08 +00:00
|
|
|
struct
|
|
|
|
{
|
2016-08-21 00:04:50 +00:00
|
|
|
bool x220_24_animating : 1;
|
|
|
|
bool x220_25_loop : 1;
|
|
|
|
bool x220_26_ : 1;
|
|
|
|
bool x220_27_ : 1;
|
|
|
|
bool x220_28_ : 1;
|
2016-09-04 22:47:48 +00:00
|
|
|
bool x220_29_animationJustStarted : 1;
|
2016-08-21 20:39:18 +00:00
|
|
|
bool x220_30_poseBuilt : 1;
|
2016-08-21 00:04:50 +00:00
|
|
|
bool x220_31_poseCached : 1;
|
2016-04-12 22:28:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-08-21 00:04:50 +00:00
|
|
|
CPoseAsTransforms x224_pose;
|
|
|
|
CHierarchyPoseBuilder x2fc_poseBuilder;
|
2016-04-12 22:28:08 +00:00
|
|
|
|
2016-09-04 02:27:35 +00:00
|
|
|
CAnimPlaybackParms x40c_playbackParms;
|
|
|
|
rstl::reserved_vector<std::pair<u32, CAdditiveAnimPlayback>, 8> x434_additiveAnims;
|
2016-04-12 22:28:08 +00:00
|
|
|
|
2016-04-16 21:49:47 +00:00
|
|
|
static rstl::reserved_vector<CBoolPOINode, 8> g_BoolPOINodes;
|
|
|
|
static rstl::reserved_vector<CInt32POINode, 16> g_Int32POINodes;
|
|
|
|
static rstl::reserved_vector<CParticlePOINode, 20> g_ParticlePOINodes;
|
|
|
|
static rstl::reserved_vector<CSoundPOINode, 20> g_SoundPOINodes;
|
2017-07-10 04:55:51 +00:00
|
|
|
static rstl::reserved_vector<CInt32POINode, 16> g_TransientInt32POINodes;
|
2016-04-16 21:49:47 +00:00
|
|
|
|
2016-09-12 04:53:28 +00:00
|
|
|
int m_drawInstCount;
|
|
|
|
|
2015-08-18 05:54:43 +00:00
|
|
|
public:
|
2017-08-13 05:26:14 +00:00
|
|
|
CAnimData(CAssetId,
|
2016-04-15 03:02:21 +00:00
|
|
|
const CCharacterInfo& character,
|
|
|
|
int defaultAnim, int charIdx, bool loop,
|
2016-04-12 22:28:08 +00:00
|
|
|
const TLockedToken<CCharLayoutInfo>& layout,
|
|
|
|
const TToken<CSkinnedModel>& model,
|
2016-04-15 03:02:21 +00:00
|
|
|
const std::experimental::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
2016-04-12 22:28:08 +00:00
|
|
|
const std::weak_ptr<CAnimSysContext>& ctx,
|
|
|
|
const std::shared_ptr<CAnimationManager>& animMgr,
|
|
|
|
const std::shared_ptr<CTransitionManager>& transMgr,
|
2016-09-12 04:53:28 +00:00
|
|
|
const TLockedToken<CCharacterFactory>& charFactory,
|
|
|
|
int drawInstCount);
|
2016-04-14 03:32:27 +00:00
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
|
2017-03-01 06:02:54 +00:00
|
|
|
static SAdvancementResults AdvanceAdditiveAnim(std::shared_ptr<CAnimTreeNode>& anim, const CCharAnimTime& time);
|
2016-08-21 20:39:18 +00:00
|
|
|
SAdvancementDeltas AdvanceAdditiveAnims(float);
|
|
|
|
SAdvancementDeltas UpdateAdditiveAnims(float);
|
2016-04-14 03:32:27 +00:00
|
|
|
bool IsAdditiveAnimation(u32) const;
|
2017-07-11 07:17:03 +00:00
|
|
|
bool IsAdditiveAnimationAdded(u32) const;
|
|
|
|
const std::shared_ptr<CAnimTreeNode>& GetAdditiveAnimationTree(u32) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
bool IsAdditiveAnimationActive(u32) const;
|
|
|
|
void DelAdditiveAnimation(u32);
|
|
|
|
void AddAdditiveAnimation(u32, float, bool, bool);
|
2017-07-11 07:17:03 +00:00
|
|
|
float GetAdditiveAnimationWeight(u32 idx) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
std::shared_ptr<CAnimationManager> GetAnimationManager();
|
2016-12-10 02:35:20 +00:00
|
|
|
const CCharacterInfo& GetCharacterInfo() const { return xc_charInfo; }
|
2016-08-21 00:04:50 +00:00
|
|
|
const CCharLayoutInfo& GetCharLayoutInfo() const { return *xcc_layoutData.GetObj(); }
|
2016-04-14 03:32:27 +00:00
|
|
|
void SetPhase(float);
|
2016-04-14 21:42:47 +00:00
|
|
|
void Touch(const CSkinnedModel& model, int shaderIdx) const;
|
|
|
|
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
CCharAnimTime GetTimeOfUserEvent(EUserEventType, const CCharAnimTime& time) const;
|
|
|
|
void MultiplyPlaybackRate(float);
|
|
|
|
void SetPlaybackRate(float);
|
|
|
|
void SetRandomPlaybackRate(CRandom16&);
|
|
|
|
void CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
|
2016-09-04 02:27:35 +00:00
|
|
|
const std::shared_ptr<CAnimTreeNode>& node);
|
2016-04-14 03:32:27 +00:00
|
|
|
zeus::CTransform GetLocatorTransform(CSegId id, const CCharAnimTime* time) const;
|
2017-11-13 06:19:18 +00:00
|
|
|
zeus::CTransform GetLocatorTransform(std::string_view name, const CCharAnimTime* time) const;
|
|
|
|
bool IsAnimTimeRemaining(float, std::string_view name) const;
|
|
|
|
float GetAnimTimeRemaining(std::string_view name) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
float GetAnimationDuration(int) const;
|
2016-08-21 00:04:50 +00:00
|
|
|
bool GetIsLoop() const {return x220_25_loop;}
|
|
|
|
void EnableLooping(bool val) {x220_25_loop = val; x220_24_animating = true;}
|
2017-07-10 04:55:51 +00:00
|
|
|
void EnableAnimation(bool val) {x220_24_animating = val;}
|
2016-08-21 00:04:50 +00:00
|
|
|
bool IsAnimating() const {return x220_24_animating;}
|
2017-08-18 01:30:15 +00:00
|
|
|
void SetAnimDir(EAnimDir dir) { x104_animDir = dir; }
|
2016-04-14 03:32:27 +00:00
|
|
|
std::shared_ptr<CAnimSysContext> GetAnimSysContext() const;
|
|
|
|
std::shared_ptr<CAnimationManager> GetAnimationManager() const;
|
2016-08-21 00:04:50 +00:00
|
|
|
void RecalcPoseBuilder(const CCharAnimTime*);
|
2016-09-04 02:27:35 +00:00
|
|
|
void RenderAuxiliary(const zeus::CFrustum& frustum) const;
|
2016-08-21 20:39:18 +00:00
|
|
|
void Render(CSkinnedModel& model, const CModelFlags& drawFlags,
|
2016-04-14 03:32:27 +00:00
|
|
|
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
2016-08-21 20:39:18 +00:00
|
|
|
const float* morphMagnitudes);
|
|
|
|
void SetupRender(CSkinnedModel& model,
|
|
|
|
const CModelFlags& drawFlags,
|
2016-04-14 03:32:27 +00:00
|
|
|
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
2016-08-21 20:39:18 +00:00
|
|
|
const float* morphMagnitudes);
|
|
|
|
static void DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags);
|
2016-04-14 03:32:27 +00:00
|
|
|
void PreRender();
|
|
|
|
void BuildPose();
|
2016-09-04 02:27:35 +00:00
|
|
|
static void PrimitiveSetToTokenVector(const std::set<CPrimitive>& primSet,
|
|
|
|
std::vector<CToken>& tokensOut, bool preLock);
|
2016-04-14 03:32:27 +00:00
|
|
|
void GetAnimationPrimitives(const CAnimPlaybackParms& parms, std::set<CPrimitive>& primsOut) const;
|
|
|
|
void SetAnimation(const CAnimPlaybackParms& parms, bool);
|
2017-06-03 06:03:07 +00:00
|
|
|
SAdvancementDeltas DoAdvance(float, bool& suspendParticles, CRandom16&, bool advTree);
|
2016-09-02 17:50:03 +00:00
|
|
|
SAdvancementDeltas Advance(float, const zeus::CVector3f&, CStateManager& stateMgr, TAreaId aid, bool advTree);
|
|
|
|
SAdvancementDeltas AdvanceIgnoreParticles(float, CRandom16&, bool advTree);
|
2016-04-14 03:32:27 +00:00
|
|
|
void AdvanceAnim(CCharAnimTime& time, zeus::CVector3f&, zeus::CQuaternion&);
|
|
|
|
void SetXRayModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
|
|
|
void SetInfraModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
2017-05-04 18:56:20 +00:00
|
|
|
const TCachedToken<CSkinnedModel>& GetModelData() const { return xd8_modelData; }
|
2016-04-14 03:32:27 +00:00
|
|
|
|
2016-08-21 20:39:18 +00:00
|
|
|
static void PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose,
|
|
|
|
const CModelFlags& drawFlags,
|
|
|
|
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
|
|
|
const float* morphMagnitudes);
|
2016-04-14 21:42:47 +00:00
|
|
|
void AdvanceParticles(const zeus::CTransform& xf, float dt,
|
2016-04-14 03:32:27 +00:00
|
|
|
const zeus::CVector3f&, CStateManager& stateMgr);
|
2016-09-04 02:27:35 +00:00
|
|
|
float GetAverageVelocity(int animIn) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
void ResetPOILists();
|
2017-11-13 06:19:18 +00:00
|
|
|
CSegId GetLocatorSegId(std::string_view name) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
zeus::CAABox GetBoundingBox(const zeus::CTransform& xf) const;
|
|
|
|
zeus::CAABox GetBoundingBox() const;
|
2017-05-06 05:21:42 +00:00
|
|
|
void SubstituteModelData(const TCachedToken<CSkinnedModel>& model);
|
2016-04-14 03:32:27 +00:00
|
|
|
static void FreeCache();
|
|
|
|
static void InitializeCache();
|
2017-01-08 03:36:24 +00:00
|
|
|
const CHierarchyPoseBuilder& GetPoseBuilder() const { return x2fc_poseBuilder; }
|
2016-04-29 10:08:46 +00:00
|
|
|
const CParticleDatabase& GetParticleDB() const { return x120_particleDB; }
|
2017-06-03 06:03:07 +00:00
|
|
|
CParticleDatabase& GetParticleDB() { return x120_particleDB; }
|
2017-11-13 06:19:18 +00:00
|
|
|
void SetParticleCEXTValue(std::string_view name, int idx, float value);
|
2017-06-03 06:03:07 +00:00
|
|
|
|
|
|
|
u32 GetPassedBoolPOICount() const { return x20c_passedBoolCount; }
|
|
|
|
u32 GetPassedIntPOICount() const { return x210_passedIntCount; }
|
|
|
|
u32 GetPassedParticlePOICount() const { return x214_passedParticleCount; }
|
|
|
|
u32 GetPassedSoundPOICount() const { return x218_passedSoundCount; }
|
|
|
|
|
|
|
|
u32 GetCharacterIndex() const { return x204_charIdx; }
|
2015-08-18 05:54:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CANIMDATA_HPP__
|