when a 2nd player joins, remove double steps from the list. They're no longer playable with 2 players joined.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
#include "LuaManager.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -247,13 +247,6 @@ void DifficultyList::SetFromGameState()
|
|||||||
{
|
{
|
||||||
const Song *pSong = GAMESTATE->m_pCurSong;
|
const Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
|
|
||||||
const bool bSongChanged = (pSong != m_CurSong);
|
|
||||||
|
|
||||||
/* If the song has changed, update displays: */
|
|
||||||
if( bSongChanged )
|
|
||||||
{
|
|
||||||
m_CurSong = pSong;
|
|
||||||
|
|
||||||
for( int m = 0; m < MAX_METERS; ++m )
|
for( int m = 0; m < MAX_METERS; ++m )
|
||||||
{
|
{
|
||||||
m_Lines[m].m_Meter.Unset();
|
m_Lines[m].m_Meter.Unset();
|
||||||
@@ -283,7 +276,7 @@ void DifficultyList::SetFromGameState()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
vector<Steps*> vpSteps;
|
vector<Steps*> vpSteps;
|
||||||
SongUtil::GetPossibleSteps( pSong, vpSteps );
|
SongUtil::GetPlayableSteps( pSong, vpSteps );
|
||||||
/* Should match the sort in ScreenSelectMusic::AfterMusicChange. */
|
/* Should match the sort in ScreenSelectMusic::AfterMusicChange. */
|
||||||
|
|
||||||
m_Rows.resize( vpSteps.size() );
|
m_Rows.resize( vpSteps.size() );
|
||||||
@@ -298,17 +291,13 @@ void DifficultyList::SetFromGameState()
|
|||||||
row.m_dc = row.m_Steps->GetDifficulty();
|
row.m_dc = row.m_Steps->GetDifficulty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UpdatePositions();
|
UpdatePositions();
|
||||||
PositionItems();
|
PositionItems();
|
||||||
|
|
||||||
if( bSongChanged )
|
|
||||||
{
|
|
||||||
for( int m = 0; m < MAX_METERS; ++m )
|
for( int m = 0; m < MAX_METERS; ++m )
|
||||||
m_Lines[m].m_Meter.FinishTweening();
|
m_Lines[m].m_Meter.FinishTweening();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DifficultyList::HideRows()
|
void DifficultyList::HideRows()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2340,21 +2340,23 @@ void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, vecto
|
|||||||
{
|
{
|
||||||
FOREACH_ENUM( StyleType, styleType )
|
FOREACH_ENUM( StyleType, styleType )
|
||||||
{
|
{
|
||||||
|
int iNumPlayersRequired;
|
||||||
switch( styleType )
|
switch( styleType )
|
||||||
{
|
{
|
||||||
DEFAULT_FAIL( styleType );
|
DEFAULT_FAIL( styleType );
|
||||||
case StyleType_OnePlayerOneSide:
|
case StyleType_OnePlayerOneSide:
|
||||||
case StyleType_OnePlayerTwoSides:
|
case StyleType_OnePlayerTwoSides:
|
||||||
if( iNumPlayers != 1 )
|
iNumPlayersRequired = 1;
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
case StyleType_TwoPlayersTwoSides:
|
case StyleType_TwoPlayersTwoSides:
|
||||||
case StyleType_TwoPlayersSharedSides:
|
case StyleType_TwoPlayersSharedSides:
|
||||||
if( iNumPlayers != 2 )
|
iNumPlayersRequired = 2;
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( iNumPlayers != iNumPlayersRequired )
|
||||||
|
continue;
|
||||||
|
|
||||||
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];
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ void MusicWheel::BeginScreen()
|
|||||||
if( GAMESTATE->m_pCurSteps[p] != NULL )
|
if( GAMESTATE->m_pCurSteps[p] != NULL )
|
||||||
{
|
{
|
||||||
vector<Steps*> vpPossibleSteps;
|
vector<Steps*> vpPossibleSteps;
|
||||||
SongUtil::GetPossibleSteps( GAMESTATE->m_pCurSong, vpPossibleSteps );
|
SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, vpPossibleSteps );
|
||||||
bool bStepsIsPossible = find( vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p] ) == vpPossibleSteps.end();
|
bool bStepsIsPossible = find( vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p] ) == vpPossibleSteps.end();
|
||||||
if( !bStepsIsPossible )
|
if( !bStepsIsPossible )
|
||||||
GAMESTATE->m_pCurSteps[p].Set( NULL );
|
GAMESTATE->m_pCurSteps[p].Set( NULL );
|
||||||
|
|||||||
@@ -298,6 +298,9 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
// Handle late joining
|
// Handle late joining
|
||||||
if( input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) )
|
if( input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) )
|
||||||
{
|
{
|
||||||
|
// refresh the steps list so that 2-side StepsTypes will be removed since they're no longer playable
|
||||||
|
AfterMusicChange();
|
||||||
|
|
||||||
int iSel = 0;
|
int iSel = 0;
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
m_iSelection[pn] = iSel;
|
m_iSelection[pn] = iSel;
|
||||||
@@ -311,6 +314,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
Steps* pSteps = m_vpSteps.empty()? NULL: m_vpSteps[m_iSelection[pn]];
|
Steps* pSteps = m_vpSteps.empty()? NULL: m_vpSteps[m_iSelection[pn]];
|
||||||
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
||||||
}
|
}
|
||||||
|
|
||||||
return; // don't handle this press again below
|
return; // don't handle this press again below
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1058,7 +1062,7 @@ void ScreenSelectMusic::AfterMusicChange()
|
|||||||
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
|
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
|
||||||
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
||||||
|
|
||||||
SongUtil::GetPossibleSteps( pSong, m_vpSteps );
|
SongUtil::GetPlayableSteps( pSong, m_vpSteps );
|
||||||
|
|
||||||
if ( PREFSMAN->m_bShowBanners )
|
if ( PREFSMAN->m_bShowBanners )
|
||||||
g_sBannerPath = pSong->GetBannerPath();
|
g_sBannerPath = pSong->GetBannerPath();
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
bool SongCriteria::Matches( const Song *pSong ) const
|
bool SongCriteria::Matches( const Song *pSong ) const
|
||||||
{
|
{
|
||||||
@@ -810,30 +812,35 @@ void SongUtil::FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongUtil::GetPossibleSteps( const Song *pSong, vector<Steps*> &vOut )
|
static void GetPlayableStepsTypes( set<StepsType> &vOut )
|
||||||
{
|
{
|
||||||
vector<const Style*> vpPossibleStyles;
|
vector<const Style*> vpPossibleStyles;
|
||||||
if( CommonMetrics::ALL_STEPS_TYPES_IN_ONE_LIST )
|
if( CommonMetrics::ALL_STEPS_TYPES_IN_ONE_LIST )
|
||||||
GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles );
|
GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles );
|
||||||
else
|
else
|
||||||
vpPossibleStyles.push_back( GAMESTATE->m_pCurStyle );
|
vpPossibleStyles.push_back( GAMESTATE->m_pCurStyle );
|
||||||
set<StepsType> vStepsType;
|
|
||||||
FOREACH( const Style*, vpPossibleStyles, s )
|
FOREACH( const Style*, vpPossibleStyles, s )
|
||||||
vStepsType.insert( (*s)->m_StepsType );
|
vOut.insert( (*s)->m_StepsType );
|
||||||
|
|
||||||
// filter out hidden StepsTypes
|
// filter out hidden StepsTypes
|
||||||
const vector<StepsType> &vstToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
const vector<StepsType> &vstToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
|
||||||
FOREACHS( StepsType, vStepsType, st )
|
FOREACHS( StepsType, vOut, st )
|
||||||
{
|
{
|
||||||
bool bShowThis = find( vstToShow.begin(), vstToShow.end(), *st ) != vstToShow.end();
|
bool bShowThis = find( vstToShow.begin(), vstToShow.end(), *st ) != vstToShow.end();
|
||||||
if( !bShowThis )
|
if( !bShowThis )
|
||||||
{
|
{
|
||||||
set<StepsType>::iterator to_erase = st;
|
set<StepsType>::iterator to_erase = st;
|
||||||
++st;
|
++st;
|
||||||
vStepsType.erase( to_erase );
|
vOut.erase( to_erase );
|
||||||
--st;
|
--st;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongUtil::GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut )
|
||||||
|
{
|
||||||
|
set<StepsType> vStepsType;
|
||||||
|
GetPlayableStepsTypes( vStepsType );
|
||||||
|
|
||||||
FOREACHS( StepsType, vStepsType, st )
|
FOREACHS( StepsType, vStepsType, st )
|
||||||
SongUtil::GetSteps( pSong, vOut, *st );
|
SongUtil::GetSteps( pSong, vOut, *st );
|
||||||
@@ -853,6 +860,13 @@ void SongUtil::GetPossibleSteps( const Song *pSong, vector<Steps*> &vOut )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SongUtil::IsStepsTypePlayable( StepsType st )
|
||||||
|
{
|
||||||
|
set<StepsType> vStepsType;
|
||||||
|
GetPlayableStepsTypes( vStepsType );
|
||||||
|
return vStepsType.find( st ) != vStepsType.end();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// SongID
|
// SongID
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
@@ -906,6 +920,29 @@ bool SongID::IsValid() const
|
|||||||
return !sDir.empty();
|
return !sDir.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
int IsStepsTypePlayable( lua_State *L )
|
||||||
|
{
|
||||||
|
StepsType st = Enum::Check<StepsType>(L, 1);
|
||||||
|
bool b = SongUtil::IsStepsTypePlayable( st );
|
||||||
|
LuaHelpers::Push( L, b );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const luaL_Reg SongUtilTable[] =
|
||||||
|
{
|
||||||
|
LIST_METHOD( IsStepsTypePlayable ),
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
LUA_REGISTER_NAMESPACE( SongUtil )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ namespace SongUtil
|
|||||||
void GetAllSongGenres( vector<RString> &vsOut );
|
void GetAllSongGenres( vector<RString> &vsOut );
|
||||||
void FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vector<Song*> &out );
|
void FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vector<Song*> &out );
|
||||||
|
|
||||||
void GetPossibleSteps( const Song *pSong, vector<Steps*> &vOut );
|
void GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut );
|
||||||
|
bool IsStepsTypePlayable( StepsType st );
|
||||||
}
|
}
|
||||||
|
|
||||||
class SongID
|
class SongID
|
||||||
|
|||||||
Reference in New Issue
Block a user