X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsetup.cpp;h=24397e8bcd82fe712b9787d6d7ecfee888db22d5;hb=820473dd8331f9c8949f0d492162fa9d1860ca90;hp=ffd9e3f188451c2b632687184273bb1e61e2c117;hpb=8eb1a0b00803dc38bf3a42609f6475e6b49d3bd5;p=supertux.git diff --git a/src/setup.cpp b/src/setup.cpp index ffd9e3f18..24397e8bc 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -40,6 +41,7 @@ #include "gameloop.h" #include "configfile.h" #include "scene.h" +#include "worldmap.h" #ifdef WIN32 #define mkdir(dir, mode) mkdir(dir) @@ -420,18 +422,17 @@ void st_menu(void) save_game_menu->additem(MN_HL,"",0,0); save_game_menu->additem(MN_BACK,"Back",0,0); - game_menu->additem(MN_LABEL,"InGame Menu",0,0); + game_menu->additem(MN_LABEL,"Pause",0,0); game_menu->additem(MN_HL,"",0,0); - game_menu->additem(MN_ACTION,"Return To Game",0,0); - game_menu->additem(MN_GOTO,"Save Game",0,save_game_menu); - game_menu->additem(MN_GOTO,"Load Game",0,load_game_menu); + game_menu->additem(MN_ACTION,"Continue",0,0); game_menu->additem(MN_GOTO,"Options",0,options_menu); game_menu->additem(MN_HL,"",0,0); - game_menu->additem(MN_ACTION,"Quit Game",0,0); + game_menu->additem(MN_ACTION,"Abort Level",0,0); - worldmap_menu->additem(MN_LABEL,"Worldmap Menu",0,0); + worldmap_menu->additem(MN_LABEL,"Pause",0,0); worldmap_menu->additem(MN_HL,"",0,0); - worldmap_menu->additem(MN_ACTION,"Return To Game",0,0); + worldmap_menu->additem(MN_ACTION,"Continue",0,0); + worldmap_menu->additem(MN_ACTION,"Save",0,0); worldmap_menu->additem(MN_GOTO,"Options",0,options_menu); worldmap_menu->additem(MN_HL,"",0,0); worldmap_menu->additem(MN_ACTION,"Quit Game",0,0); @@ -439,66 +440,37 @@ void st_menu(void) highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0); } -void update_load_save_game_menu(Menu* pmenu, int load) +void update_load_save_game_menu(Menu* pmenu) { for(int i = 2; i < 7; ++i) { // FIXME: Insert a real savegame struct/class here instead of // doing string vodoo - std::string tmp = slotinfo(i-1); - - if(load && tmp.length() == strlen("Slot X - Free")) - pmenu->item[i].kind = MN_ACTION; - else - pmenu->item[i].kind = MN_ACTION; + std::string tmp = slotinfo(i - 1); + pmenu->item[i].kind = MN_ACTION; pmenu->item[i].change_text(tmp.c_str()); } } -void process_save_game_menu() -{ - int slot = save_game_menu->check(); - if (slot != -1) - GameSession::current()->savegame(slot - 1); -} - bool process_load_game_menu() { int slot = load_game_menu->check(); if(slot != -1) { - // FIXME: Insert a real savegame struct/class here instead of - // doing string vodoo - std::string tmp = slotinfo(slot-1); + WorldMapNS::WorldMap worldmap; - if (tmp.length() == strlen("Slot X - Free")) - { // Slot is free, so start a new game - GameSession session("default", 1, ST_GL_PLAY); - session.run(); + char slotfile[1024]; + snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1); + + // Load the game or at least set the savegame_file variable + worldmap.loadgame(slotfile); - show_menu = true; - Menu::set_current(main_menu); - } - else - { - puts("Warning: Loading games isn't supported at the moment"); -#if 0 - // Slot contains a level, so load it - if (game_started) - { - GameSession session("default",slot - 1,ST_GL_LOAD_GAME); - session.run(); + worldmap.display(); + + show_menu = true; + Menu::set_current(main_menu); - show_menu = true; - Menu::set_current(main_menu); - } - else - { - //loadgame(slot - 1); - } -#endif - } st_pause_ticks_stop(); return true; }