2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/Weapon/CGSFreeLook.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
#include "Runtime/Character/CPASAnimParmData.hpp"
|
2016-12-10 02:35:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-12-10 02:35:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CGSFreeLook::Update(CAnimData& data, float dt, CStateManager& mgr) {
|
|
|
|
if (x4_cueAnimId != -1) {
|
|
|
|
x0_delay -= dt;
|
|
|
|
if (x0_delay <= 0.f) {
|
|
|
|
data.EnableLooping(x8_loopState == 1);
|
|
|
|
CAnimPlaybackParms aparms(x4_cueAnimId, -1, 1.f, true);
|
|
|
|
data.SetAnimation(aparms, false);
|
|
|
|
x0_delay = 0.f;
|
|
|
|
x4_cueAnimId = -1;
|
2017-08-26 04:36:25 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (!data.IsAnimTimeRemaining(0.001f, "Whole Body")) {
|
|
|
|
switch (x8_loopState) {
|
|
|
|
case 0:
|
|
|
|
SetAnim(data, xc_gunId, x10_setId, 1, mgr, 0.f);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
x8_loopState = -1;
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2017-08-26 04:36:25 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
return false;
|
2016-12-10 02:35:20 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
s32 CGSFreeLook::SetAnim(CAnimData& data, s32 gunId, s32 setId, s32 loopState, CStateManager& mgr, float delay) {
|
|
|
|
s32 useLoopState = 1;
|
|
|
|
if (!x14_idle)
|
|
|
|
useLoopState = loopState;
|
|
|
|
x14_idle = false;
|
|
|
|
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
|
2020-04-22 09:08:02 +00:00
|
|
|
CPASAnimParmData parms(pas::EAnimationState::Step, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId),
|
2018-12-08 05:30:43 +00:00
|
|
|
CPASAnimParm::FromEnum(useLoopState));
|
|
|
|
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
|
|
|
xc_gunId = gunId;
|
2020-04-22 09:08:02 +00:00
|
|
|
x10_setId = pas.GetAnimState(pas::EAnimationState::Step)->GetAnimParmData(anim.second, 1).GetInt32Value();
|
2018-12-08 05:30:43 +00:00
|
|
|
x8_loopState = useLoopState;
|
|
|
|
if (delay != 0.f) {
|
|
|
|
x0_delay = delay;
|
|
|
|
x4_cueAnimId = anim.second;
|
|
|
|
} else {
|
|
|
|
data.EnableLooping(loopState == 1);
|
|
|
|
CAnimPlaybackParms aparms(anim.second, -1, 1.f, true);
|
|
|
|
data.SetAnimation(aparms, false);
|
|
|
|
}
|
|
|
|
return anim.second;
|
2016-12-10 02:35:20 +00:00
|
|
|
}
|
2017-08-26 04:36:25 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|