diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 7b583c8937..54db5136f8 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -28,7 +28,7 @@ float g_fExpandSeconds = 0; float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) { float fYOffset; - if( !GAMESTATE->m_PlayerOptions->m_bTimeSpacing ) + if( !GAMESTATE->m_PlayerOptions[pn].m_bTimeSpacing ) { float fSongBeat = GAMESTATE->m_fSongBeat; float fBeatsUntilStep = fNoteBeat - fSongBeat; @@ -39,7 +39,7 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) float fSongSeconds = GAMESTATE->m_fMusicSeconds; float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat); float fSecondsUntilStep = fNoteSeconds - fSongSeconds; - float fBPM = GAMESTATE->m_pCurSong->GetDominantBPM(); + float fBPM = GAMESTATE->m_PlayerOptions[pn].m_fScrollBPM; float fBPS = fBPM/60.f; fYOffset = fSecondsUntilStep * fBPS * ARROW_SPACING; } diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index 2b388ee18d..b89d9781b8 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -20,9 +20,9 @@ void PlayerOptions::Init() { -// m_bUseScrollBPM = false; + m_bTimeSpacing = false; m_fScrollSpeed = 1.0f; -// m_fScrollBPM = 200; + m_fScrollBPM = 200; ZERO( m_fAccels ); ZERO( m_fEffects ); ZERO( m_fAppearances ); @@ -33,7 +33,6 @@ void PlayerOptions::Init() m_bHoldNotes = true; m_bTimingAssist = false; m_fPerspectiveTilt = 0; - m_bTimeSpacing = false; m_sPositioning = ""; // "null" m_sNoteSkin = "default"; @@ -59,8 +58,8 @@ CString PlayerOptions::GetString() { CString sReturn; -// if( !m_bUseScrollBPM ) -// { + if( !m_bTimeSpacing ) + { if( m_fScrollSpeed != 1 ) { /* -> 1.00 */ @@ -75,12 +74,12 @@ CString PlayerOptions::GetString() } sReturn += s + "X, "; } -// } -// else -// { -// CString s = ssprintf( "%.0f", m_fScrollBPM ); -// sReturn += s + "V, "; -// } + } + else + { + CString s = ssprintf( "C%.0f", m_fScrollBPM ); + sReturn += s + ", "; + } if( m_fAccels[ACCEL_BOOST]==1 ) sReturn += "Boost, "; if( m_fAccels[ACCEL_BRAKE]==1 ) sReturn += "Brake, "; @@ -103,8 +102,6 @@ CString PlayerOptions::GetString() if( m_fDark == 1) sReturn += "Dark, "; - if( m_bTimeSpacing ) sReturn += "TimeSpacing, "; - switch( m_Turn ) { case TURN_NONE: break; @@ -161,19 +158,18 @@ void PlayerOptions::FromString( CString sOptions ) TrimLeft(sBit); TrimRight(sBit); - if( sBit == "0.25x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 0.25f; } - else if( sBit == "0.5x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 0.50f; } - else if( sBit == "0.75x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 0.75f; } - else if( sBit == "1.5x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 1.50f; } - else if( sBit == "2.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 2.00f; } - else if( sBit == "3.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 3.00f; } - else if( sBit == "4.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 4.00f; } - else if( sBit == "5.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 5.00f; } - else if( sBit == "8.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 8.00f; } - else if( sBit == "12.0x" ) { /*m_bUseScrollBPM=false;*/ m_fScrollSpeed = 12.00f; } -// else if( sBit == "200v" ) { m_bUseScrollBPM=true; m_fScrollBPM = 200; } -// else if( sBit == "300v" ) { m_bUseScrollBPM=true; m_fScrollBPM = 300; } -// else if( sBit == "450v" ) { m_bUseScrollBPM=true; m_fScrollBPM = 450; } + if( sBit == "0.25x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 0.25f; } + else if( sBit == "0.5x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 0.50f; } + else if( sBit == "0.75x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 0.75f; } + else if( sBit == "1.5x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 1.50f; } + else if( sBit == "2.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 2.00f; } + else if( sBit == "3.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 3.00f; } + else if( sBit == "4.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 4.00f; } + else if( sBit == "5.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 5.00f; } + else if( sBit == "8.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 8.00f; } + else if( sBit == "12.0x" ) { m_bTimeSpacing=false; m_fScrollSpeed = 12.00f;} + else if( sBit == "C200" ) { m_bTimeSpacing=true; m_fScrollBPM = 200; } + else if( sBit == "C300" ) { m_bTimeSpacing=true; m_fScrollBPM = 300; } else if( sBit == "boost" ) m_fAccels[ACCEL_BOOST] = 1; else if( sBit == "brake" ) m_fAccels[ACCEL_BRAKE] = 1; else if( sBit == "wave" ) m_fAccels[ACCEL_WAVE] = 1; diff --git a/stepmania/src/PlayerOptions.h b/stepmania/src/PlayerOptions.h index c89c47dc3a..337eb0467a 100644 --- a/stepmania/src/PlayerOptions.h +++ b/stepmania/src/PlayerOptions.h @@ -63,9 +63,9 @@ struct PlayerOptions NUM_TRANSFORMS }; -// bool m_bUseScrollBPM; - float m_fScrollSpeed; -// float m_fScrollBPM; + bool m_bTimeSpacing; // instead of Beat spacing + float m_fScrollSpeed; // used if !m_bTimeSpacing + float m_fScrollBPM; // used if m_bTimeSpacing float m_fAccels[NUM_ACCELS]; float m_fEffects[NUM_EFFECTS]; float m_fAppearances[NUM_APPEARANCES]; @@ -76,7 +76,6 @@ struct PlayerOptions bool m_bHoldNotes; bool m_bTimingAssist; float m_fPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space - bool m_bTimeSpacing; // instead of Beat spacing CString m_sPositioning; /* The current positioning mode, or empty to use the normal positions. */ CString m_sNoteSkin; diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 3cd324a79f..8ffb2bd190 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -34,12 +34,12 @@ enum { PO_SCROLL, PO_NOTE_SKIN, PO_HOLD_NOTES, - PO_OTHER, + PO_DARK, PO_PERSPECTIVE, NUM_PLAYER_OPTIONS_LINES }; OptionRow g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { - OptionRow( "Speed", "x0.25","x0.5","x0.75","x1","x1.5","x2","x3","x4","x5","x8","x12" ), + OptionRow( "Speed", "x0.25","x0.5","x0.75","x1","x1.5","x2","x3","x5","x8","C200","C300" ), OptionRow( "Acceler\n-ation", "OFF","BOOST","BRAKE","WAVE","EXPAND","BOOMERANG" ), OptionRow( "Effect", "OFF","DRUNK","DIZZY","MINI","FLIP","TORNADO" ), OptionRow( "Appear\n-ance", "VISIBLE","HIDDEN","SUDDEN","STEALTH","BLINK" ), @@ -48,7 +48,7 @@ OptionRow g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { OptionRow( "Scroll", "STANDARD","REVERSE" ), OptionRow( "Note\nSkin", "" ), OptionRow( "Holds", "OFF","ON" ), - OptionRow( "Other", "OFF","DARK","TIME SPACING" ), + OptionRow( "Dark", "OFF","ON" ), OptionRow( "Perspec\n-tive", "" ), }; @@ -120,20 +120,17 @@ void ScreenPlayerOptions::ImportOptions() { PlayerOptions &po = GAMESTATE->m_PlayerOptions[p]; - if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 0.25f ) m_iSelectedOption[p][PO_SPEED] = 0; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 0.5f ) m_iSelectedOption[p][PO_SPEED] = 1; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 0.75f ) m_iSelectedOption[p][PO_SPEED] = 2; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 3; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 4; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 5; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 6; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 7; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 4.0f ) m_iSelectedOption[p][PO_SPEED] = 8; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 9; - else if( /*!po.m_bUseScrollBPM &&*/ po.m_fScrollSpeed == 12.0f ) m_iSelectedOption[p][PO_SPEED] = 10; -// else if( po.m_bUseScrollBPM && po.m_fScrollBPM == 200 ) m_iSelectedOption[p][PO_SPEED] = 8; -// else if( po.m_bUseScrollBPM && po.m_fScrollBPM == 300 ) m_iSelectedOption[p][PO_SPEED] = 9; -// else if( po.m_bUseScrollBPM && po.m_fScrollBPM == 450 ) m_iSelectedOption[p][PO_SPEED] = 10; + if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.25f ) m_iSelectedOption[p][PO_SPEED] = 0; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.5f ) m_iSelectedOption[p][PO_SPEED] = 1; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.75f ) m_iSelectedOption[p][PO_SPEED] = 2; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 3; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 4; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 5; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 6; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 7; + else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 9; + else if( po.m_bTimeSpacing && po.m_fScrollBPM == 200 ) m_iSelectedOption[p][PO_SPEED] = 8; + else if( po.m_bTimeSpacing && po.m_fScrollBPM == 300 ) m_iSelectedOption[p][PO_SPEED] = 10; else m_iSelectedOption[p][PO_SPEED] = 3; m_iSelectedOption[p][PO_ACCEL] = po.GetFirstAccel()+1; @@ -159,13 +156,7 @@ void ScreenPlayerOptions::ImportOptions() m_iSelectedOption[p][PO_HOLD_NOTES] = po.m_bHoldNotes ? 1 : 0; - - if( po.m_fDark==1 ) - m_iSelectedOption[p][PO_OTHER] = 1; - else if( po.m_bTimeSpacing ) - m_iSelectedOption[p][PO_OTHER] = 2; - else - m_iSelectedOption[p][PO_OTHER] = 0; + m_iSelectedOption[p][PO_DARK] = po.m_fDark ? 1 : 0; /* Default: */ m_iSelectedOption[p][PO_PERSPECTIVE] = 1; @@ -194,20 +185,17 @@ void ScreenPlayerOptions::ExportOptions() switch( m_iSelectedOption[p][PO_SPEED] ) { - case 0: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 0.25f; break; - case 1: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 0.5f; break; - case 2: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 0.75f; break; - case 3: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 1.0f; break; - case 4: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 1.5f; break; - case 5: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 2.0f; break; - case 6: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 3.0f; break; - case 7: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 4.0f; break; - case 8: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 5.0f; break; - case 9: /*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 8.0f; break; - case 10:/*po.m_bUseScrollBPM = false;*/ po.m_fScrollSpeed = 12.0f; break; -// case 9: po.m_bUseScrollBPM = true; po.m_fScrollBPM = 200; break; -// case 10: po.m_bUseScrollBPM = true; po.m_fScrollBPM = 300; break; -// case 11:po.m_bUseScrollBPM = true; po.m_fScrollBPM = 450; break; + case 0: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.25f; break; + case 1: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.5f; break; + case 2: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.75f; break; + case 3: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 1.0f; break; + case 4: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 1.5f; break; + case 5: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 2.0f; break; + case 6: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 3.0f; break; + case 7: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 5.0f; break; + case 8: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 8.0f; break; + case 9: po.m_bTimeSpacing = true; po.m_fScrollBPM = 200; break; + case 10:po.m_bTimeSpacing = true; po.m_fScrollBPM = 300; break; default: ASSERT(0); } @@ -229,8 +217,7 @@ void ScreenPlayerOptions::ExportOptions() po.m_bHoldNotes = (m_iSelectedOption[p][PO_HOLD_NOTES] == 1); - po.m_fDark = (m_iSelectedOption[p][PO_OTHER] == 1) ? 1.f : 0.f; - po.m_bTimeSpacing = (m_iSelectedOption[p][PO_OTHER] == 2); + po.m_fDark = (m_iSelectedOption[p][PO_DARK] == 1) ? 1.f : 0.f; switch(m_iSelectedOption[p][PO_PERSPECTIVE]) { diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 38ded16a6e..ce3a365bd1 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1345,29 +1345,3 @@ void Song::RemoveNotes( Notes* pNotes ) AddAutoGenNotes(); } - -float Song::GetDominantBPM() -{ - // Get the average BPM. - // TODO: Make this return the most-used BPM in the song. - // This is tricky though because many songs with BPM changes - // have tweaked BPMs (e.g. 160BPM at first, then 160.05BPM later). - float fSumBPM = 0; - float fSumWeights = 0; - for( unsigned i=0; i 0) - { - fSumBPM += fBPM * fLength; - fSumWeights += fLength; - } - } - return fSumBPM / fSumWeights; -} \ No newline at end of file diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index dc045dabf3..5b4f96f2bb 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -329,7 +329,11 @@ void Sprite::DrawPrimitives() void Sprite::SetState( int iNewState ) { - ASSERT( iNewState >= 0 && iNewState < m_iNumStates ); + // This assert will likely trigger if the "missing" theme element graphic + // is loaded in place of a multi-frame sprite. We want to know about these + // problems in debug builds, but they're not fatal. + DEBUG_ASSERT( iNewState >= 0 && iNewState < m_iNumStates ); + CLAMP(iNewState, 0, m_iNumStates-1); m_iCurState = iNewState; m_fSecsIntoState = 0.0; diff --git a/stepmania/src/Transition.cpp b/stepmania/src/Transition.cpp index a0edbb0a72..513c373703 100644 --- a/stepmania/src/Transition.cpp +++ b/stepmania/src/Transition.cpp @@ -90,7 +90,14 @@ void Transition::DrawPrimitives() void Transition::StartTransitioning( ScreenMessage send_when_done ) { - ASSERT( m_State == waiting ); // can't call this more than once + if( m_State != waiting ) + { + // This assert will trigger in some cases if start is pressed + // right as a transition is ending. We want to know about these + // problems in debug builds, but they're not fatal. + DEBUG_ASSERT( m_State == waiting ); // can't call this more than once + return; // ignore + } m_MessageToSendWhenDone = send_when_done; m_State = transitioning; m_fSecsIntoTransition = 0.0; diff --git a/stepmania/src/global.h b/stepmania/src/global.h index a2396e81e9..a03336cdcf 100644 --- a/stepmania/src/global.h +++ b/stepmania/src/global.h @@ -73,6 +73,13 @@ using namespace std; #define ASSERT assert #endif +#ifdef DEBUG +#define DEBUG_ASSERT ASSERT +#else +#define DEBUG_ASSERT (void*)(0) +#endif + + /* Define a macro to tell the compiler that a function doesn't return. This just * improves compiler warnings. This should be placed near the beginning of the * function prototype (although it looks better near the end, VC only accepts it diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 649cc61df3..b6d899190d 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -193,7 +193,6 @@ public: break; return m_BPMSegments[i].m_fBPM; }; - float GetDominantBPM(); BPMSegment& GetBPMSegmentAtBeat( float fBeat ) { unsigned i;