mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-16 04:44:19 -04:00
01a6dea813
* git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e02e151c" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e02e151c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "86b1975e" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "86b1975e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "eb25be94" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "eb25be94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull (merge) tools/z64compress --force subrepo: subdir: "tools/z64compress" merged: "98ef0ac2" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "98ef0ac2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "45cb0d6b" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "45cb0d6b" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "48e675ff" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "48e675ff" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "3c00dcb3" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3c00dcb3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "47c94c99" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "47c94c99" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Declare required textures * Name texture, add decomp.me permuter settings * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "913810fc" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "913810fc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "97197f2a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "97197f2a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "623d779f" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "623d779f" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "55bba23a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "55bba23a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "a20bac94" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "a20bac94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
111 lines
3.0 KiB
C++
111 lines
3.0 KiB
C++
#include "SetCutscenes.h"
|
|
|
|
#include "Globals.h"
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
#include "ZFile.h"
|
|
#include "ZRoom/ZRoom.h"
|
|
|
|
SetCutscenes::SetCutscenes(ZFile* nParent) : ZRoomCommand(nParent)
|
|
{
|
|
}
|
|
|
|
SetCutscenes::~SetCutscenes()
|
|
{
|
|
for (ZCutsceneBase* cutscene : cutscenes)
|
|
delete cutscene;
|
|
}
|
|
|
|
void SetCutscenes::ParseRawData()
|
|
{
|
|
ZRoomCommand::ParseRawData();
|
|
std::string output = "";
|
|
|
|
numCutscenes = cmdArg1;
|
|
if (Globals::Instance->game == ZGame::OOT_RETAIL || Globals::Instance->game == ZGame::OOT_SW97)
|
|
{
|
|
ZCutscene* cutscene = new ZCutscene(parent);
|
|
cutscene->ExtractFromFile(segmentOffset);
|
|
|
|
auto decl = parent->GetDeclaration(segmentOffset);
|
|
if (decl == nullptr)
|
|
{
|
|
cutscene->DeclareVar(zRoom->GetName().c_str(), "");
|
|
}
|
|
|
|
cutscenes.push_back(cutscene);
|
|
}
|
|
else
|
|
{
|
|
int32_t currentPtr = segmentOffset;
|
|
std::string declaration = "";
|
|
|
|
for (uint8_t i = 0; i < numCutscenes; i++)
|
|
{
|
|
CutsceneEntry entry(parent->GetRawData(), currentPtr);
|
|
cutsceneEntries.push_back(entry);
|
|
currentPtr += 8;
|
|
|
|
declaration += StringHelper::Sprintf(
|
|
" { %sCutsceneData0x%06X, 0x%04X, 0x%02X, 0x%02X },", zRoom->GetName().c_str(),
|
|
entry.segmentOffset, entry.exit, entry.entrance, entry.flag);
|
|
|
|
if (i < numCutscenes - 1)
|
|
declaration += "\n";
|
|
|
|
ZCutsceneMM* cutscene = new ZCutsceneMM(parent);
|
|
cutscene->ExtractFromFile(entry.segmentOffset);
|
|
cutscenes.push_back(cutscene);
|
|
}
|
|
|
|
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
|
cutsceneEntries.size() * 8, "CutsceneEntry",
|
|
StringHelper::Sprintf("%sCutsceneEntryList_%06X",
|
|
zRoom->GetName().c_str(), segmentOffset),
|
|
cutsceneEntries.size(), declaration);
|
|
}
|
|
|
|
for (ZCutsceneBase* cutscene : cutscenes)
|
|
{
|
|
if (cutscene->getSegmentOffset() != 0)
|
|
{
|
|
Declaration* decl = parent->GetDeclaration(cutscene->getSegmentOffset());
|
|
if (decl == nullptr)
|
|
{
|
|
cutscene->GetSourceOutputCode(zRoom->GetName());
|
|
}
|
|
else if (decl->text == "")
|
|
{
|
|
decl->text = cutscene->GetBodySourceCode();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
std::string SetCutscenes::GetBodySourceCode() const
|
|
{
|
|
std::string listName = parent->GetDeclarationPtrName(cmdArg2);
|
|
|
|
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
|
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_LIST(%i, %s)", numCutscenes,
|
|
listName.c_str());
|
|
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_DATA(%s)", listName.c_str());
|
|
}
|
|
|
|
std::string SetCutscenes::GetCommandCName() const
|
|
{
|
|
return "SCmdCutsceneData";
|
|
}
|
|
|
|
RoomCommand SetCutscenes::GetRoomCommand() const
|
|
{
|
|
return RoomCommand::SetCutscenes;
|
|
}
|
|
|
|
CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
|
: segmentOffset(GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 0))),
|
|
exit(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), entrance(rawData[rawDataIndex + 6]),
|
|
flag(rawData[rawDataIndex + 7])
|
|
{
|
|
}
|