2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-08-04 07:35:36 +00:00

CFlaahgraTentacle: Make private static data completely internally linked

Given these aren't referenced anywhere else, we can make them fully
internally linked. We can also make the joint list fully constexpr.
This commit is contained in:
Lioncash 2020-04-09 17:38:03 -04:00
parent 0e4bd8bf13
commit ef70d894f5
2 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,7 @@
#include "Runtime/MP1/World/CFlaahgraTentacle.hpp"
#include <array>
#include "Runtime/CStateManager.hpp"
#include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/World/CPlayer.hpp"
@ -8,6 +10,15 @@
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde::MP1 {
namespace {
constexpr std::string_view skpTentacleTip = "Arm_12"sv;
constexpr std::array<SSphereJointInfo, 3> skJointList{{
{"Arm_8", 2.f},
{"Arm_10", 1.2f},
{"Arm_12", 1.2f},
}};
} // Anonymous namespace
CFlaahgraTentacle::CFlaahgraTentacle(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
const CActorParameters& actParms)
@ -84,11 +95,11 @@ void CFlaahgraTentacle::Think(float dt, CStateManager& mgr) {
x578_ -= dt;
}
void CFlaahgraTentacle::AddSphereCollisionList(const SSphereJointInfo* sphereJoints, s32 jointCount,
void CFlaahgraTentacle::AddSphereCollisionList(const SSphereJointInfo* sphereJoints, size_t jointCount,
std::vector<CJointCollisionDescription>& outJoints) {
const CAnimData* animData = GetModelData()->GetAnimationData();
for (s32 i = 0; i < jointCount; ++i) {
for (size_t i = 0; i < jointCount; ++i) {
const SSphereJointInfo& sphereJoint = sphereJoints[i];
const CSegId segId = animData->GetLocatorSegId(sphereJoint.name);
@ -100,11 +111,9 @@ void CFlaahgraTentacle::AddSphereCollisionList(const SSphereJointInfo* sphereJoi
}
}
const SSphereJointInfo CFlaahgraTentacle::skJointList[3] = {{"Arm_8", 2.f}, {"Arm_10", 1.2f}, {"Arm_12", 1.2f}};
void CFlaahgraTentacle::SetupCollisionManager(CStateManager& mgr) {
std::vector<CJointCollisionDescription> jointList;
AddSphereCollisionList(skJointList, 3, jointList);
AddSphereCollisionList(skJointList.data(), skJointList.size(), jointList);
x56c_collisionManager =
std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), jointList, true);

View File

@ -11,8 +11,6 @@
namespace urde::MP1 {
class CFlaahgraTentacle : public CPatterned {
static const SSphereJointInfo skJointList[3];
static constexpr std::string_view skpTentacleTip = "Arm_12"sv;
s32 x568_ = -1;
std::unique_ptr<CCollisionActorManager> x56c_collisionManager;
float x570_ = 0.f;
@ -23,7 +21,8 @@ class CFlaahgraTentacle : public CPatterned {
TUniqueId x58c_triggerId = kInvalidUniqueId;
bool x58e_24_ : 1;
void AddSphereCollisionList(const SSphereJointInfo*, s32, std::vector<CJointCollisionDescription>&);
void AddSphereCollisionList(const SSphereJointInfo* sphereJoints, size_t jointCount,
std::vector<CJointCollisionDescription>& outJoints);
void SetupCollisionManager(CStateManager&);
void ExtractTentacle(CStateManager&);
void RetractTentacle(CStateManager&);