ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName ) { LOG->Trace( "ScreenNameEntry::ScreenNameEntry()" ); // update cache g_fCharsZoomSmall = CHARS_ZOOM_SMALL; g_fCharsZoomLarge = CHARS_ZOOM_LARGE; g_fCharsSpacingY = CHARS_SPACING_Y; g_ScrollingCharsColor = SCROLLING_CHARS_COLOR; g_SelectedCharsColor = SELECTED_CHARS_COLOR; g_fReceptorArrowsY = GRAY_ARROWS_Y; g_iNumCharsToDrawBehind = NUM_CHARS_TO_DRAW_BEHIND; g_iNumCharsToDrawTotal = NUM_CHARS_TO_DRAW_TOTAL; g_fFakeBeatsPerSec = FAKE_BEATS_PER_SEC; // DEBUGGING STUFF // GAMESTATE->m_CurGame = GAME_DANCE; // GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE; // GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; // GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; // GAMESTATE->m_MasterPlayerNumber = PLAYER_1; // GAMESTATE->m_RankingCategory[PLAYER_1] = RANKING_A; // GAMESTATE->m_iRankingIndex[PLAYER_1] = 0; /* Save options. We'll reset them to display letters, and we must put them * back when we're done. */ GAMESTATE->StoreSelectedOptions(); // reset Player and Song Options { FOREACH_PlayerNumber( p ) GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions(); GAMESTATE->m_SongOptions = SongOptions(); } vector<GameState::RankingFeat> aFeats[NUM_PLAYERS]; // Find out if players deserve to enter their name FOREACH_PlayerNumber( p ) { GAMESTATE->GetRankingFeats( p, aFeats[p] ); m_bStillEnteringName[p] = aFeats[p].size()>0; } if( !AnyStillEntering() ) { /* Nobody made a high score. */ HandleScreenMessage( SM_GoToNextScreen ); return; } bool IsOnRanking = ( (GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP || GAMESTATE->m_PlayMode == PLAY_MODE_ONI) && !(GAMESTATE->m_pCurCourse->IsRanking()) ); if( PREFSMAN->m_GetRankingName == PrefsManager::RANKING_OFF || (PREFSMAN->m_GetRankingName == PrefsManager::RANKING_LIST && !IsOnRanking) ) { // don't collect score due to ranking setting HandleScreenMessage( SM_GoToNextScreen ); return; } GAMESTATE->m_bPastHereWeGo = true; // enable the gray arrows FOREACH_PlayerNumber( p ) { // load last used ranking name if any Profile* pProfile = PROFILEMAN->GetProfile(p); if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() ) m_sSelectedName[p] = pProfile->m_sLastUsedHighScoreName; // resize string to MAX_RANKING_NAME_LENGTH m_sSelectedName[p] = ssprintf( "%*.*s", MAX_RANKING_NAME_LENGTH, MAX_RANKING_NAME_LENGTH, m_sSelectedName[p].c_str() ); ASSERT( (int) m_sSelectedName[p].length() == MAX_RANKING_NAME_LENGTH ); // don't load player if they aren't going to enter their name if( !m_bStillEnteringName[p] ) continue; // skip // remove modifiers that may have been on the last song GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions(); ASSERT( GAMESTATE->IsHumanPlayer(p) ); // they better be enabled if they made a high score! float fPlayerX = PLAYER_X(p,GAMESTATE->GetCurrentStyle()->m_StyleType); { LockNoteSkin l( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_sNoteSkin ); m_ReceptorArrowRow[p].Load( GAMESTATE->m_pPlayerState[p], 0 ); m_ReceptorArrowRow[p].SetX( fPlayerX ); m_ReceptorArrowRow[p].SetY( SCREEN_TOP + 100 ); this->AddChild( &m_ReceptorArrowRow[p] ); } const Style* pStyle = GAMESTATE->GetCurrentStyle(); m_ColToStringIndex[p].insert(m_ColToStringIndex[p].begin(), pStyle->m_iColsPerPlayer, -1); int CurrentStringIndex = 0; for( int t=0; t<pStyle->m_iColsPerPlayer; t++ ) { if(CurrentStringIndex == MAX_RANKING_NAME_LENGTH) continue; /* We have enough columns. */ /* Find out if this column is associated with the START menu button. */ StyleInput si(p, t); GameInput gi=GAMESTATE->GetCurrentStyle()->StyleInputToGameInput(si); MenuInput m=GAMESTATE->GetCurrentGame()->GameInputToMenuInput(gi); if(m.button == MENU_BUTTON_START) continue; m_ColToStringIndex[p][t] = CurrentStringIndex++; float ColX = fPlayerX + pStyle->m_ColumnInfo[p][t].fXOffset; m_textSelectedChars[p][t].LoadFromFont( THEME->GetPathF("ScreenNameEntry","letters") ); m_textSelectedChars[p][t].SetX( ColX ); m_textSelectedChars[p][t].SetY( GRAY_ARROWS_Y ); m_textSelectedChars[p][t].SetDiffuse( g_SelectedCharsColor ); m_textSelectedChars[p][t].SetZoom( CHARS_ZOOM_LARGE ); if( t < (int)m_sSelectedName[p].length() ) m_textSelectedChars[p][t].SetText( m_sSelectedName[p].substr(t,1) ); this->AddChild( &m_textSelectedChars[p][t] ); // draw these manually m_textScrollingChars[p][t].LoadFromFont( THEME->GetPathF("ScreenNameEntry","letters") ); m_textScrollingChars[p][t].SetX( ColX ); m_textScrollingChars[p][t].SetY( GRAY_ARROWS_Y ); m_textScrollingChars[p][t].SetDiffuse( g_ScrollingCharsColor ); //this->AddChild( &m_textScrollingChars[p][t] ); // draw these manually } m_textCategory[p].LoadFromFont( THEME->GetPathF("ScreenNameEntry","category") ); m_textCategory[p].SetX( fPlayerX ); m_textCategory[p].SetY( CATEGORY_Y ); m_textCategory[p].SetZoom( CATEGORY_ZOOM ); CString joined; for( unsigned j = 0; j < aFeats[p].size(); ++j ) { if( j ) joined += "\n"; joined += aFeats[p][j].Feat; } m_textCategory[p].SetText( joined ); this->AddChild( &m_textCategory[p] ); } if( !PREFSMAN->m_bMenuTimer ) m_Timer.Disable(); else m_Timer.SetSeconds(TIMER_SECONDS); m_Timer.SetXY( TIMER_X, TIMER_Y ); this->AddChild( &m_Timer ); m_In.Load( THEME->GetPathB("ScreenNameEntry","in") ); m_In.StartTransitioning(); // this->AddChild( &m_In ); // draw and update this manually too m_Out.Load( THEME->GetPathB("ScreenNameEntry","out") ); // this->AddChild( &m_Out ); // draw and update this manually too m_soundStep.Load( THEME->GetPathS("ScreenNameEntry","step") ); SOUND->PlayMusic( THEME->GetPathS("ScreenNameEntry","music") ); m_fFakeBeat = 0; }
void EditCoursesMenu::Start() { if( m_bInSongMenu ) { m_SongMenu.SaveToCourseEntry( GetSelectedEntry() ); m_bInSongMenu = false; OnRowValueChanged( ROW_ENTRY ); return; } Course* pCourse = GetSelectedCourse(); CourseEntry* pEntry = GetSelectedEntry(); switch( m_SelectedRow ) { case ROW_COURSE_OPTIONS: g_CourseOptionsMenu.rows[repeat].defaultChoice = pCourse->m_bRepeat ? 1 : 0; g_CourseOptionsMenu.rows[randomize].defaultChoice = pCourse->m_bRandomize ? 1 : 0; g_CourseOptionsMenu.rows[lives].defaultChoice = pCourse->m_iLives; if( g_CourseOptionsMenu.rows[lives].defaultChoice == -1 ) g_CourseOptionsMenu.rows[lives].defaultChoice = 0; SCREENMAN->MiniMenu( &g_CourseOptionsMenu, SM_BackFromCourseOptionsMenu ); break; case ROW_ACTION: switch( GetSelectedAction() ) { case save: m_soundSave.Play(); pCourse->Save(); SCREENMAN->SystemMessage( "Course saved." ); break; case add_entry: SCREENMAN->PlayStartSound(); pCourse->m_entries.insert( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY], pCourse->m_entries[m_iSelection[ROW_ENTRY]] ); OnRowValueChanged( ROW_ENTRY ); break; case delete_selected_entry: if( pCourse->m_entries.size() == 1 ) { SCREENMAN->PlayInvalidSound(); SCREENMAN->SystemMessage( "Cannot delete the last entry from a course" ); break; } SCREENMAN->PlayStartSound(); pCourse->m_entries.erase( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY] ); CLAMP( m_iSelection[ROW_ENTRY], 0, (int) pCourse->m_entries.size()-1 ); OnRowValueChanged( ROW_ENTRY ); break; default: ASSERT(0); } OnRowValueChanged( ROW_ENTRY ); break; case ROW_ENTRY_OPTIONS: m_SongMenu.LoadFromCourseEntry( GetSelectedEntry() ); m_bInSongMenu = true; break; case ROW_ENTRY_PLAYER_OPTIONS: SCREENMAN->PlayStartSound(); GAMESTATE->m_PlayerOptions[PLAYER_1] = PlayerOptions(); GAMESTATE->m_PlayerOptions[PLAYER_1].FromString( pEntry->modifiers ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions ); break; case ROW_ENTRY_SONG_OPTIONS: SCREENMAN->PlayStartSound(); GAMESTATE->m_SongOptions = SongOptions(); GAMESTATE->m_SongOptions.FromString( pEntry->modifiers ); SCREENMAN->AddNewScreenToTop( "ScreenSongOptions", SM_BackFromSongOptions ); break; default: SCREENMAN->PlayInvalidSound(); return; } }