diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2021-04-13 12:08:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-13 12:08:54 -0400 |
| commit | 96ffc1e62720f0f43eb4885e6e7dbaf76a2f6cd2 (patch) | |
| tree | b35772e0a399a4b19590492fdb9fce556b232c79 /ZAPD/ZRoom/Commands/SetPathways.cpp | |
| parent | 420508d2d872e8653081d95a43bf2ad8f85d894c (diff) | |
Fixed pathway bug (#112)
Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetPathways.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetPathways.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ZAPD/ZRoom/Commands/SetPathways.cpp b/ZAPD/ZRoom/Commands/SetPathways.cpp index d36d15d..a58b5b0 100644 --- a/ZAPD/ZRoom/Commands/SetPathways.cpp +++ b/ZAPD/ZRoom/Commands/SetPathways.cpp @@ -7,13 +7,16 @@ using namespace std; -SetPathways::SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex) +SetPathways::SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, bool isFromHeader) : ZRoomCommand(nZRoom, rawData, rawDataIndex) { _rawData = rawData; _rawDataIndex = rawDataIndex; - segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)); + if (isFromHeader) + segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)); + else + segmentOffset = _rawDataIndex; if (segmentOffset != 0) zRoom->parent->AddDeclarationPlaceholder(segmentOffset); @@ -32,7 +35,7 @@ string SetPathways::GetSourceOutputCode(std::string prefix) string SetPathways::GenerateSourceCodePass1(string roomName, int baseAddress) { - int numPaths = (Globals::Instance->game != ZGame::MM_RETAIL) ? 1 : zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 8; + int numPaths = (Globals::Instance->game != ZGame::MM_RETAIL) ? 1 : zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 8; pathwayList = new PathwayList(zRoom, _rawData, segmentOffset, numPaths); @@ -88,7 +91,6 @@ PathwayEntry::PathwayEntry(std::vector<uint8_t> rawData, int rawDataIndex) : listSegmentOffset(GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4))) { uint32_t currentPtr = listSegmentOffset; - uint8_t* data = rawData.data(); for (int i = 0; i < numPoints; i++) @@ -98,7 +100,6 @@ PathwayEntry::PathwayEntry(std::vector<uint8_t> rawData, int rawDataIndex) : z = BitConverter::ToInt16BE(data, currentPtr + 4); Vec3s point = Vec3s(x, y, z); - points.push_back(point); currentPtr += 6; @@ -120,7 +121,6 @@ PathwayList::PathwayList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDat _rawDataIndex = rawDataIndex; uint32_t currentPtr = rawDataIndex; - uint8_t* data = rawData.data(); for (int pathIndex = 0; pathIndex < length; pathIndex++) |
