Skip to content

Commit 76fe82f

Browse files
briancoelckers
authored andcommitted
Fix for CCW rotating doors reaching a negative Build angle, resulting in open and snap back behavior.
1 parent 6fa1f50 commit 76fe82f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/games/duke/src/actors.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,11 @@ void handle_se11(DDukeActor *actor)
25192519
if (actor->temp_data[4] <= -511 || actor->temp_data[4] >= 512)
25202520
{
25212521
actor->temp_data[4] = 0;
2522-
actor->temp_angle = mapangle(actor->temp_angle.Buildang() & 0xffffff00); // Gross hack! What is this supposed to do?
2522+
// Normalize to avoid getting negative Build angle on CCW rotations
2523+
int snapped = actor->temp_angle.Normalized360().Buildang();
2524+
// Quantize to 256-bit increments to prevent vector drift (legacy Build behavior)
2525+
snapped &= 0xffffff00;
2526+
actor->temp_angle = mapangle(snapped);
25232527
movesector(actor, actor->temp_data[1], actor->temp_angle);
25242528
//SetActor(actor, actor->spr.pos);
25252529
}

0 commit comments

Comments
 (0)