void SaveMode::_InitSaveSlots() { // Check all available slots for saves and autosaves. bool available_saves = false; // When in load mode, check the saves validity and skip invalid slots _file_list.SetSkipDisabled(true); for (uint32_t i = 0; i < SystemManager->GetGameSaveSlots(); ++i) { _file_list.AddOption(MakeUnicodeString(" " + VTranslate("Slot %d", i + 1))); // Add a key to slots with valid autosaves if (_IsAutoSaveValid(i)) { _file_list.AddOptionElementImage(i, GlobalManager->Media().GetKeyItemIcon()); _file_list.GetEmbeddedImage(i)->SetHeightKeepRatio(25); _file_list.AddOptionElementPosition(i, 30); } if (!_PreviewGame(_BuildSaveFilename(i))) { _file_list.EnableOption(i, false); // If the current selection is disabled, reset it. if (static_cast<int32_t>(i) == _file_list.GetSelection()) _file_list.SetSelection(i + 1); } else { available_saves = true; } } if (!available_saves) _current_state = SAVE_MODE_NO_VALID_SAVES; }
void TreasureSupervisor::_UpdateList() { if(InputManager->CancelPress() || _list_options.GetNumberOptions() == 0) { _selection = ACTION_SELECTED; _action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE); _list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); } else if(InputManager->ConfirmPress()) { _selection = DETAIL_SELECTED; _list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); uint32_t list_selection = _list_options.GetSelection(); if(list_selection == 0 && _treasure->_drunes != 0) { // If true, the drunes have been selected _selection_name.SetText(UTranslate("Drunes")); _selection_icon = GlobalManager->Media().GetDrunesIcon(); _detail_textbox.SetDisplayText(VTranslate("With the additional %u drunes found in this treasure added, " "the party now holds a total of %u drunes.", _treasure->_drunes, GlobalManager->GetDrunes())); _is_key_item = false; } else { // Otherwise, a GlobalObject is selected if(_treasure->_drunes != 0) list_selection--; _selection_name.SetText(_treasure->_items_list[list_selection]->GetName()); _is_key_item = _treasure->_items_list[list_selection]->IsKeyItem(); // TODO: this is not good practice. We should probably either remove the const status from the GetIconImage() call _selection_icon = const_cast<StillImage *>(&_treasure->_items_list[list_selection]->GetIconImage()); _detail_textbox.SetDisplayText(_treasure->_items_list[list_selection]->GetDescription()); } } else if(InputManager->UpPress()) { if(_list_options.GetSelection() == 0) { _selection = ACTION_SELECTED; _action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE); _list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); } else { _list_options.InputUp(); } } else if(InputManager->DownPress()) { if(static_cast<uint32_t>(_list_options.GetSelection()) == (_list_options.GetNumberOptions() - 1)) { _selection = ACTION_SELECTED; _action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE); _list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); } else { _list_options.InputDown(); } } }
void BootMode::_SetupMainMenu() { _main_menu.ClearOptions(); _main_menu.SetPosition(512.0f, 688.0f); _main_menu.SetTextStyle(TextStyle("title24")); _main_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _main_menu.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _main_menu.SetSelectMode(VIDEO_SELECT_SINGLE); _main_menu.SetHorizontalWrapMode(VIDEO_WRAP_MODE_STRAIGHT); _main_menu.SetCursorOffset(-50.0f, -28.0f); _main_menu.SetSkipDisabled(true); _main_menu.AddOption(UTranslate("New Game"), &BootMode::_OnNewGame); _main_menu.AddOption(UTranslate("Load Game"), &BootMode::_OnLoadGame); _main_menu.AddOption(UTranslate("Options"), &BootMode::_OnOptions); // Insert the debug options #ifdef DEBUG_FEATURES _main_menu.SetDimensions(1000.0f, 50.0f, 7, 1, 7, 1); _main_menu.AddOption(UTranslate("Battle"), &BootMode::_DEBUG_OnBattle); _main_menu.AddOption(UTranslate("Menu"), &BootMode::_DEBUG_OnMenu); _main_menu.AddOption(UTranslate("Shop"), &BootMode::_DEBUG_OnShop); #else _main_menu.SetDimensions(800.0f, 50.0f, 4, 1, 4, 1); #endif _main_menu.AddOption(UTranslate("Quit"), &BootMode::_OnQuit); if(!_SavesAvailable()) { _main_menu.EnableOption(1, false); _main_menu.SetSelection(0); } else { _main_menu.SetSelection(1); } _f1_help_text.SetText(VTranslate("Press '%s' to get to know about the game keys.", InputManager->GetHelpKeyName())); }
void BootMode::_SetupMainMenu() { _main_menu.ClearOptions(); _main_menu.SetPosition(512.0f, 688.0f); _main_menu.SetTextStyle(TextStyle("title24")); _main_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _main_menu.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _main_menu.SetSelectMode(VIDEO_SELECT_SINGLE); _main_menu.SetHorizontalWrapMode(VIDEO_WRAP_MODE_STRAIGHT); _main_menu.SetCursorOffset(-50.0f, -28.0f); _main_menu.SetSkipDisabled(true); _main_menu.AddOption(UTranslate("New Game")); _main_menu.AddOption(UTranslate("Load Game")); _main_menu.AddOption(UTranslate("Options")); // Insert the debug options #ifdef DEBUG_FEATURES _main_menu.SetDimensions(1000.0f, 50.0f, 5, 1, 5, 1); _main_menu.AddOption(vt_utils::MakeUnicodeString("Debug scripts")); if (_debug_scripts.empty()) _main_menu.EnableOption(3, false); #else _main_menu.SetDimensions(800.0f, 50.0f, 4, 1, 4, 1); #endif _main_menu.AddOption(UTranslate("Quit")); if(_GetNbSavesAvailable() == 0) { _main_menu.EnableOption(1, false); _main_menu.SetSelection(0); } else { _main_menu.SetSelection(1); } _f1_help_text.SetText(VTranslate("Press '%s' to get to know about the game keys.", InputManager->GetHelpKeyName())); }
void HelpWindow::_RefreshText() { _text_header.Clear(); _key_table_header.ClearOptions(); _key_table.ClearOptions(); _text_additional.Clear(); _text_continue.Clear(); // Common text _text_continue.SetStyle(TextStyle("title24")); _text_continue.SetText(VTranslate("Press '%s' anytime to show/hide help.", vt_input::InputManager->GetHelpKeyName())); uint8_t game_type = ModeManager->GetGameType(); if(game_type == MODE_MANAGER_BOOT_MODE) { _text_header.SetStyle(TextStyle("text24")); _text_header.SetText(UTranslate("Welcome to Valyria Tear")); _key_table_header.SetPosition(50.0f, 128.0f); _key_table_header.SetDimensions(600.0f, 30.0f, 3, 1, 3, 1); _key_table_header.SetTextStyle(TextStyle("title24")); _key_table_header.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table_header.AddOption(UTranslate("Command")); _key_table_header.AddOption(UTranslate("Current Key")); _key_table_header.AddOption(UTranslate("Purpose")); _key_table.SetPosition(50.0f, 168.0f); _key_table.SetDimensions(600.0f, 380.0f, 3, 12, 3, 12); _key_table.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetTextStyle(TextStyle("text22")); _key_table.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table.AddOption(UTranslate("Left")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetLeftKeyName())); _key_table.AddOption(UTranslate("Move menu cursor to the left")); _key_table.AddOption(UTranslate("Right")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetRightKeyName())); _key_table.AddOption(UTranslate("Move menu cursor to the right")); _key_table.AddOption(UTranslate("Confirm")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetConfirmKeyName())); _key_table.AddOption(UTranslate("Confirm a menu command")); _key_table.AddOption(UTranslate("Cancel")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetCancelKeyName())); _key_table.AddOption(UTranslate("Cancel a menu command")); // Note for later: For 'quit', only show the keyboard key as the joystick won't make the game quit. _key_table.AddOption(UTranslate("Quit")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetQuitKeyName())); _key_table.AddOption(UTranslate("Quit the application\n(when using the keyboard)")); return; } else if(game_type == MODE_MANAGER_SHOP_MODE) { _text_header.SetStyle(TextStyle("text22")); _text_header.SetText(UTranslate("Shop mode\n\n" "Use the Left/Right keys to add/remove items into the Buy and Sell modes.\n" "Then go into the Confirm mode to complete the transaction.")); _key_table_header.SetPosition(50.0f, 128.0f); _key_table_header.SetDimensions(600.0f, 30.0f, 3, 1, 3, 1); _key_table_header.SetTextStyle(TextStyle("title24")); _key_table_header.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table_header.AddOption(UTranslate("Command")); _key_table_header.AddOption(UTranslate("Current Key")); _key_table_header.AddOption(UTranslate("Purpose")); _key_table.SetPosition(50.0f, 168.0f); _key_table.SetDimensions(600.0f, 380.0f, 3, 12, 3, 12); _key_table.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetTextStyle(TextStyle("text22")); _key_table.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table.AddOption(UTranslate("Left")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetLeftKeyName())); _key_table.AddOption(UTranslate("Remove an item from the buy/sell list")); _key_table.AddOption(UTranslate("Right")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetRightKeyName())); _key_table.AddOption(UTranslate("Add an item to the buy/sell list.")); _key_table.AddOption(UTranslate("Up")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetUpKeyName())); _key_table.AddOption(UTranslate("Move up in the item list.")); _key_table.AddOption(UTranslate("Down")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetDownKeyName())); _key_table.AddOption(UTranslate("Move down in the item list.")); _key_table.AddOption(UTranslate("Confirm")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetConfirmKeyName())); _key_table.AddOption(UTranslate("Show details or confirm a transaction")); _key_table.AddOption(UTranslate("Menu")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetMenuKeyName())); _key_table.AddOption(UTranslate("Change the displayed item category.")); _key_table.AddOption(UTranslate("Cancel")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetCancelKeyName())); _key_table.AddOption(UTranslate("Get out the Buy/Sell/Confirm mode,\nor quit the shop.")); _key_table.AddOption(); // Spacer _key_table.AddOption(); _key_table.AddOption(); _key_table.AddOption(UTranslate("Pause")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetPauseKeyName())); _key_table.AddOption(UTranslate("Pauses the game")); _key_table.AddOption(UTranslate("Quit")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetQuitKeyName())); _key_table.AddOption(UTranslate("Close this window / Show the system menu")); return; } // MODE_MANAGER_DUMMY_MODE text _text_header.SetStyle(TextStyle("text20")); _text_header.SetText(UTranslate("The table below lists the default game controls.\n") + UTranslate("The control mappings can be changed in the options menu.")); _key_table_header.SetPosition(50.0f, 128.0f); _key_table_header.SetDimensions(600.0f, 30.0f, 3, 1, 3, 1); _key_table_header.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table_header.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table_header.SetTextStyle(TextStyle("title24")); _key_table_header.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table_header.AddOption(UTranslate("Command")); _key_table_header.AddOption(UTranslate("Default Key")); _key_table_header.AddOption(UTranslate("General Purpose")); _key_table.SetPosition(50.0f, 168.0f); _key_table.SetDimensions(600.0f, 380.0f, 3, 12, 3, 12); _key_table.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP); _key_table.SetTextStyle(TextStyle("text22")); _key_table.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN); _key_table.AddOption(UTranslate("Up")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetUpKeyName())); _key_table.AddOption(UTranslate("Move position or cursor upwards")); _key_table.AddOption(UTranslate("Down")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetDownKeyName())); _key_table.AddOption(UTranslate("Move position or cursor downwards")); _key_table.AddOption(UTranslate("Left")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetLeftKeyName())); _key_table.AddOption(UTranslate("Move position or cursor to the left")); _key_table.AddOption(UTranslate("Right")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetRightKeyName())); _key_table.AddOption(UTranslate("Move position or cursor to the right")); _key_table.AddOption(UTranslate("Confirm")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetConfirmKeyName())); _key_table.AddOption(UTranslate("Confirm an action or menu command")); _key_table.AddOption(UTranslate("Cancel")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetCancelKeyName())); _key_table.AddOption(UTranslate("Cancel an action or menu command")); if (game_type != MODE_MANAGER_MENU_MODE && game_type != MODE_MANAGER_BATTLE_MODE) { _key_table.AddOption(UTranslate("Menu")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetMenuKeyName())); _key_table.AddOption(UTranslate("Opens the party menu")); } else if (game_type == MODE_MANAGER_BATTLE_MODE) { _key_table.AddOption(UTranslate("Menu")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetMenuKeyName())); _key_table.AddOption(UTranslate("Show/Hide items and skills descriptions.")); } _key_table.AddOption(UTranslate("Pause")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetPauseKeyName())); _key_table.AddOption(UTranslate("Pauses the game")); _key_table.AddOption(UTranslate("Quit")); _key_table.AddOption(UTranslate(vt_input::InputManager->GetQuitKeyName())); _key_table.AddOption(UTranslate("Quit the application")); _text_additional.SetStyle(TextStyle("text20")); _text_additional.SetText(UTranslate("There are additional commands available which can be found in the MANUAL file.")); }
SaveMode::SaveMode(bool save_mode, uint32_t x_position, uint32_t y_position) : GameMode(MODE_MANAGER_SAVE_MODE), _current_state(SAVE_MODE_LOADING), _dim_color(0.35f, 0.35f, 0.35f, 1.0f), // A grayish opaque color _x_position(x_position), _y_position(y_position), _save_mode(save_mode) { _window.Create(600.0f, 500.0f); _window.SetPosition(212.0f, 138.0f); _window.Hide(); _left_window.Create(150.0f, 500.0f); _left_window.SetPosition(212.0f, 138.0f); _left_window.Show(); _title_window.Create(600.0f, 50.0f); _title_window.SetPosition(212.0f, 88.0f); _title_window.Show(); const float centered_text_xpos = _window.GetXPosition() + 50.0f; const float centered_text_width = _window.GetWidth() - 100.f; // Initialize the save successful message box _title_textbox.SetPosition(centered_text_xpos, 103.0f); _title_textbox.SetDimensions(centered_text_width, 50.0f); _title_textbox.SetTextStyle(TextStyle("title22")); _title_textbox.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _title_textbox.SetTextAlignment(VIDEO_X_CENTER, VIDEO_Y_BOTTOM); if(_save_mode) _title_textbox.SetDisplayText(UTranslate("Save Game")); else _title_textbox.SetDisplayText(UTranslate("Load Game")); for(uint32_t i = 0; i < CHARACTERS_SHOWN_SLOTS; ++i) { _character_window[i].Create(450.0f, 100.0f); _character_window[i].Show(); } _character_window[0].SetPosition(355.0f, 138.0f); _character_window[1].SetPosition(355.0f, 238.0f); _character_window[2].SetPosition(355.0f, 338.0f); _character_window[3].SetPosition(355.0f, 438.0f); // Initialize the save options box _file_list.SetPosition(315.0f, 384.0f); _file_list.SetDimensions(150.0f, 500.0f, 1, SystemManager->GetGameSaveSlots(), 1, SystemManager->GetGameSaveSlots() > 6 ? 6 : SystemManager->GetGameSaveSlots()); _file_list.SetTextStyle(TextStyle("title22")); _file_list.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _file_list.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _file_list.SetSelectMode(VIDEO_SELECT_SINGLE); _file_list.SetCursorOffset(-58.0f, -18.0f); // Initialize the confirmation option box _confirm_save_optionbox.SetPosition(512.0f, 384.0f); _confirm_save_optionbox.SetDimensions(centered_text_width, 200.0f, 1, 2, 1, 2); _confirm_save_optionbox.SetTextStyle(TextStyle("title22")); _confirm_save_optionbox.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _confirm_save_optionbox.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _confirm_save_optionbox.SetSelectMode(VIDEO_SELECT_SINGLE); _confirm_save_optionbox.SetCursorOffset(-58.0f, -18.0f); _confirm_save_optionbox.AddOption(UTranslate("Confirm Save")); _confirm_save_optionbox.AddOption(UTranslate("Cancel")); _confirm_save_optionbox.SetSelection(0); // Initialize the auto-save option box _load_auto_save_optionbox.SetPosition(512.0f, 384.0f); _load_auto_save_optionbox.SetDimensions(centered_text_width, 200.0f, 1, 3, 1, 3); _load_auto_save_optionbox.SetTextStyle(TextStyle("title22")); _load_auto_save_optionbox.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _load_auto_save_optionbox.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _load_auto_save_optionbox.SetSelectMode(VIDEO_SELECT_SINGLE); _load_auto_save_optionbox.SetCursorOffset(-58.0f, -18.0f); _load_auto_save_optionbox.AddOption(UTranslate("Load Auto-Save")); _load_auto_save_optionbox.AddOption(UTranslate("Load Save")); _load_auto_save_optionbox.AddOption(UTranslate("Cancel")); _load_auto_save_optionbox.SetSelection(0); // Initialize the save successful message box _save_success_message.SetPosition(centered_text_xpos, 314.0f); _save_success_message.SetDimensions(centered_text_width, 100.0f); _save_success_message.SetTextStyle(TextStyle("title22")); _save_success_message.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _save_success_message.SetTextAlignment(VIDEO_X_CENTER, VIDEO_Y_BOTTOM); _save_success_message.SetDisplayText(UTranslate("Save successful!")); // Initialize the save failure message box _save_failure_message.SetPosition(centered_text_xpos, 314.0f); _save_failure_message.SetDimensions(centered_text_width, 100.0f); _save_failure_message.SetTextStyle(TextStyle("title22")); _save_failure_message.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _save_failure_message.SetTextAlignment(VIDEO_X_CENTER, VIDEO_Y_BOTTOM); _save_failure_message.SetDisplayText(UTranslate("Unable to save game!\nSave FAILED!")); _no_valid_saves_message.SetPosition(centered_text_xpos, 314.0f); _no_valid_saves_message.SetDimensions(centered_text_width, 100.0f); _no_valid_saves_message.SetTextStyle(TextStyle("title22")); _no_valid_saves_message.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _no_valid_saves_message.SetTextAlignment(VIDEO_X_CENTER, VIDEO_Y_BOTTOM); _no_valid_saves_message.SetDisplayText(UTranslate("No valid saves found!")); // Initialize the save preview text boxes _map_name_textbox.SetPosition(600.0f, 558.0f); _map_name_textbox.SetDimensions(320.0f, 26.0f); _map_name_textbox.SetTextStyle(TextStyle("title22")); _map_name_textbox.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _map_name_textbox.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _map_name_textbox.SetDisplayText(" "); _time_textbox.SetPosition(600.0f, 583.0f); _time_textbox.SetDimensions(250.0f, 26.0f); _time_textbox.SetTextStyle(TextStyle("title22")); _time_textbox.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _time_textbox.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _time_textbox.ClearText(); _drunes_textbox.SetPosition(600.0f, 613.0f); _drunes_textbox.SetDimensions(250.0f, 26.0f); _drunes_textbox.SetTextStyle(TextStyle("title22")); _drunes_textbox.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER); _drunes_textbox.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER); _drunes_textbox.ClearText(); _clock_icon = vt_global::GlobalManager->Media().GetClockIcon(); _clock_icon->SetWidthKeepRatio(30.0f); _drunes_icon = vt_global::GlobalManager->Media().GetDrunesIcon(); _drunes_icon->SetWidthKeepRatio(30.0f); if(_save_mode) { for (uint32_t i = 0; i < SystemManager->GetGameSaveSlots(); ++i) { _file_list.AddOption(MakeUnicodeString(VTranslate("Slot %d", i + 1))); } // Restore the cursor position to the last load/save position. uint32_t game_slot_id = GlobalManager->GetGameSlotId(); // Propose the first slot when none where chosen yet if (game_slot_id == std::numeric_limits<uint32_t>::max()) game_slot_id = 0; _file_list.SetSelection(game_slot_id); _current_state = SAVE_MODE_SAVING; } else { _InitSaveSlots(); } _window.Show(); // Load the first slot data if(_file_list.GetSelection() > -1) _PreviewGame(_BuildSaveFilename(_file_list.GetSelection())); }