Skip to content

Commit

Permalink
SW: fix sector object setup.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
coelckers committed Oct 11, 2024
1 parent 8bc2196 commit 0a80f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions source/games/sw/src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand All @@ -4944,6 +4946,7 @@ void FindMainSector(SECTOR_OBJECT* sop)
updatesectorz(oldpos, &sop->op_main_sector);

PlaceSectorObject(sop, oldpos.XY());
sop->flags = oldflags;
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/games/sw/src/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a80f70

Please sign in to comment.