Fixed Song/Stage counter in Oni/Endless

This commit is contained in:
Chris Danford
2002-08-01 05:11:11 +00:00
parent 4e1bd74ee6
commit 0e0a328191
13 changed files with 119 additions and 98 deletions
+1
View File
@@ -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;
+1
View File
@@ -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,
+8 -3
View File
@@ -146,10 +146,15 @@ void GameState::AccumulateStageStatistics()
void GameState::ResetStageStatistics()
{
m_iSongsIntoCourse = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
{
int s;
m_iSongsBeforeFail[p] = 0;
m_fSecondsBeforeFail[p] = -1;
m_iPossibleDancePoints[p] = 0;
m_iActualDancePoints[p] = 0;
for( s=0; s<NUM_TAP_NOTE_SCORES; s++ )
@@ -276,8 +281,8 @@ float GameState::GetElapsedSeconds()
float GameState::GetPlayerSurviveTime( PlayerNumber p )
{
if( m_fSecondsBeforeFail[p] != -1 )
return m_fSecondsBeforeFail[p];
else
if( m_fSecondsBeforeFail[p] == -1 ) // haven't failed yet
return GetElapsedSeconds();
else
return m_fSecondsBeforeFail[p];
}
+31 -21
View File
@@ -66,32 +66,19 @@ public:
//
// Let a lot of classes access this info here so the don't have to keep their own copies
// Music statistic: Arcade: the current stage (one song). Oni/Endles: a single song in a course
//
// Let a lot of classes access this info here so the don't have to keep their own copies.
//
float m_fMusicSeconds; // time into the current song
float m_fSongBeat;
float m_fCurBPS;
bool m_bFreeze; // in the middle of a freeze
void ResetMusicStatistics(); // Clear the values above
void ResetMusicStatistics(); // Call this when it's time to play a new song. Clears the values above.
CArray<Song*,Song*> 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<Song*,Song*> 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;
+1 -1
View File
@@ -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();
+1
View File
@@ -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 );
+16 -2
View File
@@ -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; i<GetCurWheelItemDatas().GetSize(); i++ )
{
if( GetCurWheelItemDatas()[i].m_pSong == GAMESTATE->m_pCurSong )
@@ -423,6 +423,20 @@ MusicWheel::MusicWheel()
}
}
// Select the the previously selected course (if any)
if( GAMESTATE->m_pCurCourse != NULL )
{
for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
{
if( GetCurWheelItemDatas()[i].m_pCourse == GAMESTATE->m_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();
+26 -30
View File
@@ -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++;
}
+17 -11
View File
@@ -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; p<NUM_PLAYERS; p++ )
m_textCourseSongNumber[p].SetText( ssprintf("%d", GAMESTATE->m_iSongsBeforeFail[p]+1) );
Course* pCourse = GAMESTATE->m_pCurCourse;
CArray<Song*,Song*> apSongs;
CArray<Notes*,Notes*> 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 )
{
+3 -3
View File
@@ -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 );
+3
View File
@@ -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) );
}
+9 -13
View File
@@ -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() :
+2 -14
View File
@@ -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 )