mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-01 08:05:07 -04:00
c80f9fbd57
* WIP Multiversion support * GC PAL Non-MQ support complete * Updated OtrGui to handle different game versions * Added version file * Added new extract mode to ZAPD and optimized OTR gen time * Fixed bug causing crash * Further optimized OTRExporter, saving around ~20 seconds. * ZAPD is now multi-threaded. * Fixed merge issue * Fixed memory leak and fog issue on pause screen. * Additional fog fixes. Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
95 lines
2.7 KiB
C++
95 lines
2.7 KiB
C++
#include "SetActorCutsceneList.h"
|
|
|
|
#include "Globals.h"
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
#include "ZFile.h"
|
|
#include "ZRoom/ZRoom.h"
|
|
|
|
SetActorCutsceneList::SetActorCutsceneList(ZFile* nParent) : ZRoomCommand(nParent)
|
|
{
|
|
}
|
|
|
|
void SetActorCutsceneList::ParseRawData()
|
|
{
|
|
ZRoomCommand::ParseRawData();
|
|
int numCutscenes = cmdArg1;
|
|
int32_t currentPtr = segmentOffset;
|
|
|
|
for (int32_t i = 0; i < numCutscenes; i++)
|
|
{
|
|
ActorCutsceneEntry entry(parent->GetRawData(), currentPtr);
|
|
cutscenes.push_back(entry);
|
|
|
|
currentPtr += 16;
|
|
}
|
|
}
|
|
|
|
void SetActorCutsceneList::DeclareReferences(const std::string& prefix)
|
|
{
|
|
if (cutscenes.size() > 0)
|
|
{
|
|
std::string declaration;
|
|
|
|
for (size_t i = 0; i < cutscenes.size(); i++)
|
|
{
|
|
const auto& entry = cutscenes.at(i);
|
|
declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str());
|
|
|
|
if (i + 1 < cutscenes.size())
|
|
{
|
|
declaration += "\n";
|
|
}
|
|
}
|
|
|
|
std::string typeName = cutscenes.at(0).GetSourceTypeName();
|
|
|
|
parent->AddDeclarationArray(
|
|
segmentOffset, GetDeclarationAlignment(), cutscenes.size() * 16, typeName,
|
|
StringHelper::Sprintf("%s%sList_%06X", prefix.c_str(), typeName.c_str(), segmentOffset),
|
|
cutscenes.size(), declaration);
|
|
}
|
|
}
|
|
|
|
std::string SetActorCutsceneList::GetBodySourceCode() const
|
|
{
|
|
std::string listName;
|
|
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCutscene", listName,
|
|
parent->workerID);
|
|
return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_LIST(%i, %s)", cutscenes.size(),
|
|
listName.c_str());
|
|
}
|
|
|
|
std::string SetActorCutsceneList::GetCommandCName() const
|
|
{
|
|
return "SCmdCutsceneActorList";
|
|
}
|
|
|
|
RoomCommand SetActorCutsceneList::GetRoomCommand() const
|
|
{
|
|
return RoomCommand::SetActorCutsceneList;
|
|
}
|
|
|
|
ActorCutsceneEntry::ActorCutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
|
: priority(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)),
|
|
length(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)),
|
|
unk4(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)),
|
|
unk6(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)),
|
|
additionalCutscene(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)),
|
|
sound(rawData[rawDataIndex + 0xA]), unkB(rawData[rawDataIndex + 0xB]),
|
|
unkC(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)), unkE(rawData[rawDataIndex + 0xE]),
|
|
letterboxSize(rawData[rawDataIndex + 0xF])
|
|
{
|
|
}
|
|
|
|
std::string ActorCutsceneEntry::GetBodySourceCode() const
|
|
{
|
|
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length, unk4,
|
|
unk6, additionalCutscene, sound, unkB, unkC, unkE, letterboxSize);
|
|
}
|
|
|
|
std::string ActorCutsceneEntry::GetSourceTypeName() const
|
|
{
|
|
return "ActorCutscene";
|
|
}
|