From 6f03ad6816c77e5ae167427be4217cc8dd1df78d Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Sat, 20 Jan 2007 00:48:21 +0000 Subject: [PATCH] Issue #89: Respawn Tux at original, not current position. This is because upon restart, the reset of the level objects will be at their original position, too. SVN-Revision: 4608 --- src/object/firefly.cpp | 5 +++-- src/object/firefly.hpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/object/firefly.cpp b/src/object/firefly.cpp index ed10daeae..dc537cc2c 100644 --- a/src/object/firefly.cpp +++ b/src/object/firefly.cpp @@ -33,6 +33,7 @@ Firefly::Firefly(const lisp::Lisp& lisp) : MovingSprite(lisp, "images/objects/resetpoints/default-resetpoint.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), activated(false) { + initial_position = get_pos(); if( !lisp.get( "sprite", sprite_name ) ){ reactivate(); return; @@ -51,7 +52,7 @@ Firefly::Firefly(const lisp::Lisp& lisp) void Firefly::reactivate() { - if(GameSession::current()->get_reset_point_pos() == get_pos()){ + if(GameSession::current()->get_reset_point_pos() == initial_position){ // 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 @@ -94,7 +95,7 @@ Firefly::collision(GameObject& other, const CollisionHit& ) // TODO play sound sprite->set_action("ringing"); GameSession::current()->set_reset_point(Sector::current()->get_name(), - get_pos()); + initial_position); } return ABORT_MOVE; diff --git a/src/object/firefly.hpp b/src/object/firefly.hpp index 889afe3bd..632508794 100644 --- a/src/object/firefly.hpp +++ b/src/object/firefly.hpp @@ -40,6 +40,7 @@ public: private: bool activated; + Vector initial_position; /**< position as in level file. This is where Tux will have to respawn, as the level is reset every time */ void reactivate(); }; -- 2.11.0