summaryrefslogtreecommitdiff
path: root/ZAPD/ZRoom/Commands
diff options
context:
space:
mode:
authorYanis42 <35189056+Yanis42@users.noreply.github.com>2023-10-17 05:56:49 +0200
committerGitHub <noreply@github.com>2023-10-16 23:56:49 -0400
commit094e797349c86d0baef4a624962f4287aefdfef2 (patch)
treeee08bc4d0cba7fe53732d056627532bb2ffd605d /ZAPD/ZRoom/Commands
parent338e35f89afc905399ad90c952d154ae7b20bf75 (diff)
Update old names to newer ones (#305)JackMaster
* JointKey -> LegacyJointKey * CamData -> BgCamInfo * TransformData -> CurveInterpKnot * TransformUpdateIndex -> CurveAnimationHeader * SkelCurveLimbList -> CurveSkeletonHeader * LightSettings -> EnvLightSettings * EntranceEntry -> Spawn * PolygonDlist -> RoomShapeDListsEntry * PolygonType0 -> RoomShapeNormal, MeshHeader1Single -> RoomShapeImageSingle * BgImage -> RoomShapeImageMultiBgEntry * MeshHeader1Multi -> RoomShapeImageMulti PolygonDlist2 -> RoomShapeCullableEntry * PolygonType2 -> RoomShapeCullable * SCENE_CMD_MESH -> SCENE_CMD_ROOM_SHAPE * implement enum parsing + use NaviQuestHintFileId * Struct_800A57C0 -> SkinVertex * Struct_800A598C_2 -> SkinTransformation * Struct_800A5E28 -> SkinAnimatedLimbData * Struct_800A598C -> SkinLimbModif * fix MM issues * LinkAnimationHeader -> PlayerAnimationHeader (MM) * CsCameraEntry -> ActorCsCamInfo (MM) * remaining scene commands (MM) * format * removed useless comment * name skinlimb members * format * fixed indentation
Diffstat (limited to 'ZAPD/ZRoom/Commands')
-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
12 files changed, 128 insertions, 92 deletions
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