mirror of
https://github.com/zeldaret/oot
synced 2026-09-11 04:13:38 -04:00
Update ZAPD (#1001)
* remove fake match * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "3e9ed72e2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3e9ed72e2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * new extraction script and a hack to make clear tag work * fix clear tag again * remove static from clear tag DLists * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "e7a8a48cf" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e7a8a48cf" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "e243634e5" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e243634e5" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "d0cd6b397" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "d0cd6b397" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Update ovl_En_Clear_Tag.xml
This commit is contained in:
+37
-26
@@ -1,9 +1,11 @@
|
||||
#include "ZVector.h"
|
||||
#include <assert.h>
|
||||
#include "BitConverter.h"
|
||||
#include "File.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "StringHelper.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/File.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
REGISTER_ZFILENODE(Vector, ZVector);
|
||||
@@ -12,10 +14,25 @@ ZVector::ZVector(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
scalarType = ZScalarType::ZSCALAR_NONE;
|
||||
dimensions = 0;
|
||||
|
||||
RegisterRequiredAttribute("Type");
|
||||
RegisterRequiredAttribute("Dimensions");
|
||||
}
|
||||
|
||||
void ZVector::ExtractFromBinary(uint32_t nRawDataIndex, ZScalarType nScalarType,
|
||||
uint32_t nDimensions)
|
||||
{
|
||||
rawDataIndex = nRawDataIndex;
|
||||
scalarType = nScalarType;
|
||||
dimensions = nDimensions;
|
||||
|
||||
// Don't parse raw data of external files
|
||||
if (parent->GetMode() == ZFileMode::ExternalFile)
|
||||
return;
|
||||
|
||||
ParseRawData();
|
||||
}
|
||||
|
||||
void ZVector::ParseXML(tinyxml2::XMLElement* reader)
|
||||
{
|
||||
ZResource::ParseXML(reader);
|
||||
@@ -33,9 +50,8 @@ void ZVector::ParseRawData()
|
||||
|
||||
for (uint32_t i = 0; i < dimensions; i++)
|
||||
{
|
||||
ZScalar scalar(scalarType, parent);
|
||||
scalar.rawDataIndex = currentRawDataIndex;
|
||||
scalar.ParseRawData();
|
||||
ZScalar scalar(parent);
|
||||
scalar.ExtractFromBinary(currentRawDataIndex, scalarType);
|
||||
currentRawDataIndex += scalar.GetRawDataSize();
|
||||
|
||||
scalars.push_back(scalar);
|
||||
@@ -83,21 +99,17 @@ std::string ZVector::GetSourceTypeName() const
|
||||
|
||||
std::string ZVector::GetBodySourceCode() const
|
||||
{
|
||||
std::string body = "";
|
||||
std::string body;
|
||||
|
||||
for (size_t i = 0; i < this->scalars.size(); i++)
|
||||
body += StringHelper::Sprintf("%6s, ", scalars[i].GetBodySourceCode().c_str());
|
||||
for (size_t i = 0; i < scalars.size(); i++)
|
||||
{
|
||||
body += StringHelper::Sprintf("%6s", scalars[i].GetBodySourceCode().c_str());
|
||||
|
||||
return "{ " + body + "}";
|
||||
}
|
||||
if (i + 1 < scalars.size())
|
||||
body += ", ";
|
||||
}
|
||||
|
||||
std::string ZVector::GetSourceOutputCode(const std::string& prefix)
|
||||
{
|
||||
if (parent != nullptr)
|
||||
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(),
|
||||
GetSourceTypeName(), GetName(), GetBodySourceCode());
|
||||
|
||||
return "";
|
||||
return body;
|
||||
}
|
||||
|
||||
ZResourceType ZVector::GetResourceType() const
|
||||
@@ -105,12 +117,11 @@ ZResourceType ZVector::GetResourceType() const
|
||||
return ZResourceType::Vector;
|
||||
}
|
||||
|
||||
void ZVector::SetScalarType(ZScalarType type)
|
||||
DeclarationAlignment ZVector::GetDeclarationAlignment() const
|
||||
{
|
||||
scalarType = type;
|
||||
}
|
||||
|
||||
void ZVector::SetDimensions(uint32_t dim)
|
||||
{
|
||||
dimensions = dim;
|
||||
if (scalars.size() == 0)
|
||||
{
|
||||
return DeclarationAlignment::Align4;
|
||||
}
|
||||
return scalars.at(0).GetDeclarationAlignment();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user