From 04f2479c34c37c6fb9bd47dc8dbf412ba49be079 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 13 Feb 2023 19:59:30 +0100 Subject: [PATCH] Create PaintAddImageAsParentRotated() function that takes a BoundBoxXYZ --- src/openrct2/paint/Paint.h | 20 ++++++++++++++++---- src/openrct2/paint/PaintHelpers.cpp | 22 ++++------------------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 1c2f95e94e..a260154710 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -310,12 +310,24 @@ PaintStruct* PaintAddImageAsChild( PaintStruct* PaintAddImageAsChildRotated( PaintSession& session, const uint8_t direction, const ImageId image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); -PaintStruct* PaintAddImageAsParentRotated( - PaintSession& session, const uint8_t direction, const ImageId image_id, const CoordsXYZ& offset, - const CoordsXYZ& boundBoxSize); + PaintStruct* PaintAddImageAsParentRotated( PaintSession& session, const uint8_t direction, const ImageId imageId, const CoordsXYZ& offset, - const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); + const BoundBoxXYZ& boundBox); + +inline PaintStruct* PaintAddImageAsParentRotated( + PaintSession& session, const uint8_t direction, const ImageId imageId, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset) +{ + return PaintAddImageAsParentRotated(session, direction, imageId, offset, { boundBoxOffset, boundBoxSize }); +} + +inline PaintStruct* PaintAddImageAsParentRotated( + PaintSession& session, const uint8_t direction, const ImageId imageId, const CoordsXYZ& offset, + const CoordsXYZ& boundBoxSize) +{ + return PaintAddImageAsParentRotated(session, direction, imageId, offset, { offset, boundBoxSize }); +} void PaintUtilPushTunnelRotated(PaintSession& 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 e256cf21d4..b4ccaa7656 100644 --- a/src/openrct2/paint/PaintHelpers.cpp +++ b/src/openrct2/paint/PaintHelpers.cpp @@ -12,30 +12,16 @@ #include "Paint.h" PaintStruct* PaintAddImageAsParentRotated( - PaintSession& session, const uint8_t direction, const ImageId imageId, const CoordsXYZ& offset, - const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset) + PaintSession& session, const uint8_t direction, const ImageId imageId, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) { if (direction & 1) { return PaintAddImageAsParent( - session, imageId, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z }, - { boundBoxOffset.y, boundBoxOffset.x, boundBoxOffset.z }); + session, imageId, { offset.y, offset.x, offset.z }, { boundBox.length.y, boundBox.length.x, boundBox.length.z }, + { boundBox.offset.y, boundBox.offset.x, boundBox.offset.z }); } - return PaintAddImageAsParent(session, imageId, offset, boundBoxSize, boundBoxOffset); -} - -PaintStruct* PaintAddImageAsParentRotated( - PaintSession& session, const uint8_t direction, const ImageId 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 }); - } - - return PaintAddImageAsParent(session, image_id, offset, boundBoxSize); + return PaintAddImageAsParent(session, imageId, offset, boundBox.length, boundBox.offset); } PaintStruct* PaintAddImageAsChildRotated(