Separate game state logic and rendering logic for money entities

This commit is contained in:
ζeh Matt 2023-03-22 17:57:13 +02:00
parent 436c881f95
commit 5ee5f8013d
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
2 changed files with 14 additions and 9 deletions

View File

@ -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());
}

View File

@ -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 })
{