1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Merge pull request #15505 from Gymnasiast/fix/15496

Fix #15496 and clean up paint_swinging_inverter_ship_structure() a bit
This commit is contained in:
Michael Steenbeek
2021-10-01 18:03:22 +02:00
committed by GitHub
2 changed files with 13 additions and 9 deletions

View File

@@ -28,6 +28,7 @@
- Fix: [#15257] Chat icon shows in scenario/track editor. Other icons don't disable when deactivated in options menu.
- Fix: [#15289] Unexpected behavior with duplicated banners which also caused desyncs in multiplayer.
- Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2.
- Fix: [#15496] Crash in paint_swinging_inverter_ship_structure().
- Improved: [#3417] Crash dumps are now placed in their own folder.
- Change: [#8601] Revert ToonTower base block fix to re-enable support blocking.
- Change: [#15174] [Plugin] Deprecate the type "peep" and add support to target a specific scripting api version.

View File

@@ -49,19 +49,22 @@ static constexpr const uint32_t swinging_inverter_ship_frame_sprites[] = { SPR_S
SPR_SWINGING_INVERTER_SHIP_FRAME_3 };
static void paint_swinging_inverter_ship_structure(
paint_session* session, const Ride* ride, uint8_t direction, int8_t axisOffset, uint16_t height)
paint_session* session, const Ride& ride, uint8_t direction, int8_t axisOffset, uint16_t height)
{
const TileElement* savedTileElement = static_cast<const TileElement*>(session->CurrentlyDrawnItem);
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
rct_ride_entry* rideEntry = get_ride_entry(ride.subtype);
if (rideEntry == nullptr)
return;
Vehicle* vehicle = nullptr;
int8_t xOffset = !(direction & 1) ? axisOffset : 0;
int8_t yOffset = (direction & 1) ? axisOffset : 0;
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL)
if (ride.lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride.vehicles[0] != SPRITE_INDEX_NULL)
{
vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
vehicle = GetEntity<Vehicle>(ride.vehicles[0]);
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
@@ -92,7 +95,7 @@ static void paint_swinging_inverter_ship_structure(
uint32_t colourFlags = session->TrackColours[SCHEME_MISC];
if (colourFlags == IMAGE_TYPE_REMAP)
{
colourFlags = SPRITE_ID_PALETTE_COLOUR_2(ride->vehicle_colours[0].Body, ride->vehicle_colours[0].Trim);
colourFlags = SPRITE_ID_PALETTE_COLOUR_2(ride.vehicle_colours[0].Body, ride.vehicle_colours[0].Trim);
}
swinging_inverter_ship_bound_box boundBox = swinging_inverter_ship_bounds[direction];
@@ -179,16 +182,16 @@ static void paint_swinging_inverter_ship(
switch (relativeTrackSequence)
{
case 1:
paint_swinging_inverter_ship_structure(session, ride, direction, 48, height + 7);
paint_swinging_inverter_ship_structure(session, *ride, direction, 48, height + 7);
break;
case 2:
paint_swinging_inverter_ship_structure(session, ride, direction, 16, height + 7);
paint_swinging_inverter_ship_structure(session, *ride, direction, 16, height + 7);
break;
case 0:
paint_swinging_inverter_ship_structure(session, ride, direction, -16, height + 7);
paint_swinging_inverter_ship_structure(session, *ride, direction, -16, height + 7);
break;
case 3:
paint_swinging_inverter_ship_structure(session, ride, direction, -48, height + 7);
paint_swinging_inverter_ship_structure(session, *ride, direction, -48, height + 7);
break;
}
}