added extra stage course support (.crs file with #EXTRA tag)
and some bugs fixed...
This commit is contained in:
@@ -61,6 +61,11 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
|
||||
m_iLives = atoi( sParams[1] );
|
||||
}
|
||||
|
||||
else if( 0 == stricmp(sValueName, "EXTRA") )
|
||||
{
|
||||
m_iExtra = atoi( sParams[1] );
|
||||
}
|
||||
|
||||
else if( 0 == stricmp(sValueName, "SONG") )
|
||||
{
|
||||
CString sSongDir = "Songs\\" + sParams[1] + "\\";
|
||||
|
||||
@@ -17,7 +17,8 @@ class Song;
|
||||
struct Notes;
|
||||
|
||||
|
||||
const int MAX_COURSE_STAGES = 100;
|
||||
const int MAX_COURSE_STAGES = 300; // Increased since the user can place all Bemani songs in a single folder
|
||||
|
||||
|
||||
class Course
|
||||
{
|
||||
@@ -28,6 +29,7 @@ public:
|
||||
m_bRepeat = false;
|
||||
m_bRandomize = false;
|
||||
m_iLives = 4;
|
||||
m_iExtra = 0;
|
||||
for( int i=0; i<MAX_COURSE_STAGES; i++ )
|
||||
m_apSongs[i] = NULL;
|
||||
}
|
||||
@@ -43,6 +45,7 @@ public:
|
||||
bool m_bRandomize; // play the songs in a random order
|
||||
int m_iLives; // -1 means use bar life meter
|
||||
CString m_sModifiers; // contains player options and song options
|
||||
int m_iExtra; // extra stage number...
|
||||
|
||||
void GetPlayerOptions( PlayerOptions* pPO_out );
|
||||
void GetSongOptions( SongOptions* pSO_out);
|
||||
@@ -52,7 +55,7 @@ public:
|
||||
|
||||
void AddStage( Song* pSong, CString sDescription )
|
||||
{
|
||||
ASSERT( m_iStages <= MAX_COURSE_STAGES );
|
||||
ASSERT( m_iStages <= MAX_COURSE_STAGES - 1 );
|
||||
m_apSongs[m_iStages] = pSong;
|
||||
m_asDescriptions[m_iStages] = sDescription;
|
||||
m_iStages++;
|
||||
|
||||
@@ -376,14 +376,35 @@ MusicWheel::MusicWheel()
|
||||
for( int so=0; so<NUM_SORT_ORDERS; so++ )
|
||||
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
|
||||
|
||||
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
|
||||
{
|
||||
m_bUseRandomExtra = true;
|
||||
Course cCourse;
|
||||
for( int i=0; i< SONGMAN->m_aExtraCourses.GetSize(); i++ )
|
||||
{
|
||||
cCourse = SONGMAN->m_aExtraCourses[i];
|
||||
if( cCourse.m_sName == GAMESTATE->m_sPreferredGroup )
|
||||
{
|
||||
if( ( GAMESTATE->IsExtraStage() && cCourse.m_iExtra == 1 ) ||
|
||||
( GAMESTATE->IsExtraStage2() && cCourse.m_iExtra == 2 ) || 1 ) // force extra whatever
|
||||
{
|
||||
GAMESTATE->m_pCurSong = SONGMAN->m_aExtraCourses[i].m_apSongs[0];
|
||||
m_bUseRandomExtra = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// select a song if none are selected
|
||||
if( GAMESTATE->m_pCurSong == NULL && // if there is no currently selected song
|
||||
SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song
|
||||
{
|
||||
CArray<Song*, Song*> arraySongs;
|
||||
SONGMAN->GetSongsInGroup( GAMESTATE->m_sPreferredGroup, arraySongs );
|
||||
|
||||
if( arraySongs.GetSize() > 0 )
|
||||
// even tho separating these loops makes more code, in the end it'll be executed faster...
|
||||
//else
|
||||
if( arraySongs.GetSize() > 0 && GAMESTATE->m_pCurSong == NULL) // still nothing selected
|
||||
GAMESTATE->m_pCurSong = arraySongs[0]; // select the first song
|
||||
}
|
||||
|
||||
@@ -816,8 +837,31 @@ void MusicWheel::Update( float fDeltaTime )
|
||||
break;
|
||||
case STATE_TWEENING_ON_SCREEN:
|
||||
SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
|
||||
m_WheelState = STATE_SELECTING_MUSIC;
|
||||
m_fTimeLeftInState = 0;
|
||||
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
|
||||
{
|
||||
if ( m_bUseRandomExtra )
|
||||
{
|
||||
MUSIC->Stop;
|
||||
m_soundExpand.Play();
|
||||
m_WheelState = STATE_ROULETTE_SPINNING;
|
||||
m_SortOrder = SORT_GROUP;
|
||||
m_MusicSortDisplay.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
m_MusicSortDisplay.SetEffectNone();
|
||||
BuildWheelItemDatas( m_WheelItemDatas[SORT_GROUP], SORT_GROUP, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_WheelState = STATE_LOCKED;
|
||||
m_soundStart.Play();
|
||||
m_fLockedWheelVelocity = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_WheelState = STATE_SELECTING_MUSIC;
|
||||
|
||||
}
|
||||
break;
|
||||
case STATE_TWEENING_OFF_SCREEN:
|
||||
m_WheelState = STATE_WAITING_OFF_SCREEN;
|
||||
|
||||
@@ -118,6 +118,7 @@ public:
|
||||
Course* GetSelectedCourse() { return GetCurWheelItemDatas()[m_iSelection].m_pCourse; };
|
||||
CString GetSelectedSection(){ return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; };
|
||||
|
||||
bool WheelIsLocked() { return (m_WheelState == STATE_LOCKED ? true : false); }
|
||||
|
||||
protected:
|
||||
void BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arrayWheelItems, SongSortOrder so, bool bRoulette = false );
|
||||
@@ -166,6 +167,7 @@ protected:
|
||||
float m_fTimeLeftInState;
|
||||
float m_fPositionOffsetFromSelection;
|
||||
|
||||
bool m_bUseRandomExtra;
|
||||
|
||||
// having sounds here causes a crash in Bass. What the heck!?!?!
|
||||
RageSoundSample m_soundChangeMusic;
|
||||
|
||||
@@ -226,6 +226,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, const InputEventType
|
||||
if( m_Menu.IsClosing() )
|
||||
return; // ignore
|
||||
|
||||
if( ! GAMESTATE->IsExtraStage() && ! GAMESTATE->IsExtraStage2() )
|
||||
if( m_bMadeChoice && !m_bGoToOptions && MenuI.button == MENU_BUTTON_START )
|
||||
{
|
||||
m_bGoToOptions = true;
|
||||
@@ -239,11 +240,13 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, const InputEventType
|
||||
|
||||
if( INPUTQUEUE->MatchesPattern(MenuI.player, EASIER_DIFFICULTY_PATTERN, EASIER_DIFFICULTY_PATTERN_SIZE) )
|
||||
{
|
||||
if( ! GAMESTATE->IsExtraStage() && ! GAMESTATE->IsExtraStage2() )
|
||||
EasierDifficulty( MenuI.player );
|
||||
return;
|
||||
}
|
||||
if( INPUTQUEUE->MatchesPattern(MenuI.player, HARDER_DIFFICULTY_PATTERN, HARDER_DIFFICULTY_PATTERN_SIZE) )
|
||||
{
|
||||
if( ! GAMESTATE->IsExtraStage() && ! GAMESTATE->IsExtraStage2() )
|
||||
HarderDifficulty( MenuI.player );
|
||||
return;
|
||||
}
|
||||
@@ -313,9 +316,10 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
||||
bIsHoldingNext = true;
|
||||
}
|
||||
|
||||
if( bIsHoldingNext || m_bGoToOptions )
|
||||
if( ! GAMESTATE->IsExtraStage() && ! GAMESTATE->IsExtraStage2() &&
|
||||
( bIsHoldingNext || m_bGoToOptions ) )
|
||||
{
|
||||
SCREENMAN->SetNewScreen( new ScreenPlayerOptions );
|
||||
SCREENMAN->SetNewScreen( new ScreenPlayerOptions );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -338,6 +342,7 @@ void ScreenSelectMusic::MenuLeft( const PlayerNumber p, const InputEventType typ
|
||||
if( type >= IET_SLOW_REPEAT && INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_RIGHT) ) )
|
||||
return; // ignore
|
||||
|
||||
if( ! m_MusicWheel.WheelIsLocked() )
|
||||
MUSIC->Stop();
|
||||
|
||||
m_MusicWheel.PrevMusic();
|
||||
@@ -349,6 +354,7 @@ void ScreenSelectMusic::MenuRight( const PlayerNumber p, const InputEventType ty
|
||||
if( type >= IET_SLOW_REPEAT && INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_LEFT) ) )
|
||||
return; // ignore
|
||||
|
||||
if( ! m_MusicWheel.WheelIsLocked() )
|
||||
MUSIC->Stop();
|
||||
|
||||
m_MusicWheel.NextMusic();
|
||||
@@ -359,7 +365,8 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p )
|
||||
if( INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_LEFT) ) &&
|
||||
INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_RIGHT) ) )
|
||||
{
|
||||
m_MusicWheel.NextSort();
|
||||
if( ! GAMESTATE->IsExtraStage() && ! GAMESTATE->IsExtraStage2() )
|
||||
m_MusicWheel.NextSort();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -398,8 +398,7 @@ void SongManager::InitCoursesFromDisk()
|
||||
if( course.m_iStages > 0 )
|
||||
m_aOniCourses.Add( course );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Create endless courses
|
||||
//
|
||||
@@ -420,6 +419,28 @@ void SongManager::InitCoursesFromDisk()
|
||||
m_aEndlessCourses.Add( course );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Load extra stages
|
||||
//
|
||||
for( int g=0; g<saGroupNames.GetSize(); g++ ) // foreach Group
|
||||
{
|
||||
CString sGroupName = saGroupNames[g];
|
||||
CStringArray saCourseFiles;
|
||||
GetDirListing( "Songs\\" + sGroupName + "\\*.crs", saCourseFiles );
|
||||
for( int i=0; i<saCourseFiles.GetSize(); i++ )
|
||||
{
|
||||
Course course;
|
||||
course.LoadFromCRSFile( "Songs\\" + sGroupName + "\\" + saCourseFiles[i], m_pSongs );
|
||||
if( course.m_iStages > 0 )
|
||||
m_aExtraCourses.Add( course );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SongManager::ReloadCourses()
|
||||
|
||||
@@ -44,10 +44,13 @@ public:
|
||||
|
||||
|
||||
// for Oni
|
||||
CArray<Course, Course> m_aOniCourses;
|
||||
CArray<Course, Course> m_aOniCourses;
|
||||
|
||||
// for Extra Stages
|
||||
CArray<Course, Course> m_aExtraCourses;
|
||||
|
||||
// for Endless
|
||||
CArray<Course, Course> m_aEndlessCourses;
|
||||
CArray<Course, Course> m_aEndlessCourses;
|
||||
|
||||
void InitCoursesFromDisk();
|
||||
void ReloadCourses();
|
||||
|
||||
Reference in New Issue
Block a user