X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsetup.cpp;h=040f9be42e03679af2c3f2985c63455e11c43501;hb=8dbd5dc1ef48c95616ff2e32e7ac1396e4117fbd;hp=9bbda987d223e6f3286c51ae68f8fa730555c493;hpb=49a682384943e8aed58015da8fbbddf528733a44;p=supertux.git diff --git a/src/setup.cpp b/src/setup.cpp index 9bbda987d..040f9be42 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -50,6 +50,8 @@ #include "scene.h" #include "worldmap.h" #include "resources.h" +#include "intro.h" +#include "music_manager.h" #include "player.h" @@ -344,10 +346,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; @@ -380,7 +382,7 @@ void st_menu(void) main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu, MNID_STARTGAME); main_menu->additem(MN_GOTO, "Contrib Levels",0,contrib_menu, MNID_CONTRIB); main_menu->additem(MN_GOTO, "Options",0,options_menu, MNID_OPTIONMENU); - main_menu->additem(MN_ACTION,"Level editor",0,0, MNID_LEVELEDITOR); + main_menu->additem(MN_ACTION,"Level Editor",0,0, MNID_LEVELEDITOR); main_menu->additem(MN_ACTION,"Credits",0,0, MNID_CREDITS); main_menu->additem(MN_ACTION,"Quit",0,0, MNID_QUITMAINMENU); @@ -389,23 +391,25 @@ void st_menu(void) #ifndef NOOPENGL options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0, MNID_OPENGL); #else - options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl,MNID_OPENGL); + options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl, 0, MNID_OPENGL); #endif options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0, MNID_FULLSCREEN); if(audio_device) { - options_menu->additem(MN_TOGGLE,"Sound ",use_sound,0, MNID_SOUND); - options_menu->additem(MN_TOGGLE,"Music ",use_music,0, MNID_MUSIC); + options_menu->additem(MN_TOGGLE,"Sound ", use_sound,0, MNID_SOUND); + options_menu->additem(MN_TOGGLE,"Music ", use_music,0, MNID_MUSIC); } else { - options_menu->additem(MN_DEACTIVE,"Sound ",use_sound,0, MNID_SOUND); - options_menu->additem(MN_DEACTIVE,"Music ",use_music,0, MNID_MUSIC); + options_menu->additem(MN_DEACTIVE,"Sound ", false,0, MNID_SOUND); + options_menu->additem(MN_DEACTIVE,"Music ", false,0, MNID_MUSIC); } options_menu->additem(MN_TOGGLE,"Show FPS ",show_fps,0, MNID_SHOWFPS); - options_menu->additem(MN_GOTO,"Key Setup",0,options_keys_menu); - if(use_joystick) - options_menu->additem(MN_GOTO,"Joystick Setup",0,options_joystick_menu); + options_menu->additem(MN_GOTO,"Keyboard Setup",0,options_keys_menu); + + //if(use_joystick) + // options_menu->additem(MN_GOTO,"Joystick Setup",0,options_joystick_menu); + options_menu->additem(MN_HL,"",0,0); options_menu->additem(MN_BACK,"Back",0,0); @@ -415,7 +419,7 @@ void st_menu(void) options_keys_menu->additem(MN_CONTROLFIELD,"Right move", 0,0, 0,&keymap.right); options_keys_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, 0,&keymap.jump); options_keys_menu->additem(MN_CONTROLFIELD,"Duck", 0,0, 0,&keymap.duck); - options_keys_menu->additem(MN_CONTROLFIELD,"Power", 0,0, 0,&keymap.fire); + options_keys_menu->additem(MN_CONTROLFIELD,"Power/Run", 0,0, 0,&keymap.fire); options_keys_menu->additem(MN_HL,"",0,0); options_keys_menu->additem(MN_BACK,"Back",0,0); @@ -435,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); @@ -487,12 +491,18 @@ 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) + { + draw_intro(); + } + + fadeout(); + WorldMapNS::WorldMap worldmap; // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); @@ -517,31 +527,35 @@ void process_options_menu(void) { case MNID_OPENGL: #ifndef NOOPENGL - if(use_gl != options_menu->item[MNID_OPENGL].toggled) + if(use_gl != options_menu->isToggled(MNID_OPENGL)) { use_gl = !use_gl; st_video_setup(); } #else - options_menu->item[MNID_OPENGL].toggled = false; + options_menu->get_item_by_id(MNID_OPENGL).toggled = false; #endif break; case MNID_FULLSCREEN: - if(use_fullscreen != options_menu->item[MNID_FULLSCREEN].toggled) + if(use_fullscreen != options_menu->isToggled(MNID_FULLSCREEN)) { use_fullscreen = !use_fullscreen; st_video_setup(); } break; case MNID_SOUND: - if(use_sound != options_menu->item[MNID_SOUND].toggled) + if(use_sound != options_menu->isToggled(MNID_SOUND)) use_sound = !use_sound; break; case MNID_MUSIC: - music_manager->enable_music(options_menu->item[MNID_MUSIC].toggled); + if(use_music != options_menu->isToggled(MNID_MUSIC)) + { + use_music = !use_music; + music_manager->enable_music(use_music); + } break; case MNID_SHOWFPS: - if(show_fps != options_menu->item[MNID_SHOWFPS].toggled) + if(show_fps != options_menu->isToggled(MNID_SHOWFPS)) show_fps = !show_fps; break; } @@ -588,7 +602,6 @@ void st_general_free(void) { /* Free global images: */ - delete black_text; delete gold_text; delete white_text; @@ -596,6 +609,7 @@ void st_general_free(void) delete red_text; delete white_small_text; delete white_big_text; + delete yellow_nums; /* Free GUI/menu images: */ delete checkbox; @@ -650,7 +664,7 @@ void st_video_setup_sdl(void) if (use_fullscreen) { - screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ if (screen == NULL) { fprintf(stderr, @@ -663,7 +677,7 @@ void st_video_setup_sdl(void) } else { - screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE | SDL_DOUBLEBUF ); + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_HWSURFACE | SDL_DOUBLEBUF ); if (screen == NULL) { @@ -688,7 +702,7 @@ void st_video_setup_gl(void) if (use_fullscreen) { - screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */ + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */ if (screen == NULL) { fprintf(stderr, @@ -701,7 +715,7 @@ void st_video_setup_gl(void) } else { - screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL); + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_OPENGL); if (screen == NULL) { @@ -867,7 +881,6 @@ void st_abort(const std::string& reason, const std::string& details) abort(); } - /* Set Icon (private) */ void seticon(void)