Wrap direction in vehicle_update_motion_collision_detection

This commit is contained in:
Ted John 2016-09-18 21:49:58 +01:00
parent 453e508716
commit 2258652e83
1 changed files with 4 additions and 3 deletions

View File

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