Exemple #1
0
void QuestState::_ActiveWindowUpdate()
{
    _menu_mode->_quest_window.Update();
    _menu_mode->_quest_list_window.Update();
    if(!_IsActive())
        _OnCancel();
}
Exemple #2
0
void WorldMapState::_ActiveWindowUpdate()
{
    _menu_mode->_world_map_window.Update();
    if(!_IsActive()) {
        _OnCancel();
        return;
    }

    //draw the current viewing location information
    WorldMapLocation *current_location = _menu_mode->_world_map_window.GetCurrentViewingLocation();
    if(current_location == NULL)
    {
        _location_image = NULL;
        _location_text.ClearText();
        return;
    }
    _location_text.SetDisplayText(current_location->_location_name);
    _location_image = &(current_location->_image);
}
void EquipState::_ActiveWindowUpdate()
{
    _menu_mode->_equip_window.Update();
    if(!_IsActive())
        _OnCancel();
}
Exemple #4
0
void AbstractMenuState::Update()
{
    GlobalMedia& media = GlobalManager->Media();

    // if the current state is set to active, to an active update instead and return
    if(_IsActive())
    {
        _ActiveWindowUpdate();
        return;
    }
    // handle a cancel press. in the case that we are at the main_menu state, pop the ModeManager off
    // the Mode stack as well.
    if(InputManager->CancelPress())
    {
        media.PlaySound("cancel");
        if(_menu_mode->_current_menu_state == &(_menu_mode->_main_menu_state))
            ModeManager->Pop();
        // do instance specific cancel logic
        _OnCancel();
        return;
    }
    // handle left / right option box movement
    else if(InputManager->LeftPress())
    {
        _options.InputLeft();
        return;
    }
    else if(InputManager->RightPress())
    {
        _options.InputRight();
        return;
    }
    // play a sound if the option is selected
    else if(InputManager->ConfirmPress())
    {
        if(_options.IsOptionEnabled((_options.GetSelection())))
            media.PlaySound("confirm");
        _options.InputConfirm();
    }
    // return the event type from the option
    int32 event = _options.GetEvent();
    // update the current option box for this state, thus clearing the event flag
    // if we don't do this, then upon return we enter right back into the state we wanted
    // to return from
    _options.Update();

    if(event == VIDEO_OPTION_CONFIRM) {
        uint32 selection = _options.GetSelection();
        AbstractMenuState *next_state = GetTransitionState(selection);
        // if the next state is the state we came from, it is similar to "cancel"
        if(next_state == _from_state)
        {
            _OnCancel();
            return;
        }
        // otherwise, if the state is valid and not this state itself, handle the transition
        else if(next_state != NULL && next_state != this)
        {
            // change the static current menu state
            _menu_mode->_current_menu_state = next_state;

            next_state->_from_state = this;
            next_state->Reset();
        }
        // When we change the state, update the time immediately to avoid
        // showing outdated or empty time info
        _update_of_time = 0;
    }

    // update the current state
    _OnUpdateState();
    // update the options for the currently active state
    _menu_mode->_current_menu_state->GetOptions()->Update();

    _menu_mode->UpdateTimeAndDrunes();
}