diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index 7255f43aa9..9010e72f76 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = 094e797349c86d0baef4a624962f4287aefdfef2 - parent = 503f6d86d5fca5bd234640ef9de597d413cb91f5 + commit = 2b6f459b9523603168b6869cf03057a0d68d5f89 + parent = 2ab90bc51788c6baac0a94c3acb256be5f39ca12 method = merge cmdver = 0.4.6 diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp index a6e3bdba2f..7990a60863 100644 --- a/tools/ZAPD/ZAPD/GameConfig.cpp +++ b/tools/ZAPD/ZAPD/GameConfig.cpp @@ -214,6 +214,15 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element) else if (enumKey == "naviQuestHintType") enumData.naviQuestHintType[itemIndex] = itemID; + else if (enumKey == "ocarinaSongActionId") + enumData.ocarinaSongActionId[itemIndex] = itemID; + + else if (enumKey == "seqId") + enumData.seqId[itemIndex] = itemID; + + else if (enumKey == "playerCueId") + enumData.playerCueId[itemIndex] = itemID; + // MM else if (enumKey == "modifySeqType") enumData.modifySeqType[itemIndex] = itemID; diff --git a/tools/ZAPD/ZAPD/GameConfig.h b/tools/ZAPD/ZAPD/GameConfig.h index 0eb3f02029..838d2da6d0 100644 --- a/tools/ZAPD/ZAPD/GameConfig.h +++ b/tools/ZAPD/ZAPD/GameConfig.h @@ -31,10 +31,13 @@ public: std::map fadeOutSeqPlayer; std::map transitionType; std::map naviQuestHintType; + std::map ocarinaSongActionId; + std::map seqId; // OoT std::map textType; std::map destination; + std::map playerCueId; // MM std::map modifySeqType; diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp index 85fce2215d..f18e313085 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp @@ -14,13 +14,13 @@ const std::unordered_map csComm {CutsceneMM_CommandType::CS_CMD_TRANSITION, {"CS_TRANSITION", "(%s, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_MOTION_BLUR, {"CS_MOTION_BLUR", "(%s, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_GIVE_TATL, {"CS_GIVE_TATL", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_START_SEQ, {"CS_START_SEQ", "(0x%04X, %i, %i)"}}, + {CutsceneMM_CommandType::CS_CMD_START_SEQ, {"CS_START_SEQ", "(%s, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_2, {"CS_SFX_REVERB_INDEX_2", "(0x%04X, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_1, {"CS_SFX_REVERB_INDEX_1", "(0x%04X, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ, {"CS_MODIFY_SEQ", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_STOP_SEQ, {"CS_STOP_SEQ", "(0x%04X, %i, %i, %i)"}}, + {CutsceneMM_CommandType::CS_CMD_STOP_SEQ, {"CS_STOP_SEQ", "(%s, %i, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_START_AMBIENCE, {"CS_START_AMBIENCE", "(0x%04X, %i, %i)"}}, {CutsceneMM_CommandType::CS_CMD_FADE_OUT_AMBIENCE, {"CS_FADE_OUT_AMBIENCE", "(0x%04X, %i, %i)"}}, @@ -41,6 +41,7 @@ std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const const auto& element = csCommandsDescMM.find(commandId); std::string entryFmt = "CS_UNK_DATA(0x%02X, %i, %i, %i)"; std::string type = ""; + bool isIndexInSeqId = enumData->seqId.find(base - 1) != enumData->seqId.end(); if (element != csCommandsDescMM.end()) { @@ -72,6 +73,11 @@ std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const enumData->chooseCreditsSceneType.find(base) != enumData->chooseCreditsSceneType.end()) type = enumData->chooseCreditsSceneType[base]; + else if ((commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ || + commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ) && + isIndexInSeqId) + type = enumData->seqId[base - 1]; + else if (commandId == CutsceneMM_CommandType::CS_CMD_GIVE_TATL) type = base ? "true" : "false"; @@ -339,16 +345,18 @@ CutsceneMMSubCommandEntry_Text::CutsceneMMSubCommandEntry_Text(const std::vector std::string CutsceneMMSubCommandEntry_Text::GetBodySourceCode() const { + EnumData* enumData = &Globals::Instance->cfg.enumData; + if (type == 0xFFFF) { return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame); } - if (type == 2) + if (type == 2 && + enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end()) { - // TODO: set the enum name when it will be documented - // (https://github.com/Decompollaborate/mm/blob/3e1c568c084671c17836ced904714ea49d989621/include/z64ocarina.h#L35-L118) - return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%i, %i, %i, 0x%X)", base, startFrame, + return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)", + enumData->ocarinaSongActionId[base].c_str(), startFrame, endFrame, textId1); } @@ -425,23 +433,24 @@ CutsceneMMSubCommandEntry_ActorCue::CutsceneMMSubCommandEntry_ActorCue( std::string CutsceneMMSubCommandEntry_ActorCue::GetBodySourceCode() const { - std::string result; + EnumData* enumData = &Globals::Instance->cfg.enumData; if (static_cast(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE) { - result = "CS_PLAYER_CUE"; + return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " + "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + enumData->playerCueId[base].c_str(), startFrame, endFrame, + rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, + endPosY, endPosZ, normalX, normalY, normalZ); } else { - result = "CS_ACTOR_CUE"; + return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " + "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, + startPosY, startPosZ, endPosX, endPosY, endPosZ, normalX, + normalY, normalZ); } - - result += - StringHelper::Sprintf("(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", - base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY, - startPosZ, endPosX, endPosY, endPosZ, normalX, normalY, normalZ); - return result; } size_t CutsceneMMSubCommandEntry_ActorCue::GetRawSize() const diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp index e38bfb6e5d..8c530f796e 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp +++ b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp @@ -15,9 +15,9 @@ const std::unordered_map csCom {CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING, {"CS_LIGHT_SETTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_START_SEQ, - {"CS_START_SEQ", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, + {"CS_START_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_STOP_SEQ, - {"CS_STOP_SEQ", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, + {"CS_STOP_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ, {"CS_FADE_OUT_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, }; @@ -51,6 +51,7 @@ std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const bool isIndexInMisc = enumData->miscType.find(base) != enumData->miscType.end(); bool isIndexInFade = enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end(); + bool isIndexInSeqId = enumData->seqId.find(base - 1) != enumData->seqId.end(); std::string entryFmt = element->second.cmdMacro; std::string firstArg; entryFmt += element->second.args; @@ -59,14 +60,15 @@ std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const firstArg = enumData->miscType[base]; else if (commandId == CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ && isIndexInFade) firstArg = enumData->fadeOutSeqPlayer[base]; + else if (commandId == CutsceneOoT_CommandType::CS_CMD_START_SEQ && isIndexInSeqId) + firstArg = enumData->seqId[base - 1]; + else if (commandId == CutsceneOoT_CommandType::CS_CMD_STOP_SEQ && isIndexInSeqId) + firstArg = enumData->seqId[base - 1]; else { - bool baseOne = (commandId == CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING || - commandId == CutsceneOoT_CommandType::CS_CMD_START_SEQ || - commandId == CutsceneOoT_CommandType::CS_CMD_STOP_SEQ); - return StringHelper::Sprintf(entryFmt.c_str(), baseOne ? base - 1 : base, startFrame, - endFrame, pad, unused1, unused2, unused3, unused4, unused5, - unused6, unused7, unused8, unused9, unused10); + return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad, + unused1, unused2, unused3, unused4, unused5, unused6, + unused7, unused8, unused9, unused10); } return StringHelper::Sprintf(entryFmt.c_str(), firstArg.c_str(), startFrame, endFrame, pad, unused1, unused2, unused3, unused4, unused5, unused6, unused7, @@ -270,9 +272,11 @@ std::string CutsceneOoTSubCommandEntry_Text::GetBodySourceCode() const { return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame); } - if (type == 2) + if (type == 2 && + enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end()) { - return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%i, %i, %i, 0x%X)", base, startFrame, + return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)", + enumData->ocarinaSongActionId[base].c_str(), startFrame, endFrame, textId1); } @@ -333,24 +337,25 @@ CutsceneOoTSubCommandEntry_ActorCue::CutsceneOoTSubCommandEntry_ActorCue( std::string CutsceneOoTSubCommandEntry_ActorCue::GetBodySourceCode() const { - std::string result; + EnumData* enumData = &Globals::Instance->cfg.enumData; if (static_cast(commandID) == CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE) { - result = "CS_PLAYER_CUE"; + return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " + "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + enumData->playerCueId[base].c_str(), startFrame, endFrame, + rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, + endPosY, endPosZ, normalX, normalY, normalZ); } else { - result = "CS_ACTOR_CUE"; + return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " + "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, + startPosY, startPosZ, endPosX, endPosY, endPosZ, normalX, + normalY, normalZ); } - - result += - StringHelper::Sprintf("(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", - base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY, - startPosZ, endPosX, endPosY, endPosZ, normalX, normalY, normalZ); - return result; } size_t CutsceneOoTSubCommandEntry_ActorCue::GetRawSize() const diff --git a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h index 5181bc5d85..f338ebeddc 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h +++ b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h @@ -8,9 +8,9 @@ enum class ZLimbSkinType { - SkinType_Null, // SkinLimb segment = NULL - SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData* - SkinType_Normal = 11, // SkinLimb segment = Gfx* + SkinType_Null, // SkinLimb segment = NULL + SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData* + SkinType_Normal = 11, // SkinLimb segment = Gfx* }; class SkinVertex : public ZResource @@ -75,11 +75,11 @@ public: size_t GetRawDataSize() const override; protected: - uint16_t vtxCount; // Number of vertices in this modif entry - uint16_t transformCount; // Length of limbTransformations - uint16_t unk_4; // 0 or 1, used as an index for limbTransformations - segptr_t skinVertices; // SkinVertex* - segptr_t limbTransformations; // SkinTransformation* + uint16_t vtxCount; // Number of vertices in this modif entry + uint16_t transformCount; // Length of limbTransformations + uint16_t unk_4; // 0 or 1, used as an index for limbTransformations + segptr_t skinVertices; // SkinVertex* + segptr_t limbTransformations; // SkinTransformation* std::vector skinVertices_arr; std::vector limbTransformations_arr; @@ -102,9 +102,9 @@ public: protected: uint16_t totalVtxCount; - uint16_t limbModifCount; // Length of limbModifications - segptr_t limbModifications; // SkinLimbModif* - segptr_t dlist; // Gfx* + uint16_t limbModifCount; // Length of limbModifications + segptr_t limbModifications; // SkinLimbModif* + segptr_t dlist; // Gfx* std::vector limbModifications_arr; // ZDisplayList* unk_8_dlist = nullptr; diff --git a/tools/ZAPDConfigs/MqDbg/EnumData.xml b/tools/ZAPDConfigs/MqDbg/EnumData.xml index 53e5f9aeac..4b86308b63 100644 --- a/tools/ZAPDConfigs/MqDbg/EnumData.xml +++ b/tools/ZAPDConfigs/MqDbg/EnumData.xml @@ -1,5 +1,25 @@ + + @@ -131,6 +151,7 @@ + @@ -169,6 +190,7 @@ + @@ -176,10 +198,12 @@ + + @@ -195,6 +219,7 @@ + @@ -317,11 +342,13 @@ + + @@ -401,16 +428,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -