mirror of
https://github.com/zeldaret/botw
synced 2026-10-21 01:04:27 -04:00
ksys/phys: move motionTypeFromText to physUtil
motionTypeFromText isn't part of physDefines: its "Keyframed" string (only used there) sits between the StaticCompound and PlayReport strings in .rodata, far from physDefines' enum text, and the function is linked right after the contact listener's inline virtuals, so it most likely starts a new TU at 0x7100fd069c. Nothing separates it from getMaterialMaskFromShape and the other helpers in physUtil, so it goes in the same file and its declaration moves to physUtil.h. That part is a guess: neither function has data that would show a boundary. (AI assisted using Claude Opus 5.5)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodyPolytope.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodySphere.h"
|
||||
#include "KingSystem/Physics/System/physEntityGroupFilter.h"
|
||||
#include "KingSystem/Physics/System/physUtil.h"
|
||||
#include "KingSystem/Utils/SafeDelete.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
@@ -1 +1,25 @@
|
||||
#include "KingSystem/Physics/System/physUtil.h"
|
||||
#include "KingSystem/Physics/physDefines.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
MotionType motionTypeFromText(const sead::SafeString& text) {
|
||||
static constexpr const char* texts[] = {
|
||||
"Dynamic",
|
||||
"Fixed",
|
||||
"Keyframed",
|
||||
};
|
||||
static_assert(int(MotionType::Dynamic) == 0);
|
||||
static_assert(int(MotionType::Fixed) == 1);
|
||||
static_assert(int(MotionType::Keyframed) == 2);
|
||||
|
||||
int type = 0;
|
||||
for (const char* type_text : texts) {
|
||||
if (text == type_text)
|
||||
return static_cast<MotionType>(type);
|
||||
++type;
|
||||
}
|
||||
return MotionType::Unknown;
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
|
||||
class hkpCollidable;
|
||||
class hkpShape;
|
||||
@@ -14,6 +15,10 @@ namespace ksys::phys {
|
||||
|
||||
class StaticCompoundRigidBodyGroup;
|
||||
struct RigidBodyCollisionMasks;
|
||||
enum class MotionType;
|
||||
|
||||
// 0x0000007100fd069c
|
||||
MotionType motionTypeFromText(const sead::SafeString& text);
|
||||
|
||||
// 0x0000007100fd0810
|
||||
u32 getMaterialMaskFromShape(const hkpShape& shape, const u32* shape_key,
|
||||
|
||||
@@ -84,23 +84,4 @@ WallCode wallCodeFromText(const sead::SafeString& text) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MotionType motionTypeFromText(const sead::SafeString& text) {
|
||||
static constexpr const char* texts[] = {
|
||||
"Dynamic",
|
||||
"Fixed",
|
||||
"Keyframed",
|
||||
};
|
||||
static_assert(int(MotionType::Dynamic) == 0);
|
||||
static_assert(int(MotionType::Fixed) == 1);
|
||||
static_assert(int(MotionType::Keyframed) == 2);
|
||||
|
||||
int type = 0;
|
||||
for (const char* type_text : texts) {
|
||||
if (text == type_text)
|
||||
return static_cast<MotionType>(type);
|
||||
++type;
|
||||
}
|
||||
return MotionType::Unknown;
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
||||
@@ -401,6 +401,4 @@ FloorCode floorCodeFromText(const sead::SafeString& text);
|
||||
const char* wallCodeToText(WallCode code);
|
||||
WallCode wallCodeFromText(const sead::SafeString& text);
|
||||
|
||||
MotionType motionTypeFromText(const sead::SafeString& text);
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
||||
Reference in New Issue
Block a user