From 640f8fe9fc3c9133c18db2afc67065877f93d3e2 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 15 May 2011 14:05:02 -0400 Subject: [PATCH] [splittiming] PlayerOptions -> HasTimingChanges. Steps gained most of the functionality and lua doc. Leaving song version in: may still have a use thanks to #DISPLAYBPM. --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/PlayerOptions.cpp | 2 +- src/Steps.cpp | 18 ++++++++++++++++++ src/Steps.h | 5 +++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 966502afbc..dfb4c7cce3 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1349,6 +1349,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 24492431aa..df9f17081b 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -3368,6 +3368,9 @@ Returns the numerical difficulty of the Steps. + + Returns true if the song has significant timing changes. + Returns the complete list of RadarValues for player pn. Use to grab a specific value. diff --git a/src/PlayerOptions.cpp b/src/PlayerOptions.cpp index 036f1d314c..cbfb031bbf 100644 --- a/src/PlayerOptions.cpp +++ b/src/PlayerOptions.cpp @@ -680,7 +680,7 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps, PlayerNumber pn ) const { - if( m_fTimeSpacing && pSong->HasSignificantBpmChangesOrStops() ) + if( m_fTimeSpacing && pSteps->HasSignificantTimingChanges() ) return true; const RadarValues &rv = pSteps->GetRadarValues( pn ); if( m_bTransforms[TRANSFORM_NOHOLDS] && rv[RadarCategory_Holds]>0 ) diff --git a/src/Steps.cpp b/src/Steps.cpp index 5c2c91f063..3174e011b2 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -402,6 +402,21 @@ void Steps::SetMeter( int meter ) m_iMeter = meter; } +bool Steps::HasSignificantTimingChanges() const +{ + if( m_Timing.HasStops() ) + return true; + + /* TODO: Deal with DisplayBPM here...if possible? + * Song's version may still be useful. */ + + else if( m_Timing.HasBpmChanges() || m_Timing.HasWarps() || m_Timing.HasSpeedChanges() ) + { + return true; + } + return false; +} + void Steps::SetCachedRadarValues( const RadarValues v[NUM_PLAYERS] ) { DeAutogen(); @@ -426,6 +441,8 @@ public: DEFINE_METHOD( IsAnEdit, IsAnEdit() ) DEFINE_METHOD( IsAPlayerEdit, IsAPlayerEdit() ) + static int HasSignificantTimingChanges( T* p, lua_State *L ) { lua_pushboolean(L, p->HasSignificantTimingChanges()); return 1; } + static int GetRadarValues( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); @@ -454,6 +471,7 @@ public: ADD_METHOD( GetFilename ); ADD_METHOD( GetHash ); ADD_METHOD( GetMeter ); + ADD_METHOD( HasSignificantTimingChanges ); ADD_METHOD( GetRadarValues ); //ADD_METHOD( GetSMNoteData ); ADD_METHOD( GetStepsType ); diff --git a/src/Steps.h b/src/Steps.h index e796f99847..078295bc71 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -120,6 +120,11 @@ public: /** @brief Timing data */ TimingData m_Timing; + + /** + * @brief Determine if the Steps have any major timing changes during gameplay. + * @return true if it does, or false otherwise. */ + bool HasSignificantTimingChanges() const; // Lua void PushSelf( lua_State *L );