void MusicBannerWheel::PlayMusicSample() { Song* pSong = GetSelectedSong(); if( pSong && pSong->HasMusic() ) { if(SOUND->GetMusicPath().CompareNoCase(pSong->GetMusicPath())) // dont play the same sound over and over { SOUND->StopMusic(); SOUND->PlayMusic(pSong->GetMusicPath(), true, pSong->m_fMusicSampleStartSeconds, pSong->m_fMusicSampleLengthSeconds); } } }
void EditCoursesSongMenu::SaveToCourseEntry( CourseEntry *pEntry ) { *pEntry = CourseEntry(); pEntry->type = (CourseEntryType) m_iSelection[ROW_TYPE]; /* Only set things relevant to this type. */ if( g_bRowEnabledForType[pEntry->type][ROW_GROUP] ) pEntry->group_name = GetSelectedGroup(); if( g_bRowEnabledForType[pEntry->type][ROW_SONG] ) pEntry->pSong = GetSelectedSong(); if( g_bRowEnabledForType[pEntry->type][ROW_DIFFICULTY] ) pEntry->difficulty = GetSelectedDifficulty(); if( g_bRowEnabledForType[pEntry->type][ROW_LOW_METER] ) pEntry->low_meter = GetLowMeter(); if( g_bRowEnabledForType[pEntry->type][ROW_HIGH_METER] ) pEntry->high_meter = GetHighMeter(); if( g_bRowEnabledForType[pEntry->type][ROW_BEST_WORST_VALUE] ) pEntry->players_index = GetBestWorst(); if( pEntry->high_meter < pEntry->low_meter ) swap( pEntry->low_meter, pEntry->high_meter ); }
void EditCoursesSongMenu::OnRowValueChanged( Row row ) { LOG->Trace( "EditCoursesSongMenu::OnRowValueChanged(%i)", row ); m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[0].EnableAnimation( CanGoLeft() ); m_sprArrows[1].EnableAnimation( CanGoRight() ); CString sGroup = GetSelectedGroup(); Song *pSong = GetSelectedSong(); switch( row ) { case ROW_GROUP: { CHECKPOINT; m_textValue[ROW_GROUP].SetText( sGroup ); UpdateSongList(); pSong = GetSelectedSong(); } // fall through case ROW_SONG: CHECKPOINT; m_textValue[ROW_SONG].SetText( pSong? pSong->GetTranslitMainTitle():CString("") ); // fall through case ROW_TYPE: CHECKPOINT; m_textValue[ROW_TYPE].SetText( CourseEntryTypeToString(GetSelectedType()) ); for( int i = 0; i < NUM_ROWS; ++i ) m_textValue[i].SetDiffuse( g_bRowEnabledForType[GetSelectedType()][i]? RageColor(1,1,1,1):RageColor(0.4f,0.4f,0.4f,1) ); // fall through case ROW_DIFFICULTY: { CHECKPOINT; Difficulty dc = GetSelectedDifficulty(); if( dc == DIFFICULTY_INVALID ) m_textValue[ROW_DIFFICULTY].SetText( "(any)" ); else m_textValue[ROW_DIFFICULTY].SetText( DifficultyToString(dc) ); // fall through } case ROW_LOW_METER: CHECKPOINT; if( GetLowMeter() == -1 ) m_textValue[ROW_LOW_METER].SetText( "(any)" ); else m_textValue[ROW_LOW_METER].SetText( ssprintf("%d",GetLowMeter()) ); // fall through case ROW_HIGH_METER: CHECKPOINT; if( GetHighMeter() == -1 ) m_textValue[ROW_HIGH_METER].SetText( "(any)" ); else m_textValue[ROW_HIGH_METER].SetText( ssprintf("%d",GetHighMeter()) ); // fall through case ROW_BEST_WORST_VALUE: CHECKPOINT; m_textValue[ROW_BEST_WORST_VALUE].SetText( ssprintf("%d",GetBestWorst()+1) ); break; default: ASSERT(0); // invalid row } }
Steps* EditMenu::GetSelectedSourceNotes() { return GetSelectedSong()->GetStepsByDifficulty(GetSelectedSourceStepsType(),GetSelectedSourceDifficulty(), false); }
void EditMenu::OnRowValueChanged( Row row ) { m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[0].EnableAnimation( CanGoLeft() ); m_sprArrows[1].EnableAnimation( CanGoRight() ); switch( row ) { case ROW_GROUP: m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); m_GroupBanner.LoadFromGroup( GetSelectedGroup() ); m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT ); m_pSongs.clear(); SONGMAN->GetSongs( m_pSongs, GetSelectedGroup() ); m_iSelection[ROW_SONG] = 0; // fall through case ROW_SONG: m_textValue[ROW_SONG].SetText( "" ); m_SongBanner.LoadFromSong( GetSelectedSong() ); m_SongBanner.ScaleToClipped( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT ); m_SongTextBanner.LoadFromSong( GetSelectedSong() ); // fall through case ROW_STEPS_TYPE: m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToString(GetSelectedStepsType()) ); // fall through case ROW_DIFFICULTY: m_textValue[ROW_DIFFICULTY].SetText( DifficultyToString(GetSelectedDifficulty()) ); m_Meter.SetFromSteps( GetSelectedNotes() ); // fall through case ROW_SOURCE_STEPS_TYPE: m_textLabel[ROW_SOURCE_STEPS_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_STEPS_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToString(GetSelectedSourceStepsType()) ); // fall through case ROW_SOURCE_DIFFICULTY: m_textLabel[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_DIFFICULTY].SetText( DifficultyToString(GetSelectedSourceDifficulty()) ); m_SourceMeter.SetFromSteps( GetSelectedSourceNotes() ); m_SourceMeter.SetZoomY( GetSelectedNotes()?0.f:1.f ); m_Actions.clear(); if( GetSelectedNotes() ) { m_Actions.push_back( ACTION_EDIT ); m_Actions.push_back( ACTION_DELETE ); } else if( GetSelectedSourceNotes() ) { m_Actions.push_back( ACTION_COPY ); m_Actions.push_back( ACTION_AUTOGEN ); m_Actions.push_back( ACTION_BLANK ); } else { m_Actions.push_back( ACTION_BLANK ); } m_iSelection[ROW_ACTION] = 0; // fall through case ROW_ACTION: m_textValue[ROW_ACTION].SetText( ActionToString(GetSelectedAction()) ); break; default: ASSERT(0); // invalid row } }