Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3849/src
Modified Files:
Tag: supertux_0_1_1_branch
worldmap.cpp worldmap.h
Log Message:
When a message is placed and there is no level, it is handled as a passive message and will be displayed for almost 3 seconds. 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.
If there is a level, it will be handled as before.
(last case not tested)
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.68.2.7
retrieving revision 1.68.2.8
diff -u -d -r1.68.2.7 -r1.68.2.8
--- worldmap.cpp 27 Jul 2004 22:45:36 -0000 1.68.2.7
+++ worldmap.cpp 28 Jul 2004 16:01:09 -0000 1.68.2.8
@@ -31,6 +31,8 @@
#include "worldmap.h"
#include "resources.h"
+#define DISPLAY_MAP_MESSAGE_TIME 2600
+
namespace WorldMapNS {
Direction reverse_dir(Direction direction)
@@ -249,7 +251,7 @@
{
if (input_direction != D_NONE)
{
- WorldMap::Level* level = worldmap->at_level();
+ WorldMapNS::WorldMap::Level* level = worldmap->at_level();
// We got a new direction, so lets start walking when possible
Point next_tile;
@@ -280,7 +282,11 @@
{ // We reached the next tile, so we check what to do now
offset -= 32;
- if (worldmap->at(tile_pos)->stop || worldmap->at_level())
+ 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);
+
+ if (worldmap->at(tile_pos)->stop || (level && !level->name.empty()))
{
stop();
}
@@ -435,6 +441,7 @@
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);
@@ -861,13 +868,23 @@
}
/* Display a message in the map, if any as been selected */
- if(!i->display_map_message.empty())
+ if((!i->display_map_message.empty() && !i->name.empty()))
gold_text->draw_align(i->display_map_message.c_str(),
screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM);
break;
}
}
}
+ 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;
+ }
+ }
}
void
Index: worldmap.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v
retrieving revision 1.28.2.5
retrieving revision 1.28.2.6
diff -u -d -r1.28.2.5 -r1.28.2.6
--- worldmap.h 27 Jul 2004 16:37:00 -0000 1.28.2.5
+++ worldmap.h 28 Jul 2004 16:01:17 -0000 1.28.2.6
@@ -160,8 +160,9 @@
successfully completed */
std::string extro_filename;
- /** Message to show in the Map */
+ /** 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;
|