remove VC6 scoping hacks

This commit is contained in:
Chris Danford
2004-09-21 07:53:39 +00:00
parent f97eaed01d
commit 03fbb915f3
55 changed files with 162 additions and 266 deletions
+3 -5
View File
@@ -119,19 +119,17 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
ssprintf("%f, %f", fPercentBetweenColors, fPercentThroughEffect) ); ssprintf("%f, %f", fPercentBetweenColors, fPercentThroughEffect) );
float fOriginalAlpha = m_tempState.diffuse[0].a; float fOriginalAlpha = m_tempState.diffuse[0].a;
int i;
switch( m_Effect ) switch( m_Effect )
{ {
case diffuse_blink: case diffuse_blink:
/* XXX: Should diffuse_blink and diffuse_shift multiply the tempState color? /* XXX: Should diffuse_blink and diffuse_shift multiply the tempState color?
* (That would have the same effect with 1,1,1,1, and allow tweening the diffuse * (That would have the same effect with 1,1,1,1, and allow tweening the diffuse
* while blinking and shifting.) */ * while blinking and shifting.) */
for(i=0; i<4; i++) for(int i=0; i<4; i++)
m_tempState.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2; m_tempState.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2;
break; break;
case diffuse_shift: case diffuse_shift:
for(i=0; i<4; i++) for(int i=0; i<4; i++)
m_tempState.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); m_tempState.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors);
break; break;
case glow_blink: case glow_blink:
@@ -148,7 +146,7 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
cosf( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, cosf( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
cosf( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, cosf( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f,
fOriginalAlpha ); fOriginalAlpha );
for( i=1; i<4; i++ ) for( int i=1; i<4; i++ )
m_tempState.diffuse[i] = m_tempState.diffuse[0]; m_tempState.diffuse[i] = m_tempState.diffuse[0];
break; break;
case wag: case wag:
+2 -3
View File
@@ -20,12 +20,11 @@ void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo )
GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true ); GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
// strip out the folder called "CVS" and EMPTY_ANNOUNCER_NAME // strip out the folder called "CVS" and EMPTY_ANNOUNCER_NAME
int i; for( int i=AddTo.size()-1; i>=0; i-- )
for( i=AddTo.size()-1; i>=0; i-- )
if( !stricmp( AddTo[i], "cvs" ) ) if( !stricmp( AddTo[i], "cvs" ) )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 ); AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
for( i=AddTo.size()-1; i>=0; i-- ) for( int i=AddTo.size()-1; i>=0; i-- )
if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) ) if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 ); AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
} }
+1 -2
View File
@@ -64,8 +64,7 @@ void AddLayersFromAniDir( CString sAniDir, vector<Actor*> &layersAddTo, bool Gen
} }
} }
int i; for( int i=0; i<MAX_LAYERS; i++ )
for( i=0; i<MAX_LAYERS; i++ )
{ {
CString sLayer = ssprintf("Layer%d",i+1); CString sLayer = ssprintf("Layer%d",i+1);
const IniFile::key* pKey = ini.GetKey( sLayer ); const IniFile::key* pKey = ini.GetKey( sLayer );
+6 -9
View File
@@ -662,15 +662,14 @@ void BGAnimationLayer::Update( float fDeltaTime )
const float fSongBeat = GAMESTATE->m_fSongBeat; const float fSongBeat = GAMESTATE->m_fSongBeat;
unsigned i; for( unsigned i=0; i<m_SubActors.size(); i++ )
for( i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->Update( fDeltaTime ); m_SubActors[i]->Update( fDeltaTime );
switch( m_Type ) switch( m_Type )
{ {
case TYPE_SPRITE: case TYPE_SPRITE:
for( i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
{ {
if( m_fTexCoordVelocityX || m_fTexCoordVelocityY ) if( m_fTexCoordVelocityX || m_fTexCoordVelocityY )
{ {
@@ -714,7 +713,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
break; break;
*/ */
case TYPE_PARTICLES: case TYPE_PARTICLES:
for( i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
{ {
Actor* pActor = m_SubActors[i]; Actor* pActor = m_SubActors[i];
RageVector3 &vel = m_vParticleVelocity[i]; RageVector3 &vel = m_vParticleVelocity[i];
@@ -809,7 +808,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
} }
break; break;
case EFFECT_TILE_PULSE: case EFFECT_TILE_PULSE:
for( i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetZoom( sinf( fSongBeat*PI/2 ) ); m_SubActors[i]->SetZoom( sinf( fSongBeat*PI/2 ) );
break; break;
@@ -1023,9 +1022,7 @@ void BGAnimationLayer::LoseFocus()
void BGAnimationLayer::PlayCommand( const CString &sCommandName ) void BGAnimationLayer::PlayCommand( const CString &sCommandName )
{ {
unsigned i; for( unsigned i=0; i<m_SubActors.size(); i++ )
for( i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->Command( ssprintf("playcommand,%s", sCommandName.c_str()) ); m_SubActors[i]->Command( ssprintf("playcommand,%s", sCommandName.c_str()) );
CString sKey = sCommandName; CString sKey = sCommandName;
@@ -1035,7 +1032,7 @@ void BGAnimationLayer::PlayCommand( const CString &sCommandName )
if( it == m_asCommands.end() ) if( it == m_asCommands.end() )
return; return;
for( i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->Command( it->second ); m_SubActors[i]->Command( it->second );
} }
+3 -4
View File
@@ -87,9 +87,8 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
const vector<float> &BPMS = bpms.vfBpms; const vector<float> &BPMS = bpms.vfBpms;
unsigned i;
bool AllIdentical = true; bool AllIdentical = true;
for( i = 0; i < BPMS.size(); ++i ) for( unsigned i = 0; i < BPMS.size(); ++i )
{ {
if( i > 0 && BPMS[i] != BPMS[i-1] ) if( i > 0 && BPMS[i] != BPMS[i-1] )
AllIdentical = false; AllIdentical = false;
@@ -99,7 +98,7 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
{ {
int MinBPM=99999999; int MinBPM=99999999;
int MaxBPM=-99999999; int MaxBPM=-99999999;
for( i = 0; i < BPMS.size(); ++i ) for( unsigned i = 0; i < BPMS.size(); ++i )
{ {
MinBPM = min( MinBPM, (int) roundf(BPMS[i]) ); MinBPM = min( MinBPM, (int) roundf(BPMS[i]) );
MaxBPM = max( MaxBPM, (int) roundf(BPMS[i]) ); MaxBPM = max( MaxBPM, (int) roundf(BPMS[i]) );
@@ -115,7 +114,7 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
m_textBPM.SetText( ssprintf("%i%s%i", MinBPM, SEPARATOR.c_str(), MaxBPM) ); m_textBPM.SetText( ssprintf("%i%s%i", MinBPM, SEPARATOR.c_str(), MaxBPM) );
} else { } else {
m_BPMS.clear(); m_BPMS.clear();
for( i = 0; i < BPMS.size(); ++i ) for( unsigned i = 0; i < BPMS.size(); ++i )
{ {
m_BPMS.push_back(BPMS[i]); m_BPMS.push_back(BPMS[i]);
if( BPMS[i] != -1 ) if( BPMS[i] != -1 )
+1 -2
View File
@@ -127,7 +127,6 @@ void BitmapText::BuildChars()
if(m_wTextLines.empty()) return; if(m_wTextLines.empty()) return;
m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size()); m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size());
unsigned i;
int MinSpacing = 0; int MinSpacing = 0;
/* The height (from the origin to the baseline): */ /* The height (from the origin to the baseline): */
@@ -145,7 +144,7 @@ void BitmapText::BuildChars()
default: ASSERT( false ); return; default: ASSERT( false ); return;
} }
for( i=0; i<m_wTextLines.size(); i++ ) // foreach line for( unsigned i=0; i<m_wTextLines.size(); i++ ) // foreach line
{ {
iY += m_pFont->GetHeight(); iY += m_pFont->GetHeight();
const wstring &szLine = m_wTextLines[i]; const wstring &szLine = m_wTextLines[i];
+3 -4
View File
@@ -14,12 +14,11 @@ void ComboGraph::Load( CString Path, const StageStats &s, PlayerNumber pn )
/* Find the largest combo. */ /* Find the largest combo. */
int MaxComboSize = 0; int MaxComboSize = 0;
unsigned i; for( unsigned i = 0; i < s.ComboList[pn].size(); ++i )
for( i = 0; i < s.ComboList[pn].size(); ++i )
MaxComboSize = max( MaxComboSize, s.ComboList[pn][i].GetStageCnt() ); MaxComboSize = max( MaxComboSize, s.ComboList[pn][i].GetStageCnt() );
float width = -1; float width = -1;
for( i = 0; i < s.ComboList[pn].size(); ++i ) for( unsigned i = 0; i < s.ComboList[pn].size(); ++i )
{ {
const StageStats::Combo_t &combo = s.ComboList[pn][i]; const StageStats::Combo_t &combo = s.ComboList[pn][i];
if( combo.GetStageCnt() < MinComboSizeToShow ) if( combo.GetStageCnt() < MinComboSizeToShow )
@@ -49,7 +48,7 @@ void ComboGraph::Load( CString Path, const StageStats &s, PlayerNumber pn )
this->AddChild( sprite ); this->AddChild( sprite );
} }
for( i = 0; i < s.ComboList[pn].size(); ++i ) for( unsigned i = 0; i < s.ComboList[pn].size(); ++i )
{ {
const StageStats::Combo_t &combo = s.ComboList[pn][i]; const StageStats::Combo_t &combo = s.ComboList[pn][i];
if( combo.GetStageCnt() < MinComboSizeToShow ) if( combo.GetStageCnt() < MinComboSizeToShow )
+1 -3
View File
@@ -1072,10 +1072,8 @@ void Course::UpdateCourseStats( StepsType st )
{ {
m_SortOrder_TotalDifficulty = 0; m_SortOrder_TotalDifficulty = 0;
unsigned i;
// courses with random/players best-worst songs should go at the end // courses with random/players best-worst songs should go at the end
for(i = 0; i < m_entries.size(); i++) for(unsigned i = 0; i < m_entries.size(); i++)
{ {
if ( m_entries[i].type == COURSE_ENTRY_FIXED ) if ( m_entries[i].type == COURSE_ENTRY_FIXED )
continue; continue;
+2 -4
View File
@@ -82,9 +82,7 @@ EditCoursesMenu::EditCoursesMenu()
m_bInSongMenu = false; m_bInSongMenu = false;
int i; for( int i=0; i<2; i++ )
for( i=0; i<2; i++ )
{ {
m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditCoursesMenu %s",(i==0?"left":"right"))) ); m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditCoursesMenu %s",(i==0?"left":"right"))) );
m_sprArrows[i].SetX( ARROWS_X(i) ); m_sprArrows[i].SetX( ARROWS_X(i) );
@@ -96,7 +94,7 @@ EditCoursesMenu::EditCoursesMenu()
ZERO( m_iSelection ); ZERO( m_iSelection );
for( i=0; i<NUM_ROWS; i++ ) for( int i=0; i<NUM_ROWS; i++ )
{ {
m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") ); m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") );
m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) );
+5 -9
View File
@@ -35,9 +35,7 @@ EditMenu::EditMenu()
{ {
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" ); LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
int i; for( int i=0; i<2; i++ )
for( i=0; i<2; i++ )
{ {
m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditMenu %s",(i==0?"left":"right"))) ); m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("EditMenu %s",(i==0?"left":"right"))) );
m_sprArrows[i].SetX( ARROWS_X(i) ); m_sprArrows[i].SetX( ARROWS_X(i) );
@@ -55,7 +53,7 @@ EditMenu::EditMenu()
for( i=0; i<NUM_ROWS; i++ ) for( int i=0; i<NUM_ROWS; i++ )
{ {
m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") ); m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") );
m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) );
@@ -106,14 +104,12 @@ EditMenu::EditMenu()
// Select the current song if any // Select the current song if any
if( GAMESTATE->m_pCurSong ) if( GAMESTATE->m_pCurSong )
{ {
unsigned i; for( unsigned i=0; i<m_sGroups.size(); i++ )
for( i=0; i<m_sGroups.size(); i++ )
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] ) if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
m_iSelection[ROW_GROUP] = i; m_iSelection[ROW_GROUP] = i;
OnRowValueChanged( ROW_GROUP ); OnRowValueChanged( ROW_GROUP );
for( i=0; i<m_pSongs.size(); i++ ) for( unsigned i=0; i<m_pSongs.size(); i++ )
if( GAMESTATE->m_pCurSong == m_pSongs[i] ) if( GAMESTATE->m_pCurSong == m_pSongs[i] )
m_iSelection[ROW_SONG] = i; m_iSelection[ROW_SONG] = i;
OnRowValueChanged( ROW_SONG ); OnRowValueChanged( ROW_SONG );
@@ -121,7 +117,7 @@ EditMenu::EditMenu()
// Select the current StepsType and difficulty if any // Select the current StepsType and difficulty if any
if( GAMESTATE->m_pCurSteps[PLAYER_1] ) if( GAMESTATE->m_pCurSteps[PLAYER_1] )
{ {
for( i=0; i<m_StepsTypes.size(); i++ ) for( unsigned i=0; i<m_StepsTypes.size(); i++ )
{ {
if( m_StepsTypes[i] == GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType ) if( m_StepsTypes[i] == GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType )
{ {
+2 -5
View File
@@ -37,14 +37,13 @@ void FontPage::Load( FontPageSettings cfg )
// load character widths // load character widths
vector<int> FrameWidths; vector<int> FrameWidths;
int i;
int default_width = m_pTexture->GetSourceFrameWidth(); int default_width = m_pTexture->GetSourceFrameWidth();
if(cfg.DefaultWidth != -1) if(cfg.DefaultWidth != -1)
default_width = cfg.DefaultWidth; default_width = cfg.DefaultWidth;
// Assume each character is the width of the frame by default. // Assume each character is the width of the frame by default.
for( i=0; i<m_pTexture->GetNumFrames(); i++ ) for( int i=0; i<m_pTexture->GetNumFrames(); i++ )
{ {
map<int,int>::const_iterator it = cfg.GlyphWidths.find(i); map<int,int>::const_iterator it = cfg.GlyphWidths.find(i);
if(it != cfg.GlyphWidths.end()) if(it != cfg.GlyphWidths.end())
@@ -219,9 +218,7 @@ Font::~Font()
void Font::Unload() void Font::Unload()
{ {
unsigned i; for(unsigned i = 0; i < pages.size(); ++i)
for(i = 0; i < pages.size(); ++i)
delete pages[i]; delete pages[i];
pages.clear(); pages.clear();
+2 -3
View File
@@ -45,14 +45,13 @@ MenuInput Game::GameInputToMenuInput( GameInput GameI ) const
ASSERT(0); return MenuInput(); // invalid m_StyleType ASSERT(0); return MenuInput(); // invalid m_StyleType
}; };
int i; for( int i=0; i<NUM_MENU_BUTTONS; i++ )
for( i=0; i<NUM_MENU_BUTTONS; i++ )
if( m_DedicatedMenuButton[i] == GameI.button ) if( m_DedicatedMenuButton[i] == GameI.button )
return MenuInput( pn, (MenuButton)i ); return MenuInput( pn, (MenuButton)i );
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons ) if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
{ {
for( i=0; i<NUM_MENU_BUTTONS; i++ ) for( int i=0; i<NUM_MENU_BUTTONS; i++ )
if( m_SecondaryMenuButton[i] == GameI.button ) if( m_SecondaryMenuButton[i] == GameI.button )
return MenuInput( pn, (MenuButton)i ); return MenuInput( pn, (MenuButton)i );
} }
+5 -9
View File
@@ -70,11 +70,9 @@ GameState::~GameState()
void GameState::ApplyCmdline() void GameState::ApplyCmdline()
{ {
int i;
/* We need to join players before we can set the style. */ /* We need to join players before we can set the style. */
CString sPlayer; CString sPlayer;
for( i = 0; GetCommandlineArgument( "player", &sPlayer, i ); ++i ) for( int i = 0; GetCommandlineArgument( "player", &sPlayer, i ); ++i )
{ {
int pn = atoi( sPlayer )-1; int pn = atoi( sPlayer )-1;
if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS ) if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS )
@@ -84,7 +82,7 @@ void GameState::ApplyCmdline()
} }
CString sMode; CString sMode;
for( i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i ) for( int i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i )
{ {
ModeChoice m; ModeChoice m;
m.Load( 0, sMode ); m.Load( 0, sMode );
@@ -441,10 +439,8 @@ void GameState::Update( float fDelta )
void GameState::ReloadCharacters() void GameState::ReloadCharacters()
{ {
unsigned i; for( unsigned i=0; i<m_pCharacters.size(); i++ )
SAFE_DELETE( m_pCharacters[i] );
for( i=0; i<m_pCharacters.size(); i++ )
delete m_pCharacters[i];
m_pCharacters.clear(); m_pCharacters.clear();
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
@@ -453,7 +449,7 @@ void GameState::ReloadCharacters()
CStringArray as; CStringArray as;
GetDirListing( CHARACTERS_DIR "*", as, true, true ); GetDirListing( CHARACTERS_DIR "*", as, true, true );
bool FoundDefault = false; bool FoundDefault = false;
for( i=0; i<as.size(); i++ ) for( unsigned i=0; i<as.size(); i++ )
{ {
CString sCharName, sDummy; CString sCharName, sDummy;
splitpath(as[i], sDummy, sCharName, sDummy); splitpath(as[i], sDummy, sCharName, sDummy);
+3 -4
View File
@@ -71,11 +71,10 @@ void GraphDisplay::UpdateVerts()
int NumSlices = VALUE_RESOLUTION-1; int NumSlices = VALUE_RESOLUTION-1;
int i; for( int i = 0; i < 4*NumSlices; ++i )
for( i = 0; i < 4*NumSlices; ++i )
Slices[i].c = RageColor(1,1,1,1); Slices[i].c = RageColor(1,1,1,1);
for( i = 0; i < NumSlices; ++i ) for( int i = 0; i < NumSlices; ++i )
{ {
const float Left = SCALE( float(i), 0.0f, float(NumSlices), quadVertices.left, quadVertices.right ); const float Left = SCALE( float(i), 0.0f, float(NumSlices), quadVertices.left, quadVertices.right );
const float Right = SCALE( float(i+1), 0.0f, float(NumSlices), quadVertices.left, quadVertices.right ); const float Right = SCALE( float(i+1), 0.0f, float(NumSlices), quadVertices.left, quadVertices.right );
@@ -94,7 +93,7 @@ void GraphDisplay::UpdateVerts()
} }
const RectF *tex = m_pTexture->GetTextureCoordRect( 0 ); const RectF *tex = m_pTexture->GetTextureCoordRect( 0 );
for( i = 0; i < NumSlices; ++i ) for( int i = 0; i < NumSlices; ++i )
{ {
const float Left = SCALE( float(i), 0.0f, float(NumSlices), tex->left, tex->right ); const float Left = SCALE( float(i), 0.0f, float(NumSlices), tex->left, tex->right );
const float Right = SCALE( float(i+1), 0.0f, float(NumSlices), tex->left, tex->right ); const float Right = SCALE( float(i+1), 0.0f, float(NumSlices), tex->left, tex->right );
+2 -4
View File
@@ -144,9 +144,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
v[0].p = RageVector3( 0, 0, 0 ); v[0].p = RageVector3( 0, 0, 0 );
v[0].c = color; v[0].c = color;
int i; for( int i=0; i<NUM_SHOWN_RADAR_CATEGORIES+1; i++ ) // do one extra to close the fan
for( i=0; i<NUM_SHOWN_RADAR_CATEGORIES+1; i++ ) // do one extra to close the fan
{ {
const int c = i%NUM_SHOWN_RADAR_CATEGORIES; const int c = i%NUM_SHOWN_RADAR_CATEGORIES;
const float fDistFromCenter = const float fDistFromCenter =
@@ -164,7 +162,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
// //
// use a line loop to draw the thick line // use a line loop to draw the thick line
// //
for( i=0; i<=NUM_SHOWN_RADAR_CATEGORIES; i++ ) for( int i=0; i<=NUM_SHOWN_RADAR_CATEGORIES; i++ )
{ {
const int c = i%NUM_SHOWN_RADAR_CATEGORIES; const int c = i%NUM_SHOWN_RADAR_CATEGORIES;
const float fDistFromCenter = const float fDistFromCenter =
+2 -4
View File
@@ -20,9 +20,7 @@ JukeboxMenu::JukeboxMenu()
{ {
LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" ); LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" );
int i; for( int i=0; i<2; i++ )
for( i=0; i<2; i++ )
{ {
m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("JukeboxMenu %s",(i==0?"left":"right"))) ); m_sprArrows[i].Load( THEME->GetPathToG(ssprintf("JukeboxMenu %s",(i==0?"left":"right"))) );
m_sprArrows[i].SetX( ARROWS_X(i) ); m_sprArrows[i].SetX( ARROWS_X(i) );
@@ -33,7 +31,7 @@ JukeboxMenu::JukeboxMenu()
ZERO( m_iSelection ); ZERO( m_iSelection );
for( i=0; i<NUM_ROWS; i++ ) for( int i=0; i<NUM_ROWS; i++ )
{ {
m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") ); m_textLabel[i].LoadFromFont( THEME->GetPathToF("Common title") );
m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) );
+1 -2
View File
@@ -154,10 +154,9 @@ void Model::LoadMaterialsFromMilkshapeAscii( CString sPath )
{ {
m_Materials.resize( nNumMaterials ); m_Materials.resize( nNumMaterials );
int i;
char szName[256]; char szName[256];
for (i = 0; i < nNumMaterials; i++) for (int i = 0; i < nNumMaterials; i++)
{ {
msMaterial& Material = m_Materials[i]; msMaterial& Material = m_Materials[i];
+6 -10
View File
@@ -416,8 +416,6 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SortOrder so, CString sP
void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas, SortOrder so ) void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas, SortOrder so )
{ {
unsigned i;
switch( so ) switch( so )
{ {
case SORT_SORT_MENU: case SORT_SORT_MENU:
@@ -432,7 +430,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
if( Names.size() != Actions.size() ) if( Names.size() != Actions.size() )
RageException::Throw("MusicWheel::MenuNames and MusicWheel::MenuActions must have the same number of components"); RageException::Throw("MusicWheel::MenuNames and MusicWheel::MenuActions must have the same number of components");
for( i=0; i<Names.size(); ++i ) for( unsigned i=0; i<Names.size(); ++i )
{ {
/* Look for sort names. */ /* Look for sort names. */
vector<CString> parts; vector<CString> parts;
@@ -702,7 +700,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
} }
// init music status icons // init music status icons
for( i=0; i<arrayWheelItemDatas.size(); i++ ) for( unsigned i=0; i<arrayWheelItemDatas.size(); i++ )
{ {
Song* pSong = arrayWheelItemDatas[i].m_pSong; Song* pSong = arrayWheelItemDatas[i].m_pSong;
if( pSong == NULL ) if( pSong == NULL )
@@ -718,7 +716,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
if( so == SORT_MOST_PLAYED ) if( so == SORT_MOST_PLAYED )
{ {
// init crown icons // init crown icons
for( i=0; i< min(3u,arrayWheelItemDatas.size()); i++ ) for( unsigned i=0; i< min(3u,arrayWheelItemDatas.size()); i++ )
{ {
WheelItemData& WID = arrayWheelItemDatas[i]; WheelItemData& WID = arrayWheelItemDatas[i];
WID.m_Flags.iPlayersBestNumber = i+1; WID.m_Flags.iPlayersBestNumber = i+1;
@@ -833,10 +831,9 @@ void MusicWheel::DrawPrimitives()
} }
// draw outside->inside // draw outside->inside
int i; for( int i=0; i<NUM_WHEEL_ITEMS/2; i++ )
for( i=0; i<NUM_WHEEL_ITEMS/2; i++ )
DrawItem( i ); DrawItem( i );
for( i=NUM_WHEEL_ITEMS-1; i>=NUM_WHEEL_ITEMS/2; i-- ) for( int i=NUM_WHEEL_ITEMS-1; i>=NUM_WHEEL_ITEMS/2; i-- )
DrawItem( i ); DrawItem( i );
@@ -910,8 +907,7 @@ void MusicWheel::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
unsigned i; for( unsigned i=0; i<unsigned(NUM_WHEEL_ITEMS); i++ )
for( i=0; i<unsigned(NUM_WHEEL_ITEMS); i++ )
{ {
MusicWheelItem& display = m_MusicWheelItems[i]; MusicWheelItem& display = m_MusicWheelItems[i];
+4 -4
View File
@@ -555,22 +555,22 @@ void NetworkSyncManager::ProcessInput()
int ColumnNumber=m_packet.Read1(); int ColumnNumber=m_packet.Read1();
int NumberPlayers=m_packet.Read1(); int NumberPlayers=m_packet.Read1();
CString ColumnData; CString ColumnData;
int i;
switch (ColumnNumber) switch (ColumnNumber)
{ {
case NSSB_NAMES: case NSSB_NAMES:
ColumnData = "Names\n"; ColumnData = "Names\n";
for (i=0; i<NumberPlayers; ++i) for (int i=0; i<NumberPlayers; ++i)
ColumnData += m_PlayerNames[m_packet.Read1()] + "\n"; ColumnData += m_PlayerNames[m_packet.Read1()] + "\n";
break; break;
case NSSB_COMBO: case NSSB_COMBO:
ColumnData = "Combo\n"; ColumnData = "Combo\n";
for (i=0; i<NumberPlayers; ++i) for (int i=0; i<NumberPlayers; ++i)
ColumnData += ssprintf("%d\n",m_packet.Read2()); ColumnData += ssprintf("%d\n",m_packet.Read2());
break; break;
case NSSB_GRADE: case NSSB_GRADE:
ColumnData = "Grade\n"; ColumnData = "Grade\n";
for (i=0;i<NumberPlayers;i++) for (int i=0;i<NumberPlayers;i++)
switch (m_packet.Read1()) switch (m_packet.Read1())
{ {
case 0: case 0:
+6 -12
View File
@@ -243,12 +243,10 @@ void NoteData::AddHoldNote( HoldNote add )
{ {
ASSERT( add.iStartRow>=0 && add.iEndRow>=0 ); ASSERT( add.iStartRow>=0 && add.iEndRow>=0 );
int i;
// look for other hold notes that overlap and merge them // look for other hold notes that overlap and merge them
// XXX: this is done implicitly with 4s, but 4s uses this function. // XXX: this is done implicitly with 4s, but 4s uses this function.
// Rework this later. // Rework this later.
for( i=0; i<GetNumHoldNotes(); i++ ) // for each HoldNote for( int i=0; i<GetNumHoldNotes(); i++ ) // for each HoldNote
{ {
HoldNote &other = GetHoldNote(i); HoldNote &other = GetHoldNote(i);
if( add.iTrack == other.iTrack && // the tracks correspond if( add.iTrack == other.iTrack && // the tracks correspond
@@ -267,7 +265,7 @@ void NoteData::AddHoldNote( HoldNote add )
int iAddEndIndex = add.iEndRow; int iAddEndIndex = add.iEndRow;
// delete TapNotes under this HoldNote // delete TapNotes under this HoldNote
for( i=iAddStartIndex+1; i<=iAddEndIndex; i++ ) for( int i=iAddStartIndex+1; i<=iAddEndIndex; i++ )
SetTapNote( add.iTrack, i, TAP_EMPTY ); SetTapNote( add.iTrack, i, TAP_EMPTY );
// add a tap note at the start of this hold // add a tap note at the start of this hold
@@ -369,9 +367,7 @@ int NoteData::GetFirstRow() const
{ {
int iEarliestRowFoundSoFar = -1; int iEarliestRowFoundSoFar = -1;
int i; for( int i=0; i < int(m_TapNotes[0].size()); i++ )
for( i=0; i < int(m_TapNotes[0].size()); i++ )
{ {
if( !IsRowEmpty(i) ) if( !IsRowEmpty(i) )
{ {
@@ -380,7 +376,7 @@ int NoteData::GetFirstRow() const
} }
} }
for( i=0; i<GetNumHoldNotes(); i++ ) for( int i=0; i<GetNumHoldNotes(); i++ )
{ {
if( iEarliestRowFoundSoFar == -1 || if( iEarliestRowFoundSoFar == -1 ||
GetHoldNote(i).iStartRow < iEarliestRowFoundSoFar ) GetHoldNote(i).iStartRow < iEarliestRowFoundSoFar )
@@ -402,9 +398,7 @@ int NoteData::GetLastRow() const
{ {
int iOldestRowFoundSoFar = 0; int iOldestRowFoundSoFar = 0;
int i; for( int i = int(m_TapNotes[0].size()); i>=0; i-- ) // iterate back to front
for( i = int(m_TapNotes[0].size()); i>=0; i-- ) // iterate back to front
{ {
if( !IsRowEmpty(i) ) if( !IsRowEmpty(i) )
{ {
@@ -413,7 +407,7 @@ int NoteData::GetLastRow() const
} }
} }
for( i=0; i<GetNumHoldNotes(); i++ ) for( int i=0; i<GetNumHoldNotes(); i++ )
{ {
if( GetHoldNote(i).iEndRow > iOldestRowFoundSoFar ) if( GetHoldNote(i).iEndRow > iOldestRowFoundSoFar )
iOldestRowFoundSoFar = GetHoldNote(i).iEndRow; iOldestRowFoundSoFar = GetHoldNote(i).iEndRow;
+2 -4
View File
@@ -845,16 +845,14 @@ void NoteDataUtil::SwapSides( NoteData &in )
void NoteDataUtil::Little(NoteData &in, float fStartBeat, float fEndBeat) void NoteDataUtil::Little(NoteData &in, float fStartBeat, float fEndBeat)
{ {
int i;
// filter out all non-quarter notes // filter out all non-quarter notes
int max_row = in.GetLastRow(); int max_row = in.GetLastRow();
for( i=0; i<=max_row; i+=1 ) for( int i=0; i<=max_row; i+=1 )
if( i % ROWS_PER_BEAT != 0 ) if( i % ROWS_PER_BEAT != 0 )
for( int c=0; c<in.GetNumTracks(); c++ ) for( int c=0; c<in.GetNumTracks(); c++ )
in.SetTapNote( c, i, TAP_EMPTY ); in.SetTapNote( c, i, TAP_EMPTY );
for( i=in.GetNumHoldNotes()-1; i>=0; i-- ) for( int i=in.GetNumHoldNotes()-1; i>=0; i-- )
if( fmodf(in.GetHoldNote(i).GetStartBeat(),1) != 0 ) // doesn't start on a beat if( fmodf(in.GetHoldNote(i).GetStartBeat(),1) != 0 ) // doesn't start on a beat
in.RemoveHoldNote( i ); in.RemoveHoldNote( i );
} }
+5 -9
View File
@@ -443,8 +443,6 @@ void NoteField::DrawPrimitives()
{ {
ASSERT(GAMESTATE->m_pCurSong); ASSERT(GAMESTATE->m_pCurSong);
unsigned i;
// //
// Draw beat bars // Draw beat bars
// //
@@ -458,7 +456,7 @@ void NoteField::DrawPrimitives()
// BPM text // BPM text
// //
vector<BPMSegment> &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments; vector<BPMSegment> &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments;
for( i=0; i<aBPMSegments.size(); i++ ) for( unsigned i=0; i<aBPMSegments.size(); i++ )
{ {
if(aBPMSegments[i].m_fStartBeat >= fFirstBeatToDraw && if(aBPMSegments[i].m_fStartBeat >= fFirstBeatToDraw &&
aBPMSegments[i].m_fStartBeat <= fLastBeatToDraw) aBPMSegments[i].m_fStartBeat <= fLastBeatToDraw)
@@ -468,7 +466,7 @@ void NoteField::DrawPrimitives()
// Freeze text // Freeze text
// //
vector<StopSegment> &aStopSegments = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments; vector<StopSegment> &aStopSegments = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments;
for( i=0; i<aStopSegments.size(); i++ ) for( unsigned i=0; i<aStopSegments.size(); i++ )
{ {
if(aStopSegments[i].m_fStartBeat >= fFirstBeatToDraw && if(aStopSegments[i].m_fStartBeat >= fFirstBeatToDraw &&
aStopSegments[i].m_fStartBeat <= fLastBeatToDraw) aStopSegments[i].m_fStartBeat <= fLastBeatToDraw)
@@ -479,7 +477,7 @@ void NoteField::DrawPrimitives()
// BGChange text // BGChange text
// //
vector<BackgroundChange> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges; vector<BackgroundChange> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges;
for( i=0; i<aBackgroundChanges.size(); i++ ) for( unsigned i=0; i<aBackgroundChanges.size(); i++ )
{ {
if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw && if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw &&
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw) aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw)
@@ -525,12 +523,10 @@ void NoteField::DrawPrimitives()
// //
// Draw all HoldNotes in this column (so that they appear under the tap notes) // Draw all HoldNotes in this column (so that they appear under the tap notes)
// //
int i;
NDMap::iterator CurDisplay = m_BeatToNoteDisplays.begin(); NDMap::iterator CurDisplay = m_BeatToNoteDisplays.begin();
ASSERT( CurDisplay != m_BeatToNoteDisplays.end() ); ASSERT( CurDisplay != m_BeatToNoteDisplays.end() );
NDMap::iterator NextDisplay = CurDisplay; ++NextDisplay; NDMap::iterator NextDisplay = CurDisplay; ++NextDisplay;
for( i=0; i < GetNumHoldNotes(); i++ ) for( int i=0; i < GetNumHoldNotes(); i++ )
{ {
const HoldNote &hn = GetHoldNote(i); const HoldNote &hn = GetHoldNote(i);
if( hn.iTrack != c ) // this HoldNote doesn't belong to this column if( hn.iTrack != c ) // this HoldNote doesn't belong to this column
@@ -580,7 +576,7 @@ void NoteField::DrawPrimitives()
NextDisplay = CurDisplay; ++NextDisplay; NextDisplay = CurDisplay; ++NextDisplay;
// draw notes from furthest to closest // draw notes from furthest to closest
for( i=iLastIndexToDraw; i>=iFirstIndexToDraw; --i ) // for each row for( int i=iLastIndexToDraw; i>=iFirstIndexToDraw; --i ) // for each row
{ {
TapNote tn = GetTapNote(c, i); TapNote tn = GetTapNote(c, i);
if( tn.type == TapNote::empty ) // no note here if( tn.type == TapNote::empty ) // no note here
+3 -5
View File
@@ -321,8 +321,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
int iNumNewTracks = GameManager::StepsTypeToNumTracks( out.m_StepsType ); int iNumNewTracks = GameManager::StepsTypeToNumTracks( out.m_StepsType );
int iTransformNewToOld[MAX_NOTE_TRACKS]; int iTransformNewToOld[MAX_NOTE_TRACKS];
int i; for( int i = 0; i < MAX_NOTE_TRACKS; ++i)
for( i = 0; i < MAX_NOTE_TRACKS; ++i)
iTransformNewToOld[i] = -1; iTransformNewToOld[i] = -1;
switch( out.m_StepsType ) switch( out.m_StepsType )
@@ -452,8 +451,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
ASSERT( arrayBMSFileNames.size() ); ASSERT( arrayBMSFileNames.size() );
// load the Steps from the rest of the BMS files // load the Steps from the rest of the BMS files
unsigned i; for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
for( i=0; i<arrayBMSFileNames.size(); i++ )
{ {
Steps* pNewNotes = new Steps; Steps* pNewNotes = new Steps;
@@ -739,7 +737,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
} }
} }
for( i=0; i<out.m_Timing.m_BPMSegments.size(); i++ ) for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
LOG->Trace( "There is a BPM change at beat %f, BPM %f, index %d", LOG->Trace( "There is a BPM change at beat %f, BPM %f, index %d",
out.m_Timing.m_BPMSegments[i].m_fStartBeat, out.m_Timing.m_BPMSegments[i].m_fBPM, i ); out.m_Timing.m_BPMSegments[i].m_fStartBeat, out.m_Timing.m_BPMSegments[i].m_fBPM, i );
+5 -8
View File
@@ -58,8 +58,7 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
f.Write( "#BPMS:" ); f.Write( "#BPMS:" );
unsigned i; for( unsigned i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
for( i=0; i<out.m_Timing.m_BPMSegments.size(); i++ )
{ {
const BPMSegment &bs = out.m_Timing.m_BPMSegments[i]; const BPMSegment &bs = out.m_Timing.m_BPMSegments[i];
@@ -70,7 +69,7 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
f.PutLine( ";" ); f.PutLine( ";" );
f.Write( "#STOPS:" ); f.Write( "#STOPS:" );
for( i=0; i<out.m_Timing.m_StopSegments.size(); i++ ) for( unsigned i=0; i<out.m_Timing.m_StopSegments.size(); i++ )
{ {
const StopSegment &fs = out.m_Timing.m_StopSegments[i]; const StopSegment &fs = out.m_Timing.m_StopSegments[i];
@@ -81,7 +80,7 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
f.PutLine( ";" ); f.PutLine( ";" );
f.Write( "#BGCHANGES:" ); f.Write( "#BGCHANGES:" );
for( i=0; i<out.m_BackgroundChanges.size(); i++ ) for( unsigned i=0; i<out.m_BackgroundChanges.size(); i++ )
{ {
const BackgroundChange &seg = out.m_BackgroundChanges[i]; const BackgroundChange &seg = out.m_BackgroundChanges[i];
@@ -98,7 +97,7 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
if( out.m_ForegroundChanges.size() ) if( out.m_ForegroundChanges.size() )
{ {
f.Write( "#FGCHANGES:" ); f.Write( "#FGCHANGES:" );
for( i=0; i<out.m_ForegroundChanges.size(); i++ ) for( unsigned i=0; i<out.m_ForegroundChanges.size(); i++ )
{ {
const BackgroundChange &seg = out.m_ForegroundChanges[i]; const BackgroundChange &seg = out.m_ForegroundChanges[i];
@@ -176,8 +175,6 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
/* Flush dir cache when writing steps, so the old size isn't cached. */ /* Flush dir cache when writing steps, so the old size isn't cached. */
FILEMAN->FlushDirCache( Dirname(sPath) ); FILEMAN->FlushDirCache( Dirname(sPath) );
unsigned i;
int flags = RageFile::WRITE; int flags = RageFile::WRITE;
/* If we're not saving cache, we're saving real data, so enable SLOW_FLUSH /* If we're not saving cache, we're saving real data, so enable SLOW_FLUSH
@@ -210,7 +207,7 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
// Save all Steps for this file // Save all Steps for this file
// //
const vector<Steps*>& vpSteps = out.GetAllSteps(); const vector<Steps*>& vpSteps = out.GetAllSteps();
for( i=0; i<vpSteps.size(); i++ ) for( unsigned i=0; i<vpSteps.size(); i++ )
{ {
const Steps* pSteps = vpSteps[i]; const Steps* pSteps = vpSteps[i];
if( pSteps->IsAutogen() ) if( pSteps->IsAutogen() )
+3 -4
View File
@@ -92,8 +92,7 @@ void OptionIconRow::Refresh()
ASSERT( m_PlayerNumber != NUM_PLAYERS ); ASSERT( m_PlayerNumber != NUM_PLAYERS );
// init // init
unsigned i; for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
for( i=0; i<NUM_OPTION_COLS; i++ )
m_OptionIcon[i].Load( m_PlayerNumber, "", i==0 ); m_OptionIcon[i].Load( m_PlayerNumber, "", i==0 );
CString sOptions = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetString(); CString sOptions = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetString();
@@ -104,7 +103,7 @@ void OptionIconRow::Refresh()
CString asTabs[NUM_OPTION_COLS-1]; // fill these with what will be displayed on the tabs CString asTabs[NUM_OPTION_COLS-1]; // fill these with what will be displayed on the tabs
// for each option, look for the best column to place it in // for each option, look for the best column to place it in
for( i=0; i<asOptions.size(); i++ ) for( unsigned i=0; i<asOptions.size(); i++ )
{ {
CString sOption = asOptions[i]; CString sOption = asOptions[i];
int iPerferredCol = OptionToPreferredColumn( sOption ); int iPerferredCol = OptionToPreferredColumn( sOption );
@@ -125,7 +124,7 @@ void OptionIconRow::Refresh()
} }
} }
for( i=0; i<NUM_OPTION_COLS-1; i++ ) for( unsigned i=0; i<NUM_OPTION_COLS-1; i++ )
m_OptionIcon[i+1].Load( m_PlayerNumber, asTabs[i], false ); m_OptionIcon[i+1].Load( m_PlayerNumber, asTabs[i], false );
} }
+2 -3
View File
@@ -52,10 +52,9 @@ void PlayerAI::InitFromDisk()
ini.GetValue ( sKey, "MarvelousWeight", dist.fPercent[TNS_MARVELOUS] ); ini.GetValue ( sKey, "MarvelousWeight", dist.fPercent[TNS_MARVELOUS] );
float fSum = 0; float fSum = 0;
int j; for( int j=0; j<NUM_TAP_NOTE_SCORES; j++ )
for( j=0; j<NUM_TAP_NOTE_SCORES; j++ )
fSum += dist.fPercent[j]; fSum += dist.fPercent[j];
for( j=0; j<NUM_TAP_NOTE_SCORES; j++ ) for( int j=0; j<NUM_TAP_NOTE_SCORES; j++ )
dist.fPercent[j] /= fSum; dist.fPercent[j] /= fSum;
} }
} }
+14 -18
View File
@@ -41,14 +41,13 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
#define APP( opt ) \ #define APP( opt ) \
fapproach( m_ ## opt, other.m_ ## opt, fDeltaSeconds * other.m_Speed ## opt ); fapproach( m_ ## opt, other.m_ ## opt, fDeltaSeconds * other.m_Speed ## opt );
int i; for( int i=0; i<NUM_ACCELS; i++ )
for( i=0; i<NUM_ACCELS; i++ )
APP( fAccels[i] ); APP( fAccels[i] );
for( i=0; i<NUM_EFFECTS; i++ ) for( int i=0; i<NUM_EFFECTS; i++ )
APP( fEffects[i] ); APP( fEffects[i] );
for( i=0; i<NUM_APPEARANCES; i++ ) for( int i=0; i<NUM_APPEARANCES; i++ )
APP( fAppearances[i] ); APP( fAppearances[i] );
for( i=0; i<NUM_SCROLLS; i++ ) for( int i=0; i<NUM_SCROLLS; i++ )
APP( fScrolls[i] ); APP( fScrolls[i] );
APP( fTimeSpacing ); APP( fTimeSpacing );
APP( fScrollSpeed ); APP( fScrollSpeed );
@@ -316,8 +315,7 @@ void PlayerOptions::FromString( CString sOptions )
void NextFloat( float fValues[], int size ) void NextFloat( float fValues[], int size )
{ {
int index = -1; int index = -1;
int i; for( int i=0; i<size; i++ )
for( i=0; i<size; i++ )
{ {
if( fValues[i] == 1 ) if( fValues[i] == 1 )
{ {
@@ -326,7 +324,7 @@ void NextFloat( float fValues[], int size )
} }
} }
for( i=0; i<size; i++ ) for( int i=0; i<size; i++ )
fValues[i] = 0; fValues[i] = 0;
if( index == size-1 ) // if true, then the last float in the list was selected if( index == size-1 ) // if true, then the last float in the list was selected
@@ -338,8 +336,7 @@ void NextFloat( float fValues[], int size )
void NextBool( bool bValues[], int size ) void NextBool( bool bValues[], int size )
{ {
int index = -1; int index = -1;
int i; for( int i=0; i<size; i++ )
for( i=0; i<size; i++ )
{ {
if( bValues[i] ) if( bValues[i] )
{ {
@@ -348,7 +345,7 @@ void NextBool( bool bValues[], int size )
} }
} }
for( i=0; i<size; i++ ) for( int i=0; i<size; i++ )
bValues[i] = false; bValues[i] = false;
if( index == size-1 ) // if true, then the last float in the list was selected if( index == size-1 ) // if true, then the last float in the list was selected
@@ -520,18 +517,17 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const
COMPARE(m_fSkew); COMPARE(m_fSkew);
COMPARE(m_sPositioning); COMPARE(m_sPositioning);
COMPARE(m_sNoteSkin); COMPARE(m_sNoteSkin);
int i; for( int i = 0; i < PlayerOptions::NUM_ACCELS; ++i )
for( i = 0; i < PlayerOptions::NUM_ACCELS; ++i )
COMPARE(m_fAccels[i]); COMPARE(m_fAccels[i]);
for( i = 0; i < PlayerOptions::NUM_EFFECTS; ++i ) for( int i = 0; i < PlayerOptions::NUM_EFFECTS; ++i )
COMPARE(m_fEffects[i]); COMPARE(m_fEffects[i]);
for( i = 0; i < PlayerOptions::NUM_APPEARANCES; ++i ) for( int i = 0; i < PlayerOptions::NUM_APPEARANCES; ++i )
COMPARE(m_fAppearances[i]); COMPARE(m_fAppearances[i]);
for( i = 0; i < PlayerOptions::NUM_SCROLLS; ++i ) for( int i = 0; i < PlayerOptions::NUM_SCROLLS; ++i )
COMPARE(m_fScrolls[i]); COMPARE(m_fScrolls[i]);
for( i = 0; i < PlayerOptions::NUM_TURNS; ++i ) for( int i = 0; i < PlayerOptions::NUM_TURNS; ++i )
COMPARE(m_bTurns[i]); COMPARE(m_bTurns[i]);
for( i = 0; i < PlayerOptions::NUM_TRANSFORMS; ++i ) for( int i = 0; i < PlayerOptions::NUM_TRANSFORMS; ++i )
COMPARE(m_bTransforms[i]); COMPARE(m_bTransforms[i]);
#undef COMPARE #undef COMPARE
return true; return true;
+3 -4
View File
@@ -97,13 +97,12 @@ void Profile::InitGeneralData()
m_iTotalMines = 0; m_iTotalMines = 0;
m_iTotalHands = 0; m_iTotalHands = 0;
int i; for( int i=0; i<NUM_PLAY_MODES; i++ )
for( i=0; i<NUM_PLAY_MODES; i++ )
m_iNumSongsPlayedByPlayMode[i] = 0; m_iNumSongsPlayedByPlayMode[i] = 0;
m_iNumSongsPlayedByStyle.clear(); m_iNumSongsPlayedByStyle.clear();
for( i=0; i<NUM_DIFFICULTIES; i++ ) for( int i=0; i<NUM_DIFFICULTIES; i++ )
m_iNumSongsPlayedByDifficulty[i] = 0; m_iNumSongsPlayedByDifficulty[i] = 0;
for( i=0; i<MAX_METER+1; i++ ) for( int i=0; i<MAX_METER+1; i++ )
m_iNumSongsPlayedByMeter[i] = 0; m_iNumSongsPlayedByMeter[i] = 0;
ZERO( m_iNumStagesPassedByPlayMode ); ZERO( m_iNumStagesPassedByPlayMode );
ZERO( m_iNumStagesPassedByGrade ); ZERO( m_iNumStagesPassedByGrade );
+2 -3
View File
@@ -141,12 +141,11 @@ void RageDisplay::DrawLineStripInternal( const RageSpriteVertex v[], int iNumVer
/* Draw a line strip with rounded corners using polys. This is used on /* Draw a line strip with rounded corners using polys. This is used on
* cards that have strange allergic reactions to antialiased points and * cards that have strange allergic reactions to antialiased points and
* lines. */ * lines. */
int i; for( int i = 0; i < iNumVerts-1; ++i )
for(i = 0; i < iNumVerts-1; ++i)
DrawPolyLine(v[i], v[i+1], LineWidth); DrawPolyLine(v[i], v[i+1], LineWidth);
/* Join the lines with circles so we get rounded corners. */ /* Join the lines with circles so we get rounded corners. */
for(i = 0; i < iNumVerts; ++i) for( int i = 0; i < iNumVerts; ++i )
DrawCircle( v[i], LineWidth/2 ); DrawCircle( v[i], LineWidth/2 );
} }
+2 -3
View File
@@ -627,8 +627,7 @@ RageFileObj *RageFileManager::OpenForWriting( CString sPath, int mode, RageFile
NormalizePath( sPath ); NormalizePath( sPath );
vector< pair<int,int> > Values; vector< pair<int,int> > Values;
unsigned i; for( unsigned i = 0; i < g_Drivers.size(); ++i )
for( i = 0; i < g_Drivers.size(); ++i )
{ {
LoadedDriver &ld = g_Drivers[i]; LoadedDriver &ld = g_Drivers[i];
const CString path = ld.GetPath( sPath ); const CString path = ld.GetPath( sPath );
@@ -645,7 +644,7 @@ RageFileObj *RageFileManager::OpenForWriting( CString sPath, int mode, RageFile
stable_sort( Values.begin(), Values.end(), SortBySecond ); stable_sort( Values.begin(), Values.end(), SortBySecond );
err = 0; err = 0;
for( i = 0; i < Values.size(); ++i ) for( unsigned i = 0; i < Values.size(); ++i )
{ {
const int driver = Values[i].first; const int driver = Values[i].first;
LoadedDriver &ld = g_Drivers[driver]; LoadedDriver &ld = g_Drivers[driver];
+1 -3
View File
@@ -1112,12 +1112,10 @@ int xing_parse(struct xing *xing, struct mad_bitptr ptr, unsigned int bitlen)
if (xing->flags & XING_TOC) if (xing->flags & XING_TOC)
{ {
int i;
if (bitlen < 800) if (bitlen < 800)
goto fail; goto fail;
for (i = 0; i < 100; ++i) for (int i = 0; i < 100; ++i)
xing->toc[i] = (unsigned char) mad_bit_read(&ptr, 8); xing->toc[i] = (unsigned char) mad_bit_read(&ptr, 8);
bitlen -= 800; bitlen -= 800;
+4 -5
View File
@@ -208,17 +208,16 @@ bool RageSoundReader_WAV::read_adpcm_block_headers( adpcm_t &out ) const
{ {
ADPCMBLOCKHEADER *headers = out.blockheaders; ADPCMBLOCKHEADER *headers = out.blockheaders;
int i; for (int i = 0; i < fmt.wChannels; i++)
for (i = 0; i < fmt.wChannels; i++)
RETURN_IF_MACRO(!read_uint8(rw, &headers[i].bPredictor), false); RETURN_IF_MACRO(!read_uint8(rw, &headers[i].bPredictor), false);
for (i = 0; i < fmt.wChannels; i++) for (int i = 0; i < fmt.wChannels; i++)
RETURN_IF_MACRO(!read_le16(rw, &headers[i].iDelta), false); RETURN_IF_MACRO(!read_le16(rw, &headers[i].iDelta), false);
for (i = 0; i < fmt.wChannels; i++) for (int i = 0; i < fmt.wChannels; i++)
RETURN_IF_MACRO(!read_le16(rw, &headers[i].iSamp[0]), false); RETURN_IF_MACRO(!read_le16(rw, &headers[i].iSamp[0]), false);
for (i = 0; i < fmt.wChannels; i++) for (int i = 0; i < fmt.wChannels; i++)
RETURN_IF_MACRO(!read_le16(rw, &headers[i].iSamp[1]), false); RETURN_IF_MACRO(!read_le16(rw, &headers[i].iSamp[1]), false);
out.samples_left_in_block = out.wSamplesPerBlock; out.samples_left_in_block = out.wSamplesPerBlock;
+1 -2
View File
@@ -445,8 +445,7 @@ void RageMutex::MarkLockedMutex()
vector<const RageMutex *> before; vector<const RageMutex *> before;
/* Iterate over all locked mutexes that are locked by this thread. */ /* Iterate over all locked mutexes that are locked by this thread. */
unsigned i; for( unsigned i = 0; i < g_MutexList->size(); ++i )
for( i = 0; i < g_MutexList->size(); ++i )
{ {
const RageMutex *mutex = (*g_MutexList)[i]; const RageMutex *mutex = (*g_MutexList)[i];
+2 -3
View File
@@ -49,8 +49,7 @@ void Screen::Update( float fDeltaTime )
* This might clear previous messages on the queue. So, first apply time to * This might clear previous messages on the queue. So, first apply time to
* everything. */ * everything. */
unsigned i; for( unsigned i=0; i<m_QueuedMessages.size(); i++ )
for( i=0; i<m_QueuedMessages.size(); i++ )
{ {
/* Hack: /* Hack:
* *
@@ -78,7 +77,7 @@ void Screen::Update( float fDeltaTime )
* within HandleScreenMessage, someone cleared messages on the queue. This * within HandleScreenMessage, someone cleared messages on the queue. This
* means we have no idea where 'i' is, so start over. Since we applied time * means we have no idea where 'i' is, so start over. Since we applied time
* already, this won't cause messages to be mistimed. */ * already, this won't cause messages to be mistimed. */
for( i=0; i<m_QueuedMessages.size(); i++ ) for( unsigned i=0; i<m_QueuedMessages.size(); i++ )
{ {
if( m_QueuedMessages[i].fDelayRemaining > 0.0f ) if( m_QueuedMessages[i].fDelayRemaining > 0.0f )
continue; /* not yet */ continue; /* not yet */
+2 -4
View File
@@ -192,17 +192,15 @@ void ScreenBookkeeping::ChangeView( View newView )
int coins[HOURS_IN_DAY]; int coins[HOURS_IN_DAY];
BOOKKEEPER->GetCoinsByHour( coins ); BOOKKEEPER->GetCoinsByHour( coins );
int i;
CString sTitle1, sData1; CString sTitle1, sData1;
for( i=0; i<HOURS_IN_DAY/2; i++ ) for( int i=0; i<HOURS_IN_DAY/2; i++ )
{ {
sTitle1 += HourInDayToString(i) + "\n"; sTitle1 += HourInDayToString(i) + "\n";
sData1 += ssprintf("%d",coins[i]) + "\n"; sData1 += ssprintf("%d",coins[i]) + "\n";
} }
CString sTitle2, sData2; CString sTitle2, sData2;
for( i=(HOURS_IN_DAY/2); i<HOURS_IN_DAY; i++ ) for( int i=(HOURS_IN_DAY/2); i<HOURS_IN_DAY; i++ )
{ {
sTitle2 += HourInDayToString(i) + "\n"; sTitle2 += HourInDayToString(i) + "\n";
sData2 += ssprintf("%d",coins[i]) + "\n"; sData2 += ssprintf("%d",coins[i]) + "\n";
+1 -3
View File
@@ -713,10 +713,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
if( iCol >= m_NoteFieldEdit.GetNumTracks() ) // this button is not in the range of columns for this Style if( iCol >= m_NoteFieldEdit.GetNumTracks() ) // this button is not in the range of columns for this Style
break; break;
int i;
// check for to see if the user intended to remove a HoldNote // check for to see if the user intended to remove a HoldNote
for( i=0; i<m_NoteFieldEdit.GetNumHoldNotes(); i++ ) // for each HoldNote for( int i=0; i<m_NoteFieldEdit.GetNumHoldNotes(); i++ ) // for each HoldNote
{ {
const HoldNote &hn = m_NoteFieldEdit.GetHoldNote(i); const HoldNote &hn = m_NoteFieldEdit.GetHoldNote(i);
if( iCol == hn.iTrack && // the notes correspond if( iCol == hn.iTrack && // the notes correspond
+4 -6
View File
@@ -241,12 +241,11 @@ void ScreenMiniMenu::AfterAnswerChanged()
int ScreenMiniMenu::GetGoUpSpot() int ScreenMiniMenu::GetGoUpSpot()
{ {
int i; for( int i=m_iCurLine-1; i>=0; i-- )
for( i=m_iCurLine-1; i>=0; i-- )
if( m_Def.rows[i].enabled ) if( m_Def.rows[i].enabled )
return i; return i;
// wrap // wrap
for( i=m_Def.rows.size()-1; i>=0; i-- ) for( int i=m_Def.rows.size()-1; i>=0; i-- )
if( m_Def.rows[i].enabled ) if( m_Def.rows[i].enabled )
return i; return i;
return -1; return -1;
@@ -254,12 +253,11 @@ int ScreenMiniMenu::GetGoUpSpot()
int ScreenMiniMenu::GetGoDownSpot() int ScreenMiniMenu::GetGoDownSpot()
{ {
unsigned i; for( unsigned i=m_iCurLine+1; i<m_Def.rows.size(); i++ )
for( i=m_iCurLine+1; i<m_Def.rows.size(); i++ )
if( m_Def.rows[i].enabled ) if( m_Def.rows[i].enabled )
return i; return i;
// wrap // wrap
for( i=0; i<m_Def.rows.size(); i++ ) for( unsigned i=0; i<m_Def.rows.size(); i++ )
if( m_Def.rows[i].enabled ) if( m_Def.rows[i].enabled )
return i; return i;
return -1; return -1;
+3 -4
View File
@@ -27,8 +27,7 @@ ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : ScreenAttract( sCla
SONGMAN->GetSongs( arraySongs ); SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs ); SongUtil::SortSongPointerArrayByTitle( arraySongs );
unsigned i; for( unsigned i=0; i < arraySongs.size(); i++ )
for( i=0; i < arraySongs.size(); i++ )
{ {
BitmapText *bt = new BitmapText; BitmapText *bt = new BitmapText;
m_textLines.push_back(bt); m_textLines.push_back(bt);
@@ -51,7 +50,7 @@ ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : ScreenAttract( sCla
// m_iNumLines++; // m_iNumLines++;
// } // }
for( i=0; i<m_textLines.size(); i++ ) for( unsigned i=0; i<m_textLines.size(); i++ )
{ {
m_textLines[i]->SetXY( CENTER_X, SCREEN_BOTTOM + 40 ); m_textLines[i]->SetXY( CENTER_X, SCREEN_BOTTOM + 40 );
m_textLines[i]->BeginTweening( SCROLL_DELAY * i ); m_textLines[i]->BeginTweening( SCROLL_DELAY * i );
@@ -63,7 +62,7 @@ ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : ScreenAttract( sCla
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
this->PostScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f ); this->PostScreenMessage( SM_BeginFadingOut, 0.2f * m_textLines.size() + 3.0f );
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
} }
+1 -2
View File
@@ -281,8 +281,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
UpdateSelectionText( p ); UpdateSelectionText( p );
/* Don't tween to the initial position. */ /* Don't tween to the initial position. */
unsigned i; for( unsigned i = 0; i < m_textAlphabet[p].size(); ++i )
for( i = 0; i < m_textAlphabet[p].size(); ++i )
m_textAlphabet[p][i]->FinishTweening(); m_textAlphabet[p][i]->FinishTweening();
} }
} }
+2 -3
View File
@@ -369,7 +369,6 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
UpdateSongsList(); UpdateSongsList();
unsigned i; unsigned i;
for ( i = 0; i < m_vSongs.size(); ++i) for ( i = 0; i < m_vSongs.size(); ++i)
if ( ( !m_vSongs[i]->GetTranslitArtist().CompareNoCase( NSMAN->m_sArtist ) ) && if ( ( !m_vSongs[i]->GetTranslitArtist().CompareNoCase( NSMAN->m_sArtist ) ) &&
( !m_vSongs[i]->GetTranslitMainTitle().CompareNoCase( NSMAN->m_sMainTitle ) ) && ( !m_vSongs[i]->GetTranslitMainTitle().CompareNoCase( NSMAN->m_sMainTitle ) ) &&
@@ -419,7 +418,6 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type ) void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type )
{ {
int i;
m_soundChangeOpt.Play(); m_soundChangeOpt.Play();
switch (m_SelectMode) switch (m_SelectMode)
{ {
@@ -442,6 +440,7 @@ void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type
m_DC[pn] = NUM_DIFFICULTIES; m_DC[pn] = NUM_DIFFICULTIES;
else else
{ {
int i;
for ( i=0; i<(int)MultiSteps.size(); ++i ) for ( i=0; i<(int)MultiSteps.size(); ++i )
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
break; break;
@@ -467,7 +466,6 @@ void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type
void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type ) void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type )
{ {
int i;
m_soundChangeOpt.Play(); m_soundChangeOpt.Play();
switch (m_SelectMode) switch (m_SelectMode)
{ {
@@ -490,6 +488,7 @@ void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type
m_DC[pn] = NUM_DIFFICULTIES; m_DC[pn] = NUM_DIFFICULTIES;
else else
{ {
int i;
for ( i=0; i<(int)MultiSteps.size(); ++i ) for ( i=0; i<(int)MultiSteps.size(); ++i )
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
break; break;
+3 -5
View File
@@ -217,8 +217,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
InputMode im = INPUTMODE_INDIVIDUAL; InputMode im = INPUTMODE_INDIVIDUAL;
bool Explanations = false; bool Explanations = false;
unsigned i; for( unsigned i = 0; i < Flags.size(); ++i )
for( i = 0; i < Flags.size(); ++i )
{ {
Flags[i].MakeLower(); Flags[i].MakeLower();
@@ -239,7 +238,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
} }
m_OptionRowAlloc = new OptionRowData[asLineNames.size()]; m_OptionRowAlloc = new OptionRowData[asLineNames.size()];
for( i = 0; i < asLineNames.size(); ++i ) for( unsigned i = 0; i < asLineNames.size(); ++i )
{ {
CString sLineName = asLineNames[i]; CString sLineName = asLineNames[i];
@@ -494,8 +493,7 @@ void ScreenOptionsMaster::ExportOptions()
int ChangeMask = 0; int ChangeMask = 0;
CHECKPOINT; CHECKPOINT;
unsigned i; for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
for( i = 0; i < OptionRowHandlers.size(); ++i )
{ {
CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) ); CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) );
+2 -3
View File
@@ -406,8 +406,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
/* This player is currently on a choice that is no longer available due to /* This player is currently on a choice that is no longer available due to
* the selection just made. */ * the selection just made. */
int iSwitchToIndex = -1; int iSwitchToIndex = -1;
int i; for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i )
for( i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) ) if( mc.IsPlayable() && !BothPlayersModeChoice(mc) )
@@ -415,7 +414,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
} }
if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */ if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */
{ {
for( i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i ) for( int i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) ) if( mc.IsPlayable() && !BothPlayersModeChoice(mc) )
+3 -6
View File
@@ -34,14 +34,11 @@ ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : ScreenWithMenuEleme
} }
unsigned i;
int j;
vector<Song*> aAllSongs; vector<Song*> aAllSongs;
SONGMAN->GetSongs( aAllSongs ); SONGMAN->GetSongs( aAllSongs );
// Filter out Songs that can't be played by the current Style // Filter out Songs that can't be played by the current Style
for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front for( int j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front
{ {
bool DisplaySong = aAllSongs[j]->NormallyDisplayed(); bool DisplaySong = aAllSongs[j]->NormallyDisplayed();
@@ -57,7 +54,7 @@ ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : ScreenWithMenuEleme
// Add all group names to a map. // Add all group names to a map.
map<CString, CString> mapGroupNames; map<CString, CString> mapGroupNames;
for( i=0; i<aAllSongs.size(); i++ ) for( unsigned i=0; i<aAllSongs.size(); i++ )
{ {
const CString& sGroupName = aAllSongs[i]->m_sGroupName; const CString& sGroupName = aAllSongs[i]->m_sGroupName;
mapGroupNames[ sGroupName ] = ""; // group name maps to nothing mapGroupNames[ sGroupName ] = ""; // group name maps to nothing
@@ -75,7 +72,7 @@ ScreenSelectGroup::ScreenSelectGroup( CString sClassName ) : ScreenWithMenuEleme
{ {
vector<Song*> aSongsInGroup; vector<Song*> aSongsInGroup;
/* find all songs */ /* find all songs */
for( i=0; i<aAllSongs.size(); i++ ) // foreach Song for( unsigned i=0; i<aAllSongs.size(); i++ ) // foreach Song
{ {
/* group 0 gets all songs */ /* group 0 gets all songs */
if( g != 0 && aAllSongs[i]->m_sGroupName != asGroupNames[g] ) if( g != 0 && aAllSongs[i]->m_sGroupName != asGroupNames[g] )
+2 -2
View File
@@ -51,8 +51,8 @@ ScreenSelectMode::ScreenSelectMode( CString sClassName ) : ScreenSelect( sClassN
m_soundModeChange.Load( THEME->GetPathToS("ScreenSelectMode modechange")); m_soundModeChange.Load( THEME->GetPathToS("ScreenSelectMode modechange"));
m_soundConfirm.Load( THEME->GetPathToS("ScreenSelectMode modeconfirm")); m_soundConfirm.Load( THEME->GetPathToS("ScreenSelectMode modeconfirm"));
m_soundStart.Load( THEME->GetPathToS("ScreenSelectMode menustart")); m_soundStart.Load( THEME->GetPathToS("ScreenSelectMode menustart"));
unsigned i;
for( i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aModeChoices.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const ModeChoice& mc = m_aModeChoices[i];
+4 -5
View File
@@ -24,8 +24,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
unsigned i; for( unsigned i=0; i<m_aModeChoices.size(); i++ )
for( i=0; i<m_aModeChoices.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const ModeChoice& mc = m_aModeChoices[i];
@@ -92,9 +91,9 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
// fix Z ordering of Picture and Info so that they draw on top // fix Z ordering of Picture and Info so that they draw on top
for( i=0; i<this->m_aModeChoices.size(); i++ ) for( unsigned i=0; i<this->m_aModeChoices.size(); i++ )
this->MoveToTail( &m_sprPicture[i] ); this->MoveToTail( &m_sprPicture[i] );
for( i=0; i<this->m_aModeChoices.size(); i++ ) for( unsigned i=0; i<this->m_aModeChoices.size(); i++ )
this->MoveToTail( &m_sprInfo[i] ); this->MoveToTail( &m_sprInfo[i] );
@@ -121,7 +120,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
// //
// TweenOnScreen // TweenOnScreen
// //
for( i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aModeChoices.size(); i++ )
{ {
SET_XY_AND_ON_COMMAND( m_textIcon[i] ); SET_XY_AND_ON_COMMAND( m_textIcon[i] );
SET_XY_AND_ON_COMMAND( m_sprIcon[i] ); SET_XY_AND_ON_COMMAND( m_sprIcon[i] );
+5 -6
View File
@@ -44,9 +44,8 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") ); PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left ); PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );
unsigned i;
CString IconCommand = ICON_COMMAND; CString IconCommand = ICON_COMMAND;
for(i=1; i <= NumUnlocks; i++) for( unsigned i=1; i <= NumUnlocks; i++ )
{ {
// get pertaining UnlockEntry // get pertaining UnlockEntry
CString SongTitle = DISPLAYED_SONG(i); CString SongTitle = DISPLAYED_SONG(i);
@@ -100,7 +99,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
else else
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4); SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4);
for(i = 1; i <= NumUnlocks; i++) for(unsigned i = 1; i <= NumUnlocks; i++)
{ {
CString DisplayedSong = DISPLAYED_SONG(i); CString DisplayedSong = DISPLAYED_SONG(i);
if (USE_UNLOCKS_DAT == 1) if (USE_UNLOCKS_DAT == 1)
@@ -221,7 +220,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
float SecondsToScroll = TIME_TO_DISPLAY - 1; float SecondsToScroll = TIME_TO_DISPLAY - 1;
float SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4); float SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4);
for(i=1; i <= UNLOCK_TEXT_SCROLL_ROWS; i++) for(unsigned i=1; i <= UNLOCK_TEXT_SCROLL_ROWS; i++)
{ {
if (i > LastUnlocks.size()) if (i > LastUnlocks.size())
continue; continue;
@@ -284,10 +283,10 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
// which is still greater than 0. By typecasting it as // which is still greater than 0. By typecasting it as
// an integer, you can achieve -1, which exits the loop. // an integer, you can achieve -1, which exits the loop.
for(i = item.size() - 1; (int)i >= 0; i--) for(int i = item.size() - 1; (int)i >= 0; i--)
this->AddChild(item[i]); this->AddChild(item[i]);
for(i = ItemIcons.size() - 1; (int)i >= 0; i--) for(int i = ItemIcons.size() - 1; (int)i >= 0; i--)
this->AddChild(ItemIcons[i]); this->AddChild(ItemIcons[i]);
PointsUntilNextUnlock.SetName( "PointsDisplay" ); PointsUntilNextUnlock.SetName( "PointsDisplay" );
+1 -2
View File
@@ -9,8 +9,7 @@
SnapDisplay::SnapDisplay() SnapDisplay::SnapDisplay()
{ {
int i; for( int i=0; i<2; i++ )
for( i=0; i<2; i++ )
{ {
m_sprIndicators[i].Load( THEME->GetPathToG("SnapDisplay icon 8x1") ); m_sprIndicators[i].Load( THEME->GetPathToG("SnapDisplay icon 8x1") );
// MD 11/12/03 - this assert doesn't allow us to set the editor's maximum // MD 11/12/03 - this assert doesn't allow us to set the editor's maximum
+1 -2
View File
@@ -620,8 +620,7 @@ void Song::TidyUpData()
CStringArray arrayImages; CStringArray arrayImages;
GetImageDirListing( m_sSongDir + "*", arrayImages ); GetImageDirListing( m_sSongDir + "*", arrayImages );
unsigned i; for( unsigned i=0; i<arrayImages.size(); i++ ) // foreach image
for( i=0; i<arrayImages.size(); i++ ) // foreach image
{ {
if( HasBanner() && HasCDTitle() && HasBackground() ) if( HasBanner() && HasCDTitle() && HasBackground() )
break; /* done */ break; /* done */
+4 -7
View File
@@ -296,8 +296,7 @@ void SongManager::PreloadSongImages()
return; return;
const vector<Song*> &songs = SONGMAN->GetAllSongs(); const vector<Song*> &songs = SONGMAN->GetAllSongs();
unsigned i; for( unsigned i = 0; i < songs.size(); ++i )
for( i = 0; i < songs.size(); ++i )
{ {
if( !songs[i]->HasBanner() ) if( !songs[i]->HasBanner() )
continue; continue;
@@ -308,7 +307,7 @@ void SongManager::PreloadSongImages()
vector<Course*> courses; vector<Course*> courses;
SONGMAN->GetAllCourses( courses, false ); SONGMAN->GetAllCourses( courses, false );
for( i = 0; i < courses.size(); ++i ) for( unsigned i = 0; i < courses.size(); ++i )
{ {
if( !courses[i]->HasBanner() ) if( !courses[i]->HasBanner() )
continue; continue;
@@ -506,8 +505,6 @@ int SongManager::GetNumStagesForSong( const Song* pSong )
void SongManager::InitCoursesFromDisk( LoadingWindow *ld ) void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
{ {
unsigned i;
LOG->Trace( "Loading courses." ); LOG->Trace( "Loading courses." );
// //
@@ -515,7 +512,7 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
// //
CStringArray saCourseFiles; CStringArray saCourseFiles;
GetDirListing( COURSES_DIR "*.crs", saCourseFiles, false, true ); GetDirListing( COURSES_DIR "*.crs", saCourseFiles, false, true );
for( i=0; i<saCourseFiles.size(); i++ ) for( unsigned i=0; i<saCourseFiles.size(); i++ )
{ {
Course* pCourse = new Course; Course* pCourse = new Course;
pCourse->LoadFromCRSFile( saCourseFiles[i] ); pCourse->LoadFromCRSFile( saCourseFiles[i] );
@@ -537,7 +534,7 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
GetDirListing( COURSES_DIR "*", arrayGroupDirs, true ); GetDirListing( COURSES_DIR "*", arrayGroupDirs, true );
SortCStringArray( arrayGroupDirs ); SortCStringArray( arrayGroupDirs );
for( i=0; i< arrayGroupDirs.size(); i++ ) // for each dir in /Courses/ for( unsigned i=0; i< arrayGroupDirs.size(); i++ ) // for each dir in /Courses/
{ {
CString sGroupDirName = arrayGroupDirs[i]; CString sGroupDirName = arrayGroupDirs[i];
+2 -3
View File
@@ -145,8 +145,7 @@ void SongUtil::SortSongPointerArrayByGrade( vector<Song*> &arraySongPointers )
vector<val> vals; vector<val> vals;
vals.reserve( arraySongPointers.size() ); vals.reserve( arraySongPointers.size() );
unsigned i; for( unsigned i = 0; i < arraySongPointers.size(); ++i )
for( i = 0; i < arraySongPointers.size(); ++i )
{ {
Song *pSong = arraySongPointers[i]; Song *pSong = arraySongPointers[i];
@@ -162,7 +161,7 @@ void SongUtil::SortSongPointerArrayByGrade( vector<Song*> &arraySongPointers )
sort( vals.begin(), vals.end(), CompDescending ); sort( vals.begin(), vals.end(), CompDescending );
for( i = 0; i < arraySongPointers.size(); ++i ) for( unsigned i = 0; i < arraySongPointers.size(); ++i )
arraySongPointers[i] = vals[i].first; arraySongPointers[i] = vals[i].first;
} }
+2 -3
View File
@@ -121,8 +121,7 @@ void StageStats::AddStats( const StageStats& other )
fLifeRecord[p][fOtherFirstSecond+pos] = life; fLifeRecord[p][fOtherFirstSecond+pos] = life;
} }
unsigned i; for( unsigned i=0; i<other.ComboList[p].size(); ++i )
for( i=0; i<other.ComboList[p].size(); ++i )
{ {
const Combo_t &combo = other.ComboList[p][i]; const Combo_t &combo = other.ComboList[p][i];
@@ -133,7 +132,7 @@ void StageStats::AddStats( const StageStats& other )
/* Merge identical combos. This normally only happens in course mode, when a combo /* Merge identical combos. This normally only happens in course mode, when a combo
* continues between songs. */ * continues between songs. */
for( i=1; i<ComboList[p].size(); ++i ) for( unsigned i=1; i<ComboList[p].size(); ++i )
{ {
Combo_t &prevcombo = ComboList[p][i-1]; Combo_t &prevcombo = ComboList[p][i-1];
Combo_t &combo = ComboList[p][i]; Combo_t &combo = ComboList[p][i];
+2 -3
View File
@@ -216,8 +216,7 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage
m_sCurLanguage = sLanguage; m_sCurLanguage = sLanguage;
// clear theme path cache // clear theme path cache
int i; for( int i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
for( i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
g_ThemePathCache[i].clear(); g_ThemePathCache[i].clear();
g_vThemes.clear(); g_vThemes.clear();
@@ -226,7 +225,7 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage
LoadThemeRecursive( g_vThemes, m_sCurThemeName ); LoadThemeRecursive( g_vThemes, m_sCurThemeName );
CString sMetric; CString sMetric;
for( i = 0; GetCommandlineArgument( "metric", &sMetric, i ); ++i ) for( int i = 0; GetCommandlineArgument( "metric", &sMetric, i ); ++i )
{ {
/* sMetric must be "foo::bar=baz". "foo" and "bar" never contain "=", so in /* sMetric must be "foo::bar=baz". "foo" and "bar" never contain "=", so in
* "foo::bar=1+1=2", "baz" is always "1+1=2". Neither foo nor bar may be * "foo::bar=1+1=2", "baz" is always "1+1=2". Neither foo nor bar may be
+2 -4
View File
@@ -250,9 +250,7 @@ bool UnlockSystem::Load()
return false; return false;
} }
unsigned i; for( unsigned i=0; i<msd.GetNumValues(); i++ )
for( i=0; i<msd.GetNumValues(); i++ )
{ {
int iNumParams = msd.GetNumParams(i); int iNumParams = msd.GetNumParams(i);
const MsdFile::value_t &sParams = msd.GetValue(i); const MsdFile::value_t &sParams = msd.GetValue(i);
@@ -313,7 +311,7 @@ bool UnlockSystem::Load()
UpdateSongs(); UpdateSongs();
for(i=0; i < m_SongEntries.size(); i++) for(unsigned i=0; i < m_SongEntries.size(); i++)
{ {
CString str = ssprintf( "Unlock: %s; ", m_SongEntries[i].m_sSongName.c_str() ); CString str = ssprintf( "Unlock: %s; ", m_SongEntries[i].m_sSongName.c_str() );
for( int j = 0; j < NUM_UNLOCK_TYPES; ++j ) for( int j = 0; j < NUM_UNLOCK_TYPES; ++j )
+4 -14
View File
@@ -154,25 +154,15 @@ XNode::~XNode()
void XNode::Close() void XNode::Close()
{ {
unsigned i; for( unsigned i = 0 ; i < childs.size(); i ++)
for( i = 0 ; i < childs.size(); i ++)
{ {
XNode *p = childs[i]; SAFE_DELETE( childs[i] );
if( p )
{
delete p; childs[i] = NULL;
}
} }
childs.clear(); childs.clear();
for( i = 0 ; i < attrs.size(); i ++) for( unsigned i = 0 ; i < attrs.size(); i ++)
{ {
XAttr *p = attrs[i]; SAFE_DELETE( attrs[i] );
if( p )
{
delete p; attrs[i] = NULL;
}
} }
attrs.clear(); attrs.clear();
} }