X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsetup.cpp;h=4bfd9c30b96025fb44da00d88b0a888f902f386c;hb=2ec1be264110139466ab70422b8f4fd9c22e5c8c;hp=ee111084a1586d6744d238a80970cd695b7bb000;hpb=efb7eb0f84938633537f38fa1e76441181fad41e;p=supertux.git diff --git a/src/setup.cpp b/src/setup.cpp index ee111084a..4bfd9c30b 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -50,10 +50,13 @@ #include "scene.h" #include "worldmap.h" #include "resources.h" +#include "intro.h" #include "music_manager.h" #include "player.h" +void display_text_file(char *filename); + #ifdef WIN32 #define mkdir(dir, mode) mkdir(dir) // on win32 we typically don't want LFS paths @@ -345,10 +348,10 @@ void st_directory_setup(void) { std::string exedir = std::string(dirname(exe_file)) + "/"; - datadir = exedir + "../data/"; // SuperTux run from source dir + datadir = exedir + "../data"; // SuperTux run from source dir if (access(datadir.c_str(), F_OK) != 0) { - datadir = exedir + "../share/supertux/"; // SuperTux run from PATH + datadir = exedir + "../share/supertux"; // SuperTux run from PATH if (access(datadir.c_str(), F_OK) != 0) { // If all fails, fall back to compiled path datadir = DATA_PREFIX; @@ -436,21 +439,21 @@ void st_menu(void) load_game_menu->additem(MN_LABEL,"Start Game",0,0); load_game_menu->additem(MN_HL,"",0,0); - load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0); - load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0); - load_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0); - load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0); - load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0); + load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1); + load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2); + load_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0, 3); + load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0, 4); + load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0, 5); load_game_menu->additem(MN_HL,"",0,0); load_game_menu->additem(MN_BACK,"Back",0,0); save_game_menu->additem(MN_LABEL,"Save Game",0,0); save_game_menu->additem(MN_HL,"",0,0); - save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0); - save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0); - save_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0); - save_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0); - save_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0); + save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1); + save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2); + save_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0, 3); + save_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0, 4); + save_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0, 5); save_game_menu->additem(MN_HL,"",0,0); save_game_menu->additem(MN_BACK,"Back",0,0); @@ -488,12 +491,17 @@ bool process_load_game_menu() { int slot = load_game_menu->check(); - if(slot != -1 && load_game_menu->get_item(slot).kind == MN_ACTION) + if(slot != -1 && load_game_menu->get_item_by_id(slot).kind == MN_ACTION) { - WorldMapNS::WorldMap worldmap; - char slotfile[1024]; - snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1); + snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot); + + if (access(slotfile, F_OK) != 0) + { + display_text_file("intro.txt"); + } + + WorldMapNS::WorldMap worldmap; // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); @@ -872,7 +880,6 @@ void st_abort(const std::string& reason, const std::string& details) abort(); } - /* Set Icon (private) */ void seticon(void)