diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 1c519039e1..13b5d95182 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -15,6 +15,7 @@ #include "../interface/Window.h" #include "../localisation/Localisation.h" #include "../network/network.h" +#include "../paint/Paint.h" #include "../world/Map.h" #include "EntityRegistry.h" @@ -165,6 +166,21 @@ void MoneyEffect::Serialise(DataSerialiser& stream) stream << Wiggle; } -void MoneyEffect::Paint() const +void MoneyEffect::Paint(paint_session* session, int32_t imageDirection) const { + rct_drawpixelinfo& dpi = session->DPI; + if (dpi.zoom_level > 0) + { + return; + } + + /** rct2: 0x0097EDA4 */ + static constexpr const int8_t waveOffset[] = { + 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, + 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, + }; + + auto [stringId, value] = GetStringId(); + PaintFloatingMoneyEffect( + session, value, stringId, y, z, const_cast(&waveOffset[Wiggle % 22]), OffsetX, session->CurrentRotation); } diff --git a/src/openrct2/entity/MoneyEffect.h b/src/openrct2/entity/MoneyEffect.h index 00dece01cc..d76dfcace1 100644 --- a/src/openrct2/entity/MoneyEffect.h +++ b/src/openrct2/entity/MoneyEffect.h @@ -13,6 +13,7 @@ class DataSerialiser; struct CoordsXYZ; +struct paint_session; struct MoneyEffect : EntityBase { @@ -31,5 +32,5 @@ struct MoneyEffect : EntityBase void Update(); std::pair GetStringId() const; void Serialise(DataSerialiser& stream); - void Paint() const; + void Paint(paint_session* session, int32_t imageDirection) const; }; diff --git a/src/openrct2/paint/sprite/Paint.Misc.cpp b/src/openrct2/paint/sprite/Paint.Misc.cpp index b738bc703a..b28a14eca7 100644 --- a/src/openrct2/paint/sprite/Paint.Misc.cpp +++ b/src/openrct2/paint/sprite/Paint.Misc.cpp @@ -17,25 +17,3 @@ #include "../../localisation/StringIds.h" #include "../Paint.h" #include "Paint.Sprite.h" - -/** rct2: 0x0097EDA4 */ -static constexpr const int8_t money_wave[] = { - 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, - 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, -}; - -template<> void PaintEntity(paint_session* session, const MoneyEffect* moneyEffect, int32_t imageDirection) -{ - rct_drawpixelinfo* dpi = &session->DPI; - - if (dpi->zoom_level > 0) - { - return; - } - if (moneyEffect == nullptr) - return; - auto [stringId, value] = moneyEffect->GetStringId(); - PaintFloatingMoneyEffect( - session, value, stringId, moneyEffect->y, moneyEffect->z, const_cast(&money_wave[moneyEffect->Wiggle % 22]), - moneyEffect->OffsetX, session->CurrentRotation); -}