X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fworldmap%2Fsprite_change.hpp;h=4f22ae1c270db0f2d8b62470c4713d2759d15516;hb=3aa6936791cf24344e27d452ab2fd8c33fb5a2e8;hp=c572309d468c81051c50f67de469ecc6a412eaee;hpb=112f01454123c94f5627200c6819b219026f0af0;p=supertux.git diff --git a/src/worldmap/sprite_change.hpp b/src/worldmap/sprite_change.hpp index c572309d4..4f22ae1c2 100644 --- a/src/worldmap/sprite_change.hpp +++ b/src/worldmap/sprite_change.hpp @@ -1,13 +1,10 @@ -// $Id: worldmap.hpp 3327 2006-04-13 15:02:40Z ravu_al_hemio $ -// // SuperTux -// Copyright (C) 2004 Ingo Ruhnke -// Copyright (C) 2006 Christoph Sommer +// Copyright (C) 2006 Matthias Braun // -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,21 +12,22 @@ // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef __WORLDMAP_SPRITE_CHANGE_HPP__ -#define __WORLDMAP_SPRITE_CHANGE_HPP__ +// along with this program. If not, see . -#include +#ifndef HEADER_SUPERTUX_WORLDMAP_SPRITE_CHANGE_HPP +#define HEADER_SUPERTUX_WORLDMAP_SPRITE_CHANGE_HPP + +#include #include -#include "game_object.hpp" +#include + #include "lisp/lisp.hpp" #include "math/vector.hpp" +#include "supertux/game_object.hpp" class Sprite; -namespace WorldMapNS -{ +namespace WorldMapNS { class SpriteChange : public GameObject { @@ -37,30 +35,48 @@ public: SpriteChange(const lisp::Lisp* lisp); virtual ~SpriteChange(); - Vector pos; + virtual void draw(DrawingContext& context); + virtual void update(float elapsed_time); + /** - * should tuxs sprite change when the tile has been completely entered, - * or already when the tile was just touched + * Activates the SpriteChange's stay action, if applicable */ - bool enter; - /// sprite to change tux image to - std::auto_ptr sprite; + void set_stay_action(); + /** - * stay action can be used for objects like boats or cars, if it is - * != "" then this sprite will be displayed when tux left the tile towards - * another SpriteChange object. + * Deactivates the SpriteChange's stay action, if applicable */ + void clear_stay_action(); + +public: + Vector pos; + + /** should tuxs sprite change when the tile has been completely entered, + or already when the tile was just touched */ + bool change_on_touch; + + /** sprite to change tux image to */ + std::auto_ptr sprite; + + /** stay action can be used for objects like boats or cars, if it is + != "" then this sprite will be displayed when tux left the tile + towards another SpriteChange object. */ std::string stay_action; - /** - * should the stayaction be displayed - */ + + /** name of a group in which only one SpriteChange will ever have + its stay_action displayed. Leave empty if you don't care. */ + std::string stay_group; + +private: + /** should the stayaction be displayed */ bool in_stay_action; - virtual void draw(DrawingContext& context); - virtual void update(float elapsed_time); +private: + static std::list all_sprite_changes; }; -} +} // namespace WorldMapNS #endif +/* EOF */