diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index bad0392a3c..225bb93bff 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -28,7 +28,6 @@ SongsX=20 SongsY=20 ColorNotSelected=1,1,1,1 ColorSelected=0.5,1,0.5,1 -GoToCautionOrSelectPlayer=0 SecondsBeforeDemonstration=30 SecondsBetweenAttract=12 HelpText=Use # $ to select, then press START @@ -46,7 +45,7 @@ ControllerP1X=120 ControllerP1Y=280 ControllerP2X=520 ControllerP2Y=280 -HelpText=Press $ on the pad you wish to play on +HelpText=Press $ on the pad to join TimerSeconds=40 NextScreen=ScreenSelectGroup @@ -71,7 +70,15 @@ TimerSeconds=40 NextScreen=ScreenSelectDifficulty [ScreenEz2SelectStyle] -HelpText=Press ! " to change, then press START +CursorP1X=120 +CursorP1Y=280 +CursorP2X=520 +CursorP2Y=280 +ControllerP1X=120 +ControllerP1Y=280 +ControllerP2X=520 +ControllerP2Y=280 +HelpText=Press $ on the pad to join. Press ! " to change styles, then press START TimerSeconds=40 NextScreen=ScreenSelectGroup @@ -324,6 +331,8 @@ TryExtraStageY=424 HelpText=Press START to continue TimerSeconds=40 SpinGrades=1 +GradesGlowColor1=1,1,1,0.2 +GradesGlowColor2=1,1,1,0.8 [ScreenManager] StatsX=632 @@ -391,7 +400,7 @@ HelpText=# $ to change line ! " to select between options then press STAR TimerSeconds=40 [ScreenMapInstruments] -HelpText=Use arrow keys to navigate, ENTER to assign, and SPACE to clear. +HelpText=Use arrow keys to navigate, ENTER to assign, SPACE to clear, ESCAPE when done. [GhostArrow] ShowSeconds=0.25 diff --git a/stepmania/src/AnnouncerManager.cpp b/stepmania/src/AnnouncerManager.cpp index 34f8c631f8..147fdf0195 100644 --- a/stepmania/src/AnnouncerManager.cpp +++ b/stepmania/src/AnnouncerManager.cpp @@ -78,48 +78,15 @@ try_again: #ifdef _DEBUG if( m_sCurAnnouncerName!="" && !DoesFileExist(sPathToFolderCurrent) ) { - int iResult = AfxMessageBox( - ssprintf( - "The current announcer is missing the folder '%s'.\n" - "It may be that these sounds were never implemented in this announcer,\n" - "Or the folder may be misnamed.\n\n" - "Click Abort to break.\n" - "Click Retry after adding the folder menually.\n" - "Click Ignore to to automatically create the folder.\n\n", sFolderName), MB_ABORTRETRYIGNORE ); - switch( iResult ) - { - case IDABORT: - DebugBreak(); - break; - case IDRETRY: - goto try_again; - break; - case IDIGNORE: - CreateDirectory( sPathToFolderCurrent, NULL ); - break; - } + LOG->Trace( "The current announcer is missing the folder '%s'.", sFolderName ); + MessageBeep( MB_OK ); + CreateDirectory( sPathToFolderCurrent, NULL ); } if( !DoesFileExist(sPathToFolderEmpty) ) { - int iResult = AfxMessageBox( - ssprintf( - "The empty announcer is missing the folder '%s'.\n" - "This announcer should have empty folders for every saying.\n\n" - "Click Abort to break.\n" - "Click Retry after adding the folder menually.\n" - "Click Ignore to to automatically create the folder.\n\n", sFolderName), MB_ABORTRETRYIGNORE ); - switch( iResult ) - { - case IDABORT: - DebugBreak(); - break; - case IDRETRY: - goto try_again; - break; - case IDIGNORE: - CreateDirectory( sPathToFolderEmpty, NULL ); - break; - } + LOG->Trace( "The empty announcer is missing the folder '%s'.", sFolderName ); + MessageBeep( MB_OK ); + CreateDirectory( sPathToFolderEmpty, NULL ); } #endif diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 964aecfb84..aeca823ec0 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -298,7 +298,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "dance-single", // m_szName + "Single", // m_szName NOTES_TYPE_DANCE_SINGLE, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX @@ -325,7 +325,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "dance-versus", // m_szName + "Versus", // m_szName NOTES_TYPE_DANCE_SINGLE, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -352,7 +352,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "dance-double", // m_szName + "Double", // m_szName NOTES_TYPE_DANCE_DOUBLE, // m_NotesType StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 320 }, // m_iCenterX @@ -387,7 +387,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "dance-couple", // m_szName + "Couple", // m_szName NOTES_TYPE_DANCE_COUPLE, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -414,7 +414,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "dance-solo", // m_szName + "Solo", // m_szName NOTES_TYPE_DANCE_SOLO, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 320, 320 }, // m_iCenterX @@ -445,7 +445,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit - "dance-edit-couple", // m_szName + "EditCouple", // m_szName NOTES_TYPE_DANCE_COUPLE, // m_NotesType StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 320 }, // m_iCenterX @@ -508,7 +508,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "pump-single", // m_szName + "Single", // m_szName NOTES_TYPE_PUMP_SINGLE, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX @@ -537,7 +537,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "pump-versus", // m_szName + "Versus", // m_szName NOTES_TYPE_PUMP_SINGLE, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -566,7 +566,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "pump-double", // m_szName + "Double", // m_szName NOTES_TYPE_PUMP_DOUBLE, // m_NotesType StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 480 }, // m_iCenterX @@ -636,7 +636,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-single", // m_szName + "Single", // m_szName NOTES_TYPE_EZ2_SINGLE, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX @@ -665,7 +665,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-single-hard", // m_szName + "SingleHard", // m_szName NOTES_TYPE_EZ2_SINGLE_HARD, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX @@ -694,7 +694,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-double", // m_szName + "Double", // m_szName NOTES_TYPE_EZ2_DOUBLE, // m_NotesType StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -733,7 +733,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-real", // m_szName + "Real", // m_szName NOTES_TYPE_EZ2_REAL, // m_NotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX @@ -766,7 +766,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-single-versus", // m_szName + "Versus", // m_szName NOTES_TYPE_EZ2_SINGLE, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -795,7 +795,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-single-hard-versus", // m_szName + "VersusHard", // m_szName NOTES_TYPE_EZ2_SINGLE_HARD, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX @@ -824,7 +824,7 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "ez2-real-versus", // m_szName + "VersusReal", // m_szName NOTES_TYPE_EZ2_REAL, // m_NotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX diff --git a/stepmania/src/GhostArrow.cpp b/stepmania/src/GhostArrow.cpp index fb85e14f29..48896ad07a 100644 --- a/stepmania/src/GhostArrow.cpp +++ b/stepmania/src/GhostArrow.cpp @@ -56,8 +56,6 @@ GhostArrow::GhostArrow() void GhostArrow::Update( float fDeltaTime ) { Sprite::Update( fDeltaTime ); - - printf( "cur state is %d\n", Sprite::m_iCurState ); } void GhostArrow::Step( TapNoteScore score ) diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 4d7a04eddb..7c8bd92c52 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -146,6 +146,7 @@ void MenuElements::TweenTopLayerOffScreen() void MenuElements::TweenOffScreenToMenu( ScreenMessage smSendWhenDone ) { + m_MenuTimer.StopTimer(); TweenTopLayerOffScreen(); m_KeepAlive.CloseWipingRight( smSendWhenDone ); m_soundSwoosh.Play(); @@ -187,6 +188,8 @@ void MenuElements::TweenOnScreenFromBlack( ScreenMessage smSendWhenDone ) void MenuElements::TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPlayBackSound ) { + m_MenuTimer.StopTimer(); + if( !bPlayBackSound ) { TweenTopLayerOffScreen(); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index bcc239ce85..e3417a787d 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -28,84 +28,57 @@ #define BANNER_Y THEME->GetMetricF("ScreenEvaluation","BannerY") #define STAGE_X THEME->GetMetricF("ScreenEvaluation","StageX") #define STAGE_Y THEME->GetMetricF("ScreenEvaluation","StageY") -#define GRADE_P1_X THEME->GetMetricF("ScreenEvaluation","GradeP1X") -#define GRADE_P2_X THEME->GetMetricF("ScreenEvaluation","GradeP2X") +#define GRADE_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("GradeP%dX",p+1)) #define GRADE_Y THEME->GetMetricF("ScreenEvaluation","GradeY") -#define PERCENT_BASE_P1_X THEME->GetMetricF("ScreenEvaluation","PercentBaseP1X") -#define PERCENT_BASE_P2_X THEME->GetMetricF("ScreenEvaluation","PercentBaseP2X") +#define PERCENT_BASE_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("PercentBaseP%dX",p+1)) #define PERCENT_BASE_Y THEME->GetMetricF("ScreenEvaluation","PercentBaseY") #define JUDGE_LABELS_X THEME->GetMetricF("ScreenEvaluation","JudgeLabelsX") -#define PERFECT_P1_X THEME->GetMetricF("ScreenEvaluation","PerfectP1X") -#define PERFECT_P2_X THEME->GetMetricF("ScreenEvaluation","PerfectP2X") +#define PERFECT_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("PerfectP%dX",p+1)) #define PERFECT_Y THEME->GetMetricF("ScreenEvaluation","PerfectY") -#define GREAT_P1_X THEME->GetMetricF("ScreenEvaluation","GreatP1X") -#define GREAT_P2_X THEME->GetMetricF("ScreenEvaluation","GreatP2X") +#define GREAT_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("GreatP%dX",p+1)) #define GREAT_Y THEME->GetMetricF("ScreenEvaluation","GreatY") -#define GOOD_P1_X THEME->GetMetricF("ScreenEvaluation","GoodP1X") -#define GOOD_P2_X THEME->GetMetricF("ScreenEvaluation","GoodP2X") +#define GOOD_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("GoodP%dX",p+1)) #define GOOD_Y THEME->GetMetricF("ScreenEvaluation","GoodY") -#define BOO_P1_X THEME->GetMetricF("ScreenEvaluation","BooP1X") -#define BOO_P2_X THEME->GetMetricF("ScreenEvaluation","BooP2X") +#define BOO_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("BooP%dX",p+1)) #define BOO_Y THEME->GetMetricF("ScreenEvaluation","BooY") -#define MISS_P1_X THEME->GetMetricF("ScreenEvaluation","MissP1X") -#define MISS_P2_X THEME->GetMetricF("ScreenEvaluation","MissP2X") +#define MISS_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("MissP%dX",p+1)) #define MISS_Y THEME->GetMetricF("ScreenEvaluation","MissY") -#define OK_P1_X THEME->GetMetricF("ScreenEvaluation","OKP1X") -#define OK_P2_X THEME->GetMetricF("ScreenEvaluation","OKP2X") +#define OK_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("OKP%dX",p+1)) #define OK_Y THEME->GetMetricF("ScreenEvaluation","OKY") -#define MAX_COMBO_P1_X THEME->GetMetricF("ScreenEvaluation","MaxComboP1X") -#define MAX_COMBO_P2_X THEME->GetMetricF("ScreenEvaluation","MaxComboP2X") +#define MAX_COMBO_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("MaxComboP%dX",p+1)) #define MAX_COMBO_Y THEME->GetMetricF("ScreenEvaluation","MaxComboY") #define SCORE_LABELS_X THEME->GetMetricF("ScreenEvaluation","ScoreLabelsX") -#define SCORE_NUMBERS_P1_X THEME->GetMetricF("ScreenEvaluation","ScoreNumbersP1X") -#define SCORE_NUMBERS_P2_X THEME->GetMetricF("ScreenEvaluation","ScoreNumbersP2X") +#define SCORE_NUMBERS_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("ScoreNumbersP%dX",p+1)) #define SCORE_Y THEME->GetMetricF("ScreenEvaluation","ScoreY") -#define BONUS_P1_X THEME->GetMetricF("ScreenEvaluation","BonusP1X") -#define BONUS_P2_X THEME->GetMetricF("ScreenEvaluation","BonusP2X") +#define BONUS_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("BonusP%dX",p+1)) #define BONUS_Y THEME->GetMetricF("ScreenEvaluation","BonusY") -#define BAR_P1_BASE_X THEME->GetMetricF("ScreenEvaluation","BarP1BaseX") -#define BAR_P2_BASE_X THEME->GetMetricF("ScreenEvaluation","BarP2BaseX") -#define BAR_P1_ROTATION THEME->GetMetricF("ScreenEvaluation","BarP1Rotation") -#define BAR_P2_ROTATION THEME->GetMetricF("ScreenEvaluation","BarP2Rotation") +#define BAR_BASE_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("BarP%dBaseX",p+1)) +#define BAR_ROTATION( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("BarP%dRotation",p+1)) #define BAR_START_Y THEME->GetMetricF("ScreenEvaluation","BarStartY") #define BAR_SPACING_Y THEME->GetMetricF("ScreenEvaluation","BarSpacingY") #define BAR_WIDTH THEME->GetMetricF("ScreenEvaluation","BarWidth") #define BAR_HEIGHT THEME->GetMetricF("ScreenEvaluation","BarHeight") -#define SONGS_SURVIVED_P1_X THEME->GetMetricF("ScreenEvaluation","SongsSurvivedP1X") -#define SONGS_SURVIVED_P2_X THEME->GetMetricF("ScreenEvaluation","SongsSurvivedP2X") +#define SONGS_SURVIVED_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("SongsSurvivedP%dX",p+1)) #define SONGS_SURVIVED_Y THEME->GetMetricF("ScreenEvaluation","SongsSurvivedY") -#define NEW_RECORD_P1_X THEME->GetMetricF("ScreenEvaluation","NewRecordP1X") -#define NEW_RECORD_P2_X THEME->GetMetricF("ScreenEvaluation","NewRecordP2X") +#define NEW_RECORD_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("NewRecordP%dX",p+1)) #define NEW_RECORD_Y THEME->GetMetricF("ScreenEvaluation","NewRecordY") #define TRY_EXTRA_STAGE_X THEME->GetMetricF("ScreenEvaluation","TryExtraStageX") #define TRY_EXTRA_STAGE_Y THEME->GetMetricF("ScreenEvaluation","TryExtraStageY") #define HELP_TEXT THEME->GetMetric("ScreenEvaluation","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenEvaluation","TimerSeconds") #define SPIN_GRADES THEME->GetMetricB("ScreenEvaluation","SpinGrades") +#define GRADES_GLOW_COLOR_1 THEME->GetMetricC("ScreenEvaluation","GradesGlowColor1") +#define GRADES_GLOW_COLOR_2 THEME->GetMetricC("ScreenEvaluation","GradesGlowColor2") -float GRADE_X( int p ) { - switch( p ) { - case PLAYER_1: return GRADE_P1_X; - case PLAYER_2: return GRADE_P2_X; - default: ASSERT(0); return 0; - } -} -float PERCENT_BASE_X( int p ) { - switch( p ) { - case PLAYER_1: return PERCENT_BASE_P1_X; - case PLAYER_2: return PERCENT_BASE_P2_X; - default: ASSERT(0); return 0; - } -} float JUDGE_X( int p, int l ) { switch( l ) { - case 0: return p==PLAYER_1 ? PERFECT_P1_X : PERFECT_P2_X; - case 1: return p==PLAYER_1 ? GREAT_P1_X : GREAT_P2_X; - case 2: return p==PLAYER_1 ? GOOD_P1_X : GOOD_P2_X; - case 3: return p==PLAYER_1 ? BOO_P1_X : BOO_P2_X; - case 4: return p==PLAYER_1 ? MISS_P1_X : MISS_P2_X; - case 5: return p==PLAYER_1 ? OK_P1_X : OK_P2_X; - case 6: return p==PLAYER_1 ? MAX_COMBO_P1_X : MAX_COMBO_P2_X; + case 0: return PERFECT_X(p); + case 1: return GREAT_X(p); + case 2: return GOOD_X(p); + case 3: return BOO_X(p); + case 4: return MISS_X(p); + case 5: return OK_X(p); + case 6: return MAX_COMBO_X(p); default: ASSERT(0); return 0; } } @@ -121,48 +94,6 @@ float JUDGE_Y( int l ) { default: ASSERT(0); return 0; } } -float SCORE_NUMBERS_X( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_NUMBERS_P1_X; - case PLAYER_2: return SCORE_NUMBERS_P2_X; - default: ASSERT(0); return 0; - } -} -float BONUS_X( int p ) { - switch( p ) { - case PLAYER_1: return BONUS_P1_X; - case PLAYER_2: return BONUS_P2_X; - default: ASSERT(0); return 0; - } -} -float BAR_BASE_X( int p ) { - switch( p ) { - case PLAYER_1: return BAR_P1_BASE_X; - case PLAYER_2: return BAR_P2_BASE_X; - default: ASSERT(0); return 0; - } -} -float BAR_ROTATION( int p ) { - switch( p ) { - case PLAYER_1: return BAR_P1_ROTATION; - case PLAYER_2: return BAR_P2_ROTATION; - default: ASSERT(0); return 0; - } -} -float SONGS_SURVIVED_X( int p ) { - switch( p ) { - case PLAYER_1: return SONGS_SURVIVED_P1_X; - case PLAYER_2: return SONGS_SURVIVED_P2_X; - default: ASSERT(0); return 0; - } -} -float NEW_RECORD_X( int p ) { - switch( p ) { - case PLAYER_1: return NEW_RECORD_P1_X; - case PLAYER_2: return NEW_RECORD_P2_X; - default: ASSERT(0); return 0; - } -} const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+1); const ScreenMessage SM_GoToSelectCourse = ScreenMessage(SM_User+2); @@ -539,7 +470,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_Grades[p].SetXY( GRADE_X(p), GRADE_Y ); m_Grades[p].SetZ( -2 ); m_Grades[p].SetZoom( 1.0f ); - m_Grades[p].SetEffectGlowing( 1.0f ); + m_Grades[p].SetEffectGlowing( 1.0f, GRADES_GLOW_COLOR_1, GRADES_GLOW_COLOR_2 ); if( SPIN_GRADES ) m_Grades[p].SpinAndSettleOn( grade[p] ); else diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index fccc791b70..25b674de36 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -27,46 +27,14 @@ const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2); -#define CURSOR_P1_X THEME->GetMetricF("ScreenEz2SelectPlayer","CursorP1X") -#define CURSOR_P1_Y THEME->GetMetricF("ScreenEz2SelectPlayer","CursorP1Y") -#define CURSOR_P2_X THEME->GetMetricF("ScreenEz2SelectPlayer","CursorP2X") -#define CURSOR_P2_Y THEME->GetMetricF("ScreenEz2SelectPlayer","CursorP2Y") -#define CONTROLLER_P1_X THEME->GetMetricF("ScreenEz2SelectPlayer","ControllerP1X") -#define CONTROLLER_P1_Y THEME->GetMetricF("ScreenEz2SelectPlayer","ControllerP1Y") -#define CONTROLLER_P2_X THEME->GetMetricF("ScreenEz2SelectPlayer","ControllerP2X") -#define CONTROLLER_P2_Y THEME->GetMetricF("ScreenEz2SelectPlayer","ControllerP2Y") +#define CURSOR_X( p ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("CursorP%dX",p+1)) +#define CURSOR_Y( i ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("CursorP%dY",i+1)) +#define CONTROLLER_X( p ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("ControllerP%dX",p+1)) +#define CONTROLLER_Y( i ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("ControllerP%dY",i+1)) #define HELP_TEXT THEME->GetMetric("ScreenEz2SelectPlayer","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectPlayer","TimerSeconds") #define NEXT_SCREEN THEME->GetMetric("ScreenEz2SelectPlayer","NextScreen") -float CURSOR_X( int p ) { - switch( p ) { - case PLAYER_1: return CURSOR_P1_X; - case PLAYER_2: return CURSOR_P2_X; - default: ASSERT(0); return 0; - } -} -float CURSOR_Y( int p ) { - switch( p ) { - case PLAYER_1: return CURSOR_P1_Y; - case PLAYER_2: return CURSOR_P2_Y; - default: ASSERT(0); return 0; - } -} -float CONTROLLER_X( int p ) { - switch( p ) { - case PLAYER_1: return CONTROLLER_P1_X; - case PLAYER_2: return CONTROLLER_P2_X; - default: ASSERT(0); return 0; - } -} -float CONTROLLER_Y( int p ) { - switch( p ) { - case PLAYER_1: return CONTROLLER_P1_Y; - case PLAYER_2: return CONTROLLER_P2_Y; - default: ASSERT(0); return 0; - } -} const float TWEEN_TIME = 0.35f; @@ -235,7 +203,7 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p ) GAMESTATE->m_bSideIsJoined[p] = true; SCREENMAN->RefreshCreditsMessages(); - m_soundSelect.PlayRandom(); + m_soundSelect.Play(); m_sprCursors[p].BeginTweening( 0.25f ); m_sprCursors[p].SetTweenZoomY( 0 ); m_sprControllers[p].BeginTweening( 0.25f ); @@ -254,7 +222,7 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p ) else { // give the other player a little time to join - m_Menu.SetTimer( 5 ); + m_Menu.SetTimer( 3 ); m_Menu.StartTimer(); } } diff --git a/stepmania/src/ScreenEz2SelectPlayer.h b/stepmania/src/ScreenEz2SelectPlayer.h index 90e5ac0aa7..913db110ee 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.h +++ b/stepmania/src/ScreenEz2SelectPlayer.h @@ -9,11 +9,7 @@ Andrew Livy #include "Screen.h" #include "Sprite.h" -#include "BitmapText.h" -#include "TransitionFade.h" -#include "Quad.h" -#include "RandomSample.h" -#include "Quad.h" +#include "RageSoundSample.h" #include "MenuElements.h" @@ -42,5 +38,5 @@ private: MenuElements m_Menu; - RandomSample m_soundSelect; + RageSoundSample m_soundSelect; }; diff --git a/stepmania/src/ScreenEz2SelectStyle.cpp b/stepmania/src/ScreenEz2SelectStyle.cpp index d19f9fd3d0..670966abab 100644 --- a/stepmania/src/ScreenEz2SelectStyle.cpp +++ b/stepmania/src/ScreenEz2SelectStyle.cpp @@ -4,9 +4,6 @@ ScreenEzSelectPlayer,cpp Desc: See Header Copyright (C): Andrew Livy - -NOTES: Although cleaner, can still do with -a polish :) *****************************************/ /* Includes */ @@ -20,51 +17,29 @@ a polish :) #include "GameManager.h" #include "RageLog.h" #include "AnnouncerManager.h" -#include "GameConstantsAndTypes.h" -#include "Background.h" #include "GameState.h" #include "RageException.h" #include "RageTimer.h" +#include "GameState.h" /* Constants */ -#define HELP_TEXT THEME->GetMetric("ScreenEz2SelectStyle","HelpText") -#define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectStyle","TimerSeconds") -#define NEXT_SCREEN THEME->GetMetric("ScreenEz2SelectStyle","NextScreen") - - const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2); -enum DStyles { - DS_EASY, - DS_HARD, - DS_REAL, - DS_CLUB -}; - -const float OPT_X[NUM_EZ2STYLE_GRAPHICS] = { - CENTER_X+200, // This is the pad X - CENTER_X-200, // This is the pad X - CENTER_X-198, // This is the 1p X - CENTER_X+195, // This is the 2p X -}; // tells us the default X position -const float OPT_Y[NUM_EZ2STYLE_GRAPHICS] = { - CENTER_Y+130, - CENTER_Y+130, - CENTER_Y+115, - CENTER_Y+115, -}; // tells us the default Y position +#define CURSOR_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dX",p+1)) +#define CURSOR_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dY",i+1)) +#define CONTROLLER_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dX",p+1)) +#define CONTROLLER_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dY",i+1)) +#define HELP_TEXT THEME->GetMetric("ScreenEz2SelectStyle","HelpText") +#define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectStyle","TimerSeconds") +#define NEXT_SCREEN THEME->GetMetric("ScreenEz2SelectStyle","NextScreen") const float TWEEN_TIME = 0.35f; -float ez2p_lasttimercheck[2]; -int ez2p_bounce=0; // used for the bouncing of the '1p' and '2p' images -int ez2p_direct=0; // direction of the bouncing of the '1p' and '2p' images - /************************************ ScreenEz2SelectStyle (Constructor) Desc: Sets up the screen display @@ -74,76 +49,30 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle() { LOG->Trace( "ScreenEz2SelectStyle::ScreenEz2SelectStyle()" ); - m_iSelectedStyle=DS_EASY; // start on EASY + + GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; // the only mode you can select on this screen - // Load in the sprites we will be working with. - for( int i=0; iAddSubActor( &m_ScrollingList ); + + for( int p=0; pGetPathTo("Graphics",ssprintf("select style preview game %d style %d",GAMESTATE->m_CurGame,i)) ); - m_sprBackground[i].SetXY( CENTER_X, CENTER_Y ); - m_sprBackground[i].SetZoom( 1 ); - this->AddSubActor( &m_sprBackground[i] ); - } - - /* Setup The 1Player Scrolling List */ - m_ScrList.SetNumberVisibleElements( 3 ); - m_ScrList.CreateNewElement( "select style info game 2 style 1" ); - m_ScrList.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList.CreateNewElement( "select style info game 2 style 3" ); - m_ScrList.CreateNewElement( "select style info game 2 style 0" ); // Excess so that the user is tricked into thinking - m_ScrList.CreateNewElement( "select style info game 2 style 1" ); // the list is infinite - m_ScrList.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList.CreateNewElement( "select style info game 2 style 3" ); - m_ScrList.CreateNewElement( "select style info game 2 style 0" ); - m_ScrList.CreateNewElement( "select style info game 2 style 1" ); - m_ScrList.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList.CreateNewElement( "select style info game 2 style 3" ); - m_ScrList.CreateNewElement( "select style info game 2 style 0" ); - m_ScrList.SetXY(CENTER_X, CENTER_Y); - m_ScrList.SetCurrentPosition( DS_EASY ); - - /* Setup the 2Player Scrolling List */ - m_ScrList_2ply.SetNumberVisibleElements( 3 ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 1" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 3" ); // Excess so that the user is tricked into thinking - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 1" ); // the list is infinite - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 3" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 1" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 2" ); - m_ScrList_2ply.CreateNewElement( "select style info game 2 style 3" ); - m_ScrList_2ply.SetXY(CENTER_X, CENTER_Y); - m_ScrList_2ply.SetCurrentPosition( DS_EASY ); - - this->AddSubActor( &m_ScrList ); - this->AddSubActor( &m_ScrList_2ply ); - - // figure out on load which list we should put up. - if (GAMESTATE->m_CurStyle == STYLE_EZ2_SINGLE_VERSUS) // if we are using two players - { - m_ScrList.SetZoom( 0 ); // Hide the list for just 1 player - } - else - { - m_ScrList_2ply.SetZoom( 0 ); // Otherwise hide the 2 player list. - } - -// Load in the sprites we will be working with. - for( i=0; iGetPathTo("Graphics",sOptFileName) ); - m_sprOpt[i].SetXY( OPT_X[i], OPT_Y[i] ); - this->AddSubActor( &m_sprOpt[i] ); + if( GAMESTATE->m_bSideIsJoined[p] ) // if side is already joined + continue; // don't show bobbing join and blob + + m_sprControllers[p].Load( THEME->GetPathTo("Graphics","select player controller") ); + m_sprControllers[p].SetXY( CONTROLLER_X(p), CONTROLLER_Y(p) ); + this->AddSubActor( &m_sprControllers[p] ); + + m_sprCursors[p].Load( THEME->GetPathTo("Graphics",ssprintf("select player cursor p%d",p+1)) ); + m_sprCursors[p].SetXY( CURSOR_X(p), CURSOR_Y(p) ); + m_sprCursors[p].SetEffectBouncing( D3DXVECTOR3(0,10,0), 0.5f ); + this->AddSubActor( &m_sprCursors[p] ); } + m_Menu.Load( THEME->GetPathTo("Graphics","select style background"), @@ -153,11 +82,15 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle() this->AddSubActor( &m_Menu ); m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") ); + m_soundChange.Load( THEME->GetPathTo("Sounds","select style change") ); - GAMESTATE->m_bPlayersCanJoin = true; + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style intro") ); MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","select style music") ); + RefreshStylesAndList(); + + TweenOnScreen(); m_Menu.TweenOnScreenFromBlack( SM_None ); } @@ -171,6 +104,14 @@ ScreenEz2SelectStyle::~ScreenEz2SelectStyle() LOG->Trace( "ScreenEz2SelectStyle::~ScreenEz2SelectStyle()" ); } +/************************************ +Update +Desc: Animates the 1p/2p selection +************************************/ +void ScreenEz2SelectStyle::Update( float fDeltaTime ) +{ + Screen::Update( fDeltaTime ); +} /************************************ DrawPrimitives @@ -179,17 +120,9 @@ Desc: Draws the screen =P void ScreenEz2SelectStyle::DrawPrimitives() { -/* if (m_iSelectedPlayer != 2) // no need to animate graphics if we have no graphics to animate ;) - { - AnimateGraphics(); - } -*/ - AnimateBackground(); - m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); m_Menu.DrawTopLayer(); - } /************************************ @@ -218,9 +151,21 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_MenuTimer: - m_soundSelect.PlayRandom(); - GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; - this->SendScreenMessage( SM_GoToNextScreen, 0 ); + { + bool bAtLeastOneJoined = false; + for( int p=0; pm_bSideIsJoined[p] ) + bAtLeastOneJoined = true; + + if( !bAtLeastOneJoined ) + { + MenuStart(PLAYER_1); + m_Menu.StopTimer(); + } + + TweenOffScreen(); + m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen ); + } break; case SM_GoToPrevScreen: MUSIC->Stop(); @@ -232,23 +177,72 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM ) } } +void ScreenEz2SelectStyle::RefreshStylesAndList() +{ + GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles ); + ASSERT( m_aPossibleStyles.GetSize() > 0 ); // every game should have at least one Style, or else why have the Game? :-) + + // strip out Styles that don't work for the current number of players + int iNumSidesJoined = 0; + for( int c=0; c<2; c++ ) + if( GAMESTATE->m_bSideIsJoined[c] ) + iNumSidesJoined++; // left side, and right side + + for( int i=m_aPossibleStyles.GetSize()-1; i>=0; i-- ) + { + Style style = m_aPossibleStyles[i]; + + switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType ) + { + case StyleDef::ONE_PLAYER_ONE_CREDIT: + if( iNumSidesJoined!=1 ) + m_aPossibleStyles.RemoveAt( i ); + break; + case StyleDef::ONE_PLAYER_TWO_CREDITS: + case StyleDef::TWO_PLAYERS_TWO_CREDITS: + if( iNumSidesJoined!=2 ) + m_aPossibleStyles.RemoveAt( i ); + break; + default: ASSERT(0); + } + } + + CStringArray asGraphicPaths; + for( int i=0; iGetCurrentGameDef()->m_szName; + CString sStyleName = GAMEMAN->GetStyleDefForStyle(style)->m_szName; + + asGraphicPaths.Add( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",sGameName,sStyleName)) ); + } + m_ScrollingList.Load( asGraphicPaths ); +} /************************************ MenuBack Desc: Actions performed when a player presses the button bound to back ************************************/ - void ScreenEz2SelectStyle::MenuBack( PlayerNumber p ) { MUSIC->Stop(); m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true ); - GAMESTATE->m_CurStyle = STYLE_NONE; // Make sure that both players can scroll around title menu... +} -// m_Fade.CloseWipingLeft( SM_GoToPrevScreen ); -// TweenOffScreen(); + +void ScreenEz2SelectStyle::MenuLeft( PlayerNumber p ) +{ + m_ScrollingList.Left(); + m_soundChange.Play(); +} + +void ScreenEz2SelectStyle::MenuRight( PlayerNumber p ) +{ + m_ScrollingList.Right(); + m_soundChange.Play(); } /************************************ @@ -256,65 +250,12 @@ MenuDown Desc: Actions performed when a player presses the button bound to down ************************************/ - void ScreenEz2SelectStyle::MenuDown( PlayerNumber p ) { - MenuStart(p); -} + if( GAMESTATE->m_bSideIsJoined[p] ) // already joined + return; // ignore - -/************************************ -SetFadedStyles -Desc: Fades out non-highlighted items -depending on the users choice. -************************************/ -void ScreenEz2SelectStyle::SetFadedStyles() -{ - -} - -/************************************ -MenuRight -Desc: Actions performed when a player -presses the button bound to right -************************************/ -void ScreenEz2SelectStyle::MenuRight( PlayerNumber p ) -{ - m_ScrList.ShiftRight(); - if (m_iSelectedStyle == 3) // wrap around - m_iSelectedStyle = 0; - else - m_iSelectedStyle++; - - switch (m_iSelectedStyle) - { - case DS_EASY: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE; break; - case DS_HARD: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_HARD; break; - case DS_REAL: GAMESTATE->m_CurStyle = STYLE_EZ2_REAL; break; - case DS_CLUB: GAMESTATE->m_CurStyle = STYLE_EZ2_DOUBLE; break; - } -} - -/************************************ -MenuLeft -Desc: Actions performed when a player -presses the button bound to left -************************************/ -void ScreenEz2SelectStyle::MenuLeft( PlayerNumber p ) -{ - m_ScrList.ShiftLeft(); - if (m_iSelectedStyle == 0) // wrap around - m_iSelectedStyle = 3; - else - m_iSelectedStyle--; - - switch (m_iSelectedStyle) - { - case DS_EASY: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE; break; - case DS_HARD: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_HARD; break; - case DS_REAL: GAMESTATE->m_CurStyle = STYLE_EZ2_REAL; break; - case DS_CLUB: GAMESTATE->m_CurStyle = STYLE_EZ2_DOUBLE; break; - } + MenuStart( p ); } /************************************ @@ -324,157 +265,66 @@ presses the button bound to start ************************************/ void ScreenEz2SelectStyle::MenuStart( PlayerNumber p ) { - -// if( p!=PLAYER_INVALID && !GAMESTATE->m_bIsJoined[p] ) -// { -// SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu start") ); -// GAMESTATE->m_bIsJoined[p] = true; -// SCREENMAN->RefreshCreditsMessages(); -// m_soundSelect.PlayRandom(); -// return; // don't fall through -// } - - m_soundSelect.PlayRandom(); - this->ClearMessageQueue(); - GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; -// GAMESTATE->m_bPlayersCanJoin = false; - - CString sCurStyleName = GAMESTATE->GetCurrentStyleDef()->m_szName; - sCurStyleName.MakeLower(); - if( -1!=sCurStyleName.Find("single") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment single") ); - else if( -1!=sCurStyleName.Find("versus") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment versus") ); - else if( -1!=sCurStyleName.Find("double") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment double") ); - else if( -1!=sCurStyleName.Find("couple") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment couple") ); - else if( -1!=sCurStyleName.Find("solo") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment solo") ); - - - m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen ); + if( !GAMESTATE->m_bSideIsJoined[p] ) + { + // join them + GAMESTATE->m_bSideIsJoined[p] = true; + SCREENMAN->RefreshCreditsMessages(); + m_soundSelect.Play(); + m_sprCursors[p].BeginTweening( 0.25f ); + m_sprCursors[p].SetTweenZoomY( 0 ); + m_sprControllers[p].BeginTweening( 0.25f ); + m_sprControllers[p].SetTweenZoomY( 0 ); + + RefreshStylesAndList(); + m_ScrollingList.SetSelection( 0 ); + } + else + { + // made a selection + m_soundSelect.Play(); + GAMESTATE->m_CurStyle = m_aPossibleStyles[m_ScrollingList.GetSelection()]; + TweenOffScreen(); + m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen ); + } +} + +void ScreenEz2SelectStyle::TweenOnScreen() +{ + float fOriginalZoomY = m_ScrollingList.GetZoomY(); + m_ScrollingList.BeginTweening( 0.5f ); + m_ScrollingList.SetTweenZoomY( fOriginalZoomY ); + + for( int p=0; pGetTimeSinceStart() > ez2p_lasttimercheck[0] + 0.01f && ez2p_direct == 0) - { - ez2p_lasttimercheck[0] = TIMER->GetTimeSinceStart(); - ez2p_bounce+=1; - - m_sprPly[2].SetXY( OPT_XP[2], OPT_YP[2] - ez2p_bounce); - m_sprPly[3].SetXY( OPT_XP[3], OPT_YP[3] - ez2p_bounce); - - - if (ez2p_bounce == 10) - { - ez2p_direct = 1; - } - } - else if (TIMER->GetTimeSinceStart() > ez2p_lasttimercheck[0] + 0.01f && ez2p_direct == 1) // bounce 1p/2p down - { - ez2p_lasttimercheck[0] = TIMER->GetTimeSinceStart(); - ez2p_bounce-=1; - - m_sprPly[2].SetXY( OPT_XP[2], OPT_YP[2] - ez2p_bounce); - m_sprPly[3].SetXY( OPT_XP[3], OPT_YP[3] - ez2p_bounce); - - if (ez2p_bounce == 0) - { - ez2p_direct = 0; - } - } -*/ -} - -/************************************ -AnimateBackground -Desc: Animates the Background -************************************/ -void ScreenEz2SelectStyle::AnimateBackground() -{ - if ((m_iSelectedStyle == 0) || (m_iSelectedPlayer == 2 && m_iSelectedStyle == 3)) // EASY background - { - m_sprBackground[3].SetHeight(SCREEN_HEIGHT * 1.7f); - m_sprBackground[3].SetWidth(SCREEN_WIDTH * 1.7f); - m_sprBackground[3].SetEffectSpinning(1.0f); - } - else if (m_iSelectedStyle == 3 && m_iSelectedPlayer != 2) // CLUB background - { - m_sprBackground[3].SetHeight(0); - m_sprBackground[3].SetWidth(0); - m_sprBackground[3].SetEffectNone(); - m_sprBackground[2].SetHeight(SCREEN_HEIGHT * 3.3f); - m_sprBackground[2].SetWidth(SCREEN_WIDTH * 3.3f); - m_sprBackground[2].SetEffectSpinning(0.5f); - m_sprBackground[2].SetXY( CENTER_X, -250 ); - } - else if (m_iSelectedStyle == 2) // REAL background - { - m_sprBackground[3].SetHeight(0); - m_sprBackground[3].SetWidth(0); - m_sprBackground[3].SetEffectNone(); - m_sprBackground[2].SetHeight(0); - m_sprBackground[2].SetWidth(0); - m_sprBackground[2].SetEffectNone(); - m_sprBackground[1].SetHeight(SCREEN_HEIGHT * 1.7f); - m_sprBackground[1].SetWidth(SCREEN_WIDTH * 1.7f); - m_sprBackground[1].SetEffectSpinning(2.1f); - } - else if (m_iSelectedStyle == 1) // HARD background - { - m_sprBackground[3].SetHeight(0); - m_sprBackground[3].SetWidth(0); - m_sprBackground[3].SetEffectNone(); - m_sprBackground[2].SetHeight(0); - m_sprBackground[2].SetWidth(0); - m_sprBackground[2].SetEffectNone(); - m_sprBackground[1].SetHeight(0); - m_sprBackground[1].SetWidth(0); - m_sprBackground[1].SetEffectNone(); - m_sprBackground[0].SetHeight(SCREEN_HEIGHT * 1.7f); - m_sprBackground[0].SetWidth(SCREEN_WIDTH * 1.7f); - m_sprBackground[0].SetEffectSpinning(1.0f); - } - -} - -/************************************ -Update -Desc: Animates the 1p/2p selection -************************************/ -void ScreenEz2SelectStyle::Update( float fDeltaTime ) -{ - Screen::Update( fDeltaTime ); - - fDeltaTime /= .01f; - - ez2_bounce = fmodf((ez2_bounce+fDeltaTime), 20); - - /* 0..10..19 -> 10..0..9 */ - int offset = abs(10-int(ez2_bounce)); - m_sprOpt[2].SetXY( OPT_X[2], OPT_Y[2] - offset); - m_sprOpt[3].SetXY( OPT_X[3], OPT_Y[3] - offset); -} - -/************************************ -TweenPlyOffScreen -Desc: Squashes Player Graphics off screen -When selected. -************************************/ -void ScreenEz2SelectStyle::TweenPlyOffScreen() -{ - -} \ No newline at end of file diff --git a/stepmania/src/ScreenEz2SelectStyle.h b/stepmania/src/ScreenEz2SelectStyle.h index 1be2b9827a..7331d944b2 100644 --- a/stepmania/src/ScreenEz2SelectStyle.h +++ b/stepmania/src/ScreenEz2SelectStyle.h @@ -20,8 +20,6 @@ Andrew Livy /* Class Definition */ - const int NUM_EZ2STYLE_GRAPHICS = 4; -// const int NUM_EZ2P_GRAPHICS = 4; class ScreenEz2SelectStyle : public Screen { @@ -30,6 +28,7 @@ public: virtual ~ScreenEz2SelectStyle(); // Destructor /* Public Function Prototypes */ + virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); @@ -39,35 +38,22 @@ public: void MenuStart( PlayerNumber p ); void MenuBack( PlayerNumber p ); void MenuDown( PlayerNumber p ); + +protected: void TweenOffScreen(); - void TweenPlyOffScreen(); + void TweenOnScreen(); + + Sprite m_sprCursors[NUM_PLAYERS]; + Sprite m_sprControllers[NUM_PLAYERS]; -private: - /* Private Function Prototypes */ + CArray m_aPossibleStyles; + ScrollingList m_ScrollingList; + void RefreshStylesAndList(); - void Update( float fDeltaTime ); - void AnimateGraphics(); - void AnimateBackground(); - // void BeforeChange(); - void SetFadedStyles(); -// void AnimateGraphics(); - /* Variable Declarations */ + Sprite m_sprBackgrounds[NUM_STYLES]; MenuElements m_Menu; - Sprite m_sprOpt[NUM_EZ2STYLE_GRAPHICS]; -// Sprite m_sprPly[NUM_EZ2P_GRAPHICS]; - Sprite m_sprBackground[NUM_EZ2STYLE_GRAPHICS]; - // used for the bouncing of the '1p' and '2p' images - float ez2_bounce; - - ScrollingList m_ScrList; - ScrollingList m_ScrList_2ply; - - int m_iSelectedStyle; - int m_iSelectedPlayer; - RandomSample m_soundChange; - RandomSample m_soundSelect; - RandomSample m_soundInvalid; -protected: + RageSoundSample m_soundSelect; + RageSoundSample m_soundChange; }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index d4796be98f..20d195e800 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -32,53 +32,25 @@ // #define TOP_FRAME_X THEME->GetMetricF("ScreenGameplay","TopFrameX") -#define TOP_FRAME_Y THEME->GetMetricF("ScreenGameplay","TopFrameY") -#define TOP_FRAME_EXTRA_Y THEME->GetMetricF("ScreenGameplay","TopFrameExtraY") +#define TOP_FRAME_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("TopFrame%sY",e?"Extra":"")) #define BOTTOM_FRAME_X THEME->GetMetricF("ScreenGameplay","BottomFrameX") -#define BOTTOM_FRAME_Y THEME->GetMetricF("ScreenGameplay","BottomFrameY") -#define BOTTOM_FRAME_EXTRA_Y THEME->GetMetricF("ScreenGameplay","BottomFrameExtraY") +#define BOTTOM_FRAME_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("BottomFrame%sY",e?"Extra":"")) #define MIDDLE_FRAME_X THEME->GetMetricF("ScreenGameplay","MiddleFrameX") #define MIDDLE_FRAME_Y THEME->GetMetricF("ScreenGameplay","MiddleFrameY") -#define LIFE_P1_X THEME->GetMetricF("ScreenGameplay","LifeP1X") -#define LIFE_P1_Y THEME->GetMetricF("ScreenGameplay","LifeP1Y") -#define LIFE_P1_EXTRA_Y THEME->GetMetricF("ScreenGameplay","LifeP1ExtraY") -#define LIFE_P2_X THEME->GetMetricF("ScreenGameplay","LifeP2X") -#define LIFE_P2_Y THEME->GetMetricF("ScreenGameplay","LifeP2Y") -#define LIFE_P2_EXTRA_Y THEME->GetMetricF("ScreenGameplay","LifeP2ExtraY") +#define LIFE_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("LifeP%dX",p+1)) +#define LIFE_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("LifeP%d%sY",p+1,e?"Extra":"")) #define STAGE_X THEME->GetMetricF("ScreenGameplay","StageX") -#define STAGE_Y THEME->GetMetricF("ScreenGameplay","StageY") -#define STAGE_EXTRA_Y THEME->GetMetricF("ScreenGameplay","StageExtraY") -#define SONG_NUMBER_P1_X THEME->GetMetricF("ScreenGameplay","SongNumberP1X") -#define SONG_NUMBER_P1_Y THEME->GetMetricF("ScreenGameplay","SongNumberP1Y") -#define SONG_NUMBER_P1_EXTRA_Y THEME->GetMetricF("ScreenGameplay","SongNumberP1ExtraY") -#define SONG_NUMBER_P2_X THEME->GetMetricF("ScreenGameplay","SongNumberP2X") -#define SONG_NUMBER_P2_Y THEME->GetMetricF("ScreenGameplay","SongNumberP2Y") -#define SONG_NUMBER_P2_EXTRA_Y THEME->GetMetricF("ScreenGameplay","SongNumberP2ExtraY") -#define SCORE_P1_X THEME->GetMetricF("ScreenGameplay","ScoreP1X") -#define SCORE_P1_Y THEME->GetMetricF("ScreenGameplay","ScoreP1Y") -#define SCORE_P1_EXTRA_Y THEME->GetMetricF("ScreenGameplay","ScoreP1ExtraY") -#define SCORE_P2_X THEME->GetMetricF("ScreenGameplay","ScoreP2X") -#define SCORE_P2_Y THEME->GetMetricF("ScreenGameplay","ScoreP2Y") -#define SCORE_P2_EXTRA_Y THEME->GetMetricF("ScreenGameplay","ScoreP2ExtraY") -#define PLAYER_OPTIONS_P1_X THEME->GetMetricF("ScreenGameplay","PlayerOptionsP1X") -#define PLAYER_OPTIONS_P1_Y THEME->GetMetricF("ScreenGameplay","PlayerOptionsP1Y") -#define PLAYER_OPTIONS_P1_EXTRA_Y THEME->GetMetricF("ScreenGameplay","PlayerOptionsP1ExtraY") -#define PLAYER_OPTIONS_P2_X THEME->GetMetricF("ScreenGameplay","PlayerOptionsP2X") -#define PLAYER_OPTIONS_P2_Y THEME->GetMetricF("ScreenGameplay","PlayerOptionsP2Y") -#define PLAYER_OPTIONS_P2_EXTRA_Y THEME->GetMetricF("ScreenGameplay","PlayerOptionsP2ExtraY") +#define STAGE_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("Stage%sY",e?"Extra":"")) +#define SONG_NUMBER_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongNumberP%dX",p+1)) +#define SONG_NUMBER_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongNumberP%d%sY",p+1,e?"Extra":"")) +#define SCORE_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("ScoreP%dX",p+1)) +#define SCORE_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("ScoreP%d%sY",p+1,e?"Extra":"")) +#define PLAYER_OPTIONS_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("PlayerOptionsP%dX",p+1)) +#define PLAYER_OPTIONS_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("PlayerOptionsP%d%sY",p+1,e?"Extra":"")) #define SONG_OPTIONS_X THEME->GetMetricF("ScreenGameplay","SongOptionsX") -#define SONG_OPTIONS_Y THEME->GetMetricF("ScreenGameplay","SongOptionsY") -#define SONG_OPTIONS_EXTRA_Y THEME->GetMetricF("ScreenGameplay","SongOptionsExtraY") -#define DIFFICULTY_P1_X THEME->GetMetricF("ScreenGameplay","DifficultyP1X") -#define DIFFICULTY_P1_Y THEME->GetMetricF("ScreenGameplay","DifficultyP1Y") -#define DIFFICULTY_P1_REVERSE_Y THEME->GetMetricF("ScreenGameplay","DifficultyP1ReverseY") -#define DIFFICULTY_P1_EXTRA_Y THEME->GetMetricF("ScreenGameplay","DifficultyP1ExtraY") -#define DIFFICULTY_P1_EXTRA_REVERSE_Y THEME->GetMetricF("ScreenGameplay","DifficultyP1ExtraReverseY") -#define DIFFICULTY_P2_X THEME->GetMetricF("ScreenGameplay","DifficultyP2X") -#define DIFFICULTY_P2_Y THEME->GetMetricF("ScreenGameplay","DifficultyP2Y") -#define DIFFICULTY_P2_REVERSE_Y THEME->GetMetricF("ScreenGameplay","DifficultyP2ReverseY") -#define DIFFICULTY_P2_EXTRA_Y THEME->GetMetricF("ScreenGameplay","DifficultyP2ExtraY") -#define DIFFICULTY_P2_EXTRA_REVERSE_Y THEME->GetMetricF("ScreenGameplay","DifficultyP2ExtraReverseY") +#define SONG_OPTIONS_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongOptions%sY",e?"Extra":"")) +#define DIFFICULTY_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%dX",p+1)) +#define DIFFICULTY_Y( p, e, r ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%d%s%sY",p+1,e?"Extra":"",r?"Reverse":"")) #define DEBUG_X THEME->GetMetricF("ScreenGameplay","DebugX") #define DEBUG_Y THEME->GetMetricF("ScreenGameplay","DebugY") #define AUTOPLAY_X THEME->GetMetricF("ScreenGameplay","AutoPlayX") @@ -88,87 +60,6 @@ #define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenGameplay","SecondsBetweenComments") #define DEMONSTRATION_SECONDS THEME->GetMetricF("ScreenGameplay","DemonstrationSeconds") -float LIFE_X( int p ) { - switch( p ) { - case PLAYER_1: return LIFE_P1_X; - case PLAYER_2: return LIFE_P2_X; - default: ASSERT(0); return 0; - } -} -float LIFE_Y( int p, bool bExtra ) { - switch( p ) { - case PLAYER_1: return bExtra ? LIFE_P1_EXTRA_Y : LIFE_P1_Y; - case PLAYER_2: return bExtra ? LIFE_P2_EXTRA_Y : LIFE_P2_Y; - default: ASSERT(0); return 0; - } -} -float SONG_NUMBER_X( int p ) { - switch( p ) { - case PLAYER_1: return SONG_NUMBER_P1_X; - case PLAYER_2: return SONG_NUMBER_P2_X; - default: ASSERT(0); return 0; - } -} -float SONG_NUMBER_Y( int p, bool bExtra ) { - switch( p ) { - case PLAYER_1: return bExtra ? SONG_NUMBER_P1_EXTRA_Y : SONG_NUMBER_P1_Y; - case PLAYER_2: return bExtra ? SONG_NUMBER_P2_EXTRA_Y : SONG_NUMBER_P2_Y; - default: ASSERT(0); return 0; - } -} -float SCORE_X( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_P1_X; - case PLAYER_2: return SCORE_P2_X; - default: ASSERT(0); return 0; - } -} -float SCORE_Y( int p, bool bExtra ) { - switch( p ) { - case PLAYER_1: return bExtra ? SCORE_P1_EXTRA_Y : SCORE_P1_Y; - case PLAYER_2: return bExtra ? SCORE_P2_EXTRA_Y : SCORE_P2_Y; - default: ASSERT(0); return 0; - } -} -float DIFFICULTY_X( int p ) { - switch( p ) { - case PLAYER_1: return DIFFICULTY_P1_X; - case PLAYER_2: return DIFFICULTY_P2_X; - default: ASSERT(0); return 0; - } -} -float DIFFICULTY_Y( int p, bool bReverse, bool bExtra ) { - switch( p ) { - case PLAYER_1: - if( bExtra && bReverse ) return DIFFICULTY_P1_EXTRA_REVERSE_Y; - if( !bExtra && bReverse ) return DIFFICULTY_P1_REVERSE_Y; - if( bExtra && !bReverse ) return DIFFICULTY_P1_EXTRA_Y; - if( !bExtra && !bReverse ) return DIFFICULTY_P1_Y; - else ASSERT(0); - case PLAYER_2: - if( bExtra && bReverse ) return DIFFICULTY_P2_EXTRA_REVERSE_Y; - if( !bExtra && bReverse ) return DIFFICULTY_P2_REVERSE_Y; - if( bExtra && !bReverse ) return DIFFICULTY_P2_EXTRA_Y; - if( !bExtra && !bReverse ) return DIFFICULTY_P2_Y; - else ASSERT(0); - } - ASSERT(0); return 0; -} -float PLAYER_OPTIONS_X( int p ) { - switch( p ) { - case PLAYER_1: return PLAYER_OPTIONS_P1_X; - case PLAYER_2: return PLAYER_OPTIONS_P2_X; - default: ASSERT(0); return 0; - } -} -float PLAYER_OPTIONS_Y( int p, bool bExtra ) { - switch( p ) { - case PLAYER_1: return bExtra ? PLAYER_OPTIONS_P1_EXTRA_Y : PLAYER_OPTIONS_P1_Y; - case PLAYER_2: return bExtra ? PLAYER_OPTIONS_P2_EXTRA_Y : PLAYER_OPTIONS_P2_Y; - default: ASSERT(0); return 0; - } -} - // received while STATE_DANCING const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101); @@ -307,13 +198,13 @@ ScreenGameplay::ScreenGameplay() // TopFrame goes above LifeMeter m_sprTopFrame.Load( THEME->GetPathTo("Graphics",bExtra?"gameplay extra top frame":"gameplay top frame") ); - m_sprTopFrame.SetXY( TOP_FRAME_X, bExtra ? TOP_FRAME_EXTRA_Y : TOP_FRAME_Y ); + m_sprTopFrame.SetXY( TOP_FRAME_X, TOP_FRAME_Y(bExtra) ); this->AddSubActor( &m_sprTopFrame ); m_textStageNumber.LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); m_textStageNumber.TurnShadowOff(); - m_textStageNumber.SetXY( STAGE_X, bExtra ? STAGE_EXTRA_Y : STAGE_Y ); + m_textStageNumber.SetXY( STAGE_X, STAGE_Y(bExtra) ); m_textStageNumber.SetText( GAMESTATE->GetStageText() ); m_textStageNumber.SetDiffuseColor( GAMESTATE->GetStageColor() ); @@ -346,7 +237,7 @@ ScreenGameplay::ScreenGameplay() // Add all Actors in bottom frame // m_sprBottomFrame.Load( THEME->GetPathTo("Graphics",bExtra?"gameplay extra bottom frame":"gameplay bottom frame") ); - m_sprBottomFrame.SetXY( BOTTOM_FRAME_X, bExtra ? BOTTOM_FRAME_EXTRA_Y : BOTTOM_FRAME_Y ); + m_sprBottomFrame.SetXY( BOTTOM_FRAME_X, BOTTOM_FRAME_Y(bExtra) ); this->AddSubActor( &m_sprBottomFrame ); for( p=0; pGetPathTo("Fonts","normal") ); m_textSongOptions.TurnShadowOff(); - m_textSongOptions.SetXY( SONG_OPTIONS_X, bExtra?SONG_OPTIONS_EXTRA_Y:SONG_OPTIONS_Y ); + m_textSongOptions.SetXY( SONG_OPTIONS_X, SONG_OPTIONS_Y(bExtra) ); m_textSongOptions.SetZoom( 0.5f ); m_textSongOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetString() ); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 382cb66e3c..8870be5427 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -169,7 +169,6 @@ void ScreenOptions::InitOptionsText() title.SetZoom( 0.7f ); title.SetVertAlign( Actor::align_middle ); title.TurnShadowOff(); - m_framePage.AddSubActor( &title ); // init all text in this line and count the width of the line float fX = ITEMS_START_X; // indent 70 pixels @@ -182,7 +181,6 @@ void ScreenOptions::InitOptionsText() option.SetText( optline.szOptionsText[j] ); option.SetZoom( 0.5f ); option.SetShadowLength( 2 ); - m_framePage.AddSubActor( &option ); // set the XY position of each item in the line float fItemWidth = option.GetWidestLineWidthInSourcePixels() * option.GetZoomX(); diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 87efee1032..486c50db4a 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -41,27 +41,11 @@ #define CONTENTS_Y THEME->GetMetricF("ScreenSelectCourse","ContentsY") #define WHEEL_X THEME->GetMetricF("ScreenSelectCourse","WheelX") #define WHEEL_Y THEME->GetMetricF("ScreenSelectCourse","WheelY") -#define SCORE_P1_X THEME->GetMetricF("ScreenSelectCourse","ScoreP1X") -#define SCORE_P1_Y THEME->GetMetricF("ScreenSelectCourse","ScoreP1Y") -#define SCORE_P2_X THEME->GetMetricF("ScreenSelectCourse","ScoreP2X") -#define SCORE_P2_Y THEME->GetMetricF("ScreenSelectCourse","ScoreP2Y") +#define SCORE_X( p ) THEME->GetMetricF("ScreenSelectCourse",ssprintf("ScoreP%dX",p+1)) +#define SCORE_Y( i ) THEME->GetMetricF("ScreenSelectCourse",ssprintf("ScoreP%dY",i+1)) #define HELP_TEXT THEME->GetMetric("ScreenSelectCourse","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectCourse","TimerSeconds") -float BEST_TIME_X( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_P1_X; - case PLAYER_2: return SCORE_P2_X; - default: ASSERT(0); return 0; - } -} -float BEST_TIME_Y( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_P1_Y; - case PLAYER_2: return SCORE_P2_Y; - default: ASSERT(0); return 0; - } -} const float TWEEN_TIME = 0.5f; @@ -118,10 +102,10 @@ ScreenSelectCourse::ScreenSelectCourse() m_sprHighScoreFrame[p].Load( THEME->GetPathTo("Graphics","select music score frame") ); m_sprHighScoreFrame[p].StopAnimating(); m_sprHighScoreFrame[p].SetState( p ); - m_sprHighScoreFrame[p].SetXY( BEST_TIME_X(p), BEST_TIME_Y(p) ); + m_sprHighScoreFrame[p].SetXY( SCORE_X(p), SCORE_Y(p) ); this->AddSubActor( &m_sprHighScoreFrame[p] ); - m_HighScore[p].SetXY( BEST_TIME_X(p), BEST_TIME_Y(p) ); + m_HighScore[p].SetXY( SCORE_X(p), SCORE_Y(p) ); m_HighScore[p].SetZoom( 0.6f ); m_HighScore[p].SetDiffuseColor( PlayerToColor(p) ); this->AddSubActor( &m_HighScore[p] ); diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 072ae40580..3ae9face5e 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -23,15 +23,10 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete - -#define MORE_PAGE1_X THEME->GetMetricF("ScreenSelectDifficulty","MorePage1X") -#define MORE_PAGE1_Y THEME->GetMetricF("ScreenSelectDifficulty","MorePage1Y") -#define MORE_PAGE2_X THEME->GetMetricF("ScreenSelectDifficulty","MorePage2X") -#define MORE_PAGE2_Y THEME->GetMetricF("ScreenSelectDifficulty","MorePage2Y") -#define EXPLANATION_PAGE1_X THEME->GetMetricF("ScreenSelectDifficulty","ExplanationPage1X") -#define EXPLANATION_PAGE1_Y THEME->GetMetricF("ScreenSelectDifficulty","ExplanationPage1Y") -#define EXPLANATION_PAGE2_X THEME->GetMetricF("ScreenSelectDifficulty","ExplanationPage2X") -#define EXPLANATION_PAGE2_Y THEME->GetMetricF("ScreenSelectDifficulty","ExplanationPage2Y") +#define MORE_X( p ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("MorePage%dX",p+1)) +#define MORE_Y( i ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("MorePage%dY",i+1)) +#define EXPLANATION_X( p ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dX",p+1)) +#define EXPLANATION_Y( i ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dY",i+1)) #define EASY_X THEME->GetMetricF("ScreenSelectDifficulty","EasyX") #define EASY_Y THEME->GetMetricF("ScreenSelectDifficulty","EasyY") #define MEDIUM_X THEME->GetMetricF("ScreenSelectDifficulty","MediumX") @@ -42,10 +37,8 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to #define ONI_Y THEME->GetMetricF("ScreenSelectDifficulty","OniY") #define ENDLESS_X THEME->GetMetricF("ScreenSelectDifficulty","EndlessX") #define ENDLESS_Y THEME->GetMetricF("ScreenSelectDifficulty","EndlessY") -#define CURSOR_OFFSET_P1_X THEME->GetMetricF("ScreenSelectDifficulty","CursorOffsetP1X") -#define CURSOR_OFFSET_P1_Y THEME->GetMetricF("ScreenSelectDifficulty","CursorOffsetP1Y") -#define CURSOR_OFFSET_P2_X THEME->GetMetricF("ScreenSelectDifficulty","CursorOffsetP2X") -#define CURSOR_OFFSET_P2_Y THEME->GetMetricF("ScreenSelectDifficulty","CursorOffsetP2Y") +#define CURSOR_OFFSET_X( p ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dX",p+1)) +#define CURSOR_OFFSET_Y( i ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dY",i+1)) #define CURSOR_SHADOW_LENGTH_X THEME->GetMetricF("ScreenSelectDifficulty","CursorShadowLengthX") #define CURSOR_SHADOW_LENGTH_Y THEME->GetMetricF("ScreenSelectDifficulty","CursorShadowLengthY") #define HELP_TEXT THEME->GetMetric("ScreenSelectDifficulty","HelpText") @@ -54,34 +47,6 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to #define NEXT_SCREEN_ONI THEME->GetMetric("ScreenSelectDifficulty","NextScreenOni") -float MORE_X( int iIndex ) { - switch( iIndex ) { - case 0: return MORE_PAGE1_X; - case 1: return MORE_PAGE2_X; - default: ASSERT(0); return 0; - } -} -float MORE_Y( int iIndex ) { - switch( iIndex ) { - case 0: return MORE_PAGE1_Y; - case 1: return MORE_PAGE2_Y; - default: ASSERT(0); return 0; - } -} -float EXPLANATION_X( int iIndex ) { - switch( iIndex ) { - case 0: return EXPLANATION_PAGE1_X; - case 1: return EXPLANATION_PAGE2_X; - default: ASSERT(0); return 0; - } -} -float EXPLANATION_Y( int iIndex ) { - switch( iIndex ) { - case 0: return EXPLANATION_PAGE1_Y; - case 1: return EXPLANATION_PAGE2_Y; - default: ASSERT(0); return 0; - } -} float ITEM_X( int iItemIndex ) { switch( iItemIndex ) { case 0: return EASY_X; @@ -102,20 +67,8 @@ float ITEM_Y( int iItemIndex ) { default: ASSERT(0); return 0; } } -float CURSOR_X( int iItemIndex, int p ) { - switch( p ) { - case PLAYER_1: return ITEM_X(iItemIndex) + CURSOR_OFFSET_P1_X; - case PLAYER_2: return ITEM_X(iItemIndex) + CURSOR_OFFSET_P2_X; - default: ASSERT(0); return 0; - } -} -float CURSOR_Y( int iItemIndex, int p ) { - switch( p ) { - case PLAYER_1: return ITEM_Y(iItemIndex) + CURSOR_OFFSET_P1_Y; - case PLAYER_2: return ITEM_Y(iItemIndex) + CURSOR_OFFSET_P2_Y; - default: ASSERT(0); return 0; - } -} +float CURSOR_X( int iItemIndex, int p ) { return ITEM_X(iItemIndex) + CURSOR_OFFSET_X(p); } +float CURSOR_Y( int iItemIndex, int p ) { return ITEM_Y(iItemIndex) + CURSOR_OFFSET_Y(p); } const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 5f451b517f..5071c5d5b8 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -41,30 +41,22 @@ #define CD_TITLE_Y THEME->GetMetricF("ScreenSelectMusic","CDTitleY") #define DIFFICULTY_X THEME->GetMetricF("ScreenSelectMusic","DifficultyX") #define DIFFICULTY_Y THEME->GetMetricF("ScreenSelectMusic","DifficultyY") -#define ICON_P1_X THEME->GetMetricF("ScreenSelectMusic","IconP1X") -#define ICON_P1_Y THEME->GetMetricF("ScreenSelectMusic","IconP1Y") -#define ICON_P2_X THEME->GetMetricF("ScreenSelectMusic","IconP2X") -#define ICON_P2_Y THEME->GetMetricF("ScreenSelectMusic","IconP2Y") +#define ICON_X( p ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("IconP%dX",p+1)) +#define ICON_Y( i ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("IconP%dY",i+1)) #define RADAR_X THEME->GetMetricF("ScreenSelectMusic","RadarX") #define RADAR_Y THEME->GetMetricF("ScreenSelectMusic","RadarY") #define SORT_ICON_X THEME->GetMetricF("ScreenSelectMusic","SortIconX") #define SORT_ICON_Y THEME->GetMetricF("ScreenSelectMusic","SortIconY") -#define SCORE_P1_X THEME->GetMetricF("ScreenSelectMusic","ScoreP1X") -#define SCORE_P1_Y THEME->GetMetricF("ScreenSelectMusic","ScoreP1Y") -#define SCORE_P2_X THEME->GetMetricF("ScreenSelectMusic","ScoreP2X") -#define SCORE_P2_Y THEME->GetMetricF("ScreenSelectMusic","ScoreP2Y") +#define SCORE_X( p ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("ScoreP%dX",p+1)) +#define SCORE_Y( i ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("ScoreP%dY",i+1)) #define METER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","MeterFrameX") #define METER_FRAME_Y THEME->GetMetricF("ScreenSelectMusic","MeterFrameY") -#define METER_P1_X THEME->GetMetricF("ScreenSelectMusic","MeterP1X") -#define METER_P1_Y THEME->GetMetricF("ScreenSelectMusic","MeterP1Y") -#define METER_P2_X THEME->GetMetricF("ScreenSelectMusic","MeterP2X") -#define METER_P2_Y THEME->GetMetricF("ScreenSelectMusic","MeterP2Y") +#define METER_X( p ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("MeterP%dX",p+1)) +#define METER_Y( i ) THEME->GetMetricF("ScreenSelectMusic",ssprintf("MeterP%dY",i+1)) #define WHEEL_X THEME->GetMetricF("ScreenSelectMusic","WheelX") #define WHEEL_Y THEME->GetMetricF("ScreenSelectMusic","WheelY") -#define PLAYER_OPTIONS_P1_X THEME->GetMetricF("ScreenSelectMusic","PlayerOptionsP1X") -#define PLAYER_OPTIONS_P1_Y THEME->GetMetricF("ScreenSelectMusic","PlayerOptionsP1Y") -#define PLAYER_OPTIONS_P2_X THEME->GetMetricF("ScreenSelectMusic","PlayerOptionsP2X") -#define PLAYER_OPTIONS_P2_Y THEME->GetMetricF("ScreenSelectMusic","PlayerOptionsP2Y") +#define PLAYER_OPTIONS_X( p )THEME->GetMetricF("ScreenSelectMusic",ssprintf("PlayerOptionsP%dX",p+1)) +#define PLAYER_OPTIONS_Y( i )THEME->GetMetricF("ScreenSelectMusic",ssprintf("PlayerOptionsP%dY",i+1)) #define SONG_OPTIONS_X THEME->GetMetricF("ScreenSelectMusic","SongOptionsX") #define SONG_OPTIONS_Y THEME->GetMetricF("ScreenSelectMusic","SongOptionsY") #define HELP_TEXT THEME->GetMetric("ScreenSelectMusic","HelpText") @@ -73,57 +65,6 @@ const float TWEEN_TIME = 0.5f; -float ICON_X( int p ) { - switch( p ) { - case PLAYER_1: return ICON_P1_X; - case PLAYER_2: return ICON_P2_X; - default: ASSERT(0); return 0; - } -} -float ICON_Y( int p ) { - switch( p ) { - case PLAYER_1: return ICON_P1_Y; - case PLAYER_2: return ICON_P2_Y; - default: ASSERT(0); return 0; - } -} -float HIGH_SCORE_X( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_P1_X; - case PLAYER_2: return SCORE_P2_X; - default: ASSERT(0); return 0; - } -} -float HIGH_SCORE_Y( int p ) { - switch( p ) { - case PLAYER_1: return SCORE_P1_Y; - case PLAYER_2: return SCORE_P2_Y; - default: ASSERT(0); return 0; - } -} -float METER_X( int p ) { - switch( p ) { - case PLAYER_1: return METER_P1_X; - case PLAYER_2: return METER_P2_X; - default: ASSERT(0); return 0; - } -} -float METER_Y( int p ) { - switch( p ) { - case PLAYER_1: return METER_P1_Y; - case PLAYER_2: return METER_P2_Y; - default: ASSERT(0); return 0; - } -} -#define PLAYER_OPTIONS_X(p) ( p==PLAYER_1 ? PLAYER_OPTIONS_P1_X : PLAYER_OPTIONS_P2_X ) - -float PLAYER_OPTIONS_Y( int p ) { - switch( p ) { - case PLAYER_1: return PLAYER_OPTIONS_P1_Y; - case PLAYER_2: return PLAYER_OPTIONS_P2_Y; - default: ASSERT(0); return 0; - } -} const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2); @@ -233,10 +174,10 @@ ScreenSelectMusic::ScreenSelectMusic() m_sprHighScoreFrame[p].Load( THEME->GetPathTo("Graphics","select music score frame") ); m_sprHighScoreFrame[p].StopAnimating(); m_sprHighScoreFrame[p].SetState( p ); - m_sprHighScoreFrame[p].SetXY( HIGH_SCORE_X(p), HIGH_SCORE_Y(p) ); + m_sprHighScoreFrame[p].SetXY( SCORE_X(p), SCORE_Y(p) ); this->AddSubActor( &m_sprHighScoreFrame[p] ); - m_HighScore[p].SetXY( HIGH_SCORE_X(p), HIGH_SCORE_Y(p) ); + m_HighScore[p].SetXY( SCORE_X(p), SCORE_Y(p) ); m_HighScore[p].SetZoom( 0.6f ); m_HighScore[p].SetDiffuseColor( PlayerToColor(p) ); this->AddSubActor( &m_HighScore[p] ); @@ -428,11 +369,11 @@ void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort() } for( int i=0; iGetX(); apActorsInScore[i]->BeginTweening( TWEEN_TIME, TWEEN_BIAS_END ); // tween off screen apActorsInScore[i]->SetTweenX( fOriginalX+400 ); - apActorsInScore[i]->BeginTweeningQueued( 0.6f ); // sleep + apActorsInScore[i]->BeginTweeningQueued( 0.5f ); // sleep apActorsInScore[i]->BeginTweeningQueued( 1, TWEEN_BIAS_BEGIN ); // tween back on screen apActorsInScore[i]->SetTweenX( fOriginalX ); diff --git a/stepmania/src/ScrollingList.cpp b/stepmania/src/ScrollingList.cpp index 2c9bb62555..c4a25d2318 100644 --- a/stepmania/src/ScrollingList.cpp +++ b/stepmania/src/ScrollingList.cpp @@ -20,97 +20,49 @@ #include "SongManager.h" const int DEFAULT_VISIBLE_ELEMENTS = 3; +const int DEFAULT_SPACING = 300; -const float SPACING3ELEMENTS = 310.0f; -const float SPACING4ELEMENTS = 225.0f; -const float SPACING5ELEMENTS = 150.0f; - - -ScrollingListDisplay::ScrollingListDisplay() -{ - -} - -/************************************ -Allows us to create a graphic element -in the scrolling list -*************************************/ - -void ScrollingListDisplay::Load( CString graphiclocation ) -{ - m_gLocation = graphiclocation; - m_sprListElement.Load( THEME->GetPathTo("Graphics",m_gLocation) ); - this->AddSubActor( &m_sprListElement ); -} - -/*********************************** -RedefineGraphic - -Allows us to change a graphic -element in the scrolling list -************************************/ - -void ScrollingListDisplay::RedefineGraphic( CString graphiclocation ) -{ - m_gLocation = graphiclocation; - m_sprListElement.Load( THEME->GetPathTo("Graphics",m_gLocation) ); -} - -/************************************* -GetGraphicLocation - -Returns the graphic filename from a -scrollinglist element -**************************************/ - -CString ScrollingListDisplay::GetGraphicLocation() -{ - return m_gLocation; -} +const D3DXCOLOR COLOR_SELECTED = D3DXCOLOR(1.0f,1.0f,1.0f,1); +const D3DXCOLOR COLOR_NOT_SELECTED = D3DXCOLOR(0.4f,0.4f,0.4f,1); /*************************************** ScrollingList Initializes Variables for the ScrollingList ****************************************/ - ScrollingList::ScrollingList() { - m_iNumContents = 0; - m_iNumVisElements = DEFAULT_VISIBLE_ELEMENTS; - m_iCurrentPos = 0; + m_iSelection = 0; + m_fSelectionLag = 0; + m_iSpacing = DEFAULT_SPACING; + m_iNumVisible = DEFAULT_VISIBLE_ELEMENTS; } -/************************************** -CreateNewElement - -Adds a new graphic element to the end of -the scrolling element -***************************************/ - -void ScrollingList::CreateNewElement( CString graphiclocation ) +ScrollingList::~ScrollingList() { - float CurrentSpacing; - if (m_iNumVisElements <= 3) - { - CurrentSpacing = SPACING3ELEMENTS; - } - else if (m_iNumVisElements == 4) - { - CurrentSpacing = SPACING4ELEMENTS; - } - else - { - CurrentSpacing = SPACING5ELEMENTS; - } - - m_ScrollingListDisplays[m_iNumContents].Load( graphiclocation ); - this->AddSubActor( &m_ScrollingListDisplays[m_iNumContents] ); + Unload(); +} - m_ScrollingListDisplays[m_iNumContents].SetX( 0 - (CurrentSpacing * m_iNumContents) ); +void ScrollingList::Unload() +{ + for( int i=0; iLoad( asGraphicPaths[i] ); + m_apSprites.Add( pNewSprite ); + } } @@ -119,67 +71,12 @@ ShiftLeft Make the entire list shuffle left **************************************/ - -void ScrollingList::ShiftLeft() +void ScrollingList::Left() { - if ( m_iCurrentPos == 0 ) // if we're at the start of the list wrap to the end - { - m_iCurrentPos = m_iNumContents - 1; - } - else // just decrease our position - { - m_iCurrentPos--; - } + ASSERT( m_apSprites.GetSize() > 0 ); // nothing loaded! - float CurrentSpacing; - if (m_iNumVisElements <= 3) - { - CurrentSpacing = SPACING3ELEMENTS; - } - else if (m_iNumVisElements == 4) - { - CurrentSpacing = SPACING4ELEMENTS; - } - else - { - CurrentSpacing = SPACING5ELEMENTS; - } - - - SetCurrentPosition( m_iCurrentPos ); - - for (int i=10; i > 0; i-- ) // 21 elements (10 going in both directions plus a 0) - { - if (m_iCurrentPos - i >= 0) // set -ve -tweening - { - m_ScrollingListDisplays[m_iCurrentPos - i].SetX( 0 - ((i-1) * CurrentSpacing) - (CurrentSpacing * 2) ); - m_ScrollingListDisplays[m_iCurrentPos - i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos - i].SetTweenX( 0 - (CurrentSpacing * i) ); - } - else - { - m_ScrollingListDisplays[m_iNumContents - i].SetX( 0 - ((i-1) * CurrentSpacing) - (CurrentSpacing * 2)); - m_ScrollingListDisplays[m_iNumContents - i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iNumContents - i].SetTweenX( 0 - (CurrentSpacing * i) ); - } - - if (m_iCurrentPos + i <= m_iNumContents - 1) // set +ve tweening - { - m_ScrollingListDisplays[m_iCurrentPos + i].SetX( 0 + (CurrentSpacing * i) + CurrentSpacing - (CurrentSpacing * 2)); - m_ScrollingListDisplays[m_iCurrentPos + i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos + i].SetTweenX( 0 + (CurrentSpacing * i) ); - } - else - { - m_ScrollingListDisplays[i-1].SetX( 0 + (CurrentSpacing * i) + CurrentSpacing - (CurrentSpacing * 2)); - m_ScrollingListDisplays[i-1].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[i-1].SetTweenX( 0 + (CurrentSpacing * i) ); - } - } - - m_ScrollingListDisplays[m_iCurrentPos].SetX( 0 + CurrentSpacing - (CurrentSpacing * 2)); - m_ScrollingListDisplays[m_iCurrentPos].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos].SetTweenX( 0 ); + m_iSelection = (m_iSelection + m_apSprites.GetSize() - 1) % m_apSprites.GetSize(); // decrement with wrapping + m_fSelectionLag -= 1; } /************************************** @@ -187,67 +84,12 @@ ShiftRight Make the entire list shuffle right **************************************/ - -void ScrollingList::ShiftRight() +void ScrollingList::Right() { - if ( m_iCurrentPos == m_iNumContents - 1 ) // if we're at the end of the list wrap to the start - { - m_iCurrentPos = 0; - } - else // just decrease our position - { - m_iCurrentPos++; - } + ASSERT( m_apSprites.GetSize() > 0 ); // nothing loaded! - float CurrentSpacing; - if (m_iNumVisElements <= 3) - { - CurrentSpacing = SPACING3ELEMENTS; - } - else if (m_iNumVisElements == 4) - { - CurrentSpacing = SPACING4ELEMENTS; - } - else - { - CurrentSpacing = SPACING5ELEMENTS; - } - - - SetCurrentPosition( m_iCurrentPos ); - - for (int i=10; i > 0; i-- ) // 21 elements (10 going in both directions plus a 0) - { - if (m_iCurrentPos - i >= 0) // set -ve -tweening - { - m_ScrollingListDisplays[m_iCurrentPos - i].SetX( 0 - ((i-1) * CurrentSpacing) ); - m_ScrollingListDisplays[m_iCurrentPos - i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos - i].SetTweenX( 0 - (CurrentSpacing * i) ); - } - else - { - m_ScrollingListDisplays[m_iNumContents - i].SetX( 0 - ((i-1) * CurrentSpacing) ); - m_ScrollingListDisplays[m_iNumContents - i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iNumContents - i].SetTweenX( 0 - (CurrentSpacing * i) ); - } - - if (m_iCurrentPos + i <= m_iNumContents - 1) // set +ve tweening - { - m_ScrollingListDisplays[m_iCurrentPos + i].SetX( 0 + (CurrentSpacing * i) + CurrentSpacing ); - m_ScrollingListDisplays[m_iCurrentPos + i].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos + i].SetTweenX( 0 + (CurrentSpacing * i) ); - } - else - { - m_ScrollingListDisplays[i-1].SetX( 0 + (CurrentSpacing * i) + CurrentSpacing ); - m_ScrollingListDisplays[i-1].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[i-1].SetTweenX( 0 + (CurrentSpacing * i) ); - } - } - - m_ScrollingListDisplays[m_iCurrentPos].SetX( 0 + CurrentSpacing ); - m_ScrollingListDisplays[m_iCurrentPos].BeginTweening( 0.3f, TWEEN_BIAS_BEGIN ); - m_ScrollingListDisplays[m_iCurrentPos].SetTweenX( 0 ); + m_iSelection = (m_iSelection + 1) % m_apSprites.GetSize(); // increment with wrapping + m_fSelectionLag += 1; } /*********************************** @@ -256,55 +98,19 @@ SetCurrentPostion From the current postion in the array, add graphic elements in either direction to make the list seem infinite. ***********************************/ - -void ScrollingList::SetCurrentPosition( int CurrentPos ) +void ScrollingList::SetSelection( int iIndex ) { - m_iCurrentPos = CurrentPos; - // Setup Spacing - float CurrentSpacing; - if (m_iNumVisElements <= 3) - { - CurrentSpacing = SPACING3ELEMENTS; - } - else if (m_iNumVisElements == 4) - { - CurrentSpacing = SPACING4ELEMENTS; - } - else - { - CurrentSpacing = SPACING5ELEMENTS; - } + m_iSelection = iIndex; +} - // ORDER SPECIFICALLY! - // Central Element at front, then the next two behind, then the outer two behind them e.t.c. - // 21012 << Central element is 0, 1's are either side, 2's either side of those 3's come off-screen (regardless of spacing) - // we need 3's incase the user suddenly scrolls!! +int ScrollingList::GetSelection() +{ + return m_iSelection; +} - for( int i=3; i > 0; i--) - { - // Find the -ve Element - if ((CurrentPos - i) >= 0) // Bounds Checking: If we aren't under the first element - { - m_ScrollingListDisplays[CurrentPos-i].SetX( 0 - (i * CurrentSpacing )); - } - else // if we are under the final limit (by i) - { - m_ScrollingListDisplays[m_iNumContents+(CurrentPos - i)].SetX( 0 - (i * CurrentSpacing )); - } - - // Find the +ve Element - if ((CurrentPos + i) <= m_iNumContents-1) // Bounds Checking: If we aren't over the final element - { - m_ScrollingListDisplays[CurrentPos+i].SetX( 0 + (i * CurrentSpacing )); - } - else // if we are over the final limit (by i) - { - m_ScrollingListDisplays[i-1].SetX( 0 + (i * CurrentSpacing )); - } - } - - // Set The MIDDLE element - m_ScrollingListDisplays[CurrentPos].SetX( 0 ); +void ScrollingList::SetSpacing( int iSpacingInPixels ) +{ + m_iSpacing = iSpacingInPixels; } /****************************** @@ -313,10 +119,9 @@ SetNumberVisibleElements Allows us to set whether 3,4 or 5 elements are visible on screen at once *******************************/ - -void ScrollingList::SetNumberVisibleElements( int VisibleElements ) +void ScrollingList::SetNumberVisible( int iNumVisibleElements ) { - m_iNumVisElements = VisibleElements; + m_iNumVisible = iNumVisibleElements; } /******************************* @@ -324,13 +129,28 @@ Update Updates the actorframe ********************************/ - void ScrollingList::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); - for( int i=0; iUpdate( fDeltaTime ); } /******************************** @@ -338,66 +158,35 @@ DrawPrimitives Draws the elements onto the screen *********************************/ - void ScrollingList::DrawPrimitives() { - const D3DXCOLOR OPT_NOT_SELECTED = D3DXCOLOR(0.4f,0.4f,0.4f,1); - const D3DXCOLOR OPT_SELECTED = D3DXCOLOR(1.0f,1.0f,1.0f,1); + ASSERT( m_apSprites.GetSize() > 0 ); - for (int i=m_iNumContents; i>=0; i--) + for( int i=(m_iNumVisible)/2; i>= 0; i-- ) // draw outside to inside { - if (i != m_iCurrentPos) + int iIndexToDraw1 = m_iSelection - i; + int iIndexToDraw2 = m_iSelection + i; + + // wrap IndexToDraw* + iIndexToDraw1 = (iIndexToDraw1 + m_apSprites.GetSize()*300) % m_apSprites.GetSize(); // make sure this is positive + iIndexToDraw2 = iIndexToDraw2 % m_apSprites.GetSize(); + + ASSERT( iIndexToDraw1 >= 0 ); + + m_apSprites[iIndexToDraw1]->SetX( (-i+m_fSelectionLag) * m_iSpacing ); + m_apSprites[iIndexToDraw2]->SetX( (+i+m_fSelectionLag) * m_iSpacing ); + + if( i==0 ) // so we don't draw 0 twice { - m_ScrollingListDisplays[i].SetDiffuseColor( OPT_NOT_SELECTED ); + m_apSprites[iIndexToDraw1]->SetDiffuseColor( COLOR_SELECTED ); + m_apSprites[iIndexToDraw1]->Draw(); } else { - m_ScrollingListDisplays[i].SetDiffuseColor( OPT_SELECTED ); + m_apSprites[iIndexToDraw1]->SetDiffuseColor( COLOR_NOT_SELECTED ); + m_apSprites[iIndexToDraw2]->SetDiffuseColor( COLOR_NOT_SELECTED ); + m_apSprites[iIndexToDraw1]->Draw(); + m_apSprites[iIndexToDraw2]->Draw(); } } - - - // Start Drawing in a Specific Order For the elements around the current element - if (m_iCurrentPos == 0) // start of list? - { - m_ScrollingListDisplays[m_iNumContents - 2].Draw(); - m_ScrollingListDisplays[2].Draw(); - - m_ScrollingListDisplays[m_iNumContents - 1].Draw(); - m_ScrollingListDisplays[1].Draw(); - } - else if (m_iCurrentPos == m_iNumContents - 1) // end of list - { - m_ScrollingListDisplays[1].Draw(); - m_ScrollingListDisplays[m_iNumContents - 3].Draw(); - - m_ScrollingListDisplays[0].Draw(); - m_ScrollingListDisplays[m_iNumContents - 2].Draw(); - } - else if (m_iCurrentPos == 1) // near start - { - m_ScrollingListDisplays[m_iNumContents - 2].Draw(); - m_ScrollingListDisplays[3].Draw(); - - m_ScrollingListDisplays[2].Draw(); - m_ScrollingListDisplays[0].Draw(); - } - else if (m_iCurrentPos == m_iNumContents - 2) // near end - { - m_ScrollingListDisplays[0].Draw(); - m_ScrollingListDisplays[m_iNumContents - 4].Draw(); - - m_ScrollingListDisplays[m_iNumContents - 1].Draw(); - m_ScrollingListDisplays[m_iNumContents - 3].Draw(); - } - else // we're somewhere in the middle - { - m_ScrollingListDisplays[m_iCurrentPos + 2].Draw(); - m_ScrollingListDisplays[m_iCurrentPos - 2].Draw(); - m_ScrollingListDisplays[m_iCurrentPos - 1].Draw(); - m_ScrollingListDisplays[m_iCurrentPos + 1].Draw(); - } - - m_ScrollingListDisplays[m_iCurrentPos].Draw(); - } diff --git a/stepmania/src/ScrollingList.h b/stepmania/src/ScrollingList.h index 227280421a..008173d038 100644 --- a/stepmania/src/ScrollingList.h +++ b/stepmania/src/ScrollingList.h @@ -1,6 +1,8 @@ +#ifndef SCROLLINGLIST_H +#define SCROLLINGLIST_H /* ----------------------------------------------------------------------------- - Class: ScrollingList.h + Class: ScrollingList Desc: Creates an array of graphics which can scroll left and right. @@ -9,57 +11,37 @@ ----------------------------------------------------------------------------- */ -#pragma once -#include "Screen.h" +#include "ActorFrame.h" #include "Sprite.h" -#include "BitmapText.h" -#include "TransitionFade.h" -#include "RandomSample.h" -#include "RandomStream.h" - - -// const int SCRLIST_MAX_VISIBLE_CONTENTS = 5; -const int SCRLIST_MAX_TOTAL_CONTENTS = 20; // this is only meant for menu systems, not song lists - - -class ScrollingListDisplay : public ActorFrame -{ -public: - ScrollingListDisplay(); - - void Load( CString graphiclocation ); - void RedefineGraphic( CString graphiclocation ); - CString GetGraphicLocation(); - - CString m_gLocation; - Sprite m_sprListElement; -}; class ScrollingList : public ActorFrame { public: ScrollingList(); + ~ScrollingList(); + + void Load( const CStringArray& asGraphicPaths ); + void Unload(); // delete all items. Called automatically on Load() - void SetCurrentPosition( int CurrentPos ); - void SetNumberVisibleElements( int VisibleElements ); - void CreateNewElement( CString graphiclocation); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); - void ShiftLeft(); - void ShiftRight(); -// void SetFromCourse( Course* pCourse ); + void SetSelection( int iIndex ); + int GetSelection(); + void SetNumberVisible( int iNumVisibleElements ); + void SetSpacing( int iSpacingInPixels ); + + void Left(); + void Right(); protected: -// Quad m_quad; + int m_iSelection; + float m_fSelectionLag; + int m_iSpacing; + int m_iNumVisible; + CArray m_apSprites; // stores the list of elements (left to right) +}; - int m_iCurrentPos; - int m_iNumVisElements; - int m_iNumContents; - ScrollingListDisplay m_ScrollingListDisplays[SCRLIST_MAX_TOTAL_CONTENTS]; // stores the list of elements (from start to finish) - -// float m_fTimeUntilScroll; -// float m_fItemAtTopOfList; // between 0 and m_iNumContents -}; \ No newline at end of file +#endif \ No newline at end of file diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 7fbdbe58a6..a1e6e0bab2 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -56,10 +56,10 @@ LINK32=link.exe # ADD LINK32 $(intdir)\verstub.obj /nologo /subsystem:windows /map /debug /machine:I386 # Begin Special Build Tool IntDir=.\../Release -TargetDir=\temp\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -92,10 +92,10 @@ LINK32=link.exe # SUBTRACT LINK32 /profile /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug -TargetDir=\temp\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -1356,6 +1356,10 @@ SOURCE=.\Tls.cpp SOURCE=.\Tls.h # End Source File # End Group +# Begin Group "Utils" + +# PROP Default_Filter "" +# End Group # Begin Source File SOURCE=.\error.bmp