From 9601f2699c142bb8273d33763ef4d84e8a7d650f Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Tue, 9 Jan 2024 20:17:20 -0500 Subject: [PATCH] Mm spline fixes (#311) * Add enum file * Last fix --- ZAPD/GameConfig.cpp | 6 ++++++ ZAPD/GameConfig.h | 2 ++ ZAPD/OtherStructs/CutsceneMM_Commands.cpp | 16 ++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp index cf6cdcc7..2140464e 100644 --- a/ZAPD/GameConfig.cpp +++ b/ZAPD/GameConfig.cpp @@ -247,6 +247,12 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element) else if (enumKey == "endSfx") enumData.endSfx[itemIndex] = itemID; + + else if (enumKey == "csSplineInterpType") + enumData.interpType[itemIndex] = itemID; + + else if (enumKey == "csSplineRelTo") + enumData.relTo[itemIndex] = itemID; } } } diff --git a/ZAPD/GameConfig.h b/ZAPD/GameConfig.h index 838d2da6..4f3b91f8 100644 --- a/ZAPD/GameConfig.h +++ b/ZAPD/GameConfig.h @@ -48,6 +48,8 @@ class EnumData std::map rumbleType; std::map spawnFlag; std::map endSfx; + std::map interpType; + std::map relTo; }; class ZFile; diff --git a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp index 004213dc..b47bc40e 100644 --- a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp @@ -137,14 +137,14 @@ CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint(c posY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); posZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8); relTo = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10); - printf("%s\n", GetBodySourceCode().c_str()); - } -/*#define CS_CAM_POINT(interpType, weight, duration, posX, posY, posZ, relativeTo) \ - { CMD_BBH(interpType, weight, duration) }, { CMD_HH(posX, posY) }, { CMD_HH(posZ, relativeTo) }*/ + std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const { - return StringHelper::Sprintf("CS_CAM_POINT(0x%02X, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X)", interpType, weight, duration, posX, posY, posZ, relTo); + const auto interpTypeMap = &Globals::Instance->cfg.enumData.interpType; + const auto relToMap = &Globals::Instance->cfg.enumData.relTo; + + return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)", interpTypeMap->at(interpType).c_str(), weight, duration, posX, posY, posZ, relToMap->at(relTo).c_str()); } size_t CutsceneSubCommandEntry_SplineCamPoint::GetRawSize() const @@ -162,9 +162,6 @@ CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); } -/*#define CS_CAM_MISC(unused0, roll, fov, unused1) \ - { CMD_HH(unused0, roll) }, { CMD_HH(fov, unused1) }*/ - std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const { return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov, unused1); @@ -207,7 +204,7 @@ CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter(const firstHalfWord, secondHalfWord)); } } -/*#define CS_CAM_END() */ + std::string CutsceneSubCommandEntry_SplineFooter::GetBodySourceCode() const { return "CS_CAM_END()"; @@ -276,7 +273,6 @@ size_t CutsceneMMCommand_Spline::GetCommandSize() const return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4; } - /**** TRANSITION GENERAL ****/ CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral(