specify StyleTypes to use in ScreenDemonstration
This commit is contained in:
@@ -3648,6 +3648,7 @@ StartScreen=@ScreenTitleBranch()
|
||||
PlayMusic=0
|
||||
ShowCourseModifiersProbability=0
|
||||
AllowAdvancedModifiers=0
|
||||
AllowStyleTypes=TwoPlayersTwoSides
|
||||
|
||||
[ScreenJukebox]
|
||||
ShowCourseModifiersProbability=0
|
||||
|
||||
@@ -353,7 +353,8 @@ enum StyleType
|
||||
ONE_PLAYER_ONE_SIDE, // e.g. single
|
||||
TWO_PLAYERS_TWO_SIDES, // e.g. versus
|
||||
ONE_PLAYER_TWO_SIDES, // e.g. double
|
||||
NUM_STYLE_TYPES
|
||||
NUM_STYLE_TYPES,
|
||||
STYLE_TYPE_INVALID
|
||||
};
|
||||
const CString& StyleTypeToString( StyleType s );
|
||||
StyleType StringToStyleType( const CString& s );
|
||||
|
||||
@@ -1014,7 +1014,7 @@ Style g_Styles[] =
|
||||
&g_Games[GAME_DANCE], // m_Game
|
||||
true, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
false, // m_bUsedForDemonstration
|
||||
true, // m_bUsedForDemonstration
|
||||
true, // m_bUsedForHowToPlay
|
||||
"single", // m_szName
|
||||
STEPS_TYPE_DANCE_SINGLE, // m_StepsType
|
||||
@@ -1082,7 +1082,7 @@ Style g_Styles[] =
|
||||
&g_Games[GAME_DANCE], // m_Game
|
||||
true, // m_bUsedForGameplay
|
||||
true, // m_bUsedForEdit
|
||||
false, // m_bUsedForDemonstration
|
||||
true, // m_bUsedForDemonstration
|
||||
false, // m_bUsedForHowToPlay
|
||||
"double", // m_szName
|
||||
STEPS_TYPE_DANCE_DOUBLE, // m_StepsType
|
||||
@@ -2613,17 +2613,18 @@ void GameManager::GetStepsTypesForGame( const Game *pGame, vector<StepsType>& aS
|
||||
}
|
||||
}
|
||||
|
||||
const Style* GameManager::GetDemonstrationStyleForGame( const Game *pGame ) const
|
||||
void GameManager::GetDemonstrationStylesForGame( const Game *pGame, vector<const Style*> &vpStylesOut ) const
|
||||
{
|
||||
vpStylesOut.clear();
|
||||
|
||||
for( unsigned s=0; s<NUM_STYLES; s++ )
|
||||
{
|
||||
const Style* style = &g_Styles[s];
|
||||
if( style->m_pGame == pGame && style->m_bUsedForDemonstration )
|
||||
return style;
|
||||
vpStylesOut.push_back( style );
|
||||
}
|
||||
|
||||
ASSERT(0); // this Game is missing a Style that can be used with the demonstration
|
||||
return NULL;
|
||||
|
||||
ASSERT( vpStylesOut.size()>0 ); // this Game is missing a Style that can be used with the demonstration
|
||||
}
|
||||
|
||||
const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame ) const
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
void GetAllStyles( vector<const Style*>& aStylesAddTo, bool editor=false ) const;
|
||||
void GetStepsTypesForGame( const Game* pGame, vector<StepsType>& aStepsTypeAddTo ) const;
|
||||
const Style* GetEditorStyleForStepsType( StepsType st ) const;
|
||||
const Style* GetDemonstrationStyleForGame( const Game* pGame ) const;
|
||||
void GetDemonstrationStylesForGame( const Game *pGame, vector<const Style*> &vpStylesOut ) const;
|
||||
const Style* GetHowToPlayStyleForGame( const Game* pGame ) const;
|
||||
|
||||
void GetEnabledGames( vector<const Game*>& aGamesOut ) const;
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
#include "RageSoundManager.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "Style.h"
|
||||
|
||||
|
||||
#define SECONDS_TO_SHOW THEME->GetMetricF(m_sName,"SecondsToShow")
|
||||
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
|
||||
#define ALLOW_STYLE_TYPES THEME->GetMetric (m_sName,"AllowStyleTypes")
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenDemonstration );
|
||||
ScreenDemonstration::ScreenDemonstration( CString sName ) : ScreenJukebox( sName )
|
||||
@@ -23,7 +25,31 @@ ScreenDemonstration::ScreenDemonstration( CString sName ) : ScreenJukebox( sName
|
||||
|
||||
void ScreenDemonstration::Init()
|
||||
{
|
||||
GAMESTATE->m_pCurStyle.Set( GAMEMAN->GetDemonstrationStyleForGame(GAMESTATE->m_pCurGame) );
|
||||
// Choose a Style
|
||||
{
|
||||
vector<CString> v;
|
||||
split( ALLOW_STYLE_TYPES, ",", v );
|
||||
vector<StyleType> vStyleTypeAllow;
|
||||
FOREACH_CONST( CString, v, s )
|
||||
{
|
||||
StyleType st = StringToStyleType( *s );
|
||||
ASSERT( st != STYLE_TYPE_INVALID );
|
||||
vStyleTypeAllow.push_back( st );
|
||||
}
|
||||
|
||||
vector<const Style*> vStylePossible;
|
||||
GAMEMAN->GetDemonstrationStylesForGame( GAMESTATE->m_pCurGame, vStylePossible );
|
||||
for( int i=(int)(vStylePossible.size())-1; i>=0; i-- )
|
||||
{
|
||||
bool bAllowThis = find( vStyleTypeAllow.begin(), vStyleTypeAllow.end(), vStylePossible[i]->m_StyleType ) != vStyleTypeAllow.end();
|
||||
if( !bAllowThis )
|
||||
vStylePossible.erase( vStylePossible.begin()+i );
|
||||
}
|
||||
|
||||
ASSERT( vStylePossible.size() > 0 );
|
||||
const Style* pStyle = vStylePossible[ rand() % vStylePossible.size() ];
|
||||
GAMESTATE->m_pCurStyle.Set( pStyle );
|
||||
}
|
||||
|
||||
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user