Skip to content

Commit

Permalink
Only show language and profile options in main menu, not when using t…
Browse files Browse the repository at this point in the history
…he options in game
  • Loading branch information
Grumbel committed Aug 9, 2014
1 parent 53ac53e commit 16a0bcb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/supertux/menu/game_menu.cpp
Expand Up @@ -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"));
}
Expand Down
7 changes: 6 additions & 1 deletion src/supertux/menu/menu_storage.cpp
Expand Up @@ -61,7 +61,10 @@ MenuStorage::create(MenuId menu_id)
return std::unique_ptr<Menu>(new LanguageMenu);

case OPTIONS_MENU:
return std::unique_ptr<Menu>(new OptionsMenu);
return std::unique_ptr<Menu>(new OptionsMenu(true));

case INGAME_OPTIONS_MENU:
return std::unique_ptr<Menu>(new OptionsMenu(false));

case PROFILE_MENU:
return std::unique_ptr<Menu>(new ProfileMenu);
Expand Down Expand Up @@ -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);
}

Expand Down
3 changes: 3 additions & 0 deletions src/supertux/menu/menu_storage.hpp
Expand Up @@ -37,6 +37,7 @@ class MenuStorage
NO_MENU,
MAIN_MENU,
OPTIONS_MENU,
INGAME_OPTIONS_MENU,
PROFILE_MENU,
CONTRIB_MENU,
CONTRIB_WORLD_MENU,
Expand All @@ -55,6 +56,8 @@ class MenuStorage
std::unique_ptr<Menu> create(MenuId menu_id);

// FIXME
#ifdef GRUMBEL
#endif
JoystickMenu* get_joystick_options_menu();
KeyboardMenu* get_key_options_menu();

Expand Down
35 changes: 19 additions & 16 deletions src/supertux/menu/options_menu.cpp
Expand Up @@ -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"));

Expand Down Expand Up @@ -93,7 +96,7 @@ OptionsMenu::OptionsMenu()
magn.clear();
break;
}

++count;
}
if (!magn.empty()) //magnification not in our list but accept anyway
Expand All @@ -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)
{
Expand All @@ -129,7 +132,7 @@ OptionsMenu::OptionsMenu()
fullscreen_size_str = out.str();
}
size_t cnt = 0;
for (std::vector<std::string>::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i)
for (std::vector<std::string>::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i)
{
if (*i == fullscreen_size_str)
{
Expand All @@ -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");
Expand Down Expand Up @@ -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"));
Expand All @@ -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"));

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/supertux/menu/options_menu.hpp
Expand Up @@ -23,7 +23,7 @@
class OptionsMenu : public Menu
{
public:
OptionsMenu();
OptionsMenu(bool complete);
virtual ~OptionsMenu();

void menu_action(MenuItem* item);
Expand Down
2 changes: 1 addition & 1 deletion src/supertux/menu/worldmap_menu.cpp
Expand Up @@ -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"));
}
Expand Down

0 comments on commit 16a0bcb

Please sign in to comment.