diff --git a/Runtime/MP1/World/CElitePirate.cpp b/Runtime/MP1/World/CElitePirate.cpp index 077c530ac..e8e6f911b 100644 --- a/Runtime/MP1/World/CElitePirate.cpp +++ b/Runtime/MP1/World/CElitePirate.cpp @@ -42,7 +42,22 @@ constexpr std::array skSphereJointList{{ {"L_Ball", 0.8f}, {"R_Ball", 0.8f}, }}; -} // namespace + +// The following used to be member functions, but are made internal as +// they alter no internal state. + +// Used to be a member function with a pointer and size in GM8Ev0 +bool IsArmClawCollider(std::string_view name, std::string_view locator, const std::array& info) { + if (name == locator) { + return true; + } + return std::any_of(info.cbegin(), info.cend(), [&name](const auto& entry) { return entry.from == name; }); +} + +bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& vec) { + return std::find(vec.cbegin(), vec.cend(), uid) != vec.cend(); +} +} // Anonymous namespace CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount) : x0_tauntInterval(in.readFloatBig()) @@ -787,10 +802,6 @@ void CElitePirate::SetShotAt(bool val, CStateManager& mgr) { } } -bool CElitePirate::IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& vec) const { - return std::find(vec.begin(), vec.end(), uid) != vec.end(); -} - void CElitePirate::AddCollisionList(const SJointInfo* joints, size_t count, std::vector& outJoints) const { const CAnimData* animData = GetModelData()->GetAnimationData(); @@ -858,11 +869,9 @@ void CElitePirate::SetupCollisionActorInfo(CStateManager& mgr) { if (TCastToPtr act = mgr.ObjectById(uid)) { if (colDesc.GetName() == "Head_1"sv) { x770_collisionHeadId = uid; - } else if (IsArmClawCollider(colDesc.GetName(), "R_Palm_LCTR"sv, skRightArmJointList.data(), - skRightArmJointList.size())) { + } else if (IsArmClawCollider(colDesc.GetName(), "R_Palm_LCTR"sv, skRightArmJointList)) { x774_collisionRJointIds.push_back(uid); - } else if (IsArmClawCollider(colDesc.GetName(), "L_Palm_LCTR"sv, skLeftArmJointList.data(), - skLeftArmJointList.size())) { + } else if (IsArmClawCollider(colDesc.GetName(), "L_Palm_LCTR"sv, skLeftArmJointList)) { x788_collisionLJointIds.push_back(uid); } if (uid != x770_collisionHeadId) { @@ -882,14 +891,6 @@ void CElitePirate::SetupCollisionActorInfo(CStateManager& mgr) { x5d4_collisionActorMgr->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough}); } -bool CElitePirate::IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info, - size_t infoCount) const { - if (name == locator) { - return true; - } - return std::any_of(info, info + infoCount, [&name](const auto& entry) { return entry.from == name; }); -} - void CElitePirate::CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid) { const CAnimationParameters& params = x5d8_data.GetLauncherAnimParams(); if (!params.GetACSFile().IsValid()) { diff --git a/Runtime/MP1/World/CElitePirate.hpp b/Runtime/MP1/World/CElitePirate.hpp index c3d3b506a..7d954e828 100644 --- a/Runtime/MP1/World/CElitePirate.hpp +++ b/Runtime/MP1/World/CElitePirate.hpp @@ -220,15 +220,12 @@ protected: const CCollisionActorManager& GetCollisionActorManager() const { return *x5d4_collisionActorMgr; } private: - bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& vec) const; void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count, std::vector& outJoints) const; void AddCollisionList(const SJointInfo* joints, size_t count, std::vector& outJoints) const; void SetupCollisionManager(CStateManager& mgr); void SetupCollisionActorInfo(CStateManager& mgr); - bool IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info, - size_t infoCount) const; void ApplyDamageToHead(CStateManager& mgr, TUniqueId uid); void CreateEnergyAbsorb(CStateManager& mgr, const zeus::CTransform& xf); bool CanKnockBack(const CDamageInfo& info) const;