mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-18 21:10:19 +00:00
Update ZAPD (#1569)
* 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!
This commit is contained in:
parent
503f6d86d5
commit
4e55168eaa
97 changed files with 4225 additions and 2328 deletions
|
@ -21,7 +21,7 @@ void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string&
|
|||
|
||||
void SetAlternateHeaders::ParseRawDataLate()
|
||||
{
|
||||
size_t numHeaders = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
|
||||
size_t numHeaders = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
|
||||
|
||||
headers.reserve(numHeaders);
|
||||
for (uint32_t i = 0; i < numHeaders; i++)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "SetActorCutsceneList.h"
|
||||
#include "SetCutsceneEntryList.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
|
@ -19,7 +19,7 @@ void SetActorCutsceneList::ParseRawData()
|
|||
cutscenes.reserve(numCutscenes);
|
||||
for (int32_t i = 0; i < numCutscenes; i++)
|
||||
{
|
||||
ActorCutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
CutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
cutscenes.push_back(entry);
|
||||
|
||||
currentPtr += 16;
|
||||
|
@ -55,7 +55,7 @@ void SetActorCutsceneList::DeclareReferences(const std::string& prefix)
|
|||
std::string SetActorCutsceneList::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCutscene", listName);
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_LIST(%i, %s)", cutscenes.size(),
|
||||
listName.c_str());
|
||||
}
|
||||
|
@ -70,25 +70,34 @@ RoomCommand SetActorCutsceneList::GetRoomCommand() const
|
|||
return RoomCommand::SetActorCutsceneList;
|
||||
}
|
||||
|
||||
ActorCutsceneEntry::ActorCutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
: priority(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)),
|
||||
length(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)),
|
||||
unk4(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)),
|
||||
unk6(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)),
|
||||
additionalCutscene(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)),
|
||||
sound(rawData[rawDataIndex + 0xA]), unkB(rawData[rawDataIndex + 0xB]),
|
||||
unkC(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)), unkE(rawData[rawDataIndex + 0xE]),
|
||||
letterboxSize(rawData[rawDataIndex + 0xF])
|
||||
csCamId(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)),
|
||||
scriptIndex(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)),
|
||||
additionalCsId(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)),
|
||||
endSfx(rawData[rawDataIndex + 0xA]), customValue(rawData[rawDataIndex + 0xB]),
|
||||
hudVisibility(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)),
|
||||
endCam(rawData[rawDataIndex + 0xE]), letterboxSize(rawData[rawDataIndex + 0xF])
|
||||
{
|
||||
}
|
||||
|
||||
std::string ActorCutsceneEntry::GetBodySourceCode() const
|
||||
std::string CutsceneEntry::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length, unk4,
|
||||
unk6, additionalCutscene, sound, unkB, unkC, unkE, letterboxSize);
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
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,
|
||||
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,
|
||||
hudVisibility, endCam, letterboxSize);
|
||||
}
|
||||
|
||||
std::string ActorCutsceneEntry::GetSourceTypeName() const
|
||||
std::string CutsceneEntry::GetSourceTypeName() const
|
||||
{
|
||||
return "ActorCutscene";
|
||||
return "CutsceneEntry";
|
||||
}
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class ActorCutsceneEntry
|
||||
class CutsceneEntry
|
||||
{
|
||||
protected:
|
||||
int16_t priority;
|
||||
int16_t length;
|
||||
int16_t unk4;
|
||||
int16_t unk6;
|
||||
int16_t additionalCutscene;
|
||||
uint8_t sound;
|
||||
uint8_t unkB;
|
||||
int16_t unkC;
|
||||
uint8_t unkE;
|
||||
int16_t csCamId;
|
||||
int16_t scriptIndex;
|
||||
int16_t additionalCsId;
|
||||
uint8_t endSfx;
|
||||
uint8_t customValue;
|
||||
int16_t hudVisibility;
|
||||
uint8_t endCam;
|
||||
uint8_t letterboxSize;
|
||||
|
||||
public:
|
||||
ActorCutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const;
|
||||
std::string GetSourceTypeName() const;
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
class SetActorCutsceneList : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<ActorCutsceneEntry> cutscenes;
|
||||
std::vector<CutsceneEntry> cutscenes;
|
||||
|
||||
SetActorCutsceneList(ZFile* nParent);
|
||||
|
|
@ -23,7 +23,7 @@ void SetCutscenes::ParseRawData()
|
|||
cutsceneEntries.reserve(numCutscenes);
|
||||
for (uint8_t i = 0; i < numCutscenes; i++)
|
||||
{
|
||||
CutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
CutsceneScriptEntry entry(parent->GetRawData(), currentPtr);
|
||||
cutsceneEntries.push_back(entry);
|
||||
currentPtr += 8;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ void SetCutscenes::ParseRawData()
|
|||
|
||||
void SetCutscenes::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
std::string varPrefix = name;
|
||||
if (varPrefix == "")
|
||||
varPrefix = prefix;
|
||||
|
@ -62,10 +63,14 @@ void SetCutscenes::DeclareReferences(const std::string& prefix)
|
|||
Globals::Instance->GetSegmentedPtrName(entry.segmentPtr, parent, "CutsceneData",
|
||||
csName);
|
||||
|
||||
declaration +=
|
||||
StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(),
|
||||
entry.exit, entry.entrance, entry.flag);
|
||||
|
||||
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,
|
||||
enumData->spawnFlag[entry.flag].c_str());
|
||||
else
|
||||
declaration +=
|
||||
StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(),
|
||||
entry.exit, entry.entrance, entry.flag);
|
||||
if (i + 1 < numCutscenes)
|
||||
declaration += "\n";
|
||||
|
||||
|
@ -73,8 +78,8 @@ void SetCutscenes::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
|
||||
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
||||
cutsceneEntries.size() * 8, "CutsceneEntry",
|
||||
StringHelper::Sprintf("%sCutsceneEntryList_%06X",
|
||||
cutsceneEntries.size() * 8, "CutsceneScriptEntry",
|
||||
StringHelper::Sprintf("%sCutsceneScriptEntryList_%06X",
|
||||
zRoom->GetName().c_str(), segmentOffset),
|
||||
cutsceneEntries.size(), declaration);
|
||||
}
|
||||
|
@ -102,8 +107,8 @@ std::string SetCutscenes::GetBodySourceCode() const
|
|||
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_LIST(%i, %s)", numCutscenes,
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneScriptEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_SCRIPT_LIST(%i, %s)", numCutscenes,
|
||||
listName.c_str());
|
||||
}
|
||||
|
||||
|
@ -121,7 +126,7 @@ RoomCommand SetCutscenes::GetRoomCommand() const
|
|||
return RoomCommand::SetCutscenes;
|
||||
}
|
||||
|
||||
CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
CutsceneScriptEntry::CutsceneScriptEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
: segmentPtr(BitConverter::ToInt32BE(rawData, rawDataIndex + 0)),
|
||||
exit(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), entrance(rawData[rawDataIndex + 6]),
|
||||
flag(rawData[rawDataIndex + 7])
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "ZCutscene.h"
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class CutsceneEntry
|
||||
class CutsceneScriptEntry
|
||||
{
|
||||
public:
|
||||
CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
CutsceneScriptEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
segptr_t segmentPtr;
|
||||
uint16_t exit;
|
||||
|
@ -17,8 +17,8 @@ public:
|
|||
class SetCutscenes : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<CutsceneEntry> cutsceneEntries; // (MM Only)
|
||||
uint8_t numCutscenes; // (MM Only)
|
||||
std::vector<CutsceneScriptEntry> cutsceneEntries; // (MM Only)
|
||||
uint8_t numCutscenes; // (MM Only)
|
||||
|
||||
SetCutscenes(ZFile* nParent);
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& pref
|
|||
void SetEntranceList::ParseRawDataLate()
|
||||
{
|
||||
// Parse Entrances and Generate Declaration
|
||||
uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t currentPtr = segmentOffset;
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix)
|
|||
void SetExitList::ParseRawDataLate()
|
||||
{
|
||||
// Parse Entrances and Generate Declaration
|
||||
uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t currentPtr = segmentOffset;
|
||||
|
||||
exits.reserve(numEntrances);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
@ -151,28 +151,28 @@ void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
|
|||
if (decl == nullptr)
|
||||
DeclareVar(prefix, bodyStr);
|
||||
else
|
||||
decl->text = bodyStr;
|
||||
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;
|
||||
|
@ -371,7 +372,7 @@ void PolygonTypeBase::DeclareAndGenerateOutputCode(const std::string& prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
decl->text = bodyStr;
|
||||
decl->declBody = bodyStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,7 +15,7 @@ void SetMinimapList::ParseRawData()
|
|||
ZRoomCommand::ParseRawData();
|
||||
listSegmentAddr = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset);
|
||||
listSegmentOffset = GETSEGOFFSET(listSegmentAddr);
|
||||
unk4 = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + 4);
|
||||
scale = BitConverter::ToInt16BE(parent->GetRawData(), segmentOffset + 4);
|
||||
|
||||
uint32_t currentPtr = listSegmentOffset;
|
||||
|
||||
|
@ -54,7 +54,7 @@ void SetMinimapList::DeclareReferences(const std::string& prefix)
|
|||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(listSegmentAddr, parent, "MinimapEntry", listName);
|
||||
std::string declaration = StringHelper::Sprintf("\n\t%s, 0x%08X\n", listName.c_str(), unk4);
|
||||
std::string declaration = StringHelper::Sprintf("\n\t%s, %d\n", listName.c_str(), scale);
|
||||
|
||||
parent->AddDeclaration(
|
||||
segmentOffset, DeclarationAlignment::Align4, 8, "MinimapList",
|
||||
|
|
|
@ -35,5 +35,5 @@ public:
|
|||
private:
|
||||
segptr_t listSegmentAddr;
|
||||
uint32_t listSegmentOffset;
|
||||
uint32_t unk4;
|
||||
int16_t scale;
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ void SetPathways::ParseRawDataLate()
|
|||
{
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
auto numPaths = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
|
||||
auto numPaths = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
|
||||
pathwayList.SetNumPaths(numPaths);
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -48,11 +48,12 @@ public:
|
|||
static std::string GetEntranceName(uint16_t id)
|
||||
{
|
||||
if (ZNames::GetNumEntrances() == 0 || ZNames::GetNumSpecialEntrances() == 0)
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
||||
if (id < ZNames::GetNumEntrances())
|
||||
return Globals::Instance->cfg.entranceList[id];
|
||||
else if ((id >= 0x7FF9 && id <= 0x7FFF) && !((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances
|
||||
else if ((id >= 0x7FF9 && id <= 0x7FFF) &&
|
||||
!((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances
|
||||
return Globals::Instance->cfg.specialEntranceList[id - 0x7FF9];
|
||||
else
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
@ -60,5 +61,8 @@ public:
|
|||
|
||||
static size_t GetNumActors() { return Globals::Instance->cfg.actorList.size(); }
|
||||
static size_t GetNumEntrances() { return Globals::Instance->cfg.entranceList.size(); }
|
||||
static size_t GetNumSpecialEntrances() { return Globals::Instance->cfg.specialEntranceList.size(); }
|
||||
static size_t GetNumSpecialEntrances()
|
||||
{
|
||||
return Globals::Instance->cfg.specialEntranceList.size();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <string_view>
|
||||
|
||||
#include "Commands/EndMarker.h"
|
||||
#include "Commands/SetActorCutsceneList.h"
|
||||
#include "Commands/SetCutsceneEntryList.h"
|
||||
#include "Commands/SetActorList.h"
|
||||
#include "Commands/SetAlternateHeaders.h"
|
||||
#include "Commands/SetAnimatedMaterialList.h"
|
||||
|
@ -64,18 +64,14 @@ ZRoom::~ZRoom()
|
|||
delete cmd;
|
||||
}
|
||||
|
||||
void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
void ZRoom::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
{
|
||||
ZResource::ExtractFromXML(reader, nRawDataIndex);
|
||||
ZResource::ExtractWithXML(reader, nRawDataIndex);
|
||||
|
||||
if (hackMode == "syotes_room")
|
||||
{
|
||||
SyotesRoomHack();
|
||||
}
|
||||
SyotesRoomFix();
|
||||
else
|
||||
{
|
||||
DeclareVar(name, "");
|
||||
}
|
||||
}
|
||||
|
||||
void ZRoom::ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType)
|
||||
|
@ -338,9 +334,9 @@ std::string ZRoom::GetDefaultName(const std::string& prefix) const
|
|||
* back to very early in the game's development. Since this room is a special case,
|
||||
* declare automatically the data its contains whitout the need of a header.
|
||||
*/
|
||||
void ZRoom::SyotesRoomHack()
|
||||
void ZRoom::SyotesRoomFix()
|
||||
{
|
||||
PolygonType2 poly(parent, 0, this);
|
||||
RoomShapeCullable poly(parent, 0, this);
|
||||
|
||||
poly.ParseRawData();
|
||||
poly.DeclareReferences(GetName());
|
||||
|
@ -360,20 +356,6 @@ ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
size_t ZRoom::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress)
|
||||
{
|
||||
auto currentDecl = parent->declarations.find(declarationAddress);
|
||||
if (currentDecl == parent->declarations.end())
|
||||
return 0;
|
||||
|
||||
auto nextDecl = currentDecl;
|
||||
std::advance(nextDecl, 1);
|
||||
if (nextDecl == parent->declarations.end())
|
||||
return parent->GetRawData().size() - currentDecl->first;
|
||||
|
||||
return nextDecl->first - currentDecl->first;
|
||||
}
|
||||
|
||||
size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
|
||||
{
|
||||
int32_t cmdIndex = -1;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
ZRoom(ZFile* nParent);
|
||||
virtual ~ZRoom();
|
||||
|
||||
void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType);
|
||||
|
||||
void ParseXML(tinyxml2::XMLElement* reader) override;
|
||||
|
@ -37,7 +37,6 @@ public:
|
|||
void GetSourceOutputCode(const std::string& prefix) override;
|
||||
|
||||
std::string GetDefaultName(const std::string& prefix) const override;
|
||||
size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress);
|
||||
size_t GetCommandSizeFromNeighbor(ZRoomCommand* cmd);
|
||||
ZRoomCommand* FindCommandOfType(RoomCommand cmdType);
|
||||
|
||||
|
@ -46,5 +45,5 @@ public:
|
|||
ZResourceType GetResourceType() const override;
|
||||
|
||||
protected:
|
||||
void SyotesRoomHack();
|
||||
void SyotesRoomFix();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue