mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Wrap direction in vehicle_update_motion_collision_detection
This commit is contained in:
@@ -7101,9 +7101,10 @@ static bool vehicle_update_motion_collision_detection(
|
||||
|
||||
if (direction < 0x14) continue;
|
||||
|
||||
assert(((4 + vehicle->sprite_direction) >> 3) < countof(duck_move_offset));
|
||||
uint32 next_x_diff = abs(x + duck_move_offset[(4 + vehicle->sprite_direction) >> 3].x - collideVehicle->x);
|
||||
uint32 next_y_diff = abs(y + duck_move_offset[(4 + vehicle->sprite_direction) >> 3].y - collideVehicle->y);
|
||||
uint32 offsetSpriteDirection = (vehicle->sprite_direction + 4) & 31;
|
||||
uint32 offsetDirection = offsetSpriteDirection >> 3;
|
||||
uint32 next_x_diff = abs(x + duck_move_offset[offsetDirection].x - collideVehicle->x);
|
||||
uint32 next_y_diff = abs(y + duck_move_offset[offsetDirection].y - collideVehicle->y);
|
||||
|
||||
if (next_x_diff + next_y_diff < x_diff + y_diff){
|
||||
mayCollide = true;
|
||||
|
||||
Reference in New Issue
Block a user