Exemplo n.º 1
0
void ScoreDisplayRave::Init(const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats)
{
	ScoreDisplay::Init(pPlayerState, pPlayerStageStats);

	PlayerNumber pn = pPlayerState->m_PlayerNumber;

	m_sprFrameBase.Load(THEME->GetPathG("ScoreDisplayRave", ssprintf("frame base p%d", pn + 1)));
	this->AddChild(m_sprFrameBase);

	for (int i = 0; i < NUM_ATTACK_LEVELS; i++)
	{
		m_sprMeter[i].SetName(ssprintf("MeterP%d", pn + 1));
		LOAD_ALL_COMMANDS(m_sprMeter[i]);
		ON_COMMAND(m_sprMeter[i]);
		this->AddChild(&m_sprMeter[i]);
	}

	m_textLevel.SetName(ssprintf("LevelP%d", pn + 1));
	LOAD_ALL_COMMANDS(m_textLevel);
	ON_COMMAND(m_textLevel);
	this->AddChild(&m_textLevel);

	m_sprFrameOverlay.Load(THEME->GetPathG("ScoreDisplayRave", ssprintf("frame overlay p%d", pn + 1)));
	this->AddChild(m_sprFrameOverlay);
}
Exemplo n.º 2
0
void LinkedOptionsMenu::Load( LinkedOptionsMenu *prev, LinkedOptionsMenu *next )
{
	m_sprLineHighlight.Load( THEME->GetPathG(m_sName, "line highlight") );

	m_Frame.SetName( "Frame" );
	this->AddChild( &m_Frame );

	m_SoundMoveRow.Load( THEME->GetPathS( m_sName, "move row" ) );
	m_SoundSwitchMenu.Load( THEME->GetPathS( m_sName, "switch menu" ) );

	m_FramePage.Load( THEME->GetPathG( m_sName, "page" ) );
	m_Frame.AddChild( m_FramePage );
	
	m_Cursor.SetName( "Cursor" );
	m_Cursor.Load( m_sName, OptionsCursor::underline );
	m_Cursor.Set(PLAYER_1);
	m_Frame.AddChild( &m_Cursor );
	ON_COMMAND( m_Cursor );

	m_sprIndicatorUp.SetName("IndicatorUp");
	m_sprIndicatorDown.SetName("IndicatorDown");
	m_sprIndicatorUp.Load( THEME->GetPathG( m_sName, "indicator up" ) );
	m_sprIndicatorDown.Load( THEME->GetPathG( m_sName, "indicator down" ) );
	m_Frame.AddChild( &m_sprIndicatorUp );
	m_Frame.AddChild( &m_sprIndicatorDown );
	ON_COMMAND( m_sprIndicatorUp );
	ON_COMMAND( m_sprIndicatorDown );
	m_bIndTweenedOn[0] = false; m_bIndTweenedOn[1] = false;
	//m_sprIndicatorUp.PlayCommand( "TweenOff" );
	//m_sprIndicatorDown.PlayCommand( "TweenOff" );

	m_PrevMenu = prev;
	m_NextMenu = next;

	m_bFocus = false;
	m_iCurrentSelection = -1;
	m_iCurPage = 0;

	ROW_OFFSET_X.Load( m_sName, "RowOffsetX" );
	ROW_OFFSET_Y.Load( m_sName, "RowOffsetY" );
	ROW_SPACING_Y.Load( m_sName, "RowSpacingY" );
	CURSOR_OFFSET_X.Load( m_sName, "CursorOffsetX" );
	MENU_WRAPPING.Load( m_sName, "MenuWrapping" );
	ROWS_PER_PAGE.Load( m_sName, "RowsPerPage" );
	ASSERT(ROWS_PER_PAGE > 0);

	ON_COMMAND( m_Frame );

	ClearChoices();
}
Exemplo n.º 3
0
void PaneDisplay::Load( PlayerNumber pn )
{
	m_PlayerNumber = pn;
	m_PreferredPaneForMode[PANEMODE_SONG] = PANE_SONG_DIFFICULTY;
	m_PreferredPaneForMode[PANEMODE_BATTLE] = PANE_BATTLE_DIFFICULTY;
	m_PreferredPaneForMode[PANEMODE_COURSE] = PANE_COURSE_MACHINE_SCORES;

	m_sprPaneUnder.Load( THEME->GetPathToG( ssprintf("PaneDisplay under p%i", pn+1)) );
	m_sprPaneUnder->SetName( "Under" );
	ON_COMMAND( m_sprPaneUnder );
	this->AddChild( m_sprPaneUnder );

	int p;
	for( p = 0; p < NUM_PANE_CONTENTS; ++p )
	{
		if( g_Contents[p].type == NUM_PANES )
			continue; /* skip, disabled */

		m_textContents[p].LoadFromFont( THEME->GetPathToF( "PaneDisplay text" ) );
		m_textContents[p].SetName( ssprintf("%sText", g_Contents[p].name) );
		SET_XY_AND_ON_COMMAND( m_textContents[p] );
		m_ContentsFrame.AddChild( &m_textContents[p] );

		m_Labels[p].Load( THEME->GetPathToG( ssprintf("PaneDisplay %s label", g_Contents[p].name)) );
		m_Labels[p]->SetName( ssprintf("%sLabel", g_Contents[p].name) );
		SET_XY_AND_ON_COMMAND( m_Labels[p] );
		m_ContentsFrame.AddChild( m_Labels[p] );
	}

	m_ContentsFrame.SetXY( SHIFT_X(m_PlayerNumber), SHIFT_Y(m_PlayerNumber) );
	this->AddChild( &m_ContentsFrame );

	m_sprPaneOver.Load( THEME->GetPathToG( ssprintf("PaneDisplay over p%i", pn+1)) );
	m_sprPaneOver->SetName( "Over" );
	ON_COMMAND( m_sprPaneOver );
	this->AddChild( m_sprPaneOver );

	for( unsigned i = 0; i < NUM_PANE_CONTENTS; ++i )
	{
		if( g_Contents[i].type == NUM_PANES )
			continue; /* skip, disabled */
		COMMAND( m_textContents[i], "LoseFocus"  );
		COMMAND( m_Labels[i], "LoseFocus"  );
		m_textContents[i].FinishTweening();
		m_Labels[i]->FinishTweening();
	}

	m_CurMode = GetMode();
	SetFocus( GetNext( m_PreferredPaneForMode[m_CurMode], 0 ) );
}
Exemplo n.º 4
0
void ScoreDisplayRave::Init( PlayerNumber pn )
{
	ScoreDisplay::Init( pn );

	m_sprFrameBase.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame base p%d",pn+1)) );
	m_sprFrameOverlay.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame overlay p%d",pn+1)) );

	for( int i=0; i<NUM_ATTACK_LEVELS; i++ )	
	{
		m_sprMeter[i].SetName( ssprintf("MeterP%d",pn+1) );
		ON_COMMAND( m_sprMeter[i] );
	}
		
	m_textLevel.SetName( ssprintf("LevelP%d",pn+1) );
	ON_COMMAND( m_textLevel );
}
Exemplo n.º 5
0
void ScreenOptions::Init()
{
	ScreenWithMenuElements::Init();

	m_OptionsNavigation = PREFSMAN->m_bArcadeOptionsNavigation? NAV_THREE_KEY:NAV_FIVE_KEY;

	m_SoundChangeCol.Load( THEME->GetPathS(m_sName,"change"), true );
	m_SoundNextRow.Load( THEME->GetPathS(m_sName,"next"), true );
	m_SoundPrevRow.Load( THEME->GetPathS(m_sName,"prev"), true );
	m_SoundToggleOn.Load( THEME->GetPathS(m_sName,"toggle on"), true );
	m_SoundToggleOff.Load( THEME->GetPathS(m_sName,"toggle off"), true );

	// add everything to m_framePage so we can animate everything at once
	m_framePage.SetName( "Frame" );
	this->AddChild( &m_framePage );

	m_bMoreShown = false;
	FOREACH_PlayerNumber( p )
	{
		m_iCurrentRow[p] = -1;
		m_iFocusX[p] = -1;
		m_bWasOnExit[p] = false;
		m_bGotAtLeastOneStartPressed[p] = false;
	}

	ON_COMMAND( m_framePage );
}
Exemplo n.º 6
0
void ScreenNetRoom::Init()
{
	ScreenNetSelectBase::Init();

	m_soundChangeSel.Load( THEME->GetPathS("ScreenNetRoom","change sel"));

	m_iRoomPlace = 0;

	m_sprTitleBG.Load( THEME->GetPathG( m_sName, "TitleBG" ) );
	m_sprTitleBG.SetName( "TitleBG" );
	m_sprTitleBG.SetWidth( TITLEBG_WIDTH );
	m_sprTitleBG.SetHeight( TITLEBG_HEIGHT );
	SET_XY_AND_ON_COMMAND( m_sprTitleBG );
	this->AddChild( &m_sprTitleBG);

	m_textTitle.LoadFromFont( THEME->GetPathF(m_sName,"wheel") );
	m_textTitle.SetShadowLength( 0 );
	m_textTitle.SetName( "Title" );
	m_textTitle.SetMaxWidth( TITLEBG_WIDTH );
	SET_XY_AND_ON_COMMAND( m_textTitle );
	this->AddChild( &m_textTitle);

	m_RoomWheel.Load("RoomWheel");
	m_RoomWheel.SetName( "RoomWheel" );
	SET_XY( m_RoomWheel );
	m_RoomWheel.TweenOnScreen();
	m_RoomWheel.SetDrawOrder(1);
	this->AddChild( &m_RoomWheel );
	this->MoveToHead( &m_RoomWheel );
	ON_COMMAND( m_RoomWheel );

	NSMAN->ReportNSSOnOff(7);
}
void ScreenNetSelectMusic::Init()
{
	// Finish any previous stage. It's OK to call this when we haven't played a stage yet.
	GAMESTATE->FinishStage();

	ScreenNetSelectBase::Init();

	SAMPLE_MUSIC_PREVIEW_MODE.Load( m_sName, "SampleMusicPreviewMode" );
	MUSIC_WHEEL_TYPE.Load( m_sName, "MusicWheelType" );
	PLAYER_OPTIONS_SCREEN.Load( m_sName, "PlayerOptionsScreen" );

	FOREACH_EnabledPlayer (p)
	{
		m_DC[p] = GAMESTATE->m_PreferredDifficulty[p];

		m_StepsDisplays[p].SetName( ssprintf("StepsDisplayP%d",p+1) );
		m_StepsDisplays[p].Load( "StepsDisplayNet", NULL );
		LOAD_ALL_COMMANDS_AND_SET_XY( m_StepsDisplays[p] );
		this->AddChild( &m_StepsDisplays[p] );
	}

	m_MusicWheel.SetName( "MusicWheel" );
	m_MusicWheel.Load( MUSIC_WHEEL_TYPE );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_MusicWheel );
	m_MusicWheel.BeginScreen();
	ON_COMMAND( m_MusicWheel );
	this->AddChild( &m_MusicWheel );
	this->MoveToHead( &m_MusicWheel );

	// todo: handle me theme-side -aj
	FOREACH_EnabledPlayer( p )
	{
		m_ModIconRow[p].SetName( ssprintf("ModIconsP%d",p+1) );
		m_ModIconRow[p].Load( "ModIconRowSelectMusic", p );
		m_ModIconRow[p].SetFromGameState();
		LOAD_ALL_COMMANDS_AND_SET_XY( m_ModIconRow[p] );
		this->AddChild( &m_ModIconRow[p] );
	}

	// Load SFX and music
	m_soundChangeOpt.Load( THEME->GetPathS(m_sName,"change opt") );
	m_soundChangeSel.Load( THEME->GetPathS(m_sName,"change sel") );
	m_sSectionMusicPath =	THEME->GetPathS(m_sName,"section music");
	m_sRouletteMusicPath =	THEME->GetPathS(m_sName,"roulette music");
	m_sRandomMusicPath =	THEME->GetPathS(m_sName,"random music");

	NSMAN->ReportNSSOnOff(1);
	NSMAN->ReportPlayerOptions();

	m_bInitialSelect = false;
	m_bAllowInput = false;
}
Exemplo n.º 8
0
void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM )
{
	if( SM == SM_GotEval)
	{
		m_bHasStats = true;

		LOG->Trace( "[SMNETDebug] num active players: %d (local), %d (NSMAN)",m_iActivePlayers,NSMAN->m_ActivePlayers );

		RedoUserTexts();

		LOG->Trace( "SMNETCheckpoint" );
		for( int i=0; i<m_iActivePlayers; ++i )
		{
			// Strange occurences because of timing cause these things not to
			// work right and will sometimes cause a crash. We should make SURE
			// we won't crash!
			if ( size_t(i) >= NSMAN->m_EvalPlayerData.size() )
				break;

			if ( size_t(NSMAN->m_EvalPlayerData[i].name) >= NSMAN->m_PlayerNames.size() )
				break;

			if ( NSMAN->m_EvalPlayerData[i].name < 0 )
				break;

			if ( size_t(i) >= m_textUsers.size() )
				break;

			m_textUsers[i].SetText( NSMAN->m_PlayerNames[NSMAN->m_EvalPlayerData[i].name] );

			// Yes, hardcoded (I'd like to leave it that way) -CNLohr (in reference to Grade_Tier03)
			// Themes can read this differently. The correct solution depends...
			// TODO: make this a server-side variable. -aj
			if( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 )
				m_textUsers[i].PlayCommand("Tier02OrBetter");

			ON_COMMAND( m_textUsers[i] );
			LOG->Trace( "SMNETCheckpoint%d", i );
		}
		return; // No need to let ScreenEvaluation get a hold of this.
	}
	else if( SM == SM_GoToNextScreen )
	{
		NSMAN->ReportNSSOnOff( 4 );
	}
	ScreenEvaluation::HandleScreenMessage( SM );
}
Exemplo n.º 9
0
void LinkedOptionsMenu::SetChoices( const CStringArray &asChoices )
{
	ClearChoices();

	for( unsigned i = 0; i < asChoices.size(); i++ )
	{
		CString ch = asChoices[i];
		BitmapText *bt = new BitmapText;
		m_Rows.push_back( bt );
		bt->LoadFromFont( THEME->GetPathF( m_sName, "menutext" ) );
		bt->SetName( "Row" );
		bt->SetXY( ROW_OFFSET_X, ROW_OFFSET_Y + (ROW_SPACING_Y * (float)(i % ROWS_PER_PAGE)) );
		bt->SetText( ch );
		m_Frame.AddChild( bt );
		ON_COMMAND( *bt );
	}

	// show first page of choices
	for( unsigned i = 0; i < asChoices.size() && i < (unsigned)ROWS_PER_PAGE; i++ )
	{
		m_Rows[i]->PlayCommand("TweenOn");
	}
	m_iCurPage = 0;
	if ( asChoices.size() > (unsigned)ROWS_PER_PAGE )
	{
		m_sprIndicatorDown.PlayCommand("TweenOn");
		m_bIndTweenedOn[1] = true;
	}

	if ( m_Rows.size() > 0 )
	{
		if ( m_bFocus ) m_Cursor.PlayCommand( "TweenOn" );
		m_Cursor.SetXY( CURSOR_OFFSET_X + m_Rows[0]->GetX(), m_Rows[0]->GetY() );
		m_Cursor.SetBarWidth( floor(m_Rows[0]->GetZoomedWidth()) );
		m_iCurrentSelection = 0;
	}
	else
	{
		m_iCurrentSelection = -1;
		m_Cursor.PlayCommand( "TweenOff" );
		if ( m_bFocus )
			SCREENMAN->PostMessageToTopScreen( m_smChangeMenu, 0.0f );
	}
}
Exemplo n.º 10
0
float ScreenRanking::SetPage( PageToShow pts )
{
	bool bBanner = false; 
	bool bBannerFrame = false;
	bool bShowCategory = false; 
	bool bShowCourseTitle = false; 
	bool bShowStepsType = false; 
	bool bShowBullets = false; 
	bool bShowNames = false;
	bool bShowScores = false; 
	bool bShowPoints = false; 
	bool bShowTime = false;
	bool bShowDifficulty = false; 
	bool bShowStepsScore = false;
	bool bShowCourseDifficulty = false;
	bool bShowCourseScore = false;
	switch( pts.type )
	{
	case PAGE_TYPE_CATEGORY:
		bBanner = false; 
		bBannerFrame = false;
		bShowCategory = true;
		bShowCourseTitle = false;
		bShowStepsType = true;
		bShowBullets = true;
		bShowNames = true;
		bShowScores = true;
		bShowPoints = false;
		bShowTime = false;
		bShowDifficulty = false;
		bShowStepsScore = false;
		break;
	case PAGE_TYPE_TRAIL:
		bBanner = true; 
		bBannerFrame = true;
		bShowCategory = false;
		bShowCourseTitle = true;
		bShowStepsType = true;
		bShowBullets = true;
		bShowNames = true;
		bShowScores = !pts.pCourse->IsOni();
		bShowPoints = pts.pCourse->IsOni();
		bShowTime = pts.pCourse->IsOni();
		bShowDifficulty = false;
		bShowStepsScore = false;
		break;
	case PAGE_TYPE_ALL_STEPS:
		bBanner = false; 
		bBannerFrame = false;
		bShowCategory = false;
		bShowCourseTitle = false;
		bShowStepsType = true;
		bShowBullets = false;
		bShowNames = false;
		bShowScores = false;
		bShowPoints = false;
		bShowTime = false;
		bShowDifficulty = true;
		bShowStepsScore = true;
		break;
	case PAGE_TYPE_ALL_COURSES:
		bShowStepsType = true;
		bShowCourseScore = true;
		bShowCourseDifficulty = true;
		break;
	default:
		ASSERT(0);
	}


	// Reset
	m_Banner.SetHidden( !bBanner );
	if( bBanner )
	{
		m_Banner.Reset();
		SET_XY_AND_ON_COMMAND( m_Banner );
	}

	m_sprBannerFrame.SetHidden( !bBannerFrame );
	if( bBannerFrame )
	{
		m_sprBannerFrame.Reset();
		SET_XY_AND_ON_COMMAND( m_sprBannerFrame );
	}

	m_textCategory.SetHidden( !bShowCategory );
	if( bShowCategory )
	{
		m_textCategory.Reset();
		SET_XY_AND_ON_COMMAND( m_textCategory );
	}

	m_textCourseTitle.SetHidden( !bShowCourseTitle );
	if( bShowCourseTitle )
	{
		m_textCourseTitle.Reset();
		SET_XY_AND_ON_COMMAND( m_textCourseTitle );
	}

	m_textStepsType.SetHidden( !bShowStepsType );
	if( bShowStepsType )
	{
		m_textStepsType.Reset();
		SET_XY_AND_ON_COMMAND( m_textStepsType );
	}

	// UGLY: We have to call AddChild every time we re-load an AutoActor
	// because the internal Actor* changes.
	if( (Actor*)m_sprPageType )
		this->RemoveChild( m_sprPageType );
	m_sprPageType.Load( THEME->GetPathG(m_sName, "PageType "+PageTypeToString(pts.type)) );
	m_sprPageType->SetName( "PageType" );
	this->AddChild( m_sprPageType );
	SET_XY_AND_ON_COMMAND( m_sprPageType );

	{
		for( int l=0; l<NUM_RANKING_LINES; l++ )
		{
			m_sprBullets[l].SetHidden( !bShowBullets );
			if( bShowBullets )
			{
				m_sprBullets[l].Reset();
				m_sprBullets[l].StopAnimating();
				m_sprBullets[l].SetState( l );
				m_sprBullets[l].SetXY( BULLET_X(l), BULLET_Y(l) );
				ON_COMMAND( m_sprBullets[l] );
			}

			m_textNames[l].SetHidden( !bShowNames );
			if( bShowNames )
			{
				m_textNames[l].Reset();
				m_textNames[l].SetXY( NAME_X(l), NAME_Y(l) );
				m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				ON_COMMAND( m_textNames[l] );
			}

			m_textScores[l].SetHidden( !bShowScores );
			if( bShowScores )
			{
				m_textScores[l].Reset();
				m_textScores[l].SetXY( SCORE_X(l), SCORE_Y(l) );
				m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				ON_COMMAND( m_textScores[l] );
			}
			
			m_textPoints[l].SetHidden( !bShowPoints );
			if( bShowPoints )
			{
				m_textPoints[l].Reset();
				m_textPoints[l].SetXY( POINTS_X(l), POINTS_Y(l) );
				m_textPoints[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				ON_COMMAND( m_textPoints[l] );
			}
			
			m_textTime[l].SetHidden( !bShowTime );
			if( bShowTime )
			{
				m_textTime[l].Reset();
				m_textTime[l].SetXY( TIME_X(l), TIME_Y(l) );
				m_textTime[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				ON_COMMAND( m_textTime[l] );
			}
		}
	}

	{
		for( vector<Difficulty>::iterator dc_iter=m_vDiffsToShow.begin(); dc_iter!=m_vDiffsToShow.end(); dc_iter++ )
		{
			m_sprDifficulty[*dc_iter]->SetHidden( !bShowDifficulty );
			if( bShowDifficulty )
			{
				m_sprDifficulty[*dc_iter]->Reset();
				m_sprDifficulty[*dc_iter]->SetXY( DIFFICULTY_X(*dc_iter), DIFFICULTY_Y );
				ON_COMMAND( m_sprDifficulty[*dc_iter] );
			}
		}

		m_ListScoreRowItems.SetHidden( !bShowStepsScore );
		if( bShowStepsScore )
		{
			m_ListScoreRowItems.Reset();
			SET_XY_AND_ON_COMMAND( m_ListScoreRowItems );

			vector<Actor*> vpActors;
			for( unsigned i=0; i<m_vpStepsScoreRowItem.size(); i++ )
				vpActors.push_back( m_vpStepsScoreRowItem[i] );
			m_ListScoreRowItems.Load( vpActors, SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0, false );

			for( unsigned s=0; s<m_vpStepsScoreRowItem.size(); s++ )
			{
				StepsScoreRowItem *pStepsScoreRowItems = m_vpStepsScoreRowItem[s];
				pStepsScoreRowItems->m_sprSongFrame.Reset();
				pStepsScoreRowItems->m_sprSongFrame.SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
				pStepsScoreRowItems->m_sprSongFrame.SetUseZBuffer( true );
				ON_COMMAND( pStepsScoreRowItems->m_sprSongFrame );

				pStepsScoreRowItems->m_textSongTitle.Reset();
				pStepsScoreRowItems->m_textSongTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
				pStepsScoreRowItems->m_textSongTitle.SetUseZBuffer( true );
				ON_COMMAND( pStepsScoreRowItems->m_textSongTitle );

				for( vector<Difficulty>::iterator dc_iter=m_vDiffsToShow.begin(); dc_iter!=m_vDiffsToShow.end(); dc_iter++ )
				{
					pStepsScoreRowItems->m_textStepsScore[*dc_iter].Reset();
					pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetXY( STEPS_SCORE_OFFSET_X(*dc_iter), STEPS_SCORE_OFFSET_Y );
					pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetUseZBuffer( true );
					pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
					ON_COMMAND( pStepsScoreRowItems->m_textStepsScore[*dc_iter] );
				}
			}
		}
	}

	{
		FOREACH_ShownCourseDifficulty(d)
		{
			m_sprCourseDifficulty[d]->SetHidden( !bShowCourseDifficulty );
			if( bShowCourseDifficulty )
			{
				m_sprCourseDifficulty[d]->Reset();
				m_sprCourseDifficulty[d]->SetXY( COURSE_DIFFICULTY_X(d), COURSE_DIFFICULTY_Y );
				ON_COMMAND( m_sprCourseDifficulty[d] );
			}
		}

		m_ListCourseRowItems.SetHidden( !bShowCourseScore );
		if( bShowCourseScore )
		{
			m_ListCourseRowItems.Reset();
			SET_XY_AND_ON_COMMAND( m_ListCourseRowItems );

			vector<Actor*> vpActors;
			for( unsigned i=0; i<m_vpCourseScoreRowItem.size(); i++ )
				vpActors.push_back( m_vpCourseScoreRowItem[i] );
			m_ListCourseRowItems.Load( vpActors, SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0, false );

			for( unsigned s=0; s<m_vpCourseScoreRowItem.size(); s++ )
			{
				CourseScoreRowItem *pCourseScoreRowItem = m_vpCourseScoreRowItem[s];
				pCourseScoreRowItem->m_sprSongFrame.Reset();
				pCourseScoreRowItem->m_sprSongFrame.SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
				pCourseScoreRowItem->m_sprSongFrame.SetUseZBuffer( true );
				ON_COMMAND( pCourseScoreRowItem->m_sprSongFrame );

				pCourseScoreRowItem->m_textSongTitle.Reset();
				pCourseScoreRowItem->m_textSongTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
				pCourseScoreRowItem->m_textSongTitle.SetUseZBuffer( true );
				ON_COMMAND( pCourseScoreRowItem->m_textSongTitle );

				FOREACH_ShownCourseDifficulty(d)
				{
					pCourseScoreRowItem->m_textStepsScore[d].Reset();
					pCourseScoreRowItem->m_textStepsScore[d].SetXY( COURSE_SCORE_OFFSET_X(d), COURSE_SCORE_OFFSET_Y );
					pCourseScoreRowItem->m_textStepsScore[d].SetUseZBuffer( true );
					pCourseScoreRowItem->m_textStepsScore[d].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
					ON_COMMAND( pCourseScoreRowItem->m_textStepsScore[d] );
				}
			}
		}
	}

	// get ranking feat list
	

	//
	// init page
	//
	switch( pts.type )
	{
	case PAGE_TYPE_CATEGORY:
		{
			m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
			m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );

			for( int l=0; l<NUM_RANKING_LINES; l++ )
			{
				HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(pts.nt,pts.category);
				HighScore hs;
				bool bRecentHighScore = false;
				if( l < (int)hsl.vHighScores.size() )
				{
					hs = hsl.vHighScores[l];
					CString *psName = &hsl.vHighScores[l].sName;
					bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
				}
				else
				{
					hs.sName = NO_SCORE_NAME;				
				}

				m_textNames[l].SetText( hs.GetDisplayName() );
				m_textScores[l].SetText( ssprintf("%09i",hs.iScore) );
				m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );

				if( bRecentHighScore )
				{
					m_textNames[l].SetEffectGlowBlink(0.1f);
					m_textScores[l].SetEffectGlowBlink(0.1f);
				}
				else
				{
					m_textNames[l].SetEffectNone();
					m_textScores[l].SetEffectNone();
				}
			}
		}
		return SECONDS_PER_PAGE;
	case PAGE_TYPE_TRAIL:
		{
			m_textCourseTitle.SetText( pts.pCourse->GetFullDisplayTitle() );
			m_Banner.LoadFromCourse( pts.pCourse );
			m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );

			const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList( pts.pCourse, pts.pTrail );
			for( int l=0; l<NUM_RANKING_LINES; l++ )
			{
				HighScore hs;
				bool bRecentHighScore = false;
				if( l < (int)hsl.vHighScores.size() )
				{
					hs = hsl.vHighScores[l];
					const CString *psName = &hsl.vHighScores[l].sName;
					bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
				}
				else
				{
					hs.sName = NO_SCORE_NAME;				
				}

				m_textNames[l].SetText( hs.GetDisplayName() );
				if( pts.pCourse->IsOni() )
				{
					m_textPoints[l].SetText( ssprintf("%04d",hs.iScore) );
					m_textTime[l].SetText( SecondsToMMSSMsMs(hs.fSurviveSeconds) );
					m_textScores[l].SetText( "" );
				} else {
					m_textPoints[l].SetText( "" );
					m_textTime[l].SetText( "" );
					m_textScores[l].SetText( ssprintf("%09d",hs.iScore) );
				}
				m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				m_textPoints[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				m_textTime[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
				m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );

				if( bRecentHighScore )
				{
					m_textNames[l].SetEffectGlowBlink(0.1f);
					m_textScores[l].SetEffectGlowBlink(0.1f);
				}
				else
				{
					m_textNames[l].SetEffectNone();
					m_textScores[l].SetEffectNone();
				}
			}
		}
		return SECONDS_PER_PAGE;
	case PAGE_TYPE_ALL_STEPS:
		{
			m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );

			for( unsigned s=0; s<m_vpStepsScoreRowItem.size(); s++ )
			{
				StepsScoreRowItem *pStepsScoreRowItem = m_vpStepsScoreRowItem[s];
				const Song* pSong = pStepsScoreRowItem->m_pSong;

				pStepsScoreRowItem->m_textSongTitle.SetText( pSong->GetFullDisplayTitle() );

				for( vector<Difficulty>::iterator dc_iter = m_vDiffsToShow.begin(); dc_iter != m_vDiffsToShow.end(); dc_iter++ )
				{							
					const Steps* pSteps = pSong->GetStepsByDifficulty( pts.nt, *dc_iter, false );
					BitmapText* pTextStepsScore = &pStepsScoreRowItem->m_textStepsScore[*dc_iter];

					if( pSteps == NULL )
					{
						pTextStepsScore->SetHidden( true );
					}
					else
					{
						HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
						HighScore hs = hsl.GetTopScore();
						bool bRecentHighScore = false;
						if( !hsl.vHighScores.empty() )
						{
							hs = hsl.GetTopScore();
							const CString *psName = &hsl.GetTopScore().sName;
							bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
						}
						else
						{
							hs.sName = NO_SCORE_NAME;				
						}

						CString s;
						s = hs.GetDisplayName() + "\n";
						s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE, PERCENT_DECIMAL_PLACES, hs.fPercentDP*100 );
						pTextStepsScore->SetText( s );
					}
				}
			}
		}
		return m_ListScoreRowItems.GetSecondsForCompleteScrollThrough();
	case PAGE_TYPE_ALL_COURSES:
		{
			m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );

			for( unsigned c=0; c<m_vpCourseScoreRowItem.size(); c++ )
			{
				CourseScoreRowItem *pCourseScoreRowItem = m_vpCourseScoreRowItem[c];
				const Course* pCourse = pCourseScoreRowItem->m_pCourse;

				pCourseScoreRowItem->m_textSongTitle.SetText( pCourse->GetFullDisplayTitle() );
				FOREACH_ShownCourseDifficulty( cd )
				{
					BitmapText* pTextStepsScore = &pCourseScoreRowItem->m_textStepsScore[cd];

					Trail *pTrail = pCourse->GetTrail( pts.nt, cd );
					pTextStepsScore->SetHidden( pTrail==NULL );
					if( pTrail == NULL )
						continue;

					const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList( pCourse, pTrail );

					HighScore hs;
					bool bRecentHighScore = false;
					if( !hsl.vHighScores.empty() )
					{
						hs = hsl.vHighScores[0];
						const CString *psName = &hsl.GetTopScore().sName;
						bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
					}
					else
					{
						hs.sName = NO_SCORE_NAME;				
					}

					CString s;
					s = hs.GetDisplayName() + "\n";
					s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE, PERCENT_DECIMAL_PLACES, hs.fPercentDP*100 );
					pTextStepsScore->SetText( s );
				}
			}
		}
		return m_ListCourseRowItems.GetSecondsForCompleteScrollThrough();
	default:
		ASSERT(0);
		return 0;
	}
}
Exemplo n.º 11
0
void ComboGraph::Load( CString Path, const StageStats &s, PlayerNumber pn )
{
	ASSERT( m_SubActors.size() == 0 );

	/* Find the largest combo. */
	int MaxComboSize = 0;
	unsigned i;
	for( i = 0; i < s.ComboList[pn].size(); ++i )
		MaxComboSize = max( MaxComboSize, s.ComboList[pn][i].GetStageCnt() );

	float width = -1;
	for( i = 0; i < s.ComboList[pn].size(); ++i )
	{
		const StageStats::Combo_t &combo = s.ComboList[pn][i];
		if( combo.GetStageCnt() < MinComboSizeToShow )
			continue; /* too small */

		const bool IsMax = (combo.GetStageCnt() == MaxComboSize);

		LOG->Trace("combo %i is %f+%f", i, combo.fStartSecond, combo.fSizeSeconds);
		Sprite *sprite = new Sprite;
		sprite->SetName( "ComboBar" );
		const CString path = ssprintf( "%s %s", Path.c_str(), IsMax? "max":"normal" );
		sprite->Load( THEME->GetPathToG(path) );

		const float start = SCALE( combo.fStartSecond, s.fFirstSecond[pn], s.fLastSecond[pn], 0.0f, 1.0f );
		const float size = SCALE( combo.fSizeSeconds, 0, s.fLastSecond[pn]-s.fFirstSecond[pn], 0.0f, 1.0f );
		sprite->SetCropLeft ( SCALE( size, 0.0f, 1.0f, 0.5f, 0.0f ) );
		sprite->SetCropRight( SCALE( size, 0.0f, 1.0f, 0.5f, 0.0f ) );

		sprite->BeginTweening( .5f );
		sprite->SetCropLeft( start );
		sprite->SetCropRight( 1 - (size + start) );

		if( width < 0 )
			width = sprite->GetUnzoomedWidth();

		m_Sprites.push_back( sprite );
		this->AddChild( sprite );
	}

	for( i = 0; i < s.ComboList[pn].size(); ++i )
	{
		const StageStats::Combo_t &combo = s.ComboList[pn][i];
		if( combo.GetStageCnt() < MinComboSizeToShow )
			continue; /* too small */
	
		if( !MaxComboSize )
			continue;

		const bool IsMax = (combo.GetStageCnt() == MaxComboSize);
		if( !IsMax )
			continue;

		BitmapText *text = new BitmapText;
		text->SetName( "ComboMaxNumber" );
		text->LoadFromFont( THEME->GetPathToF(Path) );

		const float start = SCALE( combo.fStartSecond, s.fFirstSecond[pn], s.fLastSecond[pn], 0.0f, 1.0f );
		const float size = SCALE( combo.fSizeSeconds, 0, s.fLastSecond[pn]-s.fFirstSecond[pn], 0.0f, 1.0f );

		const float CenterPercent = start + size/2;
		const float CenterXPos = SCALE( CenterPercent, 0.0f, 1.0f, -width/2.0f, width/2.0f );
		text->SetX( CenterXPos );

		text->SetText( ssprintf("%i",combo.GetStageCnt()) );
		ON_COMMAND( text );

		m_Numbers.push_back( text );
		this->AddChild( text );
	}
}
Exemplo n.º 12
0
void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &vDefs, const vector<OptionRowHandler*> &vHands )
{
	LOG->Trace( "ScreenOptions::Set()" );

	ASSERT( vDefs.size() == vHands.size() );

	m_InputMode = im;

	for( unsigned r=0; r<vDefs.size(); r++ )		// foreach row
	{
		m_Rows.push_back( new OptionRow() );
		OptionRow &row = *m_Rows.back();
		const OptionRowDefinition &def = vDefs[r];
		OptionRowHandler* hand = vHands[r];
		
		bool bFirstRowGoesDown = m_OptionsNavigation==NAV_TOGGLE_THREE_KEY;

		row.LoadMetrics( m_sName );
		row.LoadNormal( def, hand, bFirstRowGoesDown );

		vector<PlayerNumber> vpns;
		FOREACH_HumanPlayer( p )
			vpns.push_back( p );
		this->ImportOptions( r, vpns );
	
		CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) );

		row.AfterImportOptions();
	}

	m_sprPage.Load( THEME->GetPathG(m_sName,"page") );
	m_sprPage->SetName( "Page" );
	SET_XY_AND_ON_COMMAND( m_sprPage );
	m_framePage.AddChild( m_sprPage );

	// init line line highlights
	FOREACH_HumanPlayer( p )
	{
		m_sprLineHighlight[p].Load( THEME->GetPathG(m_sName,"line highlight") );
		m_sprLineHighlight[p].SetName( "LineHighlight" );
		m_sprLineHighlight[p].SetX( SCREEN_CENTER_X );
		m_framePage.AddChild( &m_sprLineHighlight[p] );
		ON_COMMAND( m_sprLineHighlight[p] );
	}
	
	// init cursors
	FOREACH_HumanPlayer( p )
	{
		m_Cursor[p].Load( m_sName, OptionsCursor::cursor );
		m_Cursor[p].Set( p );
		m_framePage.AddChild( &m_Cursor[p] );
	}
	
	for( unsigned r=0; r<m_Rows.size(); r++ )		// foreach row
	{
		OptionRow &row = *m_Rows[r];
		m_framePage.AddChild( &row );
	}

	if( SHOW_EXIT_ROW )
	{
		// TRICKY:  Add "EXIT" item
		m_Rows.push_back( new OptionRow() );
		OptionRow &row = *m_Rows.back();
		row.LoadMetrics( m_sName );
		row.LoadExit();
		m_framePage.AddChild( &row );
	}

	// add explanation here so it appears on top
	FOREACH_PlayerNumber( p )
	{
		m_textExplanation[p].LoadFromFont( THEME->GetPathF(m_sName,"explanation") );
		m_textExplanation[p].SetZoom( EXPLANATION_ZOOM );
		m_textExplanation[p].SetShadowLength( 0 );
		m_framePage.AddChild( &m_textExplanation[p] );
	}

	if( SHOW_SCROLL_BAR )
	{
		m_ScrollBar.SetName( "ScrollBar" );
		m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
		m_ScrollBar.SetBarTime( SCROLL_BAR_TIME );
		FOREACH_PlayerNumber( p )
			m_ScrollBar.EnablePlayer( p, GAMESTATE->IsHumanPlayer(p) );
		m_ScrollBar.Load( "DualScrollBar" );
		SET_XY( m_ScrollBar );
		m_framePage.AddChild( &m_ScrollBar );
	}

	m_sprMore.Load( THEME->GetPathG( m_sName,"more") );
	m_sprMore->SetName( "More" );
	SET_XY_AND_ON_COMMAND( m_sprMore );
	COMMAND( m_sprMore, m_bMoreShown? "ShowMore":"HideMore" );
	m_framePage.AddChild( m_sprMore );

	switch( m_InputMode )
	{
	case INPUTMODE_INDIVIDUAL:
		{
			FOREACH_PlayerNumber( p )
				m_textExplanation[p].SetXY( EXPLANATION_X.GetValue(p), EXPLANATION_Y.GetValue(p) );
		}
		break;
	case INPUTMODE_SHARE_CURSOR:
		m_textExplanation[0].SetXY( EXPLANATION_TOGETHER_X, EXPLANATION_TOGETHER_Y );
		break;
	default:
		ASSERT(0);
	}

	FOREACH_PlayerNumber( p )
	{
		m_sprDisqualify[p].Load( THEME->GetPathG(m_sName,"disqualify") );
		m_sprDisqualify[p]->SetName( ssprintf("DisqualifyP%i",p+1) );
		SET_XY_AND_ON_COMMAND( m_sprDisqualify[p] );
		m_sprDisqualify[p]->SetHidden( true );	// unhide later if handicapping options are discovered
		m_framePage.AddChild( m_sprDisqualify[p] );
	}

	// poke once at all the explanation metrics so that we catch missing ones early
	for( int r=0; r<(int)m_Rows.size(); r++ )		// foreach row
	{
		GetExplanationText( r );
	}

	// put focus on the first enabled row
	FOREACH_PlayerNumber( p )
	{
		for( unsigned r=0; r<m_Rows.size(); r++ )
		{
			const OptionRow &row = *m_Rows[r];
			if( row.GetRowDef().IsEnabledForPlayer(p) )
			{
				m_iCurrentRow[p] = r;
				break;
			}
		}
	}

	// Hide highlight if no rows are enabled.
	FOREACH_HumanPlayer( p )
		if( m_iCurrentRow[p] == -1 )
			m_sprLineHighlight[p].SetHidden( true );


	CHECKPOINT;

	PositionItems();
	PositionAllUnderlines();
	PositionIcons();
	RefreshAllIcons();
	PositionCursors();
	UpdateEnabledDisabled();

	FOREACH_PlayerNumber( p )
		OnChange( p );

	CHECKPOINT;

	/* It's tweening into position, but on the initial tween-in we only want to
	 * tween in the whole page at once.  Since the tweens are nontrivial, it's
	 * easiest to queue the tweens and then force them to finish. */
	for( int r=0; r<(int) m_Rows.size(); r++ )	// foreach options line
	{
		OptionRow &row = *m_Rows[r];
		row.FinishTweening();
	}

	m_sprMore->FinishTweening();

	this->SortByDrawOrder();
}
Exemplo n.º 13
0
void ScreenNetSelectMusic::Init()
{
	/* Finish any previous stage.  It's OK to call this when we haven't played a stage yet. */
	GAMESTATE->FinishStage();

	ScreenNetSelectBase::Init();

	//Diff Icon background
	m_sprDiff.Load( THEME->GetPathG( m_sName, "DiffBG" ) );
	m_sprDiff.SetName( "DiffBG" );
	m_sprDiff.SetWidth( DIFFBG_WIDTH );
	m_sprDiff.SetHeight( DIFFBG_HEIGHT );
	LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprDiff );
	this->AddChild( &m_sprDiff);

	FOREACH_EnabledPlayer (p)
	{
		m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) );
		m_DifficultyIcon[p].Load( THEME->GetPathG( "ScreenSelectMusic",
												   ssprintf("difficulty icons 1x%d",
															NUM_Difficulty)) );
		LOAD_ALL_COMMANDS_AND_SET_XY( m_DifficultyIcon[p] );
		this->AddChild( &m_DifficultyIcon[p] );
		ON_COMMAND( m_DifficultyIcon[p] );
		m_DC[p] = GAMESTATE->m_PreferredDifficulty[p];

		m_StepsDisplays[p].SetName( ssprintf("MeterP%d",p+1) );
		m_StepsDisplays[p].Load( "StepsDisplay", NULL );
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_StepsDisplays[p] );
		this->AddChild( &m_StepsDisplays[p] );
	}

	m_MusicWheel.SetName( "MusicWheel" );
	m_MusicWheel.Load( "MusicWheel" );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_MusicWheel );
	m_MusicWheel.BeginScreen();
	ON_COMMAND( m_MusicWheel );
	this->AddChild( &m_MusicWheel );
	this->MoveToHead( &m_MusicWheel );
	
	m_BPMDisplay.SetName( "BPMDisplay" );
	m_BPMDisplay.LoadFromFont( THEME->GetPathF("BPMDisplay","bpm") );
	m_BPMDisplay.Load();
	LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_BPMDisplay );
	this->AddChild( &m_BPMDisplay );

	FOREACH_EnabledPlayer( p )
	{
		m_ModIconRow[p].SetName( ssprintf("ModIconsP%d",p+1) );
		m_ModIconRow[p].Load( "ModIconRowSelectMusic", p );
		m_ModIconRow[p].SetFromGameState();
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_ModIconRow[p] );
		this->AddChild( &m_ModIconRow[p] );
	}

	//Load SFX next
	m_soundChangeOpt.Load( THEME->GetPathS(m_sName,"change opt") );
	m_soundChangeSel.Load( THEME->GetPathS(m_sName,"change sel") );

	NSMAN->ReportNSSOnOff(1);
	NSMAN->ReportPlayerOptions();

	m_bInitialSelect = false;
	m_bAllowInput = false;
}