summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actASSetting.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-03-20 00:32:24 +0100
committerLéo Lam <leo@leolam.fr>2021-03-20 14:36:27 +0100
commit737a9b522b9d05e9a918240a191e6a7973cc6a4d (patch)
tree6d7eceeafb4983ab82f0d45d6244c68de7db7389 /src/KingSystem/ActorSystem/actASSetting.cpp
parent8c8d9c0e7036d22d3eebe1c8dca54b44b601e8e5 (diff)
ksys: Add ASSetting
Diffstat (limited to 'src/KingSystem/ActorSystem/actASSetting.cpp')
-rw-r--r--src/KingSystem/ActorSystem/actASSetting.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/actASSetting.cpp b/src/KingSystem/ActorSystem/actASSetting.cpp
index 1dff9658..0202a85c 100644
--- a/src/KingSystem/ActorSystem/actASSetting.cpp
+++ b/src/KingSystem/ActorSystem/actASSetting.cpp
@@ -1 +1,31 @@
#include "KingSystem/ActorSystem/actASSetting.h"
+#include "KingSystem/Resource/resLoadRequest.h"
+#include "KingSystem/Resource/resResourceASSetting.h"
+
+namespace ksys::act {
+
+SEAD_SINGLETON_DISPOSER_IMPL(ASSetting)
+
+ASSetting::~ASSetting() = default;
+
+void ASSetting::init(const sead::SafeString& config_path) {
+ res::LoadRequest req;
+ req.mRequester = "ASSetting";
+ req._22 = true;
+ mHandle.load(config_path, &req);
+}
+
+// NON_MATCHING: sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
+const res::ASSetting::BoneParams* ASSetting::getBoneParams(const sead::SafeString& key) const {
+ auto* res = sead::DynamicCast<res::ASSetting>(mHandle.getResource());
+ if (!res)
+ return nullptr;
+
+ for (const auto& bones : res->getBlenderBones()) {
+ if (key == bones.mKeyName.ref())
+ return &bones.mBoneParams;
+ }
+ return nullptr;
+}
+
+} // namespace ksys::act