From 5f49276d53745dd981d73cdfac0704285e89fcfe Mon Sep 17 00:00:00 2001 From: ZehMatt Date: Fri, 20 Aug 2021 23:22:00 +0300 Subject: [PATCH] Use CoordsXY for ferris_wheel_bound_box and correct arg passing --- src/openrct2/ride/gentle/FerrisWheel.cpp | 33 +++++++++++------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/openrct2/ride/gentle/FerrisWheel.cpp b/src/openrct2/ride/gentle/FerrisWheel.cpp index 9e2b3b5005..c3a0e0e1c6 100644 --- a/src/openrct2/ride/gentle/FerrisWheel.cpp +++ b/src/openrct2/ride/gentle/FerrisWheel.cpp @@ -32,18 +32,16 @@ static constexpr const uint8_t edges_1x4_nw_se[] = { struct ferris_wheel_bound_box { - int16_t length_x; - int16_t length_y; - int16_t offset_x; - int16_t offset_y; + CoordsXY length; + CoordsXY offset; }; /** rct2: 0x008A8CA8 */ -static ferris_wheel_bound_box ferris_wheel_data[] = { - { 31, 16, 1, 8 }, - { 16, 31, 8, 1 }, - { 31, 16, 1, 8 }, - { 16, 31, 8, 1 }, +static constexpr ferris_wheel_bound_box ferris_wheel_data[] = { + { { 31, 16 }, { 1, 8 } }, + { { 16, 31 }, { 8, 1 } }, + { { 31, 16 }, { 1, 8 } }, + { { 16, 31 }, { 8, 1 } }, }; /** @@ -89,17 +87,16 @@ static void paint_ferris_wheel_structure( imageColourFlags = SPRITE_ID_PALETTE_COLOUR_2(ride->vehicle_colours[0].Body, ride->vehicle_colours[0].Trim); } - ferris_wheel_bound_box boundBox = ferris_wheel_data[direction]; + const ferris_wheel_bound_box& boundBox = ferris_wheel_data[direction]; imageId = (22150 + (direction & 1) * 2) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsParent( - session, imageId, { xOffset, yOffset, height }, { boundBox.length_x, boundBox.length_y, 127 }, - { boundBox.offset_x, boundBox.offset_y, height }); + session, imageId, { xOffset, yOffset, height }, { boundBox.length, 127 }, { boundBox.offset, height }); imageId = (baseImageId + direction * 8 + imageOffset) | imageColourFlags; PaintAddImageAsChild( - session, imageId, xOffset, yOffset, boundBox.length_x, boundBox.length_y, 127, height, boundBox.offset_x, - boundBox.offset_y, height); + session, imageId, xOffset, yOffset, boundBox.length.x, boundBox.length.y, 127, height, boundBox.offset.x, + boundBox.offset.y, height); if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) { @@ -115,15 +112,15 @@ static void paint_ferris_wheel_structure( imageColourFlags = SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[i], vehicle->peep_tshirt_colours[i + 1]); imageId = (baseImageId + 32 + direction * 128 + frameNum) | imageColourFlags; PaintAddImageAsChild( - session, imageId, xOffset, yOffset, boundBox.length_x, boundBox.length_y, 127, height, boundBox.offset_x, - boundBox.offset_y, height); + session, imageId, xOffset, yOffset, boundBox.length.x, boundBox.length.y, 127, height, boundBox.offset.x, + boundBox.offset.y, height); } } imageId = (22150 + (direction & 1) * 2 + 1) | session->TrackColours[SCHEME_TRACK]; PaintAddImageAsChild( - session, imageId, xOffset, yOffset, boundBox.length_x, boundBox.length_y, 127, height, boundBox.offset_x, - boundBox.offset_y, height); + session, imageId, xOffset, yOffset, boundBox.length.x, boundBox.length.y, 127, height, boundBox.offset.x, + boundBox.offset.y, height); session->CurrentlyDrawnItem = savedTileElement; session->InteractionType = ViewportInteractionItem::Ride;