2016-08-14 21:11:44 +00:00
|
|
|
#include "CGunController.hpp"
|
2016-08-23 03:12:50 +00:00
|
|
|
#include "Character/CCharLayoutInfo.hpp"
|
2016-12-10 02:35:20 +00:00
|
|
|
#include "Character/CPASAnimParmData.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
2016-08-14 21:11:44 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2016-12-10 02:35:20 +00:00
|
|
|
bool CGunController::Update(float dt, CStateManager& mgr)
|
2016-08-14 21:11:44 +00:00
|
|
|
{
|
2016-12-10 02:35:20 +00:00
|
|
|
CAnimData& animData = *x0_modelData.AnimationData();
|
|
|
|
switch (x50_gunState)
|
|
|
|
{
|
|
|
|
case EGunState::FreeLook:
|
|
|
|
{
|
|
|
|
x58_24_ = x4_freeLook.Update(animData, dt, mgr);
|
|
|
|
if (!x58_24_ || !x58_25_)
|
|
|
|
break;
|
|
|
|
|
|
|
|
EnterComboFire(mgr, x4_freeLook.xc_);
|
|
|
|
x58_24_ = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EGunState::ComboFire:
|
|
|
|
x58_24_ = x1c_comboFire.Update(animData, dt, mgr);
|
|
|
|
break;
|
|
|
|
case EGunState::Fidget:
|
|
|
|
x58_24_ = x30_fidget.Update(animData, dt, mgr);
|
|
|
|
break;
|
|
|
|
case EGunState::Six:
|
|
|
|
{
|
|
|
|
if (animData.IsAnimTimeRemaining(0.001f, "Whole Body"))
|
|
|
|
break;
|
|
|
|
x54_ = x4_freeLook.SetAnim(animData, x4_freeLook.xc_, x4_freeLook.x10_, 0, mgr, 0.f);
|
|
|
|
x50_gunState = EGunState::FreeLook;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EGunState::Seven:
|
|
|
|
x58_24_ = !animData.IsAnimTimeRemaining(0.001f, "Whole Body");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!x58_24_)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
x50_gunState = EGunState::Zero;
|
|
|
|
x58_25_ = false;
|
|
|
|
|
|
|
|
return true;
|
2016-08-14 21:11:44 +00:00
|
|
|
}
|
|
|
|
|
2016-12-10 02:35:20 +00:00
|
|
|
void CGunController::ReturnToBasePosition(CStateManager& mgr, float)
|
|
|
|
{
|
|
|
|
const CPASDatabase& pasDatabase = x0_modelData.AnimationData()->GetCharacterInfo().GetPASDatabase();
|
|
|
|
std::pair<float, s32> anim =
|
|
|
|
pasDatabase.FindBestAnimation(CPASAnimParmData::NoParameters(6), *mgr.GetActiveRandom(), -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGunController::Reset()
|
|
|
|
{
|
|
|
|
x58_24_ = true;
|
|
|
|
x58_25_ = false;
|
|
|
|
x50_gunState = EGunState::Zero;
|
|
|
|
}
|
2016-08-14 21:11:44 +00:00
|
|
|
}
|