From 108fd502bf1996c718aa2601727f9e8b0d459193 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 26 Mar 2020 21:42:18 -0400 Subject: [PATCH] CElitePirate/CFlyingPirate: Updates from symbol map --- Runtime/MP1/World/CElitePirate.cpp | 46 +++++++++++++++-------------- Runtime/MP1/World/CElitePirate.hpp | 16 +++++----- Runtime/MP1/World/CFlyingPirate.cpp | 14 +++++---- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/Runtime/MP1/World/CElitePirate.cpp b/Runtime/MP1/World/CElitePirate.cpp index 601dbab9d..f994d649e 100644 --- a/Runtime/MP1/World/CElitePirate.cpp +++ b/Runtime/MP1/World/CElitePirate.cpp @@ -17,19 +17,19 @@ namespace urde::MP1 { namespace { -static constexpr std::array skJointInfoL{{ +static constexpr std::array skLeftArmJointList{{ {"L_shoulder", "L_elbow", 1.f, 1.5f}, {"L_wrist", "L_elbow", 0.9f, 1.3f}, {"L_knee", "L_ankle", 0.9f, 1.3f}, }}; -static constexpr std::array skJointInfoR{{ +static constexpr std::array skRightArmJointList{{ {"R_shoulder", "R_elbow", 1.f, 1.5f}, {"R_wrist", "R_elbow", 0.9f, 1.3f}, {"R_knee", "R_ankle", 0.9f, 1.3f}, }}; -static constexpr std::array skSphereJointInfo{{ +static constexpr std::array skSphereJointList{{ {"Head_1", 1.2f}, {"L_Palm_LCTR", 1.5f}, {"R_Palm_LCTR", 1.5f}, @@ -164,8 +164,8 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta } break; } - if ((!x988_25_ || !sub_802293f8(uid, x774_collisionRJointIds)) && - (!x988_26_ || !sub_802293f8(uid, x788_collisionLJointIds))) { + if ((!x988_25_ || !IsArmClawCollider(uid, x774_collisionRJointIds)) && + (!x988_26_ || !IsArmClawCollider(uid, x788_collisionLJointIds))) { break; } mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(), @@ -176,7 +176,7 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta } case EScriptObjectMessage::Registered: { x450_bodyController->Activate(mgr); - SetupCollisionManagers(mgr); + SetupCollisionManager(mgr); x772_launcherId = mgr.AllocateUniqueId(); CreateGrenadeLauncher(mgr, x772_launcherId); const auto& bodyStateInfo = x450_bodyController->GetBodyStateInfo(); @@ -390,7 +390,7 @@ bool CElitePirate::ShouldCallForBackup(CStateManager& mgr, float arg) { return C CPathFindSearch* CElitePirate::GetSearchPath() { return CPatterned::GetSearchPath(); } -void CElitePirate::sub_80229114(CStateManager& mgr) { +void CElitePirate::SetupHealthInfo(CStateManager& mgr) { const CHealthInfo* const health = HealthInfo(mgr); x7b4_hp = health->GetHP(); if (sub_802273a8()) { @@ -401,7 +401,7 @@ void CElitePirate::sub_80229114(CStateManager& mgr) { actor->SetDamageVulnerability(x56c_vulnerability); } } - sub_8022902c(mgr, x772_launcherId); + UpdateHealthInfo(mgr, x772_launcherId); } void CElitePirate::sub_802289b0(CStateManager& mgr, bool b) { sub_80228920(mgr, b, x772_launcherId); } @@ -430,7 +430,7 @@ void CElitePirate::sub_8022759c(bool param_1, CStateManager& mgr) { } } -bool CElitePirate::sub_802293f8(TUniqueId uid, const rstl::reserved_vector& vec) const { +bool CElitePirate::IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& vec) const { return std::find(vec.begin(), vec.end(), uid) != vec.end(); } @@ -468,12 +468,12 @@ void CElitePirate::AddSphereCollisionList(const SSphereJointInfo* joints, size_t } } -void CElitePirate::SetupCollisionManagers(CStateManager& mgr) { - constexpr size_t jointInfoCount = skJointInfoL.size() + skJointInfoR.size() + skSphereJointInfo.size(); +void CElitePirate::SetupCollisionManager(CStateManager& mgr) { + constexpr size_t jointInfoCount = skLeftArmJointList.size() + skRightArmJointList.size() + skSphereJointList.size(); std::vector joints(jointInfoCount); - AddCollisionList(skJointInfoL.data(), skJointInfoL.size(), joints); - AddCollisionList(skJointInfoR.data(), skJointInfoL.size(), joints); - AddSphereCollisionList(skSphereJointInfo.data(), skSphereJointInfo.size(), joints); + AddCollisionList(skLeftArmJointList.data(), skLeftArmJointList.size(), joints); + AddCollisionList(skRightArmJointList.data(), skLeftArmJointList.size(), joints); + AddSphereCollisionList(skSphereJointList.data(), skSphereJointList.size(), joints); if (sub_802273a8()) { x730_collisionActorMgr2 = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, true); @@ -489,8 +489,8 @@ void CElitePirate::SetupCollisionManagers(CStateManager& mgr) { x5d4_collisionActorMgr1 = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false); - sub_80229818(mgr); - sub_80229114(mgr); + SetupCollisionActorInfo(mgr); + SetupHealthInfo(mgr); SetMaterialFilter(CMaterialFilter::MakeIncludeExclude( {EMaterialTypes::Solid}, @@ -498,7 +498,7 @@ void CElitePirate::SetupCollisionManagers(CStateManager& mgr) { AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr); } -void CElitePirate::sub_80229818(CStateManager& mgr) { +void CElitePirate::SetupCollisionActorInfo(CStateManager& mgr) { if (sub_802273a8()) { for (size_t i = 0; i < x730_collisionActorMgr2->GetNumCollisionActors(); ++i) { const auto& colDesc = x730_collisionActorMgr2->GetCollisionDescFromIndex(i); @@ -506,9 +506,11 @@ void CElitePirate::sub_80229818(CStateManager& mgr) { if (TCastToPtr act = mgr.ObjectById(uid)) { if (colDesc.GetName() == "Head_1"sv) { x770_collisionHeadId = uid; - } else if (sub_8022943c(colDesc.GetName(), "R_Palm_LCTR"sv, skJointInfoR.data(), skJointInfoR.size())) { + } else if (IsArmClawCollider(colDesc.GetName(), "R_Palm_LCTR"sv, skRightArmJointList.data(), + skRightArmJointList.size())) { x774_collisionRJointIds.push_back(uid); - } else if (sub_8022943c(colDesc.GetName(), "L_Palm_LCTR"sv, skJointInfoL.data(), skJointInfoL.size())) { + } else if (IsArmClawCollider(colDesc.GetName(), "L_Palm_LCTR"sv, skLeftArmJointList.data(), + skLeftArmJointList.size())) { x788_collisionLJointIds.push_back(uid); } if (uid != x770_collisionHeadId) { @@ -528,8 +530,8 @@ void CElitePirate::sub_80229818(CStateManager& mgr) { x5d4_collisionActorMgr1->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough}); } -bool CElitePirate::sub_8022943c(std::string_view name, std::string_view locator, const SJointInfo* info, - size_t infoCount) { +bool CElitePirate::IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info, + size_t infoCount) { if (name == locator) { return true; } @@ -579,7 +581,7 @@ void CElitePirate::sub_802281d8(CStateManager& mgr, const zeus::CTransform& xf) x7ac_ = 0.25f; } -void CElitePirate::sub_8022902c(CStateManager& mgr, TUniqueId uid) { +void CElitePirate::UpdateHealthInfo(CStateManager& mgr, TUniqueId uid) { const CHealthInfo* const health = HealthInfo(mgr); if (uid != kInvalidUniqueId) { if (TCastToPtr actor = mgr.ObjectById(uid)) { diff --git a/Runtime/MP1/World/CElitePirate.hpp b/Runtime/MP1/World/CElitePirate.hpp index 04aa80767..63d490828 100644 --- a/Runtime/MP1/World/CElitePirate.hpp +++ b/Runtime/MP1/World/CElitePirate.hpp @@ -74,8 +74,8 @@ class CElitePirate : public CPatterned { std::optional> x760_; TUniqueId x770_collisionHeadId = kInvalidUniqueId; TUniqueId x772_launcherId = kInvalidUniqueId; - rstl::reserved_vector x774_collisionRJointIds; - rstl::reserved_vector x788_collisionLJointIds; + rstl::reserved_vector x774_collisionRJointIds; + rstl::reserved_vector x788_collisionLJointIds; TUniqueId x79c_ = kInvalidUniqueId; float x7a0_; float x7a4_ = 1.f; @@ -150,7 +150,7 @@ public: CPathFindSearch* GetSearchPath() override; virtual bool sub_802273a8() const { return true; } virtual bool sub_802273b0() const { return true; } - virtual void sub_80229114(CStateManager& mgr); + virtual void SetupHealthInfo(CStateManager& mgr); virtual void sub_802289b0(CStateManager& mgr, bool b); virtual SShockWaveData GetShockWaveData() const { return {x5d8_data.GetXF8(), x5d8_data.GetXFC(), x5d8_data.GetX118(), x5d8_data.GetX11C()}; @@ -159,18 +159,18 @@ public: private: void sub_80229248(); void sub_8022759c(bool param_1, CStateManager& mgr); - bool sub_802293f8(TUniqueId uid, const rstl::reserved_vector& vec) const; + 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 SetupCollisionManagers(CStateManager& mgr); - void sub_80229818(CStateManager& mgr); - bool sub_8022943c(std::string_view name, std::string_view locator, const SJointInfo* info, size_t infoCount); + void SetupCollisionManager(CStateManager& mgr); + void SetupCollisionActorInfo(CStateManager& mgr); + bool IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info, size_t infoCount); void CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid); void sub_80227464(CStateManager& mgr, TUniqueId uid); void sub_802281d8(CStateManager& mgr, const zeus::CTransform& xf); - void sub_8022902c(CStateManager& mgr, TUniqueId uid); + void UpdateHealthInfo(CStateManager& mgr, TUniqueId uid); void sub_80228920(CStateManager& mgr, bool b, TUniqueId uid); zeus::CVector3f sub_80228864(const CActor* actor) const; }; diff --git a/Runtime/MP1/World/CFlyingPirate.cpp b/Runtime/MP1/World/CFlyingPirate.cpp index 685f31c24..563666e5a 100644 --- a/Runtime/MP1/World/CFlyingPirate.cpp +++ b/Runtime/MP1/World/CFlyingPirate.cpp @@ -21,7 +21,7 @@ namespace urde::MP1 { namespace { -constexpr std::array skBurst1{{ +constexpr std::array skBurstsFlying{{ {4, {3, 4, 11, 12, -1, 0, 0, 0}, 0.1f, 0.05f}, {20, {2, 3, 4, 5, -1, 0, 0, 0}, 0.1f, 0.05f}, {20, {10, 11, 12, 13, -1, 0, 0, 0}, 0.1f, 0.05f}, @@ -30,7 +30,7 @@ constexpr std::array skBurst1{{ {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000}, }}; -constexpr std::array skBurst2{{ +constexpr std::array skBurstsFlyingOutOfView{{ {5, {3, 4, 8, 12, -1, 0, 0, 0}, 0.1f, 0.05f}, {10, {2, 3, 4, 5, -1, 0, 0, 0}, 0.1f, 0.05f}, {10, {10, 11, 12, 13, -1, 0, 0, 0}, 0.1f, 0.05f}, @@ -39,7 +39,7 @@ constexpr std::array skBurst2{{ {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000}, }}; -constexpr std::array skBurst3{{ +constexpr std::array skBurstsLanded{{ {30, {3, 4, 5, 11, 12, 4, -1, 0}, 0.1f, 0.05f}, {20, {2, 3, 4, 5, 4, 3, -1, 0}, 0.1f, 0.05f}, {20, {5, 4, 3, 13, 12, 11, -1, 0}, 0.1f, 0.05f}, @@ -47,7 +47,7 @@ constexpr std::array skBurst3{{ {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000}, }}; -constexpr std::array skBurst4{{ +constexpr std::array skBurstsLandedOutOfView{{ {10, {6, 5, 4, 14, 13, 12, -1, 0}, 0.1f, 0.05f}, {20, {14, 13, 12, 11, 10, 9, -1, 0}, 0.1f, 0.05f}, {20, {14, 15, 16, 11, 10, 9, -1, 0}, 0.1f, 0.05f}, @@ -56,7 +56,11 @@ constexpr std::array skBurst4{{ }}; constexpr std::array skBursts{ - skBurst1.data(), skBurst2.data(), skBurst3.data(), skBurst4.data(), nullptr, + skBurstsFlying.data(), + skBurstsFlyingOutOfView.data(), + skBurstsLanded.data(), + skBurstsLandedOutOfView.data(), + nullptr, }; constexpr std::array skParts{