void ScreenArcadePatch::Init() { ScreenWithMenuElements::Init(); // HACK: set last updated differently to force an update m_State = PATCH_NONE; m_LastUpdatedState = PATCH_ERROR; /* initialize BitmapText actors */ m_StateText.LoadFromFont( THEME->GetPathF("ScreenArcadePatch", "text") ); m_PatchText.LoadFromFont( THEME->GetPathF("ScreenArcadePatch", "text") ); m_StateText.SetName( "State" ); m_PatchText.SetName( "List" ); SET_XY_AND_ON_COMMAND( m_StateText ); SET_XY_AND_ON_COMMAND( m_PatchText ); /* this will be picked up on the first update */ STATE_TEXT( "Please wait..." ); m_textHelp->SetText( WAITING_HELP_TEXT ); this->AddChild( &m_StateText ); this->AddChild( &m_PatchText ); this->SortByDrawOrder(); /* init the patch thread, but don't start it yet */ m_Thread.SetName( "Patch thread" ); }
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 TextBanner::Init() { if( m_bInitted ) return; m_bInitted = true; ASSERT( m_sName != "" ); ARTIST_PREPEND_STRING.Refresh( m_sName ); TWO_LINES_TITLE_COMMAND.Refresh( m_sName ); TWO_LINES_SUBTITLE_COMMAND.Refresh( m_sName ); TWO_LINES_ARTIST_COMMAND.Refresh( m_sName ); THREE_LINES_TITLE_COMMAND.Refresh( m_sName ); THREE_LINES_SUBTITLE_COMMAND.Refresh( m_sName ); THREE_LINES_ARTIST_COMMAND.Refresh( m_sName ); m_textTitle.SetName( "Title" ); m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); SET_XY_AND_ON_COMMAND( m_textTitle ); this->AddChild( &m_textTitle ); m_textSubTitle.SetName( "Subtitle" ); m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); SET_XY_AND_ON_COMMAND( m_textSubTitle ); this->AddChild( &m_textSubTitle ); m_textArtist.SetName( "Artist" ); m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") ); SET_XY_AND_ON_COMMAND( m_textArtist ); this->AddChild( &m_textArtist ); }
void ScreenSystemLayer::ReloadCreditsText() { if( m_sprMessageFrame.IsLoaded() ) this->RemoveChild( m_sprMessageFrame ); m_sprMessageFrame.Load( THEME->GetPathG(m_sName,"MessageFrame") ); this->AddChild( m_sprMessageFrame ); m_sprMessageFrame->SetName( "MessageFrame" ); SET_XY_AND_ON_COMMAND( m_sprMessageFrame ); m_sprMessageFrame->SetHidden( true ); m_textMessage.LoadFromFont( THEME->GetPathF(m_sName,"message") ); m_textMessage.SetName( "Message" ); SET_XY_AND_ON_COMMAND( m_textMessage ); m_textMessage.SetHidden( true ); m_textStats.LoadFromFont( THEME->GetPathF(m_sName,"stats") ); m_textStats.SetName( "Stats" ); SET_XY_AND_ON_COMMAND( m_textStats ); m_textTime.LoadFromFont( THEME->GetPathF(m_sName,"time") ); m_textTime.SetName( "Time" ); m_textTime.SetHidden( !PREFSMAN->m_bTimestamping ); SET_XY_AND_ON_COMMAND( m_textTime ); FOREACH_PlayerNumber( p ) { m_textCredits[p].LoadFromFont( THEME->GetPathF("ScreenManager","credits") ); m_textCredits[p].SetName( ssprintf("CreditsP%d",p+1) ); SET_XY_AND_ON_COMMAND( &m_textCredits[p] ); } this->SortByDrawOrder(); }
void ScreenUserPacks::Init() { ScreenWithMenuElements::Init(); if ( USER_PACK_WAIT_TEXT.GetValue().empty() ) USER_PACK_WAIT_TEXT.SetValue("Please Wait..."); if ( USER_PACK_CANCEL_TEXT.GetValue().empty() ) { USER_PACK_CANCEL_TEXT.SetValue(ssprintf( "Pressing %s will cancel this selection.", DiagnosticsUtil::GetInputType() == "ITGIO" ? "&MENULEFT;+&MENURIGHT;" : "&SELECT;" )); } m_SoundDelete.Load( THEME->GetPathS( m_sName, "delete" ) ); m_SoundTransferDone.Load( THEME->GetPathS( m_sName, "transfer done" ) ); m_AddedZips.SetName( "LinkedOptionsMenuAddedZips" ); m_USBZips.SetName( "LinkedOptionsMenuUSBZips" ); m_Exit.SetName( "LinkedOptionsMenuSASExit" ); m_USBZips.Load( NULL, &m_AddedZips ); m_AddedZips.Load( &m_USBZips, &m_Exit ); m_Exit.Load( &m_AddedZips, NULL ); m_USBZips.SetMenuChangeScreenMessage( SM_LinkedMenuChange ); m_AddedZips.SetMenuChangeScreenMessage( SM_LinkedMenuChange ); m_Exit.SetMenuChangeScreenMessage( SM_LinkedMenuChange ); // why not.. this->AddChild( &m_AddedZips ); this->AddChild( &m_USBZips ); this->AddChild( &m_Exit ); SET_XY_AND_ON_COMMAND( m_AddedZips ); SET_XY_AND_ON_COMMAND( m_USBZips ); SET_XY_AND_ON_COMMAND( m_Exit ); m_Disclaimer.SetName( "Disclaimer" ); m_Disclaimer.LoadFromFont( THEME->GetPathF( m_sName, "text" ) ); m_Disclaimer.SetText( THEME->GetMetric(m_sName, "DisclaimerText") ); SET_XY_AND_ON_COMMAND( m_Disclaimer ); this->AddChild( &m_Disclaimer ); this->SortByDrawOrder(); { CStringArray asExit; asExit.push_back( "Exit" ); m_Exit.SetChoices( asExit ); } m_Exit.Focus(); m_pCurLOM = &m_Exit; m_bStopThread = false; m_PlayerSongLoadThread.SetName( "Song Add Thread" ); m_PlayerSongLoadThread.Create( InitSASSongThread, this ); ReloadZips(); }
MusicWheelItem::MusicWheelItem() { data = NULL; SetName( "MusicWheelItem" ); m_fPercentGray = 0; m_WheelNotifyIcon.SetXY( ICON_X, 0 ); m_TextBanner.SetName( "TextBanner" ); m_TextBanner.SetHorizAlign( align_left ); m_TextBanner.SetXY( SONG_NAME_X, 0 ); m_All.AddChild( &m_TextBanner ); m_sprSongBar.Load( THEME->GetPathToG("MusicWheelItem song") ); m_sprSongBar.SetXY( 0, 0 ); m_All.AddChild( &m_sprSongBar ); m_sprSectionBar.Load( THEME->GetPathToG("MusicWheelItem section") ); m_sprSectionBar.SetXY( 0, 0 ); m_All.AddChild( &m_sprSectionBar ); m_textSectionName.LoadFromFont( THEME->GetPathToF("MusicWheelItem section") ); m_textSectionName.SetShadowLength( 0 ); m_textSectionName.SetVertAlign( align_middle ); m_textSectionName.SetXY( SECTION_NAME_X, 0 ); m_textSectionName.SetZoom( SECTION_ZOOM ); m_All.AddChild( &m_textSectionName ); m_textRoulette.LoadFromFont( THEME->GetPathToF("MusicWheelItem roulette") ); m_textRoulette.SetShadowLength( 0 ); m_textRoulette.TurnRainbowOn(); m_textRoulette.SetZoom( ROULETTE_ZOOM ); m_textRoulette.SetXY( ROULETTE_X, 0 ); m_All.AddChild( &m_textRoulette ); FOREACH_PlayerNumber( p ) { m_GradeDisplay[p].Load( THEME->GetPathToG("MusicWheelItem grades") ); m_GradeDisplay[p].SetZoom( 1.0f ); m_GradeDisplay[p].SetXY( GRADE_X(p), 0 ); m_All.AddChild( &m_GradeDisplay[p] ); } m_textCourse.SetName( "CourseName" ); m_textCourse.LoadFromFont( THEME->GetPathToF("MusicWheelItem course") ); SET_XY_AND_ON_COMMAND( &m_textCourse ); m_All.AddChild( &m_textCourse ); m_textSort.SetName( "Sort" ); m_textSort.LoadFromFont( THEME->GetPathToF("MusicWheelItem sort") ); SET_XY_AND_ON_COMMAND( &m_textSort ); m_All.AddChild( &m_textSort ); }
void ScreenSelectStyle::AfterChange() { m_sprIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND ); m_textIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND ); m_sprPicture[m_iSelection].SetDiffuse( RageColor(1,1,1,1) ); m_sprInfo[m_iSelection].SetDiffuse( RageColor(1,1,1,1) ); m_sprPicture[m_iSelection].SetZoom( 1 ); m_sprInfo[m_iSelection].SetZoom( 1 ); SET_XY_AND_ON_COMMAND( m_sprPicture[m_iSelection] ); SET_XY_AND_ON_COMMAND( m_sprInfo[m_iSelection] ); }
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 ) ); }
void ScreenArcadeDiagnostics::Init() { ScreenWithMenuElements::Init(); m_USBInfo.LoadFromFont( THEME->GetPathF( "ScreenArcadeDiagnostics", "text" ) ); m_USBInfo.SetName( "USBInfo" ); m_Title.LoadFromFont( THEME->GetPathF( "ScreenArcadeDiagnostics", "text" ) ); m_Title.SetName( "Title" ); SET_XY_AND_ON_COMMAND( m_USBInfo ); SET_XY_AND_ON_COMMAND( m_Title ); this->AddChild( &m_USBInfo ); this->AddChild( &m_Title ); this->SortByDrawOrder(); }
void ScreenWithMenuElements::Init() { LOG->Trace( "ScreenWithMenuElements::Init()" ); Screen::Init(); FIRST_UPDATE_COMMAND.Load( m_sName, "FirstUpdateCommand" ); ASSERT( this->m_SubActors.empty() ); // don't call Init twice! m_autoHeader.Load( THEME->GetPathG(m_sName,"header") ); m_autoHeader->SetName("Header"); SET_XY_AND_ON_COMMAND( m_autoHeader ); this->AddChild( m_autoHeader ); if( STYLE_ICON && GAMESTATE->m_pCurStyle ) { m_sprStyleIcon.SetName( "StyleIcon" ); m_sprStyleIcon.Load( THEME->GetPathG("MenuElements",CString("icon ")+GAMESTATE->GetCurrentStyle()->m_szName) ); m_sprStyleIcon.StopAnimating(); m_sprStyleIcon.SetState( GAMESTATE->m_MasterPlayerNumber ); SET_XY_AND_ON_COMMAND( m_sprStyleIcon ); this->AddChild( &m_sprStyleIcon ); } if( SHOW_STAGE && GAMESTATE->m_pCurStyle ) { vector<Stage> vStages; GAMESTATE->GetPossibleStages( vStages ); FOREACH_CONST( Stage, vStages, s ) { m_sprStage[*s].Load( THEME->GetPathG(m_sName,"stage "+StageToString(*s)) ); m_sprStage[*s]->SetName( "Stage" ); SET_XY_AND_ON_COMMAND( m_sprStage[*s] ); this->AddChild( m_sprStage[*s] ); }
ScreenPlayerOptions::ScreenPlayerOptions( const CString &sClassName ) : ScreenOptionsMaster( sClassName ) { LOG->Trace( "ScreenPlayerOptions::ScreenPlayerOptions()" ); m_bAskOptionsMessage = !GAMESTATE->m_bEditing && PREFSMAN->m_ShowSongOptions == PrefsManager::ASK; /* If we're going to "press start for more options" or skipping options * entirely, we need a different fade out. XXX: this is a hack */ if( PREFSMAN->m_ShowSongOptions == PrefsManager::NO || GAMESTATE->m_bEditing ) m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions direct out") ); /* direct to stage */ else if( m_bAskOptionsMessage ) { m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions option out") ); /* optional song options */ m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenPlayerOptions options") ); m_sprOptionsMessage.StopAnimating(); m_sprOptionsMessage.SetXY( CENTER_X, CENTER_Y ); m_sprOptionsMessage.SetZoom( 1 ); m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); //this->AddChild( &m_sprOptionsMessage ); // we have to draw this manually over the top of transitions } m_bAcceptedChoices = false; m_bGoToOptions = ( PREFSMAN->m_ShowSongOptions == PrefsManager::YES ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") ); FOREACH_HumanPlayer( pn ) { m_sprCancelAll[pn].LoadAndSetName( "ScreenPlayerOptions", ssprintf("CancelAllP%d",pn+1) ); SET_XY_AND_ON_COMMAND( m_sprCancelAll[pn] ); this->AddChild( m_sprCancelAll[pn] ); } UpdateDisqualified(); }
ScreenEditCoursesMenu::ScreenEditCoursesMenu( const CString &sName ) : ScreenWithMenuElements( sName ) { LOG->Trace( "ScreenEditCoursesMenu::ScreenEditCoursesMenu()" ); /* Enable all players. */ FOREACH_PlayerNumber( pn ) GAMESTATE->m_bSideIsJoined[pn] = true; m_Selector.SetXY( 0, 0 ); // m_Selector.AllowNewNotes(); this->AddChild( &m_Selector ); m_textExplanation.SetName( "Explanation" ); m_textExplanation.LoadFromFont( THEME->GetPathToF("Common normal") ); SET_XY_AND_ON_COMMAND( m_textExplanation ); m_textExplanation.SetText( EXPLANATION_TEXT ); this->AddChild( &m_textExplanation ); this->SortByDrawOrder(); SOUND->PlayMusic( THEME->GetPathToS("ScreenEditCoursesMenu music") ); }
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; } }
ScreenEnding::ScreenEnding( const CString &sClassName ) : ScreenAttract( sClassName, false/*dont reset GAMESTATE*/ ) { if( PREFSMAN->m_bScreenTestMode ) { PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1); PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2); GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(), "versus" ); GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->m_pCurSong = SONGMAN->GetRandomSong(); GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse(); GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; g_CurStageStats.vpSteps[PLAYER_1].push_back( GAMESTATE->m_pCurSteps[PLAYER_1] ); g_CurStageStats.vpSteps[PLAYER_2].push_back( GAMESTATE->m_pCurSteps[PLAYER_2] ); GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 2; GAMESTATE->m_PlayerOptions[PLAYER_2].m_fScrollSpeed = 2; GAMESTATE->m_iCurrentStageIndex = 0; GAMESTATE->m_PlayerOptions[PLAYER_1].ChooseRandomMofifiers(); GAMESTATE->m_PlayerOptions[PLAYER_2].ChooseRandomMofifiers(); for( float f = 0; f < 100.0f; f += 1.0f ) { float fP1 = fmodf(f/100*4+.3f,1); g_CurStageStats.SetLifeRecordAt( PLAYER_1, fP1, f ); g_CurStageStats.SetLifeRecordAt( PLAYER_2, 1-fP1, f ); } g_CurStageStats.iActualDancePoints[PLAYER_1] = rand()%3; g_CurStageStats.iPossibleDancePoints[PLAYER_1] = 2; g_CurStageStats.iActualDancePoints[PLAYER_2] = rand()&1; g_CurStageStats.iPossibleDancePoints[PLAYER_2] = 1; g_CurStageStats.iCurCombo[PLAYER_1] = 0; g_CurStageStats.UpdateComboList( PLAYER_1, 0, false ); g_CurStageStats.iCurCombo[PLAYER_1] = 1; g_CurStageStats.UpdateComboList( PLAYER_1, 1, false ); g_CurStageStats.iCurCombo[PLAYER_1] = 50; g_CurStageStats.UpdateComboList( PLAYER_1, 25, false ); g_CurStageStats.iCurCombo[PLAYER_1] = 250; g_CurStageStats.UpdateComboList( PLAYER_1, 100, false ); g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_MARVELOUS] = rand()&1; g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_PERFECT] = rand()&1; g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_GREAT] = rand()&1; g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_MARVELOUS] = rand()&1; g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_PERFECT] = rand()&1; g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_GREAT] = rand()&1; g_vPlayedStageStats.clear(); } // Update final profile stats before we load them for display below. GAMESTATE->FinishStage(); vector<Song*> arraySongs; SONGMAN->GetSongs( arraySongs ); SongUtil::SortSongPointerArrayByTitle( arraySongs ); const CString sStatsTitleFont = THEME->GetPathToF( "ScreenEnding stats title" ); const CString sStatsValueFont = THEME->GetPathToF( "ScreenEnding stats value" ); FOREACH_PlayerNumber( p ) { if( !GAMESTATE->IsHumanPlayer(p) ) continue; // skip Profile* pProfile = PROFILEMAN->GetProfile( p ); m_textPlayerName[p].LoadFromFont( THEME->GetPathToF("ScreenEnding player name") ); m_textPlayerName[p].SetText( pProfile ? pProfile->GetDisplayName() : CString("NO CARD") ); m_textPlayerName[p].SetName( ssprintf("PlayerNameP%d",p+1) ); SET_XY_AND_ON_COMMAND( m_textPlayerName[p] ); this->AddChild( &m_textPlayerName[p] ); if( pProfile == NULL ) continue; // don't show the stats lines FOREACH_EndingStatsLine( i ) { m_Lines[i][p].title.LoadFromFont( sStatsTitleFont ); m_Lines[i][p].title.SetText( GetStatsLineTitle(p, i) ); m_Lines[i][p].title.SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) ); SET_XY_AND_ON_COMMAND( m_Lines[i][p].title ); this->AddChild( &m_Lines[i][p].title ); m_Lines[i][p].value.LoadFromFont( sStatsValueFont ); m_Lines[i][p].value.SetText( GetStatsLineValue(p, i) ); m_Lines[i][p].value.SetName( ssprintf("StatsValueP%dLine%d",p+1,i+1) ); SET_XY_AND_ON_COMMAND( m_Lines[i][p].value ); this->AddChild( &m_Lines[i][p].value ); } } this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") ); // Now that we've read the data from the profile, it's ok to Reset() GAMESTATE->Reset(); float fSecsUntilBeginFadingOut = m_Background.GetLengthSeconds() - m_Out.GetLengthSeconds(); if( fSecsUntilBeginFadingOut < 0 ) { LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated", m_sName.c_str(), m_Out.GetLengthSeconds(), m_Background.GetLengthSeconds() ); fSecsUntilBeginFadingOut = 0; } this->PostScreenMessage( SM_BeginFadingOut, fSecsUntilBeginFadingOut ); }
void ScreenPackages::Init() { ScreenWithMenuElements::Init(); m_iPackagesPos = 0; m_iLinksPos = 0; m_iDLorLST = 0; m_bIsDownloading = false; m_bCanDL = THEME->GetMetricB( m_sName, "CanDL" ); m_sStatus = ""; m_fLastUpdate = 0; m_iTotalBytes = 0; m_iDownloaded = 0; FOREACH_PlayerNumber( pn ) GAMESTATE->m_bSideIsJoined[pn] = true; m_sprExistingBG.SetName( "PackagesBG" ); m_sprExistingBG.Load( THEME->GetPathG( m_sName, "PackagesBG" ) ); SET_XY_AND_ON_COMMAND( m_sprExistingBG ); this->AddChild( &m_sprExistingBG ); m_sprWebBG.SetName( "WebBG" ); m_sprWebBG.Load( THEME->GetPathG( m_sName, "WebBG" ) ); SET_XY_AND_ON_COMMAND( m_sprWebBG ); this->AddChild( &m_sprWebBG ); COMMAND( m_sprExistingBG, "Back" ); COMMAND( m_sprWebBG, "Away" ); // m_fOutputFile. m_textPackages.LoadFromFont( THEME->GetPathF(m_sName,"default") ); m_textPackages.SetShadowLength( 0 ); m_textPackages.SetName( "Packages" ); m_textPackages.SetMaxWidth( EXISTINGBG_WIDTH ); SET_XY_AND_ON_COMMAND( m_textPackages ); this->AddChild( &m_textPackages ); RefreshPackages(); m_textWeb.LoadFromFont( THEME->GetPathF(m_sName,"default") ); m_textWeb.SetShadowLength( 0 ); m_textWeb.SetName( "Web" ); m_textWeb.SetMaxWidth( WEBBG_WIDTH ); SET_XY_AND_ON_COMMAND( m_textWeb ); this->AddChild( &m_textWeb); m_Links.push_back( " " ); m_LinkTitles.push_back( "--Visit URL--" ); m_textURL.LoadFromFont( THEME->GetPathF( m_sName,"default") ); m_textURL.SetShadowLength( 0 ); m_textURL.SetName( "WebURL" ); SET_XY_AND_ON_COMMAND( m_textURL ); this->AddChild( &m_textURL ); UpdateLinksList(); m_sprWebSel.SetName( "WebSel" ); m_sprWebSel.Load( THEME->GetPathG( m_sName, "WebSel" ) ); SET_XY_AND_ON_COMMAND( m_sprWebSel ); this->AddChild( &m_sprWebSel ); m_sprDLBG.SetName( "Download" ); m_sprDLBG.Load( THEME->GetPathG( m_sName, "DownloadBG" ) ); SET_XY_AND_ON_COMMAND( m_sprDLBG ); this->AddChild( &m_sprDLBG ); //(HTTP ELEMENTS) m_sprDL.SetName( "Download" ); m_sprDL.Load( THEME->GetPathG( m_sName, "Download" ) ); SET_XY_AND_ON_COMMAND( m_sprDL ); this->AddChild( &m_sprDL ); m_sprDL.SetDiffuse( THEME->GetMetricC( m_sName, "DownloadProgressColor" ) ); m_textStatus.LoadFromFont( THEME->GetPathF(m_sName,"default") ); m_textStatus.SetShadowLength( 0 ); m_textStatus.SetName( "DownloadStatus" ); SET_XY_AND_ON_COMMAND( m_textStatus ); this->AddChild( &m_textStatus ); UpdateProgress(); //Workaround: For some reason, the first download sometimes //corrupts; by opening and closing the rage file, this //problem does not occour. Go figure? //XXX: This is a really dirty work around! //Why does RageFile do this? //It's always some strange number of bytes at the end of the //file when it corrupts. m_fOutputFile.Open( "Packages/dummy.txt", RageFile::WRITE ); m_fOutputFile.Close(); }
void ScreenSelectStyle::Init() { ScreenSelect::Init(); m_iSelection = 0; for( unsigned i=0; i<m_aGameCommands.size(); i++ ) { const GameCommand& mc = m_aGameCommands[i]; // // Load icon // CString sIconPath = THEME->GetPathG(m_sName,ssprintf("icon%d",i+1)); m_textIcon[i].SetName( ssprintf("Icon%d",i+1) ); m_sprIcon[i].SetName( ssprintf("Icon%d",i+1) ); if( sIconPath.empty() ) // element doesn't exist { m_textIcon[i].LoadFromFont( THEME->GetPathF("Common","normal") ); m_textIcon[i].SetText( mc.m_sName ); m_textIcon[i].SetZoom(0.5f); this->AddChild( &m_textIcon[i] ); } else { m_sprIcon[i].Load( sIconPath ); this->AddChild( &m_sprIcon[i] ); } // // Load Picture // CString sPicturePath = THEME->GetPathG(m_sName, ssprintf("picture%d",i+1)); if( sPicturePath != "" ) { m_sprPicture[i].SetName( "Picture" ); m_sprPicture[i].Load( sPicturePath ); m_sprPicture[i].SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprPicture[i] ); } // // Load info // CString sInfoPath = THEME->GetPathG(m_sName,ssprintf("info%d",i+1)); if( sInfoPath != "" ) { m_sprInfo[i].SetName( "Info" ); m_sprInfo[i].Load( sInfoPath ); m_sprInfo[i].SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprInfo[i] ); } } m_sprWarning.SetName( "Warning" ); m_sprWarning.Load( THEME->GetPathG(m_sName,"warning") ); this->AddChild( &m_sprWarning ); m_sprExplanation.SetName( "Explanation" ); m_sprExplanation.Load( THEME->GetPathG(m_sName,"explanation") ); this->AddChild( &m_sprExplanation ); // fix Z ordering of Picture and Info so that they draw on top for( unsigned i=0; i<this->m_aGameCommands.size(); i++ ) this->MoveToTail( &m_sprPicture[i] ); for( unsigned i=0; i<this->m_aGameCommands.size(); i++ ) this->MoveToTail( &m_sprInfo[i] ); this->UpdateSelectableChoices(); m_sprPremium.SetName( "Premium" ); switch( GAMESTATE->GetPremium() ) { case PREMIUM_DOUBLE: m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") ); this->AddChild( &m_sprPremium ); break; case PREMIUM_JOINT: m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") ); this->AddChild( &m_sprPremium ); break; } m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true ); // // TweenOnScreen // for( unsigned i=0; i<m_aGameCommands.size(); i++ ) { SET_XY_AND_ON_COMMAND( m_textIcon[i] ); SET_XY_AND_ON_COMMAND( m_sprIcon[i] ); } SET_XY_AND_ON_COMMAND( m_sprExplanation ); SET_XY_AND_ON_COMMAND( m_sprWarning ); SET_XY_AND_ON_COMMAND( m_sprPremium ); // let AfterChange tween Picture and Info this->SortByDrawOrder(); }
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(); }