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