2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/Weapon/CGSFidget.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
#include "Runtime/Character/CPASAnimParmData.hpp"
|
|
|
|
#include "Runtime/Character/CAnimData.hpp"
|
|
|
|
#include "Runtime/Weapon/WeaponCommon.hpp"
|
2016-12-10 02:35:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
|
|
|
bool CGSFidget::Update(CAnimData& data, float dt, CStateManager& mgr) {
|
|
|
|
return !data.IsAnimTimeRemaining(0.001f, "Whole Body");
|
2017-08-26 04:36:25 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) {
|
|
|
|
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
|
|
|
|
CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId),
|
|
|
|
CPASAnimParm::FromInt32(animSet));
|
|
|
|
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
|
|
|
bool loop = pas.GetAnimState(1)->GetAnimParmData(anim.second, 3).GetBoolValue();
|
|
|
|
x14_gunId = gunId;
|
|
|
|
x18_animSet = animSet;
|
|
|
|
if (anim.second != -1) {
|
|
|
|
data.EnableLooping(loop);
|
|
|
|
CAnimPlaybackParms aParms(anim.second, -1, 1.f, true);
|
|
|
|
data.SetAnimation(aParms, false);
|
|
|
|
UnLoadAnim();
|
|
|
|
}
|
|
|
|
return anim.second;
|
2017-08-26 04:36:25 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) {
|
|
|
|
CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId),
|
|
|
|
CPASAnimParm::FromInt32(animSet));
|
|
|
|
auto anim = data.GetCharacterInfo().GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
|
|
|
if (anim.second != -1)
|
|
|
|
NWeaponTypes::get_token_vector(data, anim.second, x0_anims, true);
|
2017-08-26 04:36:25 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CGSFidget::UnLoadAnim() { x0_anims.clear(); }
|
2017-08-26 04:36:25 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CGSFidget::IsAnimLoaded() const { return NWeaponTypes::are_tokens_ready(x0_anims); }
|
|
|
|
} // namespace urde
|