2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Custom Classes
|
|
|
|
#include "CDTable.h"
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
struct CDAnimation {
|
|
|
|
// unsigned int animationGroupID;
|
|
|
|
// std::string animation_type;
|
|
|
|
// The above two are a pair to represent a primary key in the map.
|
2022-07-28 13:39:57 +00:00
|
|
|
std::string animation_name; //!< The animation name
|
|
|
|
float chance_to_play; //!< The chance to play the animation
|
|
|
|
unsigned int min_loops; //!< The minimum number of loops
|
|
|
|
unsigned int max_loops; //!< The maximum number of loops
|
|
|
|
float animation_length; //!< The animation length
|
|
|
|
bool hideEquip; //!< Whether or not to hide the equip
|
|
|
|
bool ignoreUpperBody; //!< Whether or not to ignore the upper body
|
|
|
|
bool restartable; //!< Whether or not the animation is restartable
|
|
|
|
std::string face_animation_name; //!< The face animation name
|
|
|
|
float priority; //!< The priority
|
|
|
|
float blendTime; //!< The blend time
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-03-17 14:36:21 +00:00
|
|
|
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
|
2023-03-20 13:10:52 +00:00
|
|
|
typedef int32_t AnimationGroupID;
|
|
|
|
typedef std::string AnimationID;
|
|
|
|
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
|
2021-12-05 17:54:36 +00:00
|
|
|
public:
|
2023-03-20 13:10:52 +00:00
|
|
|
CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
|
|
|
|
void CacheAnimationGroup(AnimationGroupID animationGroupID);
|
|
|
|
private:
|
|
|
|
void CacheAnimations(const CDAnimationKey animationKey);
|
|
|
|
bool CacheData(CppSQLite3Statement queryToCache);
|
|
|
|
/**
|
|
|
|
* Each animation type has a vector of animations. This is because there can be animations have a percent chance to play so one is selected at random.
|
|
|
|
*/
|
|
|
|
std::map<CDAnimationKey, std::vector<CDAnimation>> animations;
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|