void EditMenu::Down() { if( CanGoDown() ) { if( GetSelectedNotes() && m_SelectedRow==ROW_DIFFICULTY ) ChangeToRow( ROW_ACTION ); else ChangeToRow( Row(m_SelectedRow+1) ); m_soundChangeRow.PlayRandom(); } }
EditCoursesMenu::EditCoursesMenu() { LOG->Trace( "ScreenEditCoursesMenu::ScreenEditCoursesMenu()" ); m_bInSongMenu = false; for( int i=0; i<2; i++ ) { m_sprArrows[i].Load( THEME->GetPathG("EditCoursesMenu",i==0?"left":"right") ); m_sprArrows[i].SetX( ARROWS_X(i) ); this->AddChild( &m_sprArrows[i] ); } m_SelectedRow = (Row)0; ZERO( m_iSelection ); for( int i=0; i<NUM_ROWS; i++ ) { m_textLabel[i].LoadFromFont( THEME->GetPathF("Common","title") ); m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); m_textLabel[i].SetText( RowToString((Row)i) ); m_textLabel[i].SetZoom( 0.8f ); m_textLabel[i].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textLabel[i] ); m_textValue[i].LoadFromFont( THEME->GetPathF("Common","normal") ); m_textValue[i].SetXY( ROW_VALUE_X(i), ROW_Y(i) ); m_textValue[i].SetText( "blah" ); m_textValue[i].SetZoom( 0.6f ); this->AddChild( &m_textValue[i] ); } m_CourseBanner.SetXY( COURSE_BANNER_X, COURSE_BANNER_Y ); this->AddChild( &m_CourseBanner ); m_EntryBanner.SetXY( ENTRY_BANNER_X, ENTRY_BANNER_Y ); this->AddChild( &m_EntryBanner ); m_EntryTextBanner.SetName( "TextBanner" ); m_EntryTextBanner.SetXY( ENTRY_TEXT_BANNER_X, ENTRY_TEXT_BANNER_Y ); this->AddChild( &m_EntryTextBanner ); m_soundChangeRow.Load( THEME->GetPathS("EditCoursesMenu","row") ); m_soundChangeValue.Load( THEME->GetPathS("EditCoursesMenu","value") ); m_soundSave.Load( THEME->GetPathS("EditCoursesMenu","save") ); // fill in data structures SONGMAN->GetAllCourses( m_pCourses, false ); ChangeToRow( (Row)0 ); OnRowValueChanged( (Row)0 ); }
void EditCoursesMenu::Down() { if( m_bInSongMenu ) { m_SongMenu.Down(); return; } if( CanGoDown() ) { ChangeToRow( Row(m_SelectedRow+1) ); m_soundChangeRow.Play(); } }
bool EditCoursesSongMenu::ChangeRow( int add ) { Row dest = m_SelectedRow; do { dest = (Row) (dest+add); } while( dest >= 0 && dest < NUM_ROWS && !g_bRowEnabledForType[GetSelectedType()][dest] ); if( dest < 0 || dest >= NUM_ROWS ) return false; ChangeToRow( dest ); return true; }
void EditCoursesSongMenu::LoadFromCourseEntry( const CourseEntry *pEntry ) { ZERO( m_iSelection ); if( pEntry->pSong ) { /* Set this song's group. */ SetGroupByName( pEntry->pSong->m_sGroupName ); unsigned i; for( i = 0; i < m_aSongs.size(); ++i ) if( m_aSongs[i] == pEntry->pSong ) break; ASSERT_M( i < m_aSongs.size(), ssprintf("%s", pEntry->pSong->GetTranslitMainTitle().c_str()) ); m_iSelection[ROW_SONG] = i; } else if( pEntry->group_name != "" ) { SetGroupByName( pEntry->group_name ); } m_iSelection[ROW_TYPE] = pEntry->type; m_iSelection[ROW_DIFFICULTY] = (pEntry->difficulty == DIFFICULTY_INVALID)? 0:pEntry->difficulty+1; m_iSelection[ROW_LOW_METER] = (pEntry->low_meter == -1)? 0:pEntry->low_meter; m_iSelection[ROW_HIGH_METER] = (pEntry->high_meter == -1)? 0:pEntry->high_meter; m_iSelection[ROW_BEST_WORST_VALUE] = pEntry->players_index; /* Make sure we're on an active row. */ if( !g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ) ChangeRow( -1 ); if( !g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ) ChangeRow( +1 ); ASSERT( g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ); ChangeToRow( m_SelectedRow ); OnRowValueChanged( (Row)0 ); }
EditCoursesMenu::EditCoursesMenu() { LOG->Trace( "ScreenEditCoursesMenu::ScreenEditCoursesMenu()" ); GAMESTATE->m_bEditing = true; m_bInSongMenu = false; int i; for( i=0; i<2; i++ ) { m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditCoursesMenu %s",(i==0?"left":"right"))) ); m_sprArrows[i].SetX( ARROWS_X(i) ); this->AddChild( &m_sprArrows[i] ); } m_SelectedRow = (Row)0; ZERO( m_iSelection ); const CString sTitleFontPath = THEME->GetPathToF( "Common title" ); const CString sNormalFontPath = THEME->GetPathToF( "Common normal" ); const float fRowLabelsX = ROW_LABELS_X; for( i=0; i<NUM_ROWS; i++ ) { const float fRowY = ROW_Y(i); m_textLabel[i].LoadFromFont( sTitleFontPath ); m_textLabel[i].SetXY( fRowLabelsX, fRowY ); m_textLabel[i].SetText( RowToString((Row)i) ); m_textLabel[i].SetZoom( 0.8f ); m_textLabel[i].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textLabel[i] ); m_textValue[i].LoadFromFont( sNormalFontPath ); m_textValue[i].SetXY( ROW_VALUE_X(i), fRowY ); m_textValue[i].SetText( "blah" ); m_textValue[i].SetZoom( 0.6f ); this->AddChild( &m_textValue[i] ); } m_CourseBanner.SetXY( COURSE_BANNER_X, COURSE_BANNER_Y ); this->AddChild( &m_CourseBanner ); m_EntryBanner.SetXY( ENTRY_BANNER_X, ENTRY_BANNER_Y ); this->AddChild( &m_EntryBanner ); m_EntryTextBanner.SetName( "TextBanner" ); m_EntryTextBanner.SetXY( ENTRY_TEXT_BANNER_X, ENTRY_TEXT_BANNER_Y ); this->AddChild( &m_EntryTextBanner ); m_soundChangeRow.Load( THEME->GetPathToS("EditCoursesMenu row") ); m_soundChangeValue.Load( THEME->GetPathToS("EditCoursesMenu value") ); m_soundSave.Load( THEME->GetPathToS("EditCoursesMenu save") ); // fill in data structures SONGMAN->GetAllCourses( m_pCourses, false ); ChangeToRow( (Row)0 ); OnRowValueChanged( (Row)0 ); }
EditMenu::EditMenu() { LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" ); int i; for( i=0; i<2; i++ ) { m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditMenu %s",(i==0?"left":"right"))) ); m_sprArrows[i].SetX( ARROWS_X(i) ); this->AddChild( &m_sprArrows[i] ); } m_SelectedRow = (Row)0; ZERO( m_iSelection ); // start out on easy, not beginner m_iSelection[ROW_DIFFICULTY] = DIFFICULTY_EASY; m_iSelection[ROW_SOURCE_DIFFICULTY] = DIFFICULTY_EASY; for( i=0; i<NUM_ROWS; i++ ) { m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") ); m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); m_textLabel[i].SetText( RowToString((Row)i) ); m_textLabel[i].SetZoom( 0.8f ); m_textLabel[i].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textLabel[i] ); m_textValue[i].LoadFromFont( THEME->GetPathToF("Common normal") ); m_textValue[i].SetXY( ROW_VALUE_X(i), ROW_Y(i) ); m_textValue[i].SetText( "blah" ); m_textValue[i].SetZoom( 0.8f ); this->AddChild( &m_textValue[i] ); } m_GroupBanner.SetXY( GROUP_BANNER_X, GROUP_BANNER_Y ); this->AddChild( &m_GroupBanner ); m_SongBanner.SetXY( SONG_BANNER_X, SONG_BANNER_Y ); this->AddChild( &m_SongBanner ); m_SongTextBanner.SetName( "TextBanner" ); m_SongTextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y ); this->AddChild( &m_SongTextBanner ); m_Meter.SetName( "EditDifficultyMeter", "DifficultyMeter" ); m_Meter.SetXY( METER_X, METER_Y ); m_Meter.Load(); this->AddChild( &m_Meter ); m_SourceMeter.SetName( "EditDifficultyMeter", "DifficultyMeter" ); m_SourceMeter.SetXY( SOURCE_METER_X, SOURCE_METER_Y ); m_SourceMeter.Load(); this->AddChild( &m_SourceMeter ); m_soundChangeRow.Load( THEME->GetPathToS("EditMenu row") ); m_soundChangeValue.Load( THEME->GetPathToS("EditMenu value") ); // fill in data structures SONGMAN->GetGroupNames( m_sGroups ); GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, m_StepsTypes ); ChangeToRow( (Row)0 ); OnRowValueChanged( (Row)0 ); // Select the current song if any if( GAMESTATE->m_pCurSong ) { unsigned i; for( i=0; i<m_sGroups.size(); i++ ) if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] ) m_iSelection[ROW_GROUP] = i; OnRowValueChanged( ROW_GROUP ); for( i=0; i<m_pSongs.size(); i++ ) if( GAMESTATE->m_pCurSong == m_pSongs[i] ) m_iSelection[ROW_SONG] = i; OnRowValueChanged( ROW_SONG ); // Select the current StepsType and difficulty if any if( GAMESTATE->m_pCurSteps[PLAYER_1] ) { for( i=0; i<m_StepsTypes.size(); i++ ) { if( m_StepsTypes[i] == GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType ) { m_iSelection[ROW_STEPS_TYPE] = i; OnRowValueChanged( ROW_STEPS_TYPE ); m_iSelection[ROW_DIFFICULTY] = GAMESTATE->m_pCurSteps[PLAYER_1]->GetDifficulty(); OnRowValueChanged( ROW_DIFFICULTY ); break; } } } } }