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

This commit is contained in:
Chris Danford
2004-05-24 08:16:17 +00:00
parent b05d25ab24
commit a9db266eb2
14 changed files with 130 additions and 181 deletions
+3 -5
View File
@@ -50,22 +50,20 @@ Background::Background()
BLINK_DANGER_ALL.Refresh();
DANGER_ALL_IS_OPAQUE.Refresh();
int p;
m_iCurBGChangeIndex = -1;
m_pCurrentBGA = NULL;
m_pFadingBGA = NULL;
m_fSecsLeftInFade = 0;
m_DangerAll.LoadFromAniDir( THEME->GetPathToB("ScreenGameplay danger all") );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_DangerPlayer[p].LoadFromAniDir( THEME->GetPathToB(ssprintf("ScreenGameplay danger p%d",p+1)) );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_DeadPlayer[p].LoadFromAniDir( THEME->GetPathToB(ssprintf("ScreenGameplay dead p%d",p+1)) );
bool bOneOrMoreChars = false;
bool bShowingBeginnerHelper = false;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
+2 -3
View File
@@ -25,8 +25,7 @@ CombinedLifeMeterTug::CombinedLifeMeterTug()
{
METER_WIDTH.Refresh();
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
CString sStreamPath = THEME->GetPathToG(ssprintf("CombinedLifeMeterTug stream p%d",p+1));
CString sTipPath = THEME->GetPathToG(ssprintf("CombinedLifeMeterTug tip p%d",p+1));
@@ -42,7 +41,7 @@ CombinedLifeMeterTug::CombinedLifeMeterTug()
this->AddChild( &m_sprFrame );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
Character* pCharacter = GAMESTATE->m_pCurCharacters[p];
ASSERT( pCharacter );
+17 -21
View File
@@ -337,37 +337,33 @@ void DancingCharacters::DrawPrimitives()
m_LookAt,
RageVector3(0,1,0) );
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_EnabledPlayer( p )
{
if( GAMESTATE->IsPlayerEnabled(p) )
{
bool bFailed = g_CurStageStats.bFailed[p];
bool bDanger = m_bDrawDangerLight;
bool bFailed = g_CurStageStats.bFailed[p];
bool bDanger = m_bDrawDangerLight;
DISPLAY->SetLighting( true );
RageColor ambient = bFailed ? RageColor(0.2f,0.1f,0.1f,1) : (bDanger ? RageColor(0.4f,0.1f,0.1f,1) : RageColor(0.4f,0.4f,0.4f,1));
RageColor diffuse = bFailed ? RageColor(0.4f,0.1f,0.1f,1) : (bDanger ? RageColor(0.8f,0.1f,0.1f,1) : RageColor(0.8f,0.8f,0.8f,1));
RageColor specular = RageColor(0.8f,0.8f,0.8f,1);
DISPLAY->SetLighting( true );
RageColor ambient = bFailed ? RageColor(0.2f,0.1f,0.1f,1) : (bDanger ? RageColor(0.4f,0.1f,0.1f,1) : RageColor(0.4f,0.4f,0.4f,1));
RageColor diffuse = bFailed ? RageColor(0.4f,0.1f,0.1f,1) : (bDanger ? RageColor(0.8f,0.1f,0.1f,1) : RageColor(0.8f,0.8f,0.8f,1));
RageColor specular = RageColor(0.8f,0.8f,0.8f,1);
DISPLAY->SetLightDirectional(
0,
ambient,
diffuse,
specular,
RageVector3(+1, 0, +1) );
DISPLAY->SetLightDirectional(
0,
ambient,
diffuse,
specular,
RageVector3(+1, 0, +1) );
m_Character[p].Draw();
m_Character[p].Draw();
DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false );
}
DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false );
}
DISPLAY->CameraPopMatrix();
// now draw any potential 2D stuff
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if(m_bHasIdleAnim[p] && m_i2DAnimState[p] == AS2D_IDLE)
m_bgIdle[p].Draw();
+4 -6
View File
@@ -113,18 +113,16 @@ void GameState::Reset()
ASSERT( THEME );
int p;
m_timeGameStarted.SetZero();
m_CurStyle = STYLE_INVALID;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_bSideIsJoined[p] = false;
m_bPlayersFinalized = false;
// m_iCoins = 0; // don't reset coin count!
m_MasterPlayerNumber = PLAYER_INVALID;
m_sPreferredGroup = GROUP_ALL_MUSIC;
m_bChangedFailType = false;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_PreferredDifficulty[p] = DIFFICULTY_INVALID;
m_PreferredCourseDifficulty[p] = COURSE_DIFFICULTY_REGULAR;
@@ -154,7 +152,7 @@ void GameState::Reset()
SAFE_DELETE( m_pPosition );
m_pPosition = new NoteFieldPositioning("Positioning.ini");
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_bAttackBeganThisUpdate[p] = false;
ResetMusicStatistics();
@@ -165,7 +163,7 @@ void GameState::Reset()
g_vPlayedStageStats.clear();
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_CurrentPlayerOptions[p].Init();
m_PlayerOptions[p].Init();
+1 -2
View File
@@ -291,8 +291,7 @@ void MusicWheelItem::DrawPrimitives()
case TYPE_SONG:
m_TextBanner.Draw();
m_WheelNotifyIcon.Draw();
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_GradeDisplay[p].Draw();
break;
case TYPE_COURSE:
+4 -6
View File
@@ -1123,13 +1123,11 @@ void ScreenEvaluation::CommitScores(
void ScreenEvaluation::TweenOffScreen()
{
int p;
// large banner area
OFF_COMMAND( m_LargeBanner );
OFF_COMMAND( m_sprLargeBannerFrame );
OFF_COMMAND( m_sprStage );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
@@ -1148,7 +1146,7 @@ void ScreenEvaluation::TweenOffScreen()
// grade area
if( SHOW_GRADE_AREA )
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
@@ -1160,7 +1158,7 @@ void ScreenEvaluation::TweenOffScreen()
if( SHOW_GRAPH_AREA )
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
@@ -1172,7 +1170,7 @@ void ScreenEvaluation::TweenOffScreen()
if( SHOW_COMBO_AREA )
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
+2 -3
View File
@@ -50,8 +50,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer( CString sName ) : ScreenWithMenuEl
{
// Unjoin the players, then let them join back in on this screen
// GAMESTATE->m_bPlayersCanJoin = true;
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
GAMESTATE->m_bSideIsJoined[p] = false;
LOG->Trace( "ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()" );
@@ -59,7 +58,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer( CString sName ) : ScreenWithMenuEl
m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenEz2SelectPlayer background") );
this->AddChild( &m_Background ); // animated background =)
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_sprJoinFrame[p].Load( THEME->GetPathToG("ScreenEz2SelectPlayer join frame 1x2") );
m_sprJoinFrame[p].StopAnimating();
+2 -4
View File
@@ -134,12 +134,10 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
GAMESTATE->m_SongOptions = SongOptions();
}
int p;
vector<GameState::RankingFeat> aFeats[NUM_PLAYERS];
// Find out if players deserve to enter their name
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
GAMESTATE->GetRankingFeats( (PlayerNumber)p, aFeats[p] );
m_bStillEnteringName[p] = aFeats[p].size()>0;
@@ -169,7 +167,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenNameEntry background") );
this->AddChild( &m_Background );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
// load last used ranking name if any
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
+3 -3
View File
@@ -91,7 +91,7 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithM
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iSelectedCharacter[p] = 0;
if( GAMESTATE->IsHumanPlayer(p) )
@@ -99,7 +99,7 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithM
}
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
@@ -155,7 +155,7 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithM
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectCharacter music") );
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
+30 -46
View File
@@ -39,8 +39,8 @@
ScreenSelectDifficulty::ScreenSelectDifficulty( CString sClassName ) : ScreenSelect( sClassName )
{
m_CurrentPage = PAGE_1;
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iChoiceOnPage[p] = 0;
m_bChosen[p] = false;
@@ -84,7 +84,7 @@ ScreenSelectDifficulty::ScreenSelectDifficulty( CString sClassName ) : ScreenSel
}
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
CLAMP( m_iChoiceOnPage[p], 0, (int)m_ModeChoices[0].size()-1 );
m_bChosen[p] = false;
@@ -182,11 +182,10 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
// I'm not sure why this was here -- but there seem no ill effects
// of it's removal.
//
//FOREACH_PlayerNumber( p )
// if( GAMESTATE->IsHumanPlayer(p) )
//FOREACH_HumanPlayer( p )
// {
// MenuRight( (PlayerNumber)p );
// MenuLeft( (PlayerNumber)p );
// MenuRight( p );
// MenuLeft( p );
// }
}
@@ -281,11 +280,9 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
void ScreenSelectDifficulty::ChangePage( Page newPage )
{
int p;
// If anyone has already chosen, don't allow changing of pages
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
FOREACH_HumanPlayer( p )
if( m_bChosen[p] )
return;
bool bPageIncreasing = newPage > m_CurrentPage;
@@ -321,8 +318,8 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
}
// change both players
for( p=0; p<NUM_PLAYERS; p++ )
ChangeWithinPage( (PlayerNumber)p, iSwitchToIndex, true );
FOREACH_PlayerNumber( p )
ChangeWithinPage( p, iSwitchToIndex, true );
m_soundChange.Play();
@@ -335,11 +332,8 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
{
bool bAnyChanged = false;
FOREACH_PlayerNumber( p )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
if( p!=pn && m_CurrentPage==PAGE_1 )
continue; // skip
if( m_iChoiceOnPage[p] == iNewChoice )
@@ -348,8 +342,8 @@ bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice,
bAnyChanged = true;
m_iChoiceOnPage[p] = iNewChoice;
float fCursorX = GetCursorX( (PlayerNumber)p );
float fCursorY = GetCursorY( (PlayerNumber)p );
float fCursorX = GetCursorX( p );
float fCursorY = GetCursorY( p );
m_sprCursor[p].StopTweening();
m_sprCursor[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE );
@@ -386,28 +380,26 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
SCREENMAN->PlayStartSound();
}
int p;
// courses should be selected for both players at all times
if( BothPlayersModeChoice(mc) )
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
if( m_bChosen[p] || p == pn )
continue;
// move all cursors to the oni/nonstop selection so it graphically looks as if all players selected the same option.
ChangeWithinPage( (PlayerNumber)p, m_iChoiceOnPage[pn], false );
ChangeWithinPage( p, m_iChoiceOnPage[pn], false );
bPlaySelect = false;
MenuStart( (PlayerNumber)p ); // agree everyone
MenuStart( p ); // agree everyone
bPlaySelect = true;
}
}
else // someone must have chosen arcade style play so oni/nonstop/endless must be disabled
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
if( m_bChosen[p] || p == pn )
continue;
if( !BothPlayersModeChoice(m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]]) )
@@ -437,16 +429,16 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
ASSERT( iSwitchToIndex != -1 );
// move the cursor
ChangeWithinPage( (PlayerNumber) p, iSwitchToIndex, false );
ChangeWithinPage( p, iSwitchToIndex, false );
}
/* If the other player is active and hasn't yet chosen, gray out unselectable options.
* Otherwise, don't do this, so we don't gray out stuff when nothing else can be selected
* anyway. */
bool bAnyPlayersLeft = false;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || m_bChosen[p] || p == pn )
if( m_bChosen[p] || p == pn )
continue;
bAnyPlayersLeft = true;
}
@@ -470,13 +462,13 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
if( m_CurrentPage == PAGE_2 )
{
// choose this for all the other players too
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_bChosen[p] )
continue;
bPlaySelect = false;
MenuStart( (PlayerNumber)p );
MenuStart( p );
bPlaySelect = true;
}
}
@@ -489,9 +481,9 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
// check to see if everyone has chosen
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) && m_bChosen[p] == false )
if( m_bChosen[p] == false )
return;
}
this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on
@@ -499,8 +491,6 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
void ScreenSelectDifficulty::TweenOnScreen()
{
unsigned p;
for( int page=0; page<NUM_PAGES; page++ )
{
SET_XY_AND_ON_COMMAND( m_sprExplanation[page] );
@@ -513,13 +503,10 @@ void ScreenSelectDifficulty::TweenOnScreen()
}
}
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
continue;
float fCursorX = GetCursorX( (PlayerNumber)p );
float fCursorY = GetCursorY( (PlayerNumber)p );
float fCursorX = GetCursorX( p );
float fCursorY = GetCursorY( p );
m_sprCursor[p].SetXY( fCursorX, fCursorY );
ON_COMMAND( m_sprCursor[p] );
@@ -536,11 +523,8 @@ void ScreenSelectDifficulty::TweenOffScreen()
OFF_COMMAND( m_sprExplanation[page] );
OFF_COMMAND( m_sprMore[page] );
FOREACH_PlayerNumber( p )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
OFF_COMMAND( m_sprCursor[p] );
OFF_COMMAND( m_sprOK[p] );
OFF_COMMAND( m_sprShadow[p] );
+7 -10
View File
@@ -56,8 +56,8 @@
ScreenSelectDifficultyEX::ScreenSelectDifficultyEX( CString sClassName ) : ScreenSelect( sClassName )
{
m_CurrentPage = PAGE_1;
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iChoice[p] = 0;
m_bChosen[p] = false;
@@ -98,7 +98,7 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX( CString sClassName ) : Scree
}
SetDifficultyIconText( false ); // Make sure we show the names!
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsPlayerEnabled(p) ) // Only show their cursor, if they're enabled
{
@@ -374,8 +374,7 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn )
const ModeChoice& mc = m_ModeChoices[m_iChoice[pn]];
bool AnotherPlayerSelected = false;
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if(p != pn && m_bChosen[p]) { AnotherPlayerSelected = true; }
}
@@ -398,7 +397,7 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn )
if( IsACourse( m_iChoice[pn] ) )
{
// If this is course/mode, choose this for all the other players too
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_bChosen[p] ) { continue; }
MenuStart( (PlayerNumber)p );
@@ -416,7 +415,7 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn )
// check to see if everyone has chosen
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( GAMESTATE->IsPlayerEnabled((PlayerNumber)p) && m_bChosen[p] == false )
{
@@ -428,9 +427,7 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn )
void ScreenSelectDifficultyEX::TweenOnScreen()
{
unsigned p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) ) { continue; }
+52 -66
View File
@@ -50,9 +50,7 @@ const ScreenMessage SM_PlayPostSwitchPage = (ScreenMessage)(SM_User+1);
ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sClassName )
{
int p, i;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
m_iChoice[p] = clamp( DEFAULT_CHOICE-1, 0, (int) m_aModeChoices.size() );
m_bChosen[p] = false;
@@ -61,7 +59,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
// init cursor
if( SHARED_PREVIEW_AND_CURSOR )
{
for( i=0; i<NUM_CURSOR_PARTS; i++ )
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
{
CString sFName = ssprintf("%s Cursor Part%d", m_sName.c_str(),i+1);
m_sprCursor[i][0].SetName( ssprintf("CursorPart%d",i+1) );
@@ -71,12 +69,10 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
}
else
{
for( i=0; i<NUM_CURSOR_PARTS; i++ )
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
CString sFName = ssprintf("%s Cursor Part%d P%d", m_sName.c_str(),i+1,p+1);
m_sprCursor[i][p].SetName( ssprintf("CursorPart%dP%d",i+1,p+1) );
m_sprCursor[i][p].Load( THEME->GetPathToG(sFName) );
@@ -112,11 +108,8 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
}
else
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
m_Scroller[p].Load(
SCROLLER_SECONDS_PER_ITEM,
7,
@@ -145,7 +138,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
const ModeChoice& mc = m_aModeChoices[c];
// init icon
for( i=0; i<NUM_ICON_PARTS; i++ )
for( int i=0; i<NUM_ICON_PARTS; i++ )
{
CString sFName = ssprintf("%s Icon Part%d Choice%s", m_sName.c_str(),i+1,mc.m_sName.c_str());
m_sprIcon[i][c].Load( THEME->GetPathToG(sFName) );
@@ -166,10 +159,8 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
}
else
{
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_HumanPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
for( i=0; i<NUM_PREVIEW_PARTS; i++ )
{
CString sFName = ssprintf("%s Preview Part%d Choice%s P%d", m_sName.c_str(),i+1,mc.m_sName.c_str(),p+1);
@@ -194,7 +185,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
}
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
CLAMP( m_iChoice[p], 0, (int)m_aModeChoices.size()-1 );
m_bChosen[p] = false;
@@ -290,12 +281,11 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
COMMAND( m_sprCursor[i][p], "PostSwitchPage" );
}
FOREACH_HumanPlayer( p )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
COMMAND( m_sprCursor[i][p], "PostSwitchPage" );
}
}
if( SHARED_PREVIEW_AND_CURSOR )
@@ -306,9 +296,8 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PostSwitchPage" );
FOREACH_HumanPlayer( p )
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PostSwitchPage" );
}
m_fLockInputSecs = POST_SWITCH_PAGE_SECONDS;
@@ -406,8 +395,7 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
Page newPage = GetPage(iNewChoice);
// If anyone has already chosen, don't allow changing of pages
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
return false;
@@ -432,15 +420,18 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
if( SHARED_PREVIEW_AND_CURSOR )
{
int iChoice = m_iChoice[GAMESTATE->m_MasterPlayerNumber];
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
COMMAND( m_sprPreview[i][m_iChoice[p]][0], "PreSwitchPage" );
COMMAND( m_sprPreview[i][iChoice][0], "PreSwitchPage" );
}
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PreSwitchPage" );
FOREACH_HumanPlayer( p )
{
int iChoice = m_iChoice[p];
COMMAND( m_sprPreview[i][iChoice][p], "PreSwitchPage" );
}
}
for( int page=0; page<NUM_PAGES; page++ )
@@ -462,7 +453,7 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
}
// change both players
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
m_iChoice[p] = iNewChoice;
m_fLockInputSecs = PRE_SWITCH_PAGE_SECONDS;
@@ -664,14 +655,13 @@ void ScreenSelectMaster::TweenOnScreen()
}
else
{
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
{
COMMAND( m_sprPreview[i][c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
m_sprPreview[i][c][p]->FinishTweening();
SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] );
}
FOREACH_HumanPlayer( p )
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
{
COMMAND( m_sprPreview[i][c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
m_sprPreview[i][c][p]->FinishTweening();
SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] );
}
}
}
@@ -687,12 +677,11 @@ void ScreenSelectMaster::TweenOnScreen()
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
ON_COMMAND( m_sprCursor[i][p] );
}
FOREACH_HumanPlayer( p )
{
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
ON_COMMAND( m_sprCursor[i][p] );
}
}
if( SHOW_SCROLLER )
@@ -705,14 +694,13 @@ void ScreenSelectMaster::TweenOnScreen()
COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" );
}
else
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
SET_XY_AND_ON_COMMAND( m_Scroller[p] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
}
FOREACH_HumanPlayer( p )
{
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
SET_XY_AND_ON_COMMAND( m_Scroller[p] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
}
}
SET_XY_AND_ON_COMMAND( m_sprExplanation[GetCurrentPage()] );
@@ -731,9 +719,8 @@ void ScreenSelectMaster::TweenOffScreen()
else
{
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
OFF_COMMAND( m_sprCursor[i][p] );
FOREACH_HumanPlayer( p )
OFF_COMMAND( m_sprCursor[i][p] );
}
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
@@ -748,8 +735,8 @@ void ScreenSelectMaster::TweenOffScreen()
SelectedByEitherPlayer = true;
}
else
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) && m_iChoice[p] == (int)c )
FOREACH_HumanPlayer( p )
if( m_iChoice[p] == (int)c )
SelectedByEitherPlayer = true;
for( int i=0; i<NUM_ICON_PARTS; i++ )
@@ -770,12 +757,11 @@ void ScreenSelectMaster::TweenOffScreen()
else
{
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) )
{
OFF_COMMAND( m_sprPreview[i][c][p] );
COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" );
}
FOREACH_HumanPlayer( p )
{
OFF_COMMAND( m_sprPreview[i][c][p] );
COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" );
}
}
}
+2 -4
View File
@@ -101,10 +101,8 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme
m_MusicWheel.Load();
int p;
// pop'n music has this under the songwheel...
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
Character* pChar = GAMESTATE->m_pCurCharacters[p];
m_sprCharacterIcon[p].SetName( ssprintf("CharacterIconP%d",p+1) );
@@ -239,7 +237,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme
this->AddChild( &m_DifficultyList );
}
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip
+1 -2
View File
@@ -126,8 +126,7 @@ void ScreenStage::HandleScreenMessage( const ScreenMessage SM )
case SM_BeginFadingOut:
m_Out.StartTransitioning();
int p;
for( p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
OFF_COMMAND( m_sprCharacterIcon[p] );
OFF_COMMAND( m_SongTitle );
OFF_COMMAND( m_Artist );