diff options
| author | Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl> | 2021-03-07 15:01:48 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-07 13:01:48 -0500 |
| commit | 1e67767cf988af08e79d8cea4ee1e4d47658fe29 (patch) | |
| tree | 57b904cb43325ce1e91515384ac6e9283b659dd6 /ZAPD/ZRoom/Commands/SetMesh.cpp | |
| parent | d9ba72302b1105d79a06c7da8d9c1bbb8ba2fceb (diff) | |
Fix collision extraction from actor's data (#85)
* Fix collision extraction if it is in actor's data
Signed-off-by: Angie <angheloalf95@gmail.com>
* Seg2Filespace to avoid duplicated code
and rename the macro SEG2FILESPACE to GETSEGOFFSET
Also, try to use the macros GETSEGOFFSET and GETSEGNUM as much as
possible.
Signed-off-by: angie <angheloalf95@gmail.com>
* Reverse variables names
Signed-off-by: angie <angheloalf95@gmail.com>
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetMesh.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetMesh.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp index 7b1c6cb..3d60cfa 100644 --- a/ZAPD/ZRoom/Commands/SetMesh.cpp +++ b/ZAPD/ZRoom/Commands/SetMesh.cpp @@ -11,7 +11,7 @@ using namespace std; SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, int segAddressOffset) : ZRoomCommand(nZRoom, rawData, rawDataIndex) { data = rawData[rawDataIndex + 1]; - segmentOffset = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)); + segmentOffset = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, rawDataIndex + 4)); string declaration = ""; int8_t meshHeaderType = rawData[segmentOffset + 0]; @@ -22,8 +22,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, meshHeader0->headerType = 0; meshHeader0->entries = vector<MeshEntry0*>(); - meshHeader0->dListStart = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 4)); - meshHeader0->dListEnd = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 8)); + meshHeader0->dListStart = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 4)); + meshHeader0->dListEnd = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 8)); int8_t numEntries = rawData[segmentOffset + 1]; uint32_t currentPtr = meshHeader0->dListStart; @@ -38,8 +38,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, for (int i = 0; i < numEntries; i++) { MeshEntry0* entry = new MeshEntry0(); - entry->opaqueDListAddr = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, currentPtr + 0)); - entry->translucentDListAddr = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, currentPtr + 4)); + entry->opaqueDListAddr = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, currentPtr + 0)); + entry->translucentDListAddr = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, currentPtr + 4)); if (entry->opaqueDListAddr != 0) { @@ -134,7 +134,7 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration); meshHeader1 = headerSingle; -; } + } else if (fmt == 2) // Multi-Format { MeshHeader1Multi* headerMulti = new MeshHeader1Multi(); @@ -173,8 +173,8 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, meshHeader2->headerType = 2; meshHeader2->entries = vector<MeshEntry2*>(); - meshHeader2->dListStart = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 4)); - meshHeader2->dListEnd = SEG2FILESPACE(BitConverter::ToInt32BE(rawData, segmentOffset + 8)); + meshHeader2->dListStart = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 4)); + meshHeader2->dListEnd = GETSEGOFFSET(BitConverter::ToInt32BE(rawData, segmentOffset + 8)); int8_t numEntries = rawData[segmentOffset + 1]; uint32_t currentPtr = meshHeader2->dListStart; |
