diff --git a/src/openrct2/paint/Supports.cpp b/src/openrct2/paint/Supports.cpp index 45801967e4..e0ef35072f 100644 --- a/src/openrct2/paint/Supports.cpp +++ b/src/openrct2/paint/Supports.cpp @@ -306,13 +306,9 @@ static constexpr const uint16_t* WoodenCurveSupportImageIds[12] = { nullptr, }; -struct unk_supports_desc_bound_box { - CoordsXYZ offset; - CoordsXYZ length; -}; struct unk_supports_desc { - unk_supports_desc_bound_box bounding_box; + BoundBoxXYZ bounding_box; uint8_t var_6; uint8_t var_7; }; @@ -595,7 +591,7 @@ bool wooden_a_supports_paint_setup( { auto imageId = imageTemplate.WithIndex(WoodenCurveSupportImageIds[supportType][special]); - unk_supports_desc_bound_box bBox = byte_97B23C[special].bounding_box; + BoundBoxXYZ bBox = byte_97B23C[special].bounding_box; if (byte_97B23C[special].var_6 == 0 || session.WoodenSupportsPrependTo == nullptr) { @@ -768,7 +764,7 @@ bool wooden_b_supports_paint_setup( { // byte_97B23C[special].var_7 is never 0 auto imageId = imageTemplate.WithIndex(WoodenCurveSupportImageIds[supportType][specialIndex]); - const unk_supports_desc_bound_box& boundBox = supportsDesc.bounding_box; + const BoundBoxXYZ& boundBox = supportsDesc.bounding_box; if (supportsDesc.var_6 == 0 || session.WoodenSupportsPrependTo == nullptr) { @@ -1303,7 +1299,7 @@ bool path_a_supports_paint_setup( ImageIndex imageIndex = pathPaintInfo.BridgeImageId + 55 + specialIndex; const unk_supports_desc& supportsDesc = byte_98D8D4[specialIndex]; - const unk_supports_desc_bound_box& boundBox = supportsDesc.bounding_box; + const BoundBoxXYZ& boundBox = supportsDesc.bounding_box; if (supportsDesc.var_6 == 0 || session.WoodenSupportsPrependTo == nullptr) { diff --git a/src/openrct2/ride/gentle/CrookedHouse.cpp b/src/openrct2/ride/gentle/CrookedHouse.cpp index 78605715de..4748d7eda3 100644 --- a/src/openrct2/ride/gentle/CrookedHouse.cpp +++ b/src/openrct2/ride/gentle/CrookedHouse.cpp @@ -17,13 +17,7 @@ #include "../Track.h" #include "../TrackPaint.h" -struct rct_crooked_house_bound_box -{ - CoordsXY offset; - CoordsXY length; -}; - -static constexpr const rct_crooked_house_bound_box crooked_house_data[] = { +static constexpr const BoundBoxXY crooked_house_data[] = { { { 6, 0 }, { 42, 24 }, diff --git a/src/openrct2/ride/gentle/FerrisWheel.cpp b/src/openrct2/ride/gentle/FerrisWheel.cpp index 6a2230ecb1..06eac99903 100644 --- a/src/openrct2/ride/gentle/FerrisWheel.cpp +++ b/src/openrct2/ride/gentle/FerrisWheel.cpp @@ -32,18 +32,12 @@ static constexpr const uint8_t edges_1x4_nw_se[] = { EDGE_NE | EDGE_SW | EDGE_SE, }; -struct ferris_wheel_bound_box -{ - CoordsXY length; - CoordsXY offset; -}; - /** rct2: 0x008A8CA8 */ -static constexpr ferris_wheel_bound_box FerrisWheelData[] = { - { { 31, 16 }, { 1, 8 } }, - { { 16, 31 }, { 8, 1 } }, - { { 31, 16 }, { 1, 8 } }, - { { 16, 31 }, { 8, 1 } }, +static constexpr BoundBoxXY FerrisWheelData[] = { + { { 1, 8 }, { 31, 16 } }, + { { 8, 1 }, { 16, 31 } }, + { { 1, 8 }, { 31, 16 } }, + { { 8, 1 }, { 16, 31 } }, }; static void PaintFerrisWheelRiders( diff --git a/src/openrct2/ride/gentle/HauntedHouse.cpp b/src/openrct2/ride/gentle/HauntedHouse.cpp index 391ff5ef72..5a3310b513 100644 --- a/src/openrct2/ride/gentle/HauntedHouse.cpp +++ b/src/openrct2/ride/gentle/HauntedHouse.cpp @@ -17,13 +17,7 @@ #include "../TrackPaint.h" #include "../Vehicle.h" -struct haunted_house_bound_box -{ - CoordsXY offset; - CoordsXY length; -}; - -static constexpr haunted_house_bound_box haunted_house_data[] = { +static constexpr BoundBoxXY haunted_house_data[] = { { { 6, 0 }, { 42, 24 } }, { { 0, 0 }, { 0, 0 } }, { { -16, -16 }, { 32, 32 } }, { { 0, 0 }, { 0, 0 } }, { { 0, 6 }, { 24, 42 } }, { { 0, 0 }, { 0, 0 } }, }; diff --git a/src/openrct2/ride/thrill/MagicCarpet.cpp b/src/openrct2/ride/thrill/MagicCarpet.cpp index c035e85c39..32b9d2224e 100644 --- a/src/openrct2/ride/thrill/MagicCarpet.cpp +++ b/src/openrct2/ride/thrill/MagicCarpet.cpp @@ -36,14 +36,6 @@ enum SPR_MAGIC_CARPET_PENDULUM_SW = 22102, }; -struct bound_box -{ - int16_t x; - int16_t y; - int16_t width; - int16_t height; -}; - static constexpr const int16_t MagicCarpetOscillationZ[] = { -2, -1, 1, 5, 10, 16, 23, 30, 37, 45, 52, 59, 65, 70, 74, 76, 77, 76, 74, 70, 65, 59, 52, 45, 37, 30, 23, 16, 10, 5, 1, -1, }; @@ -53,7 +45,7 @@ static constexpr const int8_t MagicCarpetOscillationXY[] = { 0, -5, -11, -17, -22, -26, -29, -30, -31, -30, -29, -26, -22, -17, -11, -5, }; -static constexpr const bound_box MagicCarpetBounds[] = { +static constexpr const BoundBoxXY MagicCarpetBounds[] = { { 0, 8, 32, 16 }, { 8, 0, 16, 32 }, { 0, 8, 32, 16 }, @@ -202,16 +194,16 @@ static void PaintMagicCarpetStructure( session.CurrentlyDrawnEntity = vehicle; } - bound_box bb = MagicCarpetBounds[direction]; + BoundBoxXY bb = MagicCarpetBounds[direction]; CoordsXYZ offset, bbOffset, bbSize; offset.x = (direction & 1) ? 0 : axisOffset; offset.y = (direction & 1) ? axisOffset : 0; offset.z = height + 7; - bbOffset.x = bb.x; - bbOffset.y = bb.y; + bbOffset.x = bb.offset.x; + bbOffset.y = bb.offset.y; bbOffset.z = height + 7; - bbSize.x = bb.width; - bbSize.y = bb.height; + bbSize.x = bb.length.x; + bbSize.y = bb.offset.y; bbSize.z = 127; PaintMagicCarpetFrame(session, Plane::Back, direction, offset, bbOffset, bbSize); diff --git a/src/openrct2/ride/thrill/SwingingInverterShip.cpp b/src/openrct2/ride/thrill/SwingingInverterShip.cpp index 3e01a15287..c374b413e0 100644 --- a/src/openrct2/ride/thrill/SwingingInverterShip.cpp +++ b/src/openrct2/ride/thrill/SwingingInverterShip.cpp @@ -34,20 +34,12 @@ static constexpr const uint32_t SwingingInverterShipAnimatingBaseSpriteOffset[] 33, }; -struct swinging_inverter_ship_bound_box -{ - int16_t length_x; - int16_t length_y; - int16_t offset_x; - int16_t offset_y; -}; - /** rct2: 0x01428020 */ -static constexpr const swinging_inverter_ship_bound_box swinging_inverter_ship_bounds[] = { - { 32, 16, 0, 8 }, - { 16, 32, 8, 0 }, - { 32, 16, 0, 8 }, - { 16, 32, 8, 0 }, +static constexpr const BoundBoxXY swinging_inverter_ship_bounds[] = { + { 0, 8, 32, 16 }, + { 8, 0, 16, 32 }, + { 0, 8, 32, 16 }, + { 8, 0, 16, 32 }, }; enum @@ -74,8 +66,8 @@ static void PaintSwingingInverterShipStructure( const auto& boundBox = swinging_inverter_ship_bounds[direction]; CoordsXYZ offset((direction & 1) ? 0 : axisOffset, (direction & 1) ? axisOffset : 0, height); - CoordsXYZ bbLength(boundBox.length_x, boundBox.length_y, 127); - CoordsXYZ bbOffset(boundBox.offset_x, boundBox.offset_y, height); + CoordsXYZ bbLength(boundBox.length.x, boundBox.length.y, 127); + CoordsXYZ bbOffset(boundBox.offset.x, boundBox.offset.y, height); Vehicle* vehicle = nullptr; if (ride.lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) diff --git a/src/openrct2/ride/thrill/SwingingShip.cpp b/src/openrct2/ride/thrill/SwingingShip.cpp index d8c69f267f..b3d46bae87 100644 --- a/src/openrct2/ride/thrill/SwingingShip.cpp +++ b/src/openrct2/ride/thrill/SwingingShip.cpp @@ -25,15 +25,6 @@ static constexpr const uint8_t track_map_1x5[][5] = { { 0, 4, 3, 2, 1 }, { 0, 1, 2, 3, 4 }, }; - -struct swinging_ship_bound_box -{ - int16_t length_x; - int16_t length_y; - int16_t offset_x; - int16_t offset_y; -}; - /** rct2: 0x008A83B0 */ static constexpr const uint32_t SwingingShipBaseSpriteOffset[] = { 0, @@ -43,11 +34,11 @@ static constexpr const uint32_t SwingingShipBaseSpriteOffset[] = { }; /** rct2: 0x008A83C0 */ -static constexpr const swinging_ship_bound_box SwingingShipData[] = { - { 31, 16, 1, 8 }, - { 16, 31, 8, 1 }, - { 31, 16, 1, 8 }, - { 16, 31, 8, 1 }, +static constexpr const BoundBoxXY SwingingShipData[] = { + { 1, 8, 31, 16 }, + { 8, 1, 16, 31 }, + { 1, 8, 31, 16 }, + { 8, 1, 16, 31 }, }; enum @@ -108,9 +99,9 @@ static void PaintSwingingShipStructure( const auto& bounds = SwingingShipData[direction]; CoordsXYZ offset((direction & 1) ? 0 : axisOffset, (direction & 1) ? axisOffset : 0, height + 7); - CoordsXYZ bbLength(bounds.length_x, bounds.length_y, 80); - CoordsXYZ bbOffset(bounds.offset_x, bounds.offset_y, height + 7); - + CoordsXYZ bbLength(bounds.length.x, bounds.length.y, 80); + CoordsXYZ bbOffset(bounds.offset.x, bounds.offset.y, height + 7); + auto baseImageId = rideEntry->Cars[0].base_image_id + SwingingShipBaseSpriteOffset[direction]; if (vehicle != nullptr) { diff --git a/src/openrct2/ride/transport/Monorail.cpp b/src/openrct2/ride/transport/Monorail.cpp index 6dad0de780..e87b183d4a 100644 --- a/src/openrct2/ride/transport/Monorail.cpp +++ b/src/openrct2/ride/transport/Monorail.cpp @@ -271,57 +271,32 @@ static constexpr const uint32_t ghost_train_track_pieces_right_eight_to_diag[4][ }, }; -static constexpr const CoordsXY ghost_train_track_pieces_right_eight_to_diag_bounds[4][4] = { +static constexpr const BoundBoxXY ghost_train_track_pieces_right_eight_to_diag_boxes[4][4] = { { - { 32, 20 }, - { 32, 16 }, - { 16, 16 }, - { 16, 16 }, + { { 0, 6 }, { 32, 20 } }, + { { 0, 16 }, { 32, 16 } }, + { { 0, 0 }, { 16, 16 } }, + { { 16, 0 }, { 16, 16 } }, }, { - { 20, 32 }, - { 16, 32 }, - { 16, 16 }, - { 16, 16 }, + { { 6, 0 }, { 20, 32 } }, + { { 16, 0 }, { 16, 32 } }, + { { 0, 16 }, { 16, 16 } }, + { { 0, 0 }, { 16, 16 } }, }, { - { 32, 20 }, - { 34, 16 }, - { 28, 28 }, - { 16, 18 }, - }, - { - { 20, 32 }, - { 16, 32 }, - { 16, 16 }, - { 16, 16 }, - }, -}; -static constexpr const CoordsXY ghost_train_track_pieces_right_eight_to_diag_offset[4][4] = { - { - { 0, 6 }, - { 0, 16 }, - { 0, 0 }, - { 16, 0 }, + { { 0, 6 }, { 32, 20 } }, + { { 0, 0 }, { 34, 16 } }, + { { 4, 4 }, { 28, 28 } }, + { { 0, 16 }, { 16, 18 } }, }, { - { 6, 0 }, - { 16, 0 }, - { 0, 16 }, - { 0, 0 }, - }, - { - { 0, 6 }, - { 0, 0 }, - { 4, 4 }, - { 0, 16 }, - }, - { - { 6, 0 }, - { 0, 0 }, - { 16, 0 }, - { 16, 16 }, + + { { 6, 0 }, { 20, 32 } }, + { { 0, 0 }, { 16, 32 } }, + { { 16, 0 }, { 16, 16 } }, + { { 16, 16 }, { 16, 16 } }, }, }; @@ -352,57 +327,30 @@ static constexpr const uint32_t ghost_train_track_pieces_left_eight_to_diag[4][4 }, }; -static constexpr const CoordsXY ghost_train_track_pieces_left_eight_to_diag_bounds[4][4] = { +static constexpr const BoundBoxXY ghost_train_track_pieces_left_eight_to_diag_boxes[4][4] = { { - { 32, 20 }, - { 32, 16 }, - { 16, 16 }, - { 16, 16 }, + { { 0, 6 }, { 32, 20 } }, + { { 0, 0 }, { 32, 16 } }, + { { 0, 16 }, { 16, 16 } }, + { { 16, 16 }, { 16, 16 } }, }, { - { 20, 32 }, - { 16, 34 }, - { 16, 16 }, - { 18, 16 }, + { { 6, 0 }, { 20, 32 } }, + { { 0, 0 }, { 16, 34 } }, + { { 16, 16 }, { 16, 16 } }, + { { 16, 0 }, { 18, 16 } }, }, { - { 32, 20 }, - { 32, 16 }, - { 16, 16 }, - { 16, 16 }, + { { 0, 6 }, { 32, 20 } }, + { { 0, 16 }, { 32, 16 } }, + { { 16, 0 }, { 16, 16 } }, + { { 0, 0 }, { 16, 16 } }, }, { - { 20, 32 }, - { 16, 32 }, - { 16, 16 }, - { 16, 16 }, - }, -}; - -static constexpr const CoordsXY ghost_train_track_pieces_left_eight_to_diag_offset[4][4] = { - { - { 0, 6 }, - { 0, 0 }, - { 0, 16 }, - { 16, 16 }, - }, - { - { 6, 0 }, - { 0, 0 }, - { 16, 16 }, - { 16, 0 }, - }, - { - { 0, 6 }, - { 0, 16 }, - { 16, 0 }, - { 0, 0 }, - }, - { - { 6, 0 }, - { 16, 0 }, - { 0, 0 }, - { 0, 16 }, + { { 6, 0 }, { 20, 32 } }, + { { 16, 0 }, { 16, 32 } }, + { { 0, 0 }, { 16, 16 } }, + { { 0, 16 }, { 16, 16 } }, }, }; @@ -761,23 +709,16 @@ static void paint_monorail_track_s_bend_left( trackSequence = 3 - trackSequence; } - static constexpr CoordsXY offsetList[] = { - { 0, 6 }, - { 0, 0 }, - { 0, 6 }, - { 0, 6 }, - }; - - static constexpr CoordsXY boundsList[] = { - { 32, 20 }, - { 32, 26 }, - { 32, 26 }, - { 32, 20 }, + static constexpr BoundBoxXY boxList[] = { + { { 0, 6 }, { 32, 20 } }, + { { 0, 0 }, { 32, 26 } }, + { { 0, 6 }, { 32, 26 } }, + { { 0, 6 }, { 32, 20 } }, }; uint32_t imageId = monorail_track_pieces_s_bend_left[direction & 1][trackSequence] | session.TrackColours[SCHEME_TRACK]; - CoordsXY offset = offsetList[trackSequence]; - CoordsXY bounds = boundsList[trackSequence]; + CoordsXY offset = boxList[trackSequence].offset; + CoordsXY bounds = boxList[trackSequence].length; if (direction == 0 || direction == 2) { PaintAddImageAsParent(session, imageId, { offset.x, offset.y, height }, { bounds.x, bounds.y, 3 }); @@ -865,23 +806,13 @@ static void paint_monorail_track_s_bend_right( trackSequence = 3 - trackSequence; } - static constexpr CoordsXY offsetList[] = { - { 0, 6 }, - { 0, 6 }, - { 0, 0 }, - { 0, 6 }, - }; - - static constexpr CoordsXY boundsList[] = { - { 32, 20 }, - { 32, 26 }, - { 32, 26 }, - { 32, 20 }, + static constexpr BoundBoxXY boxList[] = { + { { 0, 6 }, { 32, 20 } }, { { 0, 6 }, { 32, 26 } }, { { 0, 0 }, { 32, 26 } }, { { 0, 6 }, { 32, 20 } } }; uint32_t imageId = monorail_track_pieces_s_bend_right[direction & 1][trackSequence] | session.TrackColours[SCHEME_TRACK]; - CoordsXY offset = offsetList[trackSequence]; - CoordsXY bounds = boundsList[trackSequence]; + CoordsXY offset = boxList[trackSequence].offset; + CoordsXY bounds = boxList[trackSequence].length; if (direction == 0 || direction == 2) { PaintAddImageAsParent(session, imageId, { offset.x, offset.y, height }, { bounds.x, bounds.y, 3 }); @@ -1018,8 +949,8 @@ static void paint_monorail_track_left_eighth_to_diag( if (index >= 0) { uint32_t imageId = ghost_train_track_pieces_left_eight_to_diag[direction][index] | session.TrackColours[SCHEME_TRACK]; - const CoordsXY offset = ghost_train_track_pieces_left_eight_to_diag_offset[direction][index]; - const CoordsXY bounds = ghost_train_track_pieces_left_eight_to_diag_bounds[direction][index]; + const CoordsXY offset = ghost_train_track_pieces_left_eight_to_diag_boxes[direction][index].offset; + const CoordsXY bounds = ghost_train_track_pieces_left_eight_to_diag_boxes[direction][index].length; PaintAddImageAsParent(session, imageId, { 0, 0, height }, { bounds.x, bounds.y, 2 }, { offset.x, offset.y, height }); } @@ -1086,8 +1017,8 @@ static void paint_monorail_track_right_eighth_to_diag( if (index >= 0) { uint32_t imageId = ghost_train_track_pieces_right_eight_to_diag[direction][index] | session.TrackColours[SCHEME_TRACK]; - const CoordsXY offset = ghost_train_track_pieces_right_eight_to_diag_offset[direction][index]; - const CoordsXY bounds = ghost_train_track_pieces_right_eight_to_diag_bounds[direction][index]; + const CoordsXY offset = ghost_train_track_pieces_right_eight_to_diag_boxes[direction][index].offset; + const CoordsXY bounds = ghost_train_track_pieces_right_eight_to_diag_boxes[direction][index].length; PaintAddImageAsParent(session, imageId, { 0, 0, height }, { bounds.x, bounds.y, 2 }, { offset.x, offset.y, height }); }