From 1bd41c177ff7daa78f1965212c85e67b5f15dd27 Mon Sep 17 00:00:00 2001 From: Tahsin Date: Thu, 27 Jul 2023 20:25:33 +0200 Subject: [PATCH] 1264 GTD OPD Map Loading --- src/engine/N3Base/N3ShapeMgr.cpp | 7 ++++++- src/game/N3Terrain.cpp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/engine/N3Base/N3ShapeMgr.cpp b/src/engine/N3Base/N3ShapeMgr.cpp index fd19144b..ad8a68eb 100644 --- a/src/engine/N3Base/N3ShapeMgr.cpp +++ b/src/engine/N3Base/N3ShapeMgr.cpp @@ -90,7 +90,12 @@ void CN3ShapeMgr::ReleaseShapes() { bool CN3ShapeMgr::Load(HANDLE hFile) { DWORD dwRWC; int nL = 0; - + int TempVersion, TempIntStringLength; + ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version + ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length + CHAR * TempOPDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized + ReadFile(hFile, TempOPDMapNamebuffer, TempIntStringLength, &dwRWC, NULL); // Now read it and push it back to the OPDMapName char buffer + if (false == LoadCollisionData(hFile)) { return false; } diff --git a/src/game/N3Terrain.cpp b/src/game/N3Terrain.cpp index 61395299..975ea99c 100644 --- a/src/game/N3Terrain.cpp +++ b/src/game/N3Terrain.cpp @@ -389,6 +389,11 @@ bool CN3Terrain::Load(HANDLE hFile) { } DWORD dwRWC; + int TempVersion, TempIntStringLength; + ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version + ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length + CHAR * TempGTDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized + ReadFile(hFile, TempGTDMapNamebuffer, TempIntStringLength, &dwRWC, NULL); // Now read it and push it back to the GTDMapName char buffer ReadFile(hFile, &(m_ti_MapSize), sizeof(int), &dwRWC, NULL); m_pat_MapSize = (m_ti_MapSize - 1) / PATCH_TILE_SIZE;