3 // SuperTux - A Jump'n Run
4 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "app/globals.h"
27 #include "video/surface.h"
28 #include "video/screen.h"
29 #include "video/drawing_context.h"
30 #include "utils/lispreader.h"
32 #include "app/setup.h"
35 #include "audio/sound_manager.h"
36 #include "resources.h"
37 #include "app/gettext.h"
40 Menu* worldmap_menu = 0;
42 namespace WorldMapNS {
44 Direction reverse_dir(Direction direction)
63 direction_to_string(Direction direction)
81 string_to_direction(const std::string& directory)
83 if (directory == "west")
85 else if (directory == "east")
87 else if (directory == "north")
89 else if (directory == "south")
95 TileManager::TileManager()
97 std::string stwt_filename = datadir + "/images/worldmap/antarctica.stwt";
98 lisp_object_t* root_obj = lisp_read_from_file(stwt_filename);
101 Termination::abort("Couldn't load file", stwt_filename);
103 if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap-tiles") == 0)
105 lisp_object_t* cur = lisp_cdr(root_obj);
107 while(!lisp_nil_p(cur))
109 lisp_object_t* element = lisp_car(cur);
111 if (strcmp(lisp_symbol(lisp_car(element)), "tile") == 0)
114 std::string filename = "<invalid>";
116 Tile* tile = new Tile;
122 tile->auto_walk = false;
124 LispReader reader(lisp_cdr(element));
125 reader.read_int("id", id);
126 reader.read_bool("north", tile->north);
127 reader.read_bool("south", tile->south);
128 reader.read_bool("west", tile->west);
129 reader.read_bool("east", tile->east);
130 reader.read_bool("stop", tile->stop);
131 reader.read_bool("auto-walk", tile->auto_walk);
132 reader.read_string("image", filename);
134 tile->sprite = new Surface(
135 datadir + "/images/worldmap/" + filename,
138 if (id >= int(tiles.size()))
145 puts("Unhandled symbol");
159 TileManager::~TileManager()
161 for(std::vector<Tile*>::iterator i = tiles.begin(); i != tiles.end(); ++i)
166 TileManager::get(int i)
168 assert(i >=0 && i < int(tiles.size()));
172 //---------------------------------------------------------------------------
174 Tux::Tux(WorldMap* worldmap_)
175 : worldmap(worldmap_)
177 largetux_sprite = new Surface(datadir + "/images/worldmap/tux.png", true);
178 firetux_sprite = new Surface(datadir + "/images/worldmap/firetux.png", true);
179 smalltux_sprite = new Surface(datadir + "/images/worldmap/smalltux.png", true);
183 tile_pos.x = worldmap->get_start_x();
184 tile_pos.y = worldmap->get_start_y();
186 input_direction = D_NONE;
191 delete smalltux_sprite;
192 delete firetux_sprite;
193 delete largetux_sprite;
197 Tux::draw(DrawingContext& context, const Vector& offset)
199 Vector pos = get_pos();
200 switch (player_status.bonus)
202 case PlayerStatus::GROWUP_BONUS:
203 context.draw_surface(largetux_sprite,
204 Vector(pos.x + offset.x, pos.y + offset.y - 10), LAYER_OBJECTS);
206 case PlayerStatus::FLOWER_BONUS:
207 context.draw_surface(firetux_sprite,
208 Vector(pos.x + offset.x, pos.y + offset.y - 10), LAYER_OBJECTS);
210 case PlayerStatus::NO_BONUS:
211 context.draw_surface(smalltux_sprite,
212 Vector(pos.x + offset.x, pos.y + offset.y - 10), LAYER_OBJECTS);
221 float x = tile_pos.x * 32;
222 float y = tile_pos.y * 32;
242 return Vector((int)x, (int)y);
250 input_direction = D_NONE;
255 Tux::set_direction(Direction dir)
257 input_direction = dir;
261 Tux::action(float delta)
265 if (input_direction != D_NONE)
267 WorldMap::SpecialTile* special_tile = worldmap->at_special_tile();
269 // We got a new direction, so lets start walking when possible
271 if ((!special_tile || special_tile->solved || special_tile->level_name.empty())
272 && worldmap->path_ok(input_direction, tile_pos, &next_tile))
274 tile_pos = next_tile;
276 direction = input_direction;
277 back_direction = reverse_dir(direction);
279 else if (input_direction == back_direction)
282 direction = input_direction;
283 tile_pos = worldmap->get_next_tile(tile_pos, direction);
284 back_direction = reverse_dir(direction);
290 // Let tux walk a few pixels (20 pixel/sec)
291 offset += 20.0f * delta;
294 { // We reached the next tile, so we check what to do now
297 if (worldmap->at(tile_pos)->stop || worldmap->at_special_tile())
303 if (worldmap->at(tile_pos)->auto_walk || direction != input_direction)
304 { // Turn to a new direction
305 Tile* tile = worldmap->at(tile_pos);
307 if(direction != input_direction &&
308 ((tile->north && input_direction == D_NORTH) ||
309 (tile->south && input_direction == D_SOUTH) ||
310 (tile->east && input_direction == D_EAST) ||
311 (tile->west && input_direction == D_WEST)))
312 { // player has changed direction during auto-movement
313 direction = input_direction;
314 back_direction = reverse_dir(direction);
316 else if(direction != input_direction)
317 { // player has changed to impossible tile
318 back_direction = reverse_dir(direction);
323 Direction dir = D_NONE;
325 if (tile->north && back_direction != D_NORTH)
327 else if (tile->south && back_direction != D_SOUTH)
329 else if (tile->east && back_direction != D_EAST)
331 else if (tile->west && back_direction != D_WEST)
337 input_direction = direction;
338 back_direction = reverse_dir(direction);
342 // Should never be reached if tiledata is good
349 // Walk automatically to the next tile
350 if(direction != D_NONE)
353 if (worldmap->path_ok(direction, tile_pos, &next_tile))
355 tile_pos = next_tile;
359 puts("Tilemap data is buggy");
368 //---------------------------------------------------------------------------
378 //---------------------------------------------------------------------------
382 tile_manager = new TileManager();
383 //tux = new Tux(this);
391 level_sprite = new Surface(datadir + "/images/worldmap/levelmarker.png", true);
392 leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", true);
393 leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", true);
398 music = "SALCON.MOD";
401 WorldMap::~WorldMap()
407 delete leveldot_green;
414 lisp_object_t* root_obj = lisp_read_from_file(datadir + "/levels/worldmap/" + map_filename);
416 Termination::abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename);
418 if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0)
420 lisp_object_t* cur = lisp_cdr(root_obj);
422 while(!lisp_nil_p(cur))
424 lisp_object_t* element = lisp_car(cur);
426 if (strcmp(lisp_symbol(lisp_car(element)), "tilemap") == 0)
428 LispReader reader(lisp_cdr(element));
429 reader.read_int("width", width);
430 reader.read_int("height", height);
431 reader.read_int_vector("data", tilemap);
433 else if (strcmp(lisp_symbol(lisp_car(element)), "properties") == 0)
435 LispReader reader(lisp_cdr(element));
436 reader.read_string("name", name, true);
437 reader.read_string("music", music);
438 reader.read_int("start_pos_x", start_x);
439 reader.read_int("start_pos_y", start_y);
441 else if (strcmp(lisp_symbol(lisp_car(element)), "special-tiles") == 0 ||
442 strcmp(lisp_symbol(lisp_car(element)), "levels") == 0)
444 lisp_object_t* cur = lisp_cdr(element);
446 while(!lisp_nil_p(cur))
448 lisp_object_t* element = lisp_car(cur);
450 if (strcmp(lisp_symbol(lisp_car(element)), "special-tile") == 0)
452 SpecialTile special_tile;
453 LispReader reader(lisp_cdr(element));
454 special_tile.solved = false;
456 special_tile.north = true;
457 special_tile.east = true;
458 special_tile.south = true;
459 special_tile.west = true;
461 reader.read_string("extro-filename", special_tile.extro_filename);
462 reader.read_string("map-message", special_tile.display_map_message);
463 reader.read_string("next-world", special_tile.next_worldmap);
464 reader.read_string("level", special_tile.level_name, true);
465 reader.read_int("x", special_tile.x);
466 reader.read_int("y", special_tile.y);
467 special_tile.auto_path = true;
468 reader.read_bool("auto-path", special_tile.auto_path);
469 special_tile.swap_x = special_tile.swap_y = -1;
470 reader.read_int("swap-x", special_tile.swap_x);
471 reader.read_int("swap-y", special_tile.swap_y);
472 special_tile.vertical_flip = false;
473 reader.read_bool("flip-special_tile", special_tile.vertical_flip);
474 special_tile.quit_worldmap = false;
475 reader.read_bool("exit-game", special_tile.quit_worldmap);
477 special_tiles.push_back(special_tile);
480 /* Kept for backward compability */
481 else if (strcmp(lisp_symbol(lisp_car(element)), "level") == 0)
483 SpecialTile special_tile;
484 LispReader reader(lisp_cdr(element));
485 special_tile.solved = false;
487 special_tile.north = true;
488 special_tile.east = true;
489 special_tile.south = true;
490 special_tile.west = true;
492 reader.read_string("extro-filename", special_tile.extro_filename);
493 if(!special_tile.extro_filename.empty())
494 special_tile.quit_worldmap = true;
495 reader.read_string("name", special_tile.level_name, true);
496 reader.read_int("x", special_tile.x);
497 reader.read_int("y", special_tile.y);
498 special_tile.vertical_flip = false;
499 special_tile.swap_x = special_tile.swap_y = -1;
501 special_tiles.push_back(special_tile);
520 void WorldMap::get_level_title(SpecialTile& special_tile)
522 /** get special_tile's title */
523 special_tile.title = "<no title>";
525 LispReader* reader = LispReader::load(datadir + "/levels/" + special_tile.level_name, "supertux-level");
528 std::cerr << "Error: Could not open special_tile file. Ignoring...\n";
532 reader->read_string("name", special_tile.title, true);
537 WorldMap::on_escape_press()
539 // Show or hide the menu
542 Menu::set_current(worldmap_menu);
543 tux->set_direction(D_NONE); // stop tux movement when menu is called
546 Menu::set_current(0);
550 WorldMap::get_input()
555 while (SDL_PollEvent(&event))
559 Menu::current()->event(event);
566 Termination::abort("Received window close", "");
570 switch(event.key.keysym.sym)
581 tux->set_direction(D_WEST);
584 tux->set_direction(D_EAST);
587 tux->set_direction(D_NORTH);
590 tux->set_direction(D_SOUTH);
598 case SDL_JOYAXISMOTION:
599 if (event.jaxis.axis == joystick_keymap.x_axis)
601 if (event.jaxis.value < -joystick_keymap.dead_zone)
602 tux->set_direction(D_WEST);
603 else if (event.jaxis.value > joystick_keymap.dead_zone)
604 tux->set_direction(D_EAST);
606 else if (event.jaxis.axis == joystick_keymap.y_axis)
608 if (event.jaxis.value > joystick_keymap.dead_zone)
609 tux->set_direction(D_SOUTH);
610 else if (event.jaxis.value < -joystick_keymap.dead_zone)
611 tux->set_direction(D_NORTH);
615 case SDL_JOYBUTTONDOWN:
616 if (event.jbutton.button == joystick_keymap.b_button)
618 else if (event.jbutton.button == joystick_keymap.start_button)
630 WorldMap::get_next_tile(Vector pos, Direction direction)
653 WorldMap::path_ok(Direction direction, Vector old_pos, Vector* new_pos)
655 *new_pos = get_next_tile(old_pos, direction);
657 if (!(new_pos->x >= 0 && new_pos->x < width
658 && new_pos->y >= 0 && new_pos->y < height))
659 { // New position is outsite the tilemap
663 { // Check if we the tile allows us to go to new_pos
667 return (at(old_pos)->west && at(*new_pos)->east);
670 return (at(old_pos)->east && at(*new_pos)->west);
673 return (at(old_pos)->north && at(*new_pos)->south);
676 return (at(old_pos)->south && at(*new_pos)->north);
679 assert(!"path_ok() can't work if direction is NONE");
686 WorldMap::update(float delta)
688 if (enter_level && !tux->is_moving())
690 bool level_finished = true;
691 SpecialTile* special_tile = at_special_tile();
694 std::cout << "Nothing to enter at: "
695 << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl;
700 if(!special_tile->level_name.empty())
702 if (special_tile->x == tux->get_tile_pos().x &&
703 special_tile->y == tux->get_tile_pos().y)
705 PlayerStatus old_player_status = player_status;
707 std::cout << "Enter the current level: " << special_tile->level_name << std::endl;
708 // do a shriking fade to the special_tile
709 shrink_fade(Vector((special_tile->x*32 + 16 + offset.x),(special_tile->y*32 + 16
711 GameSession session(datadir + "/levels/" + special_tile->level_name,
712 ST_GL_LOAD_LEVEL_FILE, special_tile->vertical_flip);
714 switch (session.run())
716 case GameSession::ES_LEVEL_FINISHED:
718 level_finished = true;
719 bool old_level_state = special_tile->solved;
720 special_tile->solved = true;
722 if (session.get_current_sector()->player->got_power !=
723 session.get_current_sector()->player->NONE_POWER)
724 player_status.bonus = PlayerStatus::FLOWER_BONUS;
725 else if (session.get_current_sector()->player->size == BIG)
726 player_status.bonus = PlayerStatus::GROWUP_BONUS;
728 player_status.bonus = PlayerStatus::NO_BONUS;
730 if (old_level_state != special_tile->solved && special_tile->auto_path)
731 { // Try to detect the next direction to which we should walk
732 // FIXME: Mostly a hack
733 Direction dir = D_NONE;
735 Tile* tile = at(tux->get_tile_pos());
737 if (tile->north && tux->back_direction != D_NORTH)
739 else if (tile->south && tux->back_direction != D_SOUTH)
741 else if (tile->east && tux->back_direction != D_EAST)
743 else if (tile->west && tux->back_direction != D_WEST)
748 tux->set_direction(dir);
749 //tux->update(delta);
752 std::cout << "Walk to dir: " << dir << std::endl;
757 case GameSession::ES_LEVEL_ABORT:
758 level_finished = false;
759 /* In case the player's abort the special_tile, keep it using the old
760 status. But the minimum lives and no bonus. */
761 player_status.score = old_player_status.score;
762 player_status.distros = old_player_status.distros;
763 player_status.lives = std::min(old_player_status.lives, player_status.lives);
764 player_status.bonus = player_status.NO_BONUS;
767 case GameSession::ES_GAME_OVER:
769 level_finished = false;
770 /* draw an end screen */
771 /* in the future, this should make a dialog a la SuperMario, asking
772 if the player wants to restart the world map with no score and from
776 DrawingContext context;
777 context.draw_gradient(Color (200,240,220), Color(200,200,220),
780 context.draw_text_center(blue_text, _("GAMEOVER"),
781 Vector(0, 200), LAYER_FOREGROUND1);
783 sprintf(str, _("SCORE: %d"), player_status.score);
784 context.draw_text_center(gold_text, str,
785 Vector(0, 230), LAYER_FOREGROUND1);
787 sprintf(str, _("COINS: %d"), player_status.distros);
788 context.draw_text_center(gold_text, str,
789 Vector(0, screen->w - 32), LAYER_FOREGROUND1);
791 context.do_drawing();
794 wait_for_event(event,2000,5000,true);
797 player_status.reset();
800 case GameSession::ES_NONE:
802 // Should never be reached
806 SoundManager::get()->play_music(song);
807 Menu::set_current(0);
808 if (!savegame_file.empty())
809 savegame(savegame_file);
812 /* The porpose of the next checking is that if the player lost
813 the special_tile (in case there is one), don't show anything */
816 if (!special_tile->extro_filename.empty())
818 // Display a text file
819 display_text_file(special_tile->extro_filename, SCROLL_SPEED_MESSAGE, white_big_text , white_text, white_small_text, blue_text );
821 if (special_tile->swap_x != -1 && special_tile->swap_y != -1)
823 // TODO: add an effect, like a camera scrolling, or at least, a fading
824 tux->set_tile_pos(Vector(special_tile->swap_x, special_tile->swap_y));
826 if (!special_tile->next_worldmap.empty())
828 // Load given worldmap
829 loadmap(special_tile->next_worldmap);
831 if (special_tile->quit_worldmap)
838 // tux->set_direction(input_direction);
841 Menu* menu = Menu::current();
846 if(menu == worldmap_menu)
848 switch (worldmap_menu->check())
850 case MNID_RETURNWORLDMAP: // Return to game
852 case MNID_QUITWORLDMAP: // Quit Worldmap
857 else if(menu == options_menu)
859 process_options_menu();
865 WorldMap::at(Vector p)
874 return tile_manager->get(tilemap[width * y + x]);
877 WorldMap::SpecialTile*
878 WorldMap::at_special_tile()
880 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
882 if (i->x == tux->get_tile_pos().x &&
883 i->y == tux->get_tile_pos().y)
892 WorldMap::draw(DrawingContext& context, const Vector& offset)
894 for(int y = 0; y < height; ++y)
895 for(int x = 0; x < width; ++x)
897 Tile* tile = at(Vector(x, y));
898 context.draw_surface(tile->sprite,
899 Vector(x*32 + offset.x, y*32 + offset.y), LAYER_TILES);
902 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
904 if(i->level_name.empty())
908 context.draw_surface(leveldot_green,
909 Vector(i->x*32 + offset.x, i->y*32 + offset.y), LAYER_TILES+1);
911 context.draw_surface(leveldot_red,
912 Vector(i->x*32 + offset.x, i->y*32 + offset.y), LAYER_TILES+1);
915 tux->draw(context, offset);
916 draw_status(context);
920 WorldMap::draw_status(DrawingContext& context)
923 sprintf(str, " %d", player_status.score);
925 context.draw_text(white_text, _("SCORE"), Vector(0, 0), LAYER_FOREGROUND1);
926 context.draw_text(gold_text, str, Vector(96, 0), LAYER_FOREGROUND1);
928 sprintf(str, "%d", player_status.distros);
929 context.draw_text(white_text, _("COINS"), Vector(screen->w/2 - 16*5, 0),
931 context.draw_text(gold_text, str, Vector(screen->w/2 + (16*5)/2, 0),
934 if (player_status.lives >= 5)
936 sprintf(str, "%dx", player_status.lives);
937 context.draw_text(gold_text, str,
938 Vector(screen->w - gold_text->get_text_width(str) - tux_life->w, 0),
940 context.draw_surface(tux_life, Vector(screen->w -
941 gold_text->get_text_width("9"), 0), LAYER_FOREGROUND1);
945 for(int i= 0; i < player_status.lives; ++i)
946 context.draw_surface(tux_life,
947 Vector(screen->w - tux_life->w*4 + (tux_life->w*i), 0),
950 context.draw_text(white_text, _("LIVES"),
951 Vector(screen->w - white_text->get_text_width(_("LIVES")) - white_text->get_text_width(" 99"), 0),
954 if (!tux->is_moving())
956 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
958 if (i->x == tux->get_tile_pos().x &&
959 i->y == tux->get_tile_pos().y)
961 if(!i->level_name.empty())
966 context.draw_text_center(white_text, i->title,
967 Vector(0, screen->h - white_text->get_height() - 30),
971 /* Display a message in the map, if any as been selected */
972 if(!i->display_map_message.empty())
973 context.draw_text_center(gold_text, i->display_map_message,
974 Vector(0, screen->h - white_text->get_height() - 60),
985 Menu::set_current(0);
989 song = SoundManager::get()->load_music(datadir + "/music/" + music);
990 SoundManager::get()->play_music(song);
992 unsigned int last_update_time;
993 unsigned int update_time;
995 last_update_time = update_time = Ticks::get();
997 DrawingContext context;
1000 float delta = ((float)(update_time-last_update_time))/100.0;
1007 last_update_time = update_time;
1008 update_time = Ticks::get();
1010 Vector tux_pos = tux->get_pos();
1013 offset.x = -tux_pos.x + screen->w/2;
1014 offset.y = -tux_pos.y + screen->h/2;
1016 if (offset.x > 0) offset.x = 0;
1017 if (offset.y > 0) offset.y = 0;
1019 if (offset.x < screen->w - width*32) offset.x = screen->w - width*32;
1020 if (offset.y < screen->h - height*32) offset.y = screen->h - height*32;
1023 draw(context, offset);
1029 Menu::current()->draw(context);
1030 mouse_cursor->draw(context);
1033 context.do_drawing();
1040 WorldMap::savegame(const std::string& filename)
1045 std::cout << "savegame: " << filename << std::endl;
1046 std::ofstream out(filename.c_str());
1048 int nb_solved_levels = 0;
1049 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
1055 out << "(supertux-savegame\n"
1057 << " (title \"" << name << " - " << nb_solved_levels << "/" << special_tiles.size() << "\")\n"
1058 << " (map \"" << map_filename << "\")\n"
1059 << " (lives " << player_status.lives << ")\n"
1060 << " (score " << player_status.score << ")\n"
1061 << " (distros " << player_status.distros << ")\n"
1062 << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n"
1063 << " (back \"" << direction_to_string(tux->back_direction) << "\")\n"
1064 << " (bonus \"" << bonus_to_string(player_status.bonus) << "\"))\n"
1067 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
1069 if (i->solved && !i->level_name.empty())
1071 out << " (level (name \"" << i->level_name << "\")\n"
1072 << " (solved #t))\n";
1077 << " )\n\n;; EOF ;;" << std::endl;
1081 WorldMap::loadgame(const std::string& filename)
1083 std::cout << "loadgame: " << filename << std::endl;
1084 savegame_file = filename;
1085 map_filename = "icyisland.stwm";
1087 if (access(filename.c_str(), F_OK) != 0)
1093 lisp_object_t* savegame = lisp_read_from_file(filename);
1096 std::cout << "WorldMap:loadgame: File not found: " << filename << std::endl;
1101 lisp_object_t* cur = savegame;
1103 if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-savegame") != 0)
1109 cur = lisp_cdr(cur);
1110 LispReader reader(cur);
1112 /* Get the Map filename and then load it before setting special_tile settings */
1113 reader.read_string("map", map_filename);
1116 reader.read_int("lives", player_status.lives);
1117 reader.read_int("score", player_status.score);
1118 reader.read_int("distros", player_status.distros);
1120 if (player_status.lives < 0)
1121 player_status.lives = START_LIVES;
1123 lisp_object_t* tux_cur = 0;
1124 if (reader.read_lisp("tux", tux_cur))
1127 std::string back_str = "none";
1128 std::string bonus_str = "none";
1130 LispReader tux_reader(tux_cur);
1131 tux_reader.read_float("x", p.x);
1132 tux_reader.read_float("y", p.y);
1133 tux_reader.read_string("back", back_str);
1134 tux_reader.read_string("bonus", bonus_str);
1136 player_status.bonus = string_to_bonus(bonus_str);
1137 tux->back_direction = string_to_direction(back_str);
1138 tux->set_tile_pos(p);
1141 lisp_object_t* level_cur = 0;
1142 if (reader.read_lisp("levels", level_cur))
1146 lisp_object_t* sym = lisp_car(lisp_car(level_cur));
1147 lisp_object_t* data = lisp_cdr(lisp_car(level_cur));
1149 if (strcmp(lisp_symbol(sym), "level") == 0)
1152 bool solved = false;
1154 LispReader level_reader(data);
1155 level_reader.read_string("name", name, true);
1156 level_reader.read_bool("solved", solved);
1158 for(SpecialTiles::iterator i = special_tiles.begin(); i != special_tiles.end(); ++i)
1160 if (name == i->level_name)
1165 level_cur = lisp_cdr(level_cur);
1169 lisp_free(savegame);
1173 WorldMap::loadmap(const std::string& filename)
1176 map_filename = filename;
1180 } // namespace WorldMapNS
1182 /* Local Variables: */