From: Miloš Klouček Date: Wed, 28 Jan 2009 15:46:06 +0000 (+0000) Subject: Allow declaration of "layer" for thunderstorm (both game and editor parts) => Thunder... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3b98af33dfb3ea9f683a89d35a02206d18cb0494;p=supertux.git Allow declaration of "layer" for thunderstorm (both game and editor parts) => Thunderstorm is now layered object, there is only "camera" left in "miscelanious objects box" SVN-Revision: 5834 --- diff --git a/src/object/thunderstorm.cpp b/src/object/thunderstorm.cpp index f896f25b6..4e761a11c 100644 --- a/src/object/thunderstorm.cpp +++ b/src/object/thunderstorm.cpp @@ -42,7 +42,7 @@ namespace { } Thunderstorm::Thunderstorm(const lisp::Lisp& reader) - : running(true), interval(10.0f) + : running(true), interval(10.0f), layer(LAYER_BACKGROUNDTILES-1) { reader.get("name", name); reader.get("running", running); @@ -50,6 +50,7 @@ Thunderstorm::Thunderstorm(const lisp::Lisp& reader) if(interval <= 0) { log_warning << "Running a thunderstorm with non-positive time interval is a bad idea" << std::endl; } + reader.get("layer", layer); sound_manager->preload("sounds/explosion.wav"); sound_manager->preload("sounds/upgrade.wav"); @@ -82,7 +83,7 @@ Thunderstorm::draw(DrawingContext& context) float alpha = 0.33f; context.push_transform(); context.set_translation(Vector(0, 0)); - context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), LAYER_BACKGROUNDTILES-1); + context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), layer); context.pop_transform(); } diff --git a/src/object/thunderstorm.hpp b/src/object/thunderstorm.hpp index 5a7fbe808..fcfba4879 100644 --- a/src/object/thunderstorm.hpp +++ b/src/object/thunderstorm.hpp @@ -82,6 +82,7 @@ public: private: bool running; /**< whether we currently automatically trigger lightnings */ float interval; /**< time between two lightnings */ + int layer; /**< layer, where flash will be painted */ Timer time_to_thunder; /**< counts down until next thunder */ Timer time_to_lightning; /**< counts down until next lightning */