mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #10864 from Gymnasiast/refactor/station-starts
Change station starts to CoordsXY
This commit is contained in:
commit
904cad77b5
|
@ -905,10 +905,9 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
|||
rct_window* w = window_get_main();
|
||||
if (w != nullptr)
|
||||
{
|
||||
int32_t x = (int16_t)(int_val[0] * 32 + 16);
|
||||
int32_t y = (int16_t)(int_val[1] * 32 + 16);
|
||||
int32_t z = tile_element_height({ x, y });
|
||||
w->SetLocation(x, y, z);
|
||||
auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre();
|
||||
location.z = tile_element_height(location);
|
||||
w->SetLocation(location.x, location.y, location.z);
|
||||
viewport_update_position(w);
|
||||
console.Execute("get location");
|
||||
}
|
||||
|
|
|
@ -3233,9 +3233,8 @@ template<typename T> static void peep_head_for_nearest_ride(Guest* peep, bool co
|
|||
auto ride = get_ride(potentialRides[i]);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
int32_t rideX = ride->stations[0].Start.x * 32;
|
||||
int32_t rideY = ride->stations[0].Start.y * 32;
|
||||
int32_t distance = abs(rideX - peep->x) + abs(rideY - peep->y);
|
||||
auto rideLocation = ride->stations[0].Start;
|
||||
int32_t distance = abs(rideLocation.x - peep->x) + abs(rideLocation.y - peep->y);
|
||||
if (distance < closestRideDistance)
|
||||
{
|
||||
closestRide = ride;
|
||||
|
@ -3541,11 +3540,9 @@ static constexpr const CoordsXY _MazeEntranceStart[] = {
|
|||
{ 24, 8 },
|
||||
};
|
||||
|
||||
static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, TileCoordsXYZD& entrance_loc)
|
||||
static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
{
|
||||
peep->maze_last_edge = entrance_loc.direction + 1;
|
||||
entrance_loc.x *= 32;
|
||||
entrance_loc.y *= 32;
|
||||
|
||||
entrance_loc.x += CoordsDirectionDelta[entrance_loc.direction].x;
|
||||
entrance_loc.y += CoordsDirectionDelta[entrance_loc.direction].y;
|
||||
|
@ -3574,10 +3571,9 @@ static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, TileCo
|
|||
peep->sub_state = PEEP_RIDE_MAZE_PATHFINDING;
|
||||
}
|
||||
|
||||
static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride, TileCoordsXYZD& entrance_loc)
|
||||
static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
{
|
||||
entrance_loc.x = ride->stations[peep->current_ride_station].Start.x * 32;
|
||||
entrance_loc.y = ride->stations[peep->current_ride_station].Start.y * 32;
|
||||
entrance_loc = { ride->stations[peep->current_ride_station].GetStart(), entrance_loc.direction };
|
||||
|
||||
TileElement* tile_element = ride_get_station_start_track_element(ride, peep->current_ride_station);
|
||||
|
||||
|
@ -3585,10 +3581,7 @@ static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride
|
|||
|
||||
peep->var_37 = (entrance_loc.direction << 2) | (direction_track << 4);
|
||||
|
||||
const CoordsXY slidePlatformDestination = SpiralSlideWalkingPath[peep->var_37];
|
||||
|
||||
entrance_loc.x += slidePlatformDestination.x;
|
||||
entrance_loc.y += slidePlatformDestination.y;
|
||||
entrance_loc += SpiralSlideWalkingPath[peep->var_37];
|
||||
|
||||
peep->destination_x = entrance_loc.x;
|
||||
peep->destination_y = entrance_loc.y;
|
||||
|
@ -3631,7 +3624,7 @@ static void peep_update_ride_leave_entrance_waypoints(Peep* peep, Ride* ride)
|
|||
Guard::Assert(!entranceLocation.isNull());
|
||||
uint8_t direction_entrance = entranceLocation.direction;
|
||||
|
||||
CoordsXY waypoint = ride->stations[peep->current_ride_station].Start.ToCoordsXY().ToTileCentre();
|
||||
CoordsXY waypoint = ride->stations[peep->current_ride_station].Start.ToTileCentre();
|
||||
|
||||
TileElement* tile_element = ride_get_station_start_track_element(ride, peep->current_ride_station);
|
||||
|
||||
|
@ -3705,7 +3698,7 @@ void Guest::UpdateRideAdvanceThroughEntrance()
|
|||
Guard::Assert(sub_state == PEEP_RIDE_LEAVE_ENTRANCE, "Peep substate should be LEAVE_ENTRANCE");
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_NO_VEHICLES))
|
||||
{
|
||||
TileCoordsXYZD entranceLocation = ride_get_entrance_location(ride, current_ride_station);
|
||||
auto entranceLocation = ride_get_entrance_location(ride, current_ride_station).ToCoordsXYZD();
|
||||
Guard::Assert(!entranceLocation.isNull());
|
||||
|
||||
if (ride->type == RIDE_TYPE_MAZE)
|
||||
|
@ -4263,13 +4256,11 @@ void Guest::UpdateRideLeaveVehicle()
|
|||
return;
|
||||
}
|
||||
|
||||
TileCoordsXYZD exitLocation = ride_get_exit_location(ride, current_ride_station);
|
||||
auto exitLocation = ride_get_exit_location(ride, current_ride_station).ToCoordsXYZD();
|
||||
Guard::Assert(!exitLocation.isNull());
|
||||
CoordsXYZ waypointLoc;
|
||||
|
||||
waypointLoc.z = (int16_t)exitLocation.z * 8 + RideData5[ride->type].z;
|
||||
waypointLoc.x = ride->stations[current_ride_station].Start.x * 32 + 16;
|
||||
waypointLoc.y = ride->stations[current_ride_station].Start.y * 32 + 16;
|
||||
auto waypointLoc = CoordsXYZ{ ride->stations[current_ride_station].Start.ToTileCentre(),
|
||||
exitLocation.z + RideData5[ride->type].z };
|
||||
|
||||
TileElement* trackElement = ride_get_station_start_track_element(ride, current_ride_station);
|
||||
|
||||
|
@ -4462,9 +4453,7 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
|||
|
||||
Vehicle* vehicle = GET_VEHICLE(ride->vehicles[current_train]);
|
||||
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32 + 16;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32 + 16;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start.ToTileCentre();
|
||||
|
||||
if (ride->type == RIDE_TYPE_ENTERPRISE)
|
||||
{
|
||||
|
@ -4532,9 +4521,7 @@ void Guest::UpdateRideApproachExitWaypoints()
|
|||
|
||||
var_37--;
|
||||
Vehicle* vehicle = GET_VEHICLE(ride->vehicles[current_train]);
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32 + 16;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32 + 16;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start.ToTileCentre();
|
||||
|
||||
if (ride->type == RIDE_TYPE_ENTERPRISE)
|
||||
{
|
||||
|
@ -4630,9 +4617,7 @@ void Guest::UpdateRideApproachSpiralSlide()
|
|||
auto exit = ride_get_exit_location(ride, current_ride_station);
|
||||
waypoint = 1;
|
||||
var_37 = (exit.direction * 4) | (var_37 & 0x30) | waypoint;
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start;
|
||||
|
||||
assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE);
|
||||
targetLoc += SpiralSlideWalkingPath[var_37];
|
||||
|
@ -4647,9 +4632,7 @@ void Guest::UpdateRideApproachSpiralSlide()
|
|||
// Actually increment the real peep waypoint
|
||||
var_37++;
|
||||
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start;
|
||||
|
||||
assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE);
|
||||
targetLoc += SpiralSlideWalkingPath[var_37];
|
||||
|
@ -4707,19 +4690,18 @@ void Guest::UpdateRideOnSpiralSlide()
|
|||
return;
|
||||
case 3:
|
||||
{
|
||||
int16_t newX = ride->stations[current_ride_station].Start.x * 32;
|
||||
int16_t newY = ride->stations[current_ride_station].Start.y * 32;
|
||||
auto newLocation = ride->stations[current_ride_station].Start;
|
||||
uint8_t dir = (var_37 / 4) & 3;
|
||||
|
||||
// Set the location that the peep walks to go on slide again
|
||||
destination_x = newX + _SpiralSlideEndWaypoint[dir].x;
|
||||
destination_y = newY + _SpiralSlideEndWaypoint[dir].y;
|
||||
destination_x = newLocation.x + _SpiralSlideEndWaypoint[dir].x;
|
||||
destination_y = newLocation.y + _SpiralSlideEndWaypoint[dir].y;
|
||||
|
||||
// Move the peep sprite to just at the end of the slide
|
||||
newX += _SpiralSlideEnd[dir].x;
|
||||
newY += _SpiralSlideEnd[dir].y;
|
||||
newLocation.x += _SpiralSlideEnd[dir].x;
|
||||
newLocation.y += _SpiralSlideEnd[dir].y;
|
||||
|
||||
MoveTo(newX, newY, z);
|
||||
MoveTo(newLocation.x, newLocation.y, z);
|
||||
|
||||
sprite_direction = (var_37 & 0xC) * 2;
|
||||
|
||||
|
@ -4740,9 +4722,7 @@ void Guest::UpdateRideOnSpiralSlide()
|
|||
uint8_t waypoint = 2;
|
||||
var_37 = (var_37 * 4 & 0x30) + waypoint;
|
||||
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start;
|
||||
|
||||
assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE);
|
||||
targetLoc += SpiralSlideWalkingPath[var_37];
|
||||
|
@ -4783,9 +4763,7 @@ void Guest::UpdateRideLeaveSpiralSlide()
|
|||
waypoint--;
|
||||
// Actually decrement the peep waypoint
|
||||
var_37--;
|
||||
CoordsXY targetLoc;
|
||||
targetLoc.x = ride->stations[current_ride_station].Start.x * 32;
|
||||
targetLoc.y = ride->stations[current_ride_station].Start.y * 32;
|
||||
CoordsXY targetLoc = ride->stations[current_ride_station].Start;
|
||||
|
||||
assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE);
|
||||
targetLoc += SpiralSlideWalkingPath[var_37];
|
||||
|
|
|
@ -2115,7 +2115,7 @@ int32_t guest_path_finding(Guest* peep)
|
|||
if (numEntranceStations == 0)
|
||||
{
|
||||
// closestStationNum is always 0 here.
|
||||
auto entranceXY = ride->stations[closestStationNum].Start;
|
||||
auto entranceXY = TileCoordsXY(ride->stations[closestStationNum].Start);
|
||||
loc.x = entranceXY.x;
|
||||
loc.y = entranceXY.y;
|
||||
loc.z = ride->stations[closestStationNum].Height;
|
||||
|
|
|
@ -757,9 +757,10 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
dst->stations[i].Start = { src->station_starts[i].x, src->station_starts[i].y };
|
||||
auto tileStartLoc = TileCoordsXY{ src->station_starts[i].x, src->station_starts[i].y };
|
||||
dst->stations[i].Start = tileStartLoc.ToCoordsXY();
|
||||
}
|
||||
dst->stations[i].SetBaseZ(src->station_height[i] * 4);
|
||||
dst->stations[i].SetBaseZ(src->station_height[i] * RCT1_COORDS_Z_STEP);
|
||||
dst->stations[i].Length = src->station_length[i];
|
||||
dst->stations[i].Depart = src->station_light[i];
|
||||
|
||||
|
|
|
@ -555,8 +555,8 @@ void S6Exporter::ExportRide(rct2_ride* dst, const Ride* src)
|
|||
}
|
||||
else
|
||||
{
|
||||
dst->station_starts[i] = { static_cast<uint8_t>(src->stations[i].Start.x),
|
||||
static_cast<uint8_t>(src->stations[i].Start.y) };
|
||||
auto tileStartLoc = TileCoordsXY(src->stations[i].Start);
|
||||
dst->station_starts[i] = { static_cast<uint8_t>(tileStartLoc.x), static_cast<uint8_t>(tileStartLoc.y) };
|
||||
}
|
||||
dst->station_heights[i] = src->stations[i].Height;
|
||||
dst->station_length[i] = src->stations[i].Length;
|
||||
|
|
|
@ -541,7 +541,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
dst->stations[i].Start = { src->station_starts[i].x, src->station_starts[i].y };
|
||||
auto tileStartLoc = TileCoordsXY(src->station_starts[i].x, src->station_starts[i].y);
|
||||
dst->stations[i].Start = tileStartLoc.ToCoordsXY();
|
||||
}
|
||||
dst->stations[i].Height = src->station_heights[i];
|
||||
dst->stations[i].Length = src->station_length[i];
|
||||
|
|
|
@ -2226,20 +2226,16 @@ void Ride::UpdateSpiralSlide()
|
|||
if (stations[i].Start.isNull())
|
||||
continue;
|
||||
|
||||
int32_t x = stations[i].Start.x;
|
||||
int32_t y = stations[i].Start.y;
|
||||
auto startLoc = stations[i].Start;
|
||||
|
||||
TileElement* tileElement = ride_get_station_start_track_element(this, i);
|
||||
if (tileElement == nullptr)
|
||||
continue;
|
||||
|
||||
int32_t rotation = tileElement->GetDirection();
|
||||
x *= 32;
|
||||
y *= 32;
|
||||
x += ride_spiral_slide_main_tile_offset[rotation][current_rotation].x;
|
||||
y += ride_spiral_slide_main_tile_offset[rotation][current_rotation].y;
|
||||
startLoc += ride_spiral_slide_main_tile_offset[rotation][current_rotation];
|
||||
|
||||
map_invalidate_tile_zoom0({ x, y, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
|
||||
map_invalidate_tile_zoom0({ startLoc, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3268,7 +3264,7 @@ static void ride_entrance_exit_connected(Ride* ride)
|
|||
|
||||
static void ride_shop_connected(Ride* ride)
|
||||
{
|
||||
TileCoordsXY shopLoc = ride->stations[0].Start;
|
||||
auto shopLoc = TileCoordsXY(ride->stations[0].Start);
|
||||
if (shopLoc.isNull())
|
||||
return;
|
||||
|
||||
|
@ -4888,11 +4884,11 @@ void loc_6DDF9C(Ride* ride, TileElement* tileElement)
|
|||
*/
|
||||
static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
|
||||
{
|
||||
TileCoordsXY location;
|
||||
CoordsXYZ location;
|
||||
int32_t stationIndex;
|
||||
for (stationIndex = 0; stationIndex < MAX_STATIONS; stationIndex++)
|
||||
{
|
||||
location = ride->stations[stationIndex].Start;
|
||||
location = ride->stations[stationIndex].GetStart();
|
||||
if (!location.isNull())
|
||||
break;
|
||||
if (stationIndex == (MAX_STATIONS - 1))
|
||||
|
@ -4902,19 +4898,15 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t x = location.x * 32;
|
||||
int32_t y = location.y * 32;
|
||||
int32_t z = ride->stations[stationIndex].GetBaseZ();
|
||||
|
||||
bool success = false;
|
||||
TileElement* tileElement = map_get_first_element_at({ x, y });
|
||||
TileElement* tileElement = map_get_first_element_at(location);
|
||||
if (tileElement == nullptr)
|
||||
return success;
|
||||
do
|
||||
{
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
||||
continue;
|
||||
if (tileElement->GetBaseZ() != z)
|
||||
if (tileElement->GetBaseZ() != location.z)
|
||||
continue;
|
||||
|
||||
if (!(TrackSequenceProperties[tileElement->AsTrack()->GetTrackType()][0] & TRACK_SEQUENCE_FLAG_ORIGIN))
|
||||
|
@ -4937,7 +4929,7 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
|
|||
int32_t state = STATE_FIND_CABLE_LIFT;
|
||||
|
||||
track_circuit_iterator it;
|
||||
track_circuit_iterator_begin(&it, { x, y, tileElement });
|
||||
track_circuit_iterator_begin(&it, { location, tileElement });
|
||||
while (track_circuit_iterator_previous(&it))
|
||||
{
|
||||
tileElement = it.current.element;
|
||||
|
@ -4979,12 +4971,10 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
|
|||
}
|
||||
if (isApplying)
|
||||
{
|
||||
z = tileElement->GetBaseZ();
|
||||
auto tmpLoc = CoordsXYZ{ it.current, tileElement->GetBaseZ() };
|
||||
int32_t direction = tileElement->GetDirection();
|
||||
trackType = tileElement->AsTrack()->GetTrackType();
|
||||
x = it.current.x;
|
||||
y = it.current.y;
|
||||
sub_6C683D(&x, &y, &z, direction, trackType, 0, &tileElement, flags);
|
||||
sub_6C683D(&tmpLoc.x, &tmpLoc.y, &tmpLoc.z, direction, trackType, 0, &tileElement, flags);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -5102,10 +5092,8 @@ static void loc_6B51C0(const Ride* ride)
|
|||
|
||||
if (ride->type != RIDE_TYPE_MAZE)
|
||||
{
|
||||
int32_t x = ride->stations[i].Start.x * 32;
|
||||
int32_t y = ride->stations[i].Start.y * 32;
|
||||
int32_t z = ride->stations[i].GetBaseZ();
|
||||
window_scroll_to_location(w, x, y, z);
|
||||
auto location = ride->stations[i].GetStart();
|
||||
window_scroll_to_location(w, location.x, location.y, location.z);
|
||||
|
||||
CoordsXYE trackElement;
|
||||
ride_try_get_origin_element(ride, &trackElement);
|
||||
|
@ -5208,8 +5196,9 @@ int32_t ride_is_valid_for_test(Ride* ride, int32_t status, bool isApplying)
|
|||
}
|
||||
|
||||
// z = ride->stations[i].GetBaseZ();
|
||||
trackElement.x = ride->stations[stationIndex].Start.x * 32;
|
||||
trackElement.y = ride->stations[stationIndex].Start.y * 32;
|
||||
auto startLoc = ride->stations[stationIndex].Start;
|
||||
trackElement.x = startLoc.x;
|
||||
trackElement.y = startLoc.y;
|
||||
trackElement.element = loc_6B4F6B(ride->id, trackElement.x, trackElement.y);
|
||||
if (trackElement.element == nullptr)
|
||||
{
|
||||
|
@ -5344,8 +5333,9 @@ int32_t ride_is_valid_for_open(Ride* ride, int32_t goingToBeOpen, bool isApplyin
|
|||
}
|
||||
|
||||
// z = ride->stations[i].GetBaseZ();
|
||||
trackElement.x = ride->stations[stationIndex].Start.x * 32;
|
||||
trackElement.y = ride->stations[stationIndex].Start.y * 32;
|
||||
auto startLoc = ride->stations[stationIndex].Start;
|
||||
trackElement.x = startLoc.x;
|
||||
trackElement.y = startLoc.y;
|
||||
trackElement.element = loc_6B4F6B(ride->id, trackElement.x, trackElement.y);
|
||||
if (trackElement.element == nullptr)
|
||||
{
|
||||
|
@ -6260,8 +6250,8 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
|
|||
}
|
||||
else
|
||||
{
|
||||
auto mapX = stationStart.x * 32;
|
||||
auto mapY = stationStart.y * 32;
|
||||
auto mapX = stationStart.x;
|
||||
auto mapY = stationStart.y;
|
||||
entranceMinX = mapX;
|
||||
entranceMinY = mapY;
|
||||
|
||||
|
@ -6615,19 +6605,16 @@ static int32_t ride_get_track_length(Ride* ride)
|
|||
track_circuit_iterator it, slowIt;
|
||||
ride_id_t rideIndex;
|
||||
int32_t trackType, result;
|
||||
CoordsXY trackStart;
|
||||
CoordsXYZ trackStart;
|
||||
bool foundTrack = false;
|
||||
|
||||
for (int32_t i = 0; i < MAX_STATIONS && !foundTrack; i++)
|
||||
{
|
||||
const auto& stationTileLoc = ride->stations[i].Start;
|
||||
if (stationTileLoc.isNull())
|
||||
trackStart = ride->stations[i].GetStart();
|
||||
if (trackStart.isNull())
|
||||
continue;
|
||||
|
||||
trackStart = stationTileLoc.ToCoordsXY();
|
||||
auto z = ride->stations[i].GetBaseZ();
|
||||
|
||||
tileElement = map_get_first_element_at(stationTileLoc.ToCoordsXY());
|
||||
tileElement = map_get_first_element_at(trackStart);
|
||||
if (tileElement == nullptr)
|
||||
continue;
|
||||
do
|
||||
|
@ -6639,7 +6626,7 @@ static int32_t ride_get_track_length(Ride* ride)
|
|||
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN))
|
||||
continue;
|
||||
|
||||
if (tileElement->GetBaseZ() != z)
|
||||
if (tileElement->GetBaseZ() != trackStart.z)
|
||||
continue;
|
||||
|
||||
foundTrack = true;
|
||||
|
@ -6876,8 +6863,7 @@ void sub_6CB945(Ride* ride)
|
|||
if (ride->stations[stationId].Start.isNull())
|
||||
continue;
|
||||
|
||||
CoordsXYZ location = { ride->stations[stationId].Start.x * 32, ride->stations[stationId].Start.y * 32,
|
||||
ride->stations[stationId].GetBaseZ() };
|
||||
CoordsXYZ location = ride->stations[stationId].GetStart();
|
||||
auto tileHeight = TileCoordsXYZ(location).z;
|
||||
uint8_t direction = INVALID_DIRECTION;
|
||||
|
||||
|
@ -7331,7 +7317,7 @@ bool ride_has_adjacent_station(Ride* ride)
|
|||
* adjacent station on either side. */
|
||||
for (int32_t stationNum = 0; stationNum < MAX_STATIONS; stationNum++)
|
||||
{
|
||||
auto stationStart = ride->stations[stationNum].GetStart();
|
||||
auto stationStart = ride->stations[stationNum].Start;
|
||||
if (!stationStart.isNull())
|
||||
{
|
||||
/* Get the map element for the station start. */
|
||||
|
|
|
@ -161,7 +161,7 @@ struct rct_ride_entry
|
|||
|
||||
struct RideStation
|
||||
{
|
||||
TileCoordsXY Start;
|
||||
CoordsXY Start;
|
||||
uint8_t Height;
|
||||
uint8_t Length;
|
||||
uint8_t Depart;
|
||||
|
|
|
@ -406,17 +406,15 @@ static void ride_ratings_begin_proximity_loop()
|
|||
gRideRatingsCalcData.station_flags |= RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
|
||||
}
|
||||
|
||||
int32_t x = ride->stations[i].Start.x * 32;
|
||||
int32_t y = ride->stations[i].Start.y * 32;
|
||||
int32_t z = ride->stations[i].GetBaseZ();
|
||||
auto location = ride->stations[i].GetStart();
|
||||
|
||||
gRideRatingsCalcData.proximity_x = x;
|
||||
gRideRatingsCalcData.proximity_y = y;
|
||||
gRideRatingsCalcData.proximity_z = z;
|
||||
gRideRatingsCalcData.proximity_x = location.x;
|
||||
gRideRatingsCalcData.proximity_y = location.y;
|
||||
gRideRatingsCalcData.proximity_z = location.z;
|
||||
gRideRatingsCalcData.proximity_track_type = 255;
|
||||
gRideRatingsCalcData.proximity_start_x = x;
|
||||
gRideRatingsCalcData.proximity_start_y = y;
|
||||
gRideRatingsCalcData.proximity_start_z = z;
|
||||
gRideRatingsCalcData.proximity_start_x = location.x;
|
||||
gRideRatingsCalcData.proximity_start_y = location.y;
|
||||
gRideRatingsCalcData.proximity_start_z = location.z;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1430,7 +1428,7 @@ static rating_tuple ride_ratings_get_drop_ratings(Ride* ride)
|
|||
static int32_t ride_ratings_get_scenery_score(Ride* ride)
|
||||
{
|
||||
int8_t i = ride_get_first_valid_station_start(ride);
|
||||
int32_t x, y;
|
||||
CoordsXY location;
|
||||
|
||||
if (i == -1)
|
||||
{
|
||||
|
@ -1439,18 +1437,14 @@ static int32_t ride_ratings_get_scenery_score(Ride* ride)
|
|||
|
||||
if (ride->type == RIDE_TYPE_MAZE)
|
||||
{
|
||||
TileCoordsXYZD location = ride_get_entrance_location(ride, 0);
|
||||
x = location.x;
|
||||
y = location.y;
|
||||
location = ride_get_entrance_location(ride, 0).ToCoordsXY();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto location = ride->stations[i].Start;
|
||||
x = location.x;
|
||||
y = location.y;
|
||||
location = ride->stations[i].Start;
|
||||
}
|
||||
|
||||
int32_t z = tile_element_height({ x * 32, y * 32 });
|
||||
int32_t z = tile_element_height(location);
|
||||
|
||||
// Check if station is underground, returns a fixed mediocre score since you can't have scenery underground
|
||||
if (z > ride->stations[i].GetBaseZ())
|
||||
|
@ -1460,9 +1454,11 @@ static int32_t ride_ratings_get_scenery_score(Ride* ride)
|
|||
|
||||
// Count surrounding scenery items
|
||||
int32_t numSceneryItems = 0;
|
||||
for (int32_t yy = std::max(y - 5, 0); yy <= std::min(y + 5, 255); yy++)
|
||||
auto tileLocation = TileCoordsXY(location);
|
||||
for (int32_t yy = std::max(tileLocation.y - 5, 0); yy <= std::min(tileLocation.y + 5, MAXIMUM_MAP_SIZE_TECHNICAL - 1); yy++)
|
||||
{
|
||||
for (int32_t xx = std::max(x - 5, 0); xx <= std::min(x + 5, 255); xx++)
|
||||
for (int32_t xx = std::max(tileLocation.x - 5, 0); xx <= std::min(tileLocation.x + 5, MAXIMUM_MAP_SIZE_TECHNICAL - 1);
|
||||
xx++)
|
||||
{
|
||||
// Count scenery items on this tile
|
||||
TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ xx, yy }.ToCoordsXY());
|
||||
|
|
|
@ -318,7 +318,7 @@ static void ride_race_init_vehicle_speeds(Ride* ride)
|
|||
*/
|
||||
static void ride_invalidate_station_start(Ride* ride, int32_t stationIndex, bool greenLight)
|
||||
{
|
||||
auto startPos = ride->stations[stationIndex].GetStart();
|
||||
auto startPos = ride->stations[stationIndex].Start;
|
||||
TileElement* tileElement = ride_get_station_start_track_element(ride, stationIndex);
|
||||
|
||||
// If no station track found return
|
||||
|
@ -434,16 +434,15 @@ void ride_set_exit_location(Ride* ride, const int32_t stationIndex, const TileCo
|
|||
|
||||
int32_t RideStation::GetBaseZ() const
|
||||
{
|
||||
return Height * 8;
|
||||
return Height * COORDS_Z_STEP;
|
||||
}
|
||||
|
||||
void RideStation::SetBaseZ(int32_t newZ)
|
||||
{
|
||||
Height = newZ / 8;
|
||||
Height = newZ / COORDS_Z_STEP;
|
||||
}
|
||||
|
||||
CoordsXYZ RideStation::GetStart() const
|
||||
{
|
||||
TileCoordsXYZ stationTileCoords{ Start.x, Start.y, Height };
|
||||
return stationTileCoords.ToCoordsXYZ();
|
||||
return { Start, GetBaseZ() };
|
||||
}
|
||||
|
|
|
@ -661,8 +661,8 @@ bool track_add_station_element(int32_t x, int32_t y, int32_t z, int32_t directio
|
|||
int8_t stationIndex = ride_get_first_empty_station_start(ride);
|
||||
assert(stationIndex != -1);
|
||||
|
||||
ride->stations[stationIndex].Start.x = (x >> 5);
|
||||
ride->stations[stationIndex].Start.y = (y >> 5);
|
||||
ride->stations[stationIndex].Start.x = x;
|
||||
ride->stations[stationIndex].Start.y = y;
|
||||
ride->stations[stationIndex].Height = z;
|
||||
ride->stations[stationIndex].Depart = 1;
|
||||
ride->stations[stationIndex].Length = 0;
|
||||
|
@ -754,8 +754,8 @@ bool track_add_station_element(int32_t x, int32_t y, int32_t z, int32_t directio
|
|||
int8_t stationIndex = ride_get_first_empty_station_start(ride);
|
||||
assert(stationIndex != -1);
|
||||
|
||||
ride->stations[stationIndex].Start.x = (x >> 5);
|
||||
ride->stations[stationIndex].Start.y = (y >> 5);
|
||||
ride->stations[stationIndex].Start.x = x;
|
||||
ride->stations[stationIndex].Start.y = y;
|
||||
ride->stations[stationIndex].Height = z;
|
||||
ride->stations[stationIndex].Depart = 1;
|
||||
ride->stations[stationIndex].Length = stationLength;
|
||||
|
@ -901,8 +901,8 @@ bool track_remove_station_element(int32_t x, int32_t y, int32_t z, int32_t direc
|
|||
int8_t stationIndex = ride_get_first_empty_station_start(ride);
|
||||
assert(stationIndex != -1);
|
||||
|
||||
ride->stations[stationIndex].Start.x = (x >> 5);
|
||||
ride->stations[stationIndex].Start.y = (y >> 5);
|
||||
ride->stations[stationIndex].Start.x = x;
|
||||
ride->stations[stationIndex].Start.y = y;
|
||||
ride->stations[stationIndex].Height = z;
|
||||
ride->stations[stationIndex].Depart = 1;
|
||||
ride->stations[stationIndex].Length = stationLength != 0 ? stationLength : byte_F441D1;
|
||||
|
|
|
@ -9258,8 +9258,7 @@ loc_6DCE68:
|
|||
|
||||
for (int32_t i = 0; i < MAX_STATIONS; i++)
|
||||
{
|
||||
auto trackLoc = TileCoordsXY(vehicle->TrackLocation);
|
||||
if (trackLoc != ride->stations[i].Start)
|
||||
if (vehicle->TrackLocation != ride->stations[i].Start)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue