allow setting courses
fix setting steps not working if the song was previously set
This commit is contained in:
@@ -29,6 +29,7 @@ void ModeChoice::Init()
|
|||||||
m_sScreen = "";
|
m_sScreen = "";
|
||||||
m_pSong = NULL;
|
m_pSong = NULL;
|
||||||
m_pSteps = NULL;
|
m_pSteps = NULL;
|
||||||
|
m_pCourse = NULL;
|
||||||
m_pCharacter = NULL;
|
m_pCharacter = NULL;
|
||||||
m_CourseDifficulty = COURSE_DIFFICULTY_INVALID;
|
m_CourseDifficulty = COURSE_DIFFICULTY_INVALID;
|
||||||
}
|
}
|
||||||
@@ -170,8 +171,11 @@ void ModeChoice::Load( int iIndex, CString sChoice )
|
|||||||
{
|
{
|
||||||
m_pSong = SONGMAN->FindSong( sValue );
|
m_pSong = SONGMAN->FindSong( sValue );
|
||||||
if( m_pSong == NULL )
|
if( m_pSong == NULL )
|
||||||
|
{
|
||||||
|
m_sInvalidReason = ssprintf( "Song \"%s\" not found", sValue.c_str() );
|
||||||
m_bInvalid |= true;
|
m_bInvalid |= true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( sName == "steps" )
|
if( sName == "steps" )
|
||||||
{
|
{
|
||||||
@@ -180,20 +184,39 @@ void ModeChoice::Load( int iIndex, CString sChoice )
|
|||||||
sSteps = sValue;
|
sSteps = sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( sName == "course" )
|
||||||
|
{
|
||||||
|
m_pCourse = SONGMAN->FindCourse( sValue );
|
||||||
|
if( m_pCourse == NULL )
|
||||||
|
{
|
||||||
|
m_sInvalidReason = ssprintf( "Course \"%s\" not found", sValue.c_str() );
|
||||||
|
m_bInvalid |= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( sName == "screen" )
|
if( sName == "screen" )
|
||||||
m_sScreen = sValue;
|
m_sScreen = sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_bInvalid && sSteps != "" )
|
if( !m_bInvalid && sSteps != "" )
|
||||||
{
|
{
|
||||||
if( m_pSong == NULL || m_style == STYLE_INVALID )
|
Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong;
|
||||||
|
Style style = (m_style != STYLE_INVALID)? m_style:GAMESTATE->m_CurStyle;
|
||||||
|
if( pSong == NULL || style == STYLE_INVALID )
|
||||||
RageException::Throw( "Must set Song and Style to set Steps" );
|
RageException::Throw( "Must set Song and Style to set Steps" );
|
||||||
|
|
||||||
m_pSteps = m_pSong->GetStepsByDescription( GAMEMAN->GetStyleDefForStyle(m_style)->m_StepsType, sSteps );
|
Difficulty dc = StringToDifficulty( sSteps );
|
||||||
|
if( dc != DIFFICULTY_EDIT )
|
||||||
|
m_pSteps = pSong->GetStepsByDifficulty( GAMEMAN->GetStyleDefForStyle(style)->m_StepsType, dc );
|
||||||
|
else
|
||||||
|
m_pSteps = pSong->GetStepsByDescription( GAMEMAN->GetStyleDefForStyle(style)->m_StepsType, sSteps );
|
||||||
if( m_pSteps == NULL )
|
if( m_pSteps == NULL )
|
||||||
|
{
|
||||||
|
m_sInvalidReason = "steps not found";
|
||||||
m_bInvalid |= true;
|
m_bInvalid |= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int GetSidesRequiredToPlayStyle( Style style )
|
int GetSidesRequiredToPlayStyle( Style style )
|
||||||
{
|
{
|
||||||
@@ -238,7 +261,11 @@ static bool AreStyleAndPlayModeCompatible( Style style, PlayMode pm )
|
|||||||
bool ModeChoice::IsPlayable( CString *why ) const
|
bool ModeChoice::IsPlayable( CString *why ) const
|
||||||
{
|
{
|
||||||
if( m_bInvalid )
|
if( m_bInvalid )
|
||||||
|
{
|
||||||
|
if( *why )
|
||||||
|
*why = m_sInvalidReason;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_style != STYLE_INVALID )
|
if ( m_style != STYLE_INVALID )
|
||||||
{
|
{
|
||||||
@@ -348,6 +375,8 @@ void ModeChoice::Apply( PlayerNumber pn ) const
|
|||||||
GAMESTATE->m_pCurSong = m_pSong;
|
GAMESTATE->m_pCurSong = m_pSong;
|
||||||
if( m_pSteps )
|
if( m_pSteps )
|
||||||
GAMESTATE->m_pCurNotes[pn] = m_pSteps;
|
GAMESTATE->m_pCurNotes[pn] = m_pSteps;
|
||||||
|
if( m_pCourse )
|
||||||
|
GAMESTATE->m_pCurCourse = m_pCourse;
|
||||||
if( m_pCharacter )
|
if( m_pCharacter )
|
||||||
GAMESTATE->m_pCurCharacters[pn] = m_pCharacter;
|
GAMESTATE->m_pCurCharacters[pn] = m_pCharacter;
|
||||||
if( m_CourseDifficulty != COURSE_DIFFICULTY_INVALID )
|
if( m_CourseDifficulty != COURSE_DIFFICULTY_INVALID )
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
class Song;
|
class Song;
|
||||||
class Steps;
|
class Steps;
|
||||||
|
class Course;
|
||||||
class Character;
|
class Character;
|
||||||
|
|
||||||
struct ModeChoice // used in SelectMode
|
struct ModeChoice // used in SelectMode
|
||||||
@@ -35,6 +36,7 @@ struct ModeChoice // used in SelectMode
|
|||||||
|
|
||||||
CString m_sName; // display name
|
CString m_sName; // display name
|
||||||
bool m_bInvalid;
|
bool m_bInvalid;
|
||||||
|
CString m_sInvalidReason;
|
||||||
int m_iIndex;
|
int m_iIndex;
|
||||||
Game m_game;
|
Game m_game;
|
||||||
Style m_style;
|
Style m_style;
|
||||||
@@ -45,6 +47,7 @@ struct ModeChoice // used in SelectMode
|
|||||||
CString m_sScreen;
|
CString m_sScreen;
|
||||||
Song* m_pSong;
|
Song* m_pSong;
|
||||||
Steps* m_pSteps;
|
Steps* m_pSteps;
|
||||||
|
Course* m_pCourse;
|
||||||
Character* m_pCharacter;
|
Character* m_pCharacter;
|
||||||
CourseDifficulty m_CourseDifficulty;
|
CourseDifficulty m_CourseDifficulty;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user