void NotesWriterSM::WriteSMNotesTag( const Steps &in, RageFile &f, bool bSavingCache ) { f.PutLine( "" ); f.PutLine( ssprintf( "//---------------%s - %s----------------", GameManager::StepsTypeToString(in.m_StepsType).c_str(), in.GetDescription().c_str() ) ); f.PutLine( "#NOTES:" ); f.PutLine( ssprintf( " %s:", GameManager::StepsTypeToString(in.m_StepsType).c_str() ) ); f.PutLine( ssprintf( " %s:", in.GetDescription().c_str() ) ); f.PutLine( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) ); f.PutLine( ssprintf( " %d:", in.GetMeter() ) ); int MaxRadar = bSavingCache? NUM_RADAR_CATEGORIES:5; CStringArray asRadarValues; for( int r=0; r < MaxRadar; r++ ) asRadarValues.push_back( ssprintf("%.3f", in.GetRadarValues()[r]) ); /* Don't append a newline here; it's added in NoteDataUtil::GetSMNoteDataString. * If we add it here, then every time we write unmodified data we'll add an extra * newline and they'll accumulate. */ f.Write( ssprintf( " %s:", join(",",asRadarValues).c_str() ) ); CString sNoteData; CString sAttackData; in.GetSMNoteData( sNoteData, sAttackData ); vector<CString> lines; split( sNoteData, "\n", lines, false ); WriteLineList( f, lines, true, true ); if( sAttackData.empty() ) f.PutLine( ";" ); else { f.PutLine( ":" ); lines.clear(); split( sAttackData, "\n", lines, false ); WriteLineList( f, lines, true, true ); f.PutLine( ";" ); } }
/* Add a list of difficulties/edits to the given row/handler. */ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand ) { hand.type = ROW_STEP; row.bOneChoiceForAllPlayers = false; // fill in difficulty names if( GAMESTATE->m_bEditing ) { row.choices.push_back( "" ); hand.ListEntries.push_back( ModeChoice() ); } else if( GAMESTATE->IsCourseMode() ) // playing a course { row.bOneChoiceForAllPlayers = PREFSMAN->m_bLockCourseDifficulties; vector<Trail*> vTrails; GAMESTATE->m_pCurCourse->GetTrails( vTrails, GAMESTATE->GetCurrentStyle()->m_StepsType ); ModeChoice mc; for( unsigned i=0; i<vTrails.size(); i++ ) { row.choices.push_back( CourseDifficultyToThemedString(vTrails[i]->m_CourseDifficulty) ); mc.m_pTrail = vTrails[i]; hand.ListEntries.push_back( mc ); } } else // !GAMESTATE->IsCourseMode(), playing a song { vector<Steps*> vSteps; GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyle()->m_StepsType ); StepsUtil::SortNotesArrayByDifficulty( vSteps ); ModeChoice mc; for( unsigned i=0; i<vSteps.size(); i++ ) { Steps* pSteps = vSteps[i]; CString s; if( pSteps->GetDifficulty() == DIFFICULTY_EDIT ) s = pSteps->GetDescription(); else s = DifficultyToThemedString( pSteps->GetDifficulty() ); s += ssprintf( " (%d)", pSteps->GetMeter() ); row.choices.push_back( s ); mc.m_pSteps = pSteps; mc.m_dc = pSteps->GetDifficulty(); hand.ListEntries.push_back( mc ); } } }
void SongUtil::GetSteps( const Song *pSong, vector<Steps*>& arrayAddTo, StepsType st, Difficulty dc, int iMeterLow, int iMeterHigh, const RString &sDescription, bool bIncludeAutoGen, unsigned uHash, int iMaxToGet ) { if( !iMaxToGet ) return; const vector<Steps*> &vpSteps = st == StepsType_Invalid ? pSong->GetAllSteps() : pSong->GetStepsByStepsType(st); for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps { Steps* pSteps = vpSteps[i]; if( dc != Difficulty_Invalid && dc != pSteps->GetDifficulty() ) continue; if( iMeterLow != -1 && iMeterLow > pSteps->GetMeter() ) continue; if( iMeterHigh != -1 && iMeterHigh < pSteps->GetMeter() ) continue; if( sDescription.size() && sDescription != pSteps->GetDescription() ) continue; if( uHash != 0 && uHash != pSteps->GetHash() ) continue; if( !bIncludeAutoGen && pSteps->IsAutogen() ) continue; arrayAddTo.push_back( pSteps ); if( iMaxToGet != -1 ) { --iMaxToGet; if( !iMaxToGet ) break; } } }
SongCreditDisplay::SongCreditDisplay() { if( GAMESTATE->IsCourseMode() ) return; this->LoadFromFont( THEME->GetPathF("SongCreditDisplay","text") ); Song* pSong = GAMESTATE->m_pCurSong; ASSERT( pSong ); CString s = pSong->GetFullDisplayTitle() + "\n" + pSong->GetDisplayArtist() + "\n"; if( !pSong->m_sCredit.empty() ) s += pSong->m_sCredit + "\n"; // use a vector and not a set so that ordering is maintained vector<Steps*> vpStepsToShow; FOREACH_PlayerNumber( p ) { if( !GAMESTATE->IsHumanPlayer(p) ) continue; // skip Steps* pSteps = GAMESTATE->m_pCurSteps[p]; bool bAlreadyAdded = find( vpStepsToShow.begin(), vpStepsToShow.end(), pSteps ) != vpStepsToShow.end(); if( !bAlreadyAdded ) vpStepsToShow.push_back( pSteps ); } for( unsigned i=0; i<vpStepsToShow.size(); i++ ) { Steps* pSteps = vpStepsToShow[i]; CString sDifficulty = DifficultyToThemedString( pSteps->GetDifficulty() ); // HACK: reset capitalization sDifficulty.MakeLower(); sDifficulty = Capitalize( sDifficulty ); s += sDifficulty + " steps: " + pSteps->GetDescription() + "\n"; } // erase the last newline s.erase( s.end()-1 ); this->SetText( s ); }