diff options
| author | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2023-10-18 00:09:24 -0400 |
|---|---|---|
| committer | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2023-10-18 00:09:24 -0400 |
| commit | 3f878d401fdcff6e7f898524f3bcf5cf4c2b2532 (patch) | |
| tree | 2f0a7e29ec2dd17d0cbe70e8ee52c96f88608bfa /ZAPD/GameConfig.cpp | |
| parent | e9f4fc638ed904cc0dcdac24ea7708c9a220a702 (diff) | |
| parent | 094e797349c86d0baef4a624962f4287aefdfef2 (diff) | |
Merge branch 'JackMaster' into mergeJackOntoSquash
Conflicts:
ZAPD/Declaration.h
ZAPD/Globals.cpp
ZAPD/Globals.h
ZAPD/Main.cpp
ZAPD/OtherStructs/SkinLimbStructs.cpp
ZAPD/OtherStructs/SkinLimbStructs.h
ZAPD/ZAnimation.cpp
ZAPD/ZCollision.cpp
ZAPD/ZCollision.h
ZAPD/ZDisplayList.cpp
ZAPD/ZFile.cpp
ZAPD/ZLimb.cpp
ZAPD/ZLimb.h
ZAPD/ZPath.cpp
ZAPD/ZResource.h
ZAPD/ZRoom/Commands/SetCsCamera.cpp
ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp
ZAPD/ZRoom/Commands/SetCutscenes.cpp
ZAPD/ZRoom/Commands/SetCutscenes.h
ZAPD/ZRoom/Commands/SetEntranceList.cpp
ZAPD/ZRoom/Commands/SetLightingSettings.cpp
ZAPD/ZRoom/Commands/SetMesh.cpp
ZAPD/ZRoom/Commands/SetMinimapList.cpp
ZAPD/ZTexture.cpp
ZAPDUtils/Makefile
ZAPDUtils/Utils/BitConverter.h
ZAPDUtils/Utils/Directory.h
ZAPDUtils/Utils/File.h
ZAPDUtils/Utils/Path.h
ZAPDUtils/Utils/StringHelper.h
ZAPDUtils/ZAPDUtils.vcxproj
Diffstat (limited to 'ZAPD/GameConfig.cpp')
| -rw-r--r-- | ZAPD/GameConfig.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp index 9a2e889..6068280 100644 --- a/ZAPD/GameConfig.cpp +++ b/ZAPD/GameConfig.cpp @@ -125,6 +125,7 @@ void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element) { bgScreenWidth = element.IntAttribute("ScreenWidth", 320); bgScreenHeight = element.IntAttribute("ScreenHeight", 240); + useScreenWidthHeightConstants = element.BoolAttribute("UseScreenWidthHeightConstants", true); } void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element) @@ -164,6 +165,83 @@ 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 enum 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") + enumData.cutsceneCmd[itemIndex] = itemID; + + else if (enumKey == "miscType") + enumData.miscType[itemIndex] = itemID; + + else if (enumKey == "textType") + enumData.textType[itemIndex] = itemID; + + else if (enumKey == "fadeOutSeqPlayer") + enumData.fadeOutSeqPlayer[itemIndex] = itemID; + + else if (enumKey == "transitionType") + enumData.transitionType[itemIndex] = itemID; + + else if (enumKey == "destination") + enumData.destination[itemIndex] = itemID; + + else if (enumKey == "naviQuestHintType") + enumData.naviQuestHintType[itemIndex] = itemID; + + // MM + else if (enumKey == "modifySeqType") + enumData.modifySeqType[itemIndex] = itemID; + + else if (enumKey == "chooseCreditsSceneType") + enumData.chooseCreditsSceneType[itemIndex] = itemID; + + else if (enumKey == "destinationType") + enumData.destinationType[itemIndex] = itemID; + + else if (enumKey == "motionBlurType") + enumData.motionBlurType[itemIndex] = itemID; + + else if (enumKey == "transitionGeneralType") + enumData.transitionGeneralType[itemIndex] = itemID; + + else if (enumKey == "rumbleType") + enumData.rumbleType[itemIndex] = itemID; + + else if (enumKey == "spawnFlag") + enumData.spawnFlag[itemIndex] = itemID; + + else if (enumKey == "endSfx") + enumData.endSfx[itemIndex] = itemID; + } + } +} + void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath) { static const std::unordered_map<std::string, ConfigFunc> ConfigFuncDictionary = { @@ -174,6 +252,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}, }; |
