From 14c92e85cee61edda232b4d8e9100c509ad47199 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 22 Apr 2020 05:08:02 -0400 Subject: [PATCH 1/7] Use pas::EAnimationState in CPAS* --- Runtime/Character/CAdditiveBodyState.cpp | 8 +- Runtime/Character/CBodyController.cpp | 5 +- Runtime/Character/CBodyState.cpp | 168 +++++++------ Runtime/Character/CBodyStateInfo.cpp | 286 +++++++++++------------ Runtime/Character/CBodyStateInfo.hpp | 14 +- Runtime/Character/CPASAnimParmData.cpp | 2 +- Runtime/Character/CPASAnimParmData.hpp | 9 +- Runtime/Character/CPASAnimState.cpp | 5 +- Runtime/Character/CPASAnimState.hpp | 7 +- Runtime/Character/CPASDatabase.hpp | 4 +- Runtime/Character/CharacterCommon.hpp | 52 ++--- Runtime/MP1/World/CBabygoth.cpp | 2 +- Runtime/MP1/World/CBeetle.cpp | 4 +- Runtime/MP1/World/CChozoGhost.cpp | 6 +- Runtime/MP1/World/CFlyingPirate.cpp | 4 +- Runtime/MP1/World/CGrenadeLauncher.cpp | 10 +- Runtime/MP1/World/CRidley.cpp | 3 +- Runtime/MP1/World/CSpacePirate.cpp | 10 +- Runtime/Weapon/CGSComboFire.cpp | 3 +- Runtime/Weapon/CGSFidget.cpp | 6 +- Runtime/Weapon/CGSFreeLook.cpp | 4 +- Runtime/Weapon/CGunController.cpp | 10 +- Runtime/Weapon/CGunMotion.cpp | 6 +- Runtime/World/CKnockBackController.cpp | 4 +- Runtime/World/CPatterned.cpp | 4 +- Runtime/World/CScriptGunTurret.cpp | 11 +- 26 files changed, 337 insertions(+), 310 deletions(-) diff --git a/Runtime/Character/CAdditiveBodyState.cpp b/Runtime/Character/CAdditiveBodyState.cpp index 587e89499..a5bd39850 100644 --- a/Runtime/Character/CAdditiveBodyState.cpp +++ b/Runtime/Character/CAdditiveBodyState.cpp @@ -11,11 +11,11 @@ namespace urde { void CABSAim::Start(CBodyController& bc, CStateManager& mgr) { // const CBCAdditiveAimCmd* cmd = // static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveAim)); - const CPASAnimState* aimState = bc.GetPASDatabase().GetAnimState(22); + const CPASAnimState* aimState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::AdditiveAim); // Left, Right, Up, Down for (size_t i = 0; i < x8_anims.size(); ++i) { - const CPASAnimParmData parms(22, CPASAnimParm::FromEnum(s32(i))); + const CPASAnimParmData parms(pas::EAnimationState::AdditiveAim, CPASAnimParm::FromEnum(s32(i))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x8_anims[i] = best.second; x18_angles[i] = zeus::degToRad(aimState->GetAnimParmData(x8_anims[i], 1).GetReal32Value()); @@ -99,7 +99,7 @@ void CABSFlinch::Start(CBodyController& bc, CStateManager& mgr) { static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveFlinch)); x4_weight = cmd->GetWeight(); - CPASAnimParmData parms(23); + CPASAnimParmData parms(pas::EAnimationState::AdditiveFlinch); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x8_anim = best.second; @@ -145,7 +145,7 @@ void CABSReaction::Start(CBodyController& bc, CStateManager& mgr) { xc_type = cmd->GetType(); x10_active = cmd->GetIsActive(); - CPASAnimParmData parms(24, CPASAnimParm::FromEnum(s32(xc_type))); + CPASAnimParmData parms(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(s32(xc_type))); std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x8_anim = best.second; diff --git a/Runtime/Character/CBodyController.cpp b/Runtime/Character/CBodyController.cpp index 4e077b60e..2251e8846 100644 --- a/Runtime/Character/CBodyController.cpp +++ b/Runtime/Character/CBodyController.cpp @@ -80,7 +80,7 @@ void CBodyController::Update(float dt, CStateManager& mgr) { } } -bool CBodyController::HasBodyState(pas::EAnimationState state) const { return GetPASDatabase().HasState(s32(state)); } +bool CBodyController::HasBodyState(pas::EAnimationState state) const { return GetPASDatabase().HasState(state); } void CBodyController::SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans) { x0_actor.GetModelData()->GetAnimationData()->SetAnimation(parms, noTrans); @@ -269,7 +269,8 @@ void CBodyController::UpdateFrozenInfo(float dt, CStateManager& mgr) { } bool CBodyController::HasIceBreakoutState() const { - CPASAnimParmData parms(24, CPASAnimParm::FromEnum(3)); + CPASAnimParmData parms(pas::EAnimationState::AdditiveReaction, + CPASAnimParm::FromEnum(static_cast(pas::EAdditiveReactionType::IceBreakout))); std::pair best = GetPASDatabase().FindBestAnimation(parms, -1); return best.first > 0.f; } diff --git a/Runtime/Character/CBodyState.cpp b/Runtime/Character/CBodyState.cpp index 20a1703d9..166a65143 100644 --- a/Runtime/Character/CBodyState.cpp +++ b/Runtime/Character/CBodyState.cpp @@ -13,7 +13,7 @@ namespace urde { void CBSAttack::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::MeleeAttack)); const CPASDatabase& pasDatabase = bc.GetPASDatabase(); - const CPASAnimParmData parms(7, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), + const CPASAnimParmData parms(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); const std::pair best = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -121,13 +121,14 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr) { zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x()); angle.makeRel(); const float attackAngle = angle.asDegrees(); - const CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), - CPASAnimParm::FromReal32(angle.asDegrees()), - CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); + const CPASAnimParmData parms( + pas::EAnimationState::ProjectileAttack, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), + CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); const std::pair best1 = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (cmd->BlendTwoClosest()) { - const std::pair best2 = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), best1.second); - const CPASAnimState* projAttackState = bc.GetPASDatabase().GetAnimState(18); + const std::pair best2 = + bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), best1.second); + const CPASAnimState* projAttackState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::ProjectileAttack); float angle1 = projAttackState->GetAnimParmData(best1.second, 1).GetReal32Value(); float angle2 = projAttackState->GetAnimParmData(best2.second, 1).GetReal32Value(); if (angle1 - angle2 > 180.f) { @@ -178,7 +179,7 @@ pas::EAnimationState CBSProjectileAttack::UpdateBody(float dt, CBodyController& void CBSDie::Start(CBodyController& bc, CStateManager& mgr) { bool shouldReset = true; if (bc.ShouldPlayDeathAnims()) { - const CPASAnimParmData parms(4, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); + const CPASAnimParmData parms(pas::EAnimationState::Death, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 0.f) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -210,12 +211,12 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) { zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z()); angle.makeRel(); - const CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()), + const CPASAnimParmData parms(pas::EAnimationState::Fall, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const CPASAnimState* knockdownState = bc.GetPASDatabase().GetAnimState(0); + const CPASAnimState* knockdownState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Fall); if (!knockdownState->GetAnimParmData(best.second, 2).GetBoolValue()) { const float animAngle = zeus::degToRad(knockdownState->GetAnimParmData(best.second, 0).GetReal32Value()); zeus::CRelAngle delta1 = angle - animAngle; @@ -255,7 +256,7 @@ void CBSFall::Shutdown(CBodyController& bc) { bc.SetFallState(xc_fallState); } void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Getup)); - const CPASAnimParmData parms(1, CPASAnimParm::FromEnum(s32(bc.GetFallState())), + const CPASAnimParmData parms(pas::EAnimationState::Getup, CPASAnimParm::FromEnum(s32(bc.GetFallState())), CPASAnimParm::FromEnum(s32(cmd->GetGetupType()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > FLT_EPSILON) { @@ -263,7 +264,8 @@ void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); } - x4_fallState = pas::EFallState(bc.GetPASDatabase().GetAnimState(1)->GetAnimParmData(best.second, 2).GetEnumValue()); + x4_fallState = pas::EFallState( + bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Getup)->GetAnimParmData(best.second, 2).GetEnumValue()); } else { x4_fallState = pas::EFallState::Zero; } @@ -296,12 +298,12 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) { const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); angle.makeRel(); - const CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()), + const CPASAnimParmData parms(pas::EAnimationState::KnockBack, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const CPASAnimState* knockbackState = bc.GetPASDatabase().GetAnimState(6); + const CPASAnimState* knockbackState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::KnockBack); if (!knockbackState->GetAnimParmData(best.second, 2).GetBoolValue()) { const float animAngle = zeus::degToRad(knockbackState->GetAnimParmData(best.second, 0).GetReal32Value()); zeus::CRelAngle delta1 = angle - animAngle; @@ -353,11 +355,12 @@ pas::EAnimationState CBSKnockBack::UpdateBody(float dt, CBodyController& bc, CSt } CBSLieOnGround::CBSLieOnGround(CActor& actor) { - x4_24_hasGroundHit = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().HasState(11); + x4_24_hasGroundHit = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().HasState( + pas::EAnimationState::GroundHit); } void CBSLieOnGround::Start(CBodyController& bc, CStateManager& mgr) { - const CPASAnimParmData parms(2, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); + const CPASAnimParmData parms(pas::EAnimationState::LieOnGround, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 0.f) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -388,7 +391,7 @@ void CBSLieOnGround::Shutdown(CBodyController& bc) { bc.EnableAnimation(true); } void CBSStep::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Step)); - const CPASAnimParmData parms(3, CPASAnimParm::FromEnum(s32(cmd->GetStepDirection())), + const CPASAnimParmData parms(pas::EAnimationState::Step, CPASAnimParm::FromEnum(s32(cmd->GetStepDirection())), CPASAnimParm::FromEnum(s32(cmd->GetStepType()))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } @@ -450,12 +453,14 @@ void CBSTurn::Start(CBodyController& bc, CStateManager& mgr) { x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); const float deltaAngle = zeus::radToDeg(zeus::CVector2f::getAngleDiff(lookDir2d, x8_dest)); x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); - const CPASAnimParmData parms(8, CPASAnimParm::FromEnum(s32(x10_turnDir)), CPASAnimParm::FromReal32(deltaAngle), + const CPASAnimParmData parms(pas::EAnimationState::Turn, CPASAnimParm::FromEnum(s32(x10_turnDir)), + CPASAnimParm::FromReal32(deltaAngle), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const float animAngle = bc.GetPASDatabase().GetAnimState(8)->GetAnimParmData(best.second, 1).GetReal32Value(); + const float animAngle = + bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->GetAnimParmData(best.second, 1).GetReal32Value(); x4_rotateSpeed = zeus::degToRad((x10_turnDir == pas::ETurnDirection::Left) ? animAngle - deltaAngle : deltaAngle - animAngle); const float timeRem = bc.GetAnimTimeRemaining(); @@ -539,14 +544,15 @@ pas::EAnimationState CBSTurn::UpdateBody(float dt, CBodyController& bc, CStateMa } void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) { - if (bc.GetPASDatabase().GetAnimState(8)->HasAnims()) { + if (bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->HasAnims()) { CBSTurn::Start(bc, mgr); } else { x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; const zeus::CVector2f lookDir2d(lookDir.toVec2f()); x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); - const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); + const CPASAnimParmData parms(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0), + CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.second != bc.GetCurrentAnimId()) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -556,7 +562,7 @@ void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) { } pas::EAnimationState CBSFlyerTurn::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) { - if (bc.GetPASDatabase().GetAnimState(8)->HasAnims()) { + if (bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->HasAnims()) { return CBSTurn::UpdateBody(dt, bc, mgr); } @@ -580,12 +586,12 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) { xc_25_advance = false; if (bc.GetLocomotionType() == pas::ELocomotionType::Crouch) { - const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } else { x4_state = pas::ELoopState::Begin; - const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > FLT_EPSILON) { @@ -593,7 +599,7 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) { bc.SetCurrentAnimation(playParms, false, false); } else { x4_state = pas::ELoopState::Loop; - const CPASAnimParmData loopParms(9, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData loopParms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); } @@ -652,7 +658,8 @@ pas::EAnimationState CBSLoopAttack::UpdateBody(float dt, CBodyController& bc, CS return pas::EAnimationState::Locomotion; } if (bc.IsAnimationOver()) { - const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); + const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(1), + CPASAnimParm::FromEnum(s32(x8_loopAttackType))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); x4_state = pas::ELoopState::Loop; } else if (!bc.GetCommandMgr().GetTargetVector().isZero()) { @@ -662,7 +669,8 @@ pas::EAnimationState CBSLoopAttack::UpdateBody(float dt, CBodyController& bc, CS case pas::ELoopState::Loop: if (xc_25_advance && (!xc_24_waitForAnimOver || bc.IsAnimationOver())) { if (bc.GetLocomotionType() != pas::ELocomotionType::Crouch) { - const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); + const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(2), + CPASAnimParm::FromEnum(s32(x8_loopAttackType))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); x4_state = pas::ELoopState::End; } else { @@ -697,14 +705,15 @@ void CBSLoopReaction::Start(CBodyController& bc, CStateManager& mgr) { } x4_state = pas::ELoopState::Begin; - const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)), + CPASAnimParm::FromEnum(s32(x4_state))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > FLT_EPSILON) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); } else { x4_state = pas::ELoopState::Loop; - const CPASAnimParmData loopParms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), + const CPASAnimParmData loopParms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)), CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); } @@ -748,7 +757,8 @@ pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, const CBo } bool CBSLoopReaction::PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const { - const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(int(x8_reactionType)), CPASAnimParm::FromEnum(2)); + const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(int(x8_reactionType)), + CPASAnimParm::FromEnum(2)); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 0.f) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -772,7 +782,8 @@ pas::EAnimationState CBSLoopReaction::UpdateBody(float dt, CBodyController& bc, } } else { if (bc.IsAnimationOver()) { - const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), CPASAnimParm::FromEnum(1)); + const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)), + CPASAnimParm::FromEnum(1)); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); x4_state = pas::ELoopState::Loop; } else if (!bc.GetCommandMgr().GetTargetVector().isZero()) { @@ -810,12 +821,12 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) { const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); angle.makeRel(); - const CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())), + const CPASAnimParmData parms(pas::EAnimationState::GroundHit, CPASAnimParm::FromEnum(s32(bc.GetFallState())), CPASAnimParm::FromReal32(angle.asDegrees())); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const CPASAnimState* groundHitState = bc.GetPASDatabase().GetAnimState(11); + const CPASAnimState* groundHitState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::GroundHit); if (!groundHitState->GetAnimParmData(best.second, 2).GetBoolValue()) { const float animAngle = zeus::degToRad(groundHitState->GetAnimParmData(best.second, 1).GetReal32Value()); zeus::CRelAngle delta1 = angle - animAngle; @@ -860,7 +871,7 @@ void CBSGenerate::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Generate)); s32 anim; if (!cmd->UseSpecialAnimId()) { - const CPASAnimParmData parms(12, CPASAnimParm::FromEnum(s32(cmd->GetGenerateType()))); + const CPASAnimParmData parms(pas::EAnimationState::Generate, CPASAnimParm::FromEnum(s32(cmd->GetGenerateType()))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); anim = best.second; } else { @@ -918,7 +929,8 @@ void CBSJump::Start(CBodyController& bc, CStateManager& mgr) { } if (!cmd->StartInJumpLoop()) { x4_state = pas::EJumpState::IntoJump; - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), + CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } else { PlayJumpLoop(mgr, bc); @@ -949,7 +961,8 @@ bool CBSJump::CheckForWallJump(CBodyController& bc, CStateManager& mgr) { const float xExtent = (aabb.max.x() - aabb.min.x()) * 0.5f; if (distToWall < 1.414f * xExtent || (act->MadeSolidCollision() && distToWall < 3.f * xExtent)) { x4_state = x30_26_wallBounceRight ? pas::EJumpState::WallBounceRight : pas::EJumpState::WallBounceLeft; - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), + CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); return true; @@ -963,7 +976,8 @@ void CBSJump::CheckForLand(CBodyController& bc, CStateManager& mgr) { if (const TCastToPtr act = bc.GetOwner()) { if (act->MadeSolidCollision() || act->IsOnGround()) { x4_state = pas::EJumpState::OutOfJump; - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), + CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); } @@ -971,7 +985,8 @@ void CBSJump::CheckForLand(CBodyController& bc, CStateManager& mgr) { } void CBSJump::PlayJumpLoop(CStateManager& mgr, CBodyController& bc) { - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(s32(x8_jumpType))); + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(1), + CPASAnimParm::FromEnum(s32(x8_jumpType))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 99.f) { x4_state = pas::EJumpState::AmbushJump; @@ -979,7 +994,7 @@ void CBSJump::PlayJumpLoop(CStateManager& mgr, CBodyController& bc) { bc.SetCurrentAnimation(playParms, false, false); } else { x4_state = pas::EJumpState::Loop; - const CPASAnimParmData loopParms(13, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData loopParms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); } @@ -1013,7 +1028,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa } if (bc.IsAnimationOver()) { x4_state = pas::EJumpState::Loop; - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } else { @@ -1045,7 +1060,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa if (bc.IsAnimationOver()) { mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling); x4_state = pas::EJumpState::Loop; - const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); x30_27_wallBounceComplete = true; @@ -1070,10 +1085,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa } bool CBSJump::ApplyAnimationDeltas() const { - if (x4_state == pas::EJumpState::AmbushJump || x4_state == pas::EJumpState::Loop) { - return false; - } - return true; + return !(x4_state == pas::EJumpState::AmbushJump || x4_state == pas::EJumpState::Loop); } bool CBSJump::IsInAir(const CBodyController& bc) const { @@ -1089,12 +1101,12 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) { zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); angle.makeRel(); x8_knockAngle = angle.asDegrees(); - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1), CPASAnimParm::FromReal32(x8_knockAngle), - CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(-1), + CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(14); + const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Hurled); xc_animSeries = hurledState->GetAnimParmData(best.second, 0).GetInt32Value(); mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling); mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Jumped); @@ -1132,8 +1144,8 @@ pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController } void CBSHurled::Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledState state) { - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), - CPASAnimParm::FromEnum(s32(state))); + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries), + CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(state))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > FLT_EPSILON) { const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); @@ -1147,8 +1159,8 @@ void CBSHurled::Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledSta } void CBSHurled::PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr) { - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), - CPASAnimParm::FromEnum(3)); + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries), + CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(3)); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first <= FLT_EPSILON) { @@ -1161,12 +1173,12 @@ void CBSHurled::PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr) } void CBSHurled::PlayLandAnimation(CBodyController& bc, CStateManager& mgr) { - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), - CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries), + CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); - const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(14); + const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Hurled); bc.SetFallState(pas::EFallState(hurledState->GetAnimParmData(best.second, 3).GetEnumValue())); if (const TCastToPtr act = bc.GetOwner()) { mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); @@ -1220,7 +1232,7 @@ pas::EAnimationState CBSHurled::UpdateBody(float dt, CBodyController& bc, CState switch (x4_state) { case pas::EHurledState::KnockIntoAir: { if (bc.IsAnimationOver()) { - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(1)); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); x4_state = pas::EHurledState::KnockLoop; @@ -1244,7 +1256,7 @@ pas::EAnimationState CBSHurled::UpdateBody(float dt, CBodyController& bc, CState case pas::EHurledState::StrikeWall: if (bc.IsAnimationOver()) { x4_state = pas::EHurledState::StrikeWallFallLoop; - const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), + const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); x28_landedDur = 0.f; @@ -1289,14 +1301,14 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Slide)); const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetSlideDirection()); const float angle = std::atan2(localDir.y(), localDir.x()); - const CPASAnimParmData parms(15, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())), + const CPASAnimParmData parms(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())), CPASAnimParm::FromReal32(zeus::radToDeg(angle))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); bc.SetCurrentAnimation(playParms, false, false); const float timeRem = bc.GetAnimTimeRemaining(); if (timeRem > FLT_EPSILON) { - const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(15); + const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Slide); const float animAngle = zeus::degToRad(slideState->GetAnimParmData(best.second, 1).GetReal32Value()); const float delta1 = zeus::CRelAngle(angle - animAngle).asRel(); const float flippedAngle = (delta1 > M_PIF) ? delta1 - 2.f * M_PIF : delta1; @@ -1337,7 +1349,7 @@ pas::EAnimationState CBSSlide::UpdateBody(float dt, CBodyController& bc, CStateM void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Taunt)); - const CPASAnimParmData parms(16, CPASAnimParm::FromEnum(s32(cmd->GetTauntType()))); + const CPASAnimParmData parms(pas::EAnimationState::Taunt, CPASAnimParm::FromEnum(s32(cmd->GetTauntType()))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } @@ -1425,7 +1437,7 @@ void CBSCover::Start(CBodyController& bc, CStateManager& mgr) { const auto* cmd = static_cast(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Cover)); x8_coverDirection = cmd->GetDirection(); x4_state = pas::ECoverState::IntoCover; - const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_coverDirection))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const zeus::CQuaternion orientDelta = @@ -1466,7 +1478,7 @@ pas::EAnimationState CBSCover::UpdateBody(float dt, CBodyController& bc, CStateM case pas::ECoverState::IntoCover: if (bc.IsAnimationOver()) { x4_state = pas::ECoverState::Cover; - const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_coverDirection))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } @@ -1481,12 +1493,12 @@ pas::EAnimationState CBSCover::UpdateBody(float dt, CBodyController& bc, CStateM if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || xc_needsExit) { xc_needsExit = false; x4_state = pas::ECoverState::OutOfCover; - const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_coverDirection))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::LeanFromCover)) { x4_state = pas::ECoverState::Lean; - const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), + const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_coverDirection))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } @@ -1509,7 +1521,7 @@ void CBSWallHang::Start(CBodyController& bc, CStateManager& mgr) { x4_state = pas::EWallHangState::IntoJump; x8_wpId = cmd->GetTarget(); x18_25_needsExit = false; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } @@ -1534,7 +1546,7 @@ bool CBSWallHang::CheckForLand(CBodyController& bc, CStateManager& mgr) { if (const TCastToPtr ai = bc.GetOwner()) { if (ai->MadeSolidCollision() || ai->IsOnGround()) { x4_state = pas::EWallHangState::DetachOutOfJump; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); mgr.SendScriptMsg(ai.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); return true; @@ -1553,7 +1565,7 @@ bool CBSWallHang::CheckForWall(CBodyController& bc, CStateManager& mgr) { if (magSq < 1.f || ai->MadeSolidCollision()) { x4_state = pas::EWallHangState::IntoWallHang; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const zeus::CVector3f& target = wp ? wp->GetTranslation() : ai->GetTranslation(); const CAnimPlaybackParms playParms(best.second, nullptr, &target, &bc.GetOwner().GetTransform(), @@ -1586,7 +1598,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta if (st == pas::EAnimationState::Invalid) { switch (x4_state) { case pas::EWallHangState::IntoJump: { - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(1)); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(1)); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 0.f) { x4_state = pas::EWallHangState::JumpArc; @@ -1594,7 +1606,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta bc.SetCurrentAnimation(playParms, false, false); } else { x4_state = pas::EWallHangState::JumpAirLoop; - const CPASAnimParmData loopParms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData loopParms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); } if (const TCastToPtr act = bc.GetOwner()) { @@ -1616,7 +1628,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta SetLaunchVelocity(bc); if (bc.IsAnimationOver()) { x4_state = pas::EWallHangState::JumpAirLoop; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } else { CheckForWall(bc, mgr); @@ -1633,7 +1645,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta case pas::EWallHangState::IntoWallHang: { if (bc.IsAnimationOver()) { x4_state = pas::EWallHangState::WallHang; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState)) { x18_25_needsExit = true; @@ -1655,7 +1667,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta } if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || x18_25_needsExit) { x4_state = pas::EWallHangState::OutOfWallHang; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } FixInPlace(bc); @@ -1664,7 +1676,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta case pas::EWallHangState::Five: { if (bc.IsAnimationOver()) { x4_state = pas::EWallHangState::WallHang; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } FixInPlace(bc); @@ -1672,7 +1684,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta } case pas::EWallHangState::OutOfWallHang: { if (bc.IsAnimationOver()) { - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(7)); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(7)); const std::pair best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (best.first > 0.f) { x4_state = pas::EWallHangState::OutOfWallHangTurn; @@ -1680,7 +1692,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta bc.SetCurrentAnimation(playParms, false, false); } else { x4_state = pas::EWallHangState::DetachJumpLoop; - const CPASAnimParmData loopParms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData loopParms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); } if (const TCastToPtr act = bc.GetOwner()) { @@ -1701,7 +1713,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta SetLaunchVelocity(bc); if (bc.IsAnimationOver()) { x4_state = pas::EWallHangState::DetachJumpLoop; - const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state))); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); } else { CheckForLand(bc, mgr); @@ -1923,7 +1935,8 @@ CBSBiPedLocomotion::CBSBiPedLocomotion(CActor& actor) { for (int i = 0; i < 14; ++i) { rstl::reserved_vector, 8>& innerVec = x8_anims.emplace_back(); for (int j = 0; j < 8; ++j) { - const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(j), CPASAnimParm::FromEnum(i)); + const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(j), + CPASAnimParm::FromEnum(i)); const std::pair best = pasDatabase.FindBestAnimation(parms, -1); float avgVel = 0.f; if (best.second != -1) { @@ -2159,7 +2172,8 @@ float CBSNewFlyerLocomotion::UpdateLocomotionAnimation(float dt, float velMag, C CBSRestrictedLocomotion::CBSRestrictedLocomotion(CActor& actor) { const CPASDatabase& pasDatabase = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase(); for (int i = 0; i < 14; ++i) { - const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(i)); + const CPASAnimParmData parms(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0), + CPASAnimParm::FromEnum(i)); const std::pair best = pasDatabase.FindBestAnimation(parms, -1); x8_anims.push_back(best.second); } diff --git a/Runtime/Character/CBodyStateInfo.cpp b/Runtime/Character/CBodyStateInfo.cpp index a3a480127..d9e8a16cb 100644 --- a/Runtime/Character/CBodyStateInfo.cpp +++ b/Runtime/Character/CBodyStateInfo.cpp @@ -48,321 +48,321 @@ CBodyStateInfo::CBodyStateInfo(CActor& actor, EBodyType type) { x1c_additiveStates.emplace_back(pas::EAnimationState::AdditiveReaction, std::make_unique()); } -std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor, true); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor, false); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); - case 19: + case pas::EAnimationState::Cover: return std::make_unique(); default: return {}; } } -std::unique_ptr CBodyStateInfo::SetupBiPedalBodyStates(int stateId, CActor& actor) const { +std::unique_ptr CBodyStateInfo::SetupBiPedalBodyStates(pas::EAnimationState stateId, CActor& actor) const { switch (stateId) { - case 0: + case pas::EAnimationState::Fall: return std::make_unique(); - case 1: + case pas::EAnimationState::Getup: return std::make_unique(); - case 2: + case pas::EAnimationState::LieOnGround: return std::make_unique(actor); - case 3: + case pas::EAnimationState::Step: return std::make_unique(); - case 4: + case pas::EAnimationState::Death: return std::make_unique(); - case 5: + case pas::EAnimationState::Locomotion: return std::make_unique(actor); - case 6: + case pas::EAnimationState::KnockBack: return std::make_unique(); - case 7: + case pas::EAnimationState::MeleeAttack: return std::make_unique(); - case 18: + case pas::EAnimationState::ProjectileAttack: return std::make_unique(); - case 9: + case pas::EAnimationState::LoopAttack: return std::make_unique(); - case 8: + case pas::EAnimationState::Turn: return std::make_unique(); - case 10: + case pas::EAnimationState::LoopReaction: return std::make_unique(); - case 11: + case pas::EAnimationState::GroundHit: return std::make_unique(); - case 12: + case pas::EAnimationState::Generate: return std::make_unique(); - case 13: + case pas::EAnimationState::Jump: return std::make_unique(); - case 14: + case pas::EAnimationState::Hurled: return std::make_unique(); - case 15: + case pas::EAnimationState::Slide: return std::make_unique(); - case 16: + case pas::EAnimationState::Taunt: return std::make_unique(); - case 17: + case pas::EAnimationState::Scripted: return std::make_unique(); - case 19: + case pas::EAnimationState::Cover: return std::make_unique(); - case 20: + case pas::EAnimationState::WallHang: return std::make_unique(); default: return {}; diff --git a/Runtime/Character/CBodyStateInfo.hpp b/Runtime/Character/CBodyStateInfo.hpp index bd440683c..c36f9aab6 100644 --- a/Runtime/Character/CBodyStateInfo.hpp +++ b/Runtime/Character/CBodyStateInfo.hpp @@ -22,13 +22,13 @@ class CBodyStateInfo { pas::EAnimationState x2c_additiveState = pas::EAnimationState::AdditiveIdle; float x30_maxPitch = 0.f; bool x34_24_changeLocoAtEndOfAnimOnly; - std::unique_ptr SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupNewFlyerBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupWallWalkerBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupPitchableBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupFlyerBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupRestrictedBodyStates(int stateId, CActor& actor) const; - std::unique_ptr SetupBiPedalBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupNewFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupWallWalkerBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupPitchableBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupRestrictedBodyStates(pas::EAnimationState stateId, CActor& actor) const; + std::unique_ptr SetupBiPedalBodyStates(pas::EAnimationState stateId, CActor& actor) const; public: CBodyStateInfo(CActor& actor, EBodyType type); diff --git a/Runtime/Character/CPASAnimParmData.cpp b/Runtime/Character/CPASAnimParmData.cpp index 0b0ade4ef..85138de6c 100644 --- a/Runtime/Character/CPASAnimParmData.cpp +++ b/Runtime/Character/CPASAnimParmData.cpp @@ -2,7 +2,7 @@ namespace urde { -CPASAnimParmData::CPASAnimParmData(s32 stateId, const CPASAnimParm& parm1, const CPASAnimParm& parm2, +CPASAnimParmData::CPASAnimParmData(pas::EAnimationState stateId, const CPASAnimParm& parm1, const CPASAnimParm& parm2, const CPASAnimParm& parm3, const CPASAnimParm& parm4, const CPASAnimParm& parm5, const CPASAnimParm& parm6, const CPASAnimParm& parm7, const CPASAnimParm& parm8) : x0_stateId(stateId) { diff --git a/Runtime/Character/CPASAnimParmData.hpp b/Runtime/Character/CPASAnimParmData.hpp index 41ad3521f..d66cd7f3a 100644 --- a/Runtime/Character/CPASAnimParmData.hpp +++ b/Runtime/Character/CPASAnimParmData.hpp @@ -2,17 +2,18 @@ #include "Runtime/RetroTypes.hpp" #include "Runtime/rstl.hpp" +#include "Runtime/Character/CharacterCommon.hpp" #include "Runtime/Character/CPASAnimParm.hpp" namespace urde { class CPASAnimParmData { - s32 x0_stateId; + pas::EAnimationState x0_stateId; rstl::reserved_vector x4_parms; public: CPASAnimParmData() = default; - explicit CPASAnimParmData(s32 stateId, const CPASAnimParm& parm1 = CPASAnimParm::NoParameter(), + explicit CPASAnimParmData(pas::EAnimationState stateId, const CPASAnimParm& parm1 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm2 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm3 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm4 = CPASAnimParm::NoParameter(), @@ -21,9 +22,9 @@ public: const CPASAnimParm& parm7 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm8 = CPASAnimParm::NoParameter()); - s32 GetStateId() const { return x0_stateId; } + pas::EAnimationState GetStateId() const { return x0_stateId; } const rstl::reserved_vector& GetAnimParmData() const { return x4_parms; } - static auto NoParameters(s32 stateId) { return CPASAnimParmData(stateId); } + static auto NoParameters(pas::EAnimationState stateId) { return CPASAnimParmData(stateId); } }; } // namespace urde diff --git a/Runtime/Character/CPASAnimState.cpp b/Runtime/Character/CPASAnimState.cpp index 3bde8b003..311cb8c3b 100644 --- a/Runtime/Character/CPASAnimState.cpp +++ b/Runtime/Character/CPASAnimState.cpp @@ -2,6 +2,7 @@ #include "Runtime/CRandom16.hpp" #include "Runtime/rstl.hpp" +#include "Runtime/Character/CharacterCommon.hpp" #include "Runtime/Character/CPASAnimParmData.hpp" #include @@ -13,7 +14,7 @@ namespace urde { CPASAnimState::CPASAnimState(CInputStream& in) { - x0_id = in.readUint32Big(); + x0_id = static_cast(in.readUint32Big()); u32 parmCount = in.readUint32Big(); u32 animCount = in.readUint32Big(); @@ -58,7 +59,7 @@ CPASAnimState::CPASAnimState(CInputStream& in) { } } -CPASAnimState::CPASAnimState(int stateId) : x0_id(stateId) {} +CPASAnimState::CPASAnimState(pas::EAnimationState stateId) : x0_id(stateId) {} CPASAnimParm CPASAnimState::GetAnimParmData(s32 animId, size_t parmIdx) const { const auto search = rstl::binary_find(x14_anims.cbegin(), x14_anims.cend(), animId, diff --git a/Runtime/Character/CPASAnimState.hpp b/Runtime/Character/CPASAnimState.hpp index 493152edd..5f4077b63 100644 --- a/Runtime/Character/CPASAnimState.hpp +++ b/Runtime/Character/CPASAnimState.hpp @@ -4,6 +4,7 @@ #include #include "Runtime/IOStreams.hpp" +#include "Runtime/Character/CharacterCommon.hpp" #include "Runtime/Character/CPASAnimInfo.hpp" #include "Runtime/Character/CPASParmInfo.hpp" @@ -11,7 +12,7 @@ namespace urde { class CRandom16; class CPASAnimParmData; class CPASAnimState { - s32 x0_id; + pas::EAnimationState x0_id; std::vector x4_parms; std::vector x14_anims; mutable std::vector x24_selectionCache; @@ -24,8 +25,8 @@ class CPASAnimState { public: explicit CPASAnimState(CInputStream& in); - explicit CPASAnimState(int stateId); - s32 GetStateId() const { return x0_id; } + explicit CPASAnimState(pas::EAnimationState stateId); + pas::EAnimationState GetStateId() const { return x0_id; } size_t GetNumAnims() const { return x14_anims.size(); } bool HasAnims() const { return !x14_anims.empty(); } CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) const; diff --git a/Runtime/Character/CPASDatabase.hpp b/Runtime/Character/CPASDatabase.hpp index e06afeec4..73d6c29f7 100644 --- a/Runtime/Character/CPASDatabase.hpp +++ b/Runtime/Character/CPASDatabase.hpp @@ -24,7 +24,7 @@ public: std::pair FindBestAnimation(const CPASAnimParmData& data, CRandom16& rand, s32 ignoreAnim) const; s32 GetDefaultState() const { return x10_defaultState; } size_t GetNumAnimStates() const { return x0_states.size(); } - const CPASAnimState* GetAnimState(s32 id) const { + const CPASAnimState* GetAnimState(pas::EAnimationState id) const { for (const CPASAnimState& state : x0_states) if (id == state.GetStateId()) return &state; @@ -39,7 +39,7 @@ public: return &x0_states[index]; } - bool HasState(s32 id) const { + bool HasState(pas::EAnimationState id) const { const auto& st = std::find_if(x0_states.begin(), x0_states.end(), [&id](const CPASAnimState& other) -> bool { return other.GetStateId() == id; }); return st != x0_states.end(); diff --git a/Runtime/Character/CharacterCommon.hpp b/Runtime/Character/CharacterCommon.hpp index 51a3d710e..6f692daa4 100644 --- a/Runtime/Character/CharacterCommon.hpp +++ b/Runtime/Character/CharacterCommon.hpp @@ -25,31 +25,31 @@ enum class ELocomotionAnim { Invalid = -1, Idle, Walk, Run, BackUp, StrafeLeft, enum class EAnimationState { Invalid = -1, - Fall, - Getup, - LieOnGround, - Step, - Death, - Locomotion, - KnockBack, - MeleeAttack, - Turn, - LoopAttack, - LoopReaction, - GroundHit, - Generate, - Jump, - Hurled, - Slide, - Taunt, - Scripted, - ProjectileAttack, - Cover, - WallHang, - AdditiveIdle, - AdditiveAim, - AdditiveFlinch, - AdditiveReaction + Fall = 0, + Getup = 1, + LieOnGround = 2, + Step = 3, + Death = 4, + Locomotion = 5, + KnockBack = 6, + MeleeAttack = 7, + Turn = 8, + LoopAttack = 9, + LoopReaction = 10, + GroundHit = 11, + Generate = 12, + Jump = 13, + Hurled = 14, + Slide = 15, + Taunt = 16, + Scripted = 17, + ProjectileAttack = 18, + Cover = 19, + WallHang = 20, + AdditiveIdle = 21, + AdditiveAim = 22, + AdditiveFlinch = 23, + AdditiveReaction = 24 }; enum class EHurledState { @@ -64,7 +64,7 @@ enum class EHurledState { Seven }; -enum class EFallState { Invalid = -1, Zero, One , Two}; +enum class EFallState { Invalid = -1, Zero, One, Two }; enum class EReactionType { Invalid = -1, Zero, One, Two, Three }; diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index 7562a5ff0..f4236457c 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -97,7 +97,7 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in x460_knockBackController.SetEnableShock(true); x460_knockBackController.SetEnableExplodeDeath(true); x8d4_stepBackwardDist = - GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * GetModelData()->GetScale().y(); // B_backward_sheegoth xa08_noShellModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo()); MakeThermalColdAndHot(); diff --git a/Runtime/MP1/World/CBeetle.cpp b/Runtime/MP1/World/CBeetle.cpp index 98b89e08a..36978c170 100644 --- a/Runtime/MP1/World/CBeetle.cpp +++ b/Runtime/MP1/World/CBeetle.cpp @@ -32,10 +32,10 @@ CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, , x7ac_tailVuln(tailVuln) , x814_attackDelayTimer(initialAttackDelay) , x834_retreatTime(retreatTime) { - x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1))); + x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1))); x5a4_jumpBackwardDist = x64_modelData->GetScale().y() * - GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))); MakeThermalColdAndHot(); if (x3fc_flavor == EFlavorType::One) x460_knockBackController.SetLocomotionDuringElectrocution(true); diff --git a/Runtime/MP1/World/CChozoGhost.cpp b/Runtime/MP1/World/CChozoGhost.cpp index b59524219..b67a7276f 100644 --- a/Runtime/MP1/World/CChozoGhost.cpp +++ b/Runtime/MP1/World/CChozoGhost.cpp @@ -105,11 +105,11 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo x578_.Token().Lock(); x5a0_.Token().Lock(); x668_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(13, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0))); x66c_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(15, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f))); x670_ = GetModelData()->GetScale().z() * - GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(1))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(1))); if (projectileVisorEffect.IsValid()) x640_projectileVisor = g_SimplePool->GetObj({SBIG('PART'), projectileVisorEffect}); diff --git a/Runtime/MP1/World/CFlyingPirate.cpp b/Runtime/MP1/World/CFlyingPirate.cpp index 88b5d83b7..b2e9d7991 100644 --- a/Runtime/MP1/World/CFlyingPirate.cpp +++ b/Runtime/MP1/World/CFlyingPirate.cpp @@ -322,7 +322,7 @@ CFlyingPirate::CFlyingPirate(TUniqueId uid, std::string_view name, const CEntity x864_missileSegments.push_back(animData->GetLocatorSegId("L_Missile_LCTR"sv)); x864_missileSegments.push_back(animData->GetLocatorSegId("R_Missile_LCTR"sv)); x850_height = modelData->GetScale().x() * - GetAnimationDistance(CPASAnimParmData{3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)}); + GetAnimationDistance(CPASAnimParmData{pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)}); if (x568_data.xd8_particleGen1.IsValid() && x568_data.xdc_particleGen2.IsValid() && x568_data.xe0_particleGen3.IsValid()) { x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xd8_particleGen1})); @@ -747,7 +747,7 @@ void CFlyingPirate::FireProjectile(CStateManager& mgr, float dt) { } if (projectileFired) { const std::pair& anim = x450_bodyController->GetPASDatabase().FindBestAnimation( - CPASAnimParmData{24, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); + CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); if (anim.first > 0.f) { GetModelData()->GetAnimationData()->AddAdditiveAnimation(anim.second, 1.f, false, true); } diff --git a/Runtime/MP1/World/CGrenadeLauncher.cpp b/Runtime/MP1/World/CGrenadeLauncher.cpp index c7bc7b28a..42b03ab60 100644 --- a/Runtime/MP1/World/CGrenadeLauncher.cpp +++ b/Runtime/MP1/World/CGrenadeLauncher.cpp @@ -32,7 +32,8 @@ CGrenadeLauncher::CGrenadeLauncher(TUniqueId uid, std::string_view name, const C GetModelData()->EnableLooping(true); const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase(); for (size_t i = 0; i < x3c8_animIds.size(); ++i) { - const auto result = pasDatabase.FindBestAnimation(CPASAnimParmData{22, CPASAnimParm::FromEnum(int(i))}, -1); + const auto result = pasDatabase.FindBestAnimation( + CPASAnimParmData{pas::EAnimationState::AdditiveAim, CPASAnimParm::FromEnum(int(i))}, -1); x3c8_animIds[i] = result.second; } } @@ -285,7 +286,9 @@ void CGrenadeLauncher::sub_80230438() { constexpr std::array arr{0, 3}; const auto anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation( - CPASAnimParmData{5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(arr[x258_started])}, -1); + CPASAnimParmData{pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0), + CPASAnimParm::FromEnum(arr[x258_started])}, + -1); if (anim.first > 0.f) { animData->SetAnimation({anim.second, -1, 1.f, true}, false); modelData->EnableLooping(true); @@ -299,7 +302,8 @@ void CGrenadeLauncher::LaunchGrenade(CStateManager& mgr) { return; } - const auto& anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation(CPASAnimParmData{23}, -1); + const auto& anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation( + CPASAnimParmData{pas::EAnimationState::AdditiveFlinch}, -1); if (anim.first > 0.f) { animData->AddAdditiveAnimation(anim.second, 1.f, false, true); const zeus::CVector3f origin = diff --git a/Runtime/MP1/World/CRidley.cpp b/Runtime/MP1/World/CRidley.cpp index e882b9f10..8015513b2 100644 --- a/Runtime/MP1/World/CRidley.cpp +++ b/Runtime/MP1/World/CRidley.cpp @@ -298,7 +298,8 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, } xae4_ = GetModelData()->GetScale().x() * - GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(4), CPASAnimParm::FromEnum(3))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(4), + CPASAnimParm::FromEnum(3))); x460_knockBackController.SetAnimationStateRange(EKnockBackAnimationState::Flinch, EKnockBackAnimationState::Flinch); x460_knockBackController.SetEnableBurn(false); x460_knockBackController.SetEnableFreeze(false); diff --git a/Runtime/MP1/World/CSpacePirate.cpp b/Runtime/MP1/World/CSpacePirate.cpp index 4af6dfb6b..1fd019e0b 100644 --- a/Runtime/MP1/World/CSpacePirate.cpp +++ b/Runtime/MP1/World/CSpacePirate.cpp @@ -416,10 +416,10 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn if (!x634_29_onlyAttackInRange) { x7a4_intoJumpDist = - GetAnimationDistance(CPASAnimParmData(13, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(0))); - x848_dodgeDist = GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(0))); + x848_dodgeDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1))); x84c_breakDodgeDist = - GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(2))); + GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(2))); } else { x450_bodyController->BodyStateInfo().SetLocoAnimChangeAtEndOfAnimOnly(true); } @@ -588,7 +588,7 @@ bool CSpacePirate::FireProjectile(float dt, CStateManager& mgr) { } if (ret) { const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation( - CPASAnimParmData{24, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); + CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); if (bestAnim.first > 0.f) { x64_modelData->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true); } @@ -1847,7 +1847,7 @@ void CSpacePirate::Taunt(CStateManager& mgr, EStateMsg msg, float dt) { bool withOtherPirate = true; if (x634_27_melee) { const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation( - CPASAnimParmData{16, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); + CPASAnimParmData{pas::EAnimationState::Taunt, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); if (bestAnim.first > 0.f) { withOtherPirate = false; x760_taunt = pas::ETauntType::Two; diff --git a/Runtime/Weapon/CGSComboFire.cpp b/Runtime/Weapon/CGSComboFire.cpp index 6a227db29..cf1a46e24 100644 --- a/Runtime/Weapon/CGSComboFire.cpp +++ b/Runtime/Weapon/CGSComboFire.cpp @@ -46,7 +46,8 @@ s32 CGSComboFire::SetAnim(CAnimData& data, s32 gunId, s32 loopState, CStateManag useLoopState = loopState; x10_25_idle = false; const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); - CPASAnimParmData parms(4, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromEnum(useLoopState)); + CPASAnimParmData parms(pas::EAnimationState::Death, CPASAnimParm::FromInt32(gunId), + CPASAnimParm::FromEnum(useLoopState)); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x10_24_over = false; xc_gunId = gunId; diff --git a/Runtime/Weapon/CGSFidget.cpp b/Runtime/Weapon/CGSFidget.cpp index f3766ecf8..dca5f0e57 100644 --- a/Runtime/Weapon/CGSFidget.cpp +++ b/Runtime/Weapon/CGSFidget.cpp @@ -12,10 +12,10 @@ bool CGSFidget::Update(CAnimData& data, float dt, CStateManager& mgr) { 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), + CPASAnimParmData parms(pas::EAnimationState::Getup, 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(); + bool loop = pas.GetAnimState(pas::EAnimationState::Getup)->GetAnimParmData(anim.second, 3).GetBoolValue(); x14_gunId = gunId; x18_animSet = animSet; if (anim.second != -1) { @@ -28,7 +28,7 @@ s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 animSet, CState } void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) { - CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), + CPASAnimParmData parms(pas::EAnimationState::Getup, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(animSet)); auto anim = data.GetCharacterInfo().GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (anim.second != -1) diff --git a/Runtime/Weapon/CGSFreeLook.cpp b/Runtime/Weapon/CGSFreeLook.cpp index c865de0f0..749b2f8a6 100644 --- a/Runtime/Weapon/CGSFreeLook.cpp +++ b/Runtime/Weapon/CGSFreeLook.cpp @@ -36,11 +36,11 @@ s32 CGSFreeLook::SetAnim(CAnimData& data, s32 gunId, s32 setId, s32 loopState, C useLoopState = loopState; x14_idle = false; const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); - CPASAnimParmData parms(3, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId), + CPASAnimParmData parms(pas::EAnimationState::Step, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId), CPASAnimParm::FromEnum(useLoopState)); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); xc_gunId = gunId; - x10_setId = pas.GetAnimState(3)->GetAnimParmData(anim.second, 1).GetInt32Value(); + x10_setId = pas.GetAnimState(pas::EAnimationState::Step)->GetAnimParmData(anim.second, 1).GetInt32Value(); x8_loopState = useLoopState; if (delay != 0.f) { x0_delay = delay; diff --git a/Runtime/Weapon/CGunController.cpp b/Runtime/Weapon/CGunController.cpp index a5708f0db..1c8fb9028 100644 --- a/Runtime/Weapon/CGunController.cpp +++ b/Runtime/Weapon/CGunController.cpp @@ -48,8 +48,9 @@ void CGunController::EnterStruck(CStateManager& mgr, float angle, bool bigStrike } const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); - CPASAnimParmData parms(2, CPASAnimParm::FromInt32(x4_freeLook.GetGunId()), CPASAnimParm::FromReal32(angle), - CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(b2)); + CPASAnimParmData parms(pas::EAnimationState::LieOnGround, CPASAnimParm::FromInt32(x4_freeLook.GetGunId()), + CPASAnimParm::FromReal32(angle), CPASAnimParm::FromBool(bigStrike), + CPASAnimParm::FromBool(b2)); std::pair anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x0_modelData.GetAnimationData()->EnableLooping(false); CAnimPlaybackParms aparms(anim.second, -1, 1.f, true); @@ -75,7 +76,7 @@ void CGunController::EnterIdle(CStateManager& mgr) { } const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); - CPASAnimParmData parms(5, parm); + CPASAnimParmData parms(pas::EAnimationState::Locomotion, parm); std::pair anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); x0_modelData.GetAnimationData()->EnableLooping(false); CAnimPlaybackParms aparms(anim.second, -1, 1.f, true); @@ -161,7 +162,8 @@ void CGunController::ReturnToDefault(CStateManager& mgr, float dt, bool setState void CGunController::ReturnToBasePosition(CStateManager& mgr, float) { const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); - std::pair anim = pasDatabase.FindBestAnimation(CPASAnimParmData(6), *mgr.GetActiveRandom(), -1); + std::pair anim = + pasDatabase.FindBestAnimation(CPASAnimParmData(pas::EAnimationState::KnockBack), *mgr.GetActiveRandom(), -1); x0_modelData.GetAnimationData()->EnableLooping(false); CAnimPlaybackParms parms(anim.second, -1, 1.f, true); x0_modelData.GetAnimationData()->SetAnimation(parms, false); diff --git a/Runtime/Weapon/CGunMotion.cpp b/Runtime/Weapon/CGunMotion.cpp index e12e9ba63..eb9eae1de 100644 --- a/Runtime/Weapon/CGunMotion.cpp +++ b/Runtime/Weapon/CGunMotion.cpp @@ -22,19 +22,19 @@ bool CGunMotion::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr bool loop = true; switch (state) { case SamusGun::EAnimationState::Wander: { - CPASAnimParmData parms((s32(state))); + CPASAnimParmData parms((pas::EAnimationState(state))); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); animId = anim.second; break; } case SamusGun::EAnimationState::Idle: { - CPASAnimParmData parms(s32(state), CPASAnimParm::FromEnum(0)); + CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromEnum(0)); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); animId = anim.second; break; } case SamusGun::EAnimationState::Struck: { - CPASAnimParmData parms(s32(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle), + CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle), CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(false)); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); animId = anim.second; diff --git a/Runtime/World/CKnockBackController.cpp b/Runtime/World/CKnockBackController.cpp index fb349cb66..353592ee3 100644 --- a/Runtime/World/CKnockBackController.cpp +++ b/Runtime/World/CKnockBackController.cpp @@ -498,8 +498,8 @@ void CKnockBackController::DoKnockBackAnimation(const zeus::CVector3f& backVec, break; } case EKnockBackAnimationState::Flinch: { - const std::pair bestAnim = - parent.GetBodyController()->GetPASDatabase().FindBestAnimation(CPASAnimParmData(23), *mgr.GetActiveRandom(), -1); + const std::pair bestAnim = parent.GetBodyController()->GetPASDatabase().FindBestAnimation( + CPASAnimParmData(pas::EAnimationState::AdditiveFlinch), *mgr.GetActiveRandom(), -1); if (bestAnim.first > 0.f) { parent.GetModelData()->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true); x64_flinchRemTime = diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index 3f6c016f0..dd87a5f0c 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -954,8 +954,8 @@ void CPatterned::BuildBodyController(EBodyType bodyType) { return; x450_bodyController = std::make_unique(*this, x3b8_turnSpeed, bodyType); - auto anim = - x450_bodyController->GetPASDatabase().FindBestAnimation(CPASAnimParmData(24, CPASAnimParm::FromEnum(0)), -1); + auto anim = x450_bodyController->GetPASDatabase().FindBestAnimation( + CPASAnimParmData(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(0)), -1); x460_knockBackController.x81_26_enableShock = anim.first > 0.f; } diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index a86d6a588..e8c0ca482 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -422,8 +422,9 @@ void CScriptGunTurret::LaunchProjectile(CStateManager& mgr) { mgr.AddObject(proj); auto pair = x64_modelData->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( - CPASAnimParmData(18, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f), - CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])), -1); + CPASAnimParmData(pas::EAnimationState::ProjectileAttack, CPASAnimParm::FromEnum(1), + CPASAnimParm::FromReal32(90.f), + CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])), -1); if (pair.first > 0.f) { x64_modelData->EnableLooping(false); x64_modelData->GetAnimationData()->SetAnimation(CAnimPlaybackParms(pair.second, -1, 1.f, true), false); @@ -433,7 +434,7 @@ void CScriptGunTurret::LaunchProjectile(CStateManager& mgr) { void CScriptGunTurret::PlayAdditiveFlinchAnimation(CStateManager& mgr) { auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( - CPASAnimParmData(23), *mgr.GetActiveRandom(), -1); + CPASAnimParmData(pas::EAnimationState::AdditiveFlinch), *mgr.GetActiveRandom(), -1); if (pair.first > 0.f) GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, false, true); } @@ -695,7 +696,7 @@ void CScriptGunTurret::UpdateTurretAnimation() { return; } - const auto parmData = CPASAnimParmData(5, CPASAnimParm::FromEnum(0), + const auto parmData = CPASAnimParmData(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])); const auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(parmData, -1); @@ -1150,7 +1151,7 @@ void CScriptGunTurret::PlayAdditiveChargingAnimation(CStateManager& mgr) { return; auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( - CPASAnimParmData(24, CPASAnimParm::FromEnum(2)), *mgr.GetActiveRandom(), -1); + CPASAnimParmData(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)), *mgr.GetActiveRandom(), -1); if (pair.first > 0.f) { x55c_additiveChargeAnim = pair.second; GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, true, false); From 6a9b404d56407ff12fc73b5ed9a91e3ea32a5b40 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 1 Mar 2021 18:19:35 -0500 Subject: [PATCH 2/7] Update hecl --- hecl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hecl b/hecl index 56e5b9c2f..cf69962a4 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 56e5b9c2f2f75a24da460ad571f64f3743a9ddce +Subproject commit cf69962a4b27a9a4447602cd3c393dd6f9bd4958 From 2d45525114f5512a98aeae6fc7906ffd122b3976 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 1 Mar 2021 21:36:10 -0500 Subject: [PATCH 3/7] Add GitHub Actions configuration --- .github/workflows/build.yml | 139 ++++++++++++++++++++++ CMakeLists.txt | 16 +-- Shaders/shader_CFluidPlaneShaderGLSL.cpp | 5 +- Shaders/shader_CFluidPlaneShaderHLSL.cpp | 5 +- Shaders/shader_CFluidPlaneShaderMetal.cpp | 5 +- amuse | 2 +- 6 files changed, 160 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..5f627679c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,139 @@ +name: Build + +on: [push] + +jobs: + build-linux-gcc: + name: Build Linux (GCC x86_64) + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get -y install build-essential curl git ninja-build llvm-dev libclang-dev clang lld zlib1g-dev \ + libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \ + libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 qt5-default + - name: Create build directory + shell: bash + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 + - name: Build + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE + + build-linux-clang: + name: Build Linux (Clang x86_64) + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get -y install build-essential curl git ninja-build llvm-dev libclang-dev clang lld zlib1g-dev \ + libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \ + libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 qt5-default + - name: Create build directory + shell: bash + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + - name: Build + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE + + build-macos: + name: Build macOS (Clang x86_64) + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + shell: bash + run: brew install ninja qt + - name: Create build directory + shell: bash + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 + - name: Build + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE + + build-windows-msvc: + name: Build Windows (MSVC x86_64) + runs-on: windows-2019 + if: 'false' # disabled for now + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: suisei-cn/actions-download-file@v1 + name: Download LLVM + id: download-llvm + with: + url: https://axiodl.com/files/LLVM-10.0.1-win64.exe + target: ${{github.workspace}}/temp + - name: Install LLVM + shell: cmd + working-directory: ${{github.workspace}}/temp + run: ${{steps.download-llvm.outputs.filename}} /S + - uses: ilammy/msvc-dev-cmd@v1 + name: Enable Visual Studio environment + - name: Install ninja + run: choco install ninja + - name: Create build directory + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + working-directory: ${{github.workspace}}/build + run: cmake .. -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS= + - name: Build + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE + + build-windows-clang: + name: Build Windows (Clang x86_64) + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: suisei-cn/actions-download-file@v1 + name: Download LLVM + id: download-llvm + with: + url: https://axiodl.com/files/LLVM-10.0.1-win64.exe + target: ${{github.workspace}}/temp + - name: Install LLVM + shell: cmd + working-directory: ${{github.workspace}}/temp + run: ${{steps.download-llvm.outputs.filename}} /S + - uses: ilammy/msvc-dev-cmd@v1 + name: Enable Visual Studio environment + - name: Install ninja + run: choco install ninja + - name: Create build directory + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + working-directory: ${{github.workspace}}/build + run: cmake .. -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_LINKER="C:/Program Files/LLVM/bin/lld-link.exe" + - name: Build + working-directory: ${{github.workspace}}/build + run: cmake --build . --config $BUILD_TYPE diff --git a/CMakeLists.txt b/CMakeLists.txt index d7411e28e..7da2e6f72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,11 +54,9 @@ set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake") find_package(Sanitizers) -if (NX) - set(URDE_VECTOR_ISA "neon") -else() - set(URDE_VECTOR_ISA "sse2" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)") -endif() +if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64) + set(URDE_VECTOR_ISA "sse41" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)") +endif () if(MSVC) if(${URDE_VECTOR_ISA} STREQUAL "avx2") @@ -71,6 +69,10 @@ if(MSVC) message(STATUS "Building with AVX Vector ISA") elseif(${URDE_VECTOR_ISA} STREQUAL "sse41") add_compile_definitions(__SSE4_1__=1) + # clang-cl 10 requires -msse4.1, may be fixed in newer versions? + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL Clang) + add_compile_options(-msse4.1) + endif() message(STATUS "Building with SSE4.1 Vector ISA") else() message(STATUS "Building with SSE2 Vector ISA") @@ -150,8 +152,6 @@ else() elseif(${URDE_VECTOR_ISA} STREQUAL "sse2") add_compile_options(-msse2) message(STATUS "Building with SSE2 Vector ISA") - elseif(${URDE_VECTOR_ISA} STREQUAL "neon") - message(STATUS "Building with NEON Vector ISA") else() message(STATUS "Building with x87 Vector ISA") endif() @@ -181,7 +181,7 @@ else() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - add_compile_options(-Wno-lto-type-mismatch) + add_compile_options(-Wno-lto-type-mismatch -Wno-maybe-uninitialized) endif() add_compile_definitions(FMT_EXCEPTIONS=0) diff --git a/Shaders/shader_CFluidPlaneShaderGLSL.cpp b/Shaders/shader_CFluidPlaneShaderGLSL.cpp index 7e7e218f4..12011089d 100644 --- a/Shaders/shader_CFluidPlaneShaderGLSL.cpp +++ b/Shaders/shader_CFluidPlaneShaderGLSL.cpp @@ -328,7 +328,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) { std::stringstream out; int nextTex = 0; int nextTCG = 3; - int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; + int bumpMapUv = -1; + int envBumpMapUv = -1; + int envMapUv = -1; + int lightmapUv = -1; out << "#define TEXTURE_DECLS "; if (info.m_hasPatternTex1) diff --git a/Shaders/shader_CFluidPlaneShaderHLSL.cpp b/Shaders/shader_CFluidPlaneShaderHLSL.cpp index ebf81e869..824936bf9 100644 --- a/Shaders/shader_CFluidPlaneShaderHLSL.cpp +++ b/Shaders/shader_CFluidPlaneShaderHLSL.cpp @@ -364,7 +364,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) { int nextTex = 0; int nextTCG = 3; int nextMtx = 4; - int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; + int bumpMapUv = -1; + int envBumpMapUv = -1; + int envMapUv = -1; + int lightmapUv = -1; out << "#define TEXTURE_DECLS "; if (info.m_hasPatternTex1) diff --git a/Shaders/shader_CFluidPlaneShaderMetal.cpp b/Shaders/shader_CFluidPlaneShaderMetal.cpp index 728d580a3..035d00c50 100644 --- a/Shaders/shader_CFluidPlaneShaderMetal.cpp +++ b/Shaders/shader_CFluidPlaneShaderMetal.cpp @@ -362,7 +362,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) { std::stringstream out; int nextTex = 0; int nextTCG = 3; - int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; + int bumpMapUv = -1; + int envBumpMapUv = -1; + int envMapUv = -1; + int lightmapUv = -1; out << "#define TEXTURE_PARAMS "; if (info.m_hasPatternTex1) diff --git a/amuse b/amuse index 2ec749e6c..df7136d26 160000 --- a/amuse +++ b/amuse @@ -1 +1 @@ -Subproject commit 2ec749e6c7d69ce85bf2fad09339eeead02f209f +Subproject commit df7136d265d1ca15a7851dfec2c8b7ee0dd9de86 From 60656b5a5d775d0f9b1bdbb31c0b1832a95a9ba6 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 1 Mar 2021 21:39:09 -0500 Subject: [PATCH 4/7] Remove appveyor configuration --- .appveyor.yml | 85 --------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 09ae15d3b..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,85 +0,0 @@ -############################################################################ -# URDE appveyor build configuration -############################################################################ -clone_depth: 1 - -platform: - - x64 - -build_cloud: AXIODL-BUILDBOT -image: Windows - -build: - verbosity: detailed - -configuration: - - Release - -cache: - - C:\projects\deps - -install: - ############################################################################ - # All external dependencies are installed in C:\projects\deps - ############################################################################ - - if not exist C:\projects\deps mkdir C:\projects\deps - - cd C:\projects\deps - - ############################################################################ - # Install Ninja - ############################################################################ - - set NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip - - if not exist ninja.zip appveyor DownloadFile %NINJA_URL% -FileName ninja.zip - - if not exist ninja 7z x ninja.zip -oC:\projects\deps\ninja > nul - - ############################################################################ - # Install a recent CMake - ############################################################################ - - set CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip - - if not exist cmake.zip appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip - - if not exist cmake 7z x cmake.zip -oC:\projects\deps\cmake > nul - - ############################################################################ - # Install custom LLVM - ############################################################################ - - set LLVM_URL=https://axiodl.com/files/LLVM-10.0.1-win64.exe - - if not exist LLVM-10.0.1-win64.exe appveyor DownloadFile %LLVM_URL% -FileName LLVM-10.0.1-win64.exe - - if not exist llvm-10.0.1 LLVM-10.0.1-win64.exe /S /D=C:\projects\deps\llvm-10.0.1 - -before_build: - # Configure ninja - - set PATH=C:\projects\deps\ninja;%PATH% - - ninja --version - # Configure cmake - - set PATH=C:\projects\deps\cmake\cmake-3.16.4-win64-x64\bin;%PATH% - - cmake --version - # Configure LLVM - - set PATH=C:\projects\deps\llvm-10.0.1\bin;%PATH% - - llvm-config --version - - clang-cl -v - # Configure VS - - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" amd64 - # Fetch submodules - - cd %APPVEYOR_BUILD_FOLDER% - - git submodule update --init --recursive - -build_script: - - mkdir build - - cd build - - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLLVM_ROOT_DIR=C:\projects\deps\llvm-10.0.1 -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link -DCMAKE_AR=llvm-ar -DCMAKE_RANLIB=llvm-ranlib -GNinja .. - - ninja urde - -#notifications: -# - provider: Slack -# incoming_webhook: -# secure: uoO0I0PWyCx0KLjBOG6d17aSVuEEvYztB/UiF8J0LmTb2O735mAdWcuZHTImDFUGZxeI34/qzOB2JKqF+h8dZA5yiprSTkWIookqQjUokAM= -# - provider: Webhook -# url: https://skyhook.glitch.me/api/webhooks/345359672326356993/M8kBYpqr1JyVNhnAHBwNN5TnZmtWy9_msxAQoeOlaa73UhPn8gLU5uYZCjU1qsAi3sGN/appveyor -# method: POST -# on_build_success: true -# on_build_failure: true -# on_build_status_changed: false - -# Uncomment this to debug AppVeyor failures. -#on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file From 09d23ef519a864f8a56c73c7030b873c427644fd Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 1 Mar 2021 23:55:55 -0500 Subject: [PATCH 5/7] CIceSheegoth/CMetroid: Use pas::EAnimationState --- Runtime/MP1/World/CIceSheegoth.cpp | 3 ++- Runtime/MP1/World/CMetroid.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Runtime/MP1/World/CIceSheegoth.cpp b/Runtime/MP1/World/CIceSheegoth.cpp index d1cfd2b94..8aba1d4bf 100644 --- a/Runtime/MP1/World/CIceSheegoth.cpp +++ b/Runtime/MP1/World/CIceSheegoth.cpp @@ -112,7 +112,8 @@ CIceSheegoth::CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityIn x460_knockBackController.SetX82_24(false); x460_knockBackController.SetEnableLaggedBurnDeath(false); x460_knockBackController.SetEnableExplodeDeath(false); - x950_ = GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * + x950_ = GetAnimationDistance( + CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * GetModelData()->GetScale().y(); xa9c_->SetGlobalScale(GetModelData()->GetScale()); xab0_->SetGlobalScale(GetModelData()->GetScale()); diff --git a/Runtime/MP1/World/CMetroid.cpp b/Runtime/MP1/World/CMetroid.cpp index f46f92ef6..e2b7cd344 100644 --- a/Runtime/MP1/World/CMetroid.cpp +++ b/Runtime/MP1/World/CMetroid.cpp @@ -89,8 +89,8 @@ CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, con , x81c_patternedInfo(pInfo) , x954_actParams(aParms) , x9bc_parent(other) { - x808_loopAttackDistance = - GetAnimationDistance(CPASAnimParmData{9, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(3)}); + x808_loopAttackDistance = GetAnimationDistance( + CPASAnimParmData{pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(3)}); UpdateTouchBounds(); SetCoefficientOfRestitutionModifier(0.9f); x460_knockBackController.SetX82_24(false); From a1dff449a439478d72137c1a1ed246c781f5a22b Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 5 Mar 2021 09:00:07 -0500 Subject: [PATCH 6/7] Use self-hosted runner for Windows MSVC build --- .github/workflows/build.yml | 57 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f627679c..1835d7f8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Build -on: [push] +on: + push: + branches: + - master + pull_request: jobs: build-linux-gcc: @@ -14,9 +18,9 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get -y install build-essential curl git ninja-build llvm-dev libclang-dev clang lld zlib1g-dev \ - libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \ - libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 qt5-default + sudo apt-get -y install build-essential curl git cmake ninja-build llvm-dev libclang-dev clang lld \ + zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \ + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 qt5-default - name: Create build directory shell: bash run: cmake -E make_directory ${{github.workspace}}/build @@ -40,9 +44,9 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get -y install build-essential curl git ninja-build llvm-dev libclang-dev clang lld zlib1g-dev \ - libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \ - libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 qt5-default + sudo apt-get -y install build-essential curl git cmake ninja-build llvm-dev libclang-dev clang lld \ + zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \ + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 qt5-default - name: Create build directory shell: bash run: cmake -E make_directory ${{github.workspace}}/build @@ -79,26 +83,25 @@ jobs: build-windows-msvc: name: Build Windows (MSVC x86_64) - runs-on: windows-2019 - if: 'false' # disabled for now + runs-on: [self-hosted, windows, x64] steps: - uses: actions/checkout@v2 with: submodules: recursive - - uses: suisei-cn/actions-download-file@v1 - name: Download LLVM - id: download-llvm - with: - url: https://axiodl.com/files/LLVM-10.0.1-win64.exe - target: ${{github.workspace}}/temp - - name: Install LLVM - shell: cmd - working-directory: ${{github.workspace}}/temp - run: ${{steps.download-llvm.outputs.filename}} /S - - uses: ilammy/msvc-dev-cmd@v1 - name: Enable Visual Studio environment - - name: Install ninja - run: choco install ninja +# - name: Download LLVM +# uses: suisei-cn/actions-download-file@v1 +# id: download-llvm +# with: +# url: https://axiodl.com/files/LLVM-10.0.1-win64.exe +# target: ${{github.workspace}}/temp +# - name: Install LLVM +# shell: cmd +# working-directory: ${{github.workspace}}/temp +# run: ${{steps.download-llvm.outputs.filename}} /S +# - name: Install ninja +# run: choco install ninja + - name: Enable Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 - name: Create build directory run: cmake -E make_directory ${{github.workspace}}/build - name: Configure CMake @@ -115,8 +118,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - uses: suisei-cn/actions-download-file@v1 - name: Download LLVM + - name: Download LLVM + uses: suisei-cn/actions-download-file@v1 id: download-llvm with: url: https://axiodl.com/files/LLVM-10.0.1-win64.exe @@ -125,10 +128,10 @@ jobs: shell: cmd working-directory: ${{github.workspace}}/temp run: ${{steps.download-llvm.outputs.filename}} /S - - uses: ilammy/msvc-dev-cmd@v1 - name: Enable Visual Studio environment - name: Install ninja run: choco install ninja + - name: Enable Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 - name: Create build directory run: cmake -E make_directory ${{github.workspace}}/build - name: Configure CMake From 0fb6261bf1b0ffa84cb55dad2bd59e0983e18706 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 5 Mar 2021 09:26:34 -0500 Subject: [PATCH 7/7] Update amuse --- amuse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amuse b/amuse index df7136d26..217e791b8 160000 --- a/amuse +++ b/amuse @@ -1 +1 @@ -Subproject commit df7136d265d1ca15a7851dfec2c8b7ee0dd9de86 +Subproject commit 217e791b882c39e9608e16d13a69643b711f2cbd