forked from rosebudai/OpenRCT2-Web
Rename JumpingFountain and move paint code to paint/entity (#26571)
* Move JumpingFountain paint code to paint/entity * Rename Fountain files to JumpingFountain * Rename PaintFountain to PaintJumpingFountain
This commit is contained in:
1 parent
ee3d6b163b
commit
9780eead48
16 files changed
+101
-65
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -281,7 +281,7 @@
|
||||
<ClInclude Include="entity\EntityList.h" />
|
||||
<ClInclude Include="entity\EntityRegistry.h" />
|
||||
<ClInclude Include="entity\EntityTweener.h" />
|
||||
<ClInclude Include="entity\Fountain.h" />
|
||||
<ClInclude Include="entity\JumpingFountain.h" />
|
||||
<ClInclude Include="entity\Guest.h" />
|
||||
<ClInclude Include="entity\Litter.h" />
|
||||
<ClInclude Include="entity\MoneyEffect.h" />
|
||||
@@ -404,6 +404,7 @@
|
||||
<ClInclude Include="paint\entity\Paint.ExplosionCloud.h" />
|
||||
<ClInclude Include="paint\entity\Paint.ExplosionFlare.h" />
|
||||
<ClInclude Include="paint\entity\Paint.Guest.h" />
|
||||
<ClInclude Include="paint\entity\Paint.JumpingFountain.h" />
|
||||
<ClInclude Include="paint\entity\Paint.Litter.h" />
|
||||
<ClInclude Include="paint\entity\Paint.MoneyEffect.h" />
|
||||
<ClInclude Include="paint\entity\Paint.Peep.h" />
|
||||
@@ -911,7 +912,7 @@
|
||||
<ClCompile Include="entity\EntityBase.cpp" />
|
||||
<ClCompile Include="entity\EntityRegistry.cpp" />
|
||||
<ClCompile Include="entity\EntityTweener.cpp" />
|
||||
<ClCompile Include="entity\Fountain.cpp" />
|
||||
<ClCompile Include="entity\JumpingFountain.cpp" />
|
||||
<ClCompile Include="entity\Guest.cpp" />
|
||||
<ClCompile Include="entity\Litter.cpp" />
|
||||
<ClCompile Include="entity\MoneyEffect.cpp" />
|
||||
@@ -1011,6 +1012,7 @@
|
||||
<ClCompile Include="paint\entity\Paint.ExplosionCloud.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.ExplosionFlare.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.Guest.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.JumpingFountain.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.Litter.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.MoneyEffect.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.Peep.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<ExplosionFlare>());
|
||||
break;
|
||||
case EntityType::jumpingFountain:
|
||||
entity->cast<JumpingFountain>()->Paint(session, image_direction);
|
||||
PaintJumpingFountain(session, *entity->cast<JumpingFountain>(), image_direction);
|
||||
break;
|
||||
case EntityType::balloon:
|
||||
PaintBalloon(session, *entity->cast<Balloon>(), image_direction);
|
||||
|
||||
@@ -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 } });
|
||||
}
|
||||
@@ -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 <cstdint>
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
struct JumpingFountain;
|
||||
}
|
||||
|
||||
struct PaintSession;
|
||||
|
||||
void PaintJumpingFountain(PaintSession& session, const OpenRCT2::JumpingFountain& jumpingFountain, int32_t imageDirection);
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user