summaryrefslogtreecommitdiff
path: root/ZAPD/GameConfig.cpp
diff options
context:
space:
mode:
authorYanis42 <35189056+Yanis42@users.noreply.github.com>2023-10-08 21:27:57 +0200
committerGitHub <noreply@github.com>2023-10-08 15:27:57 -0400
commit338e35f89afc905399ad90c952d154ae7b20bf75 (patch)
tree46bdbf3fc8f41b42454e3f68c38f281824b552f9 /ZAPD/GameConfig.cpp
parentc7dd81e67783a93e728e5662dfe0c8732d79ce59 (diff)
Update OoT and MM's cutscene names (#303)
* progress * fixed non-matching issues * moved the enums to their own file & improvements * format * split MM and OoT * more cleanup * initial MM update * MM improvements * format * class/function name update * reduce the amount of zeroes (match) * enum rename * format * removed hardcoded enums for OoT * review 1 * remove mm hardcoded enums * format * ActorCutscene -> CutsceneEntry CutsceneEntry -> CutsceneScriptEntry * format * some changes in (actor) cutsceneentry * config "CutsceneEnumData" -> "EnumData" * add ``else if``s inside ``ConfigFunc_EnumData`` * more ``else if``s * removed reference in ``~CutsceneCommand``
Diffstat (limited to 'ZAPD/GameConfig.cpp')
-rw-r--r--ZAPD/GameConfig.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp
index 6384808..fffa7f4 100644
--- a/ZAPD/GameConfig.cpp
+++ b/ZAPD/GameConfig.cpp
@@ -165,6 +165,80 @@ void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element)
externalFiles.push_back(ExternalFile(fs::path(xmlPathValue), fs::path(outPathValue)));
}
+void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element)
+{
+ std::string path = Path::GetDirectoryName(configFilePath);
+ path = path.append("/").append(element.Attribute("File"));
+ tinyxml2::XMLDocument doc;
+ tinyxml2::XMLError eResult = doc.LoadFile(path.c_str());
+
+ if (eResult != tinyxml2::XML_SUCCESS)
+ {
+ throw std::runtime_error("Error: Unable to read cutscene data.");
+ }
+
+ tinyxml2::XMLNode* root = doc.FirstChild();
+
+ if (root == nullptr)
+ return;
+
+ for (tinyxml2::XMLElement* csEnum = root->FirstChildElement(); csEnum != nullptr;
+ csEnum = csEnum->NextSiblingElement())
+ {
+ for (tinyxml2::XMLElement* item = csEnum->FirstChildElement(); item != nullptr;
+ item = item->NextSiblingElement())
+ {
+ std::string enumKey = csEnum->Attribute("Key");
+ uint16_t itemIndex = atoi(item->Attribute("Index"));
+ const char* itemID = item->Attribute("ID");
+
+ // Common
+ if (enumKey == "cmd")
+ cutsceneData.cutsceneCmd[itemIndex] = itemID;
+
+ else if (enumKey == "miscType")
+ cutsceneData.miscType[itemIndex] = itemID;
+
+ else if (enumKey == "textType")
+ cutsceneData.textType[itemIndex] = itemID;
+
+ else if (enumKey == "fadeOutSeqPlayer")
+ cutsceneData.fadeOutSeqPlayer[itemIndex] = itemID;
+
+ else if (enumKey == "transitionType")
+ cutsceneData.transitionType[itemIndex] = itemID;
+
+ else if (enumKey == "destination")
+ cutsceneData.destination[itemIndex] = itemID;
+
+ // MM
+ else if (enumKey == "modifySeqType")
+ cutsceneData.modifySeqType[itemIndex] = itemID;
+
+ else if (enumKey == "chooseCreditsSceneType")
+ cutsceneData.chooseCreditsSceneType[itemIndex] = itemID;
+
+ else if (enumKey == "destinationType")
+ cutsceneData.destinationType[itemIndex] = itemID;
+
+ else if (enumKey == "motionBlurType")
+ cutsceneData.motionBlurType[itemIndex] = itemID;
+
+ else if (enumKey == "transitionGeneralType")
+ cutsceneData.transitionGeneralType[itemIndex] = itemID;
+
+ else if (enumKey == "rumbleType")
+ cutsceneData.rumbleType[itemIndex] = itemID;
+
+ else if (enumKey == "spawnFlag")
+ cutsceneData.spawnFlag[itemIndex] = itemID;
+
+ else if (enumKey == "endSfx")
+ cutsceneData.endSfx[itemIndex] = itemID;
+ }
+ }
+}
+
void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath)
{
static const std::unordered_map<std::string, ConfigFunc> ConfigFuncDictionary = {
@@ -175,6 +249,7 @@ void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath)
{"SpecialEntranceList", &GameConfig::ConfigFunc_specialEntranceList},
{"TexturePool", &GameConfig::ConfigFunc_TexturePool},
{"BGConfig", &GameConfig::ConfigFunc_BGConfig},
+ {"EnumData", &GameConfig::ConfigFunc_EnumData},
{"ExternalXMLFolder", &GameConfig::ConfigFunc_ExternalXMLFolder},
{"ExternalFile", &GameConfig::ConfigFunc_ExternalFile},
};