From 26f5e8d78cad531a3c7562bf3afb699618a625cd Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 8 Apr 2012 23:56:28 -0400 Subject: [PATCH] Replace Steps:UseSplitTiming. Instead, use Song:IsStepsUsingDifferentTiming. --- Docs/Changelog_sm5.txt | 2 ++ src/ScreenEdit.cpp | 2 +- src/Song.cpp | 11 +++++++++++ src/Song.h | 2 ++ src/Steps.cpp | 9 --------- src/Steps.h | 5 ----- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 0fbb20f553..8860b7876c 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -13,6 +13,8 @@ StepMania 5.0 alpha 2 | 201204?? ---------- * [ScreenNetworkOptions] Fixed a bug where localized text would not show up properly. Fixes issue 759. [AJ] +* [Steps, Song] Replace Steps:UsesSplitTiming with + Song:IsStepsUsingDifferentTiming for both C++ and Lua. [wolfman2000] 2012/04/06 ---------- diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 4687f7cd8c..f5932f9d01 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -1122,7 +1122,7 @@ void ScreenEdit::Init() /* The user will most likely switch into Step Timing after laying down some initial notes. It also throws off many people at first glance. */ - if( m_pSteps->UsesSplitTiming() ) + if( m_pSong->IsStepsUsingDifferentTiming(m_pSteps) ) GAMESTATE->m_bIsUsingStepTiming = true; diff --git a/src/Song.cpp b/src/Song.cpp index 527bc156bc..33299ff66a 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -1580,6 +1580,11 @@ bool Song::IsEditAlreadyLoaded( Steps* pSteps ) const return false; } +bool Song::IsStepsUsingDifferentTiming(Steps *pSteps) const +{ + return pSteps->m_Timing != this->m_SongTiming; +} + bool Song::HasSignificantBpmChangesOrStops() const { if( m_SongTiming.HasStops() || m_SongTiming.HasDelays() ) @@ -1819,6 +1824,11 @@ public: lua_pushboolean( L, p->HasStepsTypeAndDifficulty(st, dc) ); return 1; } + static int IsStepsUsingDifferentTiming(T* p, lua_State *L) + { + lua_pushboolean(L, p->IsStepsUsingDifferentTiming(Luna::check( L, 1, true ))); + return 1; + } /* TODO: HasStepsTypeAndDifficulty and GetOneSteps should be in * a SongUtil Lua table and a method of Steps. */ static int GetOneSteps( T* p, lua_State *L ) @@ -1993,6 +2003,7 @@ public: ADD_METHOD( IsDisplayBpmSecret ); ADD_METHOD( IsDisplayBpmConstant ); ADD_METHOD( IsDisplayBpmRandom ); + ADD_METHOD( IsStepsUsingDifferentTiming ); ADD_METHOD( ShowInDemonstrationAndRanking ); ADD_METHOD( HasPreviewVid ); ADD_METHOD( GetPreviewVidPath ); diff --git a/src/Song.h b/src/Song.h index 57f62bf8df..f06102adbe 100644 --- a/src/Song.h +++ b/src/Song.h @@ -418,6 +418,8 @@ public: int GetNumStepsLoadedFromProfile( ProfileSlot slot ) const; bool IsEditAlreadyLoaded( Steps* pSteps ) const; + bool IsStepsUsingDifferentTiming(Steps *pSteps ) const; + /** * @brief An array of keysound file names (e.g. "beep.wav"). * The index in this array corresponds to the index in TapNote. diff --git a/src/Steps.cpp b/src/Steps.cpp index 5c9c40ee77..010bd8c727 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -521,13 +521,6 @@ void Steps::SetCachedRadarValues( const RadarValues v[NUM_PLAYERS] ) m_bAreCachedRadarValuesJustLoaded = true; } -bool Steps::UsesSplitTiming() const -{ - Song *song = SONGMAN->GetSongFromSteps(const_cast(this)); - return song->m_SongTiming != this->m_Timing; -} - - // lua start #include "LuaBinding.h" /** @brief Allow Lua to have access to the Steps. */ @@ -544,7 +537,6 @@ public: DEFINE_METHOD( IsAutogen, IsAutogen() ) DEFINE_METHOD( IsAnEdit, IsAnEdit() ) DEFINE_METHOD( IsAPlayerEdit, IsAPlayerEdit() ) - DEFINE_METHOD( UsesSplitTiming, UsesSplitTiming() ) static int HasSignificantTimingChanges( T* p, lua_State *L ) { @@ -641,7 +633,6 @@ public: ADD_METHOD( IsAnEdit ); ADD_METHOD( IsAutogen ); ADD_METHOD( IsAPlayerEdit ); - ADD_METHOD( UsesSplitTiming ); ADD_METHOD( GetDisplayBpms ); ADD_METHOD( IsDisplayBpmSecret ); ADD_METHOD( IsDisplayBpmConstant ); diff --git a/src/Steps.h b/src/Steps.h index 24ea973410..e81e754269 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -174,11 +174,6 @@ public: CachedObject m_CachedObject; - /** - * @brief Determine if the Steps use Split Timing by comparing the Song it's in. - * @return true if the Step and Song use different timings, false otherwise. */ - bool UsesSplitTiming() const; - void SetDisplayBPM(const DisplayBPM type) { this->displayBPMType = type; } DisplayBPM GetDisplayBPM() const { return this->displayBPMType; } void SetMinBPM(const float f) { this->specifiedBPMMin = f; }