mirror of https://github.com/OpenRCT2/OpenRCT2.git
Wrap direction in vehicle_update_motion_collision_detection
This commit is contained in:
parent
453e508716
commit
2258652e83
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue