ksys/res: Finish implementing ModelList

This commit is contained in:
Léo Lam
2021-03-19 14:31:19 +01:00
parent c119c0eefa
commit 8c8d9c0e70
9 changed files with 515 additions and 75 deletions
+3 -12
View File
@@ -6,6 +6,7 @@
#include "KingSystem/ActorSystem/actDebug.h"
#include "KingSystem/Event/evtEvent.h"
#include "KingSystem/Event/evtManager.h"
#include "KingSystem/Resource/resResourceModelList.h"
#include "KingSystem/Utils/Byaml/Byaml.h"
#include "KingSystem/Utils/Byaml/ByamlArrayIter.h"
#include "KingSystem/Utils/Byaml/ByamlData.h"
@@ -215,17 +216,6 @@ const char* InfoData::getStringByKey(const al::ByamlIter& iter, const char* key,
return iter.tryGetStringByKey(&value, key) ? value : default_.cstr();
}
[[gnu::noinline]] static InfoData::Locator::Type
getLocatorTypeFromStr(const sead::SafeString& type) {
static constexpr const char* types[] = {"Trunk", "Branch", "GlowStone",
"OnTree", "MagnePos", "StopTimerPos"};
for (s32 i = 0; i < s32(std::size(types)); ++i) {
if (type == types[i])
return InfoData::Locator::Type(i);
}
return InfoData::Locator::Type::Invalid;
}
void InfoData::getLocators(const char* actor, Locators& info) const {
info.num = 0;
@@ -255,7 +245,8 @@ void InfoData::getLocators(const char* actor, Locators& info) const {
it.tryGetFloatByKey(&locator.rot.z, "rot_z");
it.tryGetStringByKey(&type_str, "type");
locator.type = type_str ? getLocatorTypeFromStr(type_str) : Locator::Type::Invalid;
locator.type =
type_str ? res::ModelList::getLocatorTypeFromStr(type_str) : Locator::Type::Invalid;
locator.rot *= 2 * sead::numbers::pi / 360.0;
}