re-wrote score/statistics tracking

This commit is contained in:
Chris Danford
2002-07-29 03:06:55 +00:00
parent f9046674fb
commit 9ade2f771e
20 changed files with 289 additions and 76 deletions
+4 -4
View File
@@ -73,9 +73,7 @@ CString AnnouncerManager::GetAnnouncerDirFromName( CString sAnnouncerName )
void AnnouncerManager::SwitchAnnouncer( CString sNewAnnouncerName ) void AnnouncerManager::SwitchAnnouncer( CString sNewAnnouncerName )
{ {
if( sNewAnnouncerName == "" ) if( !DoesAnnouncerExist(sNewAnnouncerName) )
m_sCurAnnouncerName = "";
else if( !DoesAnnouncerExist(sNewAnnouncerName) )
m_sCurAnnouncerName = ""; m_sCurAnnouncerName = "";
else else
m_sCurAnnouncerName = sNewAnnouncerName; m_sCurAnnouncerName = sNewAnnouncerName;
@@ -138,6 +136,7 @@ CString AnnouncerManager::GetPathTo( AnnouncerElement ae, CString sAnnouncerName
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD: sAssetDir = "select difficulty comment hard"; break; case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD: sAssetDir = "select difficulty comment hard"; break;
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM:sAssetDir = "select difficulty comment medium"; break; case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM:sAssetDir = "select difficulty comment medium"; break;
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI: sAssetDir = "select difficulty comment oni"; break; case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI: sAssetDir = "select difficulty comment oni"; break;
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ENDLESS:sAssetDir = "select difficulty comment endless"; break;
case ANNOUNCER_SELECT_DIFFICULTY_CHALLENGE: sAssetDir = "select difficulty challenge"; break; case ANNOUNCER_SELECT_DIFFICULTY_CHALLENGE: sAssetDir = "select difficulty challenge"; break;
case ANNOUNCER_SELECT_DIFFICULTY_INTRO: sAssetDir = "select difficulty intro"; break; case ANNOUNCER_SELECT_DIFFICULTY_INTRO: sAssetDir = "select difficulty intro"; break;
case ANNOUNCER_SELECT_GROUP_COMMENT_ALL_MUSIC: sAssetDir = "select group comment all music"; break; case ANNOUNCER_SELECT_GROUP_COMMENT_ALL_MUSIC: sAssetDir = "select group comment all music"; break;
@@ -161,7 +160,8 @@ CString AnnouncerManager::GetPathTo( AnnouncerElement ae, CString sAnnouncerName
case ANNOUNCER_STAGE_FINAL: sAssetDir = "stage final"; break; case ANNOUNCER_STAGE_FINAL: sAssetDir = "stage final"; break;
case ANNOUNCER_STAGE_EXTRA: sAssetDir = "stage extra"; break; case ANNOUNCER_STAGE_EXTRA: sAssetDir = "stage extra"; break;
case ANNOUNCER_STAGE_ANOTHER_EXTRA: sAssetDir = "stage another extra"; break; case ANNOUNCER_STAGE_ANOTHER_EXTRA: sAssetDir = "stage another extra"; break;
case ANNOUNCER_STAGE_CHALLENGE: sAssetDir = "stage challenge"; break; case ANNOUNCER_STAGE_ONI: sAssetDir = "stage oni"; break;
case ANNOUNCER_STAGE_ENDLESS: sAssetDir = "stage endless"; break;
case ANNOUNCER_TITLE_MENU_ATTRACT: sAssetDir = "title menu attract"; break; case ANNOUNCER_TITLE_MENU_ATTRACT: sAssetDir = "title menu attract"; break;
case ANNOUNCER_TITLE_MENU_GAME_NAME: sAssetDir = "title menu game name"; break; case ANNOUNCER_TITLE_MENU_GAME_NAME: sAssetDir = "title menu game name"; break;
+3 -1
View File
@@ -58,6 +58,7 @@ enum AnnouncerElement {
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD, ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD,
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM, ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM,
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI, ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI,
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ENDLESS,
ANNOUNCER_SELECT_DIFFICULTY_CHALLENGE, ANNOUNCER_SELECT_DIFFICULTY_CHALLENGE,
ANNOUNCER_SELECT_DIFFICULTY_INTRO, ANNOUNCER_SELECT_DIFFICULTY_INTRO,
ANNOUNCER_SELECT_GROUP_COMMENT_ALL_MUSIC, ANNOUNCER_SELECT_GROUP_COMMENT_ALL_MUSIC,
@@ -81,7 +82,8 @@ enum AnnouncerElement {
ANNOUNCER_STAGE_FINAL, ANNOUNCER_STAGE_FINAL,
ANNOUNCER_STAGE_EXTRA, ANNOUNCER_STAGE_EXTRA,
ANNOUNCER_STAGE_ANOTHER_EXTRA, ANNOUNCER_STAGE_ANOTHER_EXTRA,
ANNOUNCER_STAGE_CHALLENGE, ANNOUNCER_STAGE_ONI,
ANNOUNCER_STAGE_ENDLESS,
ANNOUNCER_TITLE_MENU_ATTRACT, ANNOUNCER_TITLE_MENU_ATTRACT,
ANNOUNCER_TITLE_MENU_GAME_NAME, ANNOUNCER_TITLE_MENU_GAME_NAME,
+12 -10
View File
@@ -19,11 +19,12 @@
#include "RageTimer.h" #include "RageTimer.h"
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat ) float ArrowGetYOffset( const PlayerNumber pn, float fStepIndex )
{ {
float fSongBeat = GAMESTATE->m_fSongBeat;
float fBeatsUntilStep = NoteRowToBeat( fStepIndex ) - fSongBeat; float fBeatsUntilStep = NoteRowToBeat( fStepIndex ) - fSongBeat;
float fYOffset = fBeatsUntilStep * ARROW_GAP; float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( po.m_EffectType ) switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{ {
case PlayerOptions::EFFECT_BOOST: case PlayerOptions::EFFECT_BOOST:
fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT); fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT);
@@ -35,8 +36,9 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea
return fYOffset; return fYOffset;
} }
float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat ) float ArrowGetXPos( const PlayerNumber pn, int iColNum, float fYOffset )
{ {
float fSongBeat = GAMESTATE->m_fSongBeat;
float fPixelOffsetFromCenter = GAMESTATE->GetCurrentStyleDef()->m_ColumnInfo[PLAYER_1][iColNum].fXOffset; float fPixelOffsetFromCenter = GAMESTATE->GetCurrentStyleDef()->m_ColumnInfo[PLAYER_1][iColNum].fXOffset;
// BUG OR FEATURE??? THIS IS WHERE THE REAL COLUMN PLACEMENT HAPPENS!!! // BUG OR FEATURE??? THIS IS WHERE THE REAL COLUMN PLACEMENT HAPPENS!!!
@@ -68,7 +70,7 @@ float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float
} }
*/ */
switch( po.m_EffectType ) switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{ {
case PlayerOptions::EFFECT_DRUNK: case PlayerOptions::EFFECT_DRUNK:
fPixelOffsetFromCenter += cosf( TIMER->GetTimeSinceStart()/4 + iColNum*0.4f + fYOffset/SCREEN_HEIGHT*4) * ARROW_SIZE/3; fPixelOffsetFromCenter += cosf( TIMER->GetTimeSinceStart()/4 + iColNum*0.4f + fYOffset/SCREEN_HEIGHT*4) * ARROW_SIZE/3;
@@ -77,11 +79,11 @@ float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float
return fPixelOffsetFromCenter; return fPixelOffsetFromCenter;
} }
float ArrowGetRotation( const PlayerOptions& po, int iColNum, float fYOffset ) float ArrowGetRotation( const PlayerNumber pn, int iColNum, float fYOffset )
{ {
float fRotation = 0; //StyleDef.m_ColumnToRotation[iColNum]; float fRotation = 0; //StyleDef.m_ColumnToRotation[iColNum];
switch( po.m_EffectType ) switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{ {
case PlayerOptions::EFFECT_DIZZY: case PlayerOptions::EFFECT_DIZZY:
fRotation += fYOffset/SCREEN_HEIGHT*6; fRotation += fYOffset/SCREEN_HEIGHT*6;
@@ -91,12 +93,12 @@ float ArrowGetRotation( const PlayerOptions& po, int iColNum, float fYOffset )
return fRotation; return fRotation;
} }
float ArrowGetYPos( const PlayerOptions& po, float fYOffset ) float ArrowGetYPos( const PlayerNumber pn, float fYOffset )
{ {
return fYOffset * po.m_fArrowScrollSpeed * (po.m_bReverseScroll ? -1 : 1 ); return fYOffset * GAMESTATE->m_PlayerOptions[pn].m_fArrowScrollSpeed * (GAMESTATE->m_PlayerOptions[pn].m_bReverseScroll ? -1 : 1 );
} }
float ArrowGetAlpha( const PlayerOptions& po, float fYPos ) float ArrowGetAlpha( const PlayerNumber pn, float fYPos )
{ {
float fAlpha; float fAlpha;
static float blinktimer=0; static float blinktimer=0;
@@ -104,7 +106,7 @@ float ArrowGetAlpha( const PlayerOptions& po, float fYPos )
blinktimer = TIMER->GetTimeSinceStart(); blinktimer = TIMER->GetTimeSinceStart();
static int blinkstate=2; static int blinkstate=2;
switch( po.m_AppearanceType ) switch( GAMESTATE->m_PlayerOptions[pn].m_AppearanceType )
{ {
case PlayerOptions::APPEARANCE_VISIBLE: case PlayerOptions::APPEARANCE_VISIBLE:
fAlpha = 1; fAlpha = 1;
+4 -1
View File
@@ -87,8 +87,11 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
} }
void Course::CreateFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup ) void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup )
{ {
m_bRepeat = true;
m_bRandomize = true;
m_iLives = -1;
CString sShortGroupName = SONGMAN->ShortenGroupName( sGroupName ); CString sShortGroupName = SONGMAN->ShortenGroupName( sGroupName );
m_sName = sShortGroupName + " "; m_sName = sShortGroupName + " ";
+3 -1
View File
@@ -26,6 +26,7 @@ public:
{ {
m_iStages = 0; m_iStages = 0;
m_bRepeat = false; m_bRepeat = false;
m_bRandomize = false;
m_iLives = 4; m_iLives = 4;
for( int i=0; i<MAX_COURSE_STAGES; i++ ) for( int i=0; i<MAX_COURSE_STAGES; i++ )
m_apSongs[i] = NULL; m_apSongs[i] = NULL;
@@ -39,6 +40,7 @@ public:
CString m_asDescriptions[MAX_COURSE_STAGES]; CString m_asDescriptions[MAX_COURSE_STAGES];
Notes* GetNotesForStage( int iStage ); Notes* GetNotesForStage( int iStage );
bool m_bRepeat; // repeat after last song? bool m_bRepeat; // repeat after last song?
bool m_bRandomize; // play the songs in a random order
int m_iLives; // -1 means use bar life meter int m_iLives; // -1 means use bar life meter
CString m_sModifiers; // contains player options and song options CString m_sModifiers; // contains player options and song options
@@ -46,7 +48,7 @@ public:
void GetSongOptions( SongOptions* pSO_out); void GetSongOptions( SongOptions* pSO_out);
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs ); void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
void CreateFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup ); void CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup );
void AddStage( Song* pSong, CString sDescription ) void AddStage( Song* pSong, CString sDescription )
{ {
+3 -5
View File
@@ -109,8 +109,8 @@ void CourseContentsFrame::SetFromCourse( Course* pCourse )
printf( "Adding song '%s'\n", pSong->m_sMainTitle ); printf( "Adding song '%s'\n", pSong->m_sMainTitle );
m_CourseContentDisplays[m_iNumContents].Load( m_iNumContents+1, pSong, pNotes ); m_CourseContentDisplays[m_iNumContents].Load( m_iNumContents+1, pSong, pNotes );
m_CourseContentDisplays[m_iNumContents].SetXY( 0, -((MAX_VISIBLE_CONTENTS-1)/2) * CONTENTS_BAR_HEIGHT ); m_CourseContentDisplays[m_iNumContents].SetXY( 0, -((MAX_VISIBLE_CONTENTS-1)/2) * CONTENTS_BAR_HEIGHT );
m_CourseContentDisplays[m_iNumContents].BeginTweening( i*0.1f ); m_CourseContentDisplays[m_iNumContents].BeginTweening( m_iNumContents*0.1f );
m_CourseContentDisplays[m_iNumContents].SetTweenY( (-(MAX_VISIBLE_CONTENTS-1)/2 + i) * CONTENTS_BAR_HEIGHT ); m_CourseContentDisplays[m_iNumContents].SetTweenY( (-(MAX_VISIBLE_CONTENTS-1)/2 + m_iNumContents) * CONTENTS_BAR_HEIGHT );
m_iNumContents ++; m_iNumContents ++;
} }
@@ -162,9 +162,7 @@ void CourseContentsFrame::DrawPrimitives()
if( m_fTimeUntilScroll <= 0 ) if( m_fTimeUntilScroll <= 0 )
m_CourseContentDisplays[iItemToDraw].SetY( fY ); m_CourseContentDisplays[iItemToDraw].SetY( fY );
m_CourseContentDisplays[iItemToDraw].Draw(); m_CourseContentDisplays[iItemToDraw].Draw();
iItemToDraw++; iItemToDraw = (iItemToDraw+1) % m_iNumContents;
if( iItemToDraw >= m_iNumContents )
iItemToDraw -= m_iNumContents;
fY += CONTENTS_BAR_HEIGHT; fY += CONTENTS_BAR_HEIGHT;
} }
+173 -18
View File
@@ -15,6 +15,7 @@
#include "GameManager.h" #include "GameManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "InputMapper.h" #include "InputMapper.h"
#include "Song.h"
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
@@ -22,6 +23,7 @@ GameState* GAMESTATE = NULL; // global and accessable from anywhere in our progr
GameState::GameState() GameState::GameState()
{ {
m_CurGame = GAME_DANCE;
m_sLoadingMessage = "Initializing hardware..."; m_sLoadingMessage = "Initializing hardware...";
m_CurGame = GAME_DANCE; m_CurGame = GAME_DANCE;
Reset(); Reset();
@@ -35,28 +37,135 @@ void GameState::Reset()
{ {
int p; int p;
m_CurStyle = STYLE_NONE;
m_MasterPlayerNumber = PLAYER_INVALID;
m_sPreferredGroup = "";
for( p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficultyClass[p] = CLASS_INVALID;
m_SongSortOrder = SORT_GROUP;
m_PlayMode = PLAY_MODE_INVALID;
m_bEditing = false;
m_iCurrentStageIndex = 0;
m_pCurSong = NULL; m_pCurSong = NULL;
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
m_pCurNotes[p] = NULL; m_pCurNotes[p] = NULL;
m_pCurCourse = NULL; m_pCurCourse = NULL;
m_sPreferredGroup = "";
m_aGameplayStatistics.RemoveAll();
// We can simply reset it cause it would override the selection the user just did m_fMusicSeconds = 0;
// Moved to the constructor for now m_fSongBeat = 0;
//m_CurGame = GAME_DANCE; m_fCurBPS = 0;
m_bFreeze = 0;
m_CurStyle = STYLE_NONE;
m_MasterPlayerNumber = PLAYER_INVALID; m_apSongsPlayed.RemoveAll();
for( p=0; p<NUM_PLAYERS; p++ )
{
m_fSecondsBeforeFail[p] = -1;
m_iStagesIntoCourse[p] = 0;
}
m_bUsedAutoPlayer = false;
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficultyClass[p] = CLASS_EASY; {
m_SongSortOrder = SORT_GROUP; int s;
m_PlayMode = PLAY_MODE_INVALID;
m_iCurrentStageIndex = 0; m_iPossibleDancePoints[p] = 0;
m_iActualDancePoints[p] = 0;
for( s=0; s<NUM_TAP_NOTE_SCORES; s++ )
m_TapNoteScores[p][s] = 0;
for( s=0; s<NUM_HOLD_NOTE_SCORES; s++ )
m_HoldNoteScores[p][s] = 0;
m_iMaxCombo[p] = 0;
m_fScore[p] = 0;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
{
m_fRadarPossible[p][r] = 0;
m_fRadarActual[p][r] = 0;
} }
}
for( p=0; p<NUM_PLAYERS; p++ )
{
int s;
m_iAccumPossibleDancePoints[p] = 0;
m_iAccumActualDancePoints[p] = 0;
for( s=0; s<NUM_TAP_NOTE_SCORES; s++ )
m_AccumTapNoteScores[p][s] = 0;
for( s=0; s<NUM_HOLD_NOTE_SCORES; s++ )
m_AccumHoldNoteScores[p][s] = 0;
m_iAccumMaxCombo[p] = 0;
m_fAccumScore[p] = 0;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
{
m_fAccumRadarPossible[p][r] = 0;
m_fAccumRadarActual[p][r] = 0;
}
}
for( p=0; p<NUM_PLAYERS; p++ )
m_PlayerOptions[p] = PlayerOptions();
m_SongOptions = SongOptions();
}
void GameState::ResetMusicStatistics()
{
m_fMusicSeconds = 0;
m_fSongBeat = 0;
m_fCurBPS = 10;
m_bFreeze = false;
}
void GameState::AccumulateStageStatistics()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
int s;
m_iAccumPossibleDancePoints[p] += m_iPossibleDancePoints[p];
m_iAccumActualDancePoints[p] += m_iActualDancePoints[p];
for( s=0; s<NUM_TAP_NOTE_SCORES; s++ )
m_AccumTapNoteScores[p][s] += m_TapNoteScores[p][s];
for( s=0; s<NUM_HOLD_NOTE_SCORES; s++ )
m_AccumHoldNoteScores[p][s] += m_HoldNoteScores[p][s];
m_iAccumMaxCombo[p] += m_iMaxCombo[p];
m_fAccumScore[p] += m_fScore[p];
for( int r=0; r<NUM_RADAR_VALUES; r++ )
{
m_fAccumRadarPossible[p][r] = m_fRadarPossible[p][r];
m_fAccumRadarActual[p][r] = m_fRadarActual[p][r];
}
}
}
void GameState::ResetStageStatistics()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
int s;
m_iPossibleDancePoints[p] = 0;
m_iActualDancePoints[p] = 0;
for( s=0; s<NUM_TAP_NOTE_SCORES; s++ )
m_TapNoteScores[p][s] = 0;
for( s=0; s<NUM_HOLD_NOTE_SCORES; s++ )
m_HoldNoteScores[p][s] = 0;
m_iMaxCombo[p] = 0;
m_fScore[p] = 0;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
{
m_fRadarPossible[p][r] = 0;
m_fRadarActual[p][r] = 0;
}
}
}
int GameState::GetStageIndex() int GameState::GetStageIndex()
{ {
@@ -86,6 +195,29 @@ bool GameState::IsExtraStage2()
CString GameState::GetStageText() CString GameState::GetStageText()
{ {
switch( m_PlayMode )
{
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
CString sText;
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( this->IsPlayerEnabled(p) )
sText += ssprintf("%d ", m_iStagesIntoCourse[p]);
else
sText += "a ";
}
sText.TrimRight();
sText.Replace('a',' ');
return sText;
}
break;
default:
; // fall through
}
if( IsFinalStage() ) if( IsFinalStage() )
return "Final"; return "Final";
else if( IsExtraStage() ) else if( IsExtraStage() )
@@ -125,12 +257,6 @@ D3DXCOLOR GameState::GetStageColor()
return D3DXCOLOR(0.3f,1,0.3f,1); // green return D3DXCOLOR(0.3f,1,0.3f,1); // green
} }
GameplayStatistics& GameState::GetLatestGameplayStatistics()
{
ASSERT( m_aGameplayStatistics.GetSize() > 0 );
return m_aGameplayStatistics[ m_aGameplayStatistics.GetSize()-1 ];
}
GameDef* GameState::GetCurrentGameDef() GameDef* GameState::GetCurrentGameDef()
{ {
return GAMEMAN->GetGameDefForGame( m_CurGame ); return GAMEMAN->GetGameDefForGame( m_CurGame );
@@ -148,4 +274,33 @@ bool GameState::IsPlayerEnabled( PlayerNumber pn )
return ( pn == m_MasterPlayerNumber ) || return ( pn == m_MasterPlayerNumber ) ||
( GetCurrentStyleDef()->m_StyleType == StyleDef::TWO_PLAYERS_USE_TWO_SIDES ); ( GetCurrentStyleDef()->m_StyleType == StyleDef::TWO_PLAYERS_USE_TWO_SIDES );
}; }
float GameState::GetElapsedSeconds()
{
switch( m_PlayMode )
{
case PLAY_MODE_ARCADE:
return max( 0, m_fMusicSeconds );
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
float fSecondsTotal = 0;
for( int i=0; i<m_apSongsPlayed.GetSize(); i++ )
fSecondsTotal += m_apSongsPlayed[i]->m_fMusicLengthSeconds;
fSecondsTotal += max( 0, m_fMusicSeconds );
return fSecondsTotal;
}
default:
ASSERT(0);
return 0;
}
}
float GameState::GetPlayerSurviveTime( PlayerNumber p )
{
if( m_fSecondsBeforeFail[p] != -1 )
return m_fSecondsBeforeFail[p];
else
return GetElapsedSeconds();
}
+2 -2
View File
@@ -92,7 +92,7 @@ public:
// Statistics for: Arcade: for the current stage. Oni/Endless: for current course // Statistics for: Arcade: for the current stage. Oni/Endless: for current course
// //
int m_iPossibleDancePoints[NUM_PLAYERS]; int m_iPossibleDancePoints[NUM_PLAYERS];
int m_iActualDancePoints[NUM_PLAYERS]; // In Endless, possible dance points is -1. int m_iActualDancePoints[NUM_PLAYERS];
int m_TapNoteScores[NUM_PLAYERS][NUM_TAP_NOTE_SCORES]; int m_TapNoteScores[NUM_PLAYERS][NUM_TAP_NOTE_SCORES];
int m_HoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES]; int m_HoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
int m_iMaxCombo[NUM_PLAYERS]; int m_iMaxCombo[NUM_PLAYERS];
@@ -106,7 +106,7 @@ public:
// Only used in final evaluation screen in play mode Arcade. // Only used in final evaluation screen in play mode Arcade.
// Before being displayed, these values should be normalized by dividing by number of stages // Before being displayed, these values should be normalized by dividing by number of stages
int m_iAccumPossibleDancePoints[NUM_PLAYERS]; int m_iAccumPossibleDancePoints[NUM_PLAYERS];
int m_iAccumActualDancePoints[NUM_PLAYERS]; // In Endless, possible dance points is -1. int m_iAccumActualDancePoints[NUM_PLAYERS];
int m_AccumTapNoteScores[NUM_PLAYERS][NUM_TAP_NOTE_SCORES]; int m_AccumTapNoteScores[NUM_PLAYERS][NUM_TAP_NOTE_SCORES];
int m_AccumHoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES]; int m_AccumHoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
int m_iAccumMaxCombo[NUM_PLAYERS]; int m_iAccumMaxCombo[NUM_PLAYERS];
+5 -3
View File
@@ -28,9 +28,11 @@ void GrayArrow::Update( float fDeltaTime )
{ {
Sprite::Update( fDeltaTime ); Sprite::Update( fDeltaTime );
int iNewState = (int)( fmod(GAMESTATE->m_fSongBeat,1) * Sprite::GetNumStates() ); float fPercentIntoBeat = fmodf(GAMESTATE->m_fSongBeat,1);
if( iNewState < 0 ) if( fPercentIntoBeat < 0 )
iNewState += Sprite::GetNumStates(); fPercentIntoBeat += 1;
int iNewState = fPercentIntoBeat<0.25f ? 0 : 1;
CLAMP( iNewState, 0, Sprite::GetNumStates() );
SetState( iNewState ); SetState( iNewState );
} }
+18 -4
View File
@@ -30,14 +30,19 @@ const float FAIL_THRESHOLD = 0;
LifeMeterBar::LifeMeterBar() LifeMeterBar::LifeMeterBar()
{ {
m_fLifePercentage = 0.5f; switch( GAMESTATE->m_SongOptions.m_DrainType )
{
case SongOptions::DRAIN_NORMAL: m_fLifePercentage = 0.5f; break;
case SongOptions::DRAIN_NO_RECOVER: m_fLifePercentage = 1.0f; break;
case SongOptions::DRAIN_SUDDEN_DEATH: m_fLifePercentage = 1.0f; break;
default: ASSERT(0);
}
m_fTrailingLifePercentage = 0; m_fTrailingLifePercentage = 0;
m_fLifeVelocity = 0; m_fLifeVelocity = 0;
m_fHotAlpha = 0; m_fHotAlpha = 0;
m_bFailedEarlier = false; m_bFailedEarlier = false;
m_frame;
m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
m_quadBlackBackground.SetZoomX( METER_WIDTH ); m_quadBlackBackground.SetZoomX( METER_WIDTH );
m_quadBlackBackground.SetZoomY( METER_HEIGHT ); m_quadBlackBackground.SetZoomY( METER_HEIGHT );
@@ -95,8 +100,17 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
} }
break; break;
case SongOptions::DRAIN_SUDDEN_DEATH: case SongOptions::DRAIN_SUDDEN_DEATH:
fDeltaLife = -1; switch( score )
{
case TNS_PERFECT: fDeltaLife = +0; break;
case TNS_GREAT: fDeltaLife = +0; break;
case TNS_GOOD: fDeltaLife = -1; break;
case TNS_BOO: fDeltaLife = -1; break;
case TNS_MISS: fDeltaLife = -1; break;
}
break; break;
default:
ASSERT(0);
} }
-2
View File
@@ -125,8 +125,6 @@ void LifeMeterBattery::OnDancePointsChange()
CString sNumToDisplay = ssprintf("%03.1f", fNumToDisplay); CString sNumToDisplay = ssprintf("%03.1f", fNumToDisplay);
if( sNumToDisplay.GetLength() == 3 ) if( sNumToDisplay.GetLength() == 3 )
sNumToDisplay = "0" + sNumToDisplay; sNumToDisplay = "0" + sNumToDisplay;
if( iPossibleDancePoints == -1 )
sNumToDisplay = "??.?";
m_textPercent.SetText( sNumToDisplay ); m_textPercent.SetText( sNumToDisplay );
} }
+15 -2
View File
@@ -520,8 +520,8 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
case PLAY_MODE_ONI: case PLAY_MODE_ONI:
{ {
CArray<Course*,Course*> apCourses; CArray<Course*,Course*> apCourses;
for( int i=0; i<SONGMAN->m_aCourses.GetSize(); i++ ) for( int i=0; i<SONGMAN->m_aOniCourses.GetSize(); i++ )
apCourses.Add( &SONGMAN->m_aCourses[i] ); apCourses.Add( &SONGMAN->m_aOniCourses[i] );
SortCoursePointerArrayByDifficulty( apCourses ); SortCoursePointerArrayByDifficulty( apCourses );
@@ -532,6 +532,19 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
} }
} }
break; break;
case PLAY_MODE_ENDLESS:
{
CArray<Course*,Course*> apCourses;
for( int i=0; i<SONGMAN->m_aEndlessCourses.GetSize(); i++ )
apCourses.Add( &SONGMAN->m_aEndlessCourses[i] );
for( int c=0; c<apCourses.GetSize(); c++ ) // foreach course
{
Course* pCourse = apCourses[c];
arrayWheelItemDatas.Add( WheelItemData(TYPE_COURSE, NULL, "", pCourse, pCourse->GetColor()) );
}
}
break;
default: default:
ASSERT(0); // invalid PlayMode ASSERT(0); // invalid PlayMode
} }
+1 -1
View File
@@ -95,7 +95,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR
m_mapPathToTexture.SetAt( sTexturePath, pTexture ); m_mapPathToTexture.SetAt( sTexturePath, pTexture );
} }
LOG->WriteLine( "Display: %u MB video memory left", DISPLAY->GetDevice()->GetAvailableTextureMem() ); LOG->WriteLine( "Display: %u KB video memory left", DISPLAY->GetDevice()->GetAvailableTextureMem() );
return pTexture; return pTexture;
} }
-2
View File
@@ -38,8 +38,6 @@ ScoreDisplayNormal::ScoreDisplayNormal()
void ScoreDisplayNormal::Init( PlayerNumber pn ) void ScoreDisplayNormal::Init( PlayerNumber pn )
{ {
m_PlayerNumber = pn; m_PlayerNumber = pn;
SetScore( GAMESTATE->m_fScore[pn] );
} }
void ScoreDisplayNormal::SetScore( float fNewScore ) void ScoreDisplayNormal::SetScore( float fNewScore )
+6
View File
@@ -55,6 +55,12 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const
if( !GAMESTATE->IsPlayerEnabled(MenuI.player) ) if( !GAMESTATE->IsPlayerEnabled(MenuI.player) )
return; return;
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == DIK_ESCAPE ) // don't make user hold back button if they're pressing escape
{
this->MenuBack( MenuI.player );
return;
}
switch( MenuI.button ) switch( MenuI.button )
{ {
case MENU_BUTTON_UP: this->MenuUp( MenuI.player, type ); return; case MENU_BUTTON_UP: this->MenuUp( MenuI.player, type ); return;
+21 -8
View File
@@ -98,10 +98,8 @@ ScreenGameplay::ScreenGameplay()
GAMESTATE->m_pCurNotes[p]->GetNoteData( &notedata ); GAMESTATE->m_pCurNotes[p]->GetNoteData( &notedata );
GAMESTATE->m_iPossibleDancePoints[p] = notedata.GetPossibleDancePoints(); GAMESTATE->m_iPossibleDancePoints[p] = notedata.GetPossibleDancePoints();
break; break;
case PLAY_MODE_ENDLESS:
GAMESTATE->m_iPossibleDancePoints[p] = -1;
break;
case PLAY_MODE_ONI: case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{ {
GAMESTATE->m_iPossibleDancePoints[p] = 0; GAMESTATE->m_iPossibleDancePoints[p] = 0;
@@ -229,10 +227,10 @@ ScreenGameplay::ScreenGameplay()
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_ARCADE: case PLAY_MODE_ARCADE:
case PLAY_MODE_ENDLESS:
m_pScoreDisplay[p] = new ScoreDisplayNormal; m_pScoreDisplay[p] = new ScoreDisplayNormal;
break; break;
case PLAY_MODE_ONI: case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
m_pScoreDisplay[p] = new ScoreDisplayOni; m_pScoreDisplay[p] = new ScoreDisplayOni;
break; break;
default: default:
@@ -390,6 +388,10 @@ bool ScreenGameplay::IsLastSong()
case PLAY_MODE_ENDLESS: case PLAY_MODE_ENDLESS:
{ {
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
if( pCourse->m_bRepeat )
return false;
CArray<Song*,Song*> apSongs; CArray<Song*,Song*> apSongs;
CArray<Notes*,Notes*> apNotes[NUM_PLAYERS]; CArray<Notes*,Notes*> apNotes[NUM_PLAYERS];
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes ); pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes );
@@ -419,9 +421,15 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
CArray<Notes*,Notes*> apNotes[NUM_PLAYERS]; CArray<Notes*,Notes*> apNotes[NUM_PLAYERS];
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes ); pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes );
GAMESTATE->m_pCurSong = apSongs[GAMESTATE->m_iCurrentStageIndex]; int iPlaySongIndex = -1;
if( pCourse->m_bRandomize )
iPlaySongIndex = rand() % apSongs.GetSize();
else
iPlaySongIndex = GAMESTATE->m_iCurrentStageIndex;
GAMESTATE->m_pCurSong = apSongs[iPlaySongIndex];
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
GAMESTATE->m_pCurNotes[p] = apNotes[p][GAMESTATE->m_iCurrentStageIndex]; GAMESTATE->m_pCurNotes[p] = apNotes[p][iPlaySongIndex];
} }
break; break;
default: default:
@@ -1020,8 +1028,13 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
case SM_GoToScreenAfterBack: case SM_GoToScreenAfterBack:
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_ARCADE: SCREENMAN->SetNewScreen( new ScreenSelectMusic ); break; case PLAY_MODE_ARCADE:
case PLAY_MODE_ONI: SCREENMAN->SetNewScreen( new ScreenSelectCourse ); break; SCREENMAN->SetNewScreen( new ScreenSelectMusic );
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
SCREENMAN->SetNewScreen( new ScreenSelectCourse );
break;
default: ASSERT(0); default: ASSERT(0);
} }
break; break;
+2 -1
View File
@@ -253,7 +253,7 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
break; break;
case 4: case 4:
GAMESTATE->m_PlayMode = PLAY_MODE_ENDLESS; GAMESTATE->m_PlayMode = PLAY_MODE_ENDLESS;
SCREENMAN->SetNewScreen( new ScreenSelectGroup ); SCREENMAN->SetNewScreen( new ScreenSelectCourse );
break; break;
default: default:
ASSERT(0); // bad selection ASSERT(0); // bad selection
@@ -379,6 +379,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
case 1: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM) ); break; case 1: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_MEDIUM) ); break;
case 2: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD) ); break; case 2: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD) ); break;
case 3: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI) ); break; case 3: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ONI) ); break;
case 4: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_DIFFICULTY_COMMENT_ENDLESS) ); break;
} }
if( iSelection >= 3 ) // chose something on page 2 if( iSelection >= 3 ) // chose something on page 2
+8 -2
View File
@@ -43,9 +43,15 @@ ScreenStage::ScreenStage()
if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI ) if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI )
{ {
m_textStage.SetText( "Challenge Mode" ); m_textStage.SetText( "Nonstop Challenge" );
m_textStage.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,1,1) ); // light blue m_textStage.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,1,1) ); // light blue
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_CHALLENGE) ); SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_ONI) );
}
else if( GAMESTATE->m_PlayMode == PLAY_MODE_ENDLESS )
{
m_textStage.SetText( "Endless Challenge" );
m_textStage.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,1,1) ); // light blue
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_ENDLESS) );
} }
else if( GAMESTATE->IsExtraStage() ) else if( GAMESTATE->IsExtraStage() )
{ {
+4 -7
View File
@@ -396,14 +396,12 @@ void SongManager::InitCoursesFromDisk()
Course course; Course course;
course.LoadFromCRSFile( "Courses\\" + saCourseFiles[i], m_pSongs ); course.LoadFromCRSFile( "Courses\\" + saCourseFiles[i], m_pSongs );
if( course.m_iStages > 0 ) if( course.m_iStages > 0 )
m_aCourses.Add( course ); m_aOniCourses.Add( course );
} }
/*
Chris: Default courses were a bad idea. Get rid of them.
// //
// Create default courses // Create endless courses
// //
CStringArray saGroupNames; CStringArray saGroupNames;
this->GetGroupNames( saGroupNames ); this->GetGroupNames( saGroupNames );
@@ -416,13 +414,12 @@ void SongManager::InitCoursesFromDisk()
for( DifficultyClass dc=CLASS_EASY; dc<=CLASS_HARD; dc=DifficultyClass(dc+1) ) // foreach DifficultyClass for( DifficultyClass dc=CLASS_EASY; dc<=CLASS_HARD; dc=DifficultyClass(dc+1) ) // foreach DifficultyClass
{ {
Course course; Course course;
course.CreateFromGroupAndDifficultyClass( sGroupName, dc, apGroupSongs ); course.CreateEndlessCourseFromGroupAndDifficultyClass( sGroupName, dc, apGroupSongs );
if( course.m_iStages > 0 ) if( course.m_iStages > 0 )
m_aCourses.Add( course ); m_aEndlessCourses.Add( course );
} }
} }
*/
} }
void SongManager::ReloadCourses() void SongManager::ReloadCourses()
+5 -2
View File
@@ -43,8 +43,11 @@ public:
void GetSongsInGroup( const CString sGroupName, CArray<Song*,Song*> &AddTo ); void GetSongsInGroup( const CString sGroupName, CArray<Song*,Song*> &AddTo );
// for Courses // for Oni
CArray<Course, Course> m_aCourses; CArray<Course, Course> m_aOniCourses;
// for Endless
CArray<Course, Course> m_aEndlessCourses;
void InitCoursesFromDisk(); void InitCoursesFromDisk();
void ReloadCourses(); void ReloadCourses();