don't draw darkness unless there are shaped lights

This commit is contained in:
2024-10-14 16:28:16 -05:00
parent 2227fa573c
commit 802ec7a940

View File

@@ -489,13 +489,19 @@
(Night NIGHT_COLOR)
(otherwise FlxColor.TRANSPARENT)))
(darkness.makeGraphic FlxG.width FlxG.height darkColor true)
(doFor source lightSources (drawLight source))
// When there are no shaped light sources, don't draw darkness, it's usually just annoying.
(localVar &mut lightIsHere false)
(doFor source lightSources
(set lightIsHere true)
(drawLight source))
(blackAlphaMaskFlxSprite darkness lightMask darkness)
(set lightSprite.cameras [flxMovie.screenCamera])
(set darkness.alpha darkColor.alphaFloat)
(set darkness.cameras [flxMovie.screenCamera])
(FlxG.state.add darkness)
(FlxG.state.add lightSprite))
// TODO put these in defined sprite layers!
(when lightIsHere
(FlxG.state.add darkness)
(FlxG.state.add lightSprite)))
(method :Void hideLighting []
(when darkness