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

Fix lighting effects not toggling correctly (#22582)

* Fix lighting effects not toggling correctly

* Simplify boolean expressions around lighting effects options

* Invalidate entire screen after toggling lighting effects

* Add changelog entry
This commit is contained in:
Aaron van Geffen
2024-08-16 22:37:21 +02:00
committed by GitHub
parent 87505c2e4d
commit 4bdbd787a9
3 changed files with 7 additions and 4 deletions

View File

@@ -15,6 +15,7 @@
- Fix: [#22316] Potential crash when switching the drawing engine while the game is running.
- Fix: [#22395, #22396] Misaligned tick marks in financial and guest count graphs (original bug).
- Fix: [#22457] Potential crash opening the scenario select window.
- Fix: [#22582] Lighting effects are not enabled/disabled correctly, making the game appear frozen.
0.4.13 (2024-08-04)
------------------------------------------------------------------------

View File

@@ -131,12 +131,12 @@ void LightFXSetAvailable(bool available)
bool LightFXIsAvailable()
{
return _lightfxAvailable && Config::Get().general.EnableLightFx != 0;
return _lightfxAvailable && Config::Get().general.EnableLightFx;
}
bool LightFXForVehiclesIsAvailable()
{
return LightFXIsAvailable() && Config::Get().general.EnableLightFxForVehicles != 0;
return LightFXIsAvailable() && Config::Get().general.EnableLightFxForVehicles;
}
void LightFXInit()

View File

@@ -121,7 +121,7 @@ X8DrawingEngine::X8DrawingEngine([[maybe_unused]] const std::shared_ptr<Ui::IUiC
_drawingContext = new X8DrawingContext(this);
_bitsDPI.DrawingEngine = this;
LightFXSetAvailable(true);
_lastLightFXenabled = (Config::Get().general.EnableLightFx != 0);
_lastLightFXenabled = Config::Get().general.EnableLightFx;
}
X8DrawingEngine::~X8DrawingEngine()
@@ -188,9 +188,11 @@ void X8DrawingEngine::BeginDraw()
if (!IntroIsPlaying())
{
// HACK we need to re-configure the bits if light fx has been enabled / disabled
if (_lastLightFXenabled != (Config::Get().general.EnableLightFx != 0))
if (_lastLightFXenabled != Config::Get().general.EnableLightFx)
{
Resize(_width, _height);
GfxInvalidateScreen();
_lastLightFXenabled = Config::Get().general.EnableLightFx;
}
_weatherDrawer.Restore(_bitsDPI);
}