From: Wolfgang Becker Date: Wed, 10 Jan 2007 17:55:56 +0000 (+0000) Subject: Activate firefly on restart X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b9f4b667813697c7c8cfba795eb39c83084c91bf;p=supertux.git Activate firefly on restart SVN-Revision: 4540 --- diff --git a/src/game_session.hpp b/src/game_session.hpp index abc507e95..3c5e5dbab 100644 --- a/src/game_session.hpp +++ b/src/game_session.hpp @@ -62,6 +62,12 @@ public: void finish(bool win = true); void respawn(const std::string& sectorname, const std::string& spawnpointname); void set_reset_point(const std::string& sectorname, const Vector& pos); + std::string get_reset_point_sectorname() + { return reset_sector; } + + Vector get_reset_point_pos() + { return reset_pos; } + void display_info_box(const std::string& text); Sector* get_current_sector() diff --git a/src/object/firefly.cpp b/src/object/firefly.cpp index 49299fb94..ed10daeae 100644 --- a/src/object/firefly.cpp +++ b/src/object/firefly.cpp @@ -33,17 +33,32 @@ Firefly::Firefly(const lisp::Lisp& lisp) : MovingSprite(lisp, "images/objects/resetpoints/default-resetpoint.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), activated(false) { - if( !lisp.get( "sprite", sprite_name ) ){ + reactivate(); return; } if( sprite_name == "" ){ sprite_name = "images/objects/resetpoints/default-resetpoint.sprite"; + reactivate(); return; } //Replace sprite sprite = sprite_manager->create( sprite_name ); bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); + reactivate(); +} + +void +Firefly::reactivate() +{ + if(GameSession::current()->get_reset_point_pos() == get_pos()){ + // TODO: && GameSession::current()->get_reset_point_sectorname() == + // GameSession::current()->get_current_sector()->get_name() is not yet initialized. + // Worst case a resetpoint in a different sector at the same position as the real + // resetpoint the player is spawning is set to ringing, too. Until we can check the sector, too, dont set + // activated = true; here. + sprite->set_action("ringing"); + } } void diff --git a/src/object/firefly.hpp b/src/object/firefly.hpp index f77a5745b..889afe3bd 100644 --- a/src/object/firefly.hpp +++ b/src/object/firefly.hpp @@ -40,6 +40,7 @@ public: private: bool activated; + void reactivate(); }; #endif diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index a0dd5bfda..1b4a4b38f 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -33,7 +33,7 @@ #include "glutil.hpp" #include "texture.hpp" #include "texture_manager.hpp" -#define LIGHTMAP_DIV 1 +#define LIGHTMAP_DIV 5 static inline int next_po2(int val) {