add metric to control difficulties that show in demonstration
This commit is contained in:
@@ -3667,6 +3667,7 @@ NumMisses=6
|
|||||||
[ScreenDemonstration]
|
[ScreenDemonstration]
|
||||||
SecondsToShow=30
|
SecondsToShow=30
|
||||||
NextScreen=ScreenRanking
|
NextScreen=ScreenRanking
|
||||||
|
DifficultiesToShow=easy,medium
|
||||||
|
|
||||||
[ScreenNameEntry]
|
[ScreenNameEntry]
|
||||||
TimerX=320
|
TimerX=320
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#define SECONDS_TO_SHOW THEME->GetMetricF("ScreenDemonstration","SecondsToShow")
|
#define SECONDS_TO_SHOW THEME->GetMetricF("ScreenDemonstration","SecondsToShow")
|
||||||
#define NEXT_SCREEN THEME->GetMetric("ScreenDemonstration","NextScreen")
|
#define NEXT_SCREEN THEME->GetMetric("ScreenDemonstration","NextScreen")
|
||||||
|
|
||||||
|
|
||||||
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be same as in ScreenGameplay
|
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be same as in ScreenGameplay
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,15 @@
|
|||||||
#include "RageSounds.h"
|
#include "RageSounds.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "ScreenAttract.h"
|
#include "ScreenAttract.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
// HACK: This belongs in ScreenDemonstration
|
||||||
|
#define DIFFICULTIES_TO_SHOW THEME->GetMetric ("ScreenDemonstration","DifficultiesToShow")
|
||||||
|
|
||||||
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be same as in ScreenGameplay
|
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be same as in ScreenGameplay
|
||||||
|
|
||||||
|
|
||||||
bool ScreenJukebox::SetSong()
|
bool ScreenJukebox::SetSong( bool bDemonstration )
|
||||||
{
|
{
|
||||||
vector<Song*> vSongs;
|
vector<Song*> vSongs;
|
||||||
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
|
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
|
||||||
@@ -34,10 +37,38 @@ bool ScreenJukebox::SetSong()
|
|||||||
else
|
else
|
||||||
SONGMAN->GetSongs( vSongs, GAMESTATE->m_sPreferredGroup );
|
SONGMAN->GetSongs( vSongs, GAMESTATE->m_sPreferredGroup );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate what difficulties to show
|
||||||
|
//
|
||||||
|
CStringArray asBits;
|
||||||
|
vector<Difficulty> vDifficultiesToShow;
|
||||||
|
if( bDemonstration )
|
||||||
|
{
|
||||||
|
split( DIFFICULTIES_TO_SHOW, ",", asBits );
|
||||||
|
for( int i=0; i<asBits.size(); i++ )
|
||||||
|
{
|
||||||
|
Difficulty dc = StringToDifficulty( asBits[i] );
|
||||||
|
if( dc != DIFFICULTY_INVALID )
|
||||||
|
vDifficultiesToShow.push_back( dc );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( GAMESTATE->m_PreferredDifficulty[PLAYER_1] != DIFFICULTY_INVALID )
|
||||||
|
{
|
||||||
|
vDifficultiesToShow.push_back( GAMESTATE->m_PreferredDifficulty[PLAYER_1] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FOREACH_Difficulty( dc )
|
||||||
|
vDifficultiesToShow.push_back( dc );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Search for a Song and Steps to play during the demo
|
// Search for a Song and Steps to play during the demo
|
||||||
//
|
//
|
||||||
for( int i=0; i<600; i++ )
|
for( int i=0; i<1000; i++ )
|
||||||
{
|
{
|
||||||
if( vSongs.size() == 0 )
|
if( vSongs.size() == 0 )
|
||||||
return true;
|
return true;
|
||||||
@@ -50,17 +81,8 @@ bool ScreenJukebox::SetSong()
|
|||||||
if( pSong->NeverDisplayed() )
|
if( pSong->NeverDisplayed() )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
Difficulty dc = GAMESTATE->m_PreferredDifficulty[PLAYER_1];
|
Difficulty dc = vDifficultiesToShow[ rand()%vDifficultiesToShow.size() ];
|
||||||
Steps* pNotes = NULL;
|
Steps* pNotes = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, dc );
|
||||||
if( dc != DIFFICULTY_INVALID )
|
|
||||||
pNotes = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredDifficulty[PLAYER_1] );
|
|
||||||
else // "all difficulties"
|
|
||||||
{
|
|
||||||
vector<Steps*> vNotes;
|
|
||||||
pSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
|
|
||||||
if( vNotes.size() > 0 )
|
|
||||||
pNotes = vNotes[rand()%vNotes.size()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pNotes == NULL )
|
if( pNotes == NULL )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
@@ -79,13 +101,13 @@ bool ScreenJukebox::SetSong()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenJukebox::PrepareForJukebox() // always return true.
|
bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return true.
|
||||||
{
|
{
|
||||||
// ScreeJukeboxMenu must set this
|
// ScreeJukeboxMenu must set this
|
||||||
ASSERT( GAMESTATE->m_CurStyle != STYLE_INVALID );
|
ASSERT( GAMESTATE->m_CurStyle != STYLE_INVALID );
|
||||||
GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
|
GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
|
||||||
|
|
||||||
SetSong();
|
SetSong( bDemonstration );
|
||||||
|
|
||||||
// ASSERT( GAMESTATE->m_pCurSong );
|
// ASSERT( GAMESTATE->m_pCurSong );
|
||||||
|
|
||||||
@@ -136,7 +158,7 @@ bool ScreenJukebox::PrepareForJukebox() // always return true.
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenJukebox::ScreenJukebox( CString sName, bool bDemonstration ) : ScreenGameplay( "ScreenGameplay", PrepareForJukebox() ) // this is a hack to get some code to execute before the ScreenGameplay constructor
|
ScreenJukebox::ScreenJukebox( CString sName, bool bDemonstration ) : ScreenGameplay( "ScreenGameplay", PrepareForJukebox(bDemonstration) ) // this is a hack to get some code to execute before the ScreenGameplay constructor
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenJukebox::ScreenJukebox()" );
|
LOG->Trace( "ScreenJukebox::ScreenJukebox()" );
|
||||||
|
|
||||||
|
|||||||
@@ -18,19 +18,19 @@
|
|||||||
class ScreenJukebox : public ScreenGameplay
|
class ScreenJukebox : public ScreenGameplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenJukebox( CString sName, bool bDemonstration = false );
|
ScreenJukebox( CString sName, bool bDemonstration = false );
|
||||||
|
|
||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
/* Hack: public for JukeboxMenu */
|
/* Hack: public for JukeboxMenu */
|
||||||
static bool SetSong();
|
static bool SetSong( bool bDemonstration );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Transition m_In;
|
Transition m_In;
|
||||||
Transition m_Out;
|
Transition m_Out;
|
||||||
|
|
||||||
static bool PrepareForJukebox();
|
static bool PrepareForJukebox( bool bDemonstration );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void ScreenJukeboxMenu::MenuStart( PlayerNumber pn )
|
|||||||
GAMESTATE->m_PreferredDifficulty[p] = dc;
|
GAMESTATE->m_PreferredDifficulty[p] = dc;
|
||||||
GAMESTATE->m_bJukeboxUsesModifiers = bModifiers;
|
GAMESTATE->m_bJukeboxUsesModifiers = bModifiers;
|
||||||
|
|
||||||
if(!ScreenJukebox::SetSong())
|
if( !ScreenJukebox::SetSong(false) )
|
||||||
{
|
{
|
||||||
/* No songs are available for the selected style, group, and difficulty. */
|
/* No songs are available for the selected style, group, and difficulty. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user