mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-17 12:33:38 +00:00
git subrepo pull --force tools/ZAPD (#718)
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"
This commit is contained in:
parent
8a730123b6
commit
42af56b231
35 changed files with 1854 additions and 445 deletions
|
@ -11,7 +11,7 @@ using namespace std;
|
|||
SetActorList::SetActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
numActors = rawData[rawDataIndex + 1];
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
|
||||
_rawData = rawData;
|
||||
_rawDataIndex = rawDataIndex;
|
||||
|
@ -68,7 +68,7 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress)
|
|||
|
||||
// SW97 Actor 0x22 was removed, so we want to not output a working actor.
|
||||
if (actorNum == 0x22 && Globals::Instance->game == ZGame::OOT_SW97)
|
||||
declaration += StringHelper::Sprintf("\t//{ %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", StringHelper::Sprintf("SW_REMOVED_0x%04X", actorNum), entry->posX, entry->posY, entry->posZ, entry->rotX, entry->rotY, entry->rotZ, (uint16_t)entry->initVar, segmentOffset + (index * 16));
|
||||
declaration += StringHelper::Sprintf("\t//{ %s, %i, %i, %i, %i, %i, %i, 0x%04X }, //0x%06X", /*StringHelper::Sprintf("SW_REMOVED_0x%04X", actorNum).c_str()*/ "ACTOR_DUNGEON_KEEP", entry->posX, entry->posY, entry->posZ, entry->rotX, entry->rotY, entry->rotZ, (uint16_t)entry->initVar, segmentOffset + (index * 16));
|
||||
else
|
||||
{
|
||||
// SW97 Actor 0x23 and above are shifted up by one because 0x22 was removed between SW97 and retail.
|
||||
|
|
|
@ -7,7 +7,7 @@ using namespace std;
|
|||
|
||||
SetAlternateHeaders::SetAlternateHeaders(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
|
||||
if (segmentOffset != 0)
|
||||
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
||||
|
|
|
@ -8,7 +8,7 @@ using namespace std;
|
|||
|
||||
SetCollisionHeader::SetCollisionHeader(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
collisionHeader = ZCollisionHeader(nZRoom->parent, StringHelper::Sprintf("%sCollisionHeader0x%06X", nZRoom->GetName().c_str(), segmentOffset), rawData, segmentOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ using namespace std;
|
|||
|
||||
SetExitList::SetExitList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
exits = vector<uint16_t>();
|
||||
|
||||
if (segmentOffset != 0)
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace std;
|
|||
SetLightingSettings::SetLightingSettings(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
uint8_t numLights = rawData[rawDataIndex + 1];
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
|
||||
for (int i = 0; i < numLights; i++)
|
||||
settings.push_back(new LightingSettings(rawData, segmentOffset + (i * 22)));
|
||||
|
|
|
@ -11,7 +11,7 @@ using namespace std;
|
|||
SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, int segAddressOffset) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
data = rawData[rawDataIndex + 1];
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
|
||||
string declaration = "";
|
||||
int8_t meshHeaderType = rawData[segmentOffset + 0];
|
||||
|
@ -22,8 +22,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
meshHeader0->headerType = 0;
|
||||
meshHeader0->entries = vector<MeshEntry0*>();
|
||||
|
||||
meshHeader0->dListStart = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 4));
|
||||
meshHeader0->dListEnd = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 8));
|
||||
meshHeader0->dListStart = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 4));
|
||||
meshHeader0->dListEnd = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 8));
|
||||
|
||||
int8_t numEntries = rawData[segmentOffset + 1];
|
||||
uint32_t currentPtr = meshHeader0->dListStart;
|
||||
|
@ -38,8 +38,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
for (int i = 0; i < numEntries; i++)
|
||||
{
|
||||
MeshEntry0* entry = new MeshEntry0();
|
||||
entry->opaqueDListAddr = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, currentPtr + 0));
|
||||
entry->translucentDListAddr = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, currentPtr + 4));
|
||||
entry->opaqueDListAddr = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, currentPtr + 0));
|
||||
entry->translucentDListAddr = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, currentPtr + 4));
|
||||
|
||||
if (entry->opaqueDListAddr != 0)
|
||||
{
|
||||
|
@ -82,12 +82,12 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
for (int i = 0; i < meshHeader0->entries.size(); i++)
|
||||
{
|
||||
if (meshHeader0->entries[i]->opaqueDListAddr != 0)
|
||||
declaration += StringHelper::Sprintf("\t{ (u32)%sDlist0x%06X, ", zRoom->GetName().c_str(), meshHeader0->entries[i]->opaqueDListAddr);
|
||||
declaration += StringHelper::Sprintf("\t{ (u32)%sDL_%06X, ", zRoom->GetName().c_str(), meshHeader0->entries[i]->opaqueDListAddr);
|
||||
else
|
||||
declaration += "\t{ 0, ";
|
||||
|
||||
if (meshHeader0->entries[i]->translucentDListAddr != 0)
|
||||
declaration += StringHelper::Sprintf("(u32)%sDlist0x%06X },\n", zRoom->GetName().c_str(), meshHeader0->entries[i]->translucentDListAddr);
|
||||
declaration += StringHelper::Sprintf("(u32)%sDL_%06X },\n", zRoom->GetName().c_str(), meshHeader0->entries[i]->translucentDListAddr);
|
||||
else
|
||||
declaration += "0 },\n";
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration);
|
||||
|
||||
meshHeader1 = headerSingle;
|
||||
; }
|
||||
}
|
||||
else if (fmt == 2) // Multi-Format
|
||||
{
|
||||
MeshHeader1Multi* headerMulti = new MeshHeader1Multi();
|
||||
|
@ -173,8 +173,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
meshHeader2->headerType = 2;
|
||||
|
||||
meshHeader2->entries = vector<MeshEntry2*>();
|
||||
meshHeader2->dListStart = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 4));
|
||||
meshHeader2->dListEnd = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 8));
|
||||
meshHeader2->dListStart = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 4));
|
||||
meshHeader2->dListEnd = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 8));
|
||||
|
||||
int8_t numEntries = rawData[segmentOffset + 1];
|
||||
uint32_t currentPtr = meshHeader2->dListStart;
|
||||
|
@ -234,12 +234,12 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
|||
declaration += StringHelper::Sprintf("\t{ %i, %i, %i, %i, ", meshHeader2->entries[i]->playerXMax, meshHeader2->entries[i]->playerZMax, meshHeader2->entries[i]->playerXMin, meshHeader2->entries[i]->playerZMin);
|
||||
|
||||
if (meshHeader2->entries[i]->opaqueDListAddr != 0)
|
||||
declaration += StringHelper::Sprintf("(u32)%sDlist0x%06X, ", zRoom->GetName().c_str(), meshHeader2->entries[i]->opaqueDListAddr);
|
||||
declaration += StringHelper::Sprintf("(u32)%sDL_%06X, ", zRoom->GetName().c_str(), meshHeader2->entries[i]->opaqueDListAddr);
|
||||
else
|
||||
declaration += "0, ";
|
||||
|
||||
if (meshHeader2->entries[i]->translucentDListAddr != 0)
|
||||
declaration += StringHelper::Sprintf("(u32)%sDlist0x%06X },\n", zRoom->GetName().c_str(), meshHeader2->entries[i]->translucentDListAddr);
|
||||
declaration += StringHelper::Sprintf("(u32)%sDL_%06X },\n", zRoom->GetName().c_str(), meshHeader2->entries[i]->translucentDListAddr);
|
||||
else
|
||||
declaration += "0 },\n";
|
||||
}
|
||||
|
@ -306,9 +306,9 @@ std::string SetMesh::GenDListExterns(ZDisplayList* dList)
|
|||
string sourceOutput = "";
|
||||
|
||||
if (Globals::Instance->includeFilePrefix)
|
||||
sourceOutput += StringHelper::Sprintf("extern Gfx %sDlist0x%06X[];\n", zRoom->GetName().c_str(), dList->GetRawDataIndex());
|
||||
sourceOutput += StringHelper::Sprintf("extern Gfx %sDL_%06X[];\n", zRoom->GetName().c_str(), dList->GetRawDataIndex());
|
||||
else
|
||||
sourceOutput += StringHelper::Sprintf("extern Gfx dlist0x%06X[];\n", dList->GetRawDataIndex());
|
||||
sourceOutput += StringHelper::Sprintf("extern Gfx DL_%06X[];\n", dList->GetRawDataIndex());
|
||||
|
||||
for (ZDisplayList* otherDList : dList->otherDLists)
|
||||
sourceOutput += GenDListExterns(otherDList);
|
||||
|
|
|
@ -11,7 +11,7 @@ SetObjectList::SetObjectList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int ra
|
|||
{
|
||||
objects = vector<uint16_t>();
|
||||
uint8_t objectCnt = rawData[rawDataIndex + 1];
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
uint32_t currentPtr = segmentOffset;
|
||||
|
||||
for (int i = 0; i < objectCnt; i++)
|
||||
|
|
|
@ -14,7 +14,7 @@ SetPathways::SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDat
|
|||
segmentOffset = 0;
|
||||
listSegmentOffset = 0;
|
||||
|
||||
InitList(SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)));
|
||||
InitList(GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)));
|
||||
|
||||
uint32_t currentPtr = listSegmentOffset;
|
||||
|
||||
|
@ -31,7 +31,7 @@ SetPathways::~SetPathways()
|
|||
void SetPathways::InitList(uint32_t address)
|
||||
{
|
||||
segmentOffset = address;
|
||||
listSegmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(_rawData, address + 4));
|
||||
listSegmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(_rawData, address + 4));
|
||||
numPoints = _rawData[address + 0];
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ using namespace std;
|
|||
SetStartPositionList::SetStartPositionList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) : ZRoomCommand(nZRoom, rawData, rawDataIndex)
|
||||
{
|
||||
int numActors = rawData[rawDataIndex + 1];
|
||||
segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
|
||||
|
||||
if (segmentOffset != 0)
|
||||
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
||||
|
|
|
@ -225,10 +225,8 @@ void ZRoom::ParseCommands(std::vector<ZRoomCommand*>& commandList, CommandSet co
|
|||
{
|
||||
bool shouldContinue = true;
|
||||
int currentIndex = 0;
|
||||
int rawDataIndex = commandSet.address;
|
||||
int8_t segmentNumber = rawDataIndex >> 24;
|
||||
int rawDataIndex = commandSet.address & 0x00FFFFFF;
|
||||
|
||||
rawDataIndex &= 0x00FFFFFF;
|
||||
int32_t commandsLeft = commandSet.commandCount;
|
||||
|
||||
while (shouldContinue)
|
||||
|
@ -305,7 +303,6 @@ void ZRoom::ProcessCommandSets()
|
|||
std::vector<ZRoomCommand*> setCommands = std::vector<ZRoomCommand*>();
|
||||
|
||||
int32_t commandSet = commandSets[0].address;
|
||||
int8_t segmentNumber = commandSet >> 24;
|
||||
ParseCommands(setCommands, commandSets[0]);
|
||||
commandSets.erase(commandSets.begin());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue