mirror of
https://github.com/zeldaret/oot
synced 2026-05-27 08:08:42 -04:00
42af56b231
subrepo: subdir: "tools/ZAPD" merged: "4bf6600a3" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "4bf6600a3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#include "SetStartPositionList.h"
|
|
#include "../ZRoom.h"
|
|
#include "../ActorList.h"
|
|
#include "../../ZFile.h"
|
|
#include "../../BitConverter.h"
|
|
#include "../../StringHelper.h"
|
|
|
|
using namespace std;
|
|
|
|
SetStartPositionList::SetStartPositionList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
|
{
|
|
int numActors = rawData[rawDataIndex + 1];
|
|
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
|
|
|
if (segmentOffset != 0)
|
|
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
|
|
|
actors = vector<ActorSpawnEntry*>();
|
|
|
|
uint32_t currentPtr = segmentOffset;
|
|
|
|
for (int i = 0; i < numActors; i++)
|
|
{
|
|
actors.push_back(new ActorSpawnEntry(rawData, currentPtr));
|
|
currentPtr += 16;
|
|
}
|
|
}
|
|
|
|
SetStartPositionList::~SetStartPositionList()
|
|
{
|
|
for (ActorSpawnEntry* entry : actors)
|
|
delete entry;
|
|
}
|
|
|
|
string SetStartPositionList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
|
{
|
|
string sourceOutput = "";
|
|
char line[2048];
|
|
|
|
sourceOutput += StringHelper::Sprintf("%s 0x%02X, (u32)&%sStartPositionList0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), actors.size(), zRoom->GetName().c_str(), segmentOffset);
|
|
|
|
string declaration = "";
|
|
|
|
for (ActorSpawnEntry* entry : actors)
|
|
{
|
|
declaration += StringHelper::Sprintf("\t{ %s, %i, %i, %i, %i, %i, %i, 0x%04X },\n", ActorList[entry->actorNum].c_str(), entry->posX, entry->posY, entry->posZ,
|
|
entry->rotX, entry->rotY, entry->rotZ, entry->initVar);
|
|
}
|
|
|
|
zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, actors.size() * 16, "ActorEntry",
|
|
StringHelper::Sprintf("%sStartPositionList0x%06X", zRoom->GetName().c_str(), segmentOffset), 0, declaration);
|
|
|
|
return sourceOutput;
|
|
}
|
|
|
|
string SetStartPositionList::GenerateSourceCodePass2(string roomName, int baseAddress)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
string SetStartPositionList::GenerateExterns()
|
|
{
|
|
return StringHelper::Sprintf("extern ActorEntry %sStartPositionList0x%06X[];\n", zRoom->GetName().c_str(), segmentOffset);
|
|
}
|
|
|
|
string SetStartPositionList::GetCommandCName()
|
|
{
|
|
return "SCmdSpawnList";
|
|
}
|
|
|
|
RoomCommand SetStartPositionList::GetRoomCommand()
|
|
{
|
|
return RoomCommand::SetStartPositionList;
|
|
} |