1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Move painting for MoneyEffect entity

This commit is contained in:
ζeh Matt
2021-11-27 15:47:05 +02:00
parent 686e15fd1a
commit 53e4bf1bbf
3 changed files with 19 additions and 24 deletions

View File

@@ -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<int8_t*>(&waveOffset[Wiggle % 22]), OffsetX, session->CurrentRotation);
}

View File

@@ -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<rct_string_id, money64> GetStringId() const;
void Serialise(DataSerialiser& stream);
void Paint() const;
void Paint(paint_session* session, int32_t imageDirection) const;
};

View File

@@ -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<int8_t*>(&money_wave[moneyEffect->Wiggle % 22]),
moneyEffect->OffsetX, session->CurrentRotation);
}