mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 01:35:06 +01:00
Merge pull request #9321 from aw20368/fix/8723-use-rotate_map_coordinates
Fix #8723 Use rotate_map_coordinates to rotate coordinate
This commit is contained in:
@@ -2579,25 +2579,12 @@ TileElement* map_get_track_element_at_with_direction_from_ride(
|
||||
|
||||
void map_offset_with_rotation(int16_t* x, int16_t* y, int16_t offsetX, int16_t offsetY, uint8_t rotation)
|
||||
{
|
||||
switch (rotation & 3)
|
||||
{
|
||||
case TILE_ELEMENT_DIRECTION_WEST:
|
||||
*x += offsetX;
|
||||
*y += offsetY;
|
||||
break;
|
||||
case TILE_ELEMENT_DIRECTION_NORTH:
|
||||
*x += offsetY;
|
||||
*y -= offsetX;
|
||||
break;
|
||||
case TILE_ELEMENT_DIRECTION_EAST:
|
||||
*x -= offsetX;
|
||||
*y -= offsetY;
|
||||
break;
|
||||
case TILE_ELEMENT_DIRECTION_SOUTH:
|
||||
*x -= offsetY;
|
||||
*y += offsetX;
|
||||
break;
|
||||
}
|
||||
TileCoordsXY offsets = { offsetX, offsetY };
|
||||
TileCoordsXY newCoords = { *x, *y };
|
||||
newCoords += offsets.Rotate(rotation);
|
||||
|
||||
*x = (int16_t)newCoords.x;
|
||||
*y = (int16_t)newCoords.y;
|
||||
}
|
||||
|
||||
WallElement* map_get_wall_element_at(int32_t x, int32_t y, int32_t z, int32_t direction)
|
||||
|
||||
Reference in New Issue
Block a user