From: Marek Moeckel Date: Thu, 10 Jun 2004 16:03:17 +0000 (+0000) Subject: Door animation implemented - doors now open when activated X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cc44de029066f2cfec1e6c50500f099443586293;p=supertux.git Door animation implemented - doors now open when activated It still has bugs and it's coded rather dirty. Someone please have a look at it - see door.cpp for details. SVN-Revision: 1464 --- diff --git a/TODO b/TODO index b09a2dee8..c28fbb7b8 100644 --- a/TODO +++ b/TODO @@ -76,6 +76,7 @@ L: low priority [L] we only have a global counter for multiple coin blocks. This should be handled per block. [L] Show level number on top of the screen when playing the level +[L] fix the door animation Beyond Milestone2 ----------------- diff --git a/data/supertux.strf b/data/supertux.strf index 33fce3df1..0d617a8ed 100644 --- a/data/supertux.strf +++ b/data/supertux.strf @@ -697,7 +697,15 @@ "shared/door-5.png" "shared/door-6.png" "shared/door-7.png" - "shared/door-8.png") + "shared/door-8.png" + "shared/door-8.png" + "shared/door-7.png" + "shared/door-6.png" + "shared/door-5.png" + "shared/door-4.png" + "shared/door-3.png" + "shared/door-2.png" + "shared/door-1.png") ) ; Stomp diff --git a/po/es.po b/po/es.po index 73c58c1e9..074dc7888 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: SuperTux-CVS\n" "Report-Msgid-Bugs-To: super-tux-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2004-06-09 18:34+0100\n" +"POT-Creation-Date: 2004-06-10 14:53+0100\n" "PO-Revision-Date: 2004-06-09 23:10+0200\n" "Last-Translator: Javier Beaumont \n" "Language-Team: Spanish Team \n" @@ -26,56 +26,56 @@ msgstr "por " msgid "PAUSE - Press 'P' To Play" msgstr "PAUSA - Pulsa 'P' para continuar" -#: src/gameloop.cpp:702 src/worldmap.cpp:849 +#: src/gameloop.cpp:528 +#, fuzzy, c-format +msgid "Playing: " +msgstr "Jugando: %s" + +#: src/gameloop.cpp:714 src/worldmap.cpp:849 msgid "SCORE" msgstr "PUNTOS" -#: src/gameloop.cpp:707 +#: src/gameloop.cpp:719 msgid "Press ESC To Return" msgstr "Pulsa ESC para volver" -#: src/gameloop.cpp:712 +#: src/gameloop.cpp:724 msgid "TIME's UP" msgstr "FUERA DE TIEMPO" -#: src/gameloop.cpp:716 +#: src/gameloop.cpp:728 msgid "TIME" msgstr "TIEMPO" -#: src/gameloop.cpp:723 src/gameloop.cpp:724 src/worldmap.cpp:853 +#: src/gameloop.cpp:735 src/gameloop.cpp:736 src/worldmap.cpp:853 msgid "COINS" msgstr "MONEDAS" -#: src/gameloop.cpp:745 src/gameloop.cpp:746 src/worldmap.cpp:874 +#: src/gameloop.cpp:757 src/gameloop.cpp:758 src/worldmap.cpp:874 #: src/worldmap.cpp:875 msgid "LIVES" msgstr "VIDAS" -#: src/gameloop.cpp:751 -#, c-format -msgid "Playing: %s" -msgstr "Jugando: %s" - -#: src/gameloop.cpp:776 +#: src/gameloop.cpp:780 msgid "Result:" msgstr "Resultado:" -#: src/gameloop.cpp:779 src/worldmap.cpp:726 +#: src/gameloop.cpp:783 src/worldmap.cpp:726 #, c-format msgid "SCORE: %d" msgstr "PUNTOS: %d" -#: src/gameloop.cpp:782 src/worldmap.cpp:730 +#: src/gameloop.cpp:786 src/worldmap.cpp:730 #, c-format msgid "COINS: %d" msgstr "MONEDAS: %d" -#: src/gameloop.cpp:811 +#: src/gameloop.cpp:815 #, c-format msgid "Slot %d - Savegame" msgstr "Slot %d - Juego salvado" -#: src/gameloop.cpp:814 +#: src/gameloop.cpp:818 #, c-format msgid "Slot %d - Free" msgstr "Slot %d - Libre" @@ -376,4 +376,3 @@ msgstr " #: src/worldmap.cpp:723 msgid "GAMEOVER" msgstr "FIN DEL JUEGO" - diff --git a/src/door.cpp b/src/door.cpp index 39878876f..dd97b5a4c 100644 --- a/src/door.cpp +++ b/src/door.cpp @@ -37,6 +37,8 @@ Door::Door(LispReader& reader) reader.read_string("spawnpoint", target_spawnpoint); sprite = sprite_manager->load("door"); + animation_timer.init(true); + door_activated = false; } void @@ -68,13 +70,27 @@ void Door::draw(DrawingContext& context) { sprite->draw(context, Vector(area.x, area.y), LAYER_TILES); + + //Check if door animation is complete + //TODO: Move this out of the "draw" method as this is extremely dirty :) + if ((!animation_timer.check()) && (door_activated)) { + door_activated = false; + sprite = sprite_manager->load("door"); + GameSession::current()->respawn(target_sector, target_spawnpoint); + } } void Door::interaction(InteractionType type) { + //Animate the door on activation + //TODO: Resetting the animation doesn't work correctly + // Tux and badguys should stop moving while the door is opening if(type == INTERACTION_ACTIVATE) { - GameSession::current()->respawn(target_sector, target_spawnpoint); + sprite = sprite_manager->load("openingdoor"); + sprite->reset(); + animation_timer.start(ANIM_TIME); + door_activated = true; } } diff --git a/src/door.h b/src/door.h index c66b8cd03..d5990fbec 100644 --- a/src/door.h +++ b/src/door.h @@ -24,6 +24,9 @@ #include "interactive_object.h" #include "serializable.h" +#include "timer.h" + +#define ANIM_TIME 1500 class Sprite; @@ -45,6 +48,8 @@ private: Sprite* sprite; std::string target_sector; std::string target_spawnpoint; + Timer animation_timer; //Used for door animation + bool door_activated; }; #endif /*SUPERTUX_DOOR_H*/