Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31152/src
Modified Files:
Tag: supertux_0_1_1_branch
worldmap.cpp worldmap.h
Log Message:
Added map-message and auto-walk fields for world maps.
(map-message "message") shows 'message' when player is in the specified position. It can or not have a level specified as well.
(auto-walk #f) makes the player not walk or walk (default to walk) after finishing level. Not sure if it is usefull, but could be used in levels in a hidden place.
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.68.2.4
retrieving revision 1.68.2.5
diff -u -d -r1.68.2.4 -r1.68.2.5
--- worldmap.cpp 18 Jul 2004 11:58:15 -0000 1.68.2.4
+++ worldmap.cpp 27 Jul 2004 16:36:59 -0000 1.68.2.5
@@ -434,8 +434,12 @@
reader.read_string("name", &level.name);
reader.read_int("x", &level.x);
reader.read_int("y", &level.y);
+ reader.read_string("map-message", &level.display_map_message);
+ level.auto_path = true;
+ reader.read_bool("auto-path", &level.auto_path);
- get_level_title(&level); // get level's title
+ if(!level.name.empty())
+ get_level_title(&level); // get level's title
levels.push_back(level);
}
@@ -666,7 +670,7 @@
else
player_status.bonus = PlayerStatus::NO_BONUS;
- if (old_level_state != level->solved)
+ if (old_level_state != level->solved && level->auto_path)
{ // Try to detect the next direction to which we should walk
// FIXME: Mostly a hack
Direction dir = D_NONE;
@@ -804,6 +808,9 @@
for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
{
+ if(i->name.empty())
+ continue;
+
if (i->solved)
leveldot_green->draw(i->x*32 + offset.x,
i->y*32 + offset.y);
@@ -848,7 +855,15 @@
if (i->x == tux->get_tile_pos().x &&
i->y == tux->get_tile_pos().y)
{
+ if(!i->name.empty())
+ {
white_text->draw_align(i->title.c_str(), screen->w/2, screen->h, A_HMIDDLE, A_BOTTOM);
+ }
+
+ /* Display a message in the map, if any as been selected */
+ if(!i->display_map_message.empty())
+ gold_text->draw_align(i->display_map_message.c_str(),
+ screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM);
break;
}
}
Index: worldmap.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v
retrieving revision 1.28.2.4
retrieving revision 1.28.2.5
diff -u -d -r1.28.2.4 -r1.28.2.5
--- worldmap.h 18 Jul 2004 19:12:28 -0000 1.28.2.4
+++ worldmap.h 27 Jul 2004 16:37:00 -0000 1.28.2.5
@@ -160,6 +160,12 @@
successfully completed */
std::string extro_filename;
+ /** Message to show in the Map */
+ std::string display_map_message;
+
+ /** If false, disables the auto walking after finishing a level */
+ bool auto_path;
+
// Directions which are walkable from this level
bool north;
bool east;
|