diff --git a/src/object/thunderstorm.cpp b/src/object/thunderstorm.cpp index d4d28e70cc9..291cd113651 100644 --- a/src/object/thunderstorm.cpp +++ b/src/object/thunderstorm.cpp @@ -18,6 +18,7 @@ #include "audio/sound_manager.hpp" #include "editor/editor.hpp" +#include "object/ambient_light.hpp" #include "object/background.hpp" #include "object/electrifier.hpp" #include "supertux/level.hpp" @@ -95,6 +96,10 @@ Thunderstorm::update(float ) lightning(); time_to_thunder.start(interval); } + if(flash_display_timer.check()) { + Sector::current()->get_singleton_by_type() + .set_ambient_light(last_ambient_color); + } } void @@ -136,6 +141,7 @@ Thunderstorm::thunder() { SoundManager::current()->play("sounds/thunder.wav"); set_background_color(Color(0.4f, 0.4f, 0.4f)); + last_ambient_color = Sector::current()->get_singleton_by_type().get_ambient_light(); } void @@ -148,6 +154,7 @@ Thunderstorm::lightning() } set_background_color(Color::WHITE); + Sector::current()->get_singleton_by_type().set_ambient_light(Color::LIGHTNING_HIT_COLOR); } void diff --git a/src/object/thunderstorm.hpp b/src/object/thunderstorm.hpp index 0d2f4fadb4f..5ba43ba6d7c 100644 --- a/src/object/thunderstorm.hpp +++ b/src/object/thunderstorm.hpp @@ -85,6 +85,7 @@ class Thunderstorm final : public GameObject, Timer flash_display_timer; /**< counts down while flash is displayed */ std::map changing_tiles; /**< preserves the tiles which an electrocution should change */ + Color last_ambient_color; private: Thunderstorm(const Thunderstorm&) = delete; diff --git a/src/video/color.cpp b/src/video/color.cpp index 868e7c59d8f..35d2a355f55 100644 --- a/src/video/color.cpp +++ b/src/video/color.cpp @@ -26,6 +26,7 @@ const Color Color::CYAN(0.0, 1.0, 1.0); const Color Color::MAGENTA(1.0, 0.0, 1.0); const Color Color::YELLOW(1.0, 1.0, 0.0); const Color Color::WHITE(1.0, 1.0, 1.0); +const Color Color::LIGHTNING_HIT_COLOR(0.6, 0.6, 0.6, 0.5); Color::Color() : red(0), diff --git a/src/video/color.hpp b/src/video/color.hpp index 87b13355f15..cfa6c132aed 100644 --- a/src/video/color.hpp +++ b/src/video/color.hpp @@ -64,6 +64,7 @@ class Color final static const Color MAGENTA; static const Color YELLOW; static const Color WHITE; + static const Color LIGHTNING_HIT_COLOR; public: static Color from_rgb888(uint8_t r, uint8_t g, uint8_t b)