From 0a80f70acef6333a5fcdd0357e48d0d42f5c5dd5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 11 Oct 2024 11:49:57 +0200 Subject: [PATCH] SW: fix sector object setup. When moving the SO out of the way to get the sector, this only works for rotatable SO's. For non-rotating ones the internally used functions never did what was expected, letting the SO end up in invalid space. To do this properly the SOBJ_DONT_ROTATE flag must be cleared temporarily. --- source/games/sw/src/player.cpp | 3 +++ source/games/sw/src/track.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index efc7444ff2..3f7cd84372 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -4935,6 +4935,8 @@ void FindMainSector(SECTOR_OBJECT* sop) if (sop->op_main_sector == nullptr) { auto oldpos = sop->pmid; + auto oldflags = sop->flags; + sop->flags &= ~SOBJ_DONT_ROTATE; // This flag must be disabled here because it messes with the movement that's intended below. PlaceSectorObject(sop, { MAXSO, MAXSO }); @@ -4944,6 +4946,7 @@ void FindMainSector(SECTOR_OBJECT* sop) updatesectorz(oldpos, &sop->op_main_sector); PlaceSectorObject(sop, oldpos.XY()); + sop->flags = oldflags; } } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index b037d78162..3436e64e5b 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1766,7 +1766,7 @@ void MovePoints(SECTOR_OBJECT* sop, DAngle deltaangle, const DVector2& move) void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic) { - short wallcount = 0; + int wallcount = 0; DAngle delta_ang_from_orig; // do scaling