summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2021-03-20 03:45:24 -0400
committerGitHub <noreply@github.com>2021-03-20 03:45:24 -0400
commit963a282dc10036f367a2cb09bb5651aefc73d2a4 (patch)
tree1c53ce8e6ac29c138921a6876511313e5b97e74f
parentc8e1f444d4ce0f73a2cbed4b3abe9f1c1a496743 (diff)
Final Warning pass (#99)
* started on basic type errors * Done. For now * remove libgfxd binary * Fix Clang Warnings * Fix2 * Fix rollback of #92 and missed warning in ZCutscene.cpp * ? * add stdexcept to ZResource * Fix make clean * PR fixes * Fix make file stuff * Remove many more errors and remove -Wall * Turns out Globals was used * Final pass Co-authored-by: Fig02 <fig02srl@gmail.com>
-rw-r--r--ZAPD/HighLevel/HLAnimationIntermediette.cpp4
-rw-r--r--ZAPD/HighLevel/HLModelIntermediette.cpp14
-rw-r--r--ZAPD/Main.cpp2
-rw-r--r--ZAPD/Overlays/ZOverlay.cpp4
-rw-r--r--ZAPD/ZAnimation.cpp4
-rw-r--r--ZAPD/ZCollision.cpp18
-rw-r--r--ZAPD/ZCollision.h4
-rw-r--r--ZAPD/ZCutscene.cpp30
-rw-r--r--ZAPD/ZDisplayList.cpp16
-rw-r--r--ZAPD/ZFile.cpp4
-rw-r--r--ZAPD/ZRoom/Commands/SetActorList.cpp12
-rw-r--r--ZAPD/ZRoom/Commands/SetActorList.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetMesh.cpp4
-rw-r--r--ZAPD/ZRoom/Commands/SetObjectList.cpp4
-rw-r--r--ZAPD/ZRoom/Commands/SetPathways.cpp2
-rw-r--r--ZAPD/ZRoom/ZRoom.cpp22
-rw-r--r--ZAPD/ZTexture.cpp6
-rw-r--r--ZAPD/ZVector.cpp4
18 files changed, 78 insertions, 78 deletions
diff --git a/ZAPD/HighLevel/HLAnimationIntermediette.cpp b/ZAPD/HighLevel/HLAnimationIntermediette.cpp
index 1b64af1..f93b789 100644
--- a/ZAPD/HighLevel/HLAnimationIntermediette.cpp
+++ b/ZAPD/HighLevel/HLAnimationIntermediette.cpp
@@ -96,7 +96,7 @@ string HLAnimationIntermediette::OutputXML()
XMLElement* rotValues = doc.NewElement("RotationValues");
- for (int i = 0; i < rotationValues.size(); i++)
+ for (size_t i = 0; i < rotationValues.size(); i++)
{
XMLElement* rotValue = doc.NewElement("Value");
rotValue->SetText(rotationValues[i]);
@@ -107,7 +107,7 @@ string HLAnimationIntermediette::OutputXML()
XMLElement* rotIndices = doc.NewElement("RotationIndices");
- for (int i = 0; i < rotationIndices.size(); i++)
+ for (size_t i = 0; i < rotationIndices.size(); i++)
{
XMLElement* rotIndex = doc.NewElement("Value");
rotIndex->SetAttribute("X", rotationIndices[i].x);
diff --git a/ZAPD/HighLevel/HLModelIntermediette.cpp b/ZAPD/HighLevel/HLModelIntermediette.cpp
index 9e9d496..ee8435c 100644
--- a/ZAPD/HighLevel/HLModelIntermediette.cpp
+++ b/ZAPD/HighLevel/HLModelIntermediette.cpp
@@ -67,9 +67,9 @@ void HLModelIntermediette::FromZDisplayList(HLModelIntermediette* model, ZDispla
// Go through verts
vector<Vertex> finalVerts = vector<Vertex>();
- uint32_t vStart = -1;
+ int32_t vStart = -1;
- for (pair<uint32_t, vector<Vertex>> pair : zDisplayList->vertices)
+ for (pair<int32_t, vector<Vertex>> pair : zDisplayList->vertices)
{
if (vStart == -1) // TODO: Find a better way to do this
vStart = pair.first;
@@ -112,7 +112,7 @@ void HLModelIntermediette::FromZDisplayList(HLModelIntermediette* model, ZDispla
startIndex = 0;
- for (int i = startIndex; i < zDisplayList->instructions.size(); i++)
+ for (size_t i = startIndex; i < zDisplayList->instructions.size(); i++)
{
uint64_t data = zDisplayList->instructions[i];
F3DZEXOpcode opcode = (F3DZEXOpcode)(data >> 56);
@@ -121,7 +121,7 @@ void HLModelIntermediette::FromZDisplayList(HLModelIntermediette* model, ZDispla
{
int ss = (data & 0x0000FF0000000000) >> 40;
int nn = (data & 0x000000FF00000000) >> 32;
- int dd = (data & 0xFFFFFFFF);
+ //int dd = (data & 0xFFFFFFFF);
int sft = 32 - (nn + 1) - ss;
@@ -257,11 +257,11 @@ void HLModelIntermediette::FromZSkeleton(HLModelIntermediette* model, ZSkeleton*
{
model->hasSkeleton = true;
- for (int i = 0; i < zSkeleton->limbs.size(); i++)
+ for (size_t i = 0; i < zSkeleton->limbs.size(); i++)
{
//ZLimb* limb = zSkeleton->limbs[i];
- for (int j = 0; j < model->blocks.size(); j++)
+ for (size_t j = 0; j < model->blocks.size(); j++)
{
}
}
@@ -508,7 +508,7 @@ void HLVerticesIntermediette::OutputAssimp(aiScene* scene, std::vector<aiVector3
verts->clear();
- for (int i = 0; i < vertices.size(); i++)
+ for (size_t i = 0; i < vertices.size(); i++)
{
verts->push_back(aiVector3D(vertices[i].x, vertices[i].y, vertices[i].z));
//normals[i] = aiVector3D(vertices[i].x, vertices[i].y, vertices[i].z);
diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp
index 5e1db83..d741903 100644
--- a/ZAPD/Main.cpp
+++ b/ZAPD/Main.cpp
@@ -41,7 +41,7 @@ void ErrorHandler(int sig)
size = backtrace(array, 4096);
symbols = backtrace_symbols(array, 4096);
- for (int i = 1; i < size; i++)
+ for (size_t i = 1; i < size; i++)
{
//size_t len = strlen(symbols[i]);
cout << symbols[i] << "\n";
diff --git a/ZAPD/Overlays/ZOverlay.cpp b/ZAPD/Overlays/ZOverlay.cpp
index 006aa84..6b2564d 100644
--- a/ZAPD/Overlays/ZOverlay.cpp
+++ b/ZAPD/Overlays/ZOverlay.cpp
@@ -44,7 +44,7 @@ ZOverlay* ZOverlay::FromBuild(string buildPath, string cfgFolderPath)
// get the elf files
vector<elfio*> readers;
- for (int i = 1; i < cfgLines.size(); i++)
+ for (size_t i = 1; i < cfgLines.size(); i++)
{
string elfPath = buildPath + "/" + cfgLines[i].substr(0, cfgLines[i].size()-2) + ".o";
elfio* reader = new elfio();
@@ -198,7 +198,7 @@ string ZOverlay::GetSourceOutputCode(const std::string& prefix)
output += StringHelper::Sprintf(".word %i\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
RelocationEntry* reloc = entries[i];
output += StringHelper::Sprintf(".word 0x%08X\n", reloc->CalcRelocationWord());
diff --git a/ZAPD/ZAnimation.cpp b/ZAPD/ZAnimation.cpp
index 99450e3..614dcd7 100644
--- a/ZAPD/ZAnimation.cpp
+++ b/ZAPD/ZAnimation.cpp
@@ -72,7 +72,7 @@ std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
const int lineLength = 14;
const int offset = 0;
- for (int i = 0; i < rotationValues.size(); i++)
+ for (size_t i = 0; i < rotationValues.size(); i++)
{
valuesStr += StringHelper::Sprintf("0x%04X, ", rotationValues[i]);
@@ -80,7 +80,7 @@ std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
valuesStr += "\n ";
}
- for (int i = 0; i < rotationIndices.size(); i++)
+ for (size_t i = 0; i < rotationIndices.size(); i++)
{
indicesStr += StringHelper::Sprintf(" { 0x%04X, 0x%04X, 0x%04X },", rotationIndices[i].x, rotationIndices[i].y, rotationIndices[i].z);
diff --git a/ZAPD/ZCollision.cpp b/ZAPD/ZCollision.cpp
index 3df09fe..8d28fe8 100644
--- a/ZAPD/ZCollision.cpp
+++ b/ZAPD/ZCollision.cpp
@@ -42,14 +42,14 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
uint32_t waterBoxSegmentOffset = Seg2Filespace(waterBoxAddress, parent->baseAddress);
// HOTSPOT
- for (int i = 0; i < numVerts; i++)
+ for (uint16_t i = 0; i < numVerts; i++)
vertices.push_back(new VertexEntry(rawData, vtxSegmentOffset + (i * 6)));
// HOTSPOT
- for (int i = 0; i < numPolygons; i++)
+ for (uint16_t i = 0; i < numPolygons; i++)
polygons.push_back(new PolygonEntry(rawData, polySegmentOffset + (i * 16)));
- int highestPolyType = 0;
+ uint16_t highestPolyType = 0;
for (PolygonEntry* poly : polygons)
{
@@ -59,7 +59,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
//if (highestPolyType > 0)
{
- for (int i = 0; i < highestPolyType + 1; i++)
+ for (uint16_t i = 0; i < highestPolyType + 1; i++)
polygonTypes.push_back(BitConverter::ToUInt64BE(data, polyTypeDefSegmentOffset + (i * 8)));
}
//else
@@ -81,7 +81,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
if (waterBoxes.size() > 0)
{
- for (int i = 0; i < waterBoxes.size(); i++)
+ for (size_t i = 0; i < waterBoxes.size(); i++)
{
sprintf(line, " { %i, %i, %i, %i, %i, 0x%08X },\n", waterBoxes[i]->xMin, waterBoxes[i]->ySurface, waterBoxes[i]->zMin, waterBoxes[i]->xLength, waterBoxes[i]->zLength, waterBoxes[i]->properties);
declaration += line;
@@ -96,7 +96,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
{
declaration = "";
- for (int i = 0; i < polygons.size(); i++)
+ for (size_t i = 0; i < polygons.size(); i++)
{
sprintf(line, " { 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X },\n",
(uint16_t)polygons[i]->type, (uint16_t)polygons[i]->vtxA, (uint16_t)polygons[i]->vtxB, (uint16_t)polygons[i]->vtxC,
@@ -110,7 +110,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
}
declaration = "";
- for (int i = 0; i < polygonTypes.size(); i++)
+ for (size_t i = 0; i < polygonTypes.size(); i++)
{
declaration += StringHelper::Sprintf(" { 0x%08lX, 0x%08lX },", polygonTypes[i] >> 32, polygonTypes[i] & 0xFFFFFFFF);
@@ -128,7 +128,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, con
{
declaration = "";
- for (int i = 0; i < vertices.size(); i++)
+ for (size_t i = 0; i < vertices.size(); i++)
{
declaration += StringHelper::Sprintf(" { %i, %i, %i },", vertices[i]->x, vertices[i]->y, vertices[i]->z);
@@ -264,7 +264,7 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, const s
//setting cameraPosDataAddr to rawDataIndex give a pos list length of 0
uint32_t cameraPosDataOffset = cameraPosDataSeg & 0xFFFFFF;
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
char camSegLine[2048];
diff --git a/ZAPD/ZCollision.h b/ZAPD/ZCollision.h
index 7f7b715..729430d 100644
--- a/ZAPD/ZCollision.h
+++ b/ZAPD/ZCollision.h
@@ -66,9 +66,9 @@ class ZCollisionHeader : public ZResource
public:
int16_t absMinX, absMinY, absMinZ;
int16_t absMaxX, absMaxY, absMaxZ;
- int16_t numVerts;
+ uint16_t numVerts;
segptr_t vtxAddress;
- int16_t numPolygons;
+ uint16_t numPolygons;
segptr_t polyAddress;
segptr_t polyTypeDefAddress;
segptr_t camDataAddress;
diff --git a/ZAPD/ZCutscene.cpp b/ZAPD/ZCutscene.cpp
index 746c99d..1631da9 100644
--- a/ZAPD/ZCutscene.cpp
+++ b/ZAPD/ZCutscene.cpp
@@ -91,18 +91,18 @@ ZCutscene::~ZCutscene()
string ZCutscene::GetSourceOutputCode(const std::string& prefix)
{
string output = "";
- int size = 0;
+ size_t size = 0;
int32_t curPtr = 0;
//output += StringHelper::Sprintf("// SIZE = 0x%04X\n", GetRawDataSize());
output += StringHelper::Sprintf("\tCS_BEGIN_CUTSCENE(%i, %i),\n", commands.size(), endFrame);
- for (int i = 0; i < commands.size(); i++)
+ for (size_t i = 0; i < commands.size(); i++)
{
CutsceneCommand* cmd = commands[i];
output += "\t" + cmd->GenerateSourceCode(prefix, curPtr);
curPtr += (uint32_t)cmd->GetCommandSize();
- size += (int)cmd->GetCommandSize();
+ size += cmd->GetCommandSize();
}
output += StringHelper::Sprintf("\tCS_END(),\n", commands.size(), endFrame);
@@ -117,7 +117,7 @@ int ZCutscene::GetRawDataSize()
// Beginning
size += 8;
- for (int i = 0; i < commands.size(); i++)
+ for (size_t i = 0; i < commands.size(); i++)
{
CutsceneCommand* cmd = commands[i];
size += (int)cmd->GetCommandSize();
@@ -289,7 +289,7 @@ string CutsceneCommandSetCameraPos::GenerateSourceCode(const std::string& roomNa
result += StringHelper::Sprintf("%s(%i, %i),\n", listStr.c_str(), startFrame, endFrame);
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\t%s(%i, %i, %i, 0x%06X, %i, %i, %i, %i),\n", posStr.c_str(), entries[i]->continueFlag, entries[i]->cameraRoll, entries[i]->nextPointFrame,
*(uint32_t*)&entries[i]->viewAngle, entries[i]->posX, entries[i]->posY, entries[i]->posZ, entries[i]->unused);
@@ -345,7 +345,7 @@ string CutsceneCommandFadeBGM::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_FADE_BGM_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_FADE_BGM(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->base, entries[i]->startFrame, entries[i]->endFrame,
entries[i]->unknown0, entries[i]->unknown1, entries[i]->unknown2, entries[i]->unknown3, entries[i]->unknown4, entries[i]->unknown5, entries[i]->unknown6, entries[i]->unknown7);
@@ -393,7 +393,7 @@ string CutsceneCommandPlayBGM::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_PLAY_BGM_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_PLAY_BGM(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->sequence, entries[i]->startFrame,
entries[i]->endFrame, entries[i]->unknown0, entries[i]->unknown1, entries[i]->unknown2, entries[i]->unknown3, entries[i]->unknown4, entries[i]->unknown5,
@@ -432,7 +432,7 @@ string CutsceneCommandStopBGM::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_STOP_BGM_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_STOP_BGM(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->sequence, entries[i]->startFrame,
entries[i]->endFrame, entries[i]->unknown0, entries[i]->unknown1, entries[i]->unknown2, entries[i]->unknown3, entries[i]->unknown4, entries[i]->unknown5,
@@ -486,7 +486,7 @@ string CutsceneCommandEnvLighting::GenerateSourceCode(const std::string& roomNam
result += StringHelper::Sprintf("CS_LIGHTING_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_LIGHTING(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->setting, entries[i]->startFrame,
entries[i]->endFrame, entries[i]->unused0, entries[i]->unused1, entries[i]->unused2, entries[i]->unused3, entries[i]->unused4, entries[i]->unused5,
@@ -537,7 +537,7 @@ string CutsceneCommandUnknown9::GenerateSourceCode(const std::string& roomName,
result += StringHelper::Sprintf("CS_CMD_09_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_CMD_09(%i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->base, entries[i]->startFrame, entries[i]->endFrame, entries[i]->unk2,
entries[i]->unk3, entries[i]->unk4, entries[i]->unused0, entries[i]->unused1);
@@ -591,7 +591,7 @@ string CutsceneCommandUnknown::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%02X, %i),\n", commandID, entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_UNK_DATA(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->unused0, entries[i]->unused1, entries[i]->unused2,
entries[i]->unused3, entries[i]->unused4, entries[i]->unused5, entries[i]->unused6,
@@ -645,7 +645,7 @@ string CutsceneCommandDayTime::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_TIME_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_TIME(%i, %i, %i, %i, %i, %i),\n", entries[i]->base, entries[i]->startFrame, entries[i]->endFrame,
entries[i]->hour, entries[i]->minute, entries[i]->unused);
@@ -693,7 +693,7 @@ string CutsceneCommandTextbox::GenerateSourceCode(const std::string& roomName, i
result += StringHelper::Sprintf("CS_TEXT_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
if (entries[i]->base == 0xFFFF)
{
@@ -762,7 +762,7 @@ string CutsceneCommandActorAction::GenerateSourceCode(const std::string& roomNam
subCommand = "CS_NPC_ACTION";
}
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\t%s(0x%04X, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, %i, %i, %i, %i, %i, %i, %i),\n",
subCommand.c_str(), entries[i]->action, entries[i]->startFrame, entries[i]->endFrame,
@@ -879,7 +879,7 @@ string CutsceneCommandSpecialAction::GenerateSourceCode(const std::string& roomN
result += StringHelper::Sprintf("CS_MISC_LIST(%i),\n", entries.size());
- for (int i = 0; i < entries.size(); i++)
+ for (size_t i = 0; i < entries.size(); i++)
{
result += StringHelper::Sprintf("\t\tCS_MISC(0x%04X, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, %i, %i, %i, %i, %i, %i),\n", entries[i]->base, entries[i]->startFrame, entries[i]->endFrame,
entries[i]->unused0, entries[i]->unused1, entries[i]->unused2, entries[i]->unused3, entries[i]->unused4, entries[i]->unused5, entries[i]->unused6,
diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp
index 25cbe25..6e5c3e2 100644
--- a/ZAPD/ZDisplayList.cpp
+++ b/ZAPD/ZDisplayList.cpp
@@ -452,7 +452,7 @@ bool ZDisplayList::SequenceCheck(vector<F3DZEXOpcode> sequence, int startIndex)
{
bool success = true;
- for (int j = 0; j < sequence.size(); j++)
+ for (size_t j = 0; j < sequence.size(); j++)
{
F3DZEXOpcode opcode = (F3DZEXOpcode)(instructions[startIndex + j] >> 56);
@@ -1645,7 +1645,7 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
{
OutputFormatter outputformatter;
string sourceOutput = "";
- int dListSize = instructions.size() * sizeof(instructions[0]);
+ size_t dListSize = instructions.size() * sizeof(instructions[0]);
gfxd_input_buffer(instructions.data(), dListSize);
gfxd_endian(gfxd_endian_little, sizeof(uint64_t)); // tell gfxdis what format the data is
@@ -1682,17 +1682,17 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
return lhs.first < rhs.first;
});
- for (int i = 0; i < verticesSorted.size() - 1; i++)
+ for (size_t i = 0; i < verticesSorted.size() - 1; i++)
{
//int vtxSize = verticesSorted[i].second.size() * 16;
- int vtxSize = (int)vertices[verticesSorted[i].first].size() * 16;
+ size_t vtxSize = vertices[verticesSorted[i].first].size() * 16;
- if ((verticesSorted[i].first + vtxSize) > verticesSorted[i + 1].first)
+ if ((verticesSorted[i].first + (int)vtxSize) > verticesSorted[i + 1].first)
{
int intersectAmt = (verticesSorted[i].first + vtxSize) - verticesSorted[i + 1].first;
int intersectIndex = intersectAmt / 16;
- for (int j = intersectIndex; j < verticesSorted[i + 1].second.size(); j++)
+ for (size_t j = intersectIndex; j < verticesSorted[i + 1].second.size(); j++)
{
vertices[verticesSorted[i].first].push_back(verticesSorted[i + 1].second[j]);
}
@@ -1750,7 +1750,7 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
return lhs.first < rhs.first;
});
- for (int i = 0; i < texturesSorted.size() - 1; i++)
+ for (size_t i = 0; i < texturesSorted.size() - 1; i++)
{
int texSize = scene->textures[texturesSorted[i].first]->GetRawDataSize();
@@ -1780,7 +1780,7 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
return lhs.first < rhs.first;
});
- for (int i = 0; i < texturesSorted.size() - 1; i++)
+ for (size_t i = 0; i < texturesSorted.size() - 1; i++)
{
if (texturesSorted.size() == 0) // ?????
break;
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp
index 29881cb..0141bb3 100644
--- a/ZAPD/ZFile.cpp
+++ b/ZAPD/ZFile.cpp
@@ -1031,11 +1031,11 @@ string ZFile::ProcessDeclarations()
void ZFile::ProcessDeclarationText(Declaration* decl)
{
- int refIndex = 0;
+ size_t refIndex = 0;
if (decl->references.size() > 0)
{
- for (int i = 0; i < decl->text.size() - 1; i++)
+ for (size_t i = 0; i < decl->text.size() - 1; i++)
{
char c = decl->text[i];
char c2 = decl->text[i + 1];
diff --git a/ZAPD/ZRoom/Commands/SetActorList.cpp b/ZAPD/ZRoom/Commands/SetActorList.cpp
index 30ed52e..5e291eb 100644
--- a/ZAPD/ZRoom/Commands/SetActorList.cpp
+++ b/ZAPD/ZRoom/Commands/SetActorList.cpp
@@ -42,11 +42,11 @@ string SetActorList::GenerateSourceCodePass1(string roomName, int baseAddress)
string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress)
{
string sourceOutput = "";
- int numActorsReal = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 16;
+ size_t numActorsReal = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 16;
actors = vector<ActorSpawnEntry*>();
uint32_t currentPtr = segmentOffset;
- for (int i = 0; i < numActorsReal; i++)
+ for (size_t i = 0; i < numActorsReal; i++)
{
ActorSpawnEntry* entry = new ActorSpawnEntry(_rawData, currentPtr);
actors.push_back(entry);
@@ -61,7 +61,7 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress)
string declaration = "";
- int index = 0;
+ size_t index = 0;
for (ActorSpawnEntry* entry : actors)
{
uint16_t actorNum = entry->actorNum;
@@ -99,9 +99,9 @@ int32_t SetActorList::GetRawDataSize()
return ZRoomCommand::GetRawDataSize() + ((int)actors.size() * 16);
}
-int SetActorList::GetActorListArraySize()
+size_t SetActorList::GetActorListArraySize()
{
- int actorCount = 0;
+ size_t actorCount = 0;
// Doing an else-if here so we only do the loop when the game is SW97.
// Actor 0x22 is removed from SW97, so we need to ensure that we don't increment the actor count for it.
@@ -115,7 +115,7 @@ int SetActorList::GetActorListArraySize()
}
else
{
- actorCount = (int)actors.size();
+ actorCount = actors.size();
}
return actorCount;
diff --git a/ZAPD/ZRoom/Commands/SetActorList.h b/ZAPD/ZRoom/Commands/SetActorList.h
index 3f59494..d18d6ba 100644
--- a/ZAPD/ZRoom/Commands/SetActorList.h
+++ b/ZAPD/ZRoom/Commands/SetActorList.h
@@ -32,7 +32,7 @@ public:
virtual std::string GenerateExterns();
private:
- int GetActorListArraySize();
+ size_t GetActorListArraySize();
int numActors;
std::vector<ActorSpawnEntry*> actors;
uint32_t segmentOffset;
diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp
index 50baed3..a63ab83 100644
--- a/ZAPD/ZRoom/Commands/SetMesh.cpp
+++ b/ZAPD/ZRoom/Commands/SetMesh.cpp
@@ -79,7 +79,7 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
declaration = "";
- for (int i = 0; i < meshHeader0->entries.size(); i++)
+ for (size_t i = 0; i < meshHeader0->entries.size(); i++)
{
if (meshHeader0->entries[i]->opaqueDListAddr != 0)
declaration += StringHelper::Sprintf("\t{ (u32)%sDL_%06X, ", zRoom->GetName().c_str(), meshHeader0->entries[i]->opaqueDListAddr);
@@ -229,7 +229,7 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
declaration = "";
- for (int i = 0; i < meshHeader2->entries.size(); i++)
+ for (size_t i = 0; i < meshHeader2->entries.size(); i++)
{
declaration += StringHelper::Sprintf("\t{ %i, %i, %i, %i, ", meshHeader2->entries[i]->playerXMax, meshHeader2->entries[i]->playerZMax, meshHeader2->entries[i]->playerXMin, meshHeader2->entries[i]->playerZMin);
diff --git a/ZAPD/ZRoom/Commands/SetObjectList.cpp b/ZAPD/ZRoom/Commands/SetObjectList.cpp
index e91b0e9..935332f 100644
--- a/ZAPD/ZRoom/Commands/SetObjectList.cpp
+++ b/ZAPD/ZRoom/Commands/SetObjectList.cpp
@@ -14,7 +14,7 @@ SetObjectList::SetObjectList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int ra
segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4));
uint32_t currentPtr = segmentOffset;
- for (int i = 0; i < objectCnt; i++)
+ for (uint8_t i = 0; i < objectCnt; i++)
{
uint16_t objectIndex = BitConverter::ToInt16BE(rawData, currentPtr);
objects.push_back(objectIndex);
@@ -38,7 +38,7 @@ string SetObjectList::GenerateSourceCodePass1(string roomName, int baseAddress)
string declaration = "";
- for (int i = 0; i < objects.size(); i++)
+ for (size_t i = 0; i < objects.size(); i++)
{
uint16_t objectIndex = objects[i];
declaration += StringHelper::Sprintf("\t%s,", ObjectList[objectIndex].c_str());
diff --git a/ZAPD/ZRoom/Commands/SetPathways.cpp b/ZAPD/ZRoom/Commands/SetPathways.cpp
index a4f5e8d..a920e19 100644
--- a/ZAPD/ZRoom/Commands/SetPathways.cpp
+++ b/ZAPD/ZRoom/Commands/SetPathways.cpp
@@ -86,7 +86,7 @@ string SetPathways::GenerateSourceCodePass2(string roomName, int baseAddress)
{
string declaration = "";
- int index = 0;
+ size_t index = 0;
for (PathwayEntry* entry : pathways)
{
declaration += StringHelper::Sprintf(" { %i, %i, %i }, //0x%06X", entry->x, entry->y, entry->z, listSegmentOffset + (index * 6));
diff --git a/ZAPD/ZRoom/ZRoom.cpp b/ZAPD/ZRoom/ZRoom.cpp
index 43bf1a4..3bd3912 100644
--- a/ZAPD/ZRoom/ZRoom.cpp
+++ b/ZAPD/ZRoom/ZRoom.cpp
@@ -306,7 +306,7 @@ void ZRoom::ProcessCommandSets()
ParseCommands(setCommands, commandSets[0]);
commandSets.erase(commandSets.begin());
- for (int i = 0; i < setCommands.size(); i++)
+ for (size_t i = 0; i < setCommands.size(); i++)
{
ZRoomCommand* cmd = setCommands[i];
cmd->commandSet = commandSet & 0x00FFFFFF;
@@ -348,12 +348,12 @@ void ZRoom::SyotesRoomHack()
0x0A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08
};
- for (uint32_t i = 0; i < sizeof(headerData); i++)
+ for (size_t i = 0; i < sizeof(headerData); i++)
rawData.insert(rawData.begin() + i, headerData[i]);
SetMesh* cmdSetMesh = new SetMesh(this, rawData, 0, -8);
- for (uint32_t i = 0; i < sizeof(headerData); i++)
+ for (size_t i = 0; i < sizeof(headerData); i++)
rawData.erase(rawData.begin());
cmdSetMesh->cmdIndex = 0;
@@ -364,7 +364,7 @@ void ZRoom::SyotesRoomHack()
ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType)
{
- for (uint32_t i = 0; i < commands.size(); i++)
+ for (size_t i = 0; i < commands.size(); i++)
{
if (commands[i]->cmdID == cmdType)
return commands[i];
@@ -375,7 +375,7 @@ ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType)
size_t ZRoom::GetDeclarationSizeFromNeighbor(int declarationAddress)
{
- int declarationIndex = -1;
+ size_t declarationIndex = -1;
// Copy it into a vector.
vector<pair<int32_t, Declaration*>> declarationKeysSorted(parent->declarations.begin(), parent->declarations.end());
@@ -383,7 +383,7 @@ size_t ZRoom::GetDeclarationSizeFromNeighbor(int declarationAddress)
// Sort the vector according to the word count in descending order.
sort(declarationKeysSorted.begin(), declarationKeysSorted.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; });
- for (int i = 0; i < declarationKeysSorted.size(); i++)
+ for (size_t i = 0; i < declarationKeysSorted.size(); i++)
{
if (declarationKeysSorted[i].first == declarationAddress)
{
@@ -392,7 +392,7 @@ size_t ZRoom::GetDeclarationSizeFromNeighbor(int declarationAddress)
}
}
- if (declarationIndex != -1)
+ if ((int)declarationIndex != -1)
{
if (declarationIndex + 1 < declarationKeysSorted.size())
return declarationKeysSorted[declarationIndex + 1].first - declarationKeysSorted[declarationIndex].first;
@@ -405,9 +405,9 @@ size_t ZRoom::GetDeclarationSizeFromNeighbor(int declarationAddress)
size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
{
- int cmdIndex = -1;
+ size_t cmdIndex = -1;
- for (uint32_t i = 0; i < commands.size(); i++)
+ for (size_t i = 0; i < commands.size(); i++)
{
if (commands[i] == cmd)
{
@@ -416,7 +416,7 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
}
}
- if (cmdIndex != -1)
+ if ((int)cmdIndex != -1)
{
if (cmdIndex + 1 < commands.size())
return commands[cmdIndex + 1]->cmdAddress - commands[cmdIndex]->cmdAddress;
@@ -471,7 +471,7 @@ string ZRoom::GetSourceOutputCode(const std::string& prefix)
return lhs.first < rhs.first;
});
- for (int i = 0; i < texturesSorted.size() - 1; i++)
+ for (size_t i = 0; i < texturesSorted.size() - 1; i++)
{
int texSize = textures[texturesSorted[i].first]->GetRawDataSize();
diff --git a/ZAPD/ZTexture.cpp b/ZAPD/ZTexture.cpp
index e96c290..5dd6b77 100644
--- a/ZAPD/ZTexture.cpp
+++ b/ZAPD/ZTexture.cpp
@@ -157,7 +157,7 @@ void ZTexture::FixRawData()
{
if (type == TextureType::RGBA32bpp)
{
- for (int i = 0; i < rawData.size(); i += 4)
+ for (size_t i = 0; i < rawData.size(); i += 4)
{
uint8_t tmp = rawData[i];
rawData[i] = rawData[i + 2];
@@ -166,7 +166,7 @@ void ZTexture::FixRawData()
}
else if (type == TextureType::RGBA16bpp)// || type == TextureType::GrayscaleAlpha16bpp)
{
- for (int i = 0; i < rawData.size(); i += 2)
+ for (size_t i = 0; i < rawData.size(); i += 2)
{
uint8_t tmp = rawData[i];
rawData[i] = rawData[i + 1];
@@ -713,7 +713,7 @@ string ZTexture::GetSourceOutputCode(const std::string& prefix)
uint8_t* rawDataArr = rawData.data();
- for (int i = 0; i < rawData.size(); i += 8)
+ for (size_t i = 0; i < rawData.size(); i += 8)
{
if (i % 32 == 0)
sourceOutput += "\t";
diff --git a/ZAPD/ZVector.cpp b/ZAPD/ZVector.cpp
index d6f9003..e02631b 100644
--- a/ZAPD/ZVector.cpp
+++ b/ZAPD/ZVector.cpp
@@ -59,7 +59,7 @@ void ZVector::ParseRawData()
int ZVector::GetRawDataSize()
{
int size = 0;
- for (int i = 0; i < this->scalars.size(); i++)
+ for (size_t i = 0; i < this->scalars.size(); i++)
size += this->scalars[i]->GetRawDataSize();
return size;
}
@@ -97,7 +97,7 @@ std::string ZVector::GetSourceTypeName()
std::string ZVector::GetSourceValue()
{
std::vector<std::string> strings = std::vector<std::string>();
- for (int i = 0; i < this->scalars.size(); i++)
+ for (size_t i = 0; i < this->scalars.size(); i++)
strings.push_back(scalars[i]->GetSourceValue());
return "{ " + StringHelper::Implode(strings, ", ") + " }";
}