summaryrefslogtreecommitdiff
path: root/ZAPD/ZRoom
diff options
context:
space:
mode:
authorLouis <35883445+louist103@users.noreply.github.com>2022-06-27 12:32:52 -0400
committerNicholas Estelami <NEstelami@users.noreply.github.com>2022-07-30 22:24:40 -0400
commit0595f813a67315bf6acdc7fcf5cc406ab277d9b1 (patch)
tree39f175b546cb21ab78ff519cf5254b44eb235664 /ZAPD/ZRoom
parentb5bffbf8215aa72cffc1d7403238b946bd1db262 (diff)
Done?
Diffstat (limited to 'ZAPD/ZRoom')
-rw-r--r--ZAPD/ZRoom/Commands/SetActorCutsceneList.cpp3
-rw-r--r--ZAPD/ZRoom/Commands/SetActorList.cpp1
-rw-r--r--ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp5
-rw-r--r--ZAPD/ZRoom/Commands/SetCsCamera.cpp2
-rw-r--r--ZAPD/ZRoom/Commands/SetCutscenes.cpp1
-rw-r--r--ZAPD/ZRoom/Commands/SetEntranceList.cpp5
-rw-r--r--ZAPD/ZRoom/Commands/SetExitList.cpp5
-rw-r--r--ZAPD/ZRoom/Commands/SetLightList.cpp2
-rw-r--r--ZAPD/ZRoom/Commands/SetLightingSettings.cpp1
-rw-r--r--ZAPD/ZRoom/Commands/SetMesh.cpp4
-rw-r--r--ZAPD/ZRoom/Commands/SetMinimapChests.cpp3
-rw-r--r--ZAPD/ZRoom/Commands/SetMinimapList.cpp3
-rw-r--r--ZAPD/ZRoom/Commands/SetObjectList.cpp1
-rw-r--r--ZAPD/ZRoom/Commands/SetRoomList.cpp1
-rw-r--r--ZAPD/ZRoom/Commands/SetStartPositionList.cpp5
-rw-r--r--ZAPD/ZRoom/Commands/SetTransitionActorList.cpp1
16 files changed, 32 insertions, 11 deletions
diff --git a/ZAPD/ZRoom/Commands/SetActorCutsceneList.cpp b/ZAPD/ZRoom/Commands/SetActorCutsceneList.cpp
index 60391a9..15f2c6b 100644
--- a/ZAPD/ZRoom/Commands/SetActorCutsceneList.cpp
+++ b/ZAPD/ZRoom/Commands/SetActorCutsceneList.cpp
@@ -14,8 +14,9 @@ void SetActorCutsceneList::ParseRawData()
{
ZRoomCommand::ParseRawData();
int numCutscenes = cmdArg1;
- int32_t currentPtr = segmentOffset;
+ offset_t currentPtr = segmentOffset;
+ cutscenes.reserve(numCutscenes);
for (int32_t i = 0; i < numCutscenes; i++)
{
ActorCutsceneEntry entry(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetActorList.cpp b/ZAPD/ZRoom/Commands/SetActorList.cpp
index 919d86f..719b336 100644
--- a/ZAPD/ZRoom/Commands/SetActorList.cpp
+++ b/ZAPD/ZRoom/Commands/SetActorList.cpp
@@ -34,6 +34,7 @@ void SetActorList::ParseRawDataLate()
uint32_t currentPtr = segmentOffset;
+ actors.reserve(actorsAmount);
for (size_t i = 0; i < actorsAmount; i++)
{
ActorSpawnEntry entry(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
index 629d4a0..1687b54 100644
--- a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
+++ b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp
@@ -21,9 +21,10 @@ void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string&
void SetAlternateHeaders::ParseRawDataLate()
{
- int numHeaders = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
+ size_t numHeaders = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
- for (int32_t i = 0; i < numHeaders; i++)
+ headers.reserve(numHeaders);
+ for (uint32_t i = 0; i < numHeaders; i++)
{
int32_t address = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + (i * 4));
headers.push_back(address);
diff --git a/ZAPD/ZRoom/Commands/SetCsCamera.cpp b/ZAPD/ZRoom/Commands/SetCsCamera.cpp
index 5cf0a3d..ada1a10 100644
--- a/ZAPD/ZRoom/Commands/SetCsCamera.cpp
+++ b/ZAPD/ZRoom/Commands/SetCsCamera.cpp
@@ -18,6 +18,7 @@ void SetCsCamera::ParseRawData()
uint32_t currentPtr = segmentOffset;
int32_t numPoints = 0;
+ cameras.reserve(numCameras);
for (int32_t i = 0; i < numCameras; i++)
{
CsCameraEntry entry(parent->GetRawData(), currentPtr);
@@ -31,6 +32,7 @@ void SetCsCamera::ParseRawData()
{
uint32_t currentPtr = cameras.at(0).GetSegmentOffset();
+ points.reserve(numPoints);
for (int32_t i = 0; i < numPoints; i++)
{
ZVector vec(parent);
diff --git a/ZAPD/ZRoom/Commands/SetCutscenes.cpp b/ZAPD/ZRoom/Commands/SetCutscenes.cpp
index 3820203..51df68c 100644
--- a/ZAPD/ZRoom/Commands/SetCutscenes.cpp
+++ b/ZAPD/ZRoom/Commands/SetCutscenes.cpp
@@ -20,6 +20,7 @@ void SetCutscenes::ParseRawData()
{
int32_t currentPtr = segmentOffset;
+ cutsceneEntries.reserve(numCutscenes);
for (uint8_t i = 0; i < numCutscenes; i++)
{
CutsceneEntry entry(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetEntranceList.cpp b/ZAPD/ZRoom/Commands/SetEntranceList.cpp
index 8099bac..c92f56c 100644
--- a/ZAPD/ZRoom/Commands/SetEntranceList.cpp
+++ b/ZAPD/ZRoom/Commands/SetEntranceList.cpp
@@ -24,10 +24,11 @@ void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& pref
void SetEntranceList::ParseRawDataLate()
{
// Parse Entrances and Generate Declaration
- int numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
+ uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
uint32_t currentPtr = segmentOffset;
- for (int32_t i = 0; i < numEntrances; i++)
+ entrances.reserve(numEntrances);
+ for (uint32_t i = 0; i < numEntrances; i++)
{
EntranceEntry entry(parent->GetRawData(), currentPtr);
entrances.push_back(entry);
diff --git a/ZAPD/ZRoom/Commands/SetExitList.cpp b/ZAPD/ZRoom/Commands/SetExitList.cpp
index ddc4c5d..f94ef21 100644
--- a/ZAPD/ZRoom/Commands/SetExitList.cpp
+++ b/ZAPD/ZRoom/Commands/SetExitList.cpp
@@ -23,10 +23,11 @@ void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix)
void SetExitList::ParseRawDataLate()
{
// Parse Entrances and Generate Declaration
- int numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
+ uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
uint32_t currentPtr = segmentOffset;
- for (int32_t i = 0; i < numEntrances; i++)
+ exits.reserve(numEntrances);
+ for (uint32_t i = 0; i < numEntrances; i++)
{
uint16_t exit = BitConverter::ToUInt16BE(parent->GetRawData(), currentPtr);
exits.push_back(exit);
diff --git a/ZAPD/ZRoom/Commands/SetLightList.cpp b/ZAPD/ZRoom/Commands/SetLightList.cpp
index 2e023ff..0d0f0ff 100644
--- a/ZAPD/ZRoom/Commands/SetLightList.cpp
+++ b/ZAPD/ZRoom/Commands/SetLightList.cpp
@@ -15,6 +15,8 @@ void SetLightList::ParseRawData()
numLights = cmdArg1;
int32_t currentPtr = segmentOffset;
+
+ lights.reserve(this->numLights);
for (int i = 0; i < this->numLights; i++)
{
LightInfo light(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetLightingSettings.cpp b/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
index 08cd83d..ba5785c 100644
--- a/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
+++ b/ZAPD/ZRoom/Commands/SetLightingSettings.cpp
@@ -15,6 +15,7 @@ void SetLightingSettings::ParseRawData()
ZRoomCommand::ParseRawData();
uint8_t numLights = cmdArg1;
+ settings.reserve(numLights);
for (int i = 0; i < numLights; i++)
settings.push_back(LightingSettings(parent->GetRawData(), segmentOffset + (i * 22)));
}
diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp
index ba0bbe2..89c8c8c 100644
--- a/ZAPD/ZRoom/Commands/SetMesh.cpp
+++ b/ZAPD/ZRoom/Commands/SetMesh.cpp
@@ -442,6 +442,8 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
{
listAddress = Seg2Filespace(list, parent->baseAddress);
uint32_t auxPtr = listAddress;
+
+ multiList.reserve(count);
for (size_t i = 0; i < count; ++i)
{
BgImage bg(false, prefix, auxPtr, parent);
@@ -545,6 +547,8 @@ void PolygonType2::ParseRawData()
end = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
uint32_t currentPtr = GETSEGOFFSET(start);
+
+ polyDLists.reserve(num);
for (size_t i = 0; i < num; i++)
{
PolygonDlist entry(parent);
diff --git a/ZAPD/ZRoom/Commands/SetMinimapChests.cpp b/ZAPD/ZRoom/Commands/SetMinimapChests.cpp
index ec432b7..b1985f8 100644
--- a/ZAPD/ZRoom/Commands/SetMinimapChests.cpp
+++ b/ZAPD/ZRoom/Commands/SetMinimapChests.cpp
@@ -15,8 +15,9 @@ void SetMinimapChests::ParseRawData()
ZRoomCommand::ParseRawData();
int numChests = cmdArg1;
- int32_t currentPtr = segmentOffset;
+ offset_t currentPtr = segmentOffset;
+ chests.reserve(numChests);
for (int32_t i = 0; i < numChests; i++)
{
MinimapChest chest(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetMinimapList.cpp b/ZAPD/ZRoom/Commands/SetMinimapList.cpp
index be5d8f1..370afdf 100644
--- a/ZAPD/ZRoom/Commands/SetMinimapList.cpp
+++ b/ZAPD/ZRoom/Commands/SetMinimapList.cpp
@@ -17,8 +17,9 @@ void SetMinimapList::ParseRawData()
listSegmentOffset = GETSEGOFFSET(listSegmentAddr);
unk4 = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + 4);
- int32_t currentPtr = listSegmentOffset;
+ uint32_t currentPtr = listSegmentOffset;
+ minimaps.reserve(zRoom->roomCount);
for (int32_t i = 0; i < zRoom->roomCount; i++)
{
MinimapEntry entry(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetObjectList.cpp b/ZAPD/ZRoom/Commands/SetObjectList.cpp
index fdd41e6..3048aa2 100644
--- a/ZAPD/ZRoom/Commands/SetObjectList.cpp
+++ b/ZAPD/ZRoom/Commands/SetObjectList.cpp
@@ -17,6 +17,7 @@ void SetObjectList::ParseRawData()
uint8_t objectCnt = parent->GetRawData().at(rawDataIndex + 1);
uint32_t currentPtr = segmentOffset;
+ objects.reserve(objectCnt);
for (uint8_t i = 0; i < objectCnt; i++)
{
uint16_t objectIndex = BitConverter::ToInt16BE(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetRoomList.cpp b/ZAPD/ZRoom/Commands/SetRoomList.cpp
index 20138dd..134be08 100644
--- a/ZAPD/ZRoom/Commands/SetRoomList.cpp
+++ b/ZAPD/ZRoom/Commands/SetRoomList.cpp
@@ -69,6 +69,7 @@ void RomFile::ParseRawData()
uint32_t currentPtr = rawDataIndex;
+ rooms.reserve(numRooms);
for (int32_t i = 0; i < numRooms; i++)
{
RoomEntry entry(parent->GetRawData(), currentPtr);
diff --git a/ZAPD/ZRoom/Commands/SetStartPositionList.cpp b/ZAPD/ZRoom/Commands/SetStartPositionList.cpp
index f75b5e0..14ca16a 100644
--- a/ZAPD/ZRoom/Commands/SetStartPositionList.cpp
+++ b/ZAPD/ZRoom/Commands/SetStartPositionList.cpp
@@ -16,9 +16,10 @@ void SetStartPositionList::ParseRawData()
ZRoomCommand::ParseRawData();
uint8_t numActors = cmdArg1;
- uint32_t currentPtr = segmentOffset;
+ offset_t currentPtr = segmentOffset;
- for (int32_t i = 0; i < numActors; i++)
+ actors.reserve(numActors);
+ for (uint32_t i = 0; i < numActors; i++)
{
actors.push_back(ActorSpawnEntry(parent->GetRawData(), currentPtr));
currentPtr += 16;
diff --git a/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp b/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp
index a33d1c6..67e3e4e 100644
--- a/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp
+++ b/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp
@@ -17,6 +17,7 @@ void SetTransitionActorList::ParseRawData()
int numActors = cmdArg1;
uint32_t currentPtr = segmentOffset;
+ transitionActors.reserve(numActors);
for (int32_t i = 0; i < numActors; i++)
{
TransitionActorEntry entry(parent->GetRawData(), currentPtr);