mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-02 19:56:13 +01:00
Replace many occurrences of LocationXY16
This commit is contained in:
@@ -127,9 +127,9 @@ static void window_track_place_draw_mini_preview_track(
|
||||
TrackDesign* td6, int32_t pass, CoordsXY origin, CoordsXY min, CoordsXY max);
|
||||
static void window_track_place_draw_mini_preview_maze(
|
||||
TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max);
|
||||
static LocationXY16 draw_mini_preview_get_pixel_position(int16_t x, int16_t y);
|
||||
static bool draw_mini_preview_is_pixel_in_bounds(LocationXY16 pixel);
|
||||
static uint8_t* draw_mini_preview_get_pixel_ptr(LocationXY16 pixel);
|
||||
static ScreenCoordsXY draw_mini_preview_get_pixel_position(CoordsXY location);
|
||||
static bool draw_mini_preview_is_pixel_in_bounds(const ScreenCoordsXY& pixel);
|
||||
static uint8_t* draw_mini_preview_get_pixel_ptr(const ScreenCoordsXY& pixel);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -586,8 +586,7 @@ static void window_track_place_draw_mini_preview_track(
|
||||
}
|
||||
else
|
||||
{
|
||||
LocationXY16 pixelPosition = draw_mini_preview_get_pixel_position(
|
||||
rotatedAndOffsetTrackBlock.x, rotatedAndOffsetTrackBlock.y);
|
||||
auto pixelPosition = draw_mini_preview_get_pixel_position(rotatedAndOffsetTrackBlock);
|
||||
if (draw_mini_preview_is_pixel_in_bounds(pixelPosition))
|
||||
{
|
||||
uint8_t* pixel = draw_mini_preview_get_pixel_ptr(pixelPosition);
|
||||
@@ -647,8 +646,7 @@ static void window_track_place_draw_mini_preview_track(
|
||||
}
|
||||
else
|
||||
{
|
||||
LocationXY16 pixelPosition = draw_mini_preview_get_pixel_position(
|
||||
rotatedAndOffsetEntrance.x, rotatedAndOffsetEntrance.y);
|
||||
auto pixelPosition = draw_mini_preview_get_pixel_position(rotatedAndOffsetEntrance);
|
||||
if (draw_mini_preview_is_pixel_in_bounds(pixelPosition))
|
||||
{
|
||||
uint8_t* pixel = draw_mini_preview_get_pixel_ptr(pixelPosition);
|
||||
@@ -682,7 +680,7 @@ static void window_track_place_draw_mini_preview_maze(
|
||||
}
|
||||
else
|
||||
{
|
||||
LocationXY16 pixelPosition = draw_mini_preview_get_pixel_position(rotatedMazeCoords.x, rotatedMazeCoords.y);
|
||||
auto pixelPosition = draw_mini_preview_get_pixel_position(rotatedMazeCoords);
|
||||
if (draw_mini_preview_is_pixel_in_bounds(pixelPosition))
|
||||
{
|
||||
uint8_t* pixel = draw_mini_preview_get_pixel_ptr(pixelPosition);
|
||||
@@ -707,17 +705,18 @@ static void window_track_place_draw_mini_preview_maze(
|
||||
}
|
||||
}
|
||||
|
||||
static LocationXY16 draw_mini_preview_get_pixel_position(int16_t x, int16_t y)
|
||||
static ScreenCoordsXY draw_mini_preview_get_pixel_position(CoordsXY location)
|
||||
{
|
||||
return { (int16_t)(80 + ((y / 32) - (x / 32)) * 4), (int16_t)(38 + ((y / 32) + (x / 32)) * 2) };
|
||||
auto tilePos = TileCoordsXY(location);
|
||||
return { (80 + (tilePos.y - tilePos.x) * 4), (38 + (tilePos.y + tilePos.x) * 2) };
|
||||
}
|
||||
|
||||
static bool draw_mini_preview_is_pixel_in_bounds(LocationXY16 pixel)
|
||||
static bool draw_mini_preview_is_pixel_in_bounds(const ScreenCoordsXY& pixel)
|
||||
{
|
||||
return pixel.x >= 0 && pixel.y >= 0 && pixel.x <= 160 && pixel.y <= 75;
|
||||
}
|
||||
|
||||
static uint8_t* draw_mini_preview_get_pixel_ptr(LocationXY16 pixel)
|
||||
static uint8_t* draw_mini_preview_get_pixel_ptr(const ScreenCoordsXY& pixel)
|
||||
{
|
||||
return &_window_track_place_mini_preview[pixel.y * TRACK_MINI_PREVIEW_WIDTH + pixel.x];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user