From 7bed654fbbdbfcd3bc5e5898b752fcc6920ebaaf Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 17 Aug 2006 00:27:58 +0000 Subject: [PATCH] IsLong, IsMarathon, bindings --- stepmania/src/Song.cpp | 15 +++++++++++++++ stepmania/src/song.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 833ccd940e..2f63a5afd5 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1213,6 +1213,15 @@ float Song::GetStepsSeconds() const return GetElapsedTimeFromBeat( m_fLastBeat ) - GetElapsedTimeFromBeat( m_fFirstBeat ); } +bool Song::IsLong() const +{ + return !IsMarathon() && m_fMusicLengthSeconds > PREFSMAN->m_fLongVerSongSeconds; +} + +bool Song::IsMarathon() const +{ + return m_fMusicLengthSeconds >= PREFSMAN->m_fMarathonVerSongSeconds; +} // lua start #include "LuaBinding.h" @@ -1247,6 +1256,9 @@ public: static int GetBackgroundPath( T* p, lua_State *L ) { if( !p->HasBackground() ) lua_pushnil(L); else lua_pushstring(L, p->GetBackgroundPath()); return 1; } static int IsTutorial( T* p, lua_State *L ) { lua_pushboolean(L, p->IsTutorial()); return 1; } static int GetGroupName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sGroupName); return 1; } + static int MusicLengthSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->m_fMusicLengthSeconds); return 1; } + static int IsLong( T* p, lua_State *L ) { lua_pushboolean(L, p->IsLong()); return 1; } + static int IsMarathon( T* p, lua_State *L ) { lua_pushboolean(L, p->IsMarathon()); return 1; } static void Register(lua_State *L) { @@ -1264,6 +1276,9 @@ public: ADD_METHOD( GetBackgroundPath ); ADD_METHOD( IsTutorial ); ADD_METHOD( GetGroupName ); + ADD_METHOD( MusicLengthSeconds ); + ADD_METHOD( IsLong ); + ADD_METHOD( IsMarathon ); Luna::Register( L ); } diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 8ef0334eb8..d4da1393ce 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -178,6 +178,8 @@ public: float GetElapsedTimeFromBeat( float fBeat ) const { return m_Timing.GetElapsedTimeFromBeat( fBeat ); } bool HasSignificantBpmChangesOrStops() const; float GetStepsSeconds() const; + bool IsLong() const; + bool IsMarathon() const; bool SongCompleteForStyle( const Style *st ) const; bool HasStepsType( StepsType st ) const;