summaryrefslogtreecommitdiff
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
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
-rw-r--r--ExporterTest/RoomExporter.cpp2
-rw-r--r--ZAPD/GameConfig.cpp33
-rw-r--r--ZAPD/GameConfig.h5
-rw-r--r--ZAPD/OtherStructs/CutsceneMM_Commands.cpp51
-rw-r--r--ZAPD/OtherStructs/CutsceneOoT_Commands.cpp36
-rw-r--r--ZAPD/OtherStructs/SkinLimbStructs.cpp247
-rw-r--r--ZAPD/OtherStructs/SkinLimbStructs.h68
-rw-r--r--ZAPD/ZAnimation.cpp45
-rw-r--r--ZAPD/ZAnimation.h24
-rw-r--r--ZAPD/ZCollision.cpp6
-rw-r--r--ZAPD/ZLimb.cpp6
-rw-r--r--ZAPD/ZLimb.h6
-rw-r--r--ZAPD/ZRoom/Commands/SetCameraSettings.cpp9
-rw-r--r--ZAPD/ZRoom/Commands/SetCsCamera.cpp18
-rw-r--r--ZAPD/ZRoom/Commands/SetCsCamera.h6
-rw-r--r--ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp8
-rw-r--r--ZAPD/ZRoom/Commands/SetCutscenes.cpp8
-rw-r--r--ZAPD/ZRoom/Commands/SetEntranceList.cpp23
-rw-r--r--ZAPD/ZRoom/Commands/SetEntranceList.h6
-rw-r--r--ZAPD/ZRoom/Commands/SetLightingSettings.cpp22
-rw-r--r--ZAPD/ZRoom/Commands/SetMesh.cpp85
-rw-r--r--ZAPD/ZRoom/Commands/SetMesh.h23
-rw-r--r--ZAPD/ZRoom/Commands/SetSpecialObjects.cpp6
-rw-r--r--ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp6
-rw-r--r--ZAPD/ZRoom/ZRoom.cpp2
-rw-r--r--ZAPD/ZSkeleton.cpp2
26 files changed, 398 insertions, 355 deletions
diff --git a/ExporterTest/RoomExporter.cpp b/ExporterTest/RoomExporter.cpp
index 9a5ea19..4cc06b7 100644
--- a/ExporterTest/RoomExporter.cpp
+++ b/ExporterTest/RoomExporter.cpp
@@ -290,7 +290,7 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
- for (EntranceEntry entry : cmdEntrance->entrances)
+ for (Spawn entry : cmdEntrance->entrances)
{
writer->Write((uint8_t)entry.startPositionIndex);
writer->Write((uint8_t)entry.roomToLoad);
diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp
index fffa7f4..a6e3bdb 100644
--- a/ZAPD/GameConfig.cpp
+++ b/ZAPD/GameConfig.cpp
@@ -174,7 +174,7 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element)
if (eResult != tinyxml2::XML_SUCCESS)
{
- throw std::runtime_error("Error: Unable to read cutscene data.");
+ throw std::runtime_error("Error: Unable to read enum data.");
}
tinyxml2::XMLNode* root = doc.FirstChild();
@@ -194,47 +194,50 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element)
// Common
if (enumKey == "cmd")
- cutsceneData.cutsceneCmd[itemIndex] = itemID;
+ enumData.cutsceneCmd[itemIndex] = itemID;
else if (enumKey == "miscType")
- cutsceneData.miscType[itemIndex] = itemID;
+ enumData.miscType[itemIndex] = itemID;
else if (enumKey == "textType")
- cutsceneData.textType[itemIndex] = itemID;
+ enumData.textType[itemIndex] = itemID;
else if (enumKey == "fadeOutSeqPlayer")
- cutsceneData.fadeOutSeqPlayer[itemIndex] = itemID;
+ enumData.fadeOutSeqPlayer[itemIndex] = itemID;
else if (enumKey == "transitionType")
- cutsceneData.transitionType[itemIndex] = itemID;
+ enumData.transitionType[itemIndex] = itemID;
else if (enumKey == "destination")
- cutsceneData.destination[itemIndex] = itemID;
+ enumData.destination[itemIndex] = itemID;
+
+ else if (enumKey == "naviQuestHintType")
+ enumData.naviQuestHintType[itemIndex] = itemID;
// MM
else if (enumKey == "modifySeqType")
- cutsceneData.modifySeqType[itemIndex] = itemID;
+ enumData.modifySeqType[itemIndex] = itemID;
else if (enumKey == "chooseCreditsSceneType")
- cutsceneData.chooseCreditsSceneType[itemIndex] = itemID;
+ enumData.chooseCreditsSceneType[itemIndex] = itemID;
else if (enumKey == "destinationType")
- cutsceneData.destinationType[itemIndex] = itemID;
+ enumData.destinationType[itemIndex] = itemID;
else if (enumKey == "motionBlurType")
- cutsceneData.motionBlurType[itemIndex] = itemID;
+ enumData.motionBlurType[itemIndex] = itemID;
else if (enumKey == "transitionGeneralType")
- cutsceneData.transitionGeneralType[itemIndex] = itemID;
+ enumData.transitionGeneralType[itemIndex] = itemID;
else if (enumKey == "rumbleType")
- cutsceneData.rumbleType[itemIndex] = itemID;
+ enumData.rumbleType[itemIndex] = itemID;
else if (enumKey == "spawnFlag")
- cutsceneData.spawnFlag[itemIndex] = itemID;
+ enumData.spawnFlag[itemIndex] = itemID;
else if (enumKey == "endSfx")
- cutsceneData.endSfx[itemIndex] = itemID;
+ enumData.endSfx[itemIndex] = itemID;
}
}
}
diff --git a/ZAPD/GameConfig.h b/ZAPD/GameConfig.h
index 4278532..0eb3f02 100644
--- a/ZAPD/GameConfig.h
+++ b/ZAPD/GameConfig.h
@@ -22,7 +22,7 @@ public:
};
// Stores data from the XML file, the integer is the index (via ATOI) and the string is the value
-class CutsceneEnumData
+class EnumData
{
public:
// Common
@@ -30,6 +30,7 @@ public:
std::map<uint16_t, std::string> miscType;
std::map<uint16_t, std::string> fadeOutSeqPlayer;
std::map<uint16_t, std::string> transitionType;
+ std::map<uint16_t, std::string> naviQuestHintType;
// OoT
std::map<uint16_t, std::string> textType;
@@ -59,7 +60,7 @@ public:
std::vector<std::string> entranceList;
std::vector<std::string> specialEntranceList;
std::map<uint32_t, TexturePoolEntry> texturePool; // Key = CRC
- CutsceneEnumData cutsceneData;
+ EnumData enumData;
// ZBackground
uint32_t bgScreenWidth = 320, bgScreenHeight = 240;
diff --git a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
index f0bd68a..85fce22 100644
--- a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
+++ b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
@@ -37,7 +37,7 @@ CutsceneMMSubCommandEntry_GenericCmd::CutsceneMMSubCommandEntry_GenericCmd(
std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
const auto& element = csCommandsDescMM.find(commandId);
std::string entryFmt = "CS_UNK_DATA(0x%02X, %i, %i, %i)";
std::string type = "";
@@ -49,29 +49,28 @@ std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const
}
if (commandId == CutsceneMM_CommandType::CS_CMD_MISC &&
- cutsceneData->miscType.find(base) != cutsceneData->miscType.end())
- type = cutsceneData->miscType[base];
+ enumData->miscType.find(base) != enumData->miscType.end())
+ type = enumData->miscType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_TRANSITION &&
- cutsceneData->transitionType.find(base) != cutsceneData->transitionType.end())
- type = cutsceneData->transitionType[base];
+ enumData->transitionType.find(base) != enumData->transitionType.end())
+ type = enumData->transitionType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_MOTION_BLUR &&
- cutsceneData->motionBlurType.find(base) != cutsceneData->motionBlurType.end())
- type = cutsceneData->motionBlurType[base];
+ enumData->motionBlurType.find(base) != enumData->motionBlurType.end())
+ type = enumData->motionBlurType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ &&
- cutsceneData->modifySeqType.find(base) != cutsceneData->modifySeqType.end())
- type = cutsceneData->modifySeqType[base];
+ enumData->modifySeqType.find(base) != enumData->modifySeqType.end())
+ type = enumData->modifySeqType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_DESTINATION &&
- cutsceneData->destinationType.find(base) != cutsceneData->destinationType.end())
- type = cutsceneData->destinationType[base];
+ enumData->destinationType.find(base) != enumData->destinationType.end())
+ type = enumData->destinationType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES &&
- cutsceneData->chooseCreditsSceneType.find(base) !=
- cutsceneData->chooseCreditsSceneType.end())
- type = cutsceneData->chooseCreditsSceneType[base];
+ enumData->chooseCreditsSceneType.find(base) != enumData->chooseCreditsSceneType.end())
+ type = enumData->chooseCreditsSceneType[base];
else if (commandId == CutsceneMM_CommandType::CS_CMD_GIVE_TATL)
type = base ? "true" : "false";
@@ -173,11 +172,11 @@ CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGen
std::string CutsceneSubCommandEntry_TransitionGeneral::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->transitionGeneralType.find(base) != cutsceneData->transitionGeneralType.end())
+ if (enumData->transitionGeneralType.find(base) != enumData->transitionGeneralType.end())
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(%s, %i, %i, %i, %i, %i)",
- cutsceneData->transitionGeneralType[base].c_str(), startFrame,
+ enumData->transitionGeneralType[base].c_str(), startFrame,
endFrame, unk_06, unk_07, unk_08);
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(0x%02X, %i, %i, %i, %i, %i)", base,
@@ -220,11 +219,11 @@ CutsceneSubCommandEntry_FadeOutSeq::CutsceneSubCommandEntry_FadeOutSeq(
std::string CutsceneSubCommandEntry_FadeOutSeq::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->fadeOutSeqPlayer.find(base) != cutsceneData->fadeOutSeqPlayer.end())
+ if (enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end())
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%s, %i, %i)",
- cutsceneData->fadeOutSeqPlayer[base].c_str(), startFrame,
+ enumData->fadeOutSeqPlayer[base].c_str(), startFrame,
endFrame);
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%i, %i, %i)", base, startFrame, endFrame);
@@ -291,11 +290,11 @@ CutsceneMMSubCommandEntry_Rumble::CutsceneMMSubCommandEntry_Rumble(
std::string CutsceneMMSubCommandEntry_Rumble::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->rumbleType.find(base) != cutsceneData->rumbleType.end())
+ if (enumData->rumbleType.find(base) != enumData->rumbleType.end())
return StringHelper::Sprintf("CS_RUMBLE(%s, %i, %i, 0x%02X, 0x%02X, 0x%02X)",
- cutsceneData->rumbleType[base].c_str(), startFrame, endFrame,
+ enumData->rumbleType[base].c_str(), startFrame, endFrame,
intensity, decayTimer, decayStep);
return StringHelper::Sprintf("CS_RUMBLE(0x%04X, %i, %i, 0x%02X, 0x%02X, 0x%02X)", base,
@@ -467,17 +466,17 @@ CutsceneMMCommand_ActorCue::CutsceneMMCommand_ActorCue(const std::vector<uint8_t
std::string CutsceneMMCommand_ActorCue::GetCommandMacro() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
if (static_cast<CutsceneMM_CommandType>(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE)
{
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", numEntries);
}
- if (cutsceneData->cutsceneCmd.find(commandID) != cutsceneData->cutsceneCmd.end())
+ if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
{
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
- cutsceneData->cutsceneCmd[commandID].c_str(), numEntries);
+ enumData->cutsceneCmd[commandID].c_str(), numEntries);
}
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%03X, %i)", commandID, numEntries);
}
diff --git a/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp b/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
index 367be0e..e38bfb6 100644
--- a/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
+++ b/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
@@ -43,22 +43,22 @@ CutsceneOoTSubCommandEntry_GenericCmd::CutsceneOoTSubCommandEntry_GenericCmd(
std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
const auto& element = csCommandsDesc.find(commandId);
if (element != csCommandsDesc.end())
{
- bool isIndexInMisc = cutsceneData->miscType.find(base) != cutsceneData->miscType.end();
+ bool isIndexInMisc = enumData->miscType.find(base) != enumData->miscType.end();
bool isIndexInFade =
- cutsceneData->fadeOutSeqPlayer.find(base) != cutsceneData->fadeOutSeqPlayer.end();
+ enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end();
std::string entryFmt = element->second.cmdMacro;
std::string firstArg;
entryFmt += element->second.args;
if (commandId == CutsceneOoT_CommandType::CS_CMD_MISC && isIndexInMisc)
- firstArg = cutsceneData->miscType[base];
+ firstArg = enumData->miscType[base];
else if (commandId == CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ && isIndexInFade)
- firstArg = cutsceneData->fadeOutSeqPlayer[base];
+ firstArg = enumData->fadeOutSeqPlayer[base];
else
{
bool baseOne = (commandId == CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING ||
@@ -264,7 +264,7 @@ CutsceneOoTSubCommandEntry_Text::CutsceneOoTSubCommandEntry_Text(
std::string CutsceneOoTSubCommandEntry_Text::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
if (type == 0xFFFF)
{
@@ -276,11 +276,10 @@ std::string CutsceneOoTSubCommandEntry_Text::GetBodySourceCode() const
endFrame, textId1);
}
- if (cutsceneData->textType.find(type) != cutsceneData->textType.end())
+ if (enumData->textType.find(type) != enumData->textType.end())
{
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %s, 0x%X, 0x%X)", base, startFrame,
- endFrame, cutsceneData->textType[type].c_str(), textId1,
- textId2);
+ endFrame, enumData->textType[type].c_str(), textId1, textId2);
}
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %i, 0x%X, 0x%X)", base, startFrame,
@@ -376,7 +375,7 @@ CutsceneOoTCommand_ActorCue::CutsceneOoTCommand_ActorCue(const std::vector<uint8
std::string CutsceneOoTCommand_ActorCue::GetCommandMacro() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE)
@@ -384,10 +383,10 @@ std::string CutsceneOoTCommand_ActorCue::GetCommandMacro() const
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", entries.size());
}
- if (cutsceneData->cutsceneCmd.find(commandID) != cutsceneData->cutsceneCmd.end())
+ if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
{
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
- cutsceneData->cutsceneCmd[commandID].c_str(), entries.size());
+ enumData->cutsceneCmd[commandID].c_str(), entries.size());
}
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%04X, %i)", commandID, entries.size());
@@ -409,12 +408,12 @@ CutsceneOoTCommand_Destination::CutsceneOoTCommand_Destination(const std::vector
std::string CutsceneOoTCommand_Destination::GenerateSourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->destination.find(base) != cutsceneData->destination.end())
+ if (enumData->destination.find(base) != enumData->destination.end())
{
return StringHelper::Sprintf("CS_DESTINATION(%s, %i, %i),\n",
- cutsceneData->destination[base].c_str(), startFrame, endFrame);
+ enumData->destination[base].c_str(), startFrame, endFrame);
}
return StringHelper::Sprintf("CS_DESTINATION(%i, %i, %i),\n", base, startFrame, endFrame);
@@ -440,13 +439,12 @@ CutsceneOoTCommand_Transition::CutsceneOoTCommand_Transition(const std::vector<u
std::string CutsceneOoTCommand_Transition::GenerateSourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->transitionType.find(base) != cutsceneData->transitionType.end())
+ if (enumData->transitionType.find(base) != enumData->transitionType.end())
{
return StringHelper::Sprintf("CS_TRANSITION(%s, %i, %i),\n",
- cutsceneData->transitionType[base].c_str(), startFrame,
- endFrame);
+ enumData->transitionType[base].c_str(), startFrame, endFrame);
}
return StringHelper::Sprintf("CS_TRANSITION(%i, %i, %i),\n", base, startFrame, endFrame);
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;
}
diff --git a/ZAPD/OtherStructs/SkinLimbStructs.h b/ZAPD/OtherStructs/SkinLimbStructs.h
index 33edd07..5181bc5 100644
--- a/ZAPD/OtherStructs/SkinLimbStructs.h
+++ b/ZAPD/OtherStructs/SkinLimbStructs.h
@@ -6,19 +6,17 @@
#include "ZResource.h"
-// TODO: check if more types exists
enum class ZLimbSkinType
{
- SkinType_0, // Segment = 0
- SkinType_4 = 4, // Segment = segmented address // Struct_800A5E28
- SkinType_5 = 5, // Segment = 0
- SkinType_DList = 11, // Segment = DList address
+ SkinType_Null, // SkinLimb segment = NULL
+ SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData*
+ SkinType_Normal = 11, // SkinLimb segment = Gfx*
};
-class Struct_800A57C0 : public ZResource
+class SkinVertex : public ZResource
{
public:
- Struct_800A57C0(ZFile* nParent);
+ SkinVertex(ZFile* nParent);
void ParseRawData() override;
@@ -30,19 +28,19 @@ public:
size_t GetRawDataSize() const override;
protected:
- uint16_t unk_0;
- int16_t unk_2;
- int16_t unk_4;
- int8_t unk_6;
- int8_t unk_7;
- int8_t unk_8;
- uint8_t unk_9;
+ uint16_t index;
+ int16_t s;
+ int16_t t;
+ int8_t normX;
+ int8_t normY;
+ int8_t normZ;
+ uint8_t alpha;
};
-class Struct_800A598C_2 : public ZResource
+class SkinTransformation : public ZResource
{
public:
- Struct_800A598C_2(ZFile* nParent);
+ SkinTransformation(ZFile* nParent);
void ParseRawData() override;
@@ -54,17 +52,17 @@ public:
size_t GetRawDataSize() const override;
protected:
- uint8_t unk_0;
+ uint8_t limbIndex;
int16_t x;
int16_t y;
int16_t z;
- uint8_t unk_8;
+ uint8_t scale;
};
-class Struct_800A598C : public ZResource
+class SkinLimbModif : public ZResource
{
public:
- Struct_800A598C(ZFile* nParent);
+ SkinLimbModif(ZFile* nParent);
void ParseRawData() override;
void DeclareReferences(const std::string& prefix) override;
@@ -77,20 +75,20 @@ public:
size_t GetRawDataSize() const override;
protected:
- uint16_t unk_0; // Length of unk_8
- uint16_t unk_2; // Length of unk_C
- uint16_t unk_4; // 0 or 1 // Used as an index for unk_C
- segptr_t unk_8; // Struct_800A57C0*
- segptr_t unk_C; // Struct_800A598C_2*
-
- std::vector<Struct_800A57C0> unk_8_arr;
- std::vector<Struct_800A598C_2> unk_C_arr;
+ uint16_t vtxCount; // Number of vertices in this modif entry
+ uint16_t transformCount; // Length of limbTransformations
+ uint16_t unk_4; // 0 or 1, used as an index for limbTransformations
+ segptr_t skinVertices; // SkinVertex*
+ segptr_t limbTransformations; // SkinTransformation*
+
+ std::vector<SkinVertex> skinVertices_arr;
+ std::vector<SkinTransformation> limbTransformations_arr;
};
-class Struct_800A5E28 : public ZResource
+class SkinAnimatedLimbData : public ZResource
{
public:
- Struct_800A5E28(ZFile* nParent);
+ SkinAnimatedLimbData(ZFile* nParent);
void ParseRawData() override;
void DeclareReferences(const std::string& prefix) override;
@@ -103,11 +101,11 @@ public:
size_t GetRawDataSize() const override;
protected:
- uint16_t unk_0; // Vtx count
- uint16_t unk_2; // Length of unk_4
- segptr_t unk_4; // Struct_800A598C*
- segptr_t unk_8; // Gfx*
+ uint16_t totalVtxCount;
+ uint16_t limbModifCount; // Length of limbModifications
+ segptr_t limbModifications; // SkinLimbModif*
+ segptr_t dlist; // Gfx*
- std::vector<Struct_800A598C> unk_4_arr;
+ std::vector<SkinLimbModif> limbModifications_arr;
// ZDisplayList* unk_8_dlist = nullptr;
};
diff --git a/ZAPD/ZAnimation.cpp b/ZAPD/ZAnimation.cpp
index 0d72344..959fff8 100644
--- a/ZAPD/ZAnimation.cpp
+++ b/ZAPD/ZAnimation.cpp
@@ -153,7 +153,10 @@ size_t ZLinkAnimation::GetRawDataSize() const
std::string ZLinkAnimation::GetSourceTypeName() const
{
- return "LinkAnimationHeader";
+ if (Globals::Instance->game == ZGame::MM_RETAIL)
+ return "PlayerAnimationHeader";
+ else
+ return "LinkAnimationHeader";
}
void ZLinkAnimation::ParseRawData()
@@ -174,8 +177,8 @@ std::string ZLinkAnimation::GetBodySourceCode() const
/* ZCurveAnimation */
-TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
- uint32_t fileOffset)
+CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData,
+ uint32_t fileOffset)
: parent(parent)
{
unk_00 = BitConverter::ToUInt16BE(rawData, fileOffset + 0);
@@ -185,26 +188,26 @@ TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
unk_08 = BitConverter::ToFloatBE(rawData, fileOffset + 8);
}
-TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
- uint32_t fileOffset, size_t index)
- : TransformData(parent, rawData, fileOffset + index * GetRawDataSize())
+CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData,
+ uint32_t fileOffset, size_t index)
+ : CurveInterpKnot(parent, rawData, fileOffset + index * GetRawDataSize())
{
}
-std::string TransformData::GetBody([[maybe_unused]] const std::string& prefix) const
+std::string CurveInterpKnot::GetBody([[maybe_unused]] const std::string& prefix) const
{
return StringHelper::Sprintf("0x%04X, 0x%04X, %i, %i, %ff", unk_00, unk_02, unk_04, unk_06,
unk_08);
}
-size_t TransformData::GetRawDataSize() const
+size_t CurveInterpKnot::GetRawDataSize() const
{
return 0x0C;
}
-std::string TransformData::GetSourceTypeName()
+std::string CurveInterpKnot::GetSourceTypeName()
{
- return "TransformData";
+ return "CurveInterpKnot";
}
ZCurveAnimation::ZCurveAnimation(ZFile* nParent) : ZAnimation(nParent)
@@ -369,7 +372,7 @@ std::string ZCurveAnimation::GetBodySourceCode() const
std::string refIndexStr;
Globals::Instance->GetSegmentedPtrName(refIndex, parent, "u8", refIndexStr);
std::string transformDataStr;
- Globals::Instance->GetSegmentedPtrName(transformData, parent, "TransformData",
+ Globals::Instance->GetSegmentedPtrName(transformData, parent, "CurveInterpKnot",
transformDataStr);
std::string copyValuesStr;
Globals::Instance->GetSegmentedPtrName(copyValues, parent, "s16", copyValuesStr);
@@ -390,7 +393,7 @@ DeclarationAlignment ZCurveAnimation::GetDeclarationAlignment() const
std::string ZCurveAnimation::GetSourceTypeName() const
{
- return "TransformUpdateIndex";
+ return "CurveAnimationHeader";
}
/* ZLegacyAnimation */
@@ -423,7 +426,7 @@ void ZLegacyAnimation::ParseRawData()
ptr = jointKeyOffset;
for (int32_t i = 0; i < limbCount + 1; i++)
{
- JointKey key(parent);
+ LegacyJointKey key(parent);
key.ExtractFromFile(ptr);
jointKeyArray.push_back(key);
@@ -495,7 +498,7 @@ std::string ZLegacyAnimation::GetBodySourceCode() const
std::string frameDataName;
std::string jointKeyName;
Globals::Instance->GetSegmentedPtrName(frameData, parent, "s16", frameDataName);
- Globals::Instance->GetSegmentedPtrName(jointKey, parent, "JointKey", jointKeyName);
+ Globals::Instance->GetSegmentedPtrName(jointKey, parent, "LegacyJointKey", jointKeyName);
body += StringHelper::Sprintf("\t%i, %i,\n", frameCount, limbCount);
body += StringHelper::Sprintf("\t%s,\n", frameDataName.c_str());
@@ -514,11 +517,11 @@ size_t ZLegacyAnimation::GetRawDataSize() const
return 0x0C;
}
-JointKey::JointKey(ZFile* nParent) : ZResource(nParent)
+LegacyJointKey::LegacyJointKey(ZFile* nParent) : ZResource(nParent)
{
}
-void JointKey::ParseRawData()
+void LegacyJointKey::ParseRawData()
{
ZResource::ParseRawData();
@@ -531,23 +534,23 @@ void JointKey::ParseRawData()
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x0A);
}
-std::string JointKey::GetBodySourceCode() const
+std::string LegacyJointKey::GetBodySourceCode() const
{
return StringHelper::Sprintf("%6i, %6i, %6i, %6i, %6i, %6i", xMax, x, yMax, y, zMax, z);
}
-std::string JointKey::GetSourceTypeName() const
+std::string LegacyJointKey::GetSourceTypeName() const
{
- return "JointKey";
+ return "LegacyJointKey";
}
-ZResourceType JointKey::GetResourceType() const
+ZResourceType LegacyJointKey::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t JointKey::GetRawDataSize() const
+size_t LegacyJointKey::GetRawDataSize() const
{
return 0x0C;
}
diff --git a/ZAPD/ZAnimation.h b/ZAPD/ZAnimation.h
index 2c04b4f..643842b 100644
--- a/ZAPD/ZAnimation.h
+++ b/ZAPD/ZAnimation.h
@@ -67,7 +67,7 @@ public:
void ParseRawData() override;
};
-class TransformData
+class CurveInterpKnot
{
protected:
ZFile* parent;
@@ -84,10 +84,10 @@ protected:
float unk_08;
public:
- TransformData() = default;
- TransformData(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset);
- TransformData(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset,
- size_t index);
+ CurveInterpKnot() = default;
+ CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset);
+ CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset,
+ size_t index);
[[nodiscard]] std::string GetBody(const std::string& prefix) const;
@@ -102,7 +102,7 @@ protected:
///* 0x0000 */ u8* refIndex;
segptr_t refIndex = 0;
- ///* 0x0004 */ TransformData* transformData;
+ ///* 0x0004 */ CurveInterpKnot* transformData;
segptr_t transformData = 0;
///* 0x0008 */ s16* copyValues;
segptr_t copyValues = 0;
@@ -114,7 +114,7 @@ protected:
uint8_t limbCount = 0;
std::vector<uint8_t> refIndexArr;
- std::vector<TransformData> transformDataArr;
+ std::vector<CurveInterpKnot> transformDataArr;
std::vector<int16_t> copyValuesArr;
public:
@@ -132,14 +132,14 @@ public:
std::string GetSourceTypeName() const override;
};
-// TransformUpdateIndex
+// CurveAnimationHeader
/* ZLegacyAnimation */
-class JointKey : public ZResource
+class LegacyJointKey : public ZResource
{
public:
- JointKey(ZFile* nParent);
+ LegacyJointKey(ZFile* nParent);
void ParseRawData() override;
std::string GetBodySourceCode() const override;
@@ -172,8 +172,8 @@ public:
protected:
int16_t limbCount;
segptr_t frameData; // s16*
- segptr_t jointKey; // JointKey*
+ segptr_t jointKey; // LegacyJointKey*
std::vector<uint16_t> frameDataArray;
- std::vector<JointKey> jointKeyArray;
+ std::vector<LegacyJointKey> jointKeyArray;
};
diff --git a/ZAPD/ZCollision.cpp b/ZAPD/ZCollision.cpp
index 8c19316..d177e03 100644
--- a/ZAPD/ZCollision.cpp
+++ b/ZAPD/ZCollision.cpp
@@ -99,7 +99,7 @@ void ZCollisionHeader::ParseRawData()
// usually ordered. If for some reason the data was in some other funny
// order, this would probably break.
// The most common ordering is:
- // - *CamData*
+ // - *BgCamInfo*
// - SurfaceType
// - CollisionPoly
// - Vertices
@@ -261,7 +261,7 @@ std::string ZCollisionHeader::GetBodySourceCode() const
declaration += StringHelper::Sprintf("\t%s,\n", surfaceName.c_str());
std::string camName;
- Globals::Instance->GetSegmentedPtrName(camDataAddress, parent, "CamData", camName);
+ Globals::Instance->GetSegmentedPtrName(camDataAddress, parent, "BgCamInfo", camName);
declaration += StringHelper::Sprintf("\t%s,\n", camName.c_str());
std::string waterBoxName;
@@ -370,7 +370,7 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix,
}
parent->AddDeclarationArray(
- rawDataIndex, DeclarationAlignment::Align4, entries.size() * 8, "CamData",
+ rawDataIndex, DeclarationAlignment::Align4, entries.size() * 8, "BgCamInfo",
StringHelper::Sprintf("%sCamDataList", prefix.c_str(), rawDataIndex), entries.size(),
declaration);
diff --git a/ZAPD/ZLimb.cpp b/ZAPD/ZLimb.cpp
index fd824d0..b3acb94 100644
--- a/ZAPD/ZLimb.cpp
+++ b/ZAPD/ZLimb.cpp
@@ -106,7 +106,7 @@ void ZLimb::ParseRawData()
skinSegmentType =
static_cast<ZLimbSkinType>(BitConverter::ToInt32BE(rawData, rawDataIndex + 8));
skinSegment = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12);
- if (skinSegmentType == ZLimbSkinType::SkinType_4)
+ if (skinSegmentType == ZLimbSkinType::SkinType_Animated)
{
if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment)
{
@@ -181,7 +181,7 @@ void ZLimb::DeclareReferences(const std::string& prefix)
case ZLimbType::Skin:
switch (skinSegmentType)
{
- case ZLimbSkinType::SkinType_4:
+ case ZLimbSkinType::SkinType_Animated:
if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment)
{
segmentStruct.DeclareReferences(varPrefix);
@@ -189,7 +189,7 @@ void ZLimb::DeclareReferences(const std::string& prefix)
}
break;
- case ZLimbSkinType::SkinType_DList:
+ case ZLimbSkinType::SkinType_Normal:
DeclareDList(skinSegment, varPrefix, "");
break;
diff --git a/ZAPD/ZLimb.h b/ZAPD/ZLimb.h
index ce31e42..52919be 100644
--- a/ZAPD/ZLimb.h
+++ b/ZAPD/ZLimb.h
@@ -28,9 +28,9 @@ public:
ZLimbType type = ZLimbType::Standard;
- ZLimbSkinType skinSegmentType = ZLimbSkinType::SkinType_0; // Skin only
- segptr_t skinSegment = 0; // Skin only
- Struct_800A5E28 segmentStruct; // Skin only
+ ZLimbSkinType skinSegmentType = ZLimbSkinType::SkinType_Null; // Skin only
+ segptr_t skinSegment = 0; // Skin only
+ SkinAnimatedLimbData segmentStruct; // Skin only
// Legacy only
float legTransX, legTransY, legTransZ; // Vec3f
diff --git a/ZAPD/ZRoom/Commands/SetCameraSettings.cpp b/ZAPD/ZRoom/Commands/SetCameraSettings.cpp
index ae2d31c..e30e1b6 100644
--- a/ZAPD/ZRoom/Commands/SetCameraSettings.cpp
+++ b/ZAPD/ZRoom/Commands/SetCameraSettings.cpp
@@ -2,6 +2,7 @@
#include "Utils/BitConverter.h"
#include "Utils/StringHelper.h"
+#include "Globals.h"
SetCameraSettings::SetCameraSettings(ZFile* nParent) : ZRoomCommand(nParent)
{
@@ -16,8 +17,12 @@ void SetCameraSettings::ParseRawData()
std::string SetCameraSettings::GetBodySourceCode() const
{
- return StringHelper::Sprintf("SCENE_CMD_MISC_SETTINGS(0x%02X, 0x%08X)", cameraMovement,
- mapHighlight);
+ if (Globals::Instance->game == ZGame::MM_RETAIL)
+ return StringHelper::Sprintf("SCENE_CMD_SET_REGION_VISITED(0x%02X, 0x%08X)", cameraMovement,
+ mapHighlight);
+ else
+ return StringHelper::Sprintf("SCENE_CMD_MISC_SETTINGS(0x%02X, 0x%08X)", cameraMovement,
+ mapHighlight);
}
std::string SetCameraSettings::GetCommandCName() const
diff --git a/ZAPD/ZRoom/Commands/SetCsCamera.cpp b/ZAPD/ZRoom/Commands/SetCsCamera.cpp
index ada1a10..302d638 100644
--- a/ZAPD/ZRoom/Commands/SetCsCamera.cpp
+++ b/ZAPD/ZRoom/Commands/SetCsCamera.cpp
@@ -21,7 +21,7 @@ void SetCsCamera::ParseRawData()
cameras.reserve(numCameras);
for (int32_t i = 0; i < numCameras; i++)
{
- CsCameraEntry entry(parent->GetRawData(), currentPtr);
+ ActorCsCamInfo entry(parent->GetRawData(), currentPtr);
numPoints += entry.GetNumPoints();
currentPtr += entry.GetRawDataSize();
@@ -105,7 +105,7 @@ void SetCsCamera::DeclareReferences(const std::string& prefix)
std::string SetCsCamera::GetBodySourceCode() const
{
std::string listName;
- Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CsCameraEntry", listName);
+ Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCsCamInfo", listName);
return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_CAM_LIST(%i, %s)", cameras.size(),
listName.c_str());
}
@@ -120,7 +120,7 @@ RoomCommand SetCsCamera::GetRoomCommand() const
return RoomCommand::SetCsCamera;
}
-CsCameraEntry::CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
+ActorCsCamInfo::ActorCsCamInfo(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
: baseOffset(rawDataIndex), type(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)),
numPoints(BitConverter::ToInt16BE(rawData, rawDataIndex + 2))
{
@@ -128,27 +128,27 @@ CsCameraEntry::CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDa
segmentOffset = GETSEGOFFSET(camAddress);
}
-std::string CsCameraEntry::GetSourceTypeName() const
+std::string ActorCsCamInfo::GetSourceTypeName() const
{
- return "CsCameraEntry";
+ return "ActorCsCamInfo";
}
-int32_t CsCameraEntry::GetRawDataSize() const
+int32_t ActorCsCamInfo::GetRawDataSize() const
{
return 8;
}
-int16_t CsCameraEntry::GetNumPoints() const
+int16_t ActorCsCamInfo::GetNumPoints() const
{
return numPoints;
}
-segptr_t CsCameraEntry::GetCamAddress() const
+segptr_t ActorCsCamInfo::GetCamAddress() const
{
return camAddress;
}
-uint32_t CsCameraEntry::GetSegmentOffset() const
+uint32_t ActorCsCamInfo::GetSegmentOffset() const
{
return segmentOffset;
}
diff --git a/ZAPD/ZRoom/Commands/SetCsCamera.h b/ZAPD/ZRoom/Commands/SetCsCamera.h
index 5e0e3c8..2ce64e4 100644
--- a/ZAPD/ZRoom/Commands/SetCsCamera.h
+++ b/ZAPD/ZRoom/Commands/SetCsCamera.h
@@ -3,10 +3,10 @@
#include "ZRoom/ZRoomCommand.h"
#include "ZVector.h"
-class CsCameraEntry
+class ActorCsCamInfo
{
public:
- CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
+ ActorCsCamInfo(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
std::string GetSourceTypeName() const;
int32_t GetRawDataSize() const;
@@ -25,7 +25,7 @@ public:
class SetCsCamera : public ZRoomCommand
{
public:
- std::vector<CsCameraEntry> cameras;
+ std::vector<ActorCsCamInfo> cameras;
std::vector<ZVector> points;
SetCsCamera(ZFile* nParent);
diff --git a/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp b/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp
index e747d91..96c50c3 100644
--- a/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp
+++ b/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp
@@ -84,13 +84,13 @@ CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDa
std::string CutsceneEntry::GetBodySourceCode() const
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
- if (cutsceneData->endSfx.find(endSfx) != cutsceneData->endSfx.end())
+ if (enumData->endSfx.find(endSfx) != enumData->endSfx.end())
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %s, %i, %i, %i, %i", priority, length,
csCamId, scriptIndex, additionalCsId,
- cutsceneData->endSfx[endSfx].c_str(), customValue,
- hudVisibility, endCam, letterboxSize);
+ enumData->endSfx[endSfx].c_str(), customValue, hudVisibility,
+ endCam, letterboxSize);
else
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length,
csCamId, scriptIndex, additionalCsId, endSfx, customValue,
diff --git a/ZAPD/ZRoom/Commands/SetCutscenes.cpp b/ZAPD/ZRoom/Commands/SetCutscenes.cpp
index b3bde73..d2a1c19 100644
--- a/ZAPD/ZRoom/Commands/SetCutscenes.cpp
+++ b/ZAPD/ZRoom/Commands/SetCutscenes.cpp
@@ -32,7 +32,7 @@ void SetCutscenes::ParseRawData()
void SetCutscenes::DeclareReferences(const std::string& prefix)
{
- CutsceneEnumData* cutsceneData = &Globals::Instance->cfg.cutsceneData;
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
std::string varPrefix = name;
if (varPrefix == "")
varPrefix = prefix;
@@ -63,10 +63,10 @@ void SetCutscenes::DeclareReferences(const std::string& prefix)
Globals::Instance->GetSegmentedPtrName(entry.segmentPtr, parent, "CutsceneData",
csName);
- if (cutsceneData->spawnFlag.find(entry.flag) != cutsceneData->spawnFlag.end())
+ if (enumData->spawnFlag.find(entry.flag) != enumData->spawnFlag.end())
declaration += StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, %s },",
csName.c_str(), entry.exit, entry.entrance,
- cutsceneData->spawnFlag[entry.flag].c_str());
+ enumData->spawnFlag[entry.flag].c_str());
else
declaration +=
StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(),
@@ -108,7 +108,7 @@ std::string SetCutscenes::GetBodySourceCode() const
if (Globals::Instance->game == ZGame::MM_RETAIL)
{
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneScriptEntry", listName);
- return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_LIST(%i, %s)", numCutscenes,
+ return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_SCRIPT_LIST(%i, %s)", numCutscenes,
listName.c_str());
}
diff --git a/ZAPD/ZRoom/Commands/SetEntranceList.cpp b/ZAPD/ZRoom/Commands/SetEntranceList.cpp
index 79c87ba..3ffba0f 100644
--- a/ZAPD/ZRoom/Commands/SetEntranceList.cpp
+++ b/ZAPD/ZRoom/Commands/SetEntranceList.cpp
@@ -30,7 +30,7 @@ void SetEntranceList::ParseRawDataLate()
entrances.reserve(numEntrances);
for (uint32_t i = 0; i < numEntrances; i++)
{
- EntranceEntry entry(parent->GetRawData(), currentPtr);
+ Spawn entry(parent->GetRawData(), currentPtr);
entrances.push_back(entry);
currentPtr += 2;
@@ -55,16 +55,25 @@ void SetEntranceList::DeclareReferencesLate([[maybe_unused]] const std::string&
std::string varName =
StringHelper::Sprintf("%sEntranceList0x%06X", prefix.c_str(), segmentOffset);
- parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
- entrances.size() * 2, "EntranceEntry", varName,
- entrances.size(), declaration);
+
+ if (Globals::Instance->game != ZGame::MM_RETAIL)
+ parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
+ entrances.size() * 2, "Spawn", varName, entrances.size(),
+ declaration);
+ else
+ parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
+ entrances.size() * 2, "EntranceEntry", varName,
+ entrances.size(), declaration);
}
}
std::string SetEntranceList::GetBodySourceCode() const
{
std::string listName;
- Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EntranceEntry", listName);
+ if (Globals::Instance->game != ZGame::MM_RETAIL)
+ Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "Spawn", listName);
+ else
+ Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EntranceEntry", listName);
return StringHelper::Sprintf("SCENE_CMD_ENTRANCE_LIST(%s)", listName.c_str());
}
@@ -78,13 +87,13 @@ RoomCommand SetEntranceList::GetRoomCommand() const
return RoomCommand::SetEntranceList;
}
-EntranceEntry::EntranceEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
+Spawn::Spawn(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
{
startPositionIndex = rawData.at(rawDataIndex + 0);
roomToLoad = rawData.at(rawDataIndex + 1);
}
-std::string EntranceEntry::GetBodySourceCode() const
+std::string Spawn::GetBodySourceCode() const
{
return StringHelper::Sprintf("0x%02X, 0x%02X", startPositionIndex, roomToLoad);
}
diff --git a/ZAPD/ZRoom/Commands/SetEntranceList.h b/ZAPD/ZRoom/Commands/SetEntranceList.h
index e13e9a8..832232e 100644
--- a/ZAPD/ZRoom/Commands/SetEntranceList.h
+++ b/ZAPD/ZRoom/Commands/SetEntranceList.h
@@ -2,13 +2,13 @@
#include "ZRoom/ZRoomCommand.h"
-class EntranceEntry
+class Spawn
{
public:
uint8_t startPositionIndex;
uint8_t roomToLoad;
- EntranceEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
+ Spawn(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
std::string GetBodySourceCode() const;
};
@@ -16,7 +16,7 @@ public:
class SetEntranceList : public ZRoomCommand
{
public:
- std::vector<EntranceEntry> entrances;
+ std::vector<Spawn> entrances;
SetEntranceList(ZFile* nParent);
diff --git a/ZAPD/ZRoom/Commands/SetLightingSettings.cpp b/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
index ba5785c..eaf01cd 100644
--- a/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
+++ b/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
@@ -34,18 +34,28 @@ void SetLightingSettings::DeclareReferences(const std::string& prefix)
declaration += "\n";
}
- parent->AddDeclarationArray(
- segmentOffset, DeclarationAlignment::Align4,
- settings.size() * settings.front().GetRawDataSize(), "LightSettings",
- StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
- settings.size(), declaration);
+ if (Globals::Instance->game != ZGame::MM_RETAIL)
+ parent->AddDeclarationArray(
+ segmentOffset, DeclarationAlignment::Align4,
+ settings.size() * settings.front().GetRawDataSize(), "EnvLightSettings",
+ StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
+ settings.size(), declaration);
+ else
+ parent->AddDeclarationArray(
+ segmentOffset, DeclarationAlignment::Align4,
+ settings.size() * settings.front().GetRawDataSize(), "LightSettings",
+ StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
+ settings.size(), declaration);
}
}
std::string SetLightingSettings::GetBodySourceCode() const
{
std::string listName;
- Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName);
+ if (Globals::Instance->game != ZGame::MM_RETAIL)
+ Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EnvLightSettings", listName);
+ else
+ Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName);
return StringHelper::Sprintf("SCENE_CMD_ENV_LIGHT_SETTINGS(%i, %s)", settings.size(),
listName.c_str());
}
diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp
index 40e0bdd..9a4d30d 100644
--- a/ZAPD/ZRoom/Commands/SetMesh.cpp
+++ b/ZAPD/ZRoom/Commands/SetMesh.cpp
@@ -24,7 +24,7 @@ void SetMesh::ParseRawData()
switch (meshHeaderType)
{
case 0:
- polyType = std::make_shared<PolygonType2>(parent, segmentOffset, zRoom);
+ polyType = std::make_shared<RoomShapeCullable>(parent, segmentOffset, zRoom);
break;
case 1:
@@ -32,7 +32,7 @@ void SetMesh::ParseRawData()
break;
case 2:
- polyType = std::make_shared<PolygonType2>(parent, segmentOffset, zRoom);
+ polyType = std::make_shared<RoomShapeCullable>(parent, segmentOffset, zRoom);
break;
default:
@@ -79,7 +79,7 @@ std::string SetMesh::GetBodySourceCode() const
{
std::string list;
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "", list);
- return StringHelper::Sprintf("SCENE_CMD_MESH(%s)", list.c_str());
+ return StringHelper::Sprintf("SCENE_CMD_ROOM_SHAPE(%s)", list.c_str());
}
std::string SetMesh::GetCommandCName() const
@@ -92,11 +92,11 @@ RoomCommand SetMesh::GetRoomCommand() const
return RoomCommand::SetMesh;
}
-PolygonDlist::PolygonDlist(ZFile* nParent) : ZResource(nParent)
+RoomShapeDListsEntry::RoomShapeDListsEntry(ZFile* nParent) : ZResource(nParent)
{
}
-void PolygonDlist::ParseRawData()
+void RoomShapeDListsEntry::ParseRawData()
{
const auto& rawData = parent->GetRawData();
switch (polyType)
@@ -118,13 +118,13 @@ void PolygonDlist::ParseRawData()
}
}
-void PolygonDlist::DeclareReferences(const std::string& prefix)
+void RoomShapeDListsEntry::DeclareReferences(const std::string& prefix)
{
opaDList = MakeDlist(opa, prefix);
xluDList = MakeDlist(xlu, prefix);
}
-std::string PolygonDlist::GetBodySourceCode() const
+std::string RoomShapeDListsEntry::GetBodySourceCode() const
{
std::string bodyStr;
std::string opaStr;
@@ -142,7 +142,7 @@ std::string PolygonDlist::GetBodySourceCode() const
return bodyStr;
}
-void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
+void RoomShapeDListsEntry::GetSourceOutputCode(const std::string& prefix)
{
std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str());
@@ -154,25 +154,25 @@ void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
decl->declBody = bodyStr;
}
-std::string PolygonDlist::GetSourceTypeName() const
+std::string RoomShapeDListsEntry::GetSourceTypeName() const
{
switch (polyType)
{
case 2:
- return "PolygonDlist2";
+ return "RoomShapeCullableEntry";
default:
- return "PolygonDlist";
+ return "RoomShapeDListsEntry";
}
}
-ZResourceType PolygonDlist::GetResourceType() const
+ZResourceType RoomShapeDListsEntry::GetResourceType() const
{
// TODO
return ZResourceType::Error;
}
-size_t PolygonDlist::GetRawDataSize() const
+size_t RoomShapeDListsEntry::GetRawDataSize() const
{
switch (polyType)
{
@@ -184,12 +184,13 @@ size_t PolygonDlist::GetRawDataSize() const
}
}
-void PolygonDlist::SetPolyType(uint8_t nPolyType)
+void RoomShapeDListsEntry::SetPolyType(uint8_t nPolyType)
{
polyType = nPolyType;
}
-ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, [[maybe_unused]] const std::string& prefix)
+ZDisplayList* RoomShapeDListsEntry::MakeDlist(segptr_t ptr,
+ [[maybe_unused]] const std::string& prefix)
{
if (ptr == 0)
{
@@ -210,15 +211,15 @@ ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, [[maybe_unused]] const std::
return dlist;
}
-/* BgImage */
+/* RoomShapeImageMultiBgEntry */
-BgImage::BgImage(ZFile* nParent) : ZResource(nParent)
+RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(ZFile* nParent) : ZResource(nParent)
{
}
-BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex,
- ZFile* nParent)
- : BgImage(nParent)
+RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix,
+ uint32_t nRawDataIndex, ZFile* nParent)
+ : RoomShapeImageMultiBgEntry(nParent)
{
rawDataIndex = nRawDataIndex;
parent = nParent;
@@ -230,7 +231,7 @@ BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawData
sourceBackground = MakeBackground(source, prefix);
}
-void BgImage::ParseRawData()
+void RoomShapeImageMultiBgEntry::ParseRawData()
{
size_t pad = 0x00;
const auto& rawData = parent->GetRawData();
@@ -252,7 +253,7 @@ void BgImage::ParseRawData()
tlutCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x14);
}
-ZBackground* BgImage::MakeBackground(segptr_t ptr, const std::string& prefix)
+ZBackground* RoomShapeImageMultiBgEntry::MakeBackground(segptr_t ptr, const std::string& prefix)
{
if (ptr == 0)
return nullptr;
@@ -272,12 +273,12 @@ ZBackground* BgImage::MakeBackground(segptr_t ptr, const std::string& prefix)
return background;
}
-size_t BgImage::GetRawDataSize() const
+size_t RoomShapeImageMultiBgEntry::GetRawDataSize() const
{
return 0x1C;
}
-std::string BgImage::GetBodySourceCode() const
+std::string RoomShapeImageMultiBgEntry::GetBodySourceCode() const
{
std::string bodyStr = " ";
if (!isSubStruct)
@@ -340,12 +341,12 @@ std::string BgImage::GetBodySourceCode() const
return bodyStr;
}
-std::string BgImage::GetSourceTypeName() const
+std::string RoomShapeImageMultiBgEntry::GetSourceTypeName() const
{
- return "BgImage";
+ return "RoomShapeImageMultiBgEntry";
}
-ZResourceType BgImage::GetResourceType() const
+ZResourceType RoomShapeImageMultiBgEntry::GetResourceType() const
{
// TODO
return ZResourceType::Error;
@@ -380,13 +381,13 @@ std::string PolygonTypeBase::GetSourceTypeName() const
switch (type)
{
case 2:
- return "PolygonType2";
+ return "RoomShapeCullable";
case 1:
return "PolygonType1";
default:
- return "PolygonType0";
+ return "RoomShapeNormal";
}
}
@@ -416,7 +417,7 @@ void PolygonType1::ParseRawData()
if (dlist != 0)
{
- PolygonDlist polyGfxList(parent);
+ RoomShapeDListsEntry polyGfxList(parent);
polyGfxList.zRoom = zRoom;
polyGfxList.SetPolyType(type);
polyGfxList.ExtractFromFile(Seg2Filespace(dlist, parent->baseAddress));
@@ -434,7 +435,7 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
switch (format)
{
case 1:
- single = BgImage(true, prefix, rawDataIndex + 0x08, parent);
+ single = RoomShapeImageMultiBgEntry(true, prefix, rawDataIndex + 0x08, parent);
break;
case 2:
@@ -446,7 +447,7 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
multiList.reserve(count);
for (size_t i = 0; i < count; ++i)
{
- BgImage bg(false, prefix, auxPtr, parent);
+ RoomShapeImageMultiBgEntry bg(false, prefix, auxPtr, parent);
multiList.push_back(bg);
auxPtr += bg.GetRawDataSize();
bgImageArrayBody += bg.GetBodySourceCode();
@@ -507,7 +508,7 @@ std::string PolygonType1::GetBodySourceCode() const
bodyStr += single.GetBodySourceCode();
break;
case 2:
- Globals::Instance->GetSegmentedPtrName(list, parent, "BgImage", listStr);
+ Globals::Instance->GetSegmentedPtrName(list, parent, "RoomShapeImageMultiBgEntry", listStr);
bodyStr += StringHelper::Sprintf(" %i, %s, \n", count, listStr.c_str());
break;
@@ -523,21 +524,21 @@ std::string PolygonType1::GetSourceTypeName() const
switch (format)
{
case 1:
- return "MeshHeader1Single";
+ return "RoomShapeImageSingle";
case 2:
- return "MeshHeader1Multi";
+ return "RoomShapeImageMulti";
}
return "ERROR";
// return "PolygonType1";
}
-PolygonType2::PolygonType2(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom)
+RoomShapeCullable::RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom)
: PolygonTypeBase(nParent, nRawDataIndex, nRoom)
{
}
-void PolygonType2::ParseRawData()
+void RoomShapeCullable::ParseRawData()
{
const auto& rawData = parent->GetRawData();
@@ -551,7 +552,7 @@ void PolygonType2::ParseRawData()
polyDLists.reserve(num);
for (size_t i = 0; i < num; i++)
{
- PolygonDlist entry(parent);
+ RoomShapeDListsEntry entry(parent);
entry.zRoom = zRoom;
entry.SetPolyType(type);
entry.ExtractFromFile(currentPtr);
@@ -561,7 +562,7 @@ void PolygonType2::ParseRawData()
}
}
-void PolygonType2::DeclareReferences(const std::string& prefix)
+void RoomShapeCullable::DeclareReferences(const std::string& prefix)
{
if (num > 0)
{
@@ -593,7 +594,7 @@ void PolygonType2::DeclareReferences(const std::string& prefix)
"0x01000000");
}
-std::string PolygonType2::GetBodySourceCode() const
+std::string RoomShapeCullable::GetBodySourceCode() const
{
std::string listName;
Globals::Instance->GetSegmentedPtrName(start, parent, "", listName);
@@ -605,12 +606,12 @@ std::string PolygonType2::GetBodySourceCode() const
return body;
}
-size_t PolygonType2::GetRawDataSize() const
+size_t RoomShapeCullable::GetRawDataSize() const
{
return 0x0C;
}
-DeclarationAlignment PolygonType2::GetDeclarationAlignment() const
+DeclarationAlignment RoomShapeCullable::GetDeclarationAlignment() const
{
return DeclarationAlignment::Align4;
}
diff --git a/ZAPD/ZRoom/Commands/SetMesh.h b/ZAPD/ZRoom/Commands/SetMesh.h
index 9d90374..c0f15da 100644
--- a/ZAPD/ZRoom/Commands/SetMesh.h
+++ b/ZAPD/ZRoom/Commands/SetMesh.h
@@ -5,7 +5,7 @@
#include "ZDisplayList.h"
#include "ZRoom/ZRoomCommand.h"
-class PolygonDlist : public ZResource
+class RoomShapeDListsEntry : public ZResource
{
public:
ZRoom* zRoom;
@@ -21,7 +21,7 @@ public:
ZDisplayList* opaDList = nullptr; // Gfx*
ZDisplayList* xluDList = nullptr; // Gfx*
- PolygonDlist(ZFile* nParent);
+ RoomShapeDListsEntry(ZFile* nParent);
void ParseRawData() override;
void DeclareReferences(const std::string& prefix) override;
@@ -41,7 +41,7 @@ protected:
ZDisplayList* MakeDlist(segptr_t ptr, const std::string& prefix);
};
-class BgImage : public ZResource
+class RoomShapeImageMultiBgEntry : public ZResource
{
public:
uint16_t unk_00;
@@ -60,8 +60,9 @@ public:
bool isSubStruct;
- BgImage(ZFile* nParent);
- BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex, ZFile* nParent);
+ RoomShapeImageMultiBgEntry(ZFile* nParent);
+ RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex,
+ ZFile* nParent);
void ParseRawData() override;
@@ -80,7 +81,7 @@ class PolygonTypeBase : public ZResource
{
public:
uint8_t type;
- std::vector<PolygonDlist> polyDLists;
+ std::vector<RoomShapeDListsEntry> polyDLists;
PolygonTypeBase(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
@@ -100,12 +101,12 @@ public:
segptr_t dlist;
// single
- BgImage single;
+ RoomShapeImageMultiBgEntry single;
// multi
uint8_t count;
- segptr_t list; // BgImage*
- std::vector<BgImage> multiList;
+ segptr_t list; // RoomShapeImageMultiBgEntry*
+ std::vector<RoomShapeImageMultiBgEntry> multiList;
PolygonType1(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
@@ -119,14 +120,14 @@ public:
size_t GetRawDataSize() const override;
};
-class PolygonType2 : public PolygonTypeBase
+class RoomShapeCullable : public PolygonTypeBase
{
public:
uint8_t num;
segptr_t start;
segptr_t end;
- PolygonType2(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
+ RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
void ParseRawData() override;
void DeclareReferences(const std::string& prefix) override;
diff --git a/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp b/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp
index 696a3de..34edf5a 100644
--- a/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp
+++ b/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp
@@ -17,8 +17,14 @@ void SetSpecialObjects::ParseRawData()
std::string SetSpecialObjects::GetBodySourceCode() const
{
+ EnumData* enumData = &Globals::Instance->cfg.enumData;
std::string objectName = ZNames::GetObjectName(globalObject);
+ if (enumData->naviQuestHintType.find(elfMessage) != enumData->naviQuestHintType.end())
+ return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(%s, %s)",
+ enumData->naviQuestHintType[elfMessage].c_str(),
+ objectName.c_str());
+
return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(0x%02X, %s)", elfMessage,
objectName.c_str());
}
diff --git a/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp b/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp
index d20e4a3..fa28547 100644
--- a/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp
+++ b/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp
@@ -1,6 +1,7 @@
#include "SetWorldMapVisited.h"
#include "Utils/StringHelper.h"
+#include "Globals.h"
SetWorldMapVisited::SetWorldMapVisited(ZFile* nParent) : ZRoomCommand(nParent)
{
@@ -8,7 +9,10 @@ SetWorldMapVisited::SetWorldMapVisited(ZFile* nParent) : ZRoomCommand(nParent)
std::string SetWorldMapVisited::GetBodySourceCode() const
{
- return "SCENE_CMD_MISC_SETTINGS()";
+ if (Globals::Instance->game == ZGame::MM_RETAIL)
+ return "SCENE_CMD_SET_REGION_VISITED()";
+ else
+ return "SCENE_CMD_MISC_SETTINGS()";
}
std::string SetWorldMapVisited::GetCommandCName() const
diff --git a/ZAPD/ZRoom/ZRoom.cpp b/ZAPD/ZRoom/ZRoom.cpp
index f38c4d4..a291c36 100644
--- a/ZAPD/ZRoom/ZRoom.cpp
+++ b/ZAPD/ZRoom/ZRoom.cpp
@@ -336,7 +336,7 @@ std::string ZRoom::GetDefaultName(const std::string& prefix) const
*/
void ZRoom::SyotesRoomFix()
{
- PolygonType2 poly(parent, 0, this);
+ RoomShapeCullable poly(parent, 0, this);
poly.ParseRawData();
poly.DeclareReferences(GetName());
diff --git a/ZAPD/ZSkeleton.cpp b/ZAPD/ZSkeleton.cpp
index ca680c5..86b5786 100644
--- a/ZAPD/ZSkeleton.cpp
+++ b/ZAPD/ZSkeleton.cpp
@@ -189,7 +189,7 @@ std::string ZSkeleton::GetSourceTypeName() const
case ZSkeletonType::Flex:
return "FlexSkeletonHeader";
case ZSkeletonType::Curve:
- return "SkelCurveLimbList";
+ return "CurveSkeletonHeader";
}
return "SkeletonHeader";