Show a message when more than one bad guys is killed in a row.
authorRicardo Cruz <rick2@aeiou.pt>
Thu, 23 Sep 2004 17:47:49 +0000 (17:47 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Thu, 23 Sep 2004 17:47:49 +0000 (17:47 +0000)
SVN-Revision: 1960

src/gameobjs.cpp
src/gameobjs.h
src/player.cpp
src/sector.cpp
src/sector.h

index b440b5c..1ace86c 100644 (file)
@@ -114,7 +114,7 @@ BouncyBrick::draw(DrawingContext& context)
     draw_tile(context, shape.id, position + Vector(0, offset), LAYER_TILES+1);
 }
 
     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);
   : position(pos), text(text_)
 {
   timer.start(1000);
index 88a8d7a..197273f 100644 (file)
@@ -94,7 +94,7 @@ private:
 class FloatingText : public GameObject
 {
 public:
 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);
   FloatingText(const Vector& pos, int s);  // use this for score, for instance
   
   virtual void action(float elapsed_time);
index 87cfc3b..75f622c 100644 (file)
@@ -22,6 +22,7 @@
 #include <cassert>
 
 #include "app/globals.h"
 #include <cassert>
 
 #include "app/globals.h"
+#include "app/gettext.h"
 #include "player.h"
 #include "defines.h"
 #include "scene.h"
 #include "player.h"
 #include "defines.h"
 #include "scene.h"
@@ -334,7 +335,15 @@ Player::action(float elapsed_time)
           physic.enable_gravity(false);
           /* Reset score multiplier (for multi-hits): */
           if (!invincible_timer.started())
           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;
             player_status.score_multiplier = 1;
+            }
         }
 
       if(jumped_in_solid)
         }
 
       if(jumped_in_solid)
index 017eff7..316b22f 100644 (file)
@@ -756,6 +756,12 @@ Sector::add_particles(const Vector& epicenter, const Vector& velocity, const Vec
   return true;
 }
 
   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)
 /* Break a brick: */
 bool
 Sector::trybreakbrick(const Vector& pos, bool small)
index 4485f05..7b6c6ca 100644 (file)
@@ -113,6 +113,7 @@ public:
   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);
   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);
                                                                                 
   /** Try to grab the coin at the given coordinates */
   void trygrabdistro(const Vector& pos, int bounciness);
@@ -190,7 +191,7 @@ private:
 
   int distro_counter;
   bool counting_distros;
 
   int distro_counter;
   bool counting_distros;
-  int currentmusic;        
+  int currentmusic;
 };
 
 #endif
 };
 
 #endif