fix "solo" selectable in Pump
This commit is contained in:
@@ -307,22 +307,25 @@ const StyleDef* GameState::GetCurrentStyleDef()
|
||||
|
||||
bool GameState::IsPlayable( const ModeChoice& mc )
|
||||
{
|
||||
if ( mc.style != STYLE_INVALID )
|
||||
if( mc.m_bInvalid )
|
||||
return false;
|
||||
|
||||
if ( mc.m_style != STYLE_INVALID )
|
||||
{
|
||||
const int SidesJoinedToPlay = GAMEMAN->GetStyleDefForStyle(mc.style)->NumSidesJoinedToPlay();
|
||||
const int SidesJoinedToPlay = GAMEMAN->GetStyleDefForStyle(mc.m_style)->NumSidesJoinedToPlay();
|
||||
if( SidesJoinedToPlay != GAMESTATE->GetNumSidesJoined() )
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't set a PlayMode that's incompatible with our current Style (if any),
|
||||
/* Don't allow a PlayMode that's incompatible with our current Style (if set),
|
||||
* and vice versa. */
|
||||
const PlayMode &rPlayMode = mc.pm != PLAY_MODE_INVALID? mc.pm:m_PlayMode;
|
||||
const PlayMode &rPlayMode = (mc.m_pm != PLAY_MODE_INVALID) ? mc.m_pm : m_PlayMode;
|
||||
if( rPlayMode == PLAY_MODE_RAVE || rPlayMode == PLAY_MODE_BATTLE )
|
||||
{
|
||||
// Can't play rave if there isn't enough room for two players.
|
||||
// This is correct for dance (ie, no rave for solo and doubles),
|
||||
// and should be okay for pump .. not sure about other game types.
|
||||
const Style &rStyle = mc.style != STYLE_INVALID? mc.style: m_CurStyle;
|
||||
const Style &rStyle = mc.m_style != STYLE_INVALID? mc.m_style: m_CurStyle;
|
||||
if( rStyle != STYLE_INVALID &&
|
||||
GAMEMAN->GetStyleDefForStyle(rStyle)->m_iColsPerPlayer >= 6 )
|
||||
return false;
|
||||
|
||||
@@ -11,43 +11,41 @@
|
||||
|
||||
void ModeChoice::Init()
|
||||
{
|
||||
game = GAME_INVALID;
|
||||
style = STYLE_INVALID;
|
||||
pm = PLAY_MODE_INVALID;
|
||||
dc = DIFFICULTY_INVALID;
|
||||
sAnnouncer = "";
|
||||
strcpy( name, "" );
|
||||
m_iIndex = -1;
|
||||
m_game = GAME_INVALID;
|
||||
m_style = STYLE_INVALID;
|
||||
m_pm = PLAY_MODE_INVALID;
|
||||
m_dc = DIFFICULTY_INVALID;
|
||||
m_sAnnouncer = "";
|
||||
m_sName = "";
|
||||
}
|
||||
|
||||
bool ModeChoice::DescribesCurrentMode() const
|
||||
{
|
||||
if( game != GAME_INVALID && game != GAMESTATE->m_CurGame )
|
||||
if( m_game != GAME_INVALID && m_game != GAMESTATE->m_CurGame )
|
||||
return false;
|
||||
if( game != GAME_INVALID && GAMESTATE->m_CurGame != game )
|
||||
if( m_pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != m_pm )
|
||||
return false;
|
||||
if( pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != pm )
|
||||
if( m_style != STYLE_INVALID && GAMESTATE->m_CurStyle != m_style )
|
||||
return false;
|
||||
if( style != STYLE_INVALID && GAMESTATE->m_CurStyle != style )
|
||||
return false;
|
||||
if( dc != DIFFICULTY_INVALID )
|
||||
if( m_dc != DIFFICULTY_INVALID )
|
||||
{
|
||||
for( int pn=0; pn<NUM_PLAYERS; pn++ )
|
||||
if( GAMESTATE->IsHumanPlayer(pn) && GAMESTATE->m_PreferredDifficulty[pn] != dc )
|
||||
if( GAMESTATE->IsHumanPlayer(pn) && GAMESTATE->m_PreferredDifficulty[pn] != m_dc )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( sAnnouncer != "" && sAnnouncer != ANNOUNCER->GetCurAnnouncerName() )
|
||||
if( m_sAnnouncer != "" && m_sAnnouncer != ANNOUNCER->GetCurAnnouncerName() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModeChoice::FromString( CString sChoice, bool bIgnoreUnknown )
|
||||
void ModeChoice::Load( int iIndex, CString sChoice )
|
||||
{
|
||||
strncpy( this->name, sChoice, min(sChoice.size()+1, sizeof(this->name)) );
|
||||
name[sizeof(this->name)-1] = 0;
|
||||
m_iIndex = iIndex;
|
||||
|
||||
bool bChoiceIsInvalid = false;
|
||||
m_sName = sChoice;
|
||||
|
||||
CStringArray asCommands;
|
||||
split( sChoice, ";", asCommands );
|
||||
@@ -68,9 +66,9 @@ bool ModeChoice::FromString( CString sChoice, bool bIgnoreUnknown )
|
||||
{
|
||||
Game game = GAMEMAN->StringToGameType( sValue );
|
||||
if( game != GAME_INVALID )
|
||||
this->game = game;
|
||||
m_game = game;
|
||||
else
|
||||
bChoiceIsInvalid |= true;
|
||||
m_bInvalid |= true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,40 +77,38 @@ bool ModeChoice::FromString( CString sChoice, bool bIgnoreUnknown )
|
||||
Style style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue );
|
||||
if( style != STYLE_INVALID )
|
||||
{
|
||||
this->style = style;
|
||||
m_style = style;
|
||||
// There is a choices that allows players to choose a style. Allow joining.
|
||||
GAMESTATE->m_bPlayersCanJoin = true;
|
||||
}
|
||||
else
|
||||
bChoiceIsInvalid |= true;
|
||||
m_bInvalid |= true;
|
||||
}
|
||||
|
||||
if( sName == "playmode" )
|
||||
{
|
||||
PlayMode pm = StringToPlayMode( sValue );
|
||||
if( pm != PLAY_MODE_INVALID )
|
||||
this->pm = pm;
|
||||
m_pm = pm;
|
||||
else
|
||||
bChoiceIsInvalid |= true;
|
||||
m_bInvalid |= true;
|
||||
}
|
||||
|
||||
if( sName == "difficulty" )
|
||||
{
|
||||
Difficulty dc = StringToDifficulty( sValue );
|
||||
if( dc != DIFFICULTY_INVALID )
|
||||
this->dc = dc;
|
||||
m_dc = dc;
|
||||
else
|
||||
bChoiceIsInvalid |= true;
|
||||
m_bInvalid |= true;
|
||||
}
|
||||
|
||||
if( sName == "announcer" )
|
||||
{
|
||||
sAnnouncer = sValue;
|
||||
m_sAnnouncer = sValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return !bChoiceIsInvalid;
|
||||
}
|
||||
|
||||
void ModeChoice::ApplyToAllPlayers()
|
||||
@@ -124,16 +120,16 @@ void ModeChoice::ApplyToAllPlayers()
|
||||
|
||||
void ModeChoice::Apply( PlayerNumber pn )
|
||||
{
|
||||
if( game != GAME_INVALID )
|
||||
GAMESTATE->m_CurGame = game;
|
||||
if( pm != PLAY_MODE_INVALID )
|
||||
GAMESTATE->m_PlayMode = pm;
|
||||
if( style != STYLE_INVALID )
|
||||
GAMESTATE->m_CurStyle = style;
|
||||
if( dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID )
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = dc;
|
||||
if( sAnnouncer != "" )
|
||||
ANNOUNCER->SwitchAnnouncer( sAnnouncer );
|
||||
if( m_game != GAME_INVALID )
|
||||
GAMESTATE->m_CurGame = m_game;
|
||||
if( m_pm != PLAY_MODE_INVALID )
|
||||
GAMESTATE->m_PlayMode = m_pm;
|
||||
if( m_style != STYLE_INVALID )
|
||||
GAMESTATE->m_CurStyle = m_style;
|
||||
if( m_dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID )
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = m_dc;
|
||||
if( m_sAnnouncer != "" )
|
||||
ANNOUNCER->SwitchAnnouncer( m_sAnnouncer );
|
||||
|
||||
// HACK: Set life type to BATTERY just once here so it happens once and
|
||||
// we don't override the user's changes if they back out.
|
||||
@@ -144,7 +140,7 @@ void ModeChoice::Apply( PlayerNumber pn )
|
||||
//
|
||||
// We know what players are joined at the time we set the Style
|
||||
//
|
||||
if( style != STYLE_INVALID )
|
||||
if( m_style != STYLE_INVALID )
|
||||
{
|
||||
PROFILEMAN->TryLoadProfile( pn );
|
||||
}
|
||||
|
||||
@@ -21,18 +21,19 @@ struct ModeChoice // used in SelectMode
|
||||
ModeChoice() { Init(); }
|
||||
void Init();
|
||||
|
||||
bool FromString( CString str, bool bIgnoreUnknown=false );
|
||||
void Load( int iIndex, CString str );
|
||||
void ApplyToAllPlayers();
|
||||
void Apply( PlayerNumber pn );
|
||||
bool DescribesCurrentMode() const;
|
||||
|
||||
Game game;
|
||||
Style style;
|
||||
PlayMode pm;
|
||||
Difficulty dc;
|
||||
CString sAnnouncer;
|
||||
|
||||
char name[64];
|
||||
bool m_bInvalid;
|
||||
int m_iIndex;
|
||||
Game m_game;
|
||||
Style m_style;
|
||||
PlayMode m_pm;
|
||||
Difficulty m_dc;
|
||||
CString m_sAnnouncer;
|
||||
CString m_sName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -405,7 +405,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
||||
RageColor c = RageColor(1,1,0,1);
|
||||
WheelItemData wid( TYPE_SORT, NULL, "", NULL, c, so );
|
||||
wid.m_sLabel = Names[i];
|
||||
wid.m_Action.FromString( Actions[i], true );
|
||||
wid.m_Action.Load( i, Actions[i] );
|
||||
|
||||
switch( so )
|
||||
{
|
||||
|
||||
@@ -49,10 +49,10 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName)
|
||||
CString sChoice = CHOICE(c);
|
||||
|
||||
ModeChoice mc;
|
||||
if( mc.FromString(sChoice) )
|
||||
m_aModeChoices.push_back( mc );
|
||||
|
||||
CString sBGAnimationDir = THEME->GetPathTo(BGAnimations, ssprintf("%s %s",m_sName.c_str(),mc.name), true); // true="optional"
|
||||
mc.Load( c, sChoice );
|
||||
m_aModeChoices.push_back( mc );
|
||||
|
||||
CString sBGAnimationDir = THEME->GetPathTo(BGAnimations, ssprintf("%s %s",m_sName.c_str(),mc.m_sName.c_str()), true); // true="optional"
|
||||
if( sBGAnimationDir == "" )
|
||||
sBGAnimationDir = THEME->GetPathToB(m_sName+" background");
|
||||
m_BGAnimations[c].LoadFromAniDir( sBGAnimationDir );
|
||||
|
||||
@@ -353,7 +353,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
|
||||
|
||||
if(m_CurrentPage != PAGE_2 || !AnotherPlayerSelected)
|
||||
{
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.name)) );
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str())) );
|
||||
m_soundSelect.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() : ScreenSelect( "ScreenSele
|
||||
|
||||
for( unsigned k=0; k < m_NumModes || k <= 7 ; k++ )
|
||||
{
|
||||
CString MOO = m_aModeChoices[k].name;
|
||||
CString MOO = m_aModeChoices[k].m_sName;
|
||||
if( IsValidModeName(MOO) )
|
||||
{
|
||||
// We cannot show more than 8 icons at a time, BTW
|
||||
@@ -115,8 +115,8 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() : ScreenSelect( "ScreenSele
|
||||
float fCursorX = GetCursorX( (PlayerNumber)p );
|
||||
float fCursorY = GetCursorY( (PlayerNumber)p );
|
||||
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[0].name );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[0].name );
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[0].m_sName.c_str() );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[0].m_sName.c_str() );
|
||||
|
||||
m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) );
|
||||
m_sprPicture[p].SetXY( PICTURE_X(p), PICTURE_Y(p) );
|
||||
@@ -229,7 +229,7 @@ void ScreenSelectDifficultyEX::MenuRight( PlayerNumber pn )
|
||||
|
||||
bool ScreenSelectDifficultyEX::IsACourse( int mIndex )
|
||||
{
|
||||
CString MODECHOICENAME = m_ModeChoices[mIndex].name;
|
||||
CString MODECHOICENAME = m_ModeChoices[mIndex].m_sName;
|
||||
if( MODECHOICENAME.Left(7) != "arcade-" ) { return true; }
|
||||
else { return false; }
|
||||
}
|
||||
@@ -257,8 +257,8 @@ void ScreenSelectDifficultyEX::SetAllPlayersSelection( int iChoice, bool bSwitch
|
||||
m_sprInfo[p].Command( ANIMATE_MODE_SWITCH_INFO_ON_COMMAND );
|
||||
}
|
||||
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[m_iChoice[p]].name );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[m_iChoice[p]].name );
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[m_iChoice[p]].m_sName.c_str() );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[m_iChoice[p]].m_sName.c_str() );
|
||||
m_sprInfo[p].Load( THEME->GetPathToG(sInfoFile) );
|
||||
m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) );
|
||||
|
||||
@@ -299,8 +299,8 @@ void ScreenSelectDifficultyEX::Change( PlayerNumber pn, int iNewChoice )
|
||||
}
|
||||
|
||||
m_iChoice[p] = iNewChoice;
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[m_iChoice[p]].name );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[m_iChoice[p]].name );
|
||||
CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[m_iChoice[p]].m_sName.c_str() );
|
||||
CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[m_iChoice[p]].m_sName.c_str() );
|
||||
m_sprInfo[p].Load( THEME->GetPathToG(sInfoFile) );
|
||||
m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) );
|
||||
|
||||
@@ -338,7 +338,7 @@ void ScreenSelectDifficultyEX::SetDifficultyIconText( bool bDisplayCourseItems )
|
||||
{
|
||||
for( unsigned k=0; k < m_aModeChoices.size(); k++ )
|
||||
{
|
||||
CString MMNAME = m_ModeChoices[k].name;
|
||||
CString MMNAME = m_ModeChoices[k].m_sName;
|
||||
MMNAME.Replace( "arcade-", "" );
|
||||
m_sprDifficulty[k].SetState( GetIconIndex(MMNAME.c_str()) );
|
||||
m_textDifficultyText[k].SetDiffuse( RageColor(1,1,1,1) );
|
||||
@@ -384,7 +384,7 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn )
|
||||
m_sprDifficulty[e].SetDiffuse( RageColor(.5,.5,.5,1) );
|
||||
}
|
||||
}
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.name)) );
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str())) );
|
||||
m_soundSelect.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
||||
|
||||
if(GetCurrentPage() != PAGE_2 || !AnotherPlayerSelected)
|
||||
{
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectMaster comment %s",mc.name)) );
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectMaster comment %s",mc.m_sName.c_str())) );
|
||||
m_soundSelect.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ ScreenSelectMode::ScreenSelectMode() : ScreenSelect( "ScreenSelectMode" )
|
||||
//
|
||||
// Load Sprite
|
||||
//
|
||||
CString sElementName = ssprintf("ScreenSelectMode %s", mc.name );
|
||||
CString sElementName = ssprintf("ScreenSelectMode %s", mc.m_sName.c_str() );
|
||||
CString sElementPath = THEME->GetPathToG(sElementName);
|
||||
|
||||
arrayLocations.push_back( sElementPath );
|
||||
@@ -159,7 +159,7 @@ void ScreenSelectMode::UpdateSelectableChoices()
|
||||
for( i=0; i<m_aModeChoices.size(); i++ )
|
||||
{
|
||||
const ModeChoice& mc = m_aModeChoices[i];
|
||||
CString modename = mc.name;
|
||||
CString modename = mc.m_sName;
|
||||
modename.MakeUpper();
|
||||
|
||||
|
||||
@@ -174,8 +174,10 @@ void ScreenSelectMode::UpdateSelectableChoices()
|
||||
(!PREFSMAN->m_bJointPremium)
|
||||
)*/
|
||||
|
||||
const int SidesJoinedToPlay = mc.style == STYLE_INVALID? 1:
|
||||
GAMEMAN->GetStyleDefForStyle(mc.style)->NumSidesJoinedToPlay();
|
||||
const int SidesJoinedToPlay =
|
||||
(mc.m_style == STYLE_INVALID) ?
|
||||
1 :
|
||||
GAMEMAN->GetStyleDefForStyle(mc.m_style)->NumSidesJoinedToPlay();
|
||||
if( (!PREFSMAN->m_bJointPremium ) ||
|
||||
(
|
||||
PREFSMAN->m_bJointPremium &&
|
||||
|
||||
@@ -47,7 +47,7 @@ ScreenSelectStyle::ScreenSelectStyle() : ScreenSelect( "ScreenSelectStyle" )
|
||||
if( sIconPath.empty() ) // element doesn't exist
|
||||
{
|
||||
m_textIcon[i].LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
m_textIcon[i].SetText( mc.name );
|
||||
m_textIcon[i].SetText( mc.m_sName );
|
||||
m_textIcon[i].SetZoom(0.5f);
|
||||
this->AddChild( &m_textIcon[i] );
|
||||
}
|
||||
@@ -182,7 +182,7 @@ void ScreenSelectStyle::MenuStart( PlayerNumber pn )
|
||||
SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, 0 );
|
||||
|
||||
const ModeChoice& mc = m_aModeChoices[GetSelectionIndex(pn)];
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectStyle comment %s",mc.name)) );
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectStyle comment %s",mc.m_sName.c_str())) );
|
||||
|
||||
//
|
||||
// TweenOffScreen
|
||||
|
||||
Reference in New Issue
Block a user