diff options
| author | Yanis42 <35189056+Yanis42@users.noreply.github.com> | 2024-01-07 17:13:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-07 11:13:34 -0500 |
| commit | 2b6f459b9523603168b6869cf03057a0d68d5f89 (patch) | |
| tree | 8031a4ed679efb00ae54031a174b99fed9e54c86 | |
| parent | ab16e164220edda4de9d5146d6a81d94bbf37383 (diff) | |
Use Enum names for Ocarina Actions and Sequence IDs (#307)
* oot
* mm prep (and small oot fix)
* format
* minor mm change
| -rw-r--r-- | ZAPD/GameConfig.cpp | 6 | ||||
| -rw-r--r-- | ZAPD/GameConfig.h | 2 | ||||
| -rw-r--r-- | ZAPD/OtherStructs/CutsceneMM_Commands.cpp | 20 | ||||
| -rw-r--r-- | ZAPD/OtherStructs/CutsceneOoT_Commands.cpp | 24 | ||||
| -rw-r--r-- | ZAPD/OtherStructs/SkinLimbStructs.h | 22 |
5 files changed, 47 insertions, 27 deletions
diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp index 6c7dbd7..7990a60 100644 --- a/ZAPD/GameConfig.cpp +++ b/ZAPD/GameConfig.cpp @@ -214,6 +214,12 @@ 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; diff --git a/ZAPD/GameConfig.h b/ZAPD/GameConfig.h index 68e0d51..838d2da 100644 --- a/ZAPD/GameConfig.h +++ b/ZAPD/GameConfig.h @@ -31,6 +31,8 @@ public: std::map<uint16_t, std::string> fadeOutSeqPlayer; std::map<uint16_t, std::string> transitionType; std::map<uint16_t, std::string> naviQuestHintType; + std::map<uint16_t, std::string> ocarinaSongActionId; + std::map<uint16_t, std::string> seqId; // OoT std::map<uint16_t, std::string> textType; diff --git a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp index 9e230f4..f18e313 100644 --- a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp @@ -14,13 +14,13 @@ const std::unordered_map<CutsceneMM_CommandType, CsCommandListDescriptor> 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); } diff --git a/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp b/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp index e973a9b..8c530f7 100644 --- a/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp +++ b/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp @@ -15,9 +15,9 @@ const std::unordered_map<CutsceneOoT_CommandType, CsCommandListDescriptor> 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); } diff --git a/ZAPD/OtherStructs/SkinLimbStructs.h b/ZAPD/OtherStructs/SkinLimbStructs.h index 5181bc5..f338ebe 100644 --- a/ZAPD/OtherStructs/SkinLimbStructs.h +++ b/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<SkinVertex> skinVertices_arr; std::vector<SkinTransformation> 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<SkinLimbModif> limbModifications_arr; // ZDisplayList* unk_8_dlist = nullptr; |
