ksys: Add ASSetting

This commit is contained in:
Léo Lam
2021-03-20 00:32:24 +01:00
parent 8c8d9c0e70
commit 737a9b522b
7 changed files with 270 additions and 37 deletions
@@ -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