mirror of https://github.com/OpenRCT2/OpenRCT2.git
Change ride->overall_view to CoordsXY (#10673)
This commit is contained in:
parent
5da4903430
commit
d16fbb0cd2
|
@ -1912,11 +1912,10 @@ static void window_ride_init_viewport(rct_window* w)
|
||||||
}
|
}
|
||||||
} while (count >= 0);
|
} while (count >= 0);
|
||||||
|
|
||||||
auto location = ride->stations[stationIndex].Start;
|
auto location = ride->stations[stationIndex].GetStart();
|
||||||
|
focus.coordinate.x = location.x;
|
||||||
focus.coordinate.x = location.x * 32;
|
focus.coordinate.y = location.y;
|
||||||
focus.coordinate.y = location.y * 32;
|
focus.coordinate.z = location.z;
|
||||||
focus.coordinate.z = ride->stations[stationIndex].GetBaseZ();
|
|
||||||
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;
|
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -66,9 +66,8 @@ public:
|
||||||
auto banner = GetBanner(_bannerIndex);
|
auto banner = GetBanner(_bannerIndex);
|
||||||
|
|
||||||
res->Expenditure = ExpenditureType::Landscaping;
|
res->Expenditure = ExpenditureType::Landscaping;
|
||||||
res->Position.x = banner->position.x * 32 + 16;
|
auto location = banner->position.ToCoordsXY().ToTileCentre();
|
||||||
res->Position.y = banner->position.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
|
|
||||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||||
|
|
||||||
|
@ -116,9 +115,8 @@ public:
|
||||||
auto banner = GetBanner(_bannerIndex);
|
auto banner = GetBanner(_bannerIndex);
|
||||||
|
|
||||||
res->Expenditure = ExpenditureType::Landscaping;
|
res->Expenditure = ExpenditureType::Landscaping;
|
||||||
res->Position.x = banner->position.x * 32 + 16;
|
auto location = banner->position.ToCoordsXY().ToTileCentre();
|
||||||
res->Position.y = banner->position.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
|
|
||||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||||
|
|
||||||
|
|
|
@ -193,8 +193,7 @@ public:
|
||||||
|
|
||||||
if (ride->maze_tiles == 1)
|
if (ride->maze_tiles == 1)
|
||||||
{
|
{
|
||||||
auto tileStartLoc = TileCoordsXY{ startLoc };
|
ride->overall_view = startLoc;
|
||||||
ride->overall_view = tileStartLoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -233,8 +233,7 @@ public:
|
||||||
|
|
||||||
if (_initialPlacement && !(flags & GAME_COMMAND_FLAG_GHOST))
|
if (_initialPlacement && !(flags & GAME_COMMAND_FLAG_GHOST))
|
||||||
{
|
{
|
||||||
auto tileStartLoc = TileCoordsXY{ startLoc };
|
ride->overall_view = startLoc;
|
||||||
ride->overall_view = tileStartLoc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,11 +241,8 @@ private:
|
||||||
|
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
int32_t x = (ride->overall_view.x * 32) + 16;
|
auto xy = ride->overall_view.ToTileCentre();
|
||||||
int32_t y = (ride->overall_view.y * 32) + 16;
|
res->Position = { xy, tile_element_height(xy) };
|
||||||
int32_t z = tile_element_height({ x, y });
|
|
||||||
|
|
||||||
res->Position = { x, y, z };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ride->Delete();
|
ride->Delete();
|
||||||
|
@ -369,11 +366,8 @@ private:
|
||||||
|
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
int32_t x = (ride->overall_view.x * 32) + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
int32_t y = (ride->overall_view.y * 32) + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
int32_t z = tile_element_height({ x, y });
|
|
||||||
|
|
||||||
res->Position = { x, y, z };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, _rideIndex);
|
window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, _rideIndex);
|
||||||
|
|
|
@ -88,8 +88,7 @@ public:
|
||||||
|
|
||||||
if (!location.isNull())
|
if (!location.isNull())
|
||||||
{
|
{
|
||||||
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(
|
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.ToCoordsXY(), _rideIndex, _stationNum, _isExit);
|
||||||
{ location.x * 32, location.y * 32 }, _rideIndex, _stationNum, _isExit);
|
|
||||||
rideEntranceExitRemove.SetFlags(GetFlags());
|
rideEntranceExitRemove.SetFlags(GetFlags());
|
||||||
|
|
||||||
auto result = GameActions::QueryNested(&rideEntranceExitRemove);
|
auto result = GameActions::QueryNested(&rideEntranceExitRemove);
|
||||||
|
@ -155,8 +154,7 @@ public:
|
||||||
: ride_get_entrance_location(ride, _stationNum);
|
: ride_get_entrance_location(ride, _stationNum);
|
||||||
if (!location.isNull())
|
if (!location.isNull())
|
||||||
{
|
{
|
||||||
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(
|
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.ToCoordsXY(), _rideIndex, _stationNum, _isExit);
|
||||||
{ location.x * 32, location.y * 32 }, _rideIndex, _stationNum, _isExit);
|
|
||||||
rideEntranceExitRemove.SetFlags(GetFlags());
|
rideEntranceExitRemove.SetFlags(GetFlags());
|
||||||
|
|
||||||
auto result = GameActions::ExecuteNested(&rideEntranceExitRemove);
|
auto result = GameActions::ExecuteNested(&rideEntranceExitRemove);
|
||||||
|
|
|
@ -161,9 +161,8 @@ public:
|
||||||
auto res = std::make_unique<GameActionResult>();
|
auto res = std::make_unique<GameActionResult>();
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -95,9 +95,8 @@ public:
|
||||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
|
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
|
||||||
|
|
||||||
auto res = std::make_unique<GameActionResult>();
|
auto res = std::make_unique<GameActionResult>();
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,9 +95,8 @@ public:
|
||||||
|
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t shopItem;
|
uint32_t shopItem;
|
||||||
|
|
|
@ -245,9 +245,8 @@ public:
|
||||||
auto res = std::make_unique<GameActionResult>();
|
auto res = std::make_unique<GameActionResult>();
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(location) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
}
|
}
|
||||||
window_invalidate_by_number(WC_RIDE, _rideIndex);
|
window_invalidate_by_number(WC_RIDE, _rideIndex);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -122,9 +122,8 @@ public:
|
||||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(res->Position) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_status)
|
switch (_status)
|
||||||
|
|
|
@ -203,9 +203,8 @@ public:
|
||||||
auto res = std::make_unique<GameActionResult>();
|
auto res = std::make_unique<GameActionResult>();
|
||||||
if (!ride->overall_view.isNull())
|
if (!ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
auto location = ride->overall_view.ToTileCentre();
|
||||||
res->Position.y = ride->overall_view.y * 32 + 16;
|
res->Position = { location, tile_element_height(res->Position) };
|
||||||
res->Position.z = tile_element_height(res->Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE);
|
auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE);
|
||||||
|
|
|
@ -580,8 +580,7 @@ public:
|
||||||
|
|
||||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view.isNull())
|
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view.isNull())
|
||||||
{
|
{
|
||||||
ride->overall_view.x = mapLoc.x / 32;
|
ride->overall_view = mapLoc;
|
||||||
ride->overall_view.y = mapLoc.y / 32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tileElement = tile_element_insert(
|
auto tileElement = tile_element_insert(
|
||||||
|
|
|
@ -720,12 +720,11 @@ viewport_focus viewport_update_smart_guest_follow(rct_window* window, Peep* peep
|
||||||
auto ride = get_ride(peep->current_ride);
|
auto ride = get_ride(peep->current_ride);
|
||||||
if (ride != nullptr)
|
if (ride != nullptr)
|
||||||
{
|
{
|
||||||
auto x = (int32_t)ride->overall_view.x * 32 + 16;
|
auto xy = ride->overall_view.ToTileCentre();
|
||||||
auto y = (int32_t)ride->overall_view.y * 32 + 16;
|
|
||||||
focus.type = VIEWPORT_FOCUS_TYPE_COORDINATE;
|
focus.type = VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||||
focus.coordinate.x = x;
|
focus.coordinate.x = xy.x;
|
||||||
focus.coordinate.y = y;
|
focus.coordinate.y = xy.y;
|
||||||
focus.coordinate.z = tile_element_height({ x, y }) + 32;
|
focus.coordinate.z = tile_element_height(xy) + (4 * COORDS_Z_STEP);
|
||||||
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;
|
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,8 +222,8 @@ void news_item_get_subject_location(int32_t type, int32_t subject, int32_t* x, i
|
||||||
*x = LOCATION_NULL;
|
*x = LOCATION_NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*x = ride->overall_view.x * 32 + 16;
|
*x = ride->overall_view.x + 16;
|
||||||
*y = ride->overall_view.y * 32 + 16;
|
*y = ride->overall_view.y + 16;
|
||||||
*z = tile_element_height({ *x, *y });
|
*z = tile_element_height({ *x, *y });
|
||||||
break;
|
break;
|
||||||
case NEWS_ITEM_PEEP_ON_RIDE:
|
case NEWS_ITEM_PEEP_ON_RIDE:
|
||||||
|
|
|
@ -746,7 +746,7 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst->overall_view = { src->overall_view.x, src->overall_view.y };
|
dst->overall_view = TileCoordsXY{ src->overall_view.x, src->overall_view.y }.ToCoordsXY();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
||||||
|
|
|
@ -542,7 +542,8 @@ void S6Exporter::ExportRide(rct2_ride* dst, const Ride* src)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst->overall_view = { static_cast<uint8_t>(src->overall_view.x), static_cast<uint8_t>(src->overall_view.y) };
|
auto tileLoc = TileCoordsXY(src->overall_view);
|
||||||
|
dst->overall_view = { static_cast<uint8_t>(tileLoc.x), static_cast<uint8_t>(tileLoc.y) };
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
||||||
|
|
|
@ -529,7 +529,8 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst->overall_view = { src->overall_view.x, src->overall_view.y };
|
auto tileLoc = TileCoordsXY(src->overall_view.x, src->overall_view.y);
|
||||||
|
dst->overall_view = tileLoc.ToCoordsXY();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
for (int32_t i = 0; i < RCT12_MAX_STATIONS_PER_RIDE; i++)
|
||||||
|
|
|
@ -227,7 +227,7 @@ struct Ride
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
std::string custom_name;
|
std::string custom_name;
|
||||||
uint16_t default_name_number;
|
uint16_t default_name_number;
|
||||||
TileCoordsXY overall_view;
|
CoordsXY overall_view;
|
||||||
uint16_t vehicles[MAX_VEHICLES_PER_RIDE + 1]; // Points to the first car in the train
|
uint16_t vehicles[MAX_VEHICLES_PER_RIDE + 1]; // Points to the first car in the train
|
||||||
uint8_t depart_flags;
|
uint8_t depart_flags;
|
||||||
uint8_t num_stations;
|
uint8_t num_stations;
|
||||||
|
|
|
@ -237,11 +237,10 @@ uint8_t banner_get_closest_ride_index(const CoordsXYZ& mapPos)
|
||||||
if (ride_type_has_flag(ride.type, RIDE_TYPE_FLAG_IS_SHOP))
|
if (ride_type_has_flag(ride.type, RIDE_TYPE_FLAG_IS_SHOP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto location = ride.overall_view;
|
auto rideCoords = ride.overall_view;
|
||||||
if (location.isNull())
|
if (rideCoords.isNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto rideCoords = location.ToCoordsXY();
|
|
||||||
int32_t distance = abs(mapPos.x - rideCoords.x) + abs(mapPos.y - rideCoords.y);
|
int32_t distance = abs(mapPos.x - rideCoords.x) + abs(mapPos.y - rideCoords.y);
|
||||||
if (distance < resultDistance)
|
if (distance < resultDistance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -416,14 +416,14 @@ int16_t tile_element_height(const CoordsXY& loc)
|
||||||
{
|
{
|
||||||
// Off the map
|
// Off the map
|
||||||
if (!map_is_location_valid(loc))
|
if (!map_is_location_valid(loc))
|
||||||
return 16;
|
return 2 * COORDS_Z_STEP;
|
||||||
|
|
||||||
// Get the surface element for the tile
|
// Get the surface element for the tile
|
||||||
auto surfaceElement = map_get_surface_element_at(loc);
|
auto surfaceElement = map_get_surface_element_at(loc);
|
||||||
|
|
||||||
if (surfaceElement == nullptr)
|
if (surfaceElement == nullptr)
|
||||||
{
|
{
|
||||||
return 16;
|
return 2 * COORDS_Z_STEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t height = surfaceElement->GetBaseZ();
|
uint16_t height = surfaceElement->GetBaseZ();
|
||||||
|
@ -525,7 +525,7 @@ int16_t tile_element_height(const CoordsXY& loc)
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
// This tile is essentially at the next height level
|
// This tile is essentially at the next height level
|
||||||
height += 0x10;
|
height += LAND_HEIGHT_STEP;
|
||||||
// so we move *down* the slope
|
// so we move *down* the slope
|
||||||
if (quad < 0)
|
if (quad < 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue