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.
This commit is contained in:
Christoph Oelckers 2024-10-11 11:49:57 +02:00
parent 8bc21963e6
commit 0a80f70ace
2 changed files with 4 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -1766,7 +1766,7 @@ PlayerPart:
void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
{
short wallcount = 0;
int wallcount = 0;
DAngle delta_ang_from_orig;
// do scaling