summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actASSetting.cpp
blob: 164d9e67e2ca06d6376e4a6e2ad4eaae13a981dd (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
26
27
28
29
30
31
32
33
#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, sead::Heap* heap) {
    res::LoadRequest req;
    req.mRequester = "ASSetting";
    req._22 = true;
    mHandle.load(config_path, &req);
}

// sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
#ifdef NON_MATCHING
res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const {
    auto* res = sead::DynamicCast<res::ASSetting>(mHandle.getResource());
    if (!res)
        return nullptr;

    for (auto& bones : res->getBlenderBones()) {
        if (key == bones.mKeyName.ref())
            return &bones.mBoneParams;
    }
    return nullptr;
}
#endif

}  // namespace ksys::act