From: Wolfgang Becker Date: Sat, 16 Dec 2006 20:35:59 +0000 (+0000) Subject: Worldmaps reset ambient light. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=38e8b4c171b59735d03a2ad4bd42521de7abfa2c;p=supertux.git Worldmaps reset ambient light. SVN-Revision: 4472 --- diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index a47c628b0..404f14cc7 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -133,7 +133,7 @@ string_to_direction(const std::string& directory) //--------------------------------------------------------------------------- WorldMap::WorldMap(const std::string& filename, const std::string& force_spawnpoint) - : tux(0), solids(0), force_spawnpoint(force_spawnpoint) + : tux(0), solids(0), ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), force_spawnpoint(force_spawnpoint) { tile_manager.reset(new TileManager("images/worldmap.strf")); @@ -286,6 +286,14 @@ WorldMap::load(const std::string& filename) Teleporter* teleporter = new Teleporter(iter.lisp()); teleporters.push_back(teleporter); add_object(teleporter); + } else if(iter.item() == "ambient-light") { + std::vector vColor; + sector->get_vector( "ambient-light", vColor ); + if(vColor.size() < 3) { + log_warning << "(ambient-light) requires a color as argument" << std::endl; + } else { + ambient_light = Color( vColor ); + } } else if(iter.item() == "name") { // skip } else { @@ -643,6 +651,7 @@ WorldMap::at_teleporter(const Vector& pos) void WorldMap::draw(DrawingContext& context) { + context.set_ambient_color( ambient_light ); context.push_transform(); context.set_translation(camera_offset); diff --git a/src/worldmap/worldmap.hpp b/src/worldmap/worldmap.hpp index acbbedb66..b65069062 100644 --- a/src/worldmap/worldmap.hpp +++ b/src/worldmap/worldmap.hpp @@ -113,6 +113,7 @@ private: typedef std::vector ScriptList; ScriptList scripts; + Color ambient_light; std::string force_spawnpoint; /**< if set, spawnpoint will be forced to this value */ public: @@ -190,7 +191,6 @@ private: void load(const std::string& filename); void on_escape_press(); - }; } // namespace WorldMapNS