CElitePirate/CFlyingPirate: Updates from symbol map

This commit is contained in:
Luke Street 2020-03-26 21:42:18 -04:00
parent 0886a39d81
commit 108fd502bf
3 changed files with 41 additions and 35 deletions

View File

@ -17,19 +17,19 @@
namespace urde::MP1 {
namespace {
static constexpr std::array<SJointInfo, 3> skJointInfoL{{
static constexpr std::array<SJointInfo, 3> 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<SJointInfo, 3> skJointInfoR{{
static constexpr std::array<SJointInfo, 3> 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<SSphereJointInfo, 7> skSphereJointInfo{{
static constexpr std::array<SSphereJointInfo, 7> 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<TUniqueId, 8>& vec) const {
bool CElitePirate::IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector<TUniqueId, 7>& 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<CJointCollisionDescription> 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<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, true);
@ -489,8 +489,8 @@ void CElitePirate::SetupCollisionManagers(CStateManager& mgr) {
x5d4_collisionActorMgr1 =
std::make_unique<CCollisionActorManager>(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<CCollisionActor> 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<CCollisionActor> actor = mgr.ObjectById(uid)) {

View File

@ -74,8 +74,8 @@ class CElitePirate : public CPatterned {
std::optional<TLockedToken<CGenDescription>> x760_;
TUniqueId x770_collisionHeadId = kInvalidUniqueId;
TUniqueId x772_launcherId = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, 8> x774_collisionRJointIds;
rstl::reserved_vector<TUniqueId, 8> x788_collisionLJointIds;
rstl::reserved_vector<TUniqueId, 7> x774_collisionRJointIds;
rstl::reserved_vector<TUniqueId, 7> 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<TUniqueId, 8>& vec) const;
bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector<TUniqueId, 7>& vec) const;
void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& outJoints) const;
void AddCollisionList(const SJointInfo* joints, size_t count,
std::vector<CJointCollisionDescription>& 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;
};

View File

@ -21,7 +21,7 @@
namespace urde::MP1 {
namespace {
constexpr std::array<SBurst, 6> skBurst1{{
constexpr std::array<SBurst, 6> 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<SBurst, 6> skBurst1{{
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 6> skBurst2{{
constexpr std::array<SBurst, 6> 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<SBurst, 6> skBurst2{{
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 5> skBurst3{{
constexpr std::array<SBurst, 5> 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<SBurst, 5> skBurst3{{
{0, {0, 0, 0, 0, 0, 0, 0, 0}, 0.000000, 0.000000},
}};
constexpr std::array<SBurst, 5> skBurst4{{
constexpr std::array<SBurst, 5> 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<SBurst, 5> skBurst4{{
}};
constexpr std::array<const SBurst*, 5> skBursts{
skBurst1.data(), skBurst2.data(), skBurst3.data(), skBurst4.data(), nullptr,
skBurstsFlying.data(),
skBurstsFlyingOutOfView.data(),
skBurstsLanded.data(),
skBurstsLandedOutOfView.data(),
nullptr,
};
constexpr std::array<std::string_view, 15> skParts{