[Super-tux-commit] supertux/src sector.h,1.15,1.16 sector.cpp,1.31,1.32 gameobjs.h,1.37,1.38 gameobj
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-23 17:48:01
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2393/src Modified Files: sector.h sector.cpp gameobjs.h gameobjs.cpp player.cpp Log Message: Show a message when more than one bad guys is killed in a row. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.176 retrieving revision 1.177 diff -u -d -r1.176 -r1.177 --- player.cpp 20 Sep 2004 19:30:30 -0000 1.176 +++ player.cpp 23 Sep 2004 17:47:49 -0000 1.177 @@ -22,6 +22,7 @@ #include <cassert> #include "app/globals.h" +#include "app/gettext.h" #include "player.h" #include "defines.h" #include "scene.h" @@ -334,7 +335,15 @@ physic.enable_gravity(false); /* Reset score multiplier (for multi-hits): */ if (!invincible_timer.started()) + { + if(player_status.score_multiplier > 2) + { // show a message + char str[124]; + sprintf(str, _("%d bad guys in a row!"), player_status.score_multiplier-1); + Sector::current()->add_floating_text(base, str); + } player_status.score_multiplier = 1; + } } if(jumped_in_solid) Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- gameobjs.cpp 20 Sep 2004 19:17:29 -0000 1.52 +++ gameobjs.cpp 23 Sep 2004 17:47:49 -0000 1.53 @@ -114,7 +114,7 @@ draw_tile(context, shape.id, position + Vector(0, offset), LAYER_TILES+1); } -FloatingText::FloatingText(const Vector& pos, std::string& text_) +FloatingText::FloatingText(const Vector& pos, const std::string& text_) : position(pos), text(text_) { timer.start(1000); Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- sector.h 17 Sep 2004 12:22:40 -0000 1.15 +++ sector.h 23 Sep 2004 17:47:46 -0000 1.16 @@ -113,6 +113,7 @@ bool add_bullet(const Vector& pos, float xm, Direction dir); bool add_smoke_cloud(const Vector& pos); bool add_particles(const Vector& epicenter, const Vector& velocity, const Vector& acceleration, int number, Color color, int size, int life_time); + void add_floating_text(const Vector& pos, const std::string& text); /** Try to grab the coin at the given coordinates */ void trygrabdistro(const Vector& pos, int bounciness); @@ -190,7 +191,7 @@ int distro_counter; bool counting_distros; - int currentmusic; + int currentmusic; }; #endif Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- gameobjs.h 20 Sep 2004 19:17:29 -0000 1.37 +++ gameobjs.h 23 Sep 2004 17:47:49 -0000 1.38 @@ -94,7 +94,7 @@ class FloatingText : public GameObject { public: - FloatingText(const Vector& pos, std::string& text_); + FloatingText(const Vector& pos, const std::string& text_); FloatingText(const Vector& pos, int s); // use this for score, for instance virtual void action(float elapsed_time); Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- sector.cpp 21 Sep 2004 22:03:32 -0000 1.31 +++ sector.cpp 23 Sep 2004 17:47:49 -0000 1.32 @@ -756,6 +756,12 @@ return true; } +void +Sector::add_floating_text(const Vector& pos, const std::string& text) +{ + add_object(new FloatingText(pos, text)); +} + /* Break a brick: */ bool Sector::trybreakbrick(const Vector& pos, bool small) |