use PlayerNumber macros

This commit is contained in:
Chris Danford
2004-06-06 20:57:13 +00:00
parent 9762c6583f
commit fa114e148a
4 changed files with 46 additions and 60 deletions
+1 -4
View File
@@ -48,11 +48,8 @@ void CourseEntryDisplay::Load()
m_TextBanner.LoadFromString( "", "", "", "", "", "" );
this->AddChild( &m_TextBanner );
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
FOREACH_HumanPlayer( pn )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)pn) )
continue; // skip
if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber )
continue; // skip
+29 -38
View File
@@ -34,54 +34,45 @@ void DifficultyList::Load()
m_Lines.resize( MAX_METERS );
m_CurSong = NULL;
{
FOREACH_HumanPlayer( pn )
{
m_Cursors[pn].Load( THEME->GetPathToG(ssprintf("%s cursor p%i",m_sName.c_str(), pn+1)) );
m_Cursors[pn]->SetName( ssprintf("CursorP%i",pn+1) );
FOREACH_HumanPlayer( pn )
{
m_Cursors[pn].Load( THEME->GetPathToG(ssprintf("%s cursor p%i",m_sName.c_str(), pn+1)) );
m_Cursors[pn]->SetName( ssprintf("CursorP%i",pn+1) );
/* Hack: we need to tween cursors both up to down (cursor motion) and visible to
* invisible (fading). Cursor motion needs to stoptweening, so multiple motions
* don't queue and look unresponsive. However, that stpotweening interrupts fading,
* resulting in the cursor remaining invisible or partially invisible. So, do them
* in separate tweening stacks. This means the Cursor command can't change diffuse
* colors; I think we do need a diffuse color stack ... */
m_CursorFrames[pn].SetName( ssprintf("CursorP%i",pn+1) );
m_CursorFrames[pn].AddChild( m_Cursors[pn] );
this->AddChild( &m_CursorFrames[pn] );
}
/* Hack: we need to tween cursors both up to down (cursor motion) and visible to
* invisible (fading). Cursor motion needs to stoptweening, so multiple motions
* don't queue and look unresponsive. However, that stpotweening interrupts fading,
* resulting in the cursor remaining invisible or partially invisible. So, do them
* in separate tweening stacks. This means the Cursor command can't change diffuse
* colors; I think we do need a diffuse color stack ... */
m_CursorFrames[pn].SetName( ssprintf("CursorP%i",pn+1) );
m_CursorFrames[pn].AddChild( m_Cursors[pn] );
this->AddChild( &m_CursorFrames[pn] );
}
for( unsigned m = 0; m < m_Lines.size(); ++m )
{
for( unsigned m = 0; m < m_Lines.size(); ++m )
{
m_Lines[m].m_Meter.SetName( "DifficultySummaryRow", "Row" );
m_Lines[m].m_Meter.Load();
this->AddChild( &m_Lines[m].m_Meter );
m_Lines[m].m_Meter.SetName( "DifficultySummaryRow", "Row" );
m_Lines[m].m_Meter.Load();
this->AddChild( &m_Lines[m].m_Meter );
m_Lines[m].m_Description.SetName( "Description" );
m_Lines[m].m_Description.LoadFromFont( THEME->GetPathToF(ssprintf("%s description",m_sName.c_str())) );
this->AddChild( &m_Lines[m].m_Description );
m_Lines[m].m_Description.SetName( "Description" );
m_Lines[m].m_Description.LoadFromFont( THEME->GetPathToF(ssprintf("%s description",m_sName.c_str())) );
this->AddChild( &m_Lines[m].m_Description );
m_Lines[m].m_Number.SetName( "Number" );
m_Lines[m].m_Number.LoadFromFont( THEME->GetPathToF(ssprintf("%s number",m_sName.c_str())) );
this->AddChild( &m_Lines[m].m_Number );
}
m_Lines[m].m_Number.SetName( "Number" );
m_Lines[m].m_Number.LoadFromFont( THEME->GetPathToF(ssprintf("%s number",m_sName.c_str())) );
this->AddChild( &m_Lines[m].m_Number );
}
{
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
if( GAMESTATE->IsHumanPlayer(pn) )
ON_COMMAND( m_Cursors[pn] );
}
FOREACH_HumanPlayer( pn )
ON_COMMAND( m_Cursors[pn] );
for( int m = 0; m < MAX_METERS; ++m )
{
for( int m = 0; m < MAX_METERS; ++m )
{
ON_COMMAND( m_Lines[m].m_Meter );
ON_COMMAND( m_Lines[m].m_Description );
ON_COMMAND( m_Lines[m].m_Number );
}
ON_COMMAND( m_Lines[m].m_Meter );
ON_COMMAND( m_Lines[m].m_Description );
ON_COMMAND( m_Lines[m].m_Number );
}
UpdatePositions();
+3 -3
View File
@@ -1070,7 +1070,7 @@ bool GameState::IsDisqualified( PlayerNumber pn )
void GameState::ResetNoteSkins()
{
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
FOREACH_PlayerNumber( pn )
ResetNoteSkinsForPlayer( (PlayerNumber) pn );
++m_BeatToNoteSkinRev;
@@ -1663,7 +1663,7 @@ bool GameState::ChangePreferredDifficulty( PlayerNumber pn, Difficulty dc )
{
this->m_PreferredDifficulty[pn] = dc;
if( DifficultiesLocked() )
for( int p = 0; p < NUM_PLAYERS; ++p )
FOREACH_PlayerNumber( p )
m_PreferredDifficulty[p] = m_PreferredDifficulty[pn];
return true;
@@ -1728,7 +1728,7 @@ bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, CourseDifficul
m_PreferredCourseDifficulty[pn] = cd;
if( PREFSMAN->m_bLockCourseDifficulties )
for( int p = 0; p < NUM_PLAYERS; ++p )
FOREACH_PlayerNumber( p )
m_PreferredCourseDifficulty[p] = m_PreferredCourseDifficulty[pn];
return true;
+13 -15
View File
@@ -286,7 +286,7 @@ void Song::RevertFromDisk( bool bAllowNotesLoss )
StepsID OldCurNotes[NUM_PLAYERS];
StepsID OldCurStageStats[NUM_PLAYERS];
vector<StepsID> OldPlayedStageStats[NUM_PLAYERS];
for( int p = 0; p < NUM_PLAYERS; ++p )
FOREACH_PlayerNumber( p )
{
OldCurNotes[p].FromSteps( GAMESTATE->m_pCurSteps[p] );
OldCurStageStats[p].FromSteps( g_CurStageStats.pSteps[p] );
@@ -312,22 +312,20 @@ void Song::RevertFromDisk( bool bAllowNotesLoss )
PREFSMAN->m_bFastLoad = OldVal;
FOREACH_PlayerNumber( p )
{
for( int p = 0; p < NUM_PLAYERS; ++p )
CHECKPOINT;
if( GAMESTATE->m_pCurSong == this )
GAMESTATE->m_pCurSteps[p] = OldCurNotes[p].ToSteps( this, bAllowNotesLoss );
CHECKPOINT;
if( g_CurStageStats.pSong == this )
g_CurStageStats.pSteps[p] = OldCurStageStats[p].ToSteps( this, bAllowNotesLoss );
CHECKPOINT;
for( unsigned i = 0; i < g_vPlayedStageStats.size(); ++i )
{
CHECKPOINT;
if( GAMESTATE->m_pCurSong == this )
GAMESTATE->m_pCurSteps[p] = OldCurNotes[p].ToSteps( this, bAllowNotesLoss );
CHECKPOINT;
if( g_CurStageStats.pSong == this )
g_CurStageStats.pSteps[p] = OldCurStageStats[p].ToSteps( this, bAllowNotesLoss );
CHECKPOINT;
for( unsigned i = 0; i < g_vPlayedStageStats.size(); ++i )
{
CHECKPOINT_M(ssprintf("%i", i));
if( g_vPlayedStageStats[i].pSong == this )
g_vPlayedStageStats[i].pSteps[p] = OldPlayedStageStats[p][i].ToSteps( this, bAllowNotesLoss );
}
CHECKPOINT_M(ssprintf("%i", i));
if( g_vPlayedStageStats[i].pSong == this )
g_vPlayedStageStats[i].pSteps[p] = OldPlayedStageStats[p][i].ToSteps( this, bAllowNotesLoss );
}
}