mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05: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>
68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#include "SetStartPositionList.h"
|
|
|
|
#include "Globals.h"
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
#include "ZFile.h"
|
|
#include "ZRoom/ZNames.h"
|
|
#include "ZRoom/ZRoom.h"
|
|
|
|
SetStartPositionList::SetStartPositionList(ZFile* nParent) : ZRoomCommand(nParent)
|
|
{
|
|
}
|
|
|
|
void SetStartPositionList::ParseRawData()
|
|
{
|
|
ZRoomCommand::ParseRawData();
|
|
uint8_t numActors = cmdArg1;
|
|
|
|
uint32_t currentPtr = segmentOffset;
|
|
|
|
for (int32_t i = 0; i < numActors; i++)
|
|
{
|
|
actors.push_back(ActorSpawnEntry(parent->GetRawData(), currentPtr));
|
|
currentPtr += 16;
|
|
}
|
|
}
|
|
|
|
void SetStartPositionList::DeclareReferences(const std::string& prefix)
|
|
{
|
|
if (!actors.empty())
|
|
{
|
|
std::string declaration;
|
|
|
|
size_t index = 0;
|
|
for (const auto& entry : actors)
|
|
{
|
|
declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str());
|
|
if (index + 1 < actors.size())
|
|
declaration += "\n";
|
|
|
|
index++;
|
|
}
|
|
|
|
parent->AddDeclarationArray(
|
|
segmentOffset, DeclarationAlignment::Align4, actors.size() * 16, "ActorEntry",
|
|
StringHelper::Sprintf("%sStartPositionList0x%06X", prefix.c_str(), segmentOffset),
|
|
actors.size(), declaration);
|
|
}
|
|
}
|
|
|
|
std::string SetStartPositionList::GetBodySourceCode() const
|
|
{
|
|
std::string listName;
|
|
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorEntry", listName,
|
|
parent->workerID);
|
|
return StringHelper::Sprintf("SCENE_CMD_SPAWN_LIST(%i, %s)", actors.size(), listName.c_str());
|
|
}
|
|
|
|
std::string SetStartPositionList::GetCommandCName() const
|
|
{
|
|
return "SCmdSpawnList";
|
|
}
|
|
|
|
RoomCommand SetStartPositionList::GetRoomCommand() const
|
|
{
|
|
return RoomCommand::SetStartPositionList;
|
|
}
|