New field: (passive-message "blabla") . This will show blabla in a passive way. ie...
authorRicardo Cruz <rick2@aeiou.pt>
Wed, 28 Jul 2004 16:04:25 +0000 (16:04 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Wed, 28 Jul 2004 16:04:25 +0000 (16:04 +0000)
As I said in my previous commit to 0_1_1_branch that �When you go from a message to another, you might notice that only a random of those will be displayed, not necessarly the last one. Will be fixed.�.

Also, if you use (map-message "blabla"), a message flag will be shown in that field.

SVN-Revision: 1654

src/worldmap.cpp
src/worldmap.h

index 68ad20b..67a2fad 100644 (file)
@@ -37,6 +37,8 @@
 #include "app/gettext.h"
 #include "misc.h"
 
+#define DISPLAY_MAP_MESSAGE_TIME 2600
+
 Menu* worldmap_menu  = 0;
 
 namespace WorldMapNS {
@@ -294,7 +296,12 @@ Tux::action(float delta)
         { // We reached the next tile, so we check what to do now
           offset -= 32;
 
-          if (worldmap->at(tile_pos)->stop || worldmap->at_special_tile())
+          WorldMap::SpecialTile* special_tile = worldmap->at_special_tile();
+          if(special_tile && special_tile->passive_message)
+            special_tile->display_map_message_timer.start(DISPLAY_MAP_MESSAGE_TIME);
+
+          if (worldmap->at(tile_pos)->stop || (special_tile && 
+              !special_tile->passive_message))
             {
               stop();
             }
@@ -388,9 +395,9 @@ WorldMap::WorldMap()
   start_x = 4;
   start_y = 5;
   
-  level_sprite = new Surface(datadir +  "/images/worldmap/levelmarker.png", true);
   leveldot_green = new Surface(datadir +  "/images/worldmap/leveldot_green.png", true);
   leveldot_red = new Surface(datadir +  "/images/worldmap/leveldot_red.png", true);
+  messagedot   = new Surface(datadir +  "/images/worldmap/messagedot.png", true);
 
   enter_level = false;
 
@@ -403,9 +410,9 @@ WorldMap::~WorldMap()
   delete tux;
   delete tile_manager;
 
-  delete level_sprite;
   delete leveldot_green;
   delete leveldot_red;
+  delete messagedot;
 }
 
 void
@@ -459,6 +466,11 @@ WorldMap::load_map()
                       special_tile.west  = true;
 
                       reader.read_string("extro-filename", special_tile.extro_filename);
+                      reader.read_string("passive-message", special_tile.display_map_message);
+                      special_tile.passive_message = false;
+                      if(!special_tile.display_map_message.empty())
+                        special_tile.passive_message = true;
+                      special_tile.display_map_message_timer.init(true);
                       reader.read_string("map-message", special_tile.display_map_message);
                       reader.read_string("next-world", special_tile.next_worldmap);
                       reader.read_string("level", special_tile.level_name, true);
@@ -901,6 +913,10 @@ WorldMap::draw(DrawingContext& context, const Vector& offset)
   
   for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
     {
+      if (!i->display_map_message.empty() && !i->passive_message)
+        context.draw_surface(messagedot,
+            Vector(i->x*32 + offset.x, i->y*32 + offset.y), LAYER_TILES+1);
+
       if(i->level_name.empty())
         continue;
 
@@ -968,7 +984,7 @@ WorldMap::draw_status(DrawingContext& context)
                     LAYER_FOREGROUND1);
                 }
 
-              /* Display a message in the map, if any as been selected */
+              /* Display an in-map message in the map, if any as been selected */
               if(!i->display_map_message.empty())
                 context.draw_text_center(gold_text, i->display_map_message, 
                     Vector(0, screen->h - white_text->get_height() - 60),
@@ -977,6 +993,18 @@ WorldMap::draw_status(DrawingContext& context)
             }
         }
     }
+  for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
+    {
+    /* Display a passive message in the map, if any as been selected */
+    if(i->display_map_message_timer.check())
+      {
+      if(!i->display_map_message.empty())
+        context.draw_text_center(gold_text, i->display_map_message, 
+                Vector(0, screen->h - white_text->get_height() - 60),
+                LAYER_FOREGROUND1);
+      break;
+      }
+    }
 }
 
 void
index 3e03400..5b4607a 100644 (file)
@@ -121,9 +121,9 @@ private:
 
   bool quit;
 
-  Surface* level_sprite;
   Surface* leveldot_green;
   Surface* leveldot_red;
+  Surface* messagedot;
 
   std::string name;
   std::string music;
@@ -160,6 +160,8 @@ public:
 
     /** Message to show in the Map */
     std::string display_map_message;
+    Timer display_map_message_timer;
+    bool passive_message;
 
     /** Go to this world */
     std::string next_worldmap;