Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23301/src
Modified Files:
Tag: supertux_0_1_1_branch
worldmap.cpp worldmap.h
Log Message:
Improved passive messages code. Fixed bug of showing a previous passive message when a new one should be being displayed now.
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.68.2.8
retrieving revision 1.68.2.9
diff -u -d -r1.68.2.8 -r1.68.2.9
--- worldmap.cpp 28 Jul 2004 16:01:09 -0000 1.68.2.8
+++ worldmap.cpp 28 Jul 2004 20:40:27 -0000 1.68.2.9
@@ -31,7 +31,7 @@
#include "worldmap.h"
#include "resources.h"
-#define DISPLAY_MAP_MESSAGE_TIME 2600
+#define DISPLAY_MAP_MESSAGE_TIME 2800
namespace WorldMapNS {
@@ -284,7 +284,10 @@
WorldMap::Level* level = worldmap->at_level();
if(level && level->name.empty() && !level->display_map_message.empty())
- level->display_map_message_timer.start(DISPLAY_MAP_MESSAGE_TIME);
+ {
+ worldmap->passive_message = level->display_map_message;
+ worldmap->passive_message_timer.start(DISPLAY_MAP_MESSAGE_TIME);
+ }
if (worldmap->at(tile_pos)->stop || (level && !level->name.empty()))
{
@@ -357,6 +360,8 @@
start_x = 4;
start_y = 5;
+ passive_message_timer.init(true);
+
level_sprite = new Surface(datadir + "/images/worldmap/levelmarker.png", USE_ALPHA);
leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", USE_ALPHA);
leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", USE_ALPHA);
@@ -368,7 +373,6 @@
name = "<no file>";
music = "SALCON.MOD";
-
}
WorldMap::~WorldMap()
@@ -441,7 +445,6 @@
reader.read_int("x", &level.x);
reader.read_int("y", &level.y);
reader.read_string("map-message", &level.display_map_message);
- level.display_map_message_timer.init(true);
level.auto_path = true;
reader.read_bool("auto-path", &level.auto_path);
@@ -875,16 +878,11 @@
}
}
}
- for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
- {
- /* Display a message in the map, if any as been selected */
- if(i->display_map_message_timer.check())
- {
- gold_text->draw_align(i->display_map_message.c_str(),
- screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM);
- break;
- }
- }
+
+ /* Display a passive message in the map, if needed */
+ if(passive_message_timer.check())
+ gold_text->draw_align(passive_message.c_str(),
+ screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM);
}
void
Index: worldmap.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v
retrieving revision 1.28.2.6
retrieving revision 1.28.2.7
diff -u -d -r1.28.2.6 -r1.28.2.7
--- worldmap.h 28 Jul 2004 16:01:17 -0000 1.28.2.6
+++ worldmap.h 28 Jul 2004 20:40:27 -0000 1.28.2.7
@@ -162,7 +162,6 @@
/** Message to show in the Map during a certain time */
std::string display_map_message;
- Timer display_map_message_timer;
/** If false, disables the auto walking after finishing a level */
bool auto_path;
@@ -174,6 +173,10 @@
bool west;
};
+ /** Variables to deal with the passive map messages */
+ Timer passive_message_timer;
+ std::string passive_message;
+
private:
typedef std::vector<Level> Levels;
Levels levels;
|