diff options
| author | Yanis42 <35189056+Yanis42@users.noreply.github.com> | 2023-10-08 21:27:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-08 15:27:57 -0400 |
| commit | 338e35f89afc905399ad90c952d154ae7b20bf75 (patch) | |
| tree | 46bdbf3fc8f41b42454e3f68c38f281824b552f9 /ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp | |
| parent | c7dd81e67783a93e728e5662dfe0c8732d79ce59 (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/ZRoom/Commands/SetCutsceneEntryList.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp b/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp new file mode 100644 index 0000000..e747d91 --- /dev/null +++ b/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp @@ -0,0 +1,103 @@ +#include "SetCutsceneEntryList.h" + +#include "Globals.h" +#include "Utils/BitConverter.h" +#include "Utils/StringHelper.h" +#include "ZFile.h" +#include "ZRoom/ZRoom.h" + +SetActorCutsceneList::SetActorCutsceneList(ZFile* nParent) : ZRoomCommand(nParent) +{ +} + +void SetActorCutsceneList::ParseRawData() +{ + ZRoomCommand::ParseRawData(); + int numCutscenes = cmdArg1; + offset_t currentPtr = segmentOffset; + + cutscenes.reserve(numCutscenes); + for (int32_t i = 0; i < numCutscenes; i++) + { + CutsceneEntry entry(parent->GetRawData(), currentPtr); + cutscenes.push_back(entry); + + currentPtr += 16; + } +} + +void SetActorCutsceneList::DeclareReferences(const std::string& prefix) +{ + if (cutscenes.size() > 0) + { + std::string declaration; + + for (size_t i = 0; i < cutscenes.size(); i++) + { + const auto& entry = cutscenes.at(i); + declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); + + if (i + 1 < cutscenes.size()) + { + declaration += "\n"; + } + } + + std::string typeName = cutscenes.at(0).GetSourceTypeName(); + + parent->AddDeclarationArray( + segmentOffset, GetDeclarationAlignment(), cutscenes.size() * 16, typeName, + StringHelper::Sprintf("%s%sList_%06X", prefix.c_str(), typeName.c_str(), segmentOffset), + cutscenes.size(), declaration); + } +} + +std::string SetActorCutsceneList::GetBodySourceCode() const +{ + std::string listName; + Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName); + return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_LIST(%i, %s)", cutscenes.size(), + listName.c_str()); +} + +std::string SetActorCutsceneList::GetCommandCName() const +{ + return "SCmdCutsceneActorList"; +} + +RoomCommand SetActorCutsceneList::GetRoomCommand() const +{ + return RoomCommand::SetActorCutsceneList; +} + +CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex) + : priority(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)), + length(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)), + csCamId(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), + scriptIndex(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)), + additionalCsId(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)), + endSfx(rawData[rawDataIndex + 0xA]), customValue(rawData[rawDataIndex + 0xB]), + hudVisibility(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)), + endCam(rawData[rawDataIndex + 0xE]), letterboxSize(rawData[rawDataIndex + 0xF]) +{ +} + +std::string CutsceneEntry::GetBodySourceCode() const +{ + CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData; + + if (cutsceneData->endSfx.find(endSfx) != cutsceneData->endSfx.end()) + return StringHelper::Sprintf("%i, %i, %i, %i, %i, %s, %i, %i, %i, %i", priority, length, + csCamId, scriptIndex, additionalCsId, + cutsceneData->endSfx[endSfx].c_str(), customValue, + hudVisibility, endCam, letterboxSize); + else + return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length, + csCamId, scriptIndex, additionalCsId, endSfx, customValue, + hudVisibility, endCam, letterboxSize); +} + +std::string CutsceneEntry::GetSourceTypeName() const +{ + return "CutsceneEntry"; +} |
