diff --git a/src/openrct2/paint/sprite/Paint.Misc.cpp b/src/openrct2/paint/sprite/Paint.Misc.cpp index 4aaded7a39..9c7fe0d95e 100644 --- a/src/openrct2/paint/sprite/Paint.Misc.cpp +++ b/src/openrct2/paint/sprite/Paint.Misc.cpp @@ -108,63 +108,27 @@ void misc_paint(paint_session* session, const rct_sprite* misc, int32_t imageDir uint16_t height = jumpingFountain.z + 6; int32_t ebx = imageDirection / 8; - uint8_t al = (jumpingFountain.FountainFlags / 128) & 1; - uint8_t ah = (jumpingFountain.sprite_direction / 16) & 1; + // Fountain is firing anti clockwise + bool reversed = (jumpingFountain.FountainFlags & FOUNTAIN_FLAG::DIRECTION); + // Fountain rotation + bool rotated = (jumpingFountain.sprite_direction / 16) & 1; + bool isAntiClockwise = (ebx / 2) & 1; // Clockwise or Anti-clockwise - if (al == ah) + // These cancel each other out + if (reversed != rotated) { - al = ebx / 2; - } - else - { - al = ebx / 2; - al = al ^ 1; + isAntiClockwise = !isAntiClockwise; } uint32_t baseImageId = (jumpingFountain.type == SPRITE_MISC_JUMPING_FOUNTAIN_SNOW) ? 23037 : 22973; uint32_t imageId = baseImageId + ebx * 16 + jumpingFountain.frame; - if (al & 1) - { - switch (ebx) - { - case 0: - sub_98197C(session, imageId, 0, 0, 32, 1, 3, height, -32, -3, height); - break; + constexpr std::array antiClockWiseBoundingBoxes = { CoordsXY{ -COORDS_XY_STEP, -3 }, + CoordsXY{ 0, -3 } }; + constexpr std::array clockWiseBoundingBoxes = { CoordsXY{ -COORDS_XY_STEP, 3 }, CoordsXY{ 0, 3 } }; - case 1: - sub_98197C(session, imageId, 0, 0, 1, 32, 3, height, -3, 0, height); - break; + auto bb = isAntiClockwise ? antiClockWiseBoundingBoxes : clockWiseBoundingBoxes; - case 2: - sub_98197C(session, imageId, 0, 0, 32, 1, 3, height, 0, -3, height); - break; - - case 3: - sub_98197C(session, imageId, 0, 0, 1, 32, 3, height, -3, -32, height); - break; - } - } - else - { - switch (ebx) - { - case 0: - sub_98197C(session, imageId, 0, 0, 32, 1, 3, height, -32, 3, height); - break; - - case 1: - sub_98197C(session, imageId, 0, 0, 1, 32, 3, height, 3, 0, height); - break; - - case 2: - sub_98197C(session, imageId, 0, 0, 32, 1, 3, height, 0, 3, height); - break; - - case 3: - sub_98197C(session, imageId, 0, 0, 1, 32, 3, height, 3, -32, height); - break; - } - } + sub_98197C_rotated(session, ebx, imageId, 0, 0, 32, 1, 3, height, bb[ebx & 1].x, bb[ebx & 1].y, height); break; } diff --git a/src/openrct2/world/Fountain.cpp b/src/openrct2/world/Fountain.cpp index a89638a294..03b34fbb7d 100644 --- a/src/openrct2/world/Fountain.cpp +++ b/src/openrct2/world/Fountain.cpp @@ -28,16 +28,6 @@ enum class PATTERN FAST_RANDOM_CHASERS, }; -namespace FOUNTAIN_FLAG -{ - const uint32_t FAST = 1 << 0; - const uint32_t GOTO_EDGE = 1 << 1; - const uint32_t SPLIT = 1 << 2; - const uint32_t TERMINATE = 1 << 3; - const uint32_t BOUNCE = 1 << 4; - const uint32_t DIRECTION = 1 << 7; -}; // namespace FOUNTAIN_FLAG - static constexpr const std::array _fountainDirectionsNegative = { CoordsXY{ -COORDS_XY_STEP, 0 }, CoordsXY{ -COORDS_XY_STEP, -COORDS_XY_STEP }, diff --git a/src/openrct2/world/Fountain.h b/src/openrct2/world/Fountain.h index 4a9b028c1f..2bab18d1c4 100644 --- a/src/openrct2/world/Fountain.h +++ b/src/openrct2/world/Fountain.h @@ -41,3 +41,13 @@ enum JUMPING_FOUNTAIN_TYPE_WATER, JUMPING_FOUNTAIN_TYPE_SNOW }; + +namespace FOUNTAIN_FLAG +{ + const uint32_t FAST = 1 << 0; + const uint32_t GOTO_EDGE = 1 << 1; + const uint32_t SPLIT = 1 << 2; + const uint32_t TERMINATE = 1 << 3; + const uint32_t BOUNCE = 1 << 4; + const uint32_t DIRECTION = 1 << 7; +}; // namespace FOUNTAIN_FLAG