From f7e6cce7a9c7c89afd1e013294ed427ace08d350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 8 Nov 2020 18:28:43 +0100 Subject: ksys/act: Implement final non-dev-only ActorParam function --- src/KingSystem/ActorSystem/actActorParam.cpp | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/KingSystem/ActorSystem/actActorParam.cpp') diff --git a/src/KingSystem/ActorSystem/actActorParam.cpp b/src/KingSystem/ActorSystem/actActorParam.cpp index bcc3a045..b358375a 100644 --- a/src/KingSystem/ActorSystem/actActorParam.cpp +++ b/src/KingSystem/ActorSystem/actActorParam.cpp @@ -1,6 +1,9 @@ #include "KingSystem/ActorSystem/actActorParam.h" #include #include +#include "KingSystem/ActorSystem/actActorParamMgr.h" +#include "KingSystem/ActorSystem/actActorTemplate.h" +#include "KingSystem/Utils/Byaml.h" namespace ksys::act { @@ -125,4 +128,30 @@ bool ActorParam::setPriority(const sead::SafeString& priority) { return false; } +void ActorParam::setProfileAndPriority(const char* profile, const char* priority) { + mProfile = profile; + + al::ByamlIter* root = ActorTemplate::instance()->getRootIter(); + al::ByamlIter iter; + if (root->tryGetIterByKey(&iter, profile)) { + const char* profile_priority; + iter.tryGetStringByKey(&mClassName, "class"); + iter.tryGetStringByKey(&profile_priority, "priority"); + + if (setPriority(priority)) + return; + + if (setPriority(profile_priority)) + return; + + ActorParamMgr::instance()->getDebugMessage().log( + "[%s] アクタテンプレート %s の 処理順指定[%s:%s]は定義されていません", + mActorName.cstr(), profile, priority, profile_priority); + } else { + ActorParamMgr::instance()->getDebugMessage().log( + "[%s] アクタテンプレートに %s は定義されていません", mActorName.cstr(), profile); + setProfileAndPriority("Dummy", priority); + } +} + } // namespace ksys::act -- cgit v1.2.3