Plugins agregados
This commit is contained in:
614
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Normal file
614
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Normal file
@@ -0,0 +1,614 @@
|
||||
#include "CutsceneMM_Commands.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "WarningHandler.h"
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
// Specific for command lists where each entry has size 8 bytes
|
||||
const std::unordered_map<CutsceneMM_CommandType, CsCommandListDescriptor> csCommandsDescMM = {
|
||||
{CutsceneMM_CommandType::CS_CMD_MISC, {"CS_MISC", "(%s, %i, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING, {"CS_LIGHT_SETTING", "(0x%02X, %i, %i)"}},
|
||||
{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", "(%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", "(%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)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_DESTINATION, {"CS_DESTINATION", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
{"CS_CHOOSE_CREDITS_SCENES", "(%s, %i, %i)"}},
|
||||
};
|
||||
|
||||
CutsceneMMSubCommandEntry_GenericCmd::CutsceneMMSubCommandEntry_GenericCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneMM_CommandType cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
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())
|
||||
{
|
||||
entryFmt = element->second.cmdMacro;
|
||||
entryFmt += element->second.args;
|
||||
}
|
||||
|
||||
if (commandId == CutsceneMM_CommandType::CS_CMD_MISC &&
|
||||
enumData->miscType.find(base) != enumData->miscType.end())
|
||||
type = enumData->miscType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_TRANSITION &&
|
||||
enumData->transitionType.find(base) != enumData->transitionType.end())
|
||||
type = enumData->transitionType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_MOTION_BLUR &&
|
||||
enumData->motionBlurType.find(base) != enumData->motionBlurType.end())
|
||||
type = enumData->motionBlurType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ &&
|
||||
enumData->modifySeqType.find(base) != enumData->modifySeqType.end())
|
||||
type = enumData->modifySeqType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_DESTINATION &&
|
||||
enumData->destinationType.find(base) != enumData->destinationType.end())
|
||||
type = enumData->destinationType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES &&
|
||||
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";
|
||||
|
||||
if (type != "")
|
||||
return StringHelper::Sprintf("%s", entryFmt.c_str(), type.c_str(), startFrame, endFrame,
|
||||
pad);
|
||||
|
||||
if (commandId == CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING ||
|
||||
commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ ||
|
||||
commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ)
|
||||
{
|
||||
return StringHelper::Sprintf("%s", entryFmt.c_str(), base - 1, startFrame, endFrame, pad);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("%s", entryFmt.c_str(), base, startFrame, endFrame, pad);
|
||||
}
|
||||
|
||||
CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex,
|
||||
CutsceneMM_CommandType cmdId)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
commandID = static_cast<uint32_t>(cmdId);
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDescMM.find(static_cast<CutsceneMM_CommandType>(commandID));
|
||||
|
||||
if (element != csCommandsDescMM.end())
|
||||
{
|
||||
return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
interpType = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0);
|
||||
weight = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1);
|
||||
duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
posX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
posY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
posZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8);
|
||||
relTo = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const
|
||||
{
|
||||
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
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
roll = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
fov = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov,
|
||||
unused1);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SplineMiscPoint::GetRawSize() const
|
||||
{
|
||||
return 0x08;
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
numEntries = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SplineHeader::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_CAM_SPLINE(0x%04X, 0x%04X, 0x%04X, 0x%04X)", numEntries,
|
||||
unused0, unused1, duration);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SplineHeader::GetRawSize() const
|
||||
{
|
||||
return 0x08;
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
uint16_t firstHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex);
|
||||
uint16_t secondHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
|
||||
if (firstHalfWord != 0xFFFF || secondHalfWord != 4)
|
||||
{
|
||||
HANDLE_ERROR(WarningType::InvalidExtractedData, "Invalid Spline Footer",
|
||||
StringHelper::Sprintf(
|
||||
"Invalid Spline footer. Was expecting 0xFFFF, 0x0004. Got 0x%04X, 0x%04X",
|
||||
firstHalfWord, secondHalfWord));
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SplineFooter::GetBodySourceCode() const
|
||||
{
|
||||
return "CS_CAM_END()";
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SplineFooter::GetRawSize() const
|
||||
{
|
||||
return 0x04;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Spline::CutsceneMMCommand_Spline(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
numHeaders = 0;
|
||||
totalCommands = 0;
|
||||
rawDataIndex += 4;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (BitConverter::ToUInt16BE(rawData, rawDataIndex) == 0xFFFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
numHeaders++;
|
||||
|
||||
auto* header = new CutsceneSubCommandEntry_SplineHeader(rawData, rawDataIndex);
|
||||
rawDataIndex += header->GetRawSize();
|
||||
entries.push_back(header);
|
||||
|
||||
totalCommands += header->numEntries;
|
||||
|
||||
for (uint32_t i = 0; i < header->numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < header->numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < header->numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SplineMiscPoint(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
auto* footer = new CutsceneSubCommandEntry_SplineFooter(rawData, rawDataIndex);
|
||||
entries.push_back(footer);
|
||||
rawDataIndex += footer->GetRawSize();
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Spline::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_CAM_SPLINE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
size_t CutsceneMMCommand_Spline::GetCommandSize() const
|
||||
{
|
||||
// 8 Bytes once for the spline command, 8 Bytes per spline the header, two groups of size 12, 1
|
||||
// group of size 8, 4 bytes for the footer.
|
||||
return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4;
|
||||
}
|
||||
|
||||
/**** TRANSITION GENERAL ****/
|
||||
|
||||
CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unk_06 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
unk_07 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
unk_08 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A);
|
||||
unk_0B = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0B);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_TransitionGeneral::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->transitionGeneralType.find(base) != enumData->transitionGeneralType.end())
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(%s, %i, %i, %i, %i, %i)",
|
||||
enumData->transitionGeneralType[base].c_str(), startFrame,
|
||||
endFrame, unk_06, unk_07, unk_08);
|
||||
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(0x%02X, %i, %i, %i, %i, %i)", base,
|
||||
startFrame, endFrame, unk_06, unk_07, unk_08);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_TransitionGeneral::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_TransitionGeneral::CutsceneMMCommand_TransitionGeneral(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_TransitionGeneral(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_TransitionGeneral::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_FadeOutSeq::CutsceneSubCommandEntry_FadeOutSeq(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unk_08 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8);
|
||||
}
|
||||
|
||||
/**** FADE OUT SEQUENCE ****/
|
||||
|
||||
std::string CutsceneSubCommandEntry_FadeOutSeq::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end())
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%s, %i, %i)",
|
||||
enumData->fadeOutSeqPlayer[base].c_str(), startFrame,
|
||||
endFrame);
|
||||
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%i, %i, %i)", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_FadeOutSeq::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_FadeOutSeq::CutsceneMMCommand_FadeOutSeq(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_FadeOutSeq(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_FadeOutSeq::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** NON IMPLEMENTED ****/
|
||||
|
||||
CutsceneSubCommandEntry_NonImplemented::CutsceneSubCommandEntry_NonImplemented(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CutsceneMMCommand_NonImplemented::CutsceneMMCommand_NonImplemented(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_NonImplemented(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_Rumble::CutsceneMMSubCommandEntry_Rumble(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
intensity = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
decayTimer = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
decayStep = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_Rumble::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->rumbleType.find(base) != enumData->rumbleType.end())
|
||||
return StringHelper::Sprintf("CS_RUMBLE(%s, %i, %i, 0x%02X, 0x%02X, 0x%02X)",
|
||||
enumData->rumbleType[base].c_str(), startFrame, endFrame,
|
||||
intensity, decayTimer, decayStep);
|
||||
|
||||
return StringHelper::Sprintf("CS_RUMBLE(0x%04X, %i, %i, 0x%02X, 0x%02X, 0x%02X)", base,
|
||||
startFrame, endFrame, intensity, decayTimer, decayStep);
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_Rumble::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Rumble::CutsceneMMCommand_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_Rumble(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Rumble::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_Text::CutsceneMMSubCommandEntry_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
}
|
||||
|
||||
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 &&
|
||||
enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)",
|
||||
enumData->ocarinaSongActionId[base].c_str(), startFrame,
|
||||
endFrame, textId1);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
return StringHelper::Sprintf("CS_TEXT_DEFAULT(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 1:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_1(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 3:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_3(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 4:
|
||||
return StringHelper::Sprintf("CS_TEXT_BOSSES_REMAINS(0x%X, %i, %i, 0x%X)", base, startFrame,
|
||||
endFrame, textId1);
|
||||
|
||||
case 5:
|
||||
return StringHelper::Sprintf("CS_TEXT_ALL_NORMAL_MASKS(0x%X, %i, %i, 0x%X)", base,
|
||||
startFrame, endFrame, textId1);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_Text::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Text::CutsceneMMCommand_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_Text(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Text::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_ActorCue::CutsceneMMSubCommandEntry_ActorCue(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC);
|
||||
startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10);
|
||||
startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14);
|
||||
endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18);
|
||||
endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20);
|
||||
normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24);
|
||||
normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28);
|
||||
normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_ActorCue::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneMM_CommandType>(commandID) == CutsceneMM_CommandType::CS_CMD_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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_ActorCue::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_ActorCue::CutsceneMMCommand_ActorCue(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_ActorCue(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_ActorCue::GetCommandMacro() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneMM_CommandType>(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
|
||||
enumData->cutsceneCmd[commandID].c_str(), numEntries);
|
||||
}
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%03X, %i)", commandID, numEntries);
|
||||
}
|
||||
481
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.h
Normal file
481
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.h
Normal file
@@ -0,0 +1,481 @@
|
||||
#pragma once
|
||||
|
||||
#include "Cutscene_Common.h"
|
||||
|
||||
// https://github.com/zeldaret/mm/blob/0c7b90cf97f26483c8b6a98ae099a295f61e72ab/include/z64cutscene.h#L294-530
|
||||
enum class CutsceneMM_CommandType
|
||||
{
|
||||
/* -2 */ CS_CMD_ACTOR_CUE_POST_PROCESS = -2,
|
||||
/* -1 */ CS_CAM_STOP,
|
||||
/* 0x00A */ CS_CMD_TEXT = 10,
|
||||
/* 0x05A */ CS_CMD_CAMERA_SPLINE = 90,
|
||||
/* 0x064 */ CS_CMD_ACTOR_CUE_100 = 100,
|
||||
/* 0x065 */ CS_CMD_ACTOR_CUE_101,
|
||||
/* 0x066 */ CS_CMD_ACTOR_CUE_102,
|
||||
/* 0x067 */ CS_CMD_ACTOR_CUE_103,
|
||||
/* 0x068 */ CS_CMD_ACTOR_CUE_104,
|
||||
/* 0x069 */ CS_CMD_ACTOR_CUE_105,
|
||||
/* 0x06A */ CS_CMD_ACTOR_CUE_106,
|
||||
/* 0x06B */ CS_CMD_ACTOR_CUE_107,
|
||||
/* 0x06C */ CS_CMD_ACTOR_CUE_108,
|
||||
/* 0x06D */ CS_CMD_ACTOR_CUE_109,
|
||||
/* 0x06E */ CS_CMD_ACTOR_CUE_110,
|
||||
/* 0x06F */ CS_CMD_ACTOR_CUE_111,
|
||||
/* 0x070 */ CS_CMD_ACTOR_CUE_112,
|
||||
/* 0x071 */ CS_CMD_ACTOR_CUE_113,
|
||||
/* 0x072 */ CS_CMD_ACTOR_CUE_114,
|
||||
/* 0x073 */ CS_CMD_ACTOR_CUE_115,
|
||||
/* 0x074 */ CS_CMD_ACTOR_CUE_116,
|
||||
/* 0x075 */ CS_CMD_ACTOR_CUE_117,
|
||||
/* 0x076 */ CS_CMD_ACTOR_CUE_118,
|
||||
/* 0x077 */ CS_CMD_ACTOR_CUE_119,
|
||||
/* 0x078 */ CS_CMD_ACTOR_CUE_120,
|
||||
/* 0x079 */ CS_CMD_ACTOR_CUE_121,
|
||||
/* 0x07A */ CS_CMD_ACTOR_CUE_122,
|
||||
/* 0x07B */ CS_CMD_ACTOR_CUE_123,
|
||||
/* 0x07C */ CS_CMD_ACTOR_CUE_124,
|
||||
/* 0x07D */ CS_CMD_ACTOR_CUE_125,
|
||||
/* 0x07E */ CS_CMD_ACTOR_CUE_126,
|
||||
/* 0x07F */ CS_CMD_ACTOR_CUE_127,
|
||||
/* 0x080 */ CS_CMD_ACTOR_CUE_128,
|
||||
/* 0x081 */ CS_CMD_ACTOR_CUE_129,
|
||||
/* 0x082 */ CS_CMD_ACTOR_CUE_130,
|
||||
/* 0x083 */ CS_CMD_ACTOR_CUE_131,
|
||||
/* 0x084 */ CS_CMD_ACTOR_CUE_132,
|
||||
/* 0x085 */ CS_CMD_ACTOR_CUE_133,
|
||||
/* 0x086 */ CS_CMD_ACTOR_CUE_134,
|
||||
/* 0x087 */ CS_CMD_ACTOR_CUE_135,
|
||||
/* 0x088 */ CS_CMD_ACTOR_CUE_136,
|
||||
/* 0x089 */ CS_CMD_ACTOR_CUE_137,
|
||||
/* 0x08A */ CS_CMD_ACTOR_CUE_138,
|
||||
/* 0x08B */ CS_CMD_ACTOR_CUE_139,
|
||||
/* 0x08C */ CS_CMD_ACTOR_CUE_140,
|
||||
/* 0x08D */ CS_CMD_ACTOR_CUE_141,
|
||||
/* 0x08E */ CS_CMD_ACTOR_CUE_142,
|
||||
/* 0x08F */ CS_CMD_ACTOR_CUE_143,
|
||||
/* 0x090 */ CS_CMD_ACTOR_CUE_144,
|
||||
/* 0x091 */ CS_CMD_ACTOR_CUE_145,
|
||||
/* 0x092 */ CS_CMD_ACTOR_CUE_146,
|
||||
/* 0x093 */ CS_CMD_ACTOR_CUE_147,
|
||||
/* 0x094 */ CS_CMD_ACTOR_CUE_148,
|
||||
/* 0x095 */ CS_CMD_ACTOR_CUE_149,
|
||||
/* 0x096 */ CS_CMD_MISC,
|
||||
/* 0x097 */ CS_CMD_LIGHT_SETTING,
|
||||
/* 0x098 */ CS_CMD_TRANSITION,
|
||||
/* 0x099 */ CS_CMD_MOTION_BLUR,
|
||||
/* 0x09A */ CS_CMD_GIVE_TATL,
|
||||
/* 0x09B */ CS_CMD_TRANSITION_GENERAL,
|
||||
/* 0x09C */ CS_CMD_FADE_OUT_SEQ,
|
||||
/* 0x09D */ CS_CMD_TIME,
|
||||
/* 0x0C8 */ CS_CMD_PLAYER_CUE = 200,
|
||||
/* 0x0C9 */ CS_CMD_ACTOR_CUE_201,
|
||||
/* 0x0FA */ CS_CMD_UNK_DATA_FA = 0xFA,
|
||||
/* 0x0FE */ CS_CMD_UNK_DATA_FE = 0xFE,
|
||||
/* 0x0FF */ CS_CMD_UNK_DATA_FF,
|
||||
/* 0x100 */ CS_CMD_UNK_DATA_100,
|
||||
/* 0x101 */ CS_CMD_UNK_DATA_101,
|
||||
/* 0x102 */ CS_CMD_UNK_DATA_102,
|
||||
/* 0x103 */ CS_CMD_UNK_DATA_103,
|
||||
/* 0x104 */ CS_CMD_UNK_DATA_104,
|
||||
/* 0x105 */ CS_CMD_UNK_DATA_105,
|
||||
/* 0x108 */ CS_CMD_UNK_DATA_108 = 0x108,
|
||||
/* 0x109 */ CS_CMD_UNK_DATA_109,
|
||||
/* 0x12C */ CS_CMD_START_SEQ = 300,
|
||||
/* 0x12D */ CS_CMD_STOP_SEQ,
|
||||
/* 0x12E */ CS_CMD_START_AMBIENCE,
|
||||
/* 0x12F */ CS_CMD_FADE_OUT_AMBIENCE,
|
||||
/* 0x130 */ CS_CMD_SFX_REVERB_INDEX_2,
|
||||
/* 0x131 */ CS_CMD_SFX_REVERB_INDEX_1,
|
||||
/* 0x132 */ CS_CMD_MODIFY_SEQ,
|
||||
/* 0x15E */ CS_CMD_DESTINATION = 350,
|
||||
/* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
/* 0x190 */ CS_CMD_RUMBLE = 400,
|
||||
/* 0x1C2 */ CS_CMD_ACTOR_CUE_450 = 450,
|
||||
/* 0x1C3 */ CS_CMD_ACTOR_CUE_451,
|
||||
/* 0x1C4 */ CS_CMD_ACTOR_CUE_452,
|
||||
/* 0x1C5 */ CS_CMD_ACTOR_CUE_453,
|
||||
/* 0x1C6 */ CS_CMD_ACTOR_CUE_454,
|
||||
/* 0x1C7 */ CS_CMD_ACTOR_CUE_455,
|
||||
/* 0x1C8 */ CS_CMD_ACTOR_CUE_456,
|
||||
/* 0x1C9 */ CS_CMD_ACTOR_CUE_457,
|
||||
/* 0x1CA */ CS_CMD_ACTOR_CUE_458,
|
||||
/* 0x1CB */ CS_CMD_ACTOR_CUE_459,
|
||||
/* 0x1CC */ CS_CMD_ACTOR_CUE_460,
|
||||
/* 0x1CD */ CS_CMD_ACTOR_CUE_461,
|
||||
/* 0x1CE */ CS_CMD_ACTOR_CUE_462,
|
||||
/* 0x1CF */ CS_CMD_ACTOR_CUE_463,
|
||||
/* 0x1D0 */ CS_CMD_ACTOR_CUE_464,
|
||||
/* 0x1D1 */ CS_CMD_ACTOR_CUE_465,
|
||||
/* 0x1D2 */ CS_CMD_ACTOR_CUE_466,
|
||||
/* 0x1D3 */ CS_CMD_ACTOR_CUE_467,
|
||||
/* 0x1D4 */ CS_CMD_ACTOR_CUE_468,
|
||||
/* 0x1D5 */ CS_CMD_ACTOR_CUE_469,
|
||||
/* 0x1D6 */ CS_CMD_ACTOR_CUE_470,
|
||||
/* 0x1D7 */ CS_CMD_ACTOR_CUE_471,
|
||||
/* 0x1D8 */ CS_CMD_ACTOR_CUE_472,
|
||||
/* 0x1D9 */ CS_CMD_ACTOR_CUE_473,
|
||||
/* 0x1DA */ CS_CMD_ACTOR_CUE_474,
|
||||
/* 0x1DB */ CS_CMD_ACTOR_CUE_475,
|
||||
/* 0x1DC */ CS_CMD_ACTOR_CUE_476,
|
||||
/* 0x1DD */ CS_CMD_ACTOR_CUE_477,
|
||||
/* 0x1DE */ CS_CMD_ACTOR_CUE_478,
|
||||
/* 0x1DF */ CS_CMD_ACTOR_CUE_479,
|
||||
/* 0x1E0 */ CS_CMD_ACTOR_CUE_480,
|
||||
/* 0x1E1 */ CS_CMD_ACTOR_CUE_481,
|
||||
/* 0x1E2 */ CS_CMD_ACTOR_CUE_482,
|
||||
/* 0x1E3 */ CS_CMD_ACTOR_CUE_483,
|
||||
/* 0x1E4 */ CS_CMD_ACTOR_CUE_484,
|
||||
/* 0x1E5 */ CS_CMD_ACTOR_CUE_485,
|
||||
/* 0x1E6 */ CS_CMD_ACTOR_CUE_486,
|
||||
/* 0x1E7 */ CS_CMD_ACTOR_CUE_487,
|
||||
/* 0x1E8 */ CS_CMD_ACTOR_CUE_488,
|
||||
/* 0x1E9 */ CS_CMD_ACTOR_CUE_489,
|
||||
/* 0x1EA */ CS_CMD_ACTOR_CUE_490,
|
||||
/* 0x1EB */ CS_CMD_ACTOR_CUE_491,
|
||||
/* 0x1EC */ CS_CMD_ACTOR_CUE_492,
|
||||
/* 0x1ED */ CS_CMD_ACTOR_CUE_493,
|
||||
/* 0x1EE */ CS_CMD_ACTOR_CUE_494,
|
||||
/* 0x1EF */ CS_CMD_ACTOR_CUE_495,
|
||||
/* 0x1F0 */ CS_CMD_ACTOR_CUE_496,
|
||||
/* 0x1F1 */ CS_CMD_ACTOR_CUE_497,
|
||||
/* 0x1F2 */ CS_CMD_ACTOR_CUE_498,
|
||||
/* 0x1F3 */ CS_CMD_ACTOR_CUE_499,
|
||||
/* 0x1F4 */ CS_CMD_ACTOR_CUE_500,
|
||||
/* 0x1F5 */ CS_CMD_ACTOR_CUE_501,
|
||||
/* 0x1F6 */ CS_CMD_ACTOR_CUE_502,
|
||||
/* 0x1F7 */ CS_CMD_ACTOR_CUE_503,
|
||||
/* 0x1F8 */ CS_CMD_ACTOR_CUE_504,
|
||||
/* 0x1F9 */ CS_CMD_ACTOR_CUE_SOTCS,
|
||||
/* 0x1FA */ CS_CMD_ACTOR_CUE_506,
|
||||
/* 0x1FB */ CS_CMD_ACTOR_CUE_507,
|
||||
/* 0x1FC */ CS_CMD_ACTOR_CUE_508,
|
||||
/* 0x1FD */ CS_CMD_ACTOR_CUE_509,
|
||||
/* 0x1FE */ CS_CMD_ACTOR_CUE_510,
|
||||
/* 0x1FF */ CS_CMD_ACTOR_CUE_511,
|
||||
/* 0x200 */ CS_CMD_ACTOR_CUE_512,
|
||||
/* 0x201 */ CS_CMD_ACTOR_CUE_513,
|
||||
/* 0x202 */ CS_CMD_ACTOR_CUE_514,
|
||||
/* 0x203 */ CS_CMD_ACTOR_CUE_515,
|
||||
/* 0x204 */ CS_CMD_ACTOR_CUE_516,
|
||||
/* 0x205 */ CS_CMD_ACTOR_CUE_517,
|
||||
/* 0x206 */ CS_CMD_ACTOR_CUE_518,
|
||||
/* 0x207 */ CS_CMD_ACTOR_CUE_519,
|
||||
/* 0x208 */ CS_CMD_ACTOR_CUE_520,
|
||||
/* 0x209 */ CS_CMD_ACTOR_CUE_521,
|
||||
/* 0x20A */ CS_CMD_ACTOR_CUE_522,
|
||||
/* 0x20B */ CS_CMD_ACTOR_CUE_523,
|
||||
/* 0x20C */ CS_CMD_ACTOR_CUE_524,
|
||||
/* 0x20D */ CS_CMD_ACTOR_CUE_525,
|
||||
/* 0x20E */ CS_CMD_ACTOR_CUE_526,
|
||||
/* 0x20F */ CS_CMD_ACTOR_CUE_527,
|
||||
/* 0x210 */ CS_CMD_ACTOR_CUE_528,
|
||||
/* 0x211 */ CS_CMD_ACTOR_CUE_529,
|
||||
/* 0x212 */ CS_CMD_ACTOR_CUE_530,
|
||||
/* 0x213 */ CS_CMD_ACTOR_CUE_531,
|
||||
/* 0x214 */ CS_CMD_ACTOR_CUE_532,
|
||||
/* 0x215 */ CS_CMD_ACTOR_CUE_533,
|
||||
/* 0x216 */ CS_CMD_ACTOR_CUE_534,
|
||||
/* 0x217 */ CS_CMD_ACTOR_CUE_535,
|
||||
/* 0x218 */ CS_CMD_ACTOR_CUE_536,
|
||||
/* 0x219 */ CS_CMD_ACTOR_CUE_537,
|
||||
/* 0x21A */ CS_CMD_ACTOR_CUE_538,
|
||||
/* 0x21B */ CS_CMD_ACTOR_CUE_539,
|
||||
/* 0x21C */ CS_CMD_ACTOR_CUE_540,
|
||||
/* 0x21D */ CS_CMD_ACTOR_CUE_541,
|
||||
/* 0x21E */ CS_CMD_ACTOR_CUE_542,
|
||||
/* 0x21F */ CS_CMD_ACTOR_CUE_543,
|
||||
/* 0x220 */ CS_CMD_ACTOR_CUE_544,
|
||||
/* 0x221 */ CS_CMD_ACTOR_CUE_545,
|
||||
/* 0x222 */ CS_CMD_ACTOR_CUE_546,
|
||||
/* 0x223 */ CS_CMD_ACTOR_CUE_547,
|
||||
/* 0x224 */ CS_CMD_ACTOR_CUE_548,
|
||||
/* 0x225 */ CS_CMD_ACTOR_CUE_549,
|
||||
/* 0x226 */ CS_CMD_ACTOR_CUE_550,
|
||||
/* 0x227 */ CS_CMD_ACTOR_CUE_551,
|
||||
/* 0x228 */ CS_CMD_ACTOR_CUE_552,
|
||||
/* 0x229 */ CS_CMD_ACTOR_CUE_553,
|
||||
/* 0x22A */ CS_CMD_ACTOR_CUE_554,
|
||||
/* 0x22B */ CS_CMD_ACTOR_CUE_555,
|
||||
/* 0x22C */ CS_CMD_ACTOR_CUE_556,
|
||||
/* 0x22D */ CS_CMD_ACTOR_CUE_557,
|
||||
/* 0x22E */ CS_CMD_ACTOR_CUE_558,
|
||||
/* 0x22F */ CS_CMD_ACTOR_CUE_559,
|
||||
/* 0x230 */ CS_CMD_ACTOR_CUE_560,
|
||||
/* 0x231 */ CS_CMD_ACTOR_CUE_561,
|
||||
/* 0x232 */ CS_CMD_ACTOR_CUE_562,
|
||||
/* 0x233 */ CS_CMD_ACTOR_CUE_563,
|
||||
/* 0x234 */ CS_CMD_ACTOR_CUE_564,
|
||||
/* 0x235 */ CS_CMD_ACTOR_CUE_565,
|
||||
/* 0x236 */ CS_CMD_ACTOR_CUE_566,
|
||||
/* 0x237 */ CS_CMD_ACTOR_CUE_567,
|
||||
/* 0x238 */ CS_CMD_ACTOR_CUE_568,
|
||||
/* 0x239 */ CS_CMD_ACTOR_CUE_569,
|
||||
/* 0x23A */ CS_CMD_ACTOR_CUE_570,
|
||||
/* 0x23B */ CS_CMD_ACTOR_CUE_571,
|
||||
/* 0x23C */ CS_CMD_ACTOR_CUE_572,
|
||||
/* 0x23D */ CS_CMD_ACTOR_CUE_573,
|
||||
/* 0x23E */ CS_CMD_ACTOR_CUE_574,
|
||||
/* 0x23F */ CS_CMD_ACTOR_CUE_575,
|
||||
/* 0x240 */ CS_CMD_ACTOR_CUE_576,
|
||||
/* 0x241 */ CS_CMD_ACTOR_CUE_577,
|
||||
/* 0x242 */ CS_CMD_ACTOR_CUE_578,
|
||||
/* 0x243 */ CS_CMD_ACTOR_CUE_579,
|
||||
/* 0x244 */ CS_CMD_ACTOR_CUE_580,
|
||||
/* 0x245 */ CS_CMD_ACTOR_CUE_581,
|
||||
/* 0x246 */ CS_CMD_ACTOR_CUE_582,
|
||||
/* 0x247 */ CS_CMD_ACTOR_CUE_583,
|
||||
/* 0x248 */ CS_CMD_ACTOR_CUE_584,
|
||||
/* 0x249 */ CS_CMD_ACTOR_CUE_585,
|
||||
/* 0x24A */ CS_CMD_ACTOR_CUE_586,
|
||||
/* 0x24B */ CS_CMD_ACTOR_CUE_587,
|
||||
/* 0x24C */ CS_CMD_ACTOR_CUE_588,
|
||||
/* 0x24D */ CS_CMD_ACTOR_CUE_589,
|
||||
/* 0x24E */ CS_CMD_ACTOR_CUE_590,
|
||||
/* 0x24F */ CS_CMD_ACTOR_CUE_591,
|
||||
/* 0x250 */ CS_CMD_ACTOR_CUE_592,
|
||||
/* 0x251 */ CS_CMD_ACTOR_CUE_593,
|
||||
/* 0x252 */ CS_CMD_ACTOR_CUE_594,
|
||||
/* 0x253 */ CS_CMD_ACTOR_CUE_595,
|
||||
/* 0x254 */ CS_CMD_ACTOR_CUE_596,
|
||||
/* 0x255 */ CS_CMD_ACTOR_CUE_597,
|
||||
/* 0x256 */ CS_CMD_ACTOR_CUE_598,
|
||||
/* 0x257 */ CS_CMD_ACTOR_CUE_599
|
||||
};
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneMM_CommandType commandId;
|
||||
|
||||
CutsceneMMSubCommandEntry_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMM_CommandType cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_GenericCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMM_CommandType cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
// TODO: MM cutscene camera command is implemented as a placeholder until we better understand how
|
||||
// it works
|
||||
|
||||
class CutsceneSubCommandEntry_SplineCamPoint : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t interpType;
|
||||
uint8_t weight;
|
||||
uint16_t duration;
|
||||
|
||||
uint16_t posX;
|
||||
uint16_t posY;
|
||||
|
||||
uint16_t posZ;
|
||||
uint16_t relTo;
|
||||
|
||||
CutsceneSubCommandEntry_SplineCamPoint(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_SplineMiscPoint : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t unused0;
|
||||
uint16_t roll;
|
||||
uint16_t fov;
|
||||
uint16_t unused1;
|
||||
|
||||
CutsceneSubCommandEntry_SplineMiscPoint(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_SplineFooter : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneSubCommandEntry_SplineFooter(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_SplineHeader : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t numEntries;
|
||||
uint16_t unused0;
|
||||
uint16_t unused1;
|
||||
uint16_t duration;
|
||||
CutsceneSubCommandEntry_SplineHeader(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Spline : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint32_t numHeaders;
|
||||
uint32_t totalCommands;
|
||||
CutsceneMMCommand_Spline(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
/**** TRANSITION GENERAL ****/
|
||||
|
||||
class CutsceneSubCommandEntry_TransitionGeneral : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t unk_06;
|
||||
uint8_t unk_07;
|
||||
uint8_t unk_08;
|
||||
uint8_t unk_09;
|
||||
uint8_t unk_0A;
|
||||
uint8_t unk_0B;
|
||||
|
||||
CutsceneSubCommandEntry_TransitionGeneral(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_TransitionGeneral : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_TransitionGeneral(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** FADE OUT SEQUENCE ****/
|
||||
|
||||
class CutsceneSubCommandEntry_FadeOutSeq : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint32_t unk_08;
|
||||
|
||||
CutsceneSubCommandEntry_FadeOutSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_FadeOutSeq : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_FadeOutSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** NON IMPLEMENTED ****/
|
||||
|
||||
class CutsceneSubCommandEntry_NonImplemented : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneSubCommandEntry_NonImplemented(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_NonImplemented : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_NonImplemented(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
};
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_Rumble : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t intensity;
|
||||
uint8_t decayTimer;
|
||||
uint8_t decayStep;
|
||||
|
||||
CutsceneMMSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Rumble : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_Text : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t type;
|
||||
uint16_t textId1;
|
||||
uint16_t textId2;
|
||||
|
||||
CutsceneMMSubCommandEntry_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Text : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_ActorCue : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t rotX, rotY, rotZ;
|
||||
int32_t startPosX, startPosY, startPosZ;
|
||||
int32_t endPosX, endPosY, endPosZ;
|
||||
float normalX, normalY, normalZ;
|
||||
|
||||
CutsceneMMSubCommandEntry_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_ActorCue : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
458
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
458
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
@@ -0,0 +1,458 @@
|
||||
#include "CutsceneOoT_Commands.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <unordered_map>
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
// Specific for command lists where each entry has size 0x30 bytes
|
||||
const std::unordered_map<CutsceneOoT_CommandType, CsCommandListDescriptor> csCommandsDesc = {
|
||||
{CutsceneOoT_CommandType::CS_CMD_MISC,
|
||||
{"CS_MISC", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{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", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_STOP_SEQ,
|
||||
{"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)"}},
|
||||
};
|
||||
|
||||
CutsceneOoTSubCommandEntry_GenericCmd::CutsceneOoTSubCommandEntry_GenericCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneOoT_CommandType cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
word0 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0);
|
||||
word1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4);
|
||||
|
||||
unused1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8);
|
||||
unused2 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC);
|
||||
unused3 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x10);
|
||||
unused4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x14);
|
||||
unused5 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x18);
|
||||
unused6 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
unused7 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x20);
|
||||
unused8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x24);
|
||||
unused9 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x28);
|
||||
unused10 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
const auto& element = csCommandsDesc.find(commandId);
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
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;
|
||||
|
||||
if (commandId == CutsceneOoT_CommandType::CS_CMD_MISC && isIndexInMisc)
|
||||
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
|
||||
{
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad,
|
||||
unused1, unused2, unused3, unused4, unused5, unused6,
|
||||
unused7, unused8, unused9, unused10);
|
||||
}
|
||||
}
|
||||
return StringHelper::Sprintf("CS_UNK_DATA(0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, "
|
||||
"0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X)",
|
||||
word0, word1, unused1, unused2, unused3, unused4, unused5, unused6,
|
||||
unused7, unused8, unused9, unused10);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_GenericCmd::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_GenericCmd::CutsceneOoTCommand_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex,
|
||||
CutsceneOoT_CommandType cmdId)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
commandID = static_cast<uint32_t>(cmdId);
|
||||
entries.reserve(numEntries);
|
||||
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDesc.find(static_cast<CutsceneOoT_CommandType>(commandID));
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
CutsceneOoTCommand_CameraPoint::CutsceneOoTCommand_CameraPoint(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
continueFlag = BitConverter::ToInt8BE(rawData, rawDataIndex + 0);
|
||||
cameraRoll = BitConverter::ToInt8BE(rawData, rawDataIndex + 1);
|
||||
nextPointFrame = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||
viewAngle = BitConverter::ToFloatBE(rawData, rawDataIndex + 4);
|
||||
|
||||
posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
||||
posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||
posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 12);
|
||||
|
||||
unused = BitConverter::ToInt16BE(rawData, rawDataIndex + 14);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_CameraPoint::GetBodySourceCode() const
|
||||
{
|
||||
std::string continueMacro = "CS_CAM_CONTINUE";
|
||||
if (continueFlag != 0)
|
||||
continueMacro = "CS_CAM_STOP";
|
||||
|
||||
return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, %i, %ff, %i, %i, %i, 0x%04X)",
|
||||
continueMacro.c_str(), cameraRoll, nextPointFrame, viewAngle, posX,
|
||||
posY, posZ, unused);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_CameraPoint::GetRawSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_GenericCameraCmd::CutsceneOoTCommand_GenericCameraCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unused = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
|
||||
bool shouldContinue = true;
|
||||
|
||||
uint32_t currentPtr = rawDataIndex + 8;
|
||||
|
||||
while (shouldContinue)
|
||||
{
|
||||
CutsceneOoTCommand_CameraPoint* camPoint =
|
||||
new CutsceneOoTCommand_CameraPoint(rawData, currentPtr);
|
||||
entries.push_back(camPoint);
|
||||
|
||||
if (camPoint->continueFlag == -1)
|
||||
shouldContinue = false;
|
||||
|
||||
currentPtr += camPoint->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_GenericCameraCmd::GetCommandMacro() const
|
||||
{
|
||||
std::string result;
|
||||
const char* listStr;
|
||||
|
||||
if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE)
|
||||
{
|
||||
listStr = "CS_CAM_AT_SPLINE";
|
||||
}
|
||||
else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER)
|
||||
{
|
||||
listStr = "CS_CAM_AT_SPLINE_REL_TO_PLAYER";
|
||||
}
|
||||
else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER)
|
||||
{
|
||||
listStr = "CS_CAM_EYE_SPLINE_REL_TO_PLAYER";
|
||||
}
|
||||
else
|
||||
{
|
||||
listStr = "CS_CAM_EYE_SPLINE";
|
||||
}
|
||||
|
||||
result += StringHelper::Sprintf("%s(%i, %i)", listStr, startFrame, endFrame);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_GenericCameraCmd::GetCommandSize() const
|
||||
{
|
||||
return 0x0C + entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_Rumble::CutsceneOoTSubCommandEntry_Rumble(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
sourceStrength = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
duration = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
decreaseRate = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_Rumble::GetBodySourceCode() const
|
||||
{
|
||||
// Note: the first argument is unused
|
||||
return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER(%i, %i, %i, %i, %i, %i, 0x%02X, 0x%02X)",
|
||||
base, startFrame, endFrame, sourceStrength, duration, decreaseRate,
|
||||
unk_09, unk_0A);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_Rumble::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_Rumble::CutsceneOoTCommand_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_Rumble(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Rumble::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_Text::CutsceneOoTSubCommandEntry_Text(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_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 &&
|
||||
enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)",
|
||||
enumData->ocarinaSongActionId[base].c_str(), startFrame,
|
||||
endFrame, textId1);
|
||||
}
|
||||
|
||||
if (enumData->textType.find(type) != enumData->textType.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %s, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, enumData->textType[type].c_str(), textId1, textId2);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, type, textId1, textId2);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_Text::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_Text::CutsceneOoTCommand_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_Text(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Text::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_ActorCue::CutsceneOoTSubCommandEntry_ActorCue(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC);
|
||||
startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10);
|
||||
startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14);
|
||||
endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18);
|
||||
endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20);
|
||||
normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24);
|
||||
normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28);
|
||||
normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_ActorCue::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
|
||||
CutsceneOoT_CommandType::CS_CMD_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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_ActorCue::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_ActorCue::CutsceneOoTCommand_ActorCue(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_ActorCue(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_ActorCue::GetCommandMacro() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
|
||||
CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", entries.size());
|
||||
}
|
||||
|
||||
if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
|
||||
enumData->cutsceneCmd[commandID].c_str(), entries.size());
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%04X, %i)", commandID, entries.size());
|
||||
}
|
||||
|
||||
/**** DESTINATION ****/
|
||||
|
||||
CutsceneOoTCommand_Destination::CutsceneOoTCommand_Destination(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unknown = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); // endFrame duplicate
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Destination::GenerateSourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->destination.find(base) != enumData->destination.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_DESTINATION(%s, %i, %i),\n",
|
||||
enumData->destination[base].c_str(), startFrame, endFrame);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_DESTINATION(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_Destination::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
/**** TRANSITION ****/
|
||||
|
||||
CutsceneOoTCommand_Transition::CutsceneOoTCommand_Transition(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Transition::GenerateSourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->transitionType.find(base) != enumData->transitionType.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TRANSITION(%s, %i, %i),\n",
|
||||
enumData->transitionType[base].c_str(), startFrame, endFrame);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_TRANSITION(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_Transition::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
314
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.h
Normal file
314
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.h
Normal file
@@ -0,0 +1,314 @@
|
||||
#pragma once
|
||||
|
||||
#include "Cutscene_Common.h"
|
||||
|
||||
// https://github.com/zeldaret/oot/blob/7235af2249843fb68740111b70089bad827a4730/include/z64cutscene.h#L35-L165
|
||||
enum class CutsceneOoT_CommandType
|
||||
{
|
||||
CS_CMD_CAM_EYE_SPLINE = 0x01,
|
||||
CS_CMD_CAM_AT_SPLINE,
|
||||
CS_CMD_MISC,
|
||||
CS_CMD_LIGHT_SETTING,
|
||||
CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER,
|
||||
CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER,
|
||||
CS_CMD_CAM_EYE,
|
||||
CS_CMD_CAM_AT,
|
||||
CS_CMD_RUMBLE_CONTROLLER,
|
||||
CS_CMD_PLAYER_CUE,
|
||||
CS_CMD_UNIMPLEMENTED_B,
|
||||
CS_CMD_UNIMPLEMENTED_D = 0x0D,
|
||||
CS_CMD_ACTOR_CUE_1_0,
|
||||
CS_CMD_ACTOR_CUE_0_0,
|
||||
CS_CMD_ACTOR_CUE_1_1,
|
||||
CS_CMD_ACTOR_CUE_0_1,
|
||||
CS_CMD_ACTOR_CUE_0_2,
|
||||
CS_CMD_TEXT,
|
||||
CS_CMD_UNIMPLEMENTED_15 = 0x15,
|
||||
CS_CMD_UNIMPLEMENTED_16,
|
||||
CS_CMD_ACTOR_CUE_0_3,
|
||||
CS_CMD_ACTOR_CUE_1_2,
|
||||
CS_CMD_ACTOR_CUE_2_0,
|
||||
CS_CMD_UNIMPLEMENTED_1B = 0x1B,
|
||||
CS_CMD_UNIMPLEMENTED_1C,
|
||||
CS_CMD_ACTOR_CUE_3_0,
|
||||
CS_CMD_ACTOR_CUE_4_0,
|
||||
CS_CMD_ACTOR_CUE_6_0,
|
||||
CS_CMD_UNIMPLEMENTED_20,
|
||||
CS_CMD_UNIMPLEMENTED_21,
|
||||
CS_CMD_ACTOR_CUE_0_4,
|
||||
CS_CMD_ACTOR_CUE_1_3,
|
||||
CS_CMD_ACTOR_CUE_2_1,
|
||||
CS_CMD_ACTOR_CUE_3_1,
|
||||
CS_CMD_ACTOR_CUE_4_1,
|
||||
CS_CMD_ACTOR_CUE_0_5,
|
||||
CS_CMD_ACTOR_CUE_1_4,
|
||||
CS_CMD_ACTOR_CUE_2_2,
|
||||
CS_CMD_ACTOR_CUE_3_2,
|
||||
CS_CMD_ACTOR_CUE_4_2,
|
||||
CS_CMD_ACTOR_CUE_5_0,
|
||||
CS_CMD_TRANSITION,
|
||||
CS_CMD_ACTOR_CUE_0_6,
|
||||
CS_CMD_ACTOR_CUE_4_3,
|
||||
CS_CMD_ACTOR_CUE_1_5,
|
||||
CS_CMD_ACTOR_CUE_7_0,
|
||||
CS_CMD_ACTOR_CUE_2_3,
|
||||
CS_CMD_ACTOR_CUE_3_3,
|
||||
CS_CMD_ACTOR_CUE_6_1,
|
||||
CS_CMD_ACTOR_CUE_3_4,
|
||||
CS_CMD_ACTOR_CUE_4_4,
|
||||
CS_CMD_ACTOR_CUE_5_1,
|
||||
CS_CMD_ACTOR_CUE_6_2 = 0x39,
|
||||
CS_CMD_ACTOR_CUE_6_3,
|
||||
CS_CMD_UNIMPLEMENTED_3B,
|
||||
CS_CMD_ACTOR_CUE_7_1,
|
||||
CS_CMD_UNIMPLEMENTED_3D,
|
||||
CS_CMD_ACTOR_CUE_8_0,
|
||||
CS_CMD_ACTOR_CUE_3_5,
|
||||
CS_CMD_ACTOR_CUE_1_6,
|
||||
CS_CMD_ACTOR_CUE_3_6,
|
||||
CS_CMD_ACTOR_CUE_3_7,
|
||||
CS_CMD_ACTOR_CUE_2_4,
|
||||
CS_CMD_ACTOR_CUE_1_7,
|
||||
CS_CMD_ACTOR_CUE_2_5,
|
||||
CS_CMD_ACTOR_CUE_1_8,
|
||||
CS_CMD_UNIMPLEMENTED_47,
|
||||
CS_CMD_ACTOR_CUE_2_6,
|
||||
CS_CMD_UNIMPLEMENTED_49,
|
||||
CS_CMD_ACTOR_CUE_2_7,
|
||||
CS_CMD_ACTOR_CUE_3_8,
|
||||
CS_CMD_ACTOR_CUE_0_7,
|
||||
CS_CMD_ACTOR_CUE_5_2,
|
||||
CS_CMD_ACTOR_CUE_1_9,
|
||||
CS_CMD_ACTOR_CUE_4_5,
|
||||
CS_CMD_ACTOR_CUE_1_10,
|
||||
CS_CMD_ACTOR_CUE_2_8,
|
||||
CS_CMD_ACTOR_CUE_3_9,
|
||||
CS_CMD_ACTOR_CUE_4_6,
|
||||
CS_CMD_ACTOR_CUE_5_3,
|
||||
CS_CMD_ACTOR_CUE_0_8,
|
||||
CS_CMD_START_SEQ,
|
||||
CS_CMD_STOP_SEQ,
|
||||
CS_CMD_ACTOR_CUE_6_4,
|
||||
CS_CMD_ACTOR_CUE_7_2,
|
||||
CS_CMD_ACTOR_CUE_5_4,
|
||||
CS_CMD_ACTOR_CUE_0_9 = 0x5D,
|
||||
CS_CMD_ACTOR_CUE_1_11,
|
||||
CS_CMD_ACTOR_CUE_0_10 = 0x69,
|
||||
CS_CMD_ACTOR_CUE_2_9,
|
||||
CS_CMD_ACTOR_CUE_0_11,
|
||||
CS_CMD_ACTOR_CUE_3_10,
|
||||
CS_CMD_UNIMPLEMENTED_6D,
|
||||
CS_CMD_ACTOR_CUE_0_12,
|
||||
CS_CMD_ACTOR_CUE_7_3,
|
||||
CS_CMD_UNIMPLEMENTED_70,
|
||||
CS_CMD_UNIMPLEMENTED_71,
|
||||
CS_CMD_ACTOR_CUE_7_4,
|
||||
CS_CMD_ACTOR_CUE_6_5,
|
||||
CS_CMD_ACTOR_CUE_1_12,
|
||||
CS_CMD_ACTOR_CUE_2_10,
|
||||
CS_CMD_ACTOR_CUE_1_13,
|
||||
CS_CMD_ACTOR_CUE_0_13,
|
||||
CS_CMD_ACTOR_CUE_1_14,
|
||||
CS_CMD_ACTOR_CUE_2_11,
|
||||
CS_CMD_ACTOR_CUE_0_14 = 0x7B,
|
||||
CS_CMD_FADE_OUT_SEQ,
|
||||
CS_CMD_ACTOR_CUE_1_15,
|
||||
CS_CMD_ACTOR_CUE_2_12,
|
||||
CS_CMD_ACTOR_CUE_3_11,
|
||||
CS_CMD_ACTOR_CUE_4_7,
|
||||
CS_CMD_ACTOR_CUE_5_5,
|
||||
CS_CMD_ACTOR_CUE_6_6,
|
||||
CS_CMD_ACTOR_CUE_1_16,
|
||||
CS_CMD_ACTOR_CUE_2_13,
|
||||
CS_CMD_ACTOR_CUE_3_12,
|
||||
CS_CMD_ACTOR_CUE_7_5,
|
||||
CS_CMD_ACTOR_CUE_4_8,
|
||||
CS_CMD_ACTOR_CUE_5_6,
|
||||
CS_CMD_ACTOR_CUE_6_7,
|
||||
CS_CMD_ACTOR_CUE_0_15,
|
||||
CS_CMD_ACTOR_CUE_0_16,
|
||||
CS_CMD_TIME,
|
||||
CS_CMD_ACTOR_CUE_1_17,
|
||||
CS_CMD_ACTOR_CUE_7_6,
|
||||
CS_CMD_ACTOR_CUE_9_0,
|
||||
CS_CMD_ACTOR_CUE_0_17,
|
||||
CS_CMD_DESTINATION = 0x03E8,
|
||||
CS_CMD_END = 0xFFFF
|
||||
};
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneOoT_CommandType commandId;
|
||||
|
||||
uint32_t word0 = 0;
|
||||
uint32_t word1 = 0;
|
||||
|
||||
uint32_t unused1 = 0;
|
||||
uint32_t unused2 = 0;
|
||||
uint32_t unused3 = 0;
|
||||
uint32_t unused4 = 0;
|
||||
uint32_t unused5 = 0;
|
||||
uint32_t unused6 = 0;
|
||||
uint32_t unused7 = 0;
|
||||
uint32_t unused8 = 0;
|
||||
uint32_t unused9 = 0;
|
||||
uint32_t unused10 = 0;
|
||||
|
||||
CutsceneOoTSubCommandEntry_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex, CutsceneOoT_CommandType cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_GenericCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneOoT_CommandType cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
class CutsceneOoTCommand_CameraPoint : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
int8_t continueFlag;
|
||||
int8_t cameraRoll;
|
||||
int16_t nextPointFrame;
|
||||
float viewAngle;
|
||||
int16_t posX, posY, posZ;
|
||||
int16_t unused;
|
||||
|
||||
CutsceneOoTCommand_CameraPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_GenericCameraCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unused;
|
||||
|
||||
CutsceneOoTCommand_GenericCameraCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
/**** TRANSITION ****/
|
||||
|
||||
class CutsceneOoTCommand_Transition : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
|
||||
CutsceneOoTCommand_Transition(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_Rumble : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t sourceStrength;
|
||||
uint8_t duration;
|
||||
uint8_t decreaseRate;
|
||||
uint8_t unk_09;
|
||||
uint8_t unk_0A;
|
||||
|
||||
CutsceneOoTSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_Rumble : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_Text : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t type;
|
||||
uint16_t textId1;
|
||||
uint16_t textId2;
|
||||
|
||||
CutsceneOoTSubCommandEntry_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_Text : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_ActorCue : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t rotX, rotY, rotZ;
|
||||
int32_t startPosX, startPosY, startPosZ;
|
||||
int32_t endPosX, endPosY, endPosZ;
|
||||
float normalX, normalY, normalZ;
|
||||
|
||||
CutsceneOoTSubCommandEntry_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_ActorCue : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** DESTINATION ****/
|
||||
|
||||
class CutsceneOoTCommand_Destination : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unknown;
|
||||
|
||||
CutsceneOoTCommand_Destination(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
128
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.cpp
Normal file
128
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
#include "Cutscene_Common.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/* CutsceneSubCommandEntry */
|
||||
|
||||
CutsceneSubCommandEntry::CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
pad = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X), CMD_HH(0x%04X, 0x%04X)", base, startFrame,
|
||||
endFrame, pad);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry::GetRawSize() const
|
||||
{
|
||||
return 0x08;
|
||||
}
|
||||
|
||||
/* CutsceneCommand */
|
||||
|
||||
CutsceneCommand::CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
{
|
||||
numEntries = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0);
|
||||
}
|
||||
|
||||
CutsceneCommand::~CutsceneCommand()
|
||||
{
|
||||
for (auto entry : entries)
|
||||
{
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_W(0x%08X), CMD_W(0x%08X)", commandID, numEntries);
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GenerateSourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
result += GetCommandMacro();
|
||||
result += ",\n";
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
result += " ";
|
||||
result += entry->GetBodySourceCode();
|
||||
result += ",\n";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCommand::GetCommandSize() const
|
||||
{
|
||||
size_t size = 0;
|
||||
if (entries.size() > 0)
|
||||
{
|
||||
size = entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 0x08 * numEntries;
|
||||
}
|
||||
return 0x08 + size;
|
||||
}
|
||||
|
||||
void CutsceneCommand::SetCommandID(uint32_t nCommandID)
|
||||
{
|
||||
commandID = nCommandID;
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
entry->commandID = commandID;
|
||||
}
|
||||
}
|
||||
|
||||
/*** TIME ****/
|
||||
|
||||
CutsceneSubCommandEntry_SetTime::CutsceneSubCommandEntry_SetTime(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
hour = BitConverter::ToUInt8BE(rawData, rawDataIndex + 6);
|
||||
minute = BitConverter::ToUInt8BE(rawData, rawDataIndex + 7);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SetTime::GetBodySourceCode() const
|
||||
{
|
||||
// Note: Both OoT and MM have the first argument unused
|
||||
return StringHelper::Sprintf("CS_TIME(%i, %i, %i, %i, %i)", base, startFrame, endFrame, hour,
|
||||
minute);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SetTime::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneCommand_Time::CutsceneCommand_Time(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SetTime(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_Time::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TIME_LIST(%i)", numEntries);
|
||||
}
|
||||
72
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.h
Normal file
72
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Declaration.h"
|
||||
|
||||
typedef struct CsCommandListDescriptor
|
||||
{
|
||||
const char* cmdMacro;
|
||||
const char* args;
|
||||
} CsCommandListDescriptor;
|
||||
|
||||
class CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t pad;
|
||||
|
||||
uint32_t commandID;
|
||||
|
||||
CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneSubCommandEntry() = default;
|
||||
|
||||
virtual std::string GetBodySourceCode() const;
|
||||
|
||||
virtual size_t GetRawSize() const;
|
||||
};
|
||||
|
||||
class CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint32_t commandID;
|
||||
uint32_t commandIndex;
|
||||
|
||||
uint32_t numEntries;
|
||||
std::vector<CutsceneSubCommandEntry*> entries;
|
||||
|
||||
CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneCommand();
|
||||
|
||||
virtual std::string GetCommandMacro() const;
|
||||
virtual std::string GenerateSourceCode() const;
|
||||
virtual size_t GetCommandSize() const;
|
||||
|
||||
virtual void SetCommandID(uint32_t nCommandID);
|
||||
};
|
||||
|
||||
/**** TIME ****/
|
||||
|
||||
class CutsceneSubCommandEntry_SetTime : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
|
||||
CutsceneSubCommandEntry_SetTime(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_Time : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_Time(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
354
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.cpp
Normal file
354
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.cpp
Normal file
@@ -0,0 +1,354 @@
|
||||
#include "SkinLimbStructs.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "ZDisplayList.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
/* SkinVertex */
|
||||
|
||||
SkinVertex::SkinVertex(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void SkinVertex::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
index = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
s = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
|
||||
t = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
|
||||
normX = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06);
|
||||
normY = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07);
|
||||
normZ = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08);
|
||||
alpha = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
}
|
||||
|
||||
std::string SkinVertex::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", index, s, t, normX, normY,
|
||||
normZ, alpha);
|
||||
}
|
||||
|
||||
std::string SkinVertex::GetSourceTypeName() const
|
||||
{
|
||||
return "SkinVertex";
|
||||
}
|
||||
|
||||
ZResourceType SkinVertex::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t SkinVertex::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* SkinTransformation */
|
||||
|
||||
SkinTransformation::SkinTransformation(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void SkinTransformation::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
limbIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00);
|
||||
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
|
||||
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
|
||||
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x06);
|
||||
scale = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
}
|
||||
|
||||
std::string SkinTransformation::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", limbIndex, x, y, z, scale);
|
||||
}
|
||||
|
||||
std::string SkinTransformation::GetSourceTypeName() const
|
||||
{
|
||||
return "SkinTransformation";
|
||||
}
|
||||
|
||||
ZResourceType SkinTransformation::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t SkinTransformation::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* SkinLimbModif */
|
||||
|
||||
SkinLimbModif::SkinLimbModif(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void SkinLimbModif::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
vtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
transformCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
unk_4 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x04);
|
||||
skinVertices = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
limbTransformations = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C);
|
||||
|
||||
if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
uint32_t unk_8_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
|
||||
|
||||
skinVertices_arr.reserve(vtxCount);
|
||||
for (size_t i = 0; i < vtxCount; i++)
|
||||
{
|
||||
SkinVertex skinVertices_data(parent);
|
||||
skinVertices_data.ExtractFromFile(unk_8_Offset);
|
||||
skinVertices_arr.push_back(skinVertices_data);
|
||||
|
||||
unk_8_Offset += skinVertices_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (limbTransformations != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
|
||||
|
||||
limbTransformations_arr.reserve(transformCount);
|
||||
for (size_t i = 0; i < transformCount; i++)
|
||||
{
|
||||
SkinTransformation limbTransformations_data(parent);
|
||||
limbTransformations_data.ExtractFromFile(unk_C_Offset);
|
||||
limbTransformations_arr.push_back(limbTransformations_data);
|
||||
|
||||
unk_C_Offset += limbTransformations_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SkinLimbModif::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
varPrefix = name;
|
||||
|
||||
if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
const auto& res = skinVertices_arr.at(0);
|
||||
std::string unk_8_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = skinVertices_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = skinVertices_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t skinVertices_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(skinVertices_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(skinVertices_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
|
||||
if (limbTransformations != 0 && GETSEGNUM(limbTransformations) == parent->segment)
|
||||
{
|
||||
const auto& res = limbTransformations_arr.at(0);
|
||||
std::string unk_C_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = limbTransformations_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = limbTransformations_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_C_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_C_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_C_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
}
|
||||
|
||||
std::string SkinLimbModif::GetBodySourceCode() const
|
||||
{
|
||||
std::string skinVertices_Str;
|
||||
std::string unk_C_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(skinVertices, parent, "SkinVertex", skinVertices_Str, parent->workerID);
|
||||
Globals::Instance->GetSegmentedPtrName(limbTransformations, parent, "SkinTransformation",
|
||||
unk_C_Str, parent->workerID);
|
||||
|
||||
std::string entryStr = StringHelper::Sprintf("\n\t\tARRAY_COUNTU(%s), ARRAY_COUNTU(%s),\n",
|
||||
skinVertices_Str.c_str(), unk_C_Str.c_str());
|
||||
entryStr += StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, skinVertices_Str.c_str(),
|
||||
unk_C_Str.c_str());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string SkinLimbModif::GetSourceTypeName() const
|
||||
{
|
||||
return "SkinLimbModif";
|
||||
}
|
||||
|
||||
ZResourceType SkinLimbModif::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t SkinLimbModif::GetRawDataSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
/* SkinAnimatedLimbData */
|
||||
|
||||
SkinAnimatedLimbData::SkinAnimatedLimbData(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void SkinAnimatedLimbData::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
totalVtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
limbModifCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
limbModifications = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
|
||||
dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
|
||||
if (limbModifications != 0 && GETSEGNUM(limbModifications) == parent->segment)
|
||||
{
|
||||
uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
|
||||
|
||||
limbModifications_arr.reserve(limbModifCount);
|
||||
for (size_t i = 0; i < limbModifCount; i++)
|
||||
{
|
||||
SkinLimbModif limbModifications_data(parent);
|
||||
limbModifications_data.ExtractFromFile(limbModifications_Offset);
|
||||
limbModifications_arr.push_back(limbModifications_data);
|
||||
|
||||
limbModifications_Offset += limbModifications_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SkinAnimatedLimbData::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
varPrefix = name;
|
||||
|
||||
ZResource::DeclareReferences(varPrefix);
|
||||
|
||||
if (limbModifications != SEGMENTED_NULL && GETSEGNUM(limbModifications) == parent->segment)
|
||||
{
|
||||
const auto& res = limbModifications_arr.at(0);
|
||||
std::string limbModifications_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = limbModifications_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = limbModifications_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(limbModifications_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(limbModifications_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), limbModifications_Str,
|
||||
arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
|
||||
if (dlist != SEGMENTED_NULL && GETSEGNUM(dlist) == parent->segment)
|
||||
{
|
||||
uint32_t dlist_Offset = Seg2Filespace(dlist, parent->baseAddress);
|
||||
|
||||
int32_t dlistLength = ZDisplayList::GetDListLength(
|
||||
parent->GetRawData(), dlist_Offset,
|
||||
Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX);
|
||||
ZDisplayList* dlist_data = new ZDisplayList(parent);
|
||||
dlist_data->ExtractFromBinary(dlist_Offset, dlistLength);
|
||||
|
||||
std::string dListStr =
|
||||
StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), dlist_Offset);
|
||||
dlist_data->SetName(dListStr);
|
||||
dlist_data->DeclareVar(varPrefix, "");
|
||||
dlist_data->DeclareReferences(varPrefix);
|
||||
parent->AddResource(dlist_data);
|
||||
}
|
||||
}
|
||||
|
||||
std::string SkinAnimatedLimbData::GetBodySourceCode() const
|
||||
{
|
||||
std::string limbModifications_Str;
|
||||
std::string dlist_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(limbModifications, parent, "SkinLimbModif",
|
||||
limbModifications_Str, parent->workerID);
|
||||
Globals::Instance->GetSegmentedPtrName(dlist, parent, "Gfx", dlist_Str, parent->workerID);
|
||||
|
||||
std::string entryStr = "\n";
|
||||
entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", totalVtxCount,
|
||||
limbModifications_Str.c_str());
|
||||
entryStr +=
|
||||
StringHelper::Sprintf("\t%s, %s\n", limbModifications_Str.c_str(), dlist_Str.c_str());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string SkinAnimatedLimbData::GetSourceTypeName() const
|
||||
{
|
||||
return "SkinAnimatedLimbData";
|
||||
}
|
||||
|
||||
ZResourceType SkinAnimatedLimbData::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t SkinAnimatedLimbData::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
111
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.h
Normal file
111
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.h
Normal file
@@ -0,0 +1,111 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ZResource.h"
|
||||
#include "ZDisplayList.h"
|
||||
|
||||
enum class ZLimbSkinType
|
||||
{
|
||||
SkinType_Null, // SkinLimb segment = NULL
|
||||
SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData*
|
||||
SkinType_Normal = 11, // SkinLimb segment = Gfx*
|
||||
};
|
||||
|
||||
class SkinVertex : public ZResource
|
||||
{
|
||||
public:
|
||||
SkinVertex(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
uint16_t index;
|
||||
int16_t s;
|
||||
int16_t t;
|
||||
int8_t normX;
|
||||
int8_t normY;
|
||||
int8_t normZ;
|
||||
uint8_t alpha;
|
||||
};
|
||||
|
||||
class SkinTransformation : public ZResource
|
||||
{
|
||||
public:
|
||||
SkinTransformation(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
uint8_t limbIndex;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
uint8_t scale;
|
||||
};
|
||||
|
||||
class SkinLimbModif : public ZResource
|
||||
{
|
||||
public:
|
||||
SkinLimbModif(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class SkinAnimatedLimbData : public ZResource
|
||||
{
|
||||
public:
|
||||
SkinAnimatedLimbData(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
uint16_t totalVtxCount;
|
||||
uint16_t limbModifCount; // Length of limbModifications
|
||||
segptr_t limbModifications; // SkinLimbModif*
|
||||
segptr_t dlist; // Gfx*
|
||||
|
||||
std::vector<SkinLimbModif> limbModifications_arr;
|
||||
// ZDisplayList* unk_8_dlist = nullptr;
|
||||
};
|
||||
Reference in New Issue
Block a user