mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 07:07:09 +00:00
4e55168eaa
* git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "094e79734" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "094e79734" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb" * Add EnumData.xml where some names are now externalized * Remove legacy typedefs for zapd, no longer needed!
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
#include "ZWaterbox.h"
|
|
|
|
#include "Globals.h"
|
|
#include "Utils/BitConverter.h"
|
|
#include "Utils/StringHelper.h"
|
|
|
|
REGISTER_ZFILENODE(Waterbox, ZWaterbox);
|
|
|
|
ZWaterbox::ZWaterbox(ZFile* nParent) : ZResource(nParent)
|
|
{
|
|
}
|
|
|
|
ZWaterbox::~ZWaterbox()
|
|
{
|
|
}
|
|
|
|
void ZWaterbox::ParseRawData()
|
|
{
|
|
const auto& rawData = parent->GetRawData();
|
|
|
|
xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
|
ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
|
zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
|
xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
|
|
zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
|
|
|
if (Globals::Instance->game == ZGame::OOT_SW97)
|
|
properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
|
else
|
|
properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12);
|
|
}
|
|
|
|
void ZWaterbox::DeclareReferences(const std::string& prefix)
|
|
{
|
|
std::string declaration;
|
|
std::string auxName = name;
|
|
|
|
if (name == "")
|
|
auxName = GetDefaultName(prefix);
|
|
|
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
|
|
GetSourceTypeName(), name.c_str(), GetBodySourceCode());
|
|
}
|
|
|
|
std::string ZWaterbox::GetBodySourceCode() const
|
|
{
|
|
return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength,
|
|
zLength, properties);
|
|
}
|
|
|
|
std::string ZWaterbox::GetDefaultName(const std::string& prefix) const
|
|
{
|
|
return StringHelper::Sprintf("%sWaterBoxes_%06X", prefix.c_str(), rawDataIndex);
|
|
}
|
|
|
|
ZResourceType ZWaterbox::GetResourceType() const
|
|
{
|
|
return ZResourceType::Waterbox;
|
|
}
|
|
|
|
size_t ZWaterbox::GetRawDataSize() const
|
|
{
|
|
return 16;
|
|
}
|
|
|
|
std::string ZWaterbox::GetSourceTypeName() const
|
|
{
|
|
return "WaterBox";
|
|
}
|
|
|
|
bool ZWaterbox::DoesSupportArray() const
|
|
{
|
|
return true;
|
|
}
|