From 5ee5f8013deb83ccab6fa03322219f3e0da16dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:57:13 +0200 Subject: [PATCH] Separate game state logic and rendering logic for money entities --- src/openrct2/entity/Guest.cpp | 10 +--------- src/openrct2/entity/MoneyEffect.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 235a03673b..14e45644e6 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -2300,15 +2300,7 @@ void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureTyp FinancePayment(-amount, expenditure); - if (gConfigGeneral.ShowGuestPurchases && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) - { - // HACK Currently disabled for multiplayer due to limitation of all sprites - // needing to be synchronised - if (NetworkGetMode() == NETWORK_MODE_NONE && !gOpenRCT2Headless) - { - MoneyEffect::CreateAt(amount, GetLocation(), true); - } - } + MoneyEffect::CreateAt(amount, GetLocation(), true); OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Purchase, GetLocation()); } diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 946f6367d2..b72f87f97d 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -9,6 +9,7 @@ #include "MoneyEffect.h" #include "../OpenRCT2.h" +#include "../config/Config.h" #include "../core/DataSerialiser.h" #include "../drawing/Drawing.h" #include "../interface/Viewport.h" @@ -172,6 +173,18 @@ void MoneyEffect::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); + if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + { + // Don't render any money in the title screen. + return; + } + + if (GuestPurchase && !gConfigGeneral.ShowGuestPurchases) + { + // Don't show the money effect for guest purchases when the option is disabled. + return; + } + DrawPixelInfo& dpi = session.DPI; if (dpi.zoom_level > ZoomLevel{ 0 }) {