summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System/physUtil.cpp
blob: d5ed8af5c43129eb565c85cc43a267b04418769c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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