void ScreenJukeboxMenu::MenuStart( PlayerNumber pn ) { if( IsTransitioning() ) return; const Style *style = m_Selector.GetSelectedStyle(); CString sGroup = m_Selector.GetSelectedGroup(); Difficulty dc = m_Selector.GetSelectedDifficulty(); bool bModifiers = m_Selector.GetSelectedModifiers(); GAMESTATE->m_pCurStyle = style; GAMESTATE->m_sPreferredGroup = (sGroup=="ALL MUSIC") ? GROUP_ALL_MUSIC : sGroup; FOREACH_PlayerNumber( p ) GAMESTATE->m_PreferredDifficulty[p] = dc; GAMESTATE->m_bJukeboxUsesModifiers = bModifiers; if( !ScreenJukebox::SetSong(false) ) { /* No songs are available for the selected style, group, and difficulty. */ SCREENMAN->PlayInvalidSound(); SCREENMAN->SystemMessage( "No songs available with these settings" ); return; } SOUND->StopMusic(); SCREENMAN->PlayStartSound(); StartTransitioning( SM_GoToNextScreen ); }
void ScreenSetTime::MenuStart( PlayerNumber pn ) { bool bHoldingLeftAndRight = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ) && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) ); if( bHoldingLeftAndRight ) ChangeSelection( -1 ); else if( m_Selection == NUM_SET_TIME_SELECTIONS -1 ) // last row { /* Save the new time. */ time_t iNow = time(NULL); time_t iAdjusted = iNow + m_TimeOffset; tm adjusted; localtime_r( &iAdjusted, &adjusted ); HOOKS->SetTime( adjusted ); /* We're going to draw a little more while we transition out. We've already * set the new time; don't over-adjust visually. */ m_TimeOffset = 0; SOUND->PlayOnce( THEME->GetPathS("Common","start") ); StartTransitioning( SM_GoToNextScreen ); } else ChangeSelection( +1 ); }
void ScreenTestInput::MenuBack( PlayerNumber pn ) { if(!IsTransitioning()) { SCREENMAN->PlayStartSound(); StartTransitioning( SM_GoToPrevScreen ); } }
void ScreenArcadeDiagnostics::MenuBack( PlayerNumber pn ) { if(!IsTransitioning()) { this->PlayCommand( "Off" ); StartTransitioning( SM_GoToPrevScreen ); } }
void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) { case SM_BeginFadingOut: StartTransitioning( SM_GoToNextScreen ); return; case SM_MenuTimer: MenuStart(PLAYER_1); if( !AllAreFinishedChoosing() ) ResetTimer(); return; } Screen::HandleScreenMessage( SM ); }
/************************************ MenuStart Desc: Actions performed when a player presses the button bound to start ************************************/ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber pn ) { if( GAMESTATE->m_bSideIsJoined[pn] ) // already joined return; // ignore GAMESTATE->m_bSideIsJoined[pn] = true; SCREENMAN->RefreshCreditsMessages(); SCREENMAN->PlayStartSound(); m_sprJoinMessage[pn].SetState( pn+NUM_PLAYERS ); if( FOLD_ON_JOIN ) { m_sprJoinMessage[pn].BeginTweening( 0.25f ); m_sprJoinMessage[pn].SetZoomY( 0 ); m_sprJoinFrame[pn].BeginTweening( 0.25f ); m_sprJoinFrame[pn].SetZoomY( 0 ); } bool bBothSidesJoined = true; FOREACH_PlayerNumber( p ) if( !GAMESTATE->m_bSideIsJoined[p] ) bBothSidesJoined = false; if( bBothSidesJoined ) { TweenOffScreen(); StartTransitioning( SM_GoToNextScreen ); } else { // give the other player a little time to join m_MenuTimer->SetSeconds( 1 ); m_MenuTimer->Start(); m_MenuTimer->EnableStealth( SILENT_WAIT ); // do we wanna make the timer 'quiet' ? } }
/************************************ HandleScreenMessage Desc: Handles Screen Messages and changes game states. ************************************/ void ScreenEz2SelectPlayer::HandleScreenMessage( const ScreenMessage SM ) { Screen::HandleScreenMessage( SM ); switch( SM ) { case SM_MenuTimer: if( GAMESTATE->GetNumSidesJoined() == 0 ) { MenuStart(PLAYER_1); } TweenOffScreen(); StartTransitioning( SM_GoToNextScreen ); break; case SM_GoToPrevScreen: SOUND->StopMusic(); SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); break; case SM_GoToNextScreen: SCREENMAN->SetNewScreen( NEXT_SCREEN ); break; } }
void ScreenJukeboxMenu::MenuBack( PlayerNumber pn ) { StartTransitioning( SM_GoToPrevScreen ); SOUND->StopMusic(); }
void ScreenSetTime::MenuBack( PlayerNumber pn ) { StartTransitioning( SM_GoToPrevScreen ); }
void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT ) return; // ignore LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d", DeviceI.device, DeviceI.button ); int button = DeviceI.button; #ifdef _XBOX if(!m_iWaitingForPress && DeviceI.device == DEVICE_JOY1) { // map the xbox controller buttons to the keyboard equivalents if(DeviceI.button == JOY_HAT_LEFT) button = KEY_LEFT; else if(DeviceI.button == JOY_HAT_RIGHT) button = KEY_RIGHT; else if(DeviceI.button == JOY_HAT_UP) button = KEY_UP; else if(DeviceI.button == JOY_HAT_DOWN) button = KEY_DOWN; else if(DeviceI.button == JOY_AUX_1) button = KEY_ENTER; else if(DeviceI.button == JOY_AUX_2) button = KEY_ESC; else if(DeviceI.button == JOY_1 || DeviceI.button == JOY_2 || DeviceI.button == JOY_3 || DeviceI.button == JOY_4) button = KEY_DEL; } #endif // // TRICKY: Some adapters map the PlayStation digital d-pad to both axes and // buttons. We want buttons to be used for any mappings where possible because // presses of buttons aren't mutually exclusive and presses of axes are (e.g. // can't read presses of both Left and Right simultaneously). So, when the user // presses a button, we'll wait until the next Update before adding a mapping so // that we get a chance to see all input events the user's press of a panel. // Prefer non-axis events over axis events. // if( m_iWaitingForPress ) { /* Don't allow function keys to be mapped. */ if ( DeviceI.device == DEVICE_KEYBOARD && (DeviceI.button >= KEY_F1 && DeviceI.button <= KEY_F12) ) { m_textError.SetText( "That key can not be mapped." ); SCREENMAN->PlayInvalidSound(); m_textError.StopTweening(); m_textError.SetDiffuse( RageColor(0,1,0,1) ); m_textError.BeginTweening( 3 ); m_textError.BeginTweening( 1 ); m_textError.SetDiffuse( RageColor(0,1,0,0) ); } else { if( m_DeviceIToMap.IsValid() && !IsAxis(m_DeviceIToMap) && IsAxis(DeviceI) ) { LOG->Trace("Ignored input; non-axis event already received"); return; // ignore this press } m_DeviceIToMap = DeviceI; } } #ifdef _XBOX else if( DeviceI.device == DEVICE_JOY1 ) #else else if( DeviceI.device == DEVICE_KEYBOARD ) #endif { switch( button ) { /* We only advertise space as doing this, but most games * use either backspace or delete, and I find them more * intuitive, so allow them, too. -gm */ /* XXX: For some reason that eludes me, this function gets sent an * KEY_SPACE button press every time the JOY_HAT_UP button is pressed. * Had to put this in to prevent mappings being erased everytime the user * pressed up on the joypad. */ case KEY_DEL: #ifndef _XBOX case KEY_SPACE: case KEY_BACK: /* Clear the selected input mapping. */ #endif { GameInput curGameI( (GameController)m_iCurController, (GameButton)m_iCurButton ); INPUTMAPPER->ClearFromInputMap( curGameI, m_iCurSlot ); INPUTMAPPER->AddDefaultMappingsForCurrentGameIfUnmapped(); // commit to disk after each change INPUTMAPPER->SaveMappingsToDisk(); } break; case KEY_LEFT: /* Move the selection left, wrapping up. */ if( m_iCurSlot == 0 && m_iCurController == 0 ) break; // can't go left any more m_iCurSlot--; if( m_iCurSlot < 0 ) { m_iCurSlot = NUM_CHANGABLE_SLOTS-1; m_iCurController--; } break; case KEY_RIGHT: /* Move the selection right, wrapping down. */ if( m_iCurSlot == NUM_CHANGABLE_SLOTS-1 && m_iCurController == MAX_GAME_CONTROLLERS-1 ) break; // can't go right any more m_iCurSlot++; if( m_iCurSlot > NUM_CHANGABLE_SLOTS-1 ) { m_iCurSlot = 0; m_iCurController++; } break; case KEY_UP: /* Move the selection up. */ if( m_iCurButton == 0 ) break; // can't go up any more m_iCurButton--; break; case KEY_DOWN: /* Move the selection down. */ if( m_iCurButton == GAMESTATE->GetCurrentGame()->m_iButtonsPerController-1 ) break; // can't go down any more m_iCurButton++; break; case KEY_ESC: /* Quit the screen. */ if( !IsTransitioning() ) { SCREENMAN->PlayStartSound(); INPUTMAPPER->SaveMappingsToDisk(); // save changes StartTransitioning( SM_GoToNextScreen ); for( int b=0; b<GAMESTATE->GetCurrentGame()->m_iButtonsPerController; b++ ) m_Line[b].RunCommands( (b%2)? ODD_LINE_OUT:EVEN_LINE_OUT ); } break; case KEY_ENTER: /* Change the selection. */ case KEY_KP_ENTER: m_iWaitingForPress = FramesToWaitForInput; m_DeviceIToMap.MakeInvalid(); break; } } // Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton ); Refresh(); }