From d0459c3488d2a7edb574905a3433f5a9b91c6f22 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 21 Feb 2011 03:11:39 -0600 Subject: [PATCH] comment, cleanup --- src/Background.cpp | 15 ++++++--------- src/PlayerAI.cpp | 16 +++++++--------- src/SongManager.cpp | 8 +++----- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/Background.cpp b/src/Background.cpp index 624551a391..1456936d65 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -370,7 +370,6 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun } ASSERT( !sEffectFile.empty() ); - Actor *pActor = ActorUtil::MakeActor( sEffectFile ); ASSERT( pActor ); @@ -390,7 +389,7 @@ BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const R // Set to not show any BGChanges, whether scripted or random if( GAMESTATE->m_SongOptions.GetCurrent().m_bStaticBackground ) return BackgroundDef(); - + if( RandomBGAnimations.empty() ) return BackgroundDef(); @@ -430,7 +429,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac for( int i=max(iter->m_iStartRow,iStartRow); iGetNoteRowsPerMeasure() ) { - // Don't fade. It causes frame rate dip, especially on slower machines. + // Don't fade. It causes frame rate dip, especially on slower machines. BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); if( !bd.IsEmpty() ) { @@ -458,12 +457,12 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac } if( !bAtBeginningOfMeasure ) - continue; // skip - + continue; // skip + // start so that we don't create a BGChange right on top of fEndBeat bool bInRange = bpmseg.m_iStartRow >= iStartRow && bpmseg.m_iStartRow < iEndRow; if( !bInRange ) - continue; // skip + continue; // skip BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); if( !bd.IsEmpty() ) @@ -487,9 +486,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong ) if( g_fBGBrightness == 0.0f ) return; - // - // Choose a bunch of background that we'll use for the random file marker - // + // Choose a bunch of backgrounds that we'll use for the random file marker { vector vsThrowAway, vsNames; switch( g_RandomBackgroundMode ) diff --git a/src/PlayerAI.cpp b/src/PlayerAI.cpp index 1376e0324b..48f7186ec5 100644 --- a/src/PlayerAI.cpp +++ b/src/PlayerAI.cpp @@ -18,18 +18,17 @@ struct TapScoreDistribution for( int i=0; i<=TNS_W1; i++ ) { fCumulativePercent += fPercent[i]; - if( fRand <= fCumulativePercent+1e-4 ) /* rounding error */ + if( fRand <= fCumulativePercent+1e-4 ) // rounding error return (TapNoteScore)i; } - ASSERT_M( 0, ssprintf("%f,%f",fRand,fCumulativePercent) ); // the fCumulativePercents must sum to 1.0, so we should never get here! + // the fCumulativePercents must sum to 1.0, so we should never get here! + ASSERT_M( 0, ssprintf("%f,%f",fRand,fCumulativePercent) ); return TNS_W1; } - }; static TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS]; - void PlayerAI::InitFromDisk() { bool bSuccess; @@ -68,7 +67,6 @@ void PlayerAI::InitFromDisk() } } - TapNoteScore PlayerAI::GetTapNoteScore( const PlayerState* pPlayerState ) { if( pPlayerState->m_PlayerController == PC_AUTOPLAY ) @@ -84,10 +82,10 @@ TapNoteScore PlayerAI::GetTapNoteScore( const PlayerState* pPlayerState ) int iCpuSkill = pPlayerState->m_iCpuSkill; - /* If we're in battle mode, reduce the skill based on the number of modifier attacks - * against us. If we're in demonstration or jukebox mode with modifiers attached, - * don't make demonstration miss a lot. */ - // xxx: weight certain modifiers (boomerang, tornado) more? (to simulate + /* If we're in battle mode, reduce the skill based on the number of modifier + * attacks against us. If we're in demonstration or jukebox mode with + * modifiers attached, don't make demonstration miss a lot. */ + // Idea: weight certain modifiers (boomerang, tornado) more? (to simulate // readability problems) -aj if( !GAMESTATE->m_bDemonstrationOrJukebox ) { diff --git a/src/SongManager.cpp b/src/SongManager.cpp index bfac9bc417..dfd342657a 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -142,7 +142,6 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld ) LOG->Trace( "Found %d songs in %f seconds.", (int)m_pSongs.size(), tm.GetDeltaTime() ); } - static LocalizedString FOLDER_CONTAINS_MUSIC_FILES( "SongManager", "The folder \"%s\" appears to be a song folder. All song folders must reside in a group folder. For example, \"Songs/Originals/My Song\"." ); void SongManager::SanityCheckGroupDir( RString sDir ) const { @@ -299,8 +298,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir, LoadingWindow *ld ) LoadEnabledSongsFromPref(); } -// Instead of "symlinks", songs should have membership in multiple groups. -// -Chris +// Instead of "symlinks", songs should have membership in multiple groups. -Chris void SongManager::LoadGroupSymLinks(RString sDir, RString sGroupFolder) { // Find all symlink files in this folder @@ -310,9 +308,9 @@ void SongManager::LoadGroupSymLinks(RString sDir, RString sGroupFolder) SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupFolder]; for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song. { - MsdFile msdF; + MsdFile msdF; msdF.ReadFile( sDir+sGroupFolder+"/"+arraySymLinks[s].c_str(), false ); // don't unescape - RString sSymDestination = msdF.GetParam(0,1); // Should only be 1 vale¶m...period. + RString sSymDestination = msdF.GetParam(0,1); // Should only be 1 value & param...period. Song* pNewSong = new Song; if( !pNewSong->LoadFromSongDir( sSymDestination ) )