Beispiel #1
0
void ScreenSetTime::MenuStart( const InputEventPlus &input )
{
	bool bHoldingLeftAndRight = 
		INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, input.pn ) &&
		INPUTMAPPER->IsBeingPressed( GAME_BUTTON_LEFT, input.pn );

	if( bHoldingLeftAndRight )
		ChangeSelection( -1 );
	else if( m_Selection == NUM_SetTimeSelection -1 )	
	{
		time_t iNow = time(NULL);
		time_t iAdjusted = iNow + m_TimeOffset;

		tm adjusted;
		localtime_r( &iAdjusted, &adjusted );

		HOOKS->SetTime( adjusted );

		m_TimeOffset = 0;

		FOREACH_SetTimeSelection( s )
		{
			BitmapText &title = m_textTitle[s];
			title.BeginTweening( 0.3f, TWEEN_LINEAR );
			title.SetDiffuse( RageColor(1,1,1,0) );

			BitmapText &value = m_textValue[s];
			value.BeginTweening( 0.3f, TWEEN_LINEAR );
			value.SetDiffuse( RageColor(1,1,1,0) );
		}

		SCREENMAN->PlayStartSound();
		StartTransitioningScreen( SM_GoToNextScreen );
	}
void ScreenProfileSave::Continue()
{
	GAMESTATE->SavePlayerProfiles();
	SCREENMAN->ZeroNextUpdate();

	StartTransitioningScreen( SM_GoToNextScreen );
}
bool ScreenTestLights::MenuBack( const InputEventPlus &input )
{
	if( IsTransitioning() )
		return false;
	SCREENMAN->PlayStartSound();
	StartTransitioningScreen( SM_GoToPrevScreen );		
	return true;
}
void ScreenBookkeeping::MenuStart( const InputEventPlus &input )
{
	if( !IsTransitioning() )
	{
		SCREENMAN->PlayStartSound();
		StartTransitioningScreen( SM_GoToNextScreen );		
	}
}
bool ScreenSplash::MenuStart( const InputEventPlus &input )
{
	if( IsTransitioning() )
		return false;
	if( !ALLOW_START_TO_SKIP )
		return false;
	StartTransitioningScreen( SM_GoToNextScreen );
	return true;
}
void ScreenProfileLoad::Continue()
{
    if( m_bHaveProfileToLoad )
    {
        GAMESTATE->LoadProfiles( LOAD_EDITS );
        SCREENMAN->ZeroNextUpdate();
    }

    StartTransitioningScreen( SM_GoToNextScreen );
}
void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
{
	if( SM == SM_BeginFadingOut )	// Screen is starting to tween out.
	{
		/* Don't call GameCommand::Apply once per player on screens that 
		 * have a shared selection. This can cause change messages to be
		 * broadcast multiple times. Detect whether all players have the
		 * same choice, and  if so, call ApplyToAll instead.
		 * TODO: Think of a better way to handle this.
		 */
		ASSERT( GAMESTATE->GetMasterPlayerNumber() != PlayerNumber_Invalid );
		int iMastersIndex = this->GetSelectionIndex( GAMESTATE->GetMasterPlayerNumber() );
		bool bAllPlayersChoseTheSame = true;
		FOREACH_HumanPlayer( p )
		{
			if( this->GetSelectionIndex(p) != iMastersIndex )
			{
				bAllPlayersChoseTheSame = false;
				break;
			}
		}

		if(!m_aGameCommands.empty())
		{
			if( bAllPlayersChoseTheSame )
			{
				const GameCommand &gc = m_aGameCommands[iMastersIndex];
				m_sNextScreen = gc.m_sScreen;
				if( !gc.m_bInvalid )
				gc.ApplyToAllPlayers();
			}
			else
			{
				FOREACH_HumanPlayer( p )
				{
					int iIndex = this->GetSelectionIndex(p);
					const GameCommand &gc = m_aGameCommands[iIndex];
					m_sNextScreen = gc.m_sScreen;
					if( !gc.m_bInvalid )
					gc.Apply( p );
				}
			}
		}
		StopTimer();

		SCREENMAN->RefreshCreditsMessages();

		ASSERT( !IsTransitioning() );
		StartTransitioningScreen( SM_GoToNextScreen );
	}
void ScreenSplash::HandleScreenMessage( const ScreenMessage SM )
{
	if( SM == SM_DoneFadingIn )
	{
		if( PREPARE_SCREEN )
			SCREENMAN->PrepareScreen( GetNextScreenName() );
	}
	else if( SM == SM_MenuTimer )
	{
		StartTransitioningScreen( SM_GoToNextScreen );
	}

	ScreenWithMenuElements::HandleScreenMessage( SM );
}
void ScreenNetSelectMusic::StartSelectedSong()
{
	Song * pSong = m_MusicWheel.GetSelectedSong();
	GAMESTATE->m_pCurSong.Set( pSong );
	StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; //StepsType_dance_single;
	FOREACH_EnabledPlayer (pn)
	{
		GAMESTATE->m_PreferredDifficulty[pn].Set( m_DC[pn] );
		Steps *pSteps = SongUtil::GetStepsByDifficulty(pSong, st, m_DC[pn]);
		GAMESTATE->m_pCurSteps[pn].Set( pSteps );
	}

	GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder;
	GAMESTATE->m_pPreferredSong = pSong;

	// force event mode
	GAMESTATE->m_bTemporaryEventMode = true;

	TweenOffScreen();
	StartTransitioningScreen( SM_GoToNextScreen );
}
Beispiel #10
0
void ScreenPrompt::End( bool bCancelled )
{
	switch( m_Answer )
	{
		case ANSWER_YES:
			m_smSendOnPop = SM_Success;
			break;
		case ANSWER_NO:
			m_smSendOnPop = SM_Failure;
			break;
		default: break;
	}

	if( bCancelled )
	{
		Cancel( SM_GoToNextScreen );
	}
	else
	{
		SCREENMAN->PlayStartSound();
		StartTransitioningScreen( SM_GoToNextScreen );
	}

	switch( m_Answer )
	{
		case ANSWER_YES:
			if( g_pOnYes )
				g_pOnYes(g_pCallbackData);
			break;
		case ANSWER_NO:
			if( g_pOnNo )
				g_pOnNo(g_pCallbackData);
			break;
		default: break;
	}

	s_LastAnswer = bCancelled ? ANSWER_CANCEL : m_Answer;
	s_bCancelledLast = bCancelled;
}
void ScreenTextEntry::End( bool bCancelled )
{
	if( bCancelled )
	{
		if( g_pOnCancel ) 
			g_pOnCancel();

		Cancel( SM_GoToNextScreen );
		//TweenOffScreen();
	}
	else
	{
		RString sAnswer = WStringToRString(m_sAnswer);
		RString sError;
		if( g_pValidate != NULL )
		{
			bool bValidAnswer = g_pValidate( sAnswer, sError );
			if( !bValidAnswer )
			{
				ScreenPrompt::Prompt( SM_None, sError );
				return;	// don't end this screen.
			}
		}

		if( g_pOnOK )
		{
			RString ret = WStringToRString(m_sAnswer);
			FontCharAliases::ReplaceMarkers(ret);
			g_pOnOK( ret );
		}

		StartTransitioningScreen( SM_GoToNextScreen );
		SCREENMAN->PlayStartSound();
	}

	s_bCancelledLast = bCancelled;
	s_sLastAnswer = bCancelled ? RString("") : WStringToRString(m_sAnswer);
}
Beispiel #12
0
void ScreenSetTime::MenuStart( const InputEventPlus &input )
{
	bool bHoldingLeftAndRight = 
		INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, input.pn ) &&
		INPUTMAPPER->IsBeingPressed( GAME_BUTTON_LEFT, input.pn );

	if( bHoldingLeftAndRight )
		ChangeSelection( -1 );
	else if( m_Selection == NUM_SetTimeSelection -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;

		FOREACH_SetTimeSelection( s )
		{
			BitmapText &title = m_textTitle[s];
			title.BeginTweening( 0.3f, TWEEN_LINEAR );
			title.SetDiffuse( RageColor(1,1,1,0) );

			BitmapText &value = m_textValue[s];
			value.BeginTweening( 0.3f, TWEEN_LINEAR );
			value.SetDiffuse( RageColor(1,1,1,0) );
		}

		SCREENMAN->PlayStartSound();
		StartTransitioningScreen( SM_GoToNextScreen );
	}
Beispiel #13
0
bool ScreenInstructions::MenuStart( const InputEventPlus &input )
{
	StartTransitioningScreen( SM_GoToNextScreen );
	return true;
}