From 201a94f7e6db732d1b9dcf7e824fe7c05aa87446 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 24 Aug 2021 16:26:52 +0100 Subject: [PATCH] Add overloads to take CoordsXYZ (#15253) --- src/openrct2/paint/Paint.h | 9 ++++++ src/openrct2/paint/PaintHelpers.cpp | 47 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 83db6e3c7b..7a6787d18e 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -295,6 +295,15 @@ paint_struct* PaintAddImageAsChildRotated( paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z); +paint_struct* PaintAddImageAsChildRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); +paint_struct* PaintAddImageAsParentRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize); +paint_struct* PaintAddImageAsParentRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); void paint_util_push_tunnel_rotated(paint_session* session, uint8_t direction, uint16_t height, uint8_t type); diff --git a/src/openrct2/paint/PaintHelpers.cpp b/src/openrct2/paint/PaintHelpers.cpp index 994c306c57..1868ef8afa 100644 --- a/src/openrct2/paint/PaintHelpers.cpp +++ b/src/openrct2/paint/PaintHelpers.cpp @@ -48,6 +48,37 @@ paint_struct* PaintAddImageAsParentRotated( } } +paint_struct* PaintAddImageAsParentRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset) +{ + if (direction & 1) + { + return PaintAddImageAsParent( + session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z }, + { boundBoxOffset.y, boundBoxOffset.x, boundBoxOffset.z }); + } + else + { + return PaintAddImageAsParent(session, image_id, offset, boundBoxSize, boundBoxOffset); + } +} + +paint_struct* PaintAddImageAsParentRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize) +{ + if (direction & 1) + { + return PaintAddImageAsParent( + session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z }); + } + else + { + return PaintAddImageAsParent(session, image_id, offset, boundBoxSize); + } +} + paint_struct* PaintAddImageAsChildRotated( paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, @@ -67,6 +98,22 @@ paint_struct* PaintAddImageAsChildRotated( } } +paint_struct* PaintAddImageAsChildRotated( + paint_session* session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset) +{ + if (direction & 1) + { + return PaintAddImageAsChild( + session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z }, + { boundBoxOffset.y, boundBoxOffset.x, boundBoxOffset.z }); + } + else + { + return PaintAddImageAsChild(session, image_id, offset, boundBoxSize, boundBoxOffset); + } +} + void paint_util_push_tunnel_rotated(paint_session* session, uint8_t direction, uint16_t height, uint8_t type) { if (direction & 1)