From: Ingo Ruhnke Date: Sat, 9 Aug 2014 19:46:32 +0000 (+0200) Subject: Only show language and profile options in main menu, not when using the options in... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=16a0bcbb7cfbd52e9aa1d340feff987a5ce94436;p=supertux.git Only show language and profile options in main menu, not when using the options in game --- diff --git a/src/supertux/menu/game_menu.cpp b/src/supertux/menu/game_menu.cpp index 04b3d322d..fb3e45906 100644 --- a/src/supertux/menu/game_menu.cpp +++ b/src/supertux/menu/game_menu.cpp @@ -31,7 +31,7 @@ GameMenu::GameMenu() add_label(level->name); add_hl(); add_entry(MNID_CONTINUE, _("Continue")); - add_submenu(_("Options"), MenuStorage::OPTIONS_MENU); + add_submenu(_("Options"), MenuStorage::INGAME_OPTIONS_MENU); add_hl(); add_entry(MNID_ABORTLEVEL, _("Abort Level")); } diff --git a/src/supertux/menu/menu_storage.cpp b/src/supertux/menu/menu_storage.cpp index a6d23cb63..2b5e04d74 100644 --- a/src/supertux/menu/menu_storage.cpp +++ b/src/supertux/menu/menu_storage.cpp @@ -61,7 +61,10 @@ MenuStorage::create(MenuId menu_id) return std::unique_ptr(new LanguageMenu); case OPTIONS_MENU: - return std::unique_ptr(new OptionsMenu); + return std::unique_ptr(new OptionsMenu(true)); + + case INGAME_OPTIONS_MENU: + return std::unique_ptr(new OptionsMenu(false)); case PROFILE_MENU: return std::unique_ptr(new ProfileMenu); @@ -98,12 +101,14 @@ MenuStorage::create(MenuId menu_id) KeyboardMenu* MenuStorage::get_key_options_menu() { + assert(!"broken"); return new KeyboardMenu(g_input_manager); } JoystickMenu* MenuStorage::get_joystick_options_menu() { + assert(!"broken"); return new JoystickMenu(g_input_manager); } diff --git a/src/supertux/menu/menu_storage.hpp b/src/supertux/menu/menu_storage.hpp index a9713c15b..49508a4f6 100644 --- a/src/supertux/menu/menu_storage.hpp +++ b/src/supertux/menu/menu_storage.hpp @@ -37,6 +37,7 @@ public: NO_MENU, MAIN_MENU, OPTIONS_MENU, + INGAME_OPTIONS_MENU, PROFILE_MENU, CONTRIB_MENU, CONTRIB_WORLD_MENU, @@ -55,6 +56,8 @@ public: std::unique_ptr create(MenuId menu_id); // FIXME +#ifdef GRUMBEL +#endif JoystickMenu* get_joystick_options_menu(); KeyboardMenu* get_key_options_menu(); diff --git a/src/supertux/menu/options_menu.cpp b/src/supertux/menu/options_menu.cpp index 5ea8a672f..79a2278f4 100644 --- a/src/supertux/menu/options_menu.cpp +++ b/src/supertux/menu/options_menu.cpp @@ -42,22 +42,25 @@ enum OptionsMenuIDs { MNID_MUSIC }; -OptionsMenu::OptionsMenu() +OptionsMenu::OptionsMenu(bool complete) { add_label(_("Options")); add_hl(); - // Language change should only be possible in the main menu, since elsewhere it might not always work fully - // FIXME: Implement me: if (get_parent() == main_menu) - add_submenu(_("Select Language"), MenuStorage::LANGUAGE_MENU) - ->set_help(_("Select a different language to display text in")); + if (complete) + { + // Language and profile changes are only be possible in the + // main menu, since elsewhere it might not always work fully + add_submenu(_("Select Language"), MenuStorage::LANGUAGE_MENU) + ->set_help(_("Select a different language to display text in")); - add_submenu(_("Select Profile"), MenuStorage::PROFILE_MENU) - ->set_help(_("Select a profile to play with")); + add_submenu(_("Select Profile"), MenuStorage::PROFILE_MENU) + ->set_help(_("Select a profile to play with")); + } add_toggle(MNID_PROFILES, _("Profile on Startup"), g_config->sound_enabled) ->set_help(_("Select your profile immediately after start-up")); - + add_toggle(MNID_FULLSCREEN,_("Fullscreen"), g_config->use_fullscreen) ->set_help(_("Fill the entire screen")); @@ -93,7 +96,7 @@ OptionsMenu::OptionsMenu() magn.clear(); break; } - + ++count; } if (!magn.empty()) //magnification not in our list but accept anyway @@ -102,7 +105,7 @@ OptionsMenu::OptionsMenu() magnification->list.push_back(magn); } } - + int display_mode_count = SDL_GetNumDisplayModes(0); for(int i = 0; i < display_mode_count; ++i) { @@ -129,7 +132,7 @@ OptionsMenu::OptionsMenu() fullscreen_size_str = out.str(); } size_t cnt = 0; - for (std::vector::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i) + for (std::vector::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i) { if (*i == fullscreen_size_str) { @@ -147,7 +150,7 @@ OptionsMenu::OptionsMenu() MenuItem* aspect = add_string_select(MNID_ASPECTRATIO, _("Aspect Ratio")); aspect->set_help(_("Adjust the aspect ratio")); - + aspect->list.push_back(_("auto")); aspect->list.push_back("5:4"); aspect->list.push_back("4:3"); @@ -178,7 +181,7 @@ OptionsMenu::OptionsMenu() aspect->list.push_back(aspect_ratio); } } - + if (sound_manager->is_audio_enabled()) { add_toggle(MNID_SOUND, _("Sound"), g_config->sound_enabled) ->set_help(_("Disable all sound effects")); @@ -188,7 +191,7 @@ OptionsMenu::OptionsMenu() add_inactive(MNID_SOUND, _("Sound (disabled)")); add_inactive(MNID_MUSIC, _("Music (disabled)")); } - + add_submenu(_("Setup Keyboard"), MenuStorage::KEYBOARD_MENU) ->set_help(_("Configure key-action mappings")); @@ -230,7 +233,7 @@ OptionsMenu::menu_action(MenuItem* item) case MNID_MAGNIFICATION: if (item->list[item->selected] == _("auto")) { - g_config->magnification = 0.0f; // Magic value + g_config->magnification = 0.0f; // Magic value } else if(sscanf(item->list[item->selected].c_str(), "%f", &g_config->magnification) == 1) { @@ -259,7 +262,7 @@ OptionsMenu::menu_action(MenuItem* item) g_config->fullscreen_size.height = height; g_config->fullscreen_refresh_rate = refresh_rate; } - } + } break; case MNID_FULLSCREEN: diff --git a/src/supertux/menu/options_menu.hpp b/src/supertux/menu/options_menu.hpp index 45d1738a6..9980e06f0 100644 --- a/src/supertux/menu/options_menu.hpp +++ b/src/supertux/menu/options_menu.hpp @@ -23,7 +23,7 @@ class OptionsMenu : public Menu { public: - OptionsMenu(); + OptionsMenu(bool complete); virtual ~OptionsMenu(); void menu_action(MenuItem* item); diff --git a/src/supertux/menu/worldmap_menu.cpp b/src/supertux/menu/worldmap_menu.cpp index c20c29abd..f526ee465 100644 --- a/src/supertux/menu/worldmap_menu.cpp +++ b/src/supertux/menu/worldmap_menu.cpp @@ -28,7 +28,7 @@ WorldmapMenu::WorldmapMenu() add_label(_("Pause")); add_hl(); add_entry(MNID_RETURNWORLDMAP, _("Continue")); - add_submenu(_("Options"), MenuStorage::OPTIONS_MENU); + add_submenu(_("Options"), MenuStorage::INGAME_OPTIONS_MENU); add_hl(); add_entry(MNID_QUITWORLDMAP, _("Quit World")); }