1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +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

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