mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Change some rides over to the BoundBoxXY struct
Changes over the Crooked House, Ferris Wheel, Haunted House, Magic Carpet, Swinging Ship, Swinging Inverter Ship, Monorail, and the Supports file over to using the new BoundBoxXY(Z) struct(s).
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 } },
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user