Exemple #1
0
MainMenuState::MainMenuState(MenuMode *menu_mode):
    AbstractMenuState("Main Menu", menu_mode)
{
    // Setup the main options box
    SetupOptionBoxCommonSettings(&_options);
    _options.SetDimensions(745.0f, 50.0f, MAIN_OPTIONS_SIZE, 1, MAIN_OPTIONS_SIZE, 1);

    // Generate the strings
    std::vector<ustring> options;
    options.push_back(UTranslate("Inventory")); // 0
    options.push_back(UTranslate("Skills")); // 1
    options.push_back(UTranslate("Party")); // 2
    options.push_back(UTranslate("Quests")); // 3
    options.push_back(UTranslate("Map")); // 4

    // Add strings and set default selection.
    _options.SetOptions(options);
    _options.SetSelection(MAIN_OPTIONS_INVENTORY);
    _options.SetSkipDisabled(true);

    // Deactivate menus with empy content
    if (GlobalManager->GetActiveQuestIds().empty())
        _options.EnableOption(3, false);

    if (GlobalManager->GetWorldMapFilename().empty())
        _options.EnableOption(4, false);
}
Exemple #2
0
TradeInterface::TradeInterface() :
    _view_mode(SHOP_VIEW_MODE_INVALID),
    _selected_object(NULL),
    _trade_deal_types(0),
    _current_category(0)
{
    _category_header.SetStyle(TextStyle("title24"));
    _category_header.SetText(UTranslate("Category"));

    _name_header.SetStyle(TextStyle("title24"));
    _name_header.SetText(UTranslate("Name"));

    _properties_header.SetDimensions(300.0f, 30.0f, 3, 1, 3, 1);
    _properties_header.SetOptionAlignment(VIDEO_X_RIGHT, VIDEO_Y_CENTER);
    _properties_header.SetTextStyle(TextStyle("title24"));
    _properties_header.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);
    _properties_header.AddOption(UTranslate("Price"));
    _properties_header.AddOption(UTranslate("Stock"));
    _properties_header.AddOption(UTranslate("Own"));

    _selected_name.SetStyle(TextStyle("text22"));

    _selected_properties.SetOwner(ShopMode::CurrentInstance()->GetBottomWindow());
    _selected_properties.SetPosition(480.0f, 70.0f);
    _selected_properties.SetDimensions(300.0f, 30.0f, 3, 1, 3, 1);
    _selected_properties.SetOptionAlignment(VIDEO_X_RIGHT, VIDEO_Y_CENTER);
    _selected_properties.SetTextStyle(TextStyle("text22"));
    _selected_properties.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);
    _selected_properties.AddOption(ustring());
    _selected_properties.AddOption(ustring());
    _selected_properties.AddOption(ustring());
}
void SmallCharacterWindow::SetCharacter(GlobalCharacter* character)
{
    delete _character;
    _character = character;

    if(!_character || _character->GetID() == vt_global::GLOBAL_CHARACTER_INVALID) {
        _character_name.Clear();
        _character_data.Clear();
        _portrait = StillImage();
        return;
    }

    _portrait = character->GetPortrait();
    // Only size up valid portraits
    if(!_portrait.GetFilename().empty())
        _portrait.SetDimensions(100.0f, 100.0f);

    // the characters' name is already translated.
    _character_name.SetText(_character->GetName(), TextStyle("title22"));

    // And the rest of the data
    /// tr: level
    ustring char_data = UTranslate("Lv: ") + MakeUnicodeString(NumberToString(_character->GetExperienceLevel()) + "\n");
    /// tr: hit points
    char_data += UTranslate("HP: ") + MakeUnicodeString(NumberToString(_character->GetHitPoints()) +
                               " / " + NumberToString(_character->GetMaxHitPoints()) + "\n");
    /// tr: skill points
    char_data += UTranslate("SP: ") + MakeUnicodeString(NumberToString(_character->GetSkillPoints()) +
                               " / " + NumberToString(_character->GetMaxSkillPoints()));

    _character_data.SetText(char_data, TextStyle("text20"));
}
ustring BattleTarget::GetName()
{
    switch(_type) {
    default:
        return UTranslate("[Invalid Target]");

    case GLOBAL_TARGET_SELF_POINT:
    case GLOBAL_TARGET_ALLY_POINT:
    case GLOBAL_TARGET_FOE_POINT:
        return (_actor_target->GetName() + UTranslate(" — ") + (_actor_target->GetAttackPoints()).at(_attack_point)->GetName());

    case GLOBAL_TARGET_SELF:
    case GLOBAL_TARGET_ALLY:
    case GLOBAL_TARGET_ALLY_EVEN_DEAD:
    case GLOBAL_TARGET_DEAD_ALLY_ONLY:
    case GLOBAL_TARGET_FOE:
        return _actor_target->GetName();

    case GLOBAL_TARGET_ALL_ALLIES:
        return UTranslate("All Allies");

    case GLOBAL_TARGET_ALL_FOES:
        return UTranslate("All Enemies");
    }
}
Exemple #5
0
void PauseMode::_SetupOptions()
{
    _quit_options.ClearOptions();
    _quit_options.AddOption(UTranslate("Cancel"));
    _quit_options.AddOption(UTranslate("Options"));
    _quit_options.AddOption(UTranslate("Quit to Main Menu"));
    _quit_options.AddOption(UTranslate("Quit Game"));
    _quit_options.SetSelection(QUIT_CANCEL);
}
Exemple #6
0
void SaveMode::_ClearSaveData(bool selected_file_exists)
{
    if (selected_file_exists)
        _map_name_textbox.SetDisplayText(UTranslate("Invalid data!"));
    else
        _map_name_textbox.SetDisplayText(UTranslate("No data"));
    _time_textbox.SetDisplayText(" ");
    _drunes_textbox.SetDisplayText(" ");
    _location_image.Clear();
    for (uint32 i = 0; i < 4; ++i)
        _character_window[i].SetCharacter(NULL);
}
void SaveMode::_ClearSaveData(bool selected_file_exists)
{
    if (selected_file_exists) {
        _map_name_textbox.SetDisplayText(UTranslate("Invalid data!"));
    } else {
        // tr: A slot for saving the same
        _map_name_textbox.SetDisplayText(UTranslate("This slot is unused"));
    }
    _time_textbox.ClearText();
    _drunes_textbox.ClearText();
    _location_image.Clear();
    for (uint32_t i = 0; i < CHARACTERS_SHOWN_SLOTS; ++i)
        _character_window[i].SetCharacter(nullptr);
}
TreasureSupervisor::TreasureSupervisor() :
    _treasure(nullptr),
    _selection(ACTION_SELECTED),
    _window_title(UTranslate("You obtain"), TextStyle("title24", Color::white, VIDEO_TEXT_SHADOW_DARK, 1, -2)),
    _selection_name(),
    _selection_icon(nullptr),
    _is_key_item(false)
{
    // Create the menu windows and option boxes used for the treasure menu and
    // align them at the appropriate locations on the screen
    _action_window.Create(768.0f, 64.0f, ~VIDEO_MENU_EDGE_BOTTOM);
    _action_window.SetPosition(512.0f, 460.0f);
    _action_window.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_TOP);

    _list_window.Create(768.0f, 236.0f);
    _list_window.SetPosition(512.0f, 516.0f);
    _list_window.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_TOP);

    _action_options.SetPosition(30.0f, 18.0f);
    _action_options.SetDimensions(726.0f, 32.0f, 1, 1, 1, 1);
    _action_options.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
    _action_options.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _action_options.SetHorizontalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _action_options.SetSelectMode(VIDEO_SELECT_SINGLE);
    _action_options.SetCursorOffset(-50.0f, -25.0f);
    _action_options.SetTextStyle(TextStyle("title22", Color::white, VIDEO_TEXT_SHADOW_DARK, 1, -2));
    _action_options.AddOption(UTranslate("Ok"));
    _action_options.SetSelection(0);
    _action_options.SetOwner(&_action_window);

    _list_options.SetPosition(20.0f, 20.0f);
    _list_options.SetDimensions(726.0f, 200.0f, 1, 255, 1, 5);
    _list_options.SetAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
    _list_options.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER);
    _list_options.SetVerticalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _list_options.SetSelectMode(VIDEO_SELECT_SINGLE);
    _list_options.SetCursorOffset(-50.0f, -25.0f);
    _list_options.SetTextStyle(TextStyle("text22", Color::white, VIDEO_TEXT_SHADOW_DARK, 1, -2));
    _list_options.SetOwner(&_list_window);

    _detail_textbox.SetPosition(20.0f, 90.0f);
    _detail_textbox.SetDimensions(726.0f, 128.0f);
    _detail_textbox.SetDisplaySpeed(SystemManager->GetMessageSpeed());
    _detail_textbox.SetTextStyle(TextStyle("text22", Color::white, VIDEO_TEXT_SHADOW_DARK, 1, -2));
    _detail_textbox.SetDisplayMode(VIDEO_TEXT_REVEAL);
    _detail_textbox.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
    _detail_textbox.SetOwner(&_list_window);

    _selection_name.SetStyle(TextStyle("text22", Color::white, VIDEO_TEXT_SHADOW_DARK, 1, -2));
} // TreasureSupervisor::TreasureSupervisor()
Exemple #9
0
void BootMode::_ShowMessageWindow(WAIT_FOR wait)
{
    if(wait == WAIT_JOY_BUTTON)
        _message_window.SetText(UTranslate("Please press a new joystick button."));
    else if(wait == WAIT_KEY)
        _message_window.SetText(UTranslate("Please press a new key."));
    else if(wait == WAIT_JOY_AXIS)
        _message_window.SetText(UTranslate("Please move an axis."));
    else {
        PRINT_WARNING << "Undefined wait value." << std::endl;
        return;
    }

    _message_window.Show();
}
Exemple #10
0
void SkillsState::Reset()
{
    // Setup the option box
    SetupOptionBoxCommonSettings(&_options);
    _options.SetDimensions(415.0f, 50.0f, SKILLS_OPTIONS_SIZE, 1, SKILLS_OPTIONS_SIZE, 1);

    // Generate the strings
    std::vector<ustring> options;
    options.push_back(UTranslate("Use"));
    options.push_back(UTranslate("Back"));

    // Add strings and set default selection.
    _options.SetOptions(options);
    _options.SetSelection(SKILLS_OPTIONS_USE);
}
Exemple #11
0
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 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 = &_drunes_icon;
			_detail_textbox.SetDisplayText(UTranslate("With the additional ") + MakeUnicodeString(NumberToString(_treasure->_drunes)) +
			UTranslate(" drunes found in this treasure added, the party now holds a total of ") + MakeUnicodeString(NumberToString(GlobalManager->GetDrunes()))
			+ MakeUnicodeString(" drunes."));
		}
		else { // Otherwise, a GlobalObject is selected
			if (_treasure->_drunes != 0)
				list_selection--;
			_selection_name.SetText(_treasure->_objects_list[list_selection]->GetName());
			// TODO: this is not good practice. We should probably either remove the const status from the GetIconImage() call
			_selection_icon = const_cast<StillImage*>(&_treasure->_objects_list[list_selection]->GetIconImage());
			_detail_textbox.SetDisplayText(_treasure->_objects_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>(_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();
		}
	}
}
Exemple #12
0
PauseMode::PauseMode(bool quit_state, bool pause_audio) :
    GameMode(MODE_MANAGER_PAUSE_MODE),
    _quit_state(quit_state),
    _audio_paused(pause_audio),
    _music_volume(1.0f),
    _dim_color(0.35f, 0.35f, 0.35f, 1.0f), // A grayish opaque color
    _option_selected(false),
    _options_handler(this)
{
    // Save a copy of the current screen to use as the backdrop.
    try {
        _screen_capture = VideoManager->CaptureScreen();
    }
    catch (const Exception &e) {
        IF_PRINT_WARNING(PAUSE_DEBUG) << e.ToString() << std::endl;
    }

    // Render the paused string in white text
    _paused_text.SetStyle(TextStyle("title28", Color::white, VIDEO_TEXT_SHADOW_BLACK));
    _paused_text.SetText(UTranslate("Paused"));

    // Initialize the quit options box
    _quit_options.SetPosition(512.0f, 384.0f);
    _quit_options.SetDimensions(220.0f, 300.0f, 1, 4, 1, 4);
    _quit_options.SetTextStyle(TextStyle("title24", Color::white, VIDEO_TEXT_SHADOW_BLACK));

    _quit_options.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _quit_options.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _quit_options.SetSelectMode(VIDEO_SELECT_SINGLE);
    _quit_options.SetCursorOffset(-58.0f, -18.0f);

    _SetupOptions();
}
Exemple #13
0
void BootMode::_SetupJoySettingsMenu()
{
    _joy_settings_menu.ClearOptions();
    _joy_settings_menu.SetPosition(512.0f, 468.0f);
    _joy_settings_menu.SetDimensions(250.0f, 500.0f, 1, 9, 1, 9);
    _joy_settings_menu.SetTextStyle(TextStyle("title22"));
    _joy_settings_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _joy_settings_menu.SetOptionAlignment(VIDEO_X_LEFT, VIDEO_Y_CENTER);
    _joy_settings_menu.SetSelectMode(VIDEO_SELECT_SINGLE);
    _joy_settings_menu.SetVerticalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _joy_settings_menu.SetCursorOffset(-50.0f, -28.0f);
    _joy_settings_menu.SetSkipDisabled(true);

    ustring dummy;
    _joy_settings_menu.AddOption(dummy, &BootMode::_OnToggleJoystickEnabled, NULL, NULL,
                                 &BootMode::_OnToggleJoystickEnabled, &BootMode::_OnToggleJoystickEnabled);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineXAxisJoy);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineYAxisJoy);
    _joy_settings_menu.AddOption(dummy, NULL, NULL, NULL, &BootMode::_OnThresholdJoyLeft, &BootMode::_OnThresholdJoyRight);

    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineConfirmJoy);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineCancelJoy);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineMenuJoy);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefinePauseJoy);
    _joy_settings_menu.AddOption(dummy, &BootMode::_RedefineQuitJoy);

    _joy_settings_menu.AddOption(UTranslate("Restore defaults"), &BootMode::_OnRestoreDefaultJoyButtons);
}
void TreasureSupervisor::Initialize(MapTreasure *treasure)
{
    if(!treasure) {
        IF_PRINT_WARNING(MAP_DEBUG) << "function argument was nullptr" << std::endl;
        return;
    }
    _treasure = treasure;
    MapMode::CurrentInstance()->PushState(STATE_TREASURE);

    // Construct the object list, including any drunes that were contained within the treasure
    if(_treasure->_drunes != 0) {
        _list_options.AddOption(MakeUnicodeString("<data/inventory/drunes.png>       ") +
                                UTranslate("Drunes") +
                                MakeUnicodeString("<R>" + NumberToString(_treasure->_drunes)));
        GlobalManager->Media().PlaySound("coins");
    } else {
        GlobalManager->Media().PlaySound("item_pickup");
    }

    for(uint32_t i = 0; i < _treasure->_items_list.size(); i++) {
        if(_treasure->_items_list[i]->GetCount() > 1) {
            _list_options.AddOption(MakeUnicodeString("<" + _treasure->_items_list[i]->GetIconImage().GetFilename() + ">       ") +
                                    _treasure->_items_list[i]->GetName() +
                                    MakeUnicodeString("<R>x" + NumberToString(_treasure->_items_list[i]->GetCount())));
        } else {
            _list_options.AddOption(MakeUnicodeString("<" + _treasure->_items_list[i]->GetIconImage().GetFilename() + ">       ") +
                                    _treasure->_items_list[i]->GetName());
        }
    }

    for(uint32_t i = 0; i < _list_options.GetNumberOptions(); i++) {
        _list_options.GetEmbeddedImage(i)->SetDimensions(30.0f, 30.0f);
    }

    _action_options.SetSelection(0);
    _action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE);
    _list_options.SetSelection(0);
    _list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);

    _selection = ACTION_SELECTED;
    _action_window.Show();
    _list_window.Show();

    // Immediately add the drunes and objects to the player's inventory
    GlobalManager->AddDrunes(_treasure->_drunes);

    for(uint32_t i = 0; i < _treasure->_items_list.size(); ++i) {
        GlobalObject *obj = _treasure->_items_list[i];
        if(!obj)
            continue;
        if(!GlobalManager->IsItemInInventory(obj->GetID())) {
            // Pass a copy to the inventory, the treasure object will delete its content on destruction.
            vt_global::GlobalObject *obj_copy = GlobalCreateNewObject(obj->GetID(), obj->GetCount());
            GlobalManager->AddToInventory(obj_copy);
        } else {
            GlobalManager->IncrementItemCount(obj->GetID(), obj->GetCount());
        }
    }
} // void TreasureSupervisor::Initialize(MapTreasure* treasure)
Exemple #15
0
void SaveMode::_ClearSaveData() {
		_map_name_textbox.SetDisplayText(UTranslate("No valid data"));
		_time_textbox.SetDisplayText(" ");
		_drunes_textbox.SetDisplayText(" ");
		for (uint32 i = 0; i < 4; ++i) {
			_character_window[i].SetCharacter(NULL);
		}
}
Exemple #16
0
ustring BattleTarget::GetName() {
	if ((_type == GLOBAL_TARGET_SELF_POINT) || (_type == GLOBAL_TARGET_ALLY_POINT) || (_type == GLOBAL_TARGET_FOE_POINT)) {
		return (_actor->GetName() + UTranslate(" — ") + (_actor->GetAttackPoints()).at(_point)->GetName());
	}
	else if ((_type == GLOBAL_TARGET_SELF) || (_type == GLOBAL_TARGET_ALLY) || (_type == GLOBAL_TARGET_FOE)
			|| (_type == GLOBAL_TARGET_ALLY_EVEN_DEAD)) {
		return _actor->GetName();
	}
	else if (_type == GLOBAL_TARGET_ALL_ALLIES) {
		return UTranslate("All Allies");
	}
	else if (_type == GLOBAL_TARGET_ALL_FOES) {
		return UTranslate("All Enemies");
	}

	return UTranslate("[Invalid Target]");
}
Exemple #17
0
void InventoryState::Reset()
{
    // Setup the option box
    SetupOptionBoxCommonSettings(&_options);
    _options.SetDimensions(555.0f, 50.0f, INV_OPTIONS_SIZE, 1, INV_OPTIONS_SIZE, 1);

    // Generate the strings
    std::vector<ustring> options;
    options.push_back(UTranslate("Items"));
    options.push_back(UTranslate("Equip"));
    options.push_back(UTranslate("Remove"));
    options.push_back(UTranslate("Back"));

    // Add strings and set default selection.
    _options.SetOptions(options);
    _options.SetSelection(INV_OPTIONS_USE);
}
Exemple #18
0
void BootMode::_RefreshJoySettings()
{
    int32 i = 0;
    if(InputManager->GetJoysticksEnabled())
        _joy_settings_menu.SetOptionText(i++, UTranslate("Input enabled: ") + MakeUnicodeString("<r>") +  UTranslate("Yes"));
    else
        _joy_settings_menu.SetOptionText(i++, UTranslate("Input enabled: ") + MakeUnicodeString("<r>") +  UTranslate("No"));

    _joy_settings_menu.SetOptionText(i++, UTranslate("X Axis") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetXAxisJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Y Axis") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetYAxisJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Threshold") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetThresholdJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Confirm: Button") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetConfirmJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Cancel: Button") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetCancelJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Menu: Button") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetMenuJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Pause: Button") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetPauseJoy())));
    _joy_settings_menu.SetOptionText(i++, UTranslate("Quit: Button") + MakeUnicodeString("<r>" + NumberToString(InputManager->GetQuitJoy())));
}
Exemple #19
0
void MainMenuState::_OnDrawMainWindow()
{

    uint32 draw_window = _options.GetSelection();

    // Draw the chosen window
    switch(draw_window) {
        case MAIN_OPTIONS_INVENTORY: {
            AbstractMenuState::_DrawBottomMenu();
            _menu_mode->_inventory_window.Draw();
            break;
        }
        case MAIN_OPTIONS_SKILLS: {
            AbstractMenuState::_DrawBottomMenu();
            _menu_mode->_skills_window.Draw();
            break;
        }
        case MAIN_OPTIONS_QUESTS: {
            static const ustring quest_view_message = UTranslate("Select to view Quest Log.");
            _menu_mode->_bottom_window.Draw();
            _menu_mode->_help_information.SetDisplayText(quest_view_message);
            _menu_mode->_help_information.Draw();
            _menu_mode->_quest_window.Draw();
            break;
        }
        case MAIN_OPTIONS_WORLDMAP:
        {
            static const ustring world_map_window_message = UTranslate("Select to view current world map.\nUse left / right to cycle through locations.\nPress 'cancel' to return");
            _menu_mode->_bottom_window.Draw();
            _menu_mode->_help_information.SetDisplayText(world_map_window_message);
            _menu_mode->_help_information.Draw();
            // actual drawing of thebottom window will occur upon transition
            // to the world map state
            _menu_mode->_world_map_window.Draw();
            break;
        }
        case MAIN_OPTIONS_PARTY:
        default: {
            AbstractMenuState::_DrawBottomMenu();
            _menu_mode->_party_window.Draw();
            break;
        }
    } // switch draw_window

}
Exemple #20
0
RootInterface::RootInterface() {
	// Initialize text properties and set default text where appropriate
	_shop_name.SetStyle(TextStyle("title28"));
	_shop_name.SetText(UTranslate("Shop Name")); // This default name should be overwritten

	_buy_price_text.SetStyle(TextStyle("text22"));
	_buy_price_text.SetText(UTranslate("Buy prices"));
	_sell_price_text.SetStyle(TextStyle("text22"));
	_sell_price_text.SetText(UTranslate("Sell prices"));

	_greeting_text.SetOwner(ShopMode::CurrentInstance()->GetBottomWindow());
	_greeting_text.SetPosition(40.0f, 100.0f);
	_greeting_text.SetDimensions(600.0f, 50.0f);
	_greeting_text.SetTextStyle(TextStyle("text22"));
	_greeting_text.SetDisplayMode(VIDEO_TEXT_INSTANT);
	_greeting_text.SetTextAlignment(VIDEO_X_LEFT, VIDEO_Y_TOP);
	_greeting_text.SetDisplayText(UTranslate("\"Welcome! Take a look around.\"")); // Default greeting, should usually be overwritten
}
Exemple #21
0
void BootMode::_SetupAudioOptionsMenu()
{
    _audio_options_menu.ClearOptions();
    _audio_options_menu.SetPosition(512.0f, 468.0f);
    _audio_options_menu.SetDimensions(300.0f, 200.0f, 1, 2, 1, 2);
    _audio_options_menu.SetTextStyle(TextStyle("title22"));
    _audio_options_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _audio_options_menu.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _audio_options_menu.SetSelectMode(VIDEO_SELECT_SINGLE);
    _audio_options_menu.SetVerticalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _audio_options_menu.SetCursorOffset(-50.0f, -28.0f);
    _audio_options_menu.SetSkipDisabled(true);

    _audio_options_menu.AddOption(UTranslate("Sound Volume: "), NULL, NULL, NULL, &BootMode::_OnSoundLeft, &BootMode::_OnSoundRight);
    _audio_options_menu.AddOption(UTranslate("Music Volume: "), NULL, NULL, NULL, &BootMode::_OnMusicLeft, &BootMode::_OnMusicRight);

    _audio_options_menu.SetSelection(0);
}
Exemple #22
0
// Draw the window to the screen
void SmallCharacterWindow::Draw()
{
    // Call parent Draw method, if failed pass on fail result
    MenuWindow::Draw();

    // check to see if this window is an actual character
    if(_character == NULL)
        return;

    if(_character->GetID() == vt_global::GLOBAL_CHARACTER_INVALID)
        return;

    // Get the window metrics
    float x, y, w, h;
    GetPosition(x, y);
    GetDimensions(w, h);
    // Adjust the current position to make it look better
    y -= 5;

    //Draw character portrait
    VideoManager->Move(x + 50, y + 110);
    _portrait.Draw();

    // Write character name
    VideoManager->MoveRelative(125, -75);
    VideoManager->Text()->Draw(_character->GetName(), TextStyle("title22"));

    // Level
    VideoManager->MoveRelative(0, 20);
    VideoManager->Text()->Draw(UTranslate("Lv: ") + MakeUnicodeString(NumberToString(_character->GetExperienceLevel())), TextStyle("text20"));

    // HP
    VideoManager->MoveRelative(0, 20);
    VideoManager->Text()->Draw(UTranslate("HP: ") + MakeUnicodeString(NumberToString(_character->GetHitPoints()) +
                               " / " + NumberToString(_character->GetMaxHitPoints())), TextStyle("text20"));

    // SP
    VideoManager->MoveRelative(0, 20);
    VideoManager->Text()->Draw(UTranslate("SP: ") + MakeUnicodeString(NumberToString(_character->GetSkillPoints()) +
                               " / " + NumberToString(_character->GetMaxSkillPoints())), TextStyle("text20"));

    return;
}
Exemple #23
0
void BootMode::_RefreshKeySettings()
{
    // Update key names
    _key_settings_menu.SetOptionText(0, UTranslate("Move Up") + MakeUnicodeString("<r>" + InputManager->GetUpKeyName()));
    _key_settings_menu.SetOptionText(1, UTranslate("Move Down") + MakeUnicodeString("<r>" + InputManager->GetDownKeyName()));
    _key_settings_menu.SetOptionText(2, UTranslate("Move Left") + MakeUnicodeString("<r>" + InputManager->GetLeftKeyName()));
    _key_settings_menu.SetOptionText(3, UTranslate("Move Right") + MakeUnicodeString("<r>" + InputManager->GetRightKeyName()));
    _key_settings_menu.SetOptionText(4, UTranslate("Confirm") + MakeUnicodeString("<r>" + InputManager->GetConfirmKeyName()));
    _key_settings_menu.SetOptionText(5, UTranslate("Cancel") + MakeUnicodeString("<r>" + InputManager->GetCancelKeyName()));
    _key_settings_menu.SetOptionText(6, UTranslate("Menu") + MakeUnicodeString("<r>" + InputManager->GetMenuKeyName()));
    _key_settings_menu.SetOptionText(7, UTranslate("Pause") + MakeUnicodeString("<r>" + InputManager->GetPauseKeyName()));
}
void BattleMenu::_RefreshExplanationWindow()
{
    if (_options_selected_list.GetSelection() == AUTOBATTLE_MENU_INDEX) {
        _explanation_window.Show();
        _explanation_window.SetText(UTranslate("When the Auto-Battle mode is activated, your party will auto attack the opponents using default attacks. If you open a command menu, the Auto-Battle mode will be deactivated again."));
    }
    else {
        _explanation_window.Hide();
    }
}
Exemple #25
0
void BootMode::_SetupVideoOptionsMenu()
{
    _video_options_menu.ClearOptions();
    _video_options_menu.SetPosition(512.0f, 468.0f);
    _video_options_menu.SetDimensions(300.0f, 400.0f, 1, 4, 1, 4);
    _video_options_menu.SetTextStyle(TextStyle("title22"));
    _video_options_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _video_options_menu.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _video_options_menu.SetSelectMode(VIDEO_SELECT_SINGLE);
    _video_options_menu.SetVerticalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _video_options_menu.SetCursorOffset(-50.0f, -28.0f);
    _video_options_menu.SetSkipDisabled(true);

    _video_options_menu.AddOption(UTranslate("Resolution:"), &BootMode::_OnResolution);
    // Left & right will change window mode as well as confirm
    _video_options_menu.AddOption(UTranslate("Window mode:"), &BootMode::_OnToggleFullscreen, NULL, NULL, &BootMode::_OnToggleFullscreen, &BootMode::_OnToggleFullscreen);
    _video_options_menu.AddOption(UTranslate("Brightness:"), NULL, NULL, NULL, &BootMode::_OnBrightnessLeft, &BootMode::_OnBrightnessRight);
    _video_options_menu.AddOption(UTranslate("Map tiles: "), &BootMode::_OnTogglePixelArtSmoothed, NULL, NULL, &BootMode::_OnTogglePixelArtSmoothed, &BootMode::_OnTogglePixelArtSmoothed);

    _video_options_menu.SetSelection(0);
}
Exemple #26
0
void BootMode::_SetupOptionsMenu()
{
    _options_menu.ClearOptions();
    _options_menu.SetPosition(512.0f, 468.0f);
    _options_menu.SetDimensions(300.0f, 600.0f, 1, 5, 1, 5);
    _options_menu.SetTextStyle(TextStyle("title22"));
    _options_menu.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _options_menu.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
    _options_menu.SetSelectMode(VIDEO_SELECT_SINGLE);
    _options_menu.SetVerticalWrapMode(VIDEO_WRAP_MODE_STRAIGHT);
    _options_menu.SetCursorOffset(-50.0f, -28.0f);
    _options_menu.SetSkipDisabled(true);

    _options_menu.AddOption(UTranslate("Video"), &BootMode::_OnVideoOptions);
    _options_menu.AddOption(UTranslate("Audio"), &BootMode::_OnAudioOptions);
    _options_menu.AddOption(UTranslate("Language"), &BootMode::_OnLanguageOptions);
    _options_menu.AddOption(UTranslate("Key Settings"), &BootMode::_OnKeySettings);
    _options_menu.AddOption(UTranslate("Joystick Settings"), &BootMode::_OnJoySettings);

    _options_menu.SetSelection(0);
}
Exemple #27
0
void PartyState::Reset()
{
    // Setup the status option box
    SetupOptionBoxCommonSettings(&_options);
    _options.SetDimensions(415.0f, 50.0f, PARTY_OPTIONS_SIZE, 1, PARTY_OPTIONS_SIZE, 1);

    // Generate the strings
    std::vector<ustring> options;
    options.push_back(UTranslate("View/Reorder"));
    options.push_back(UTranslate("Back"));

    // Add strings and set default selection.
    _options.SetOptions(options);
    _options.SetSelection(PARTY_OPTIONS_VIEW_ALTER);

    _menu_mode->_help_information.SetDisplayText(
        UTranslate("View character Information.\nSelect a character to change formation."));

    // Update the current character status at reset, in case of equipment change.
    _menu_mode->_party_window.UpdateStatus();
}
Exemple #28
0
void BootMode::_RefreshVideoOptions()
{
    // Update resolution text
    std::ostringstream resolution("");
    resolution << VideoManager->GetScreenWidth() << " x " << VideoManager->GetScreenHeight();
    _video_options_menu.SetOptionText(0, UTranslate("Resolution: ") + MakeUnicodeString(resolution.str()));

    // Update text on current video mode
    if(VideoManager->IsFullscreen())
        _video_options_menu.SetOptionText(1, UTranslate("Window mode: ") + UTranslate("Fullscreen"));
    else
        _video_options_menu.SetOptionText(1, UTranslate("Window mode: ") + UTranslate("Windowed"));

    // Update brightness
    _video_options_menu.SetOptionText(2, UTranslate("Brightness: ") + MakeUnicodeString(NumberToString(VideoManager->GetGamma() * 50.0f + 0.5f) + " %"));

    // Update the image quality text
    if(VideoManager->ShouldSmoothPixelArt())
        _video_options_menu.SetOptionText(3, UTranslate("Map tiles: ") + UTranslate("Smoothed"));
    else
        _video_options_menu.SetOptionText(3, UTranslate("Map tiles: ") + UTranslate("Normal"));
}
Exemple #29
0
void MenuMode::UpdateTimeAndDrunes()
{
    // Only update the time every 900ms
    _update_of_time -= (int32) vt_system::SystemManager->GetUpdateTime();
    if (_update_of_time > 0)
        return;
    _update_of_time = 900;

    std::ostringstream os_time;
    uint8 hours = SystemManager->GetPlayHours();
    uint8 minutes = SystemManager->GetPlayMinutes();
    uint8 seconds = SystemManager->GetPlaySeconds();
    os_time << (hours < 10 ? "0" : "") << static_cast<uint32>(hours) << ":";
    os_time << (minutes < 10 ? "0" : "") << static_cast<uint32>(minutes) << ":";
    os_time << (seconds < 10 ? "0" : "") << static_cast<uint32>(seconds);

    // TODO: vt_utils::ustring should be able to take const modifiers in its operators....
    static vt_utils::ustring time_ustr_base = UTranslate("Time: ");
    static vt_utils::ustring drunes_ustr_base = UTranslate("Drunes: ");
    _time_text.SetDisplayText(time_ustr_base + MakeUnicodeString(os_time.str()));
    _drunes_text.SetDisplayText(drunes_ustr_base + MakeUnicodeString(NumberToString(GlobalManager->GetDrunes())));
}
Exemple #30
0
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(!_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()));
}