From 89f042f9b73d93854eab55ead5154cc82a54a348 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 8 Mar 2024 10:55:21 -0500 Subject: [PATCH] Change --- LEGO1/tgl/d3drm/unk.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/LEGO1/tgl/d3drm/unk.cpp b/LEGO1/tgl/d3drm/unk.cpp index 3e2053fa..11e073fa 100644 --- a/LEGO1/tgl/d3drm/unk.cpp +++ b/LEGO1/tgl/d3drm/unk.cpp @@ -79,7 +79,7 @@ inline Result CreateMesh( rpMesh->groupMesh = pD3DRM; for (int i = 0; i < count; i++) { - if (*((unsigned char*) &faceIndices[i] + 3) & 0x80) { + if (*((unsigned char*) ((unsigned short*) &faceIndices[i] + 1) + 1) & 0x80) { unsigned long j = *(unsigned short*) &faceIndices[i]; vertices[index].position.x = pPositions[j][0]; vertices[index].position.y = pPositions[j][1]; @@ -112,8 +112,10 @@ inline Result CreateMesh( } if (!Succeeded(result)) { - delete rpMesh->groupMesh; - rpMesh->groupMesh = NULL; + if (rpMesh) { + delete rpMesh; + } + rpMesh = NULL; } else { result = MeshSetTextureMappingMode(rpMesh, PerspectiveCorrect); @@ -127,10 +129,6 @@ inline Result CreateMesh( delete[] vertices; } - if (!Succeeded(result)) { - delete rpMesh; - } - return result; }