summaryrefslogtreecommitdiff
path: root/ZAPD/OtherStructs/SkinLimbStructs.cpp
diff options
context:
space:
mode:
authorYanis42 <35189056+Yanis42@users.noreply.github.com>2023-10-17 05:56:49 +0200
committerGitHub <noreply@github.com>2023-10-16 23:56:49 -0400
commit094e797349c86d0baef4a624962f4287aefdfef2 (patch)
treeee08bc4d0cba7fe53732d056627532bb2ffd605d /ZAPD/OtherStructs/SkinLimbStructs.cpp
parent338e35f89afc905399ad90c952d154ae7b20bf75 (diff)
Update old names to newer ones (#305)JackMaster
* JointKey -> LegacyJointKey * CamData -> BgCamInfo * TransformData -> CurveInterpKnot * TransformUpdateIndex -> CurveAnimationHeader * SkelCurveLimbList -> CurveSkeletonHeader * LightSettings -> EnvLightSettings * EntranceEntry -> Spawn * PolygonDlist -> RoomShapeDListsEntry * PolygonType0 -> RoomShapeNormal, MeshHeader1Single -> RoomShapeImageSingle * BgImage -> RoomShapeImageMultiBgEntry * MeshHeader1Multi -> RoomShapeImageMulti PolygonDlist2 -> RoomShapeCullableEntry * PolygonType2 -> RoomShapeCullable * SCENE_CMD_MESH -> SCENE_CMD_ROOM_SHAPE * implement enum parsing + use NaviQuestHintFileId * Struct_800A57C0 -> SkinVertex * Struct_800A598C_2 -> SkinTransformation * Struct_800A5E28 -> SkinAnimatedLimbData * Struct_800A598C -> SkinLimbModif * fix MM issues * LinkAnimationHeader -> PlayerAnimationHeader (MM) * CsCameraEntry -> ActorCsCamInfo (MM) * remaining scene commands (MM) * format * removed useless comment * name skinlimb members * format * fixed indentation
Diffstat (limited to 'ZAPD/OtherStructs/SkinLimbStructs.cpp')
-rw-r--r--ZAPD/OtherStructs/SkinLimbStructs.cpp247
1 files changed, 126 insertions, 121 deletions
diff --git a/ZAPD/OtherStructs/SkinLimbStructs.cpp b/ZAPD/OtherStructs/SkinLimbStructs.cpp
index 4c12062..e85bdef 100644
--- a/ZAPD/OtherStructs/SkinLimbStructs.cpp
+++ b/ZAPD/OtherStructs/SkinLimbStructs.cpp
@@ -6,149 +6,149 @@
#include "ZDisplayList.h"
#include "ZFile.h"
-/* Struct_800A57C0 */
+/* SkinVertex */
-Struct_800A57C0::Struct_800A57C0(ZFile* nParent) : ZResource(nParent)
+SkinVertex::SkinVertex(ZFile* nParent) : ZResource(nParent)
{
}
-void Struct_800A57C0::ParseRawData()
+void SkinVertex::ParseRawData()
{
const auto& rawData = parent->GetRawData();
- unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
- unk_2 = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
- unk_4 = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
- unk_6 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06);
- unk_7 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07);
- unk_8 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08);
- unk_9 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
+ index = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
+ s = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
+ t = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
+ normX = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06);
+ normY = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07);
+ normZ = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08);
+ alpha = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
}
-std::string Struct_800A57C0::GetBodySourceCode() const
+std::string SkinVertex::GetBodySourceCode() const
{
- return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", unk_0, unk_2, unk_4, unk_6,
- unk_7, unk_8, unk_9);
+ return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", index, s, t, normX, normY,
+ normZ, alpha);
}
-std::string Struct_800A57C0::GetSourceTypeName() const
+std::string SkinVertex::GetSourceTypeName() const
{
- return "Struct_800A57C0";
+ return "SkinVertex";
}
-ZResourceType Struct_800A57C0::GetResourceType() const
+ZResourceType SkinVertex::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t Struct_800A57C0::GetRawDataSize() const
+size_t SkinVertex::GetRawDataSize() const
{
return 0x0A;
}
-/* Struct_800A598C_2 */
+/* SkinTransformation */
-Struct_800A598C_2::Struct_800A598C_2(ZFile* nParent) : ZResource(nParent)
+SkinTransformation::SkinTransformation(ZFile* nParent) : ZResource(nParent)
{
}
-void Struct_800A598C_2::ParseRawData()
+void SkinTransformation::ParseRawData()
{
const auto& rawData = parent->GetRawData();
- unk_0 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00);
+ limbIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00);
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x06);
- unk_8 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
+ scale = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
}
-std::string Struct_800A598C_2::GetBodySourceCode() const
+std::string SkinTransformation::GetBodySourceCode() const
{
- return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", unk_0, x, y, z, unk_8);
+ return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", limbIndex, x, y, z, scale);
}
-std::string Struct_800A598C_2::GetSourceTypeName() const
+std::string SkinTransformation::GetSourceTypeName() const
{
- return "Struct_800A598C_2";
+ return "SkinTransformation";
}
-ZResourceType Struct_800A598C_2::GetResourceType() const
+ZResourceType SkinTransformation::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t Struct_800A598C_2::GetRawDataSize() const
+size_t SkinTransformation::GetRawDataSize() const
{
return 0x0A;
}
-/* Struct_800A598C */
+/* SkinLimbModif */
-Struct_800A598C::Struct_800A598C(ZFile* nParent) : ZResource(nParent)
+SkinLimbModif::SkinLimbModif(ZFile* nParent) : ZResource(nParent)
{
}
-void Struct_800A598C::ParseRawData()
+void SkinLimbModif::ParseRawData()
{
const auto& rawData = parent->GetRawData();
- unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
- unk_2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
+ vtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
+ transformCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
unk_4 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x04);
- unk_8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
- unk_C = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C);
+ skinVertices = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
+ limbTransformations = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C);
- if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
+ if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
{
- uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
+ uint32_t unk_8_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
- unk_8_arr.reserve(unk_0);
- for (size_t i = 0; i < unk_0; i++)
+ skinVertices_arr.reserve(vtxCount);
+ for (size_t i = 0; i < vtxCount; i++)
{
- Struct_800A57C0 unk8_data(parent);
- unk8_data.ExtractFromFile(unk_8_Offset);
- unk_8_arr.push_back(unk8_data);
+ SkinVertex skinVertices_data(parent);
+ skinVertices_data.ExtractFromFile(unk_8_Offset);
+ skinVertices_arr.push_back(skinVertices_data);
- unk_8_Offset += unk8_data.GetRawDataSize();
+ unk_8_Offset += skinVertices_data.GetRawDataSize();
}
}
- if (unk_C != 0 && GETSEGNUM(unk_8) == parent->segment)
+ if (limbTransformations != 0 && GETSEGNUM(skinVertices) == parent->segment)
{
- uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
+ uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
- unk_C_arr.reserve(unk_2);
- for (size_t i = 0; i < unk_2; i++)
+ limbTransformations_arr.reserve(transformCount);
+ for (size_t i = 0; i < transformCount; i++)
{
- Struct_800A598C_2 unkC_data(parent);
- unkC_data.ExtractFromFile(unk_C_Offset);
- unk_C_arr.push_back(unkC_data);
+ SkinTransformation limbTransformations_data(parent);
+ limbTransformations_data.ExtractFromFile(unk_C_Offset);
+ limbTransformations_arr.push_back(limbTransformations_data);
- unk_C_Offset += unkC_data.GetRawDataSize();
+ unk_C_Offset += limbTransformations_data.GetRawDataSize();
}
}
}
-void Struct_800A598C::DeclareReferences(const std::string& prefix)
+void SkinLimbModif::DeclareReferences(const std::string& prefix)
{
std::string varPrefix = prefix;
if (name != "")
varPrefix = name;
- if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
+ if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
{
- const auto& res = unk_8_arr.at(0);
+ const auto& res = skinVertices_arr.at(0);
std::string unk_8_Str = res.GetDefaultName(varPrefix);
- size_t arrayItemCnt = unk_8_arr.size();
+ size_t arrayItemCnt = skinVertices_arr.size();
std::string entryStr = "";
for (size_t i = 0; i < arrayItemCnt; i++)
{
- auto& child = unk_8_arr[i];
+ auto& child = skinVertices_arr[i];
child.DeclareReferences(varPrefix);
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
@@ -156,11 +156,11 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
entryStr += "\n";
}
- uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
- Declaration* decl = parent->GetDeclaration(unk_8_Offset);
+ uint32_t skinVertices_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
+ Declaration* decl = parent->GetDeclaration(skinVertices_Offset);
if (decl == nullptr)
{
- parent->AddDeclarationArray(unk_8_Offset, res.GetDeclarationAlignment(),
+ parent->AddDeclarationArray(skinVertices_Offset, res.GetDeclarationAlignment(),
arrayItemCnt * res.GetRawDataSize(),
res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr);
}
@@ -168,17 +168,17 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
decl->declBody = entryStr;
}
- if (unk_C != 0 && GETSEGNUM(unk_C) == parent->segment)
+ if (limbTransformations != 0 && GETSEGNUM(limbTransformations) == parent->segment)
{
- const auto& res = unk_C_arr.at(0);
+ const auto& res = limbTransformations_arr.at(0);
std::string unk_C_Str = res.GetDefaultName(varPrefix);
- size_t arrayItemCnt = unk_C_arr.size();
+ size_t arrayItemCnt = limbTransformations_arr.size();
std::string entryStr = "";
for (size_t i = 0; i < arrayItemCnt; i++)
{
- auto& child = unk_C_arr[i];
+ auto& child = limbTransformations_arr[i];
child.DeclareReferences(varPrefix);
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
@@ -186,7 +186,7 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
entryStr += "\n";
}
- uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
+ uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
Declaration* decl = parent->GetDeclaration(unk_C_Offset);
if (decl == nullptr)
{
@@ -199,69 +199,70 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
}
}
-std::string Struct_800A598C::GetBodySourceCode() const
+std::string SkinLimbModif::GetBodySourceCode() const
{
- std::string unk_8_Str;
+ std::string skinVertices_Str;
std::string unk_C_Str;
- Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Struct_800A57C0", unk_8_Str);
- Globals::Instance->GetSegmentedPtrName(unk_C, parent, "Struct_800A598C_2", unk_C_Str);
+ Globals::Instance->GetSegmentedPtrName(skinVertices, parent, "SkinVertex", skinVertices_Str);
+ Globals::Instance->GetSegmentedPtrName(limbTransformations, parent, "SkinTransformation",
+ unk_C_Str);
std::string entryStr = StringHelper::Sprintf("\n\t\tARRAY_COUNTU(%s), ARRAY_COUNTU(%s),\n",
- unk_8_Str.c_str(), unk_C_Str.c_str());
- entryStr +=
- StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, unk_8_Str.c_str(), unk_C_Str.c_str());
+ skinVertices_Str.c_str(), unk_C_Str.c_str());
+ entryStr += StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, skinVertices_Str.c_str(),
+ unk_C_Str.c_str());
return entryStr;
}
-std::string Struct_800A598C::GetSourceTypeName() const
+std::string SkinLimbModif::GetSourceTypeName() const
{
- return "Struct_800A598C";
+ return "SkinLimbModif";
}
-ZResourceType Struct_800A598C::GetResourceType() const
+ZResourceType SkinLimbModif::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t Struct_800A598C::GetRawDataSize() const
+size_t SkinLimbModif::GetRawDataSize() const
{
return 0x10;
}
-/* Struct_800A5E28 */
+/* SkinAnimatedLimbData */
-Struct_800A5E28::Struct_800A5E28(ZFile* nParent) : ZResource(nParent)
+SkinAnimatedLimbData::SkinAnimatedLimbData(ZFile* nParent) : ZResource(nParent)
{
}
-void Struct_800A5E28::ParseRawData()
+void SkinAnimatedLimbData::ParseRawData()
{
const auto& rawData = parent->GetRawData();
- unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
- unk_2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
- unk_4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
- unk_8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
+ totalVtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
+ limbModifCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
+ limbModifications = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
+ dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
- if (unk_4 != 0 && GETSEGNUM(unk_4) == parent->segment)
+ if (limbModifications != 0 && GETSEGNUM(limbModifications) == parent->segment)
{
- uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
+ uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
- unk_4_arr.reserve(unk_2);
- for (size_t i = 0; i < unk_2; i++)
+ limbModifications_arr.reserve(limbModifCount);
+ for (size_t i = 0; i < limbModifCount; i++)
{
- Struct_800A598C unk_4_data(parent);
- unk_4_data.ExtractFromFile(unk_4_Offset);
- unk_4_arr.push_back(unk_4_data);
+ SkinLimbModif limbModifications_data(parent);
+ limbModifications_data.ExtractFromFile(limbModifications_Offset);
+ limbModifications_arr.push_back(limbModifications_data);
- unk_4_Offset += unk_4_data.GetRawDataSize();
+ limbModifications_Offset += limbModifications_data.GetRawDataSize();
}
}
}
-void Struct_800A5E28::DeclareReferences(const std::string& prefix)
+void SkinAnimatedLimbData::DeclareReferences(const std::string& prefix)
{
std::string varPrefix = prefix;
if (name != "")
@@ -269,17 +270,17 @@ void Struct_800A5E28::DeclareReferences(const std::string& prefix)
ZResource::DeclareReferences(varPrefix);
- if (unk_4 != SEGMENTED_NULL && GETSEGNUM(unk_4) == parent->segment)
+ if (limbModifications != SEGMENTED_NULL && GETSEGNUM(limbModifications) == parent->segment)
{
- const auto& res = unk_4_arr.at(0);
- std::string unk_4_Str = res.GetDefaultName(varPrefix);
+ const auto& res = limbModifications_arr.at(0);
+ std::string limbModifications_Str = res.GetDefaultName(varPrefix);
- size_t arrayItemCnt = unk_4_arr.size();
+ size_t arrayItemCnt = limbModifications_arr.size();
std::string entryStr = "";
for (size_t i = 0; i < arrayItemCnt; i++)
{
- auto& child = unk_4_arr[i];
+ auto& child = limbModifications_arr[i];
child.DeclareReferences(varPrefix);
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
@@ -287,63 +288,67 @@ void Struct_800A5E28::DeclareReferences(const std::string& prefix)
entryStr += "\n";
}
- uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
- Declaration* decl = parent->GetDeclaration(unk_4_Offset);
+ uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
+ Declaration* decl = parent->GetDeclaration(limbModifications_Offset);
if (decl == nullptr)
{
- parent->AddDeclarationArray(unk_4_Offset, res.GetDeclarationAlignment(),
+ parent->AddDeclarationArray(limbModifications_Offset, res.GetDeclarationAlignment(),
arrayItemCnt * res.GetRawDataSize(),
- res.GetSourceTypeName(), unk_4_Str, arrayItemCnt, entryStr);
+ res.GetSourceTypeName(), limbModifications_Str,
+ arrayItemCnt, entryStr);
}
else
decl->declBody = entryStr;
}
- if (unk_8 != SEGMENTED_NULL && GETSEGNUM(unk_8) == parent->segment)
+ if (dlist != SEGMENTED_NULL && GETSEGNUM(dlist) == parent->segment)
{
- uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
+ uint32_t dlist_Offset = Seg2Filespace(dlist, parent->baseAddress);
int32_t dlistLength = ZDisplayList::GetDListLength(
- parent->GetRawData(), unk_8_Offset,
+ parent->GetRawData(), dlist_Offset,
Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX);
- ZDisplayList* unk_8_dlist = new ZDisplayList(parent);
- unk_8_dlist->ExtractFromBinary(unk_8_Offset, dlistLength);
+ ZDisplayList* dlist_data = new ZDisplayList(parent);
+ dlist_data->ExtractFromBinary(dlist_Offset, dlistLength);
std::string dListStr =
- StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), unk_8_Offset);
- unk_8_dlist->SetName(dListStr);
- unk_8_dlist->DeclareVar(varPrefix, "");
- unk_8_dlist->DeclareReferences(varPrefix);
- parent->AddResource(unk_8_dlist);
+ StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), dlist_Offset);
+ dlist_data->SetName(dListStr);
+ dlist_data->DeclareVar(varPrefix, "");
+ dlist_data->DeclareReferences(varPrefix);
+ parent->AddResource(dlist_data);
}
}
-std::string Struct_800A5E28::GetBodySourceCode() const
+std::string SkinAnimatedLimbData::GetBodySourceCode() const
{
- std::string unk_4_Str;
- std::string unk_8_Str;
- Globals::Instance->GetSegmentedPtrName(unk_4, parent, "Struct_800A598C", unk_4_Str);
- Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Gfx", unk_8_Str);
+ std::string limbModifications_Str;
+ std::string dlist_Str;
+ Globals::Instance->GetSegmentedPtrName(limbModifications, parent, "SkinLimbModif",
+ limbModifications_Str);
+ Globals::Instance->GetSegmentedPtrName(dlist, parent, "Gfx", dlist_Str);
std::string entryStr = "\n";
- entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", unk_0, unk_4_Str.c_str());
- entryStr += StringHelper::Sprintf("\t%s, %s\n", unk_4_Str.c_str(), unk_8_Str.c_str());
+ entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", totalVtxCount,
+ limbModifications_Str.c_str());
+ entryStr +=
+ StringHelper::Sprintf("\t%s, %s\n", limbModifications_Str.c_str(), dlist_Str.c_str());
return entryStr;
}
-std::string Struct_800A5E28::GetSourceTypeName() const
+std::string SkinAnimatedLimbData::GetSourceTypeName() const
{
- return "Struct_800A5E28";
+ return "SkinAnimatedLimbData";
}
-ZResourceType Struct_800A5E28::GetResourceType() const
+ZResourceType SkinAnimatedLimbData::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t Struct_800A5E28::GetRawDataSize() const
+size_t SkinAnimatedLimbData::GetRawDataSize() const
{
return 0x0C;
}