From 843c96735e5a6713e6e138fdcf1a8709fe338022 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 2 Jul 2002 17:34:20 +0000 Subject: [PATCH] no message --- stepmania/src/Course.cpp | 89 ++++++++++++++++++++++++++++++++ stepmania/src/Course.h | 5 ++ stepmania/src/MusicWheel.cpp | 2 +- stepmania/src/ScreenGameplay.cpp | 2 +- stepmania/src/SongManager.cpp | 17 +++++- stepmania/src/StepMania.vcproj | 6 --- 6 files changed, 112 insertions(+), 9 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index f52216b33a..57194cebd5 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -12,4 +12,93 @@ #include "Course.h" #include "ThemeManager.h" +#include "Song.h" + +void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) +{ + CStdioFile file; + if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) ) + throw RageException( "Error opening SM file '%s'.", sPath ); + + + // read the whole file into a sFileText + CString sFileText; + CString buffer; + while( file.ReadString(buffer) ) + sFileText += buffer + "\n"; + file.Close(); + + // strip comments out of sFileText + while( sFileText.Find("//") != -1 ) + { + int iIndexCommentStart = sFileText.Find("//"); + int iIndexCommentEnd = sFileText.Find("\n", iIndexCommentStart); + if( iIndexCommentEnd == -1 ) // comment doesn't have an end? + sFileText.Delete( iIndexCommentStart, 2 ); + else + sFileText.Delete( iIndexCommentStart, iIndexCommentEnd-iIndexCommentStart ); + } + + // split sFileText into strings containing each value expression + CStringArray arrayValueStrings; + split( sFileText, ";", arrayValueStrings, false ); + + + // for each value expression string, parse it into a value name and data + for( int i=0; i < arrayValueStrings.GetSize(); i++ ) + { + CString sValueString = arrayValueStrings[i]; + + // split the value string into tokens + CStringArray arrayValueTokens; + split( sValueString, ":", arrayValueTokens, false ); + for( int j=0; jm_sSongDir, sSongDir) ) + pSong = apSongs[i]; + + if( pSong == NULL ) // we didn't find the Song + continue; // skip this song + + Notes* pNotes = NULL; + for( int i=0; im_arrayNotes.GetSize(); i++ ) + if( 0 == stricmp(pSong->m_arrayNotes[i]->m_sDescription, sNotesDescription) ) + pNotes = pSong->m_arrayNotes[i]; + + if( pNotes == NULL ) // we didn't find the Notes + continue; // skip this song + + AddStage( pSong, pNotes ); + } + + else + LOG->WriteLine( "Unexpected value named '%s'", sValueName ); + } +} diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 6382b76613..54975daa45 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -23,6 +23,7 @@ public: { m_NotesType = NOTES_TYPE_INVALID; m_iStages = 0; + m_bRepeat = false; for( int i=0; i &apSongs ); void AddStage( Song* pSong, Notes* pNotes ) { diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 75c4be8a5a..8c18431ad8 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -24,7 +24,7 @@ const float FADE_TIME = 1.0f; const float SWITCH_MUSIC_TIME = 0.15f; -const float SAMPLE_MUSIC_DELAY = 0.15f; +const float SAMPLE_MUSIC_DELAY = 0.20f; const float ROULETTE_SWITCH_MUSIC_TIME = SWITCH_MUSIC_TIME/2; const int ROULETTE_SWITCHES_IN_SLOWING_DOWN = 5; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index dd27215f22..3b7be93351 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -574,7 +574,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ - if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_BACK && type == IET_FAST_REPEAT && m_DancingState == STATE_DANCING && !m_bBothHaveFailed ) + if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_BACK && type == IET_SLOW_REPEAT && m_DancingState == STATE_DANCING && !m_bBothHaveFailed ) { m_bBothHaveFailed = true; SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 ); diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 0eacdc4582..2a461ddc6a 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -81,7 +81,6 @@ GameplayStatistics SongManager::GetLatestGameplayStatistics( PlayerNumber p ) return m_aGameplayStatistics[p][ m_aGameplayStatistics[p].GetSize()-1 ]; } - void SongManager::InitSongArrayFromDisk() { LoadStepManiaSongDir( "Songs" ); @@ -407,6 +406,22 @@ CString SongManager::ShortenGroupName( const CString &sOrigGroupName ) void SongManager::InitCoursesFromDisk() { + // + // Load courses from CRS files + // + CStringArray saCourseFiles; + GetDirListing( "Courses\\*.crs", saCourseFiles ); + for( int i=0; iGetGroupNames( saGroupNames ); for( int g=0; g - - - -