"for( int p=0; p<NUM_PLAYERS; p++ )" -> "FOREACH_PlayerNumber( p )"

This commit is contained in:
Chris Danford
2004-05-24 06:10:11 +00:00
parent 6f75a3d920
commit ba93ee8469
38 changed files with 161 additions and 161 deletions
+3 -3
View File
@@ -422,7 +422,7 @@ void Background::LoadFromSong( const Song* pSong )
m_DangerAll.SetZoomX( fXZoom );
m_DangerAll.SetZoomY( fYZoom );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_DangerPlayer[p].SetXY( (float)LEFT_EDGE, (float)TOP_EDGE );
m_DangerPlayer[p].SetZoomX( fXZoom );
@@ -540,7 +540,7 @@ void Background::Update( float fDeltaTime )
m_DangerAll.Update( fDeltaTime );
}
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( IsDangerPlayerVisible((PlayerNumber)p) )
m_DangerPlayer[p].Update( fDeltaTime );
@@ -591,7 +591,7 @@ void Background::DrawPrimitives()
if( m_pFadingBGA )
m_pFadingBGA->Draw();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( IsDangerPlayerVisible((PlayerNumber)p) )
m_DangerPlayer[p].Draw();
+1 -1
View File
@@ -253,7 +253,7 @@ void BeginnerHelper::DrawPrimitives()
for( int scd=0; scd<NUM_PLAYERS*2; scd++ )
m_sStepCircle[scd].Draw(); // Should be drawn before the dancer, but after the pad, so it is drawn over the pad and under the dancer.
for( int pn=0; pn<NUM_PLAYERS; pn++ ) // Draw each dancer
FOREACH_PlayerNumber( pn ) // Draw each dancer
if( GAMESTATE->IsHumanPlayer(pn) )
m_mDancer[pn].Draw();
+3 -3
View File
@@ -145,7 +145,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta )
a.fSecsRemaining = 10;
a.level = ATTACK_LEVEL_1;
a.sModifier = sPossibleModifiers[a.level][rand()%3];
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->LaunchAttack( (PlayerNumber)p, a );
SCREENMAN->SendMessageToTopScreen( SM_BattleTrickLevel1 );
@@ -157,7 +157,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta )
a.fSecsRemaining = 10;
a.level = ATTACK_LEVEL_2;
a.sModifier = sPossibleModifiers[a.level][rand()%3];
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->LaunchAttack( (PlayerNumber)p, a );
SCREENMAN->SendMessageToTopScreen( SM_BattleTrickLevel2 );
@@ -169,7 +169,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta )
a.fSecsRemaining = 10;
a.level = ATTACK_LEVEL_3;
a.sModifier = sPossibleModifiers[a.level][rand()%3];
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->LaunchAttack( (PlayerNumber)p, a );
SCREENMAN->SendMessageToTopScreen( SM_BattleTrickLevel3 );
+6 -6
View File
@@ -56,7 +56,7 @@ DancingCharacters::DancingCharacters()
memset( m_bHasWinAnim, 0, sizeof(m_bHasWinAnim) );
memset( m_bHasFailAnim, 0, sizeof(m_bHasFailAnim) );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_2DIdleTimer[p].SetZero();
m_i2DAnimState[p] = AS2D_IDLE; // start on idle state
@@ -174,7 +174,7 @@ void DancingCharacters::LoadNextSong()
ASSERT( GAMESTATE->m_pCurSong );
m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->m_fFirstBeat;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
m_Character[p].PlayAnimation( "rest" );
}
@@ -201,7 +201,7 @@ void DancingCharacters::Update( float fDelta )
* at a very low music rate. */
fUpdateScale *= GAMESTATE->m_SongOptions.m_fMusicRate;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsPlayerEnabled(p) )
m_Character[p].Update( fDelta*fUpdateScale );
@@ -212,7 +212,7 @@ void DancingCharacters::Update( float fDelta )
bool bIsHereWeGo = GAMESTATE->m_bPastHereWeGo;
if( !bWasHereWeGo && bIsHereWeGo )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
m_Character[p].PlayAnimation( "warmup" );
}
@@ -224,7 +224,7 @@ void DancingCharacters::Update( float fDelta )
if( fLastBeat < GAMESTATE->m_pCurSong->m_fFirstBeat &&
fThisBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_Character[p].PlayAnimation( "dance" );
}
fLastBeat = fThisBeat;
@@ -267,7 +267,7 @@ void DancingCharacters::Update( float fDelta )
}
// update any 2D stuff
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if(m_bHasIdleAnim[p])
{
+17 -17
View File
@@ -409,7 +409,7 @@ void GameState::SaveCurrentSettingsToProfile( PlayerNumber pn )
void GameState::Update( float fDelta )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_CurrentPlayerOptions[p].Approach( m_PlayerOptions[p], fDelta );
@@ -463,7 +463,7 @@ void GameState::ReloadCharacters()
delete m_pCharacters[i];
m_pCharacters.clear();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_pCurCharacters[p] = NULL;
CStringArray as;
@@ -515,7 +515,7 @@ void GameState::ResetStageStatistics()
{
if( GetStageIndex() == 0 )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
if( pProfile )
@@ -532,7 +532,7 @@ void GameState::ResetStageStatistics()
RemoveAllInventory();
m_fOpponentHealthPercent = 1;
m_fTugLifePercentP1 = 0.5f;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_fSuperMeter[p] = 0;
m_HealthState[p] = ALIVE;
@@ -543,7 +543,7 @@ void GameState::ResetStageStatistics()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_vLastPerDifficultyAwards[p].clear();
m_vLastPeakComboAwards[p].clear();
@@ -722,7 +722,7 @@ int GameState::GetCourseSongIndex() const
{
int iSongIndex = 0;
/* iSongsPlayed includes the current song, so it's 1-based; subtract one. */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( IsPlayerEnabled(p) )
iSongIndex = max( iSongIndex, g_CurStageStats.iSongsPlayed[p]-1 );
return iSongIndex;
@@ -803,7 +803,7 @@ bool GameState::IsPlayerEnabled( PlayerNumber pn ) const
int GameState::GetNumPlayersEnabled() const
{
int count = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( IsPlayerEnabled(p) )
count++;
return count;
@@ -838,7 +838,7 @@ bool GameState::IsHumanPlayer( PlayerNumber pn ) const
int GameState::GetNumHumanPlayers() const
{
int count = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( IsHumanPlayer(p) )
count++;
return count;
@@ -846,7 +846,7 @@ int GameState::GetNumHumanPlayers() const
PlayerNumber GameState::GetFirstHumanPlayer() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( IsHumanPlayer(p) )
return (PlayerNumber)p;
ASSERT(0); // there must be at least 1 human player
@@ -860,7 +860,7 @@ bool GameState::IsCpuPlayer( PlayerNumber pn ) const
bool GameState::AnyPlayersAreCpu() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( IsCpuPlayer(p) )
return true;
return false;
@@ -904,7 +904,7 @@ bool GameState::HasEarnedExtraStage() const
if( (this->IsFinalStage() || this->IsExtraStage()) )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !this->IsPlayerEnabled(p) )
continue; // skip
@@ -1033,7 +1033,7 @@ void GameState::StoreSelectedOptions()
* at the end of gameplay to restore options. */
void GameState::RestoreSelectedOptions()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
this->m_PlayerOptions[p] = this->m_StoredPlayerOptions[p];
m_SongOptions = m_StoredSongOptions;
}
@@ -1178,7 +1178,7 @@ void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn, AttackLevel al )
void GameState::RemoveAllInventory()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
{
m_Inventory[p][s].fSecsRemaining = 0;
@@ -1214,7 +1214,7 @@ void GameState::RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn )
void GameState::RemoveAllActiveAttacks() // called on end of song
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
RemoveActiveAttacksForPlayer( (PlayerNumber)p );
}
@@ -1591,7 +1591,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
bool GameState::AllAreInDangerOrWorse() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( this->IsPlayerEnabled(p) )
if( m_HealthState[p] < DANGER )
return false;
@@ -1600,7 +1600,7 @@ bool GameState::AllAreInDangerOrWorse() const
bool GameState::AllAreDead() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( this->IsPlayerEnabled(p) )
if( m_HealthState[p] < DEAD )
return false;
@@ -1609,7 +1609,7 @@ bool GameState::AllAreDead() const
bool GameState::OneIsHot() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( this->IsPlayerEnabled(PlayerNumber(p)) )
if( m_HealthState[p] == HOT )
return true;
+3 -3
View File
@@ -78,7 +78,7 @@ GrooveRadar::GrooveRadarValueMap::GrooveRadarValueMap()
m_sprRadarBase.Load( THEME->GetPathToG("GrooveRadar base") );
this->AddChild( &m_sprRadarBase );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_bValuesVisible[p] = false;
m_PercentTowardNew[p] = 0;
@@ -123,7 +123,7 @@ void GrooveRadar::GrooveRadarValueMap::Update( float fDeltaTime )
if(DISABLE_RADAR != 1)
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_PercentTowardNew[p] = min( m_PercentTowardNew[p]+4.0f*fDeltaTime, 1 );
}
@@ -143,7 +143,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
DISPLAY->SetTextureModeModulate();
RageSpriteVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !m_bValuesVisible[p] )
continue;
+1 -1
View File
@@ -23,7 +23,7 @@ InputQueue* INPUTQUEUE = NULL; // global and accessable from anywhere in our pro
InputQueue::InputQueue()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_aQueue[p].insert(m_aQueue[p].begin(), MAX_INPUT_QUEUE_LENGTH, GameButtonAndTime() );
}
+5 -5
View File
@@ -28,7 +28,7 @@ MemoryCardManager::MemoryCardManager()
{
m_pDriver = MakeMemoryCardDriver();
m_bCardsLocked = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_bTooLate[p] = false;
m_bWriteError[p] = false;
@@ -89,7 +89,7 @@ void MemoryCardManager::Update( float fDelta )
// unassign cards that were disconnected
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_Device[p].IsBlank() ) // not assigned a card
continue;
@@ -158,7 +158,7 @@ void MemoryCardManager::LockCards( bool bLock )
if( !bLock )
{
// clear too late flag
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_bTooLate[p] = false;
}
}
@@ -172,7 +172,7 @@ void MemoryCardManager::AssignUnassignedCards()
// remove cards that are already assigned
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_Device[p].IsBlank() ) // no card assigned to this player
continue;
@@ -185,7 +185,7 @@ void MemoryCardManager::AssignUnassignedCards()
// try to assign each device to a player
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
LOG->Trace( "Looking for a card for Player %d", p+1 );
+3 -3
View File
@@ -38,7 +38,7 @@ bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 );
bool ModeChoice::DescribesCurrentModeForAllPlayers() const
{
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
if( !DescribesCurrentMode( (PlayerNumber) pn) )
return false;
@@ -59,7 +59,7 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
if( m_pSteps == NULL && m_dc != DIFFICULTY_INVALID )
{
// Why is this checking for all players?
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
if( GAMESTATE->IsHumanPlayer(pn) && GAMESTATE->m_PreferredDifficulty[pn] != m_dc )
return false;
}
@@ -360,7 +360,7 @@ bool ModeChoice::IsPlayable( CString *why ) const
void ModeChoice::ApplyToAllPlayers() const
{
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
if( GAMESTATE->IsHumanPlayer(pn) )
Apply((PlayerNumber) pn);
+2 -2
View File
@@ -161,7 +161,7 @@ void MusicWheel::Load()
po,
so );
GAMESTATE->m_pCurSong = pSong;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
@@ -947,7 +947,7 @@ void MusicWheel::Update( float fDeltaTime )
}
if( dc != DIFFICULTY_INVALID )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
GAMESTATE->m_PreferredDifficulty[p] = dc;
}
+3 -3
View File
@@ -90,7 +90,7 @@ MusicWheelItem::MusicWheelItem()
m_textRoulette.SetXY( ROULETTE_X, 0 );
m_All.AddChild( &m_textRoulette );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_GradeDisplay[p].Load( THEME->GetPathToG("MusicWheelItem grades") );
m_GradeDisplay[p].SetZoom( 1.0f );
@@ -193,7 +193,7 @@ void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID )
void MusicWheelItem::RefreshGrades()
{
// Refresh Grades
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !data->m_pSong || // this isn't a song display
!GAMESTATE->IsHumanPlayer(p) )
@@ -240,7 +240,7 @@ void MusicWheelItem::Update( float fDeltaTime )
m_sprSongBar.Update( fDeltaTime );
m_WheelNotifyIcon.Update( fDeltaTime );
m_TextBanner.Update( fDeltaTime );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_GradeDisplay[p].Update( fDeltaTime );
}
break;
+3 -3
View File
@@ -290,7 +290,7 @@ void PrefsManager::Init()
m_bLogCheckpoints = false;
m_bShowLoadingWindow = true;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iMemoryCardUsbBus[p] = -1;
m_iMemoryCardUsbPort[p] = -1;
@@ -507,7 +507,7 @@ void PrefsManager::ReadPrefsFromFile( CString sIni )
ini.GetValue( "Options", "DisableScreenSaver", m_bDisableScreenSaver );
ini.GetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
ini.GetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.GetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
@@ -733,7 +733,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "DisableScreenSaver", m_bDisableScreenSaver );
ini.SetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
ini.SetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.SetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
+1 -1
View File
@@ -46,7 +46,7 @@ ProfileManager::ProfileManager()
try
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_bWasLoadedFromMemoryCard[p] = false;
LoadMachineProfile();
+3 -3
View File
@@ -33,7 +33,7 @@ ScreenAward::ScreenAward( CString sName ) : ScreenWithMenuElements( sName )
bool bEitherPlayerHasAward = false;
ZERO( m_bSavedScreenshot );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -145,7 +145,7 @@ void ScreenAward::HandleScreenMessage( const ScreenMessage SM )
case SM_GoToNextScreen:
// TRICKY: Keep looping on this screen until all awards are shown
bool bMoreAwardsLeft = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -166,7 +166,7 @@ void ScreenAward::HandleScreenMessage( const ScreenMessage SM )
void ScreenAward::MenuStart( PlayerNumber pn )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
+2 -2
View File
@@ -274,7 +274,7 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
TICK_EARLY_SECONDS.Refresh();
// set both players to joined so the credit message doesn't show
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_bSideIsJoined[p] = true;
SCREENMAN->RefreshCreditsMessages();
@@ -1251,7 +1251,7 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
case SDLK_F8:
{
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
}
+2 -2
View File
@@ -204,7 +204,7 @@ void ScreenEvaluation::Init()
// Debugging
//
{
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach line
FOREACH_PlayerNumber( p ) // foreach line
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ ) // foreach line
{
stageStats.fRadarPossible[p][r] = 0.5f + r/10.0f;
@@ -1483,7 +1483,7 @@ void ScreenEvaluation::EndScreen()
{
TweenOffScreen();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_Grades[p].SettleImmediately();
GAMESTATE->m_iRoundSeed = rand();
+3 -3
View File
@@ -219,7 +219,7 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber pn )
}
bool bBothSidesJoined = true;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( !GAMESTATE->m_bSideIsJoined[p] )
bBothSidesJoined = false;
@@ -239,7 +239,7 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber pn )
void ScreenEz2SelectPlayer::TweenOnScreen()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
float fOffScreenOffset = float( (p==PLAYER_1) ? -SCREEN_WIDTH/2 : +SCREEN_WIDTH/2 );
@@ -259,7 +259,7 @@ void ScreenEz2SelectPlayer::TweenOnScreen()
void ScreenEz2SelectPlayer::TweenOffScreen()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
float fOffScreenOffset = float( (p==PLAYER_1) ? -SCREEN_WIDTH : +SCREEN_WIDTH );
+3 -3
View File
@@ -95,7 +95,7 @@ bool ScreenJukebox::SetSong( bool bDemonstration )
// Found something we can use!
GAMESTATE->m_pCurSong = pSong;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_pCurNotes[p] = pSteps;
return true; // done looking
@@ -122,7 +122,7 @@ bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return t
{
/* Note that you also need to make sure you benchmark with the
* same notes. I use a copy of MaxU with only heavy notes included. */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
@@ -138,7 +138,7 @@ bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return t
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
}
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
+2 -2
View File
@@ -39,7 +39,7 @@ ScreenJukeboxMenu::ScreenJukeboxMenu( CString sClassName ) : ScreenWithMenuEleme
GAMESTATE->m_CurStyle = STYLE_INVALID;
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
GAMESTATE->m_bSideIsJoined[pn] = true;
m_Selector.SetXY( 0, 0 );
@@ -122,7 +122,7 @@ void ScreenJukeboxMenu::MenuStart( PlayerNumber pn )
GAMESTATE->m_CurStyle = style;
GAMESTATE->m_sPreferredGroup = (sGroup=="ALL MUSIC") ? GROUP_ALL_MUSIC : sGroup;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_PreferredDifficulty[p] = dc;
GAMESTATE->m_bJukeboxUsesModifiers = bModifiers;
+3 -3
View File
@@ -97,7 +97,7 @@ ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer")
this->AddChild(&m_textMessage);
this->AddChild(&m_textStats);
this->AddChild(&m_textTime);
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
this->AddChild(&m_textCredits[p]);
@@ -150,7 +150,7 @@ void ScreenSystemLayer::ReloadCreditsText()
m_textTime.SetName( "Time" );
SET_XY_AND_ON_COMMAND( m_textTime );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_textCredits[p].LoadFromFont( THEME->GetPathToF("ScreenManager credits") );
m_textCredits[p].SetName( ssprintf("CreditsP%d",p+1) );
@@ -185,7 +185,7 @@ void ScreenSystemLayer::SystemMessageNoAnimate( CString sMessage )
void ScreenSystemLayer::RefreshCreditsMessages()
{
// update joined
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
CString sCredits;
+4 -4
View File
@@ -129,7 +129,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
// reset Player and Song Options
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_PlayerOptions[p] = PlayerOptions();
GAMESTATE->m_SongOptions = SongOptions();
}
@@ -274,7 +274,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
bool ScreenNameEntry::AnyStillEntering() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( m_bStillEnteringName[p] )
return true;
return false;
@@ -308,7 +308,7 @@ void ScreenNameEntry::DrawPrimitives()
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !m_bStillEnteringName[p] )
continue; // don't draw scrolling arrows
@@ -387,7 +387,7 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
case SM_MenuTimer:
if( !m_Out.IsTransitioning() )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
this->MenuStart( (PlayerNumber)p );
}
break;
+2 -2
View File
@@ -463,7 +463,7 @@ void ScreenNameEntryTraditional::PositionCharsAndCursor( int pn )
bool ScreenNameEntryTraditional::AnyStillEntering() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( m_bStillEnteringName[p] )
return true;
return false;
@@ -548,7 +548,7 @@ void ScreenNameEntryTraditional::HandleScreenMessage( const ScreenMessage SM )
case SM_MenuTimer:
if( !m_Out.IsTransitioning() )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
Finish( (PlayerNumber)p );
MenuStart( PLAYER_INVALID, IET_FIRST_PRESS );
}
+26 -26
View File
@@ -109,7 +109,7 @@ ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sCla
this->AddChild( &m_framePage );
m_bMoreShown = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iCurrentRow[p] = 0;
m_bWasOnExit[p] = false;
@@ -141,7 +141,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
RageException::Throw( "Screen %s menu entry \"%s\" has no choices",
m_sName.c_str(), OptionRows[r].name.c_str() );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
vector<bool> &vbSelected = Row.m_vbSelected[p];
vbSelected.resize( Row.m_RowDef.choices.size() );
@@ -168,7 +168,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
Row.m_vbSelected[p] = m_Rows[r]->m_vbSelected[0];
CHECKPOINT_M( ssprintf("row %i: %s", r, Row.m_RowDef.name.c_str()) );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( m_OptionsNavigation==NAV_FIRST_CHOICE_GOES_DOWN )
Row.m_iChoiceWithFocus[p] = 0; // focus on the first row, which is "go down"
else
@@ -197,7 +197,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
// init line highlights
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -212,7 +212,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
// init highlights
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -224,7 +224,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
// init row icons
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -271,7 +271,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
bt->SetX( fX );
// init underlines
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -292,7 +292,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
for( unsigned j=0; j<textItems.size(); j++ ) // for each option on this row
delete textItems[j];
textItems.clear();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
for( unsigned j=0; j<row.m_Underline[p].size(); j++ ) // for each option on this row
delete row.m_Underline[p][j];
@@ -354,7 +354,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
{
for( unsigned c=0; c<textItems.size(); c++ )
m_framePage.AddChild( textItems[c] );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
for( unsigned c=0; c<row.m_Underline[p].size(); c++ )
m_framePage.AddChild( row.m_Underline[p][c] );
}
@@ -383,7 +383,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
// add explanation here so it appears on top
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_textExplanation[p].LoadFromFont( THEME->GetPathToF("ScreenOptions explanation") );
m_textExplanation[p].SetZoom( EXPLANATION_ZOOM );
@@ -396,7 +396,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
* the player name is meaningful. Otherwise, we're probably in the system menu. */
if( GAMESTATE->m_CurStyle != STYLE_INVALID )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_textPlayerName[p].LoadFromFont( THEME->GetPathToF( "ScreenOptions player") );
m_textPlayerName[p].SetName( ssprintf("PlayerNameP%i",p+1) );
@@ -411,7 +411,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
m_ScrollBar.SetName( "DualScrollBar", "ScrollBar" );
m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
m_ScrollBar.SetBarTime( SCROLL_BAR_TIME );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_ScrollBar.EnablePlayer( (PlayerNumber)p, GAMESTATE->IsHumanPlayer(p) );
m_ScrollBar.Load();
UtilSetXY( m_ScrollBar, "ScreenOptions" );
@@ -428,7 +428,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
{
case INPUTMODE_INDIVIDUAL:
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_textExplanation[p].SetXY( EXPLANATION_X(p), EXPLANATION_Y(p) );
}
break;
@@ -439,7 +439,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
ASSERT(0);
}
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_sprDisqualify[p].Load( THEME->GetPathToG( "ScreenOptions disqualify") );
m_sprDisqualify[p]->SetName( "ScreenOptions", ssprintf("DisqualifyP%i",p+1) );
@@ -470,7 +470,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
PositionCursors();
UpdateEnabledDisabled();
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
OnChange( (PlayerNumber)p );
}
@@ -487,7 +487,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
for( unsigned c=0; c<row.m_textItems.size(); c++ )
row.m_textItems[c]->FinishTweening();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
for( unsigned c=0; c<row.m_Underline[p].size(); c++ )
row.m_Underline[p][c]->FinishTweening();
@@ -642,7 +642,7 @@ void ScreenOptions::PositionUnderlines()
if( row.Type == Row::ROW_EXIT )
continue;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -686,7 +686,7 @@ void ScreenOptions::PositionUnderlines()
void ScreenOptions::PositionIcons()
{
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
FOREACH_PlayerNumber( p ) // foreach player
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -728,7 +728,7 @@ void ScreenOptions::PositionCursors()
{
// Set the position of the highlight showing the current option the user is changing.
// Set the position of the underscores showing the current choice for each option line.
for( int pn=0; pn<NUM_PLAYERS; pn++ ) // foreach player
FOREACH_PlayerNumber( pn ) // foreach player
{
if( !GAMESTATE->IsHumanPlayer(pn) )
continue;
@@ -811,7 +811,7 @@ void ScreenOptions::UpdateEnabledDisabled()
Row &row = *m_Rows[i];
bool bThisRowIsSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == (int) i )
bThisRowIsSelected = true;
@@ -843,7 +843,7 @@ void ScreenOptions::UpdateEnabledDisabled()
if( row.Type == Row::ROW_EXIT )
{
bool bExitRowIsSelectedByBoth = true;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != (int) i )
bExitRowIsSelectedByBoth = false;
@@ -1078,7 +1078,7 @@ void ScreenOptions::OnChange( PlayerNumber pn )
}
/* Update all players, since changing one player can move both cursors. */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsHumanPlayer(p) )
TweenCursor( (PlayerNumber) p );
@@ -1180,7 +1180,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
if( row.Type == Row::ROW_EXIT )
{
bool bAllOnExit = true;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) && m_Rows[m_iCurrentRow[p]]->Type != Row::ROW_EXIT )
bAllOnExit = false;
@@ -1308,7 +1308,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
row.m_iChoiceWithFocus[p] = iNewChoiceWithFocus;
}
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_OptionsNavigation==NAV_FIRST_CHOICE_GOES_DOWN )
{
@@ -1363,7 +1363,7 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
LOG->Trace("move pn %i, dir %i, rep %i", pn, dir, Repeat);
bool changed = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_InputMode == INPUTMODE_INDIVIDUAL && p != pn )
continue; // skip
@@ -1404,7 +1404,7 @@ ScreenOptions::Row::~Row()
{
for( unsigned i = 0; i < m_textItems.size(); ++i )
delete m_textItems[i];
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
for( unsigned i = 0; i < m_Underline[p].size(); ++i )
delete m_Underline[p][i];
}
+4 -4
View File
@@ -229,7 +229,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
Explanations = true;
if( Flags[i] == "forceallplayers" )
{
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
GAMESTATE->m_bSideIsJoined[pn] = true;
GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
}
@@ -410,7 +410,7 @@ void ScreenOptionsMaster::ImportOptions()
}
else
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -506,7 +506,7 @@ void ScreenOptionsMaster::ExportOptions()
const OptionRowData &data = m_OptionRowAlloc[i];
Row &row = *m_Rows[i];
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -587,7 +587,7 @@ void ScreenOptionsMaster::GoToPrevState()
void ScreenOptionsMaster::RefreshIcons()
{
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
FOREACH_PlayerNumber( p ) // foreach player
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
+2 -2
View File
@@ -176,7 +176,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
// save current player options
PlayerOptions po[2];
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
po[p] = GAMESTATE->m_PlayerOptions[p];
}
@@ -186,7 +186,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
ScreenOptionsMaster::ExportOptions();
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
bool bIsHandicap = GAMESTATE->IsDisqualified((PlayerNumber)p);
+2 -2
View File
@@ -186,7 +186,7 @@ void ScreenSelect::FinalizeChoices()
* invalidate the choice we've already made. Hack: apply the style.
* (Applying the style may have other side-effects, so it'll be re-applied
* in SM_GoToNextScreen.) */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
{
const int sel = GetSelectionIndex( (PlayerNumber)p );
@@ -217,7 +217,7 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
/* Apply here, not in SM_AllDoneChoosing, because applying can take a very
* long time (200+ms), and at SM_AllDoneChoosing, we're still tweening stuff
* off-screen. */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
m_aModeChoices[this->GetSelectionIndex((PlayerNumber)p)].Apply( (PlayerNumber)p );
+2 -2
View File
@@ -364,7 +364,7 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn )
if( AllAreFinishedChoosing() )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
vector<Character*> apCharacters;
GAMESTATE->GetCharacters( apCharacters );
@@ -385,7 +385,7 @@ void ScreenSelectCharacter::MenuBack( PlayerNumber pn )
void ScreenSelectCharacter::TweenOffScreen()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_sprCard[p].Command( CARD_OFF_COMMAND(p) );
m_sprTitle[p].Command( TITLE_OFF_COMMAND(p) );
+5 -5
View File
@@ -101,7 +101,7 @@ ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : ScreenWithMenuEle
m_MusicWheel.SetXY( WHEEL_X, WHEEL_Y );
this->AddChild( &m_MusicWheel );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
continue; // skip
@@ -173,7 +173,7 @@ void ScreenSelectCourse::TweenOnScreen()
m_textNumSongs.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
m_textTime.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
m_CourseContentsFrame.Command( "ZoomY,0;BounceEnd,0.5;ZoomY,1" );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_sprHighScoreFrame[p].Command( "AddX,640;BounceEnd,0.5;AddX,-640" );
m_HighScore[p].Command( "AddX,640;BounceEnd,0.5;AddX,-640" );
@@ -189,7 +189,7 @@ void ScreenSelectCourse::TweenOffScreen()
m_textNumSongs.Command( "BounceBegin,0.5;AddX,-640" );
m_textTime.Command( "BounceBegin,0.5;AddX,-640" );
m_CourseContentsFrame.Command( "Linear,0.5;ZoomY,0" );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_sprHighScoreFrame[p].Command( "BounceBegin,0.5;AddX,640" );
m_HighScore[p].Command( "BounceBegin,0.5;AddX,640" );
@@ -400,7 +400,7 @@ void ScreenSelectCourse::AfterCourseChange()
m_CourseContentsFrame.TweenInAfterChangedCourse();
ASSERT(pCourse);
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
CourseDifficulty cd = GAMESTATE->m_PreferredCourseDifficulty[p];
@@ -461,7 +461,7 @@ void ScreenSelectCourse::AfterCourseChange()
void ScreenSelectCourse::UpdateOptionsDisplays()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
+5 -5
View File
@@ -182,7 +182,7 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
// I'm not sure why this was here -- but there seem no ill effects
// of it's removal.
//
//for( int p=0; p<NUM_PLAYERS; p++ )
//FOREACH_PlayerNumber( p )
// if( GAMESTATE->IsHumanPlayer(p) )
// {
// MenuRight( (PlayerNumber)p );
@@ -212,7 +212,7 @@ void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
return;
bool AnotherPlayerSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( p != pn && m_bChosen[p] )
AnotherPlayerSelected = true;
@@ -248,7 +248,7 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
return;
bool AnotherPlayerSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( p != pn && m_bChosen[p] )
AnotherPlayerSelected = true;
@@ -335,7 +335,7 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
{
bool bAnyChanged = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -536,7 +536,7 @@ void ScreenSelectDifficulty::TweenOffScreen()
OFF_COMMAND( m_sprExplanation[page] );
OFF_COMMAND( m_sprMore[page] );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
+4 -4
View File
@@ -189,7 +189,7 @@ int ScreenSelectDifficultyEX::GetSelectionIndex( PlayerNumber pn )
void ScreenSelectDifficultyEX::UpdateSelectableChoices()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
/* XXX: If a player joins during the tween-in, this diffuse change
* will be undone by the tween. Hmm. */
@@ -243,7 +243,7 @@ bool ScreenSelectDifficultyEX::IsACourse( int mIndex )
void ScreenSelectDifficultyEX::SetAllPlayersSelection( int iChoice, bool bSwitchingModes )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iChoice[p] = iChoice;
if( bSwitchingModes && ANIMATE_MODE_SWITCH )
@@ -279,7 +279,7 @@ void ScreenSelectDifficultyEX::SetAllPlayersSelection( int iChoice, bool bSwitch
void ScreenSelectDifficultyEX::Change( PlayerNumber pn, int iNewChoice )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) ) { continue; }
if( p!=pn && m_CurrentPage==PAGE_1 ) { continue; }
@@ -454,7 +454,7 @@ void ScreenSelectDifficultyEX::TweenOnScreen()
void ScreenSelectDifficultyEX::TweenOffScreen()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) ) { continue; }
+15 -15
View File
@@ -290,7 +290,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
@@ -306,7 +306,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PostSwitchPage" );
}
@@ -340,7 +340,7 @@ void ScreenSelectMaster::UpdateSelectableChoices()
for( int i=0; i<NUM_ICON_PARTS; i++ )
COMMAND( m_sprIcon[i][c], m_aModeChoices[c].IsPlayable()? "Enabled":"Disabled" );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
@@ -419,7 +419,7 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
COMMAND( m_sprCursor[i][p], "PreSwitchPage" );
}
@@ -438,7 +438,7 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PreSwitchPage" );
}
@@ -480,7 +480,7 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, int iNewChoice )
bool bMoveAll = SHARED_PREVIEW_AND_CURSOR || GetCurrentPage()!=PAGE_1;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
const int iOldChoice = m_iChoice[p];
@@ -609,7 +609,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
if( SHARED_PREVIEW_AND_CURSOR || GetCurrentPage() == PAGE_2 )
{
/* Only one player has to pick. Choose this for all the other players, too. */
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
{
ASSERT( !m_bChosen[p] );
@@ -620,7 +620,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
{
fSecs = max( fSecs, DoMenuStart(pn) );
// check to see if everyone has chosen
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
bAllDone &= m_bChosen[p];
}
@@ -664,7 +664,7 @@ void ScreenSelectMaster::TweenOnScreen()
}
else
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
{
@@ -687,7 +687,7 @@ void ScreenSelectMaster::TweenOnScreen()
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
@@ -705,7 +705,7 @@ void ScreenSelectMaster::TweenOnScreen()
COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" );
}
else
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
@@ -731,7 +731,7 @@ void ScreenSelectMaster::TweenOffScreen()
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
OFF_COMMAND( m_sprCursor[i][p] );
}
@@ -748,7 +748,7 @@ void ScreenSelectMaster::TweenOffScreen()
SelectedByEitherPlayer = true;
}
else
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) && m_iChoice[p] == (int)c )
SelectedByEitherPlayer = true;
@@ -770,7 +770,7 @@ void ScreenSelectMaster::TweenOffScreen()
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
OFF_COMMAND( m_sprPreview[i][c][p] );
@@ -784,7 +784,7 @@ void ScreenSelectMaster::TweenOffScreen()
if( SHARED_PREVIEW_AND_CURSOR )
OFF_COMMAND( m_Scroller[0] );
else
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
OFF_COMMAND( m_Scroller[p] );
}
+8 -8
View File
@@ -478,7 +478,7 @@ void ScreenSelectMusic::SkipSongPartTweens()
if( SHOW_DIFFICULTY_LIST )
m_DifficultyList.FinishTweening();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -537,7 +537,7 @@ void ScreenSelectMusic::TweenOnScreen()
ON_COMMAND( m_MachineRank );
ON_COMMAND( m_Overlay );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -594,7 +594,7 @@ void ScreenSelectMusic::TweenOffScreen()
OFF_COMMAND( m_MachineRank );
OFF_COMMAND( m_Overlay );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -647,7 +647,7 @@ void ScreenSelectMusic::SwitchDisplayMode( DisplayMode dm )
void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
@@ -1068,7 +1068,7 @@ void ScreenSelectMusic::MenuStart( PlayerNumber pn )
case TYPE_SONG: {
const bool bIsNew = PROFILEMAN->IsSongNew( m_MusicWheel.GetSelectedSong() );
bool bIsHard = false;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer( (PlayerNumber)p ) )
continue; // skip
@@ -1231,7 +1231,7 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
void ScreenSelectMusic::SwitchToPreferredDifficulty()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer( PlayerNumber(p) ) )
continue;
@@ -1318,7 +1318,7 @@ void ScreenSelectMusic::AfterMusicChange()
case TYPE_SORT:
{
CString sGroup = m_MusicWheel.GetSelectedSection();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_iSelection[p] = -1;
m_BPMDisplay.NoBPM();
@@ -1573,7 +1573,7 @@ void ScreenSelectMusic::UpdateOptionsDisplays()
// m_PlayerOptionIcons.Refresh();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
+1 -1
View File
@@ -349,7 +349,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
if( m_Choice == 0 )
{
// apply default options
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
}
+2 -2
View File
@@ -60,7 +60,7 @@ ScreenWithMenuElements::ScreenWithMenuElements( CString sClassName ) : Screen( s
if( MEMORY_CARD_ICONS )
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_MemoryCardDisplay[p].Load( (PlayerNumber)p );
m_MemoryCardDisplay[p].SetName( ssprintf("MemoryCardDisplayP%d",p+1) );
@@ -139,7 +139,7 @@ void ScreenWithMenuElements::StartTransitioning( ScreenMessage smSendWhenDone )
UtilOffCommand( m_autoHeader, m_sName );
UtilOffCommand( m_sprStyleIcon, m_sName );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
UtilOffCommand( m_MemoryCardDisplay[p], m_sName );
UtilOffCommand( m_autoFooter, m_sName );
UtilOffCommand( m_textHelp, m_sName );
+1 -1
View File
@@ -33,7 +33,7 @@ SongCreditDisplay::SongCreditDisplay()
// use a vector and not a set so that ordering is maintained
vector<Steps*> vpStepsToShow;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
+6 -6
View File
@@ -29,7 +29,7 @@ StageStats::StageStats()
StageType = STAGE_INVALID;
fGameplaySeconds = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
pSteps[p] = NULL;
iMeter[p] = 0;
@@ -64,7 +64,7 @@ void StageStats::AddStats( const StageStats& other )
fGameplaySeconds += other.fGameplaySeconds;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
pSteps[p] = NULL;
iMeter[p] += other.iMeter[p] * iLengthMultiplier;
@@ -224,7 +224,7 @@ Grade StageStats::GetGrade( PlayerNumber pn ) const
bool StageStats::OnePassed() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) && !bFailed[p] )
return true;
return false;
@@ -232,7 +232,7 @@ bool StageStats::OnePassed() const
bool StageStats::AllFailed() const
{
for( int pn=0; pn<NUM_PLAYERS; pn++ )
FOREACH_PlayerNumber( pn )
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(pn)) )
if( !bFailed[pn] )
return false;
@@ -241,7 +241,7 @@ bool StageStats::AllFailed() const
bool StageStats::AllFailedEarlier() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) && !bFailedEarlier[p] )
return false;
return true;
@@ -525,7 +525,7 @@ Grade GetBestFinalGrade()
vector<Song*> vSongs;
StageStats stats;
GAMESTATE->GetFinalEvalStatsAndSongs( stats, vSongs );
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) )
top_grade = min( top_grade, stats.GetGrade((PlayerNumber)p) );
return top_grade;
+2 -2
View File
@@ -201,7 +201,7 @@ void ResetGame( bool ReturnToFirstScreen )
/*
GameState::Reset() will switch the NoteSkin
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
PlayerNumber pn = (PlayerNumber)p;
if( !NOTESKIN->DoesNoteSkinExist( NOTESKIN->GetCurNoteSkinName(pn) ) )
@@ -1300,7 +1300,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
// so we don't have to play through a whole song to get new output.
BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineProfile();
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) )
PROFILEMAN->SaveProfile( (PlayerNumber)p );
SCREENMAN->SystemMessage( "Stats saved" );
+1 -1
View File
@@ -47,7 +47,7 @@ StyleInput StyleDef::GameInputToStyleInput( const GameInput &GameI ) const
{
StyleInput SI;
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
for( int t=0; t<m_iColsPerPlayer; t++ )
{