X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsetup.cpp;h=24397e8bcd82fe712b9787d6d7ecfee888db22d5;hb=820473dd8331f9c8949f0d492162fa9d1860ca90;hp=7751d23ca3fe22678ef71d50dde4d5cd3aebc413;hpb=8fa514bf18494f19ca1fbae3512354f0fab22bce;p=supertux.git diff --git a/src/setup.cpp b/src/setup.cpp index 7751d23ca..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) @@ -373,7 +375,11 @@ void st_menu(void) options_menu->additem(MN_LABEL,"Options",0,0); options_menu->additem(MN_HL,"",0,0); +#ifndef NOOPENGL options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0); +#else + options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl,0); +#endif options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0); if(audio_device) { @@ -416,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); @@ -435,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; } @@ -510,13 +486,13 @@ void process_options_menu(void) switch (options_menu->check()) { case 2: +#ifndef NOOPENGL if(use_gl != options_menu->item[2].toggled) { -#ifndef NOOPENGL use_gl = !use_gl; st_video_setup(); -#endif } +#endif break; case 3: if(use_fullscreen != options_menu->item[3].toggled) @@ -573,14 +549,14 @@ void st_general_setup(void) /* Load global images: */ - text_load(&black_text, datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); - text_load(&gold_text,datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); - text_load(&blue_text,datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18); - text_load(&red_text,datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); - text_load(&white_text,datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); - text_load(&white_small_text,datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); - text_load(&white_big_text,datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,23); - text_load(&yellow_nums,datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); + black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); + gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); + blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18); + red_text = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); + white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); + white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); + white_big_text = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,23); + yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); /* Load GUI/menu images: */ checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA); @@ -599,13 +575,13 @@ void st_general_free(void) /* Free global images: */ - text_free(&black_text); - text_free(&gold_text); - text_free(&white_text); - text_free(&blue_text); - text_free(&red_text); - text_free(&white_small_text); - text_free(&white_big_text); + delete black_text; + delete gold_text; + delete white_text; + delete blue_text; + delete red_text; + delete white_small_text; + delete white_big_text; /* Free GUI/menu images: */ delete checkbox; @@ -628,7 +604,6 @@ void st_general_free(void) void st_video_setup(void) { - if(screen != NULL) SDL_FreeSurface(screen); @@ -649,9 +624,10 @@ void st_video_setup(void) else st_video_setup_sdl(); + Surface::reload_all(); + /* Set window manager stuff: */ SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux"); - } void st_video_setup_sdl(void)