From e4ca397898bc59230f4458f72ada2fcaa95d15f3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 24 Sep 2022 18:13:16 +0200 Subject: [PATCH] - corrected sector check output in validateSprite. --- source/core/maploader.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index ef82a6c8d..da7ed7118 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -261,6 +261,8 @@ static void SetWallPalV5() void validateSprite(spritetype& spri, int sectnum, int index) { + sectortype* sectp = §or[sectnum]; + auto pos = spri.pos; bool bugged = false; if ((unsigned)spri.statnum >= MAXSTATUS) @@ -275,11 +277,11 @@ void validateSprite(spritetype& spri, int sectnum, int index) } else if (!validSectorIndex(sectnum)) { - sectnum = -1; - updatesector(pos, §num); - bugged = sectnum < 0; + sectp = nullptr; + updatesector(pos.XY(), §p); + bugged = sectp == nullptr; - if (!DPrintf(DMSG_WARNING, "Sprite #%d (%.0f,%.0f) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, sectnum)) + if (!DPrintf(DMSG_WARNING, "Sprite #%d (%.0f,%.0f) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, ::sectnum(sectp))) { if (bugged) Printf("Sprite #%d (%.0f,%.0f) with invalid sector %d\n", index, pos.X, pos.Y, sectnum); } @@ -288,10 +290,9 @@ void validateSprite(spritetype& spri, int sectnum, int index) { spri = {}; spri.statnum = MAXSTATUS; - sectnum = -1; + sectp = nullptr; } - if (sectnum >= 0) spri.sectp = §or[sectnum]; - else spri.sectp = nullptr; + spri.sectp = sectp; } static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)