From bc0e8b4a8d3d490a9a116748b9f15236bebc2612 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Jan 2022 18:03:59 +0100 Subject: [PATCH] - use a method for setting wall coordinates when loading a map. --- source/core/maploader.cpp | 15 +++++++++------ source/core/maptypes.h | 1 + source/games/blood/src/db.cpp | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index ccc931b09..edda7ba19 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -178,8 +178,9 @@ static void ReadSectorV5(FileReader& fr, sectortype& sect) static void ReadWallV7(FileReader& fr, walltype& wall) { - wall.__wall_int_pos.X = fr.ReadInt32(); - wall.__wall_int_pos.Y = fr.ReadInt32(); + int x = fr.ReadInt32(); + int y = fr.ReadInt32(); + wall.setPosFromLoad(x, y); wall.point2 = fr.ReadInt16(); wall.nextwall = fr.ReadInt16(); wall.nextsector = fr.ReadInt16(); @@ -199,8 +200,9 @@ static void ReadWallV7(FileReader& fr, walltype& wall) static void ReadWallV6(FileReader& fr, walltype& wall) { - wall.__wall_int_pos.X = fr.ReadInt32(); - wall.__wall_int_pos.Y = fr.ReadInt32(); + int x = fr.ReadInt32(); + int y = fr.ReadInt32(); + wall.setPosFromLoad(x, y); wall.point2 = fr.ReadInt16(); wall.nextsector = fr.ReadInt16(); wall.nextwall = fr.ReadInt16(); @@ -220,8 +222,9 @@ static void ReadWallV6(FileReader& fr, walltype& wall) static void ReadWallV5(FileReader& fr, walltype& wall) { - wall.__wall_int_pos.X = fr.ReadInt32(); - wall.__wall_int_pos.Y = fr.ReadInt32(); + int x = fr.ReadInt32(); + int y = fr.ReadInt32(); + wall.setPosFromLoad(x, y); wall.point2 = fr.ReadInt16(); wall.picnum = fr.ReadInt16(); wall.overpicnum = fr.ReadInt16(); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index e865117ad..42236e0b0 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -361,6 +361,7 @@ struct walltype vec2_t __wall_int_pos; const vec2_t wall_int_pos() const { return __wall_int_pos; } + void setPosFromLoad(int x, int y) { __wall_int_pos = { x, y }; } int32_t point2; int32_t nextwall; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index b114476ac..750d1cc70 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -392,8 +392,9 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* { dbCrypt((char*)&load, sizeof(walltypedisk), (gMapRev * sizeof(sectortypedisk)) | 0x7474614d); } - pWall->__wall_int_pos.X = LittleLong(load.x); - pWall->__wall_int_pos.Y = LittleLong(load.y); + int x = LittleLong(load.x); + int y = LittleLong(load.y); + pWall->setPosFromLoad(x, y); pWall->point2 = LittleShort(load.point2); pWall->nextwall = LittleShort(load.nextwall); pWall->nextsector = LittleShort(load.nextsector);