mirror of https://github.com/AxioDL/metaforce.git
CBabygoth: Make use of std::array where applicable
Same behavior, no implicit array to pointer decay. We can also move all this data into the cpp file fully.
This commit is contained in:
parent
f1aca12e6b
commit
abd576a43a
|
@ -1,5 +1,7 @@
|
||||||
#include "Runtime/MP1/World/CBabygoth.hpp"
|
#include "Runtime/MP1/World/CBabygoth.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/CStateManager.hpp"
|
#include "Runtime/CStateManager.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
@ -21,7 +23,15 @@
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
const std::string_view CBabygoth::skpMouthDamageJoint = "LCTR_SHEMOUTH"sv;
|
constexpr std::string_view skpMouthDamageJoint = "LCTR_SHEMOUTH"sv;
|
||||||
|
|
||||||
|
constexpr std::array<SSphereJointInfo, 5> skSphereJointList{{
|
||||||
|
{"L_knee", 1.2f},
|
||||||
|
{"R_knee", 1.2f},
|
||||||
|
{"LCTR_SHEMOUTH", 1.7f},
|
||||||
|
{"Pelvis", 1.2f},
|
||||||
|
{"butt_LCTR", 0.9f},
|
||||||
|
}};
|
||||||
|
|
||||||
CBabygothData::CBabygothData(CInputStream& in)
|
CBabygothData::CBabygothData(CInputStream& in)
|
||||||
: x0_fireballAttackTime(in.readFloatBig())
|
: x0_fireballAttackTime(in.readFloatBig())
|
||||||
|
@ -298,13 +308,10 @@ void CBabygoth::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E
|
||||||
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SSphereJointInfo CBabygoth::skSphereJointList[skSphereJointCount] = {
|
void CBabygoth::AddSphereCollisionList(const SSphereJointInfo* sphereJointInfo, size_t jointCount,
|
||||||
{"L_knee", 1.2f}, {"R_knee", 1.2f}, {"LCTR_SHEMOUTH", 1.7f}, {"Pelvis", 1.2f}, {"butt_LCTR", 0.9f}};
|
|
||||||
|
|
||||||
void CBabygoth::AddSphereCollisionList(const SSphereJointInfo* sphereJointInfo, s32 jointCount,
|
|
||||||
std::vector<CJointCollisionDescription>& jointList) {
|
std::vector<CJointCollisionDescription>& jointList) {
|
||||||
for (s32 i = 0; i < jointCount; ++i) {
|
for (size_t i = 0; i < jointCount; ++i) {
|
||||||
CSegId seg = GetModelData()->GetAnimationData()->GetLocatorSegId(sphereJointInfo[i].name);
|
const CSegId seg = GetModelData()->GetAnimationData()->GetLocatorSegId(sphereJointInfo[i].name);
|
||||||
jointList.push_back(
|
jointList.push_back(
|
||||||
CJointCollisionDescription::SphereCollision(seg, sphereJointInfo[i].radius, sphereJointInfo[i].name, 1000.f));
|
CJointCollisionDescription::SphereCollision(seg, sphereJointInfo[i].radius, sphereJointInfo[i].name, 1000.f));
|
||||||
}
|
}
|
||||||
|
@ -312,7 +319,7 @@ void CBabygoth::AddSphereCollisionList(const SSphereJointInfo* sphereJointInfo,
|
||||||
|
|
||||||
void CBabygoth::SetupCollisionManager(CStateManager& mgr) {
|
void CBabygoth::SetupCollisionManager(CStateManager& mgr) {
|
||||||
std::vector<CJointCollisionDescription> joints;
|
std::vector<CJointCollisionDescription> joints;
|
||||||
AddSphereCollisionList(skSphereJointList, skSphereJointCount, joints);
|
AddSphereCollisionList(skSphereJointList.data(), skSphereJointList.size(), joints);
|
||||||
x928_colActMgr = std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false);
|
x928_colActMgr = std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false);
|
||||||
x928_colActMgr->SetActive(mgr, GetActive());
|
x928_colActMgr->SetActive(mgr, GetActive());
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,6 @@ public:
|
||||||
enum class EShellState { Default, CrackOne, CrackTwo, Destroyed };
|
enum class EShellState { Default, CrackOne, CrackTwo, Destroyed };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr s32 skSphereJointCount = 5;
|
|
||||||
static const SSphereJointInfo skSphereJointList[skSphereJointCount];
|
|
||||||
static const std::string_view skpMouthDamageJoint;
|
|
||||||
s32 x568_stateProg = -1;
|
s32 x568_stateProg = -1;
|
||||||
EShellState x56c_shellState = EShellState::Default;
|
EShellState x56c_shellState = EShellState::Default;
|
||||||
CBabygothData x570_babyData;
|
CBabygothData x570_babyData;
|
||||||
|
@ -115,7 +112,7 @@ private:
|
||||||
bool xa49_28_onApproachPath : 1;
|
bool xa49_28_onApproachPath : 1;
|
||||||
bool xa49_29_objectSpaceCollision : 1;
|
bool xa49_29_objectSpaceCollision : 1;
|
||||||
|
|
||||||
void AddSphereCollisionList(const SSphereJointInfo*, s32, std::vector<CJointCollisionDescription>&);
|
void AddSphereCollisionList(const SSphereJointInfo*, size_t, std::vector<CJointCollisionDescription>&);
|
||||||
|
|
||||||
void SetupCollisionManager(CStateManager&);
|
void SetupCollisionManager(CStateManager&);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue