mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-14 11:00:41 +00:00
ZAPD update: Gotta go fast! (#877)
* copy over the xml * Rename anims * A bunch of renames * minor extract_assets fixes * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "820678b4e" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "820678b4e" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Change rgb5a1 to rgba16 * eye and eyebrows * some dlists * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "6be9af65d" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "6be9af65d" git-subrepo: version: "0.4.3" origin: "???" commit: "???"
This commit is contained in:
parent
d1a5ea5110
commit
5c147e5e03
226 changed files with 2350 additions and 1492 deletions
|
@ -255,12 +255,12 @@ std::string FlashingTexture::GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddre
|
|||
index++;
|
||||
}
|
||||
|
||||
zRoom->parent->AddDeclarationArray(
|
||||
primColorSegmentOffset, DeclarationAlignment::Align4, primColors.size() * 5,
|
||||
"F3DPrimColor",
|
||||
StringHelper::Sprintf("%sAnimatedMaterialPrimColor_%06X", zRoom->GetName().c_str(),
|
||||
primColorSegmentOffset),
|
||||
primColors.size(), declaration);
|
||||
zRoom->parent->AddDeclarationArray(primColorSegmentOffset, DeclarationAlignment::Align4,
|
||||
primColors.size() * 5, "F3DPrimColor",
|
||||
StringHelper::Sprintf("%sAnimatedMaterialPrimColor_%06X",
|
||||
zRoom->GetName().c_str(),
|
||||
primColorSegmentOffset),
|
||||
primColors.size(), declaration);
|
||||
}
|
||||
|
||||
if (envColorSegmentOffset != 0)
|
||||
|
@ -281,7 +281,7 @@ std::string FlashingTexture::GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddre
|
|||
|
||||
zRoom->parent->AddDeclarationArray(
|
||||
envColorSegmentOffset, DeclarationAlignment::Align4, envColors.size() * 4,
|
||||
"Color_RGBA8",
|
||||
"F3DEnvColor",
|
||||
StringHelper::Sprintf("%sAnimatedMaterialEnvColors0x%06X", zRoom->GetName().c_str(),
|
||||
envColorSegmentOffset),
|
||||
envColors.size(), declaration);
|
||||
|
@ -400,7 +400,8 @@ std::string AnimatedMatTexCycleParams::GenerateSourceCode(ZRoom* zRoom, uint32_t
|
|||
textureIndices.size(), declaration);
|
||||
}
|
||||
|
||||
std::string segmName = zRoom->parent->GetDeclarationPtrName(textureSegmentOffsetsSegmentAddress);
|
||||
std::string segmName =
|
||||
zRoom->parent->GetDeclarationPtrName(textureSegmentOffsetsSegmentAddress);
|
||||
std::string indexesName = zRoom->parent->GetDeclarationPtrName(textureIndicesSegmentAddress);
|
||||
|
||||
return StringHelper::Sprintf("%i, %s, %s", cycleLength, segmName.c_str(), indexesName.c_str());
|
||||
|
|
|
@ -13,7 +13,6 @@ void SetCollisionHeader::ParseRawData()
|
|||
{
|
||||
ZRoomCommand::ParseRawData();
|
||||
collisionHeader = new ZCollisionHeader(parent);
|
||||
collisionHeader->SetRawData(parent->GetRawData());
|
||||
collisionHeader->SetRawDataIndex(segmentOffset);
|
||||
collisionHeader->SetName(
|
||||
StringHelper::Sprintf("%sCollisionHeader_%06X", parent->GetName().c_str(), segmentOffset));
|
||||
|
|
|
@ -33,7 +33,6 @@ void SetCsCamera::ParseRawData()
|
|||
for (int32_t i = 0; i < numPoints; i++)
|
||||
{
|
||||
ZVector vec(parent);
|
||||
vec.SetRawData(parent->GetRawData());
|
||||
vec.SetRawDataIndex(currentPtr);
|
||||
vec.SetScalarType(ZScalarType::ZSCALAR_S16);
|
||||
vec.SetDimensions(3);
|
||||
|
|
|
@ -19,7 +19,7 @@ void SetCutscenes::ParseRawData()
|
|||
if (Globals::Instance->game == ZGame::OOT_RETAIL || Globals::Instance->game == ZGame::OOT_SW97)
|
||||
{
|
||||
ZCutscene* cutscene = new ZCutscene(parent);
|
||||
cutscene->ExtractFromFile(parent->GetRawData(), segmentOffset);
|
||||
cutscene->ExtractFromFile(segmentOffset);
|
||||
|
||||
auto decl = parent->GetDeclaration(segmentOffset);
|
||||
if (decl == nullptr)
|
||||
|
@ -48,7 +48,7 @@ void SetCutscenes::ParseRawData()
|
|||
declaration += "\n";
|
||||
|
||||
ZCutsceneMM* cutscene = new ZCutsceneMM(parent);
|
||||
cutscene->ExtractFromFile(parent->GetRawData(), entry.segmentOffset);
|
||||
cutscene->ExtractFromFile(entry.segmentOffset);
|
||||
cutscenes.push_back(cutscene);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,6 @@ RoomCommand SetMesh::GetRoomCommand() const
|
|||
PolygonDlist::PolygonDlist(const std::string& prefix, const std::vector<uint8_t>& nRawData,
|
||||
uint32_t nRawDataIndex, ZFile* nParent, ZRoom* nRoom)
|
||||
{
|
||||
rawData.assign(nRawData.begin(), nRawData.end());
|
||||
rawDataIndex = nRawDataIndex;
|
||||
parent = nParent;
|
||||
zRoom = nRoom;
|
||||
|
@ -126,6 +125,7 @@ PolygonDlist::PolygonDlist(const std::string& prefix, const std::vector<uint8_t>
|
|||
|
||||
void PolygonDlist::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
switch (polyType)
|
||||
{
|
||||
case 2:
|
||||
|
@ -161,9 +161,9 @@ ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, const std::string& prefix)
|
|||
uint32_t dlistAddress = Seg2Filespace(ptr, parent->baseAddress);
|
||||
|
||||
int32_t dlistLength = ZDisplayList::GetDListLength(
|
||||
rawData, dlistAddress,
|
||||
parent->GetRawData(), dlistAddress,
|
||||
Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX);
|
||||
ZDisplayList* dlist = new ZDisplayList(rawData, dlistAddress, dlistLength, parent);
|
||||
ZDisplayList* dlist = new ZDisplayList(dlistAddress, dlistLength, parent);
|
||||
GenDListDeclarations(zRoom, parent, dlist);
|
||||
|
||||
return dlist;
|
||||
|
@ -271,7 +271,6 @@ std::string PolygonDlist::GetName()
|
|||
BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, const std::vector<uint8_t>& nRawData,
|
||||
uint32_t nRawDataIndex, ZFile* nParent)
|
||||
{
|
||||
rawData.assign(nRawData.begin(), nRawData.end());
|
||||
rawDataIndex = nRawDataIndex;
|
||||
parent = nParent;
|
||||
isSubStruct = nIsSubStruct;
|
||||
|
@ -285,6 +284,7 @@ BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, const std::vector
|
|||
void BgImage::ParseRawData()
|
||||
{
|
||||
size_t pad = 0x00;
|
||||
const auto& rawData = parent->GetRawData();
|
||||
if (!isSubStruct)
|
||||
{
|
||||
pad = 0x04;
|
||||
|
@ -312,7 +312,7 @@ ZBackground* BgImage::MakeBackground(segptr_t ptr, const std::string& prefix)
|
|||
|
||||
uint32_t backAddress = Seg2Filespace(ptr, parent->baseAddress);
|
||||
|
||||
ZBackground* background = new ZBackground(prefix, rawData, backAddress, parent);
|
||||
ZBackground* background = new ZBackground(prefix, backAddress, parent);
|
||||
background->DeclareVar(prefix, "");
|
||||
parent->resources.push_back(background);
|
||||
|
||||
|
@ -408,9 +408,9 @@ std::string BgImage::GetName()
|
|||
|
||||
PolygonTypeBase::PolygonTypeBase(ZFile* nParent, const std::vector<uint8_t>& nRawData,
|
||||
uint32_t nRawDataIndex, ZRoom* nRoom)
|
||||
: rawData{nRawData}, rawDataIndex{nRawDataIndex}, parent{nParent}, zRoom{nRoom}
|
||||
: rawDataIndex{nRawDataIndex}, parent{nParent}, zRoom{nRoom}
|
||||
{
|
||||
type = BitConverter::ToUInt8BE(rawData, rawDataIndex);
|
||||
type = BitConverter::ToUInt8BE(parent->GetRawData(), rawDataIndex);
|
||||
}
|
||||
|
||||
void PolygonTypeBase::DeclareVar(const std::string& prefix, const std::string& bodyStr)
|
||||
|
@ -477,6 +477,8 @@ PolygonType1::PolygonType1(ZFile* nParent, const std::vector<uint8_t>& nRawData,
|
|||
|
||||
void PolygonType1::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
format = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x01);
|
||||
dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
|
||||
|
||||
|
@ -506,7 +508,7 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
|
|||
switch (format)
|
||||
{
|
||||
case 1:
|
||||
single = BgImage(true, prefix, rawData, rawDataIndex + 0x08, parent);
|
||||
single = BgImage(true, prefix, parent->GetRawData(), rawDataIndex + 0x08, parent);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -515,8 +517,8 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
|
|||
listAddress = Seg2Filespace(list, parent->baseAddress);
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
BgImage bg(false, prefix, rawData, listAddress + i * BgImage::GetRawDataSize(),
|
||||
parent);
|
||||
BgImage bg(false, prefix, parent->GetRawData(),
|
||||
listAddress + i * BgImage::GetRawDataSize(), parent);
|
||||
multiList.push_back(bg);
|
||||
bgImageArrayBody += bg.GetBodySourceCode(true);
|
||||
if (i + 1 < count)
|
||||
|
@ -609,6 +611,8 @@ PolygonType2::PolygonType2(ZFile* nParent, const std::vector<uint8_t>& nRawData,
|
|||
|
||||
void PolygonType2::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
num = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x01);
|
||||
|
||||
start = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
|
||||
|
|
|
@ -39,7 +39,6 @@ protected:
|
|||
ZDisplayList* opaDList = nullptr; // Gfx*
|
||||
ZDisplayList* xluDList = nullptr; // Gfx*
|
||||
|
||||
std::vector<uint8_t> rawData;
|
||||
uint32_t rawDataIndex;
|
||||
ZFile* parent;
|
||||
ZRoom* zRoom;
|
||||
|
@ -65,7 +64,6 @@ protected:
|
|||
|
||||
ZBackground* sourceBackground;
|
||||
|
||||
std::vector<uint8_t> rawData;
|
||||
uint32_t rawDataIndex;
|
||||
ZFile* parent;
|
||||
std::string name;
|
||||
|
@ -114,7 +112,6 @@ protected:
|
|||
|
||||
std::vector<PolygonDlist> polyDLists;
|
||||
|
||||
std::vector<uint8_t> rawData;
|
||||
uint32_t rawDataIndex;
|
||||
ZFile* parent;
|
||||
ZRoom* zRoom;
|
||||
|
|
|
@ -60,10 +60,9 @@ ZRoom::~ZRoom()
|
|||
delete cmd;
|
||||
}
|
||||
|
||||
void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
|
||||
const uint32_t nRawDataIndex)
|
||||
void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
{
|
||||
ZResource::ExtractFromXML(reader, nRawData, nRawDataIndex);
|
||||
ZResource::ExtractFromXML(reader, nRawDataIndex);
|
||||
|
||||
scene = Globals::Instance->lastScene;
|
||||
|
||||
|
@ -97,8 +96,8 @@ void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8
|
|||
int32_t address = strtol(StringHelper::Split(addressStr, "0x")[1].c_str(), NULL, 16);
|
||||
|
||||
ZDisplayList* dList = new ZDisplayList(
|
||||
rawData, address,
|
||||
ZDisplayList::GetDListLength(rawData, address,
|
||||
address,
|
||||
ZDisplayList::GetDListLength(parent->GetRawData(), address,
|
||||
Globals::Instance->game == ZGame::OOT_SW97 ?
|
||||
DListType::F3DEX :
|
||||
DListType::F3DZEX),
|
||||
|
@ -115,7 +114,7 @@ void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8
|
|||
|
||||
ZCutscene* cutscene = new ZCutscene(parent);
|
||||
cutscene->SetInnerNode(true);
|
||||
cutscene->ExtractFromXML(child, rawData, address);
|
||||
cutscene->ExtractFromXML(child, address);
|
||||
|
||||
cutscene->GetSourceOutputCode(name);
|
||||
|
||||
|
@ -152,7 +151,7 @@ void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8
|
|||
delete pathway;
|
||||
}
|
||||
|
||||
#ifndef DEPRECATION_OFF
|
||||
#ifdef DEPRECATION_ON
|
||||
fprintf(stderr,
|
||||
"ZRoom::ExtractFromXML: Deprecation warning in '%s'.\n"
|
||||
"\t The resource '%s' is currently deprecated, and will be removed in a future "
|
||||
|
@ -174,6 +173,7 @@ void ZRoom::ParseCommands(std::vector<ZRoomCommand*>& commandList, CommandSet co
|
|||
|
||||
uint32_t commandsLeft = commandSet.commandCount;
|
||||
|
||||
const auto& rawData = parent->GetRawData();
|
||||
while (shouldContinue)
|
||||
{
|
||||
if (commandsLeft <= 0)
|
||||
|
@ -392,7 +392,7 @@ size_t ZRoom::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress)
|
|||
auto nextDecl = currentDecl;
|
||||
std::advance(nextDecl, 1);
|
||||
if (nextDecl == parent->declarations.end())
|
||||
return rawData.size() - currentDecl->first;
|
||||
return parent->GetRawData().size() - currentDecl->first;
|
||||
|
||||
return nextDecl->first - currentDecl->first;
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
|
|||
if (cmdIndex + 1 < (int32_t)commands.size())
|
||||
return commands[cmdIndex + 1]->cmdAddress - commands[cmdIndex]->cmdAddress;
|
||||
else
|
||||
return rawData.size() - commands[cmdIndex]->cmdAddress;
|
||||
return parent->GetRawData().size() - commands[cmdIndex]->cmdAddress;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -36,8 +36,7 @@ public:
|
|||
ZRoom(ZFile* nParent);
|
||||
virtual ~ZRoom();
|
||||
|
||||
void ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
|
||||
uint32_t nRawDataIndex) override;
|
||||
void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
|
||||
void ParseCommands(std::vector<ZRoomCommand*>& commandList, CommandSet commandSet);
|
||||
size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue