From 5d4bd639dfdffcf26edb458485beee1b81b92531 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Sat, 9 Mar 2024 23:12:39 -0600 Subject: Refactored vtx overlap function --- src/Companion.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Companion.cpp') diff --git a/src/Companion.cpp b/src/Companion.cpp index 441f596..81044b3 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -14,6 +14,7 @@ #include "factories/VtxFactory.h" #include "factories/TextureFactory.h" #include "factories/DisplayListFactory.h" +#include "factories/DisplayListOverrides.h" #include "factories/BlobFactory.h" #include "factories/LightsFactory.h" #include "factories/mk64/CourseVtx.h" @@ -482,6 +483,7 @@ void Companion::Process() { this->gConfig.segment.local.clear(); this->gFileHeader.clear(); this->gCurrentPad = 0; + GFXDOverride::ClearVtx(); if(root[":config"]) { this->ParseCurrentFileConfig(root[":config"]); @@ -783,6 +785,25 @@ std::optional> Companion::GetNodeByAddr(cons return this->gAddrMap[this->gCurrentFile][addr]; } +std::optional>> Companion::GetNodesByType(const std::string& type){ + std::vector> nodes; + + if(!this->gAddrMap.contains(this->gCurrentFile)){ + return nodes; + } + + for(auto& [addr, tpl] : this->gAddrMap[this->gCurrentFile]){ + auto [name, node] = tpl; + const auto n_type = GetSafeNode(node, "type"); + if(n_type == type){ + nodes.push_back(tpl); + } + } + + return nodes; + +} + std::string Companion::NormalizeAsset(const std::string& name) const { auto path = fs::path(this->gCurrentFile).stem().string() + "_" + name; return path; -- cgit v1.2.3