mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Use TileCoordsXY
This commit is contained in:
@@ -133,8 +133,8 @@ rct_window* window_banner_open(rct_windownumber number)
|
||||
window_init_scroll_widgets(w);
|
||||
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t view_x = banner->x << 5;
|
||||
int32_t view_y = banner->y << 5;
|
||||
int32_t view_x = banner->position.x << 5;
|
||||
int32_t view_y = banner->position.y << 5;
|
||||
|
||||
TileElement* tile_element = map_get_first_element_at(view_x / 32, view_y / 32);
|
||||
while (1)
|
||||
@@ -172,8 +172,8 @@ rct_window* window_banner_open(rct_windownumber number)
|
||||
static void window_banner_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t x = banner->x << 5;
|
||||
int32_t y = banner->y << 5;
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
|
||||
TileElement* tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
|
||||
@@ -343,8 +343,8 @@ static void window_banner_viewport_rotate(rct_window* w)
|
||||
|
||||
auto banner = get_banner(w->number);
|
||||
|
||||
int32_t view_x = (banner->x << 5) + 16;
|
||||
int32_t view_y = (banner->y << 5) + 16;
|
||||
int32_t view_x = (banner->position.x << 5) + 16;
|
||||
int32_t view_y = (banner->position.y << 5) + 16;
|
||||
int32_t view_z = w->frame_no;
|
||||
|
||||
// Create viewport
|
||||
|
||||
@@ -154,8 +154,8 @@ rct_window* window_sign_open(rct_windownumber number)
|
||||
window_init_scroll_widgets(w);
|
||||
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t view_x = banner->x << 5;
|
||||
int32_t view_y = banner->y << 5;
|
||||
int32_t view_x = banner->position.x << 5;
|
||||
int32_t view_y = banner->position.y << 5;
|
||||
|
||||
TileElement* tile_element = map_get_first_element_at(view_x / 32, view_y / 32);
|
||||
|
||||
@@ -204,8 +204,8 @@ rct_window* window_sign_open(rct_windownumber number)
|
||||
static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t x = banner->x << 5;
|
||||
int32_t y = banner->y << 5;
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
|
||||
switch (widgetIndex)
|
||||
@@ -370,8 +370,8 @@ static void window_sign_viewport_rotate(rct_window* w)
|
||||
|
||||
auto banner = get_banner(w->number);
|
||||
|
||||
int32_t view_x = (banner->x << 5) + 16;
|
||||
int32_t view_y = (banner->y << 5) + 16;
|
||||
int32_t view_x = (banner->position.x << 5) + 16;
|
||||
int32_t view_y = (banner->position.y << 5) + 16;
|
||||
int32_t view_z = w->frame_no;
|
||||
|
||||
// Create viewport
|
||||
@@ -410,8 +410,8 @@ rct_window* window_sign_small_open(rct_windownumber number)
|
||||
w->colours[2] = COLOUR_DARK_BROWN;
|
||||
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t view_x = banner->x << 5;
|
||||
int32_t view_y = banner->y << 5;
|
||||
int32_t view_x = banner->position.x << 5;
|
||||
int32_t view_y = banner->position.y << 5;
|
||||
|
||||
TileElement* tile_element = map_get_first_element_at(view_x / 32, view_y / 32);
|
||||
|
||||
@@ -459,8 +459,8 @@ rct_window* window_sign_small_open(rct_windownumber number)
|
||||
static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
auto banner = get_banner(w->number);
|
||||
int32_t x = banner->x << 5;
|
||||
int32_t y = banner->y << 5;
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
auto tile_element = map_get_first_element_at(x / 32, y / 32);
|
||||
|
||||
switch (widgetIndex)
|
||||
|
||||
@@ -145,8 +145,8 @@ public:
|
||||
banner->text_colour = 2;
|
||||
banner->type = _bannerType;
|
||||
banner->colour = _primaryColour;
|
||||
banner->x = _loc.x / 32;
|
||||
banner->y = _loc.y / 32;
|
||||
banner->position.x = _loc.x / 32;
|
||||
banner->position.y = _loc.y / 32;
|
||||
newTileElement->SetType(TILE_ELEMENT_TYPE_BANNER);
|
||||
BannerElement* bannerElement = newTileElement->AsBanner();
|
||||
bannerElement->clearance_height = newTileElement->base_height + 2;
|
||||
|
||||
@@ -66,9 +66,9 @@ public:
|
||||
auto banner = get_banner(_bannerIndex);
|
||||
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
res->Position.x = banner->x * 32 + 16;
|
||||
res->Position.y = banner->y * 32 + 16;
|
||||
res->Position.z = tile_element_height(banner->x, banner->y);
|
||||
res->Position.x = banner->position.x * 32 + 16;
|
||||
res->Position.y = banner->position.y * 32 + 16;
|
||||
res->Position.z = tile_element_height(banner->position.x, banner->position.y);
|
||||
|
||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||
|
||||
@@ -116,9 +116,9 @@ public:
|
||||
auto banner = get_banner(_bannerIndex);
|
||||
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
res->Position.x = banner->x * 32 + 16;
|
||||
res->Position.y = banner->y * 32 + 16;
|
||||
res->Position.z = tile_element_height(banner->x, banner->y);
|
||||
res->Position.x = banner->position.x * 32 + 16;
|
||||
res->Position.y = banner->position.y * 32 + 16;
|
||||
res->Position.z = tile_element_height(banner->position.x, banner->position.y);
|
||||
|
||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||
|
||||
|
||||
@@ -265,8 +265,8 @@ public:
|
||||
banner->text_colour = 2;
|
||||
banner->flags = BANNER_FLAG_IS_LARGE_SCENERY;
|
||||
banner->type = 0;
|
||||
banner->x = _loc.x / 32;
|
||||
banner->y = _loc.y / 32;
|
||||
banner->position.x = _loc.x / 32;
|
||||
banner->position.y = _loc.y / 32;
|
||||
|
||||
ride_id_t rideIndex = banner_get_closest_ride_index(_loc.x, _loc.y, maxHeight);
|
||||
if (rideIndex != RIDE_ID_NULL)
|
||||
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
{
|
||||
auto banner = get_banner(_bannerIndex);
|
||||
|
||||
int32_t x = banner->x << 5;
|
||||
int32_t y = banner->y << 5;
|
||||
int32_t x = banner->position.x << 5;
|
||||
int32_t y = banner->position.y << 5;
|
||||
|
||||
if (_name.empty() == false)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
auto banner = get_banner(_bannerIndex);
|
||||
|
||||
CoordsXY coords{ banner->x * 32, banner->y * 32 };
|
||||
CoordsXY coords{ banner->position.x * 32, banner->position.y * 32 };
|
||||
|
||||
if (_isLarge)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
{
|
||||
auto banner = get_banner(_bannerIndex);
|
||||
|
||||
CoordsXY coords{ banner->x * 32, banner->y * 32 };
|
||||
CoordsXY coords{ banner->position.x * 32, banner->position.y * 32 };
|
||||
|
||||
if (_isLarge)
|
||||
{
|
||||
|
||||
@@ -361,8 +361,8 @@ public:
|
||||
banner->text_colour = 2;
|
||||
banner->flags = BANNER_FLAG_IS_WALL;
|
||||
banner->type = 0;
|
||||
banner->x = _loc.x / 32;
|
||||
banner->y = _loc.y / 32;
|
||||
banner->position.x = _loc.x / 32;
|
||||
banner->position.y = _loc.y / 32;
|
||||
|
||||
ride_id_t rideIndex = banner_get_closest_ride_index(_loc.x, _loc.y, targetHeight);
|
||||
if (rideIndex != RIDE_ID_NULL)
|
||||
|
||||
@@ -2860,8 +2860,8 @@ private:
|
||||
|
||||
dst->colour = RCT1::GetColour(src->colour);
|
||||
dst->text_colour = src->text_colour;
|
||||
dst->x = src->x;
|
||||
dst->y = src->y;
|
||||
dst->position.x = src->x;
|
||||
dst->position.y = src->y;
|
||||
}
|
||||
|
||||
void FixEntrancePositions()
|
||||
|
||||
@@ -1197,8 +1197,8 @@ void S6Exporter::ExportBanner(RCT12Banner& dst, const Banner& src)
|
||||
dst.colour = src.colour;
|
||||
}
|
||||
dst.text_colour = src.text_colour;
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.x = src.position.x;
|
||||
dst.y = src.position.y;
|
||||
}
|
||||
|
||||
enum : uint32_t
|
||||
|
||||
@@ -853,8 +853,8 @@ public:
|
||||
}
|
||||
|
||||
dst->text_colour = src->text_colour;
|
||||
dst->x = src->x;
|
||||
dst->y = src->y;
|
||||
dst->position.x = src->x;
|
||||
dst->position.y = src->y;
|
||||
}
|
||||
|
||||
void Initialise()
|
||||
|
||||
@@ -119,7 +119,7 @@ TileElement* banner_get_tile_element(BannerIndex bannerIndex)
|
||||
auto banner = get_banner(bannerIndex);
|
||||
if (banner != nullptr)
|
||||
{
|
||||
auto tileElement = map_get_first_element_at(banner->x, banner->y);
|
||||
auto tileElement = map_get_first_element_at(banner->position.x, banner->position.y);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
do
|
||||
@@ -140,7 +140,7 @@ WallElement* banner_get_scrolling_wall_tile_element(BannerIndex bannerIndex)
|
||||
if (banner == nullptr)
|
||||
return nullptr;
|
||||
|
||||
auto tileElement = map_get_first_element_at(banner->x, banner->y);
|
||||
auto tileElement = map_get_first_element_at(banner->position.x, banner->position.y);
|
||||
if (tileElement == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@@ -256,8 +256,7 @@ void fix_duplicated_banners()
|
||||
// Copy over the original banner, but update the location
|
||||
auto& newBanner = *get_banner(newBannerIndex);
|
||||
newBanner = *get_banner(bannerIndex);
|
||||
newBanner.x = x;
|
||||
newBanner.y = y;
|
||||
newBanner.position = { x, y };
|
||||
|
||||
// Duplicate user string too
|
||||
rct_string_id stringIdx = newBanner.string_idx;
|
||||
|
||||
@@ -26,8 +26,7 @@ struct Banner
|
||||
uint8_t colour;
|
||||
uint8_t ride_index;
|
||||
uint8_t text_colour;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
TileCoordsXY position;
|
||||
};
|
||||
|
||||
enum BANNER_FLAGS
|
||||
|
||||
@@ -309,8 +309,7 @@ GameActionResult::Ptr tile_inspector_paste_element_at(CoordsXY loc, TileElement
|
||||
}
|
||||
auto& newBanner = *get_banner(newBannerIndex);
|
||||
newBanner = *get_banner(bannerIndex);
|
||||
newBanner.x = loc.x / 32;
|
||||
newBanner.y = loc.y / 32;
|
||||
newBanner.position = TileCoordsXY(loc);
|
||||
|
||||
// Use the new banner index
|
||||
tile_element_set_banner_index(&element, newBannerIndex);
|
||||
|
||||
Reference in New Issue
Block a user