diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 8e9c67d6f8..3ee0a60f1d 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -15,8 +15,8 @@ #include "entity/Duck.h" #include "entity/EntityList.h" #include "entity/EntityRegistry.h" -#include "entity/Fountain.h" #include "entity/Guest.h" +#include "entity/JumpingFountain.h" #include "entity/Litter.h" #include "entity/MoneyEffect.h" #include "entity/Particle.h" diff --git a/src/openrct2/SpriteIds.h b/src/openrct2/SpriteIds.h index c9280bef7a..c17b06b2c9 100644 --- a/src/openrct2/SpriteIds.h +++ b/src/openrct2/SpriteIds.h @@ -874,6 +874,9 @@ enum : ImageIndex SPR_EXPLOSION_FLARE = 22896, SPR_CRASH_SPLASH_PARTICLE = 22927, + SPR_JUMPING_FOUNTAIN_WATER = 22973, + SPR_JUMPING_FOUNTAIN_SNOW = 23037, + SPR_LAND_OWNERSHIP_AVAILABLE = 22955, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE = 22956, diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index 3cb92fa64f..4761bca87c 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -30,7 +30,7 @@ #include "Balloon.h" #include "Duck.h" #include "EntityTweener.h" -#include "Fountain.h" +#include "JumpingFountain.h" #include "MoneyEffect.h" #include "Particle.h" diff --git a/src/openrct2/entity/Fountain.cpp b/src/openrct2/entity/JumpingFountain.cpp similarity index 88% rename from src/openrct2/entity/Fountain.cpp rename to src/openrct2/entity/JumpingFountain.cpp index 9d43b96e1b..7cc87371c5 100644 --- a/src/openrct2/entity/Fountain.cpp +++ b/src/openrct2/entity/JumpingFountain.cpp @@ -7,13 +7,12 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -#include "Fountain.h" +#include "JumpingFountain.h" #include "../Game.h" #include "../GameState.h" #include "../core/DataSerialiser.h" #include "../object/PathAdditionEntry.h" -#include "../paint/Paint.h" #include "../profiling/Profiling.h" #include "../scenario/Scenario.h" #include "../world/Footpath.h" @@ -403,51 +402,4 @@ namespace OpenRCT2 stream << TargetY; stream << Iteration; } - - void JumpingFountain::Paint(PaintSession& session, int32_t imageDirection) const - { - PROFILED_FUNCTION(); - - // TODO: Move into SpriteIds.h - constexpr uint32_t kJumpingFountainSnowBaseImage = 23037; - constexpr uint32_t kJumpingFountainWaterBaseImage = 22973; - - auto& rt = session.rt; - if (rt.zoom_level > ZoomLevel{ 0 }) - { - return; - } - - uint16_t height = z + 6; - imageDirection = imageDirection / 8; - - // Fountain is firing anti clockwise - bool reversed = fountainFlags.has(FountainFlag::direction); - // Fountain rotation - bool rotated = (orientation / 16) & 1; - bool isAntiClockwise = (imageDirection / 2) & 1; // Clockwise or Anti-clockwise - - // These cancel each other out - if (reversed != rotated) - { - isAntiClockwise = !isAntiClockwise; - } - - uint32_t baseImageId = (FountainType == JumpingFountainType::Snow) ? kJumpingFountainSnowBaseImage - : kJumpingFountainWaterBaseImage; - auto imageId = ImageId(baseImageId + imageDirection * 16 + frame); - constexpr std::array antiClockWiseBoundingBoxes = { - CoordsXY{ -kCoordsXYStep, -3 }, - CoordsXY{ 0, -3 }, - }; - constexpr std::array clockWiseBoundingBoxes = { - CoordsXY{ -kCoordsXYStep, 3 }, - CoordsXY{ 0, 3 }, - }; - - auto bb = isAntiClockwise ? antiClockWiseBoundingBoxes : clockWiseBoundingBoxes; - - PaintAddImageAsParentRotated( - session, imageDirection, imageId, { 0, 0, height }, { { bb[imageDirection & 1], height }, { 32, 1, 3 } }); - } } // namespace OpenRCT2 diff --git a/src/openrct2/entity/Fountain.h b/src/openrct2/entity/JumpingFountain.h similarity index 95% rename from src/openrct2/entity/Fountain.h rename to src/openrct2/entity/JumpingFountain.h index 774c4da97d..fe85dc1e1d 100644 --- a/src/openrct2/entity/Fountain.h +++ b/src/openrct2/entity/JumpingFountain.h @@ -13,8 +13,6 @@ #include "../world/Location.hpp" #include "EntityBase.h" -struct PaintSession; - namespace OpenRCT2 { class DataSerialiser; @@ -52,7 +50,6 @@ namespace OpenRCT2 void Update(); static void StartAnimation(JumpingFountainType newType, const CoordsXY& newLoc, const TileElement* tileElement); void Serialise(DataSerialiser& stream); - void Paint(PaintSession& session, int32_t imageDirection) const; private: JumpingFountainType GetType() const; diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 714c7d8cda..b06eefcf95 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -281,7 +281,7 @@ - + @@ -404,6 +404,7 @@ + @@ -911,7 +912,7 @@ - + @@ -1011,6 +1012,7 @@ + diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index 5efe77a08a..4139519153 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -13,7 +13,7 @@ #include "../drawing/LightFX.h" #include "../entity/Duck.h" #include "../entity/EntityList.h" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../entity/MoneyEffect.h" #include "../entity/Particle.h" #include "../entity/Staff.h" @@ -31,6 +31,7 @@ #include "entity/Paint.ExplosionCloud.h" #include "entity/Paint.ExplosionFlare.h" #include "entity/Paint.Guest.h" +#include "entity/Paint.JumpingFountain.h" #include "entity/Paint.Litter.h" #include "entity/Paint.MoneyEffect.h" #include "entity/Paint.Staff.h" @@ -171,7 +172,7 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos) PaintExplosionFlare(session, *entity->cast()); break; case EntityType::jumpingFountain: - entity->cast()->Paint(session, image_direction); + PaintJumpingFountain(session, *entity->cast(), image_direction); break; case EntityType::balloon: PaintBalloon(session, *entity->cast(), image_direction); diff --git a/src/openrct2/paint/entity/Paint.JumpingFountain.cpp b/src/openrct2/paint/entity/Paint.JumpingFountain.cpp new file mode 100644 index 0000000000..bc76d2fa38 --- /dev/null +++ b/src/openrct2/paint/entity/Paint.JumpingFountain.cpp @@ -0,0 +1,60 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Paint.JumpingFountain.h" + +#include "../../SpriteIds.h" +#include "../../entity/JumpingFountain.h" +#include "../../profiling/Profiling.h" +#include "../Paint.h" + +using namespace OpenRCT2; + +void PaintJumpingFountain(PaintSession& session, const JumpingFountain& jumpingFountain, int32_t imageDirection) +{ + PROFILED_FUNCTION(); + + auto& rt = session.rt; + if (rt.zoom_level > ZoomLevel{ 0 }) + { + return; + } + + uint16_t height = jumpingFountain.z + 6; + imageDirection = imageDirection / 8; + + // Fountain is firing anti clockwise + bool reversed = jumpingFountain.fountainFlags.has(FountainFlag::direction); + // Fountain rotation + bool rotated = (jumpingFountain.orientation / 16) & 1; + bool isAntiClockwise = (imageDirection / 2) & 1; // Clockwise or Anti-clockwise + + // These cancel each other out + if (reversed != rotated) + { + isAntiClockwise = !isAntiClockwise; + } + + uint32_t baseImageId = (jumpingFountain.FountainType == JumpingFountainType::Snow) ? SPR_JUMPING_FOUNTAIN_SNOW + : SPR_JUMPING_FOUNTAIN_WATER; + auto imageId = ImageId(baseImageId + imageDirection * 16 + jumpingFountain.frame); + constexpr std::array kAntiClockWiseBoundingBoxes = { + CoordsXY{ -kCoordsXYStep, -3 }, + CoordsXY{ 0, -3 }, + }; + constexpr std::array kClockWiseBoundingBoxes = { + CoordsXY{ -kCoordsXYStep, 3 }, + CoordsXY{ 0, 3 }, + }; + + auto bb = isAntiClockwise ? kAntiClockWiseBoundingBoxes : kClockWiseBoundingBoxes; + + PaintAddImageAsParentRotated( + session, imageDirection, imageId, { 0, 0, height }, { { bb[imageDirection & 1], height }, { 32, 1, 3 } }); +} diff --git a/src/openrct2/paint/entity/Paint.JumpingFountain.h b/src/openrct2/paint/entity/Paint.JumpingFountain.h new file mode 100644 index 0000000000..ee8a5b32bf --- /dev/null +++ b/src/openrct2/paint/entity/Paint.JumpingFountain.h @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2 +{ + struct JumpingFountain; +} + +struct PaintSession; + +void PaintJumpingFountain(PaintSession& session, const OpenRCT2::JumpingFountain& jumpingFountain, int32_t imageDirection); diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 0da348f143..d1c5c91c90 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -31,7 +31,7 @@ #include "../entity/Duck.h" #include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../entity/Litter.h" #include "../entity/MoneyEffect.h" #include "../entity/Particle.h" diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 3f89d5104a..ab4ed34b3b 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -25,7 +25,7 @@ #include "../entity/Balloon.h" #include "../entity/Duck.h" #include "../entity/EntityList.h" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../entity/Litter.h" #include "../entity/MoneyEffect.h" #include "../entity/Particle.h" diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index 08600a38f7..860680cdc3 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -14,7 +14,7 @@ #include "../core/EnumUtils.hpp" #include "../core/FlagHolder.hpp" #include "../core/Money.hpp" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../management/Research.h" #include "../object/Object.h" #include "../ride/RideTypes.h" diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index d5e5bf46b5..204ac4ea2e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -17,8 +17,8 @@ #include "../core/String.hpp" #include "../entity/Balloon.h" #include "../entity/Duck.h" -#include "../entity/Fountain.h" #include "../entity/Guest.h" +#include "../entity/JumpingFountain.h" #include "../entity/Litter.h" #include "../entity/MoneyEffect.h" #include "../entity/Particle.h" diff --git a/src/openrct2/scripting/bindings/world/ScMap.cpp b/src/openrct2/scripting/bindings/world/ScMap.cpp index 2039289c74..129362f2b4 100644 --- a/src/openrct2/scripting/bindings/world/ScMap.cpp +++ b/src/openrct2/scripting/bindings/world/ScMap.cpp @@ -15,8 +15,8 @@ #include "../../../entity/Balloon.h" #include "../../../entity/Duck.h" #include "../../../entity/EntityList.h" - #include "../../../entity/Fountain.h" #include "../../../entity/Guest.h" + #include "../../../entity/JumpingFountain.h" #include "../../../entity/Litter.h" #include "../../../entity/MoneyEffect.h" #include "../../../entity/Particle.h" diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 3e88c72687..a2c153f5b5 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -27,7 +27,7 @@ #include "../entity/Duck.h" #include "../entity/EntityList.h" #include "../entity/EntityTweener.h" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../entity/PatrolArea.h" #include "../entity/Staff.h" #include "../interface/Cursors.h" diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 03f34c8af8..3396bf5e98 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -21,7 +21,7 @@ #include "../actions/scenery/SmallSceneryRemoveAction.h" #include "../actions/scenery/WallRemoveAction.h" #include "../core/CodepointView.hpp" -#include "../entity/Fountain.h" +#include "../entity/JumpingFountain.h" #include "../network/Network.h" #include "../object/BannerSceneryEntry.h" #include "../object/LargeSceneryEntry.h"