From a61a803ced817c472de776687db2e342127a93d1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 8 Jul 2003 23:48:51 +0000 Subject: [PATCH] Please use real names in copyright notices, not aliases. Minor cleanup: Indent of 4. Use ssprintf, not sprintf. Fix warnings. Use SET_XY. --- stepmania/src/ScreenUnlock.cpp | 61 +++++++++++++--------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/stepmania/src/ScreenUnlock.cpp b/stepmania/src/ScreenUnlock.cpp index d4990c9a0e..884ca3524b 100644 --- a/stepmania/src/ScreenUnlock.cpp +++ b/stepmania/src/ScreenUnlock.cpp @@ -19,48 +19,33 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") { - LOG->Trace("ScreenUnlock::ScreenUnlock()"); - PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") ); - PointsUntilNextUnlock.SetHorizAlign( Actor::align_left ); + LOG->Trace("ScreenUnlock::ScreenUnlock()"); + PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") ); + PointsUntilNextUnlock.SetHorizAlign( Actor::align_left ); - CString sDP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->NumPointsUntilNextUnlock() ); + CString sDP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->NumPointsUntilNextUnlock() ); - for(int i=1; i <= THEME->GetMetricI("ScreenUnlock", "NumUnlocks"); i++) - { - // new unlock graphic - char filename[30]; - sprintf(filename, "UnlockGraphic%d", i); - Unlocks[i].Load( THEME->GetPathToG(filename) ); + for(int i=1; i <= THEME->GetMetricI("ScreenUnlock", "NumUnlocks"); i++) + { + // new unlock graphic + Unlocks[i].Load( THEME->GetPathToG(ssprintf("UnlockGraphic%d", i)) ); - sprintf(filename, "Unlock%d", i); + Unlocks[i].SetName( ssprintf("Unlock%d",i) ); + SET_XY( Unlocks[i] ); - PointsUntilNextUnlock.SetXY( - THEME->GetMetricI("ScreenUnlock",ssprintf("Unlock%dX", i)), - THEME->GetMetricI("ScreenUnlock",ssprintf("Unlock%dX", i)) ); + const bool SongIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked + (THEME->GetMetric("ScreenUnlock", ssprintf("Unlock%dSong", i))); + if ( !SongIsLocked ) + this->AddChild(&Unlocks[i]); + } - Unlocks[i].SetName( ssprintf("Unlock%d",i) ); + // No negative numbers + if( sDP.Left(1) == "-" ) + sDP = "*"; - UtilSetXY( Unlocks[i], "ScreenUnlock" ); - - if (!GAMESTATE->m_pUnlockingSys->SongIsLocked - (THEME->GetMetric - ("ScreenUnlock", ssprintf - ("Unlock%dSong", i)))) - this->AddChild(&Unlocks[i]); - } - - /* Remove the decimal - if( sDP.Find(".",1) > 0 ) - { - sDP = sDP.Left(sDP.Find(".",1)); - } no longer necessary since its an int*/ - - // No negative numbers - if( sDP.Left(1) == "-" ) - sDP = "*"; - - PointsUntilNextUnlock.SetText( sDP ); - PointsUntilNextUnlock.SetZoom( THEME->GetMetricF("ScreenUnlock","DancePointsZoom") ); - PointsUntilNextUnlock.SetXY( THEME->GetMetricI("ScreenUnlock","DancePointsDisplayX"), THEME->GetMetricI("ScreenUnlock","DancePointsDisplayY") ); - this->AddChild( &PointsUntilNextUnlock ); + PointsUntilNextUnlock.SetName( "DancePointsDisplay" ); + PointsUntilNextUnlock.SetText( sDP ); + PointsUntilNextUnlock.SetZoom( THEME->GetMetricF("ScreenUnlock","DancePointsZoom") ); + SET_XY( PointsUntilNextUnlock ); + this->AddChild( &PointsUntilNextUnlock ); }