no message
This commit is contained in:
@@ -12,4 +12,93 @@
|
|||||||
|
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "Song.h"
|
||||||
|
|
||||||
|
|
||||||
|
void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &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; j<arrayValueTokens.GetSize(); j++ )
|
||||||
|
{
|
||||||
|
arrayValueTokens[j].TrimLeft();
|
||||||
|
arrayValueTokens[j].TrimRight();
|
||||||
|
}
|
||||||
|
if( arrayValueTokens.GetSize() == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CString sValueName = arrayValueTokens.GetAt( 0 );
|
||||||
|
|
||||||
|
// handle the data
|
||||||
|
if( sValueName == "#COURSE" )
|
||||||
|
m_sName = arrayValueTokens[1];
|
||||||
|
|
||||||
|
else if( sValueName == "#REPEAT" )
|
||||||
|
{
|
||||||
|
arrayValueTokens[1].MakeLower();
|
||||||
|
if( arrayValueTokens[1].Find("yes") != -1 )
|
||||||
|
m_bRepeat = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sValueName == "#SONG" )
|
||||||
|
{
|
||||||
|
CString sSongDir = arrayValueTokens[1];
|
||||||
|
CString sNotesDescription = arrayValueTokens[2];
|
||||||
|
|
||||||
|
Song* pSong = NULL;
|
||||||
|
for( int i=0; i<apSongs.GetSize(); i++ )
|
||||||
|
if( 0 == stricmp(apSongs[i]->m_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; i<pSong->m_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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_NotesType = NOTES_TYPE_INVALID;
|
m_NotesType = NOTES_TYPE_INVALID;
|
||||||
m_iStages = 0;
|
m_iStages = 0;
|
||||||
|
m_bRepeat = false;
|
||||||
for( int i=0; i<MAX_COURSE_STAGES; i++ )
|
for( int i=0; i<MAX_COURSE_STAGES; i++ )
|
||||||
{
|
{
|
||||||
m_apSongs[i] = NULL;
|
m_apSongs[i] = NULL;
|
||||||
@@ -37,6 +38,10 @@ public:
|
|||||||
int m_iStages;
|
int m_iStages;
|
||||||
Song* m_apSongs[MAX_COURSE_STAGES];
|
Song* m_apSongs[MAX_COURSE_STAGES];
|
||||||
Notes* m_apNotes[MAX_COURSE_STAGES];
|
Notes* m_apNotes[MAX_COURSE_STAGES];
|
||||||
|
bool m_bRepeat; // repeat after last song?
|
||||||
|
PlayerOptions m_PlayerOptions;
|
||||||
|
|
||||||
|
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
|
||||||
|
|
||||||
void AddStage( Song* pSong, Notes* pNotes )
|
void AddStage( Song* pSong, Notes* pNotes )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
const float FADE_TIME = 1.0f;
|
const float FADE_TIME = 1.0f;
|
||||||
|
|
||||||
const float SWITCH_MUSIC_TIME = 0.15f;
|
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 float ROULETTE_SWITCH_MUSIC_TIME = SWITCH_MUSIC_TIME/2;
|
||||||
const int ROULETTE_SWITCHES_IN_SLOWING_DOWN = 5;
|
const int ROULETTE_SWITCHES_IN_SLOWING_DOWN = 5;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
m_bBothHaveFailed = true;
|
||||||
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ GameplayStatistics SongManager::GetLatestGameplayStatistics( PlayerNumber p )
|
|||||||
return m_aGameplayStatistics[p][ m_aGameplayStatistics[p].GetSize()-1 ];
|
return m_aGameplayStatistics[p][ m_aGameplayStatistics[p].GetSize()-1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SongManager::InitSongArrayFromDisk()
|
void SongManager::InitSongArrayFromDisk()
|
||||||
{
|
{
|
||||||
LoadStepManiaSongDir( "Songs" );
|
LoadStepManiaSongDir( "Songs" );
|
||||||
@@ -407,6 +406,22 @@ CString SongManager::ShortenGroupName( const CString &sOrigGroupName )
|
|||||||
|
|
||||||
void SongManager::InitCoursesFromDisk()
|
void SongManager::InitCoursesFromDisk()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Load courses from CRS files
|
||||||
|
//
|
||||||
|
CStringArray saCourseFiles;
|
||||||
|
GetDirListing( "Courses\\*.crs", saCourseFiles );
|
||||||
|
for( int i=0; i<saCourseFiles.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
Course course;
|
||||||
|
course.LoadFromCRSFile( "Courses\\" + saCourseFiles[i], m_pSongs );
|
||||||
|
m_aCourses.Add( course );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create default courses
|
||||||
|
//
|
||||||
CStringArray saGroupNames;
|
CStringArray saGroupNames;
|
||||||
this->GetGroupNames( saGroupNames );
|
this->GetGroupNames( saGroupNames );
|
||||||
for( int g=0; g<saGroupNames.GetSize(); g++ ) // foreach Group
|
for( int g=0; g<saGroupNames.GetSize(); g++ ) // foreach Group
|
||||||
|
|||||||
@@ -414,12 +414,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\IniFile.h">
|
RelativePath=".\IniFile.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="MSDScanner.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="MSDScanner.h">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="System"
|
Name="System"
|
||||||
|
|||||||
Reference in New Issue
Block a user