Fix ScreenJukebox when there are no matching steps

Also makes minor tweaks to the SetSong function and adds a SystemMessage to
display that no steps have been found.  When this happens, the ScreenJukebox
will return to its PrevScreen.
This commit is contained in:
Devin J. Pohly
2013-06-09 17:22:43 -04:00
parent 8d50a47d49
commit ec23a019e2
4 changed files with 13 additions and 6 deletions
+3
View File
@@ -1494,6 +1494,9 @@ PlayMode_Battle instructions=
Hold instructions=Hold arrows are arrows that you must keep held down. A successfully held down hold arrow will give you an OK while a missed hold arrow will give you an NG.
Mine instructions=Mines are explosive and should be avoided at all costs as they will take life off of your meter. They will trigger if you keep your foot held down as they pass.
[ScreenJukebox]
NoMatchingSteps=No matching steps found.
[ScreenLegal]
Warning=Warning
BodyText=The StepMania program source code is licensed under a permissive open-source license.\n\nThe StepMania name and logos are protected by Trademark law.\n\nThe StepMania default theme SOUNDS ARE SEPARATELY OWNED BY THE AUTHORS. ALL OTHER THEME COMPONENTS ARE LICENSED UNDER THE STEPMANIA LICENSE.\n\nSee license.txt for details.
+2
View File
@@ -4463,6 +4463,7 @@ NumMisses=6
Fallback="ScreenGameplay"
Class="ScreenDemonstration"
NextScreen=Branch.NoiseTrigger()
PrevScreen=Branch.NoiseTrigger()
StartScreen=Branch.TitleMenu()
PlayMusic=false
SecondsToShow=60
@@ -4516,6 +4517,7 @@ Line4="lua,OptionsRandomJukebox()"
Class="ScreenJukebox"
Fallback="ScreenGameplay"
NextScreen="ScreenJukebox"
PrevScreen="ScreenJukeboxMenu"
StartScreen="ScreenTitleMenu"
LightsMode="LightsMode_Demonstration"
ShowCourseModifiersProbability=0
+7 -4
View File
@@ -41,6 +41,10 @@ void ScreenJukebox::SetSong()
if ( vSongs.size() == 0 )
vSongs = SONGMAN->GetSongs( GAMESTATE->m_sPreferredSongGroup );
// Still nothing?
if( vSongs.size() == 0 )
return;
// Calculate what difficulties to show
vector<Difficulty> vDifficultiesToShow;
@@ -68,9 +72,6 @@ void ScreenJukebox::SetSong()
// Search for a Song and Steps to play during the demo.
for( int i=0; i<1000; i++ )
{
if( vSongs.size() == 0 )
return;
Song* pSong = vSongs[RandomInt(vSongs.size())];
ASSERT( pSong != NULL );
@@ -169,6 +170,7 @@ ScreenJukebox::ScreenJukebox()
m_pCourseEntry = NULL;
}
static LocalizedString NO_MATCHING_STEPS("ScreenJukebox", "NoMatchingSteps");
void ScreenJukebox::Init()
{
// ScreenJukeboxMenu must set this
@@ -228,7 +230,8 @@ void ScreenJukebox::Init()
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
{
this->PostScreenMessage( SM_GoToNextScreen, 0 ); // Abort demonstration.
SCREENMAN->SystemMessage( NO_MATCHING_STEPS );
this->PostScreenMessage( SM_GoToPrevScreen, 0 ); // Abort demonstration.
return;
}
+1 -2
View File
@@ -14,13 +14,12 @@ public:
virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void SetSong();
protected:
bool m_bDemonstration;
const CourseEntry *m_pCourseEntry;
void SetSong();
virtual void InitSongQueues();
};