From 0e0a328191403df8def2ad25927dc93e78e103a4 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 1 Aug 2002 05:11:11 +0000 Subject: [PATCH] Fixed Song/Stage counter in Oni/Endless --- stepmania/src/AnnouncerManager.cpp | 1 + stepmania/src/AnnouncerManager.h | 1 + stepmania/src/GameState.cpp | 11 ++++-- stepmania/src/GameState.h | 52 +++++++++++++++---------- stepmania/src/LifeMeterBar.cpp | 2 +- stepmania/src/LifeMeterBattery.cpp | 1 + stepmania/src/MusicWheel.cpp | 18 ++++++++- stepmania/src/ScreenEvaluation.cpp | 56 +++++++++++++-------------- stepmania/src/ScreenGameplay.cpp | 28 ++++++++------ stepmania/src/ScreenMusicScroll.cpp | 6 +-- stepmania/src/ScreenPlayerOptions.cpp | 3 ++ stepmania/src/ScreenSongOptions.cpp | 22 +++++------ stepmania/src/Song.cpp | 16 +------- 13 files changed, 119 insertions(+), 98 deletions(-) diff --git a/stepmania/src/AnnouncerManager.cpp b/stepmania/src/AnnouncerManager.cpp index baae4ba3f0..06c35768ce 100644 --- a/stepmania/src/AnnouncerManager.cpp +++ b/stepmania/src/AnnouncerManager.cpp @@ -131,6 +131,7 @@ CString AnnouncerManager::GetPathTo( AnnouncerElement ae, CString sAnnouncerName case ANNOUNCER_EVALUATION_C: sAssetDir = "evaluation c"; break; case ANNOUNCER_EVALUATION_D: sAssetDir = "evaluation d"; break; case ANNOUNCER_EVALUATION_E: sAssetDir = "evaluation e"; break; + case ANNOUNCER_PLAYER_OPTIONS_INTRO: sAssetDir = "player options intro"; break; case ANNOUNCER_SELECT_COURSE_INTRO: sAssetDir = "select course intro"; break; case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_EASY: sAssetDir = "select difficulty comment easy"; break; case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD: sAssetDir = "select difficulty comment hard"; break; diff --git a/stepmania/src/AnnouncerManager.h b/stepmania/src/AnnouncerManager.h index 90c2392f2d..7faff381cd 100644 --- a/stepmania/src/AnnouncerManager.h +++ b/stepmania/src/AnnouncerManager.h @@ -53,6 +53,7 @@ enum AnnouncerElement { ANNOUNCER_EVALUATION_C, ANNOUNCER_EVALUATION_D, ANNOUNCER_EVALUATION_E, + ANNOUNCER_PLAYER_OPTIONS_INTRO, ANNOUNCER_SELECT_COURSE_INTRO, ANNOUNCER_SELECT_DIFFICULTY_COMMENT_EASY, ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD, diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 3a82a10819..6b751e2876 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -146,10 +146,15 @@ void GameState::AccumulateStageStatistics() void GameState::ResetStageStatistics() { + m_iSongsIntoCourse = 0; + for( int p=0; p m_apSongsPlayed; // an array of completed songs. - // This is useful for the final evaluation screen, - // and used to calculate the time into a course - float GetElapsedSeconds(); // Arcade: time into current song. Oni/Endless: time into current course - - int m_iSongsIntoCourse; // In Arcade, this value is meaningless. - // In Oni and Endless, this is the number of songs played in the current course. - int m_iSongsBeforeFail[NUM_PLAYERS]; // In Arcade, this value is meaningless. - // In Oni and Endless, this is the number of songs played before failing. - float m_fSecondsBeforeFail[NUM_PLAYERS];// -1 means not yet failed - // In Arcade, is the time into the current stage before failing. - // In Oni and Endless this is the time into the current course before failing - bool m_bUsedAutoPlayer; // Used autoplayer at any time during any stage/course/song - - float GetPlayerSurviveTime( PlayerNumber p ); - // - // Statistics for: Arcade: for the current stage. Oni/Endless: for current course + // Stage Statistics: Arcade: for the current stage (one song). Oni/Endless: for current course (multiple songs) // int m_iPossibleDancePoints[NUM_PLAYERS]; int m_iActualDancePoints[NUM_PLAYERS]; @@ -102,8 +89,29 @@ public: float m_fRadarPossible[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on end of notes float m_fRadarActual[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on end of notes - void ResetStageStatistics(); // Clear the values above - void AccumulateStageStatistics(); // Accumulate values above into the values below + float GetElapsedSeconds(); // Arcade: time into current song. Oni/Endless: time into current course + + int m_iSongsIntoCourse; // In Arcade, this value is meaningless. + // In Oni and Endless, this is the number of songs played in the current course. + int m_iSongsBeforeFail[NUM_PLAYERS]; // In Arcade, this value is meaningless. + // In Oni and Endless, this is the number of songs played before failing. + float m_fSecondsBeforeFail[NUM_PLAYERS];// -1 means not yet failed + // In Arcade, is the time into the current stage before failing. + // In Oni and Endless this is the time into the current course before failing + + float GetPlayerSurviveTime( PlayerNumber p ); // Returns time player has survived + + void AccumulateStageStatistics(); // Call this before clearing values. Accumulate values above into the Session values below. + void ResetStageStatistics(); // Clears the values above + + + // + // Session Statistics: Arcade: 3 songs. Oni/Endless: one course. + // + CArray m_apSongsPlayed; // an array of completed songs. + // This is useful for the final evaluation screen, + // and used to calculate the time into a course + bool m_bUsedAutoPlayer; // Used autoplayer at any time during any stage/course/song // Only used in final evaluation screen in play mode Arcade. // Before being displayed, these values should be normalized by dividing by number of stages @@ -117,6 +125,8 @@ public: float m_fAccumRadarActual[NUM_PLAYERS][NUM_RADAR_VALUES]; + // Session statistics are cleared by calling Reset() + PlayerOptions m_PlayerOptions[NUM_PLAYERS]; SongOptions m_SongOptions; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 71755be881..5dbf224fc6 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -121,7 +121,7 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) m_fLifePercentage += fDeltaLife; CLAMP( m_fLifePercentage, 0, 1 ); - if( m_fLifePercentage < FAIL_THRESHOLD ) + if( m_fLifePercentage <= FAIL_THRESHOLD ) m_bFailedEarlier = true; ResetBarVelocity(); diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index cd2eb1b451..a31f250c6d 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -122,6 +122,7 @@ void LifeMeterBattery::OnDancePointsChange() { int iActualDancePoints = GAMESTATE->m_iActualDancePoints[m_PlayerNumber]; int iPossibleDancePoints = GAMESTATE->m_iPossibleDancePoints[m_PlayerNumber]; + iPossibleDancePoints = max( 1, iPossibleDancePoints ); float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.00001f; // correct for rounding errors printf( "Actual %d, Possible %d, Percent %f\n", iActualDancePoints, iPossibleDancePoints, fPercentDancePoints ); diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 5544405b36..6dc68e624a 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -396,7 +396,7 @@ MusicWheel::MusicWheel() } } - // select a song if none are selected + // Select a song in case we can't find the last selected song below. if( GAMESTATE->m_pCurSong == NULL && // if there is no currently selected song SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song { @@ -409,9 +409,9 @@ MusicWheel::MusicWheel() } + // Select the the previously selected song (if any) if( GAMESTATE->m_pCurSong != NULL ) { - // find the previously selected song (if any) for( int i=0; im_pCurSong ) @@ -423,6 +423,20 @@ MusicWheel::MusicWheel() } } + // Select the the previously selected course (if any) + if( GAMESTATE->m_pCurCourse != NULL ) + { + for( int i=0; im_pCurCourse ) + { + m_iSelection = i; // select it + m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group + break; + } + } + } + // rebuild the WheelItems that appear on screen RebuildWheelItemDisplays(); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 79d439fc46..5d73ffa914 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -23,6 +23,7 @@ #include "AnnouncerManager.h" #include "ScreenMusicScroll.h" #include "GameState.h" +#include "ScreenSelectCourse.h" const float BANNER_X = CENTER_X; @@ -52,7 +53,8 @@ const float TRY_EXTRA_STAGE_X = CENTER_X; const float TRY_EXTRA_STAGE_Y = SCREEN_BOTTOM - 60; -const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+2); +const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+1); +const ScreenMessage SM_GoToSelectCourse = ScreenMessage(SM_User+2); const ScreenMessage SM_GoToFinalEvaluation = ScreenMessage(SM_User+3); const ScreenMessage SM_GoToMusicScroll = ScreenMessage(SM_User+4); @@ -289,6 +291,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) //Less - D //Fail - E float fPercentDancePoints = iActualDancePoints[p] / (float)iPossibleDancePoints[p]; + fPercentDancePoints = min( fPercentDancePoints, 0 ); if ( fPercentDancePoints >= 1.00 ) grade[p] = GRADE_AAA; else if( fPercentDancePoints >= 0.93 ) grade[p] = GRADE_AA; @@ -724,6 +727,9 @@ void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToSelectMusic: SCREENMAN->SetNewScreen( new ScreenSelectMusic ); break; + case SM_GoToSelectCourse: + SCREENMAN->SetNewScreen( new ScreenSelectCourse ); + break; case SM_GoToMusicScroll: SCREENMAN->SetNewScreen( new ScreenMusicScroll ); break; @@ -744,42 +750,32 @@ void ScreenEvaluation::MenuStart( const PlayerNumber p ) if( PREFSMAN->m_bEventMode ) { -// GAMESTATE->m_iCurrentStageIndex++; - m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); - return; + switch( GAMESTATE->m_PlayMode ) + { + case PLAY_MODE_ARCADE: + m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); + break; + case PLAY_MODE_ONI: + case PLAY_MODE_ENDLESS: + m_Menu.TweenOffScreenToMenu( SM_GoToSelectCourse ); + break; + default: + ASSERT(0); + } } - - switch( m_ResultMode ) + else // not event mode { - case RM_ARCADE_SUMMARY: - m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false ); - return; - case RM_ARCADE_STAGE: if( m_bTryExtraStage ) - { -// GAMESTATE->m_iCurrentStageIndex++; m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); - } - else if( - GAMESTATE->m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1 || - GAMESTATE->IsExtraStage() || - GAMESTATE->IsExtraStage2() ) - { + else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex >= PREFSMAN->m_iNumArcadeStages-1 ) m_Menu.TweenOffScreenToMenu( SM_GoToFinalEvaluation ); - } else - { -// GAMESTATE->m_iCurrentStageIndex++; - m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); - } - - return; - case RM_ONI: - m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false ); - return; - default: - ASSERT(0); + m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false ); } + // + // Increment the stage counter. + // + GAMESTATE->m_iCurrentStageIndex++; } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index c5284b7031..7c3b2b920f 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -42,7 +42,7 @@ const float STAGE_NUMBER_LOCAL_X = 0; const float STAGE_NUMBER_LOCAL_Y = +20; const float STAGE_NUMBER_LOCALEZ2_Y = -30; -const float SONG_NUMBER_LOCAL_X[NUM_PLAYERS] = { STAGE_NUMBER_LOCAL_X-16, STAGE_NUMBER_LOCAL_X+16 }; +const float SONG_NUMBER_LOCAL_X[NUM_PLAYERS] = { STAGE_NUMBER_LOCAL_X-20, STAGE_NUMBER_LOCAL_X+20 }; const float SONG_NUMBER_LOCAL_Y[NUM_PLAYERS] = { STAGE_NUMBER_LOCAL_Y, STAGE_NUMBER_LOCAL_Y }; @@ -73,8 +73,9 @@ const ScreenMessage SM_LastNotesEnded = ScreenMessage(SM_User+103); // received while STATE_OUTRO const ScreenMessage SM_ShowCleared = ScreenMessage(SM_User+111); const ScreenMessage SM_HideCleared = ScreenMessage(SM_User+112); -const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage(SM_User+113); -const ScreenMessage SM_GoToStateAfterCleared= ScreenMessage(SM_User+114); +const ScreenMessage SM_SaveChangedBeforeGoingBack = ScreenMessage(SM_User+113); +const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage(SM_User+114); +const ScreenMessage SM_GoToStateAfterCleared= ScreenMessage(SM_User+115); const ScreenMessage SM_BeginFailed = ScreenMessage(SM_User+121); const ScreenMessage SM_ShowFailed = ScreenMessage(SM_User+122); @@ -451,6 +452,9 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad ) case PLAY_MODE_ONI: case PLAY_MODE_ENDLESS: { + for( int p=0; pm_iSongsBeforeFail[p]+1) ); + Course* pCourse = GAMESTATE->m_pCurCourse; CArray apSongs; CArray apNotes[NUM_PLAYERS]; @@ -780,7 +784,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_BACK) ); m_soundMusic.Stop(); this->ClearMessageQueue(); - m_Fade.CloseWipingLeft( SM_GoToScreenAfterBack ); + m_Fade.CloseWipingLeft( SM_SaveChangedBeforeGoingBack ); } // @@ -874,13 +878,7 @@ void ShowSavePrompt( ScreenMessage SM_SendWhenDone ) SCREENMAN->AddScreenToTop( new ScreenPrompt( SM_SendWhenDone, - ssprintf( - "You have changed the offset or BPM of\n" - "%s.\n" - "Would you like to save these changes back\n" - "to the song file?\n" - "Choosing NO will disgard your changes.", - GAMESTATE->m_pCurSong->GetFullTitle() ), + sMessage, PROMPT_YES_NO, true, SaveChanges, @@ -1076,6 +1074,14 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) m_sprCleared.StartBlurring(); SCREENMAN->SendMessageToTopScreen( SM_GoToStateAfterCleared, 1 ); break; + case SM_SaveChangedBeforeGoingBack: + if( m_bChangedOffsetOrBPM ) + { + m_bChangedOffsetOrBPM = false; + ShowSavePrompt( SM_GoToScreenAfterBack ); + break; + } + break; case SM_GoToScreenAfterBack: switch( GAMESTATE->m_PlayMode ) { diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index 7eccb258f5..407302a198 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -160,12 +160,12 @@ ScreenMusicScroll::ScreenMusicScroll() { m_textLines[i].SetZoom( 0.7f ); m_textLines[i].SetXY( CENTER_X, SCREEN_BOTTOM + 40 ); - m_textLines[i].BeginTweeningQueued( 0.30f * i ); - m_textLines[i].BeginTweeningQueued( 3.0f ); + m_textLines[i].BeginTweeningQueued( 0.20f * i ); + m_textLines[i].BeginTweeningQueued( 2.0f ); m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 ); } - this->SendScreenMessage( SM_StartFadingOut, 0.3f * i + 3.0f ); + this->SendScreenMessage( SM_StartFadingOut, 0.2f * i + 3.0f ); this->AddSubActor( &m_Fade ); diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 5644445bd4..1b42d12c3b 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -23,6 +23,7 @@ #include "RageLog.h" #include "GameManager.h" #include "GameState.h" +#include "RageSound.h" enum { @@ -63,6 +64,8 @@ ScreenPlayerOptions::ScreenPlayerOptions() : g_PlayerOptionsLines, NUM_PLAYER_OPTIONS_LINES ); + + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_PLAYER_OPTIONS_INTRO) ); } diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index 1af7147942..0bf8640057 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -23,18 +23,6 @@ #include "GameState.h" - -OptionLineData g_SongOptionsLines[] = { - { "Life Type", 2, {"BAR","BATTERY"} }, - { "Bar Drain", 3, {"NORMAL","NO RECOVER","SUDDEN DEATH"} }, - { "Bat.Lives", 10, {"1","2","3","4","5","6","7","8","9","10"} }, - { "Fail", 3, {"ARCADE","END OF SONG","OFF"} }, - { "Assist", 2, {"OFF","TICK"} }, - { "Rate", 9, {"x0.7","x0.8","x0.9","x1.0","x1.1","x1.2","x1.3","x1.4","x1.5"} }, - { "Bars", 2, {"OFF","ON"} }, -}; -const int NUM_SONG_OPTIONS_LINES = sizeof(g_SongOptionsLines)/sizeof(OptionLineData); - enum { SO_LIFE = 0, SO_DRAIN, @@ -42,9 +30,17 @@ enum { SO_FAIL, SO_ASSIST, SO_RATE, - SO_BARS + NUM_SONG_OPTIONS_LINES }; +OptionLineData g_SongOptionsLines[NUM_SONG_OPTIONS_LINES] = { + { "Life Type", 2, {"BAR","BATTERY"} }, + { "Bar Drain", 3, {"NORMAL","NO RECOVER","SUDDEN DEATH"} }, + { "Bat.Lives", 10, {"1","2","3","4","5","6","7","8","9","10"} }, + { "Fail", 3, {"ARCADE","END OF SONG","OFF"} }, + { "Assist", 2, {"OFF","TICK"} }, + { "Rate", 9, {"x0.7","x0.8","x0.9","x1.0","x1.1","x1.2","x1.3","x1.4","x1.5"} }, +}; ScreenSongOptions::ScreenSongOptions() : diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 27dd895b97..680d9bbabf 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -282,8 +282,8 @@ bool Song::LoadFromSongDir( CString sDir ) // save group name CStringArray sDirectoryParts; - split( m_sSongDir, "\\", sDirectoryParts, true ); - m_sGroupName = sDirectoryParts[1]; + split( m_sSongDir, "\\", sDirectoryParts, false ); + m_sGroupName = sDirectoryParts[sDirectoryParts.GetSize()-3]; // second from last item // @@ -789,12 +789,6 @@ bool Song::LoadFromSMFile( CString sPath ) int i; - // get group name - CStringArray sDirectoryParts; - split( m_sSongDir, "\\", sDirectoryParts, true ); - m_sGroupName = sDirectoryParts[1]; - - MsdFile msd; bool bResult = msd.ReadFile( sPath ); if( !bResult ) @@ -961,12 +955,6 @@ bool Song::LoadFromKSFDir( CString sDir ) CString sPath = m_sSongDir + arrayKSFFileNames[0]; - // get group name - CStringArray sDirectoryParts; - split( m_sSongDir, "\\", sDirectoryParts, true ); - m_sGroupName = sDirectoryParts[1]; - - MsdFile msd; bool bResult = msd.ReadFile( sPath ); if( !bResult )