super-tux-commit Mailing List for Super Tux (Page 44)
Brought to you by:
wkendrick
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(94) |
Apr
(500) |
May
(531) |
Jun
(196) |
Jul
(224) |
Aug
(193) |
Sep
(117) |
Oct
(115) |
Nov
(319) |
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
|
Mar
(105) |
Apr
(41) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(7) |
Oct
(12) |
Nov
(26) |
Dec
(39) |
2009 |
Jan
(6) |
Feb
(15) |
Mar
(10) |
Apr
(25) |
May
(29) |
Jun
(21) |
Jul
(26) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
From: Ricardo C. <rm...@us...> - 2004-07-28 20:40:36
|
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; |
From: Ricardo C. <rm...@us...> - 2004-07-28 16:08:25
|
Update of /cvsroot/super-tux/supertux/data/images/worldmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5674/data/images/worldmap Added Files: messagedot.png Removed Files: levelmarker.png Log Message: Added an ugly message flag. Any artists there? Also removed depricated levelmarker.png image. --- levelmarker.png DELETED --- --- NEW FILE: messagedot.png --- (This appears to be a binary file; contents omitted.) |
From: Ricardo C. <rm...@us...> - 2004-07-28 16:07:18
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5467/src Modified Files: worldmap.cpp Log Message: Bug fix: When using map-message field and there is a level there, don't draw message flag. For the record, I haven't testes the last two commits to head. I guess I've an excuse this time, since It's not pretty to test stuff when you have to work with data files on /usr/../supertux/ folder. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- worldmap.cpp 28 Jul 2004 16:04:25 -0000 1.110 +++ worldmap.cpp 28 Jul 2004 16:07:08 -0000 1.111 @@ -913,12 +913,14 @@ 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()) + { + 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); + continue; + } if (i->solved) context.draw_surface(leveldot_green, |
From: Ricardo C. <rm...@us...> - 2004-07-28 16:04:34
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4798/src Modified Files: worldmap.cpp worldmap.h Log Message: New field: (passive-message "blabla") . This will show blabla in a passive way. ie. when a player passed throught it, it will be shown for almost 3 seconds. 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. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- worldmap.cpp 28 Jul 2004 10:59:00 -0000 1.109 +++ worldmap.cpp 28 Jul 2004 16:04:25 -0000 1.110 @@ -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 @@ { // 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 @@ 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 @@ delete tux; delete tile_manager; - delete level_sprite; delete leveldot_green; delete leveldot_red; + delete messagedot; } void @@ -459,6 +466,11 @@ 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 @@ 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 @@ 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 @@ } } } + 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: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- worldmap.h 28 Jul 2004 10:47:49 -0000 1.42 +++ worldmap.h 28 Jul 2004 16:04:25 -0000 1.43 @@ -121,9 +121,9 @@ bool quit; - Surface* level_sprite; Surface* leveldot_green; Surface* leveldot_red; + Surface* messagedot; std::string name; std::string music; @@ -160,6 +160,8 @@ /** 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; |
From: Ricardo C. <rm...@us...> - 2004-07-28 16:01:30
|
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; |
From: Ricardo C. <rm...@us...> - 2004-07-28 14:57:37
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25734/lib/video Modified Files: drawing_context.cpp drawing_context.h font.cpp font.h Log Message: Added support for break lines in centered text. The code is pretty hacky, but seems to work fine, and such a feature was really needed to avoid hacks (for instance, the one found in display_text_file()). In the future, it would be a good idea to add break lines support for get_text_width() and get_text_height(). Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- font.cpp 26 Jul 2004 15:48:37 -0000 1.4 +++ font.cpp 28 Jul 2004 14:57:24 -0000 1.5 @@ -93,6 +93,35 @@ } void +Font::draw_center(const std::string& text, const Vector& pos, Uint32 drawing_effect) +{ + /* Cut lines changes into seperate strings, needed to support centering text + with break lines. + Feel free to replace this hack with a more elegant solution + */ + char temp[1024]; + unsigned int i, l, y; + i = y = 0; + while(true) + { + l = text.find("\n", i); + if(l == std::string::npos) + { + temp[text.copy(temp, text.size() - i, i)] = '\0'; + draw(temp, Vector(screen->w/2 - get_text_width(temp)/2 + pos.x, pos.y + y), + drawing_effect); + break; + } + temp[text.copy(temp, l - i, i)] = '\0'; + draw(temp, Vector(screen->w/2 - get_text_width(temp)/2 + pos.x, pos.y + y), + drawing_effect); + + i = l+1; + y += h + 2; + } +} + +void Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos, Uint32 drawing_effect) { Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- drawing_context.cpp 22 Jul 2004 19:07:51 -0000 1.3 +++ drawing_context.cpp 28 Jul 2004 14:57:24 -0000 1.4 @@ -90,6 +90,7 @@ TextRequest* textrequest = new TextRequest; textrequest->font = font; textrequest->text = text; + textrequest->center = false; request.request_data = textrequest; drawingrequests.push_back(request); @@ -103,13 +104,13 @@ request.type = TEXT; request.layer = layer; - request.pos = transform.apply(position) + Vector(screen->w/2 - - font->get_text_width(text)/2, 0); + request.pos = transform.apply(position); request.drawing_effect = drawing_effect; TextRequest* textrequest = new TextRequest; textrequest->font = font; textrequest->text = text; + textrequest->center = true; request.request_data = textrequest; drawingrequests.push_back(request); @@ -215,8 +216,11 @@ DrawingContext::draw_text(DrawingRequest& request) { TextRequest* textrequest = (TextRequest*) request.request_data; - - textrequest->font->draw(textrequest->text, request.pos, request.drawing_effect); + + if(textrequest->center) + textrequest->font->draw_center(textrequest->text, request.pos, request.drawing_effect); + else + textrequest->font->draw(textrequest->text, request.pos, request.drawing_effect); delete textrequest; } Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- drawing_context.h 25 Jul 2004 19:03:35 -0000 1.4 +++ drawing_context.h 28 Jul 2004 14:57:24 -0000 1.5 @@ -129,6 +129,7 @@ { Font* font; std::string text; + bool center; }; struct GradientRequest @@ -161,6 +162,7 @@ void draw_surface_part(DrawingRequest& request); void draw_text(DrawingRequest& request); + void draw_text_center(DrawingRequest& request); void draw_gradient(DrawingRequest& request); void draw_filled_rect(DrawingRequest& request); Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- font.h 26 Jul 2004 15:48:38 -0000 1.5 +++ font.h 28 Jul 2004 14:57:24 -0000 1.6 @@ -55,6 +55,8 @@ void draw(const std::string& text, const Vector& pos, Uint32 drawing_effect = NONE_EFFECT); + void draw_center(const std::string& text, const Vector& pos, + Uint32 drawing_effect = NONE_EFFECT); void draw_chars(Surface* pchars, const std::string& text, const Vector& position, Uint32 drawing_effect); |
From: Ricardo C. <rm...@us...> - 2004-07-28 10:59:10
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21048/src Modified Files: worldmap.cpp Log Message: Fixed the not saving bug. It's odd, there was this code in savegame(): if(filename != "") return; ?!?!?!? :O Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- worldmap.cpp 28 Jul 2004 10:47:49 -0000 1.108 +++ worldmap.cpp 28 Jul 2004 10:59:00 -0000 1.109 @@ -704,7 +704,7 @@ { PlayerStatus old_player_status = player_status; - std::cout << "Enter the current special_tile: " << special_tile->level_name << std::endl; + std::cout << "Enter the current level: " << special_tile->level_name << std::endl; // do a shriking fade to the special_tile shrink_fade(Vector((special_tile->x*32 + 16 + offset.x),(special_tile->y*32 + 16 + offset.y)), 500); @@ -1039,7 +1039,7 @@ void WorldMap::savegame(const std::string& filename) { - if(filename != "") + if(filename == "") return; std::cout << "savegame: " << filename << std::endl; |
From: Ricardo C. <rm...@us...> - 2004-07-28 10:48:58
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19620/src Modified Files: resources.cpp Log Message: Tux growing animation and door opening alpha was not being applied. Fixed. Why haven't anyone noticed it yet?! Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- resources.cpp 26 Jul 2004 15:48:38 -0000 1.45 +++ resources.cpp 28 Jul 2004 10:48:49 -0000 1.46 @@ -125,10 +125,10 @@ for (int i = 0; i < GROWING_FRAMES; i++) { sprintf(img_name, "%s/images/shared/tux-grow-left-%i.png", datadir.c_str(), i+1); - growingtux_left[i] = new Surface(img_name, false); + growingtux_left[i] = new Surface(img_name, true); sprintf(img_name, "%s/images/shared/tux-grow-right-%i.png", datadir.c_str(), i+1); - growingtux_right[i] = new Surface(img_name, false); + growingtux_right[i] = new Surface(img_name, true); } smalltux.stand_left = sprite_manager->load("smalltux-stand-left"); @@ -264,7 +264,7 @@ for (int i = 0; i < DOOR_OPENING_FRAMES; i++) { sprintf(img_name, "%s/images/shared/door-%i.png", datadir.c_str(), i+1); - door_opening[i] = new Surface(img_name, false); + door_opening[i] = new Surface(img_name, true); } /* Distros: */ |
From: Ricardo C. <rm...@us...> - 2004-07-28 10:48:02
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19414/src Modified Files: worldmap.cpp worldmap.h Log Message: Changes in worldmap: - Fixed bugs created by myself due to the Level SpecialTile replacement variable names. - Changed movement code a bit - could use a deeper look. Now possible to change direction during movement. Also movement stops when the Menu is called. Saving (and loading?) doesn't seem to work. Not sure who faults it is, but I prefer to blaim the new library path code. :) Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- worldmap.cpp 27 Jul 2004 22:46:13 -0000 1.107 +++ worldmap.cpp 28 Jul 2004 10:47:49 -0000 1.108 @@ -247,10 +247,17 @@ { offset = 0; direction = D_NONE; + input_direction = D_NONE; moving = false; } void +Tux::set_direction(Direction dir) +{ +input_direction = dir; +} + +void Tux::action(float delta) { if (!moving) @@ -271,7 +278,6 @@ } else if (input_direction == back_direction) { - std::cout << "Back triggered" << std::endl; moving = true; direction = input_direction; tile_pos = worldmap->get_next_tile(tile_pos, direction); @@ -294,43 +300,65 @@ } else { - if (worldmap->at(tile_pos)->auto_walk) + if (worldmap->at(tile_pos)->auto_walk || direction != input_direction) { // Turn to a new direction Tile* tile = worldmap->at(tile_pos); - Direction dir = D_NONE; - - if (tile->north && back_direction != D_NORTH) - dir = D_NORTH; - else if (tile->south && back_direction != D_SOUTH) - dir = D_SOUTH; - else if (tile->east && back_direction != D_EAST) - dir = D_EAST; - else if (tile->west && back_direction != D_WEST) - dir = D_WEST; - if (dir != D_NONE) - { - direction = dir; + if(direction != input_direction && + ((tile->north && input_direction == D_NORTH) || + (tile->south && input_direction == D_SOUTH) || + (tile->east && input_direction == D_EAST) || + (tile->west && input_direction == D_WEST))) + { // player has changed direction during auto-movement + direction = input_direction; + back_direction = reverse_dir(direction); + } + else if(direction != input_direction) + { // player has changed to impossible tile back_direction = reverse_dir(direction); + stop(); } else { + Direction dir = D_NONE; + + if (tile->north && back_direction != D_NORTH) + dir = D_NORTH; + else if (tile->south && back_direction != D_SOUTH) + dir = D_SOUTH; + else if (tile->east && back_direction != D_EAST) + dir = D_EAST; + else if (tile->west && back_direction != D_WEST) + dir = D_WEST; + + if (dir != D_NONE) + { + direction = dir; + input_direction = direction; + back_direction = reverse_dir(direction); + } + else + { // Should never be reached if tiledata is good stop(); return; + } } - } + } // Walk automatically to the next tile - Vector next_tile; - if (worldmap->path_ok(direction, tile_pos, &next_tile)) + if(direction != D_NONE) { + Vector next_tile; + if (worldmap->path_ok(direction, tile_pos, &next_tile)) + { tile_pos = next_tile; - } - else - { + } + else + { puts("Tilemap data is buggy"); stop(); + } } } } @@ -364,7 +392,6 @@ leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", true); leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", true); - input_direction = D_NONE; enter_level = false; name = "<no title>"; @@ -384,9 +411,9 @@ void WorldMap::load_map() { - lisp_object_t* root_obj = lisp_read_from_file(datadir + "/special_tiles/worldmap/" + map_filename); + lisp_object_t* root_obj = lisp_read_from_file(datadir + "/levels/worldmap/" + map_filename); if (!root_obj) - Termination::abort("Couldn't load file", datadir + "/special_tiles/worldmap/" + map_filename); + Termination::abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0) { @@ -411,7 +438,8 @@ reader.read_int("start_pos_x", start_x); reader.read_int("start_pos_y", start_y); } - else if (strcmp(lisp_symbol(lisp_car(element)), "special_tiles") == 0) + else if (strcmp(lisp_symbol(lisp_car(element)), "special-tiles") == 0 || + strcmp(lisp_symbol(lisp_car(element)), "levels") == 0) { lisp_object_t* cur = lisp_cdr(element); @@ -494,7 +522,7 @@ /** get special_tile's title */ special_tile.title = "<no title>"; - LispReader* reader = LispReader::load(datadir + "/special_tiles/" + special_tile.level_name, "supertux-special_tile"); + LispReader* reader = LispReader::load(datadir + "/levels/" + special_tile.level_name, "supertux-level"); if(!reader) { std::cerr << "Error: Could not open special_tile file. Ignoring...\n"; @@ -510,7 +538,10 @@ { // Show or hide the menu if(!Menu::current()) + { Menu::set_current(worldmap_menu); + tux->set_direction(D_NONE); // stop tux movement when menu is called + } else Menu::set_current(0); } @@ -519,7 +550,6 @@ WorldMap::get_input() { enter_level = false; - input_direction = D_NONE; SDL_Event event; while (SDL_PollEvent(&event)) @@ -546,6 +576,20 @@ case SDLK_RETURN: enter_level = true; break; + + case SDLK_LEFT: + tux->set_direction(D_WEST); + break; + case SDLK_RIGHT: + tux->set_direction(D_EAST); + break; + case SDLK_UP: + tux->set_direction(D_NORTH); + break; + case SDLK_DOWN: + tux->set_direction(D_SOUTH); + break; + default: break; } @@ -555,16 +599,16 @@ if (event.jaxis.axis == joystick_keymap.x_axis) { if (event.jaxis.value < -joystick_keymap.dead_zone) - input_direction = D_WEST; + tux->set_direction(D_WEST); else if (event.jaxis.value > joystick_keymap.dead_zone) - input_direction = D_EAST; + tux->set_direction(D_EAST); } else if (event.jaxis.axis == joystick_keymap.y_axis) { if (event.jaxis.value > joystick_keymap.dead_zone) - input_direction = D_SOUTH; + tux->set_direction(D_SOUTH); else if (event.jaxis.value < -joystick_keymap.dead_zone) - input_direction = D_NORTH; + tux->set_direction(D_NORTH); } break; @@ -580,20 +624,6 @@ } } } - - if (!Menu::current()) - { - Uint8 *keystate = SDL_GetKeyState(NULL); - - if (keystate[SDLK_LEFT]) - input_direction = D_WEST; - else if (keystate[SDLK_RIGHT]) - input_direction = D_EAST; - else if (keystate[SDLK_UP]) - input_direction = D_NORTH; - else if (keystate[SDLK_DOWN]) - input_direction = D_SOUTH; - } } Vector @@ -678,7 +708,7 @@ // do a shriking fade to the special_tile shrink_fade(Vector((special_tile->x*32 + 16 + offset.x),(special_tile->y*32 + 16 + offset.y)), 500); - GameSession session(datadir + "/special_tiles/" + special_tile->level_name, + GameSession session(datadir + "/levels/" + special_tile->level_name, ST_GL_LOAD_LEVEL_FILE, special_tile->vertical_flip); switch (session.run()) @@ -805,7 +835,7 @@ else { tux->action(delta); - tux->set_direction(input_direction); +// tux->set_direction(input_direction); } Menu* menu = Menu::current(); @@ -1032,13 +1062,13 @@ << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n" << " (back \"" << direction_to_string(tux->back_direction) << "\")\n" << " (bonus \"" << bonus_to_string(player_status.bonus) << "\"))\n" - << " (special_tiles\n"; + << " (levels\n"; for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { if (i->solved && !i->level_name.empty()) { - out << " (special_tile (name \"" << i->level_name << "\")\n" + out << " (level (name \"" << i->level_name << "\")\n" << " (solved #t))\n"; } } @@ -1109,14 +1139,14 @@ } lisp_object_t* level_cur = 0; - if (reader.read_lisp("special_tiles", level_cur)) + if (reader.read_lisp("levels", level_cur)) { while(level_cur) { lisp_object_t* sym = lisp_car(lisp_car(level_cur)); lisp_object_t* data = lisp_cdr(lisp_car(level_cur)); - if (strcmp(lisp_symbol(sym), "special_tile") == 0) + if (strcmp(lisp_symbol(sym), "level") == 0) { std::string name; bool solved = false; Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- worldmap.h 27 Jul 2004 22:31:30 -0000 1.41 +++ worldmap.h 28 Jul 2004 10:47:49 -0000 1.42 @@ -105,7 +105,7 @@ void draw(DrawingContext& context, const Vector& offset); void action(float elapsed_time); - void set_direction(Direction d) { input_direction = d; } + void set_direction(Direction dir); bool is_moving() const { return moving; } Vector get_pos(); @@ -185,7 +185,6 @@ MusicRef song; - Direction input_direction; bool enter_level; Vector offset; |
From: Marek M. <wa...@us...> - 2004-07-28 09:14:06
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6682/data/levels/default Modified Files: Tag: supertux_0_1_1_branch bonusisland.stwm Log Message: changed world map messages Index: bonusisland.stwm =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/Attic/bonusisland.stwm,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -d -r1.1.2.5 -r1.1.2.6 --- bonusisland.stwm 27 Jul 2004 23:15:27 -0000 1.1.2.5 +++ bonusisland.stwm 28 Jul 2004 09:13:57 -0000 1.1.2.6 @@ -104,19 +104,19 @@ (x 49) (y 37)) - (level (map-message "This way to Abednego's Island") + (level (map-message "This way to Abednego's Area") (x 34) (y 5)) (level (map-message "To the SuperTux Team Island") (x 36) (y 5)) - (level (map-message "Matr1x' Island this way") + (level (map-message "Matr1x' Sector this way") (x 34) (y 7)) - (level (map-message "About to enter Thompson's Island") + (level (map-message "About to enter Thompson's Domain") (x 35) (y 8)) - (level (map-message "Torfi's Island just ahead") + (level (map-message "Torfi's Territory just ahead") (x 36) (y 7)) ) |
From: Marek M. <wa...@us...> - 2004-07-27 23:15:50
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14484/data/levels/default Modified Files: Tag: supertux_0_1_1_branch bonusisland.stwm Log Message: moved section names/authors to the intersection at the beginning of the worldmap (apparently, someone else had the same idea at the same time... :)) Index: bonusisland.stwm =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/Attic/bonusisland.stwm,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- bonusisland.stwm 27 Jul 2004 22:52:33 -0000 1.1.2.4 +++ bonusisland.stwm 27 Jul 2004 23:15:27 -0000 1.1.2.5 @@ -51,11 +51,7 @@ )) (levels - (level (map-message "Entering Abednego's Island!") - (x 6) - (y 10)) (level (name "bonus1/abednego-level1.stl") -; (map-message "Entering Abednego's Island") (x 7) (y 18)) (level (name "bonus1/abednego-level2.stl") @@ -67,8 +63,7 @@ (level (name "bonus1/abednego-level4.stl") (x 12) (y 23)) - (level (name "bonus1/matr1x-level1.stl") - (map-message "Entering Matr1x' Island") + (level (name "bonus1/matr1x-level1.stl") (x 24) (y 17)) (level (name "bonus1/matr1x-level2.stl") @@ -77,15 +72,13 @@ (level (name "bonus1/matr1x-level3.stl") (x 25) (y 21)) - (level (name "bonus1/thompson-level1.stl") - (map-message "Entering Thompson's Island") + (level (name "bonus1/thompson-level1.stl") (x 38) (y 18)) (level (name "bonus1/thompson-level2.stl") (x 40) (y 22)) (level (name "bonus1/torfi-level1.stl") - (map-message "Entering Torfi's Island") (x 42) (y 12)) (level (name "bonus1/torfi-level2.stl") @@ -95,7 +88,6 @@ (x 46) (y 15)) (level (name "bonus1/wansti-level1.stl") - (map-message "Entering SuperTux Team Island") (x 59) (y 15)) (level (name "bonus1/wansti-level2.stl") @@ -111,6 +103,22 @@ (map-message "You found a secret place!") (x 49) (y 37)) + + (level (map-message "This way to Abednego's Island") + (x 34) + (y 5)) + (level (map-message "To the SuperTux Team Island") + (x 36) + (y 5)) + (level (map-message "Matr1x' Island this way") + (x 34) + (y 7)) + (level (map-message "About to enter Thompson's Island") + (x 35) + (y 8)) + (level (map-message "Torfi's Island just ahead") + (x 36) + (y 7)) ) ) |
From: Ricardo C. <rm...@us...> - 2004-07-27 22:52:42
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10336/data/levels/default Modified Files: Tag: supertux_0_1_1_branch bonusisland.stwm Log Message: Changed the position of the message. Marek, I find it confusing, as a player, to have two messages when going to the first level of each "island", so my suggestion is doing like this; put the messages in a fork or something before the level. Have a look at this example (just go to the abednego area) and check if you also prefer this approach. Index: bonusisland.stwm =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/Attic/bonusisland.stwm,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- bonusisland.stwm 27 Jul 2004 19:21:54 -0000 1.1.2.3 +++ bonusisland.stwm 27 Jul 2004 22:52:33 -0000 1.1.2.4 @@ -51,8 +51,11 @@ )) (levels + (level (map-message "Entering Abednego's Island!") + (x 6) + (y 10)) (level (name "bonus1/abednego-level1.stl") - (map-message "Entering Abednego's Island") +; (map-message "Entering Abednego's Island") (x 7) (y 18)) (level (name "bonus1/abednego-level2.stl") |
From: Ricardo C. <rm...@us...> - 2004-07-27 22:46:22
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9271/src Modified Files: worldmap.cpp Log Message: Fixed bug to let the player go through messages with no levels on it. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- worldmap.cpp 27 Jul 2004 22:31:29 -0000 1.106 +++ worldmap.cpp 27 Jul 2004 22:46:13 -0000 1.107 @@ -261,7 +261,7 @@ // We got a new direction, so lets start walking when possible Vector next_tile; - if ((!special_tile || special_tile->solved) + if ((!special_tile || special_tile->solved || special_tile->level_name.empty()) && worldmap->path_ok(input_direction, tile_pos, &next_tile)) { tile_pos = next_tile; |
From: Ricardo C. <rm...@us...> - 2004-07-27 22:45:45
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9097/src Modified Files: Tag: supertux_0_1_1_branch worldmap.cpp Log Message: Fixed bug to let the player go through messages with no levels on it. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.68.2.6 retrieving revision 1.68.2.7 diff -u -d -r1.68.2.6 -r1.68.2.7 --- worldmap.cpp 27 Jul 2004 22:36:00 -0000 1.68.2.6 +++ worldmap.cpp 27 Jul 2004 22:45:36 -0000 1.68.2.7 @@ -253,7 +253,7 @@ // We got a new direction, so lets start walking when possible Point next_tile; - if ((!level || level->solved) + if ((!level || level->solved || level->name.empty()) && worldmap->path_ok(input_direction, tile_pos, &next_tile)) { tile_pos = next_tile; |
From: Ricardo C. <rm...@us...> - 2004-07-27 22:36:10
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7524/src Modified Files: Tag: supertux_0_1_1_branch worldmap.cpp Log Message: Fixed bug of saving even special tiles that have not levels and when pressing enter on special tiles with no levels. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.68.2.5 retrieving revision 1.68.2.6 diff -u -d -r1.68.2.5 -r1.68.2.6 --- worldmap.cpp 27 Jul 2004 16:36:59 -0000 1.68.2.5 +++ worldmap.cpp 27 Jul 2004 22:36:00 -0000 1.68.2.6 @@ -647,7 +647,7 @@ if (enter_level && !tux->is_moving()) { Level* level = at_level(); - if (level) + if (level && !level->name.empty()) { if (level->x == tux->get_tile_pos().x && level->y == tux->get_tile_pos().y) @@ -951,7 +951,7 @@ for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) { - if (i->solved) + if (i->solved && !i->name.empty()) { out << " (level (name \"" << i->name << "\")\n" << " (solved #t))\n"; |
From: Ricardo C. <rm...@us...> - 2004-07-27 22:31:49
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6571/src Modified Files: worldmap.cpp worldmap.h Log Message: Renamed Level by SpecialTile. Fixed bug that was causing every special tiles to be saved, not just levels. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- worldmap.cpp 27 Jul 2004 19:31:39 -0000 1.105 +++ worldmap.cpp 27 Jul 2004 22:31:29 -0000 1.106 @@ -257,11 +257,11 @@ { if (input_direction != D_NONE) { - WorldMap::Level* level = worldmap->at_level(); + WorldMap::SpecialTile* special_tile = worldmap->at_special_tile(); // We got a new direction, so lets start walking when possible Vector next_tile; - if ((!level || level->solved) + if ((!special_tile || special_tile->solved) && worldmap->path_ok(input_direction, tile_pos, &next_tile)) { tile_pos = next_tile; @@ -288,7 +288,7 @@ { // We reached the next tile, so we check what to do now offset -= 32; - if (worldmap->at(tile_pos)->stop || worldmap->at_level()) + if (worldmap->at(tile_pos)->stop || worldmap->at_special_tile()) { stop(); } @@ -384,9 +384,9 @@ void WorldMap::load_map() { - lisp_object_t* root_obj = lisp_read_from_file(datadir + "/levels/worldmap/" + map_filename); + lisp_object_t* root_obj = lisp_read_from_file(datadir + "/special_tiles/worldmap/" + map_filename); if (!root_obj) - Termination::abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename); + Termination::abort("Couldn't load file", datadir + "/special_tiles/worldmap/" + map_filename); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0) { @@ -411,7 +411,7 @@ reader.read_int("start_pos_x", start_x); reader.read_int("start_pos_y", start_y); } - else if (strcmp(lisp_symbol(lisp_car(element)), "levels") == 0) + else if (strcmp(lisp_symbol(lisp_car(element)), "special_tiles") == 0) { lisp_object_t* cur = lisp_cdr(element); @@ -421,56 +421,56 @@ if (strcmp(lisp_symbol(lisp_car(element)), "special-tile") == 0) { - Level level; + SpecialTile special_tile; LispReader reader(lisp_cdr(element)); - level.solved = false; + special_tile.solved = false; - level.north = true; - level.east = true; - level.south = true; - level.west = true; + special_tile.north = true; + special_tile.east = true; + special_tile.south = true; + special_tile.west = true; - reader.read_string("extro-filename", level.extro_filename); - reader.read_string("map-message", level.display_map_message); - reader.read_string("next-world", level.next_worldmap); - reader.read_string("level", level.name, true); - reader.read_int("x", level.x); - reader.read_int("y", level.y); - level.auto_path = true; - reader.read_bool("auto-path", level.auto_path); - level.swap_x = level.swap_y = -1; - reader.read_int("swap-x", level.swap_x); - reader.read_int("swap-y", level.swap_y); - level.vertical_flip = false; - reader.read_bool("flip-level", level.vertical_flip); - level.quit_worldmap = false; - reader.read_bool("exit-game", level.quit_worldmap); + reader.read_string("extro-filename", special_tile.extro_filename); + 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); + reader.read_int("x", special_tile.x); + reader.read_int("y", special_tile.y); + special_tile.auto_path = true; + reader.read_bool("auto-path", special_tile.auto_path); + special_tile.swap_x = special_tile.swap_y = -1; + reader.read_int("swap-x", special_tile.swap_x); + reader.read_int("swap-y", special_tile.swap_y); + special_tile.vertical_flip = false; + reader.read_bool("flip-special_tile", special_tile.vertical_flip); + special_tile.quit_worldmap = false; + reader.read_bool("exit-game", special_tile.quit_worldmap); - levels.push_back(level); + special_tiles.push_back(special_tile); } /* Kept for backward compability */ else if (strcmp(lisp_symbol(lisp_car(element)), "level") == 0) { - Level level; + SpecialTile special_tile; LispReader reader(lisp_cdr(element)); - level.solved = false; + special_tile.solved = false; - level.north = true; - level.east = true; - level.south = true; - level.west = true; + special_tile.north = true; + special_tile.east = true; + special_tile.south = true; + special_tile.west = true; - reader.read_string("extro-filename", level.extro_filename); - if(!level.extro_filename.empty()) - level.quit_worldmap = true; - reader.read_string("name", level.name, true); - reader.read_int("x", level.x); - reader.read_int("y", level.y); - level.vertical_flip = false; - level.swap_x = level.swap_y = -1; + reader.read_string("extro-filename", special_tile.extro_filename); + if(!special_tile.extro_filename.empty()) + special_tile.quit_worldmap = true; + reader.read_string("name", special_tile.level_name, true); + reader.read_int("x", special_tile.x); + reader.read_int("y", special_tile.y); + special_tile.vertical_flip = false; + special_tile.swap_x = special_tile.swap_y = -1; - levels.push_back(level); + special_tiles.push_back(special_tile); } cur = lisp_cdr(cur); @@ -489,19 +489,19 @@ tux = new Tux(this); } -void WorldMap::get_level_title(Level& level) +void WorldMap::get_level_title(SpecialTile& special_tile) { - /** get level's title */ - level.title = "<no title>"; + /** get special_tile's title */ + special_tile.title = "<no title>"; - LispReader* reader = LispReader::load(datadir + "/levels/" + level.name, "supertux-level"); + LispReader* reader = LispReader::load(datadir + "/special_tiles/" + special_tile.level_name, "supertux-special_tile"); if(!reader) { - std::cerr << "Error: Could not open level file. Ignoring...\n"; + std::cerr << "Error: Could not open special_tile file. Ignoring...\n"; return; } - reader->read_string("name", level.title, true); + reader->read_string("name", special_tile.title, true); delete reader; } @@ -658,8 +658,8 @@ if (enter_level && !tux->is_moving()) { bool level_finished = true; - Level* level = at_level(); - if (!level) + SpecialTile* special_tile = at_special_tile(); + if (!special_tile) { std::cout << "Nothing to enter at: " << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl; @@ -667,27 +667,27 @@ } - if(!level->name.empty()) + if(!special_tile->level_name.empty()) { - if (level->x == tux->get_tile_pos().x && - level->y == tux->get_tile_pos().y) + if (special_tile->x == tux->get_tile_pos().x && + special_tile->y == tux->get_tile_pos().y) { PlayerStatus old_player_status = player_status; - std::cout << "Enter the current level: " << level->name << std::endl; - // do a shriking fade to the level - shrink_fade(Vector((level->x*32 + 16 + offset.x),(level->y*32 + 16 + std::cout << "Enter the current special_tile: " << special_tile->level_name << std::endl; + // do a shriking fade to the special_tile + shrink_fade(Vector((special_tile->x*32 + 16 + offset.x),(special_tile->y*32 + 16 + offset.y)), 500); - GameSession session(datadir + "/levels/" + level->name, - ST_GL_LOAD_LEVEL_FILE, level->vertical_flip); + GameSession session(datadir + "/special_tiles/" + special_tile->level_name, + ST_GL_LOAD_LEVEL_FILE, special_tile->vertical_flip); switch (session.run()) { case GameSession::ES_LEVEL_FINISHED: { level_finished = true; - bool old_level_state = level->solved; - level->solved = true; + bool old_level_state = special_tile->solved; + special_tile->solved = true; if (session.get_current_sector()->player->got_power != session.get_current_sector()->player->NONE_POWER) @@ -697,7 +697,7 @@ else player_status.bonus = PlayerStatus::NO_BONUS; - if (old_level_state != level->solved && level->auto_path) + if (old_level_state != special_tile->solved && special_tile->auto_path) { // Try to detect the next direction to which we should walk // FIXME: Mostly a hack Direction dir = D_NONE; @@ -726,7 +726,7 @@ break; case GameSession::ES_LEVEL_ABORT: level_finished = false; - /* In case the player's abort the level, keep it using the old + /* In case the player's abort the special_tile, keep it using the old status. But the minimum lives and no bonus. */ player_status.score = old_player_status.score; player_status.distros = old_player_status.distros; @@ -740,7 +740,7 @@ /* draw an end screen */ /* in the future, this should make a dialog a la SuperMario, asking if the player wants to restart the world map with no score and from - level 1 */ + special_tile 1 */ char str[80]; DrawingContext context; @@ -780,25 +780,25 @@ } } /* The porpose of the next checking is that if the player lost - the level (in case there is one), don't show anything */ + the special_tile (in case there is one), don't show anything */ if(level_finished) { - if (!level->extro_filename.empty()) + if (!special_tile->extro_filename.empty()) { // Display a text file - display_text_file(level->extro_filename, SCROLL_SPEED_MESSAGE, white_big_text , white_text, white_small_text, blue_text ); + display_text_file(special_tile->extro_filename, SCROLL_SPEED_MESSAGE, white_big_text , white_text, white_small_text, blue_text ); } - if (level->swap_x != -1 && level->swap_y != -1) + if (special_tile->swap_x != -1 && special_tile->swap_y != -1) { // TODO: add an effect, like a camera scrolling, or at least, a fading - tux->set_tile_pos(Vector(level->swap_x, level->swap_y)); + tux->set_tile_pos(Vector(special_tile->swap_x, special_tile->swap_y)); } - if (!level->next_worldmap.empty()) + if (!special_tile->next_worldmap.empty()) { // Load given worldmap - loadmap(level->next_worldmap); + loadmap(special_tile->next_worldmap); } - if (level->quit_worldmap) + if (special_tile->quit_worldmap) quit = true; } } @@ -844,10 +844,10 @@ return tile_manager->get(tilemap[width * y + x]); } -WorldMap::Level* -WorldMap::at_level() +WorldMap::SpecialTile* +WorldMap::at_special_tile() { - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { if (i->x == tux->get_tile_pos().x && i->y == tux->get_tile_pos().y) @@ -869,9 +869,9 @@ Vector(x*32 + offset.x, y*32 + offset.y), LAYER_TILES); } - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { - if(i->name.empty()) + if(i->level_name.empty()) continue; if (i->solved) @@ -923,12 +923,12 @@ if (!tux->is_moving()) { - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { if (i->x == tux->get_tile_pos().x && i->y == tux->get_tile_pos().y) { - if(!i->name.empty()) + if(!i->level_name.empty()) { if(i->title == "") get_level_title(*i); @@ -1016,7 +1016,7 @@ std::ofstream out(filename.c_str()); int nb_solved_levels = 0; - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { if (i->solved) ++nb_solved_levels; @@ -1024,7 +1024,7 @@ out << "(supertux-savegame\n" << " (version 1)\n" - << " (title \"" << name << " - " << nb_solved_levels << "/" << levels.size() << "\")\n" + << " (title \"" << name << " - " << nb_solved_levels << "/" << special_tiles.size() << "\")\n" << " (map \"" << map_filename << "\")\n" << " (lives " << player_status.lives << ")\n" << " (score " << player_status.score << ")\n" @@ -1032,13 +1032,13 @@ << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n" << " (back \"" << direction_to_string(tux->back_direction) << "\")\n" << " (bonus \"" << bonus_to_string(player_status.bonus) << "\"))\n" - << " (levels\n"; + << " (special_tiles\n"; - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { - if (i->solved) + if (i->solved && !i->level_name.empty()) { - out << " (level (name \"" << i->name << "\")\n" + out << " (special_tile (name \"" << i->level_name << "\")\n" << " (solved #t))\n"; } } @@ -1079,7 +1079,7 @@ cur = lisp_cdr(cur); LispReader reader(cur); - /* Get the Map filename and then load it before setting level settings */ + /* Get the Map filename and then load it before setting special_tile settings */ reader.read_string("map", map_filename); load_map(); @@ -1109,14 +1109,14 @@ } lisp_object_t* level_cur = 0; - if (reader.read_lisp("levels", level_cur)) + if (reader.read_lisp("special_tiles", level_cur)) { while(level_cur) { lisp_object_t* sym = lisp_car(lisp_car(level_cur)); lisp_object_t* data = lisp_cdr(lisp_car(level_cur)); - if (strcmp(lisp_symbol(sym), "level") == 0) + if (strcmp(lisp_symbol(sym), "special_tile") == 0) { std::string name; bool solved = false; @@ -1125,9 +1125,9 @@ level_reader.read_string("name", name, true); level_reader.read_bool("solved", solved); - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i) { - if (name == i->name) + if (name == i->level_name) i->solved = solved; } } Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- worldmap.h 27 Jul 2004 16:44:36 -0000 1.40 +++ worldmap.h 27 Jul 2004 22:31:30 -0000 1.41 @@ -138,11 +138,11 @@ TileManager* tile_manager; public: - struct Level + struct SpecialTile { int x; int y; - std::string name; + std::string level_name; std::string title; bool solved; @@ -180,8 +180,8 @@ private: std::string map_filename; - typedef std::vector<Level> Levels; - Levels levels; + typedef std::vector<SpecialTile> SpecialTiles; + SpecialTiles special_tiles; MusicRef song; @@ -191,7 +191,7 @@ Vector offset; std::string savegame_file; - void get_level_title(Level& level); + void get_level_title(SpecialTile& special_tile); void draw_status(DrawingContext& context); public: @@ -213,7 +213,7 @@ Vector get_next_tile(Vector pos, Direction direction); Tile* at(Vector pos); - WorldMap::Level* at_level(); + WorldMap::SpecialTile* at_special_tile(); /** Check if it is possible to walk from \a pos into \a direction, if possible, write the new position to \a new_pos */ |
From: Tobias G. <to...@us...> - 2004-07-27 20:07:45
|
Update of /cvsroot/super-tux/supertux/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9517/lib Modified Files: Makefile.am Log Message: removed special/stringlist.cpp/h Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 26 Jul 2004 18:09:12 -0000 1.4 +++ Makefile.am 27 Jul 2004 20:07:35 -0000 1.5 @@ -14,7 +14,6 @@ special/moving_object.cpp \ special/sprite.cpp \ special/sprite_manager.cpp \ - special/stringlist.cpp \ special/timer.cpp \ utils/configfile.cpp \ utils/lispreader.cpp \ @@ -46,7 +45,6 @@ special/moving_object.h \ special/sprite.h \ special/sprite_manager.h \ - special/stringlist.h \ special/timer.h libsupertuxutils_HEADERS =utils/configfile.h \ utils/exceptions.h \ |
From: Tobias G. <to...@us...> - 2004-07-27 19:31:51
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/src Modified Files: gameloop.cpp level_subset.cpp leveleditor.cpp leveleditor.h title.cpp worldmap.cpp Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) Index: level_subset.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- level_subset.cpp 27 Jul 2004 16:34:52 -0000 1.7 +++ level_subset.cpp 27 Jul 2004 19:31:39 -0000 1.8 @@ -19,8 +19,6 @@ // 02111-1307, USA. #include <assert.h> -#include <unistd.h> - #include "app/setup.h" #include "level.h" #include "app/globals.h" @@ -103,7 +101,7 @@ if (levels.empty()) { // Level info file doesn't define any levels, so read the // directory to see what we can find - std::vector<std::string> files; + std::set<std::string> files; snprintf(filename, 1024, "%s/levels/%s/", st_dir, subset); if(access(filename, R_OK) == 0) @@ -116,7 +114,7 @@ files = FileSystem::read_directory(filename); } - for(std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) + for(std::set<std::string>::iterator i = files.begin(); i != files.end(); ++i) { if (has_suffix(*i, ".stl")) levels.push_back(*i); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.144 retrieving revision 1.145 diff -u -d -r1.144 -r1.145 --- leveleditor.cpp 26 Jul 2004 18:09:13 -0000 1.144 +++ leveleditor.cpp 27 Jul 2004 19:31:39 -0000 1.145 @@ -330,7 +330,7 @@ default: if(i >= 1) { - if(load_level_subset(level_subsets.item[i-1])) + if(load_level_subset(subset_load_menu->item[i+1].text)) return 1; } break; @@ -395,7 +395,7 @@ return done; } -int LevelEditor::load_level_subset(char *filename) +int LevelEditor::load_level_subset(const char *filename) { le_level_subset->load(filename); leveleditor_menu->get_item_by_id(MNID_SUBSETSETTINGS).kind = MN_GOTO; @@ -411,7 +411,7 @@ void LevelEditor::init_menus() { - int i; + int i = 0; leveleditor_menu = new Menu(); subset_load_menu = new Menu(); @@ -435,9 +435,9 @@ subset_load_menu->additem(MN_LABEL, "Load Level Subset", 0, 0); subset_load_menu->additem(MN_HL, "", 0, 0); - for(i = 0; i < level_subsets.num_items; ++i) + for(std::set<std::string>::iterator it = level_subsets.begin(); it != level_subsets.end(); ++it) { - subset_load_menu->additem(MN_ACTION,level_subsets.item[i],0,0, i+1); + subset_load_menu->additem(MN_ACTION,(*it),0,0, i+1); } subset_load_menu->additem(MN_HL,"",0,0); subset_load_menu->additem(MN_BACK,"Back",0,0); @@ -539,22 +539,22 @@ void LevelEditor::update_level_settings_menu() { char str[80]; - int i; + std::set<std::string>::iterator it; level_settings_menu->get_item_by_id(MNID_NAME).change_input(le_level->name.c_str()); level_settings_menu->get_item_by_id(MNID_AUTHOR).change_input(le_level->author.c_str()); - string_list_copy(level_settings_menu->get_item_by_id(MNID_SONG).list, FileSystem::dfiles("music/",NULL, "-fast")); - string_list_copy(level_settings_menu->get_item_by_id(MNID_BGIMG).list, FileSystem::dfiles("images/background",NULL, NULL)); - string_list_add_item(level_settings_menu->get_item_by_id(MNID_BGIMG).list,""); - string_list_add_item(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,""); - string_list_add_item(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,"snow"); - string_list_add_item(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,"clouds"); + level_settings_menu->get_item_by_id(MNID_SONG).list.first = FileSystem::dfiles("music/",NULL, "-fast"); + level_settings_menu->get_item_by_id(MNID_BGIMG).list.first = FileSystem::dfiles("images/background",NULL, NULL); + level_settings_menu->get_item_by_id(MNID_BGIMG).list.first.insert(""); + level_settings_menu->get_item_by_id(MNID_PARTICLE).list.first.insert(""); + level_settings_menu->get_item_by_id(MNID_PARTICLE).list.first.insert("snow"); + level_settings_menu->get_item_by_id(MNID_PARTICLE).list.first.insert("clouds"); - if((i = string_list_find(level_settings_menu->get_item_by_id(MNID_SONG).list,le_level->get_sector("main")->song_title.c_str())) != -1) - level_settings_menu->get_item_by_id(MNID_SONG).list->active_item = i; - if((i = string_list_find(level_settings_menu->get_item_by_id(MNID_BGIMG).list,le_level->get_sector("main")->background->get_image().c_str())) != -1) - level_settings_menu->get_item_by_id(MNID_BGIMG).list->active_item = i; + if((it = level_settings_menu->get_item_by_id(MNID_SONG).list.first.find(le_level->get_sector("main")->song_title)) != level_settings_menu->get_item_by_id(MNID_SONG).list.first.end()) + level_settings_menu->get_item_by_id(MNID_SONG).list.second = it; + if((it = level_settings_menu->get_item_by_id(MNID_BGIMG).list.first.find(le_level->get_sector("main")->background->get_image())) != level_settings_menu->get_item_by_id(MNID_BGIMG).list.first.end()) + level_settings_menu->get_item_by_id(MNID_BGIMG).list.second = it; /* if((i = string_list_find(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,le_level->get_sector("main")->particlesystem.c_str())) != -1) level_settings_menu->get_item_by_id(MNID_PARTICLE).list->active_item = i;*/ @@ -597,9 +597,9 @@ le_level->name = level_settings_menu->get_item_by_id(MNID_NAME).input; le_level->author = level_settings_menu->get_item_by_id(MNID_AUTHOR).input; - if(le_level->get_sector("main")->background->get_image().compare(string_list_active(level_settings_menu->get_item_by_id(MNID_BGIMG).list)) != 0) + if(le_level->get_sector("main")->background->get_image().compare((*level_settings_menu->get_item_by_id(MNID_BGIMG).list.second)) != 0) { - le_level->get_sector("main")->background->set_image(string_list_active(level_settings_menu->get_item_by_id(MNID_BGIMG).list), atoi(level_settings_menu->get_item_by_id(MNID_BGSPEED).input)); + le_level->get_sector("main")->background->set_image((*level_settings_menu->get_item_by_id(MNID_BGIMG).list.second), atoi(level_settings_menu->get_item_by_id(MNID_BGSPEED).input)); i = true; } @@ -613,7 +613,7 @@ le_level->load_gfx(); }*/ - le_level->get_sector("main")->song_title = string_list_active(level_settings_menu->get_item_by_id(MNID_SONG).list); + le_level->get_sector("main")->song_title = (*level_settings_menu->get_item_by_id(MNID_SONG).list.second); le_level->get_sector("main")->solids->resize( atoi(level_settings_menu->get_item_by_id(MNID_LENGTH).input), @@ -950,10 +950,10 @@ object_properties_menu->additem(MN_STRINGSELECT,"Kind",0,0,1); for(int i = 0; i < NUM_BadGuyKinds; ++i) { - string_list_add_item(object_properties_menu->get_item_by_id(1).list, - badguykind_to_string(static_cast<BadGuyKind>(i)).c_str()); + object_properties_menu->get_item_by_id(1).list.first.insert( + badguykind_to_string(static_cast<BadGuyKind>(i))); if(pbad->kind == i) - object_properties_menu->get_item_by_id(1).list->active_item = i; + object_properties_menu->get_item_by_id(1).list.second = object_properties_menu->get_item_by_id(1).list.first.find(badguykind_to_string(static_cast<BadGuyKind>(i))); } object_properties_menu->additem(MN_TOGGLE,"StayOnPlatform",pbad->stay_on_platform,0,2); } @@ -984,7 +984,7 @@ BadGuy* pbad = dynamic_cast<BadGuy*>(pobj); if(pbad != 0) { BadGuy* pbad = dynamic_cast<BadGuy*>(pobj); - pbad->kind = badguykind_from_string(string_list_active(object_properties_menu->get_item_by_id(1).list)); + pbad->kind = badguykind_from_string((*object_properties_menu->get_item_by_id(1).list.second)); pbad->stay_on_platform = object_properties_menu->get_item_by_id(2).toggled; } loop = false; Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- title.cpp 27 Jul 2004 13:25:05 -0000 1.113 +++ title.cpp 27 Jul 2004 19:31:39 -0000 1.114 @@ -74,7 +74,7 @@ static std::vector<LevelSubset*> contrib_subsets; static LevelSubset* current_contrib_subset = 0; -static string_list_type worldmap_list; +static std::set<std::string> worldmap_list; static LevelEditor* leveleditor; @@ -102,34 +102,39 @@ void generate_contrib_menu() { + /** Generating contrib levels list by making use of Level Subset */ - string_list_type level_subsets = FileSystem::dsubdirs("/levels", "info"); + std::set<std::string> level_subsets = FileSystem::dsubdirs("/levels", "info"); free_contrib_menu(); contrib_menu->additem(MN_LABEL,_("Contrib Levels"),0,0); contrib_menu->additem(MN_HL,"",0,0); - - for (int i = 0; i < level_subsets.num_items; ++i) + + int i = 0; + for (std::set<std::string>::iterator it = level_subsets.begin(); it != level_subsets.end(); ++it) { LevelSubset* subset = new LevelSubset(); - subset->load(level_subsets.item[i]); + subset->load((*it).c_str()); contrib_menu->additem(MN_GOTO, subset->title.c_str(), i, - contrib_subset_menu, i); + contrib_subset_menu); contrib_subsets.push_back(subset); + ++i; } - for(int i = 0; i < worldmap_list.num_items; i++) + i = 0; + for(std::set<std::string>::iterator it = worldmap_list.begin(); it != worldmap_list.end(); ++it) { WorldMapNS::WorldMap worldmap; - worldmap.loadmap(worldmap_list.item[i]); - contrib_menu->additem(MN_ACTION, worldmap.get_world_title(),0,0, i + level_subsets.num_items); + worldmap.loadmap((*it).c_str()); + contrib_menu->additem(MN_ACTION, worldmap.get_world_title(),0,0, i + level_subsets.size()); + ++i; } contrib_menu->additem(MN_HL,"",0,0); contrib_menu->additem(MN_BACK,_("Back"),0,0); - string_list_free(&level_subsets); + level_subsets.clear(); } void check_levels_contrib_menu() @@ -180,10 +185,13 @@ titlesession->set_current(); } } - else if(index < worldmap_list.num_items + (int)contrib_subsets.size()) + else if((unsigned)index < worldmap_list.size() + (int)contrib_subsets.size()) { WorldMapNS::WorldMap worldmap; - worldmap.loadmap(worldmap_list.item[index - contrib_subsets.size()]); + std::set<std::string>::iterator it = worldmap_list.begin(); + for(int i = index - contrib_subsets.size(); i > 0; --i) + ++it; + worldmap.loadmap((*it)); worldmap.display(); Menu::set_current(main_menu); @@ -309,10 +317,11 @@ if (event.type == SDL_QUIT) Menu::set_current(0); } - + /* Draw the background: */ draw_demo(frame_ratio); - + + if (Menu::current() == main_menu) context.draw_surface(logo, Vector(screen->w/2 - logo->w/2, 30), LAYER_FOREGROUND1+1); @@ -330,7 +339,7 @@ { menu->draw(context); menu->action(); - + if(menu == main_menu) { switch (main_menu->check()) @@ -417,12 +426,13 @@ /* Free surfaces: */ free_contrib_menu(); - string_list_free(&worldmap_list); + worldmap_list.clear(); delete titlesession; delete bkg_title; delete logo; delete img_choose_subset; } + // EOF // Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- worldmap.cpp 27 Jul 2004 16:54:45 -0000 1.104 +++ worldmap.cpp 27 Jul 2004 19:31:39 -0000 1.105 @@ -437,7 +437,7 @@ reader.read_int("x", level.x); reader.read_int("y", level.y); level.auto_path = true; - reader.read_bool("auto-path", &level.auto_path); + reader.read_bool("auto-path", level.auto_path); level.swap_x = level.swap_y = -1; reader.read_int("swap-x", level.swap_x); reader.read_int("swap-y", level.swap_y); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.161 retrieving revision 1.162 diff -u -d -r1.161 -r1.162 --- gameloop.cpp 27 Jul 2004 17:53:51 -0000 1.161 +++ gameloop.cpp 27 Jul 2004 19:31:39 -0000 1.162 @@ -77,6 +77,9 @@ context = new DrawingContext(); + if(debug_mode) + flip_level = true; + restart_level(); } Index: leveleditor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- leveleditor.h 21 Jul 2004 11:56:48 -0000 1.17 +++ leveleditor.h 27 Jul 2004 19:31:39 -0000 1.18 @@ -94,7 +94,7 @@ /* own declerations */ /* crutial ones (main loop) */ void init_menus(); -int load_level_subset(char *filename); +int load_level_subset(const char *filename); void drawlevel(DrawingContext& context); void drawinterface(DrawingContext& context); void change(float x, float y, int tm, unsigned int c); @@ -142,7 +142,7 @@ // variables /* leveleditor internals */ -string_list_type level_subsets; +std::set<std::string> level_subsets; bool le_level_changed; /* if changes, ask for saving, when quiting*/ bool show_minimap; bool show_selections; |
From: Tobias G. <to...@us...> - 2004-07-27 19:31:49
|
Update of /cvsroot/super-tux/supertux/lib/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/lib/gui Modified Files: menu.cpp menu.h Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- menu.cpp 26 Jul 2004 18:09:13 -0000 1.6 +++ menu.cpp 27 Jul 2004 19:31:37 -0000 1.7 @@ -171,16 +171,10 @@ pnew_item->input = (char*) malloc(sizeof(char)); pnew_item->input[0] = '\0'; - if(kind_ == MN_STRINGSELECT) - { - pnew_item->list = (string_list_type*) malloc(sizeof(string_list_type)); - string_list_init(pnew_item->list); - } - else - pnew_item->list = NULL; - pnew_item->id = id; pnew_item->int_p = int_p_; + + pnew_item->list.second = 0; pnew_item->input_flickering = false; pnew_item->input_flickering_timer.init(true); @@ -306,7 +300,7 @@ { free(item[i].text); free(item[i].input); - string_list_free(item[i].list); + item[i].list.first.clear(); } } } @@ -379,23 +373,23 @@ case MENU_ACTION_LEFT: if(item[active_item].kind == MN_STRINGSELECT - && item[active_item].list->num_items != 0) + && item[active_item].list.first.size() != 0) { - if(item[active_item].list->active_item > 0) - --item[active_item].list->active_item; + if(item[active_item].list.second != item[active_item].list.first.begin()) + --item[active_item].list.second; else - item[active_item].list->active_item = item[active_item].list->num_items-1; + item[active_item].list.second = item[active_item].list.first.end(); } break; case MENU_ACTION_RIGHT: if(item[active_item].kind == MN_STRINGSELECT - && item[active_item].list->num_items != 0) + && item[active_item].list.first.size() != 0) { - if(item[active_item].list->active_item < item[active_item].list->num_items-1) - ++item[active_item].list->active_item; + if(item[active_item].list.second != item[active_item].list.first.end()) + ++item[active_item].list.second; else - item[active_item].list->active_item = 0; + item[active_item].list.second = item[active_item].list.first.begin(); } break; @@ -526,9 +520,10 @@ int shadow_size = 2; int text_width = int(text_font->get_text_width(pitem.text)); int input_width = int(text_font->get_text_width(pitem.input) + 10); - int list_width = - int(text_font->get_text_width(string_list_active(pitem.list))); - + int list_width = 0; + if(pitem.list.second != 0) + list_width = int(text_font->get_text_width((*pitem.list.second))); + if (arrange_left) x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; @@ -637,7 +632,7 @@ Vector(list_pos_2, 18), Color(0,0,0,128), LAYER_GUI - 5); - context.draw_text_center(text_font, string_list_active(pitem.list), + context.draw_text_center(text_font, (*pitem.list.second), Vector(text_pos, y_pos - int(text_font->get_height()/2)), LAYER_GUI); context.draw_text_center(text_font, pitem.text, @@ -693,7 +688,7 @@ int menu_width = 0; for(unsigned int i = 0; i < item.size(); ++i) { - int w = strlen(item[i].text) + (item[i].input ? strlen(item[i].input) + 1 : 0) + strlen(string_list_active(item[i].list)); + int w = strlen(item[i].text) + (item[i].input ? strlen(item[i].input) + 1 : 0); //+ ((item[i].list.second != item[i].list.first.end()) ? (strlen((*(item[i].list.second)).c_str())) : 0); if( w > menu_width ) { menu_width = w; @@ -714,8 +709,9 @@ void Menu::draw(DrawingContext& context) { + int menu_height = get_height(); - int menu_width = get_width(); + int menu_width = get_width(); /* Draw a transparent background */ context.draw_filled_rect( Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- menu.h 26 Jul 2004 15:48:37 -0000 1.4 +++ menu.h 27 Jul 2004 19:31:38 -0000 1.5 @@ -21,6 +21,9 @@ #define SUPERTUX_MENU_H #include <vector> +#include <set> +#include <string> +#include <utility> #include "SDL.h" @@ -28,7 +31,6 @@ #include "../video/font.h" #include "../special/timer.h" #include "../special/base.h" -#include "../special/stringlist.h" #include "../gui/mousecursor.h" namespace SuperTux @@ -68,7 +70,7 @@ char *input; int *int_p; // used for setting keys (can be used for more stuff...) int id; // item id - string_list_type* list; + std::pair<std::set<std::string>, std::set<std::string>::iterator> list; Menu* target_menu; void change_text (const char *text); |
From: Tobias G. <to...@us...> - 2004-07-27 19:31:48
|
Update of /cvsroot/super-tux/supertux/lib/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/lib/utils Modified Files: configfile.cpp Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) Index: configfile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/configfile.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- configfile.cpp 27 Jul 2004 09:56:14 -0000 1.5 +++ configfile.cpp 27 Jul 2004 19:31:38 -0000 1.6 @@ -103,7 +103,7 @@ if (root_obj->type == LISP_TYPE_EOF || root_obj->type == LISP_TYPE_PARSE_ERROR) return; - if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-config") != 0) + if (strcmp(lisp_symbol(lisp_car(root_obj)), (package_symbol_name+"-config").c_str()) != 0) return; LispReader reader(lisp_cdr(root_obj)); @@ -148,7 +148,7 @@ if(config) { - fprintf(config, "(supertux-config\n"); + fprintf(config, ("("+package_symbol_name+"-config\n").c_str()); fprintf(config, "\t;; the following options can be set to #t or #f:\n"); fprintf(config, "\t(fullscreen %s)\n", use_fullscreen ? "#t" : "#f"); fprintf(config, "\t(sound %s)\n", SoundManager::get()->sound_enabled() ? "#t" : "#f"); |
From: Tobias G. <to...@us...> - 2004-07-27 19:31:48
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/lib/app Modified Files: globals.cpp globals.h setup.cpp setup.h Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- setup.cpp 27 Jul 2004 09:56:14 -0000 1.8 +++ setup.cpp 27 Jul 2004 19:31:37 -0000 1.9 @@ -119,15 +119,14 @@ /* Get all names of sub-directories in a certain directory. */ /* Returns the number of sub-directories found. */ /* Note: The user has to free the allocated space. */ -string_list_type FileSystem::dsubdirs(const char *rel_path,const char* expected_file) +std::set<std::string> FileSystem::dsubdirs(const char *rel_path,const char* expected_file) { DIR *dirStructP; struct dirent *direntp; - string_list_type sdirs; + std::set<std::string> sdirs; char filename[1024]; char path[1024]; - string_list_init(&sdirs); sprintf(path,"%s/%s",st_dir,rel_path); if((dirStructP = opendir(path)) != NULL) { @@ -147,7 +146,7 @@ continue; } - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -180,7 +179,7 @@ } } - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -189,14 +188,13 @@ return sdirs; } -string_list_type FileSystem::dfiles(const char *rel_path, const char* glob, const char* exception_str) +std::set<std::string> FileSystem::dfiles(const char *rel_path, const char* glob, const char* exception_str) { DIR *dirStructP; struct dirent *direntp; - string_list_type sdirs; + std::set<std::string> sdirs; char path[1024]; - string_list_init(&sdirs); sprintf(path,"%s/%s",st_dir,rel_path); if((dirStructP = opendir(path)) != NULL) { @@ -218,7 +216,7 @@ if(strstr(direntp->d_name,glob) == NULL) continue; - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -245,7 +243,7 @@ if(strstr(direntp->d_name,glob) == NULL) continue; - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -844,9 +842,9 @@ exit(ret); } -std::vector<std::string> FileSystem::read_directory(const std::string& pathname) +std::set<std::string> FileSystem::read_directory(const std::string& pathname) { - std::vector<std::string> dirnames; + std::set<std::string> dirnames; DIR* dir = opendir(pathname.c_str()); if (dir) @@ -855,7 +853,7 @@ while((direntp = readdir(dir))) { - dirnames.push_back(direntp->d_name); + dirnames.insert(direntp->d_name); } closedir(dir); Index: globals.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- globals.cpp 26 Jul 2004 15:48:37 -0000 1.5 +++ globals.cpp 27 Jul 2004 19:31:34 -0000 1.6 @@ -50,7 +50,6 @@ bool use_fullscreen; bool debug_mode; bool show_fps; -float game_speed = 1.0f; int joystick_num = 0; char* level_startup_file = 0; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- setup.h 26 Jul 2004 15:48:37 -0000 1.6 +++ setup.h 27 Jul 2004 19:31:37 -0000 1.7 @@ -21,6 +21,7 @@ #define SUPERTUX_SETUP_H #include <vector> +#include <set> #include <string> #include "../gui/menu.h" #include "../special/base.h" @@ -33,9 +34,9 @@ static int faccessible(const char *filename); static int fcreatedir(const char* relative_dir); static int fwriteable(const char *filename); - static std::vector<std::string> read_directory(const std::string& pathname); - static string_list_type dsubdirs(const char *rel_path, const char* expected_file); - static string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str); + static std::set<std::string> read_directory(const std::string& pathname); + static std::set<std::string> dsubdirs(const char *rel_path, const char* expected_file); + static std::set<std::string> dfiles(const char *rel_path, const char* glob, const char* exception_str); }; /// All you need to get an application up and running Index: globals.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- globals.h 26 Jul 2004 15:48:37 -0000 1.5 +++ globals.h 27 Jul 2004 19:31:37 -0000 1.6 @@ -74,7 +74,6 @@ extern char* st_dir; extern char* st_save_dir; - extern float game_speed; extern SDL_Joystick * js; int wait_for_event(SDL_Event& event,unsigned int min_delay = 0, unsigned int max_delay = 0, bool empty_events = false); |
From: Tobias G. <to...@us...> - 2004-07-27 19:31:47
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/lib/special Removed Files: stringlist.cpp stringlist.h Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) --- stringlist.cpp DELETED --- --- stringlist.h DELETED --- |
From: Marek M. <wa...@us...> - 2004-07-27 19:22:03
|
Update of /cvsroot/super-tux/supertux/data/levels/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv404/data/levels/default Modified Files: Tag: supertux_0_1_1_branch bonusisland.stwm Log Message: added secret level (work in progress) made use of new worldmap stuff Index: bonusisland.stwm =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/default/Attic/bonusisland.stwm,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- bonusisland.stwm 27 Jul 2004 16:48:18 -0000 1.1.2.2 +++ bonusisland.stwm 27 Jul 2004 19:21:54 -0000 1.1.2.3 @@ -52,6 +52,7 @@ (levels (level (name "bonus1/abednego-level1.stl") + (map-message "Entering Abednego's Island") (x 7) (y 18)) (level (name "bonus1/abednego-level2.stl") @@ -64,7 +65,8 @@ (x 12) (y 23)) (level (name "bonus1/matr1x-level1.stl") - (x 24) + (map-message "Entering Matr1x' Island") + (x 24) (y 17)) (level (name "bonus1/matr1x-level2.stl") (x 29) @@ -73,13 +75,15 @@ (x 25) (y 21)) (level (name "bonus1/thompson-level1.stl") - (x 38) + (map-message "Entering Thompson's Island") + (x 38) (y 18)) (level (name "bonus1/thompson-level2.stl") (x 40) (y 22)) (level (name "bonus1/torfi-level1.stl") - (x 42) + (map-message "Entering Torfi's Island") + (x 42) (y 12)) (level (name "bonus1/torfi-level2.stl") (x 47) @@ -88,7 +92,8 @@ (x 46) (y 15)) (level (name "bonus1/wansti-level1.stl") - (x 59) + (map-message "Entering SuperTux Team Island") + (x 59) (y 15)) (level (name "bonus1/wansti-level2.stl") (x 60) @@ -99,7 +104,8 @@ (level (name "bonus1/castle.stl") (x 35) (y 36)) - (level (name "bonus1/secret.stl") + (level (name "bonus1/secret.stl") + (map-message "You found a secret place!") (x 49) (y 37)) ) |
From: Ricardo C. <rm...@us...> - 2004-07-27 17:54:00
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14201/src Modified Files: gameloop.cpp Log Message: Disabled level flipping on debug mode. I guess everybody already have time to give it a try. If not, just go to the worldmap and set (flip #t) in a level. Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.160 retrieving revision 1.161 diff -u -d -r1.160 -r1.161 --- gameloop.cpp 27 Jul 2004 13:25:05 -0000 1.160 +++ gameloop.cpp 27 Jul 2004 17:53:51 -0000 1.161 @@ -77,9 +77,6 @@ context = new DrawingContext(); - if(debug_mode) - flip_level = true; - restart_level(); } |
From: Ricardo C. <rm...@us...> - 2004-07-27 16:55:05
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2373/src Modified Files: worldmap.cpp Log Message: Ooops, almost forgot this! I really should do a testing, but I can't even compile the code. Output: In file included from badguy.cpp:27: defines.h:25:20: config.h: No such file or directory Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- worldmap.cpp 27 Jul 2004 16:44:34 -0000 1.103 +++ worldmap.cpp 27 Jul 2004 16:54:45 -0000 1.104 @@ -436,6 +436,7 @@ reader.read_string("level", level.name, true); reader.read_int("x", level.x); reader.read_int("y", level.y); + level.auto_path = true; reader.read_bool("auto-path", &level.auto_path); level.swap_x = level.swap_y = -1; reader.read_int("swap-x", level.swap_x); |