fix subtle bugs that caused inaccurate judgment totals with AI player

This commit is contained in:
Chris Danford
2003-04-10 05:46:31 +00:00
parent 17e9a7d777
commit 04145caf72
20 changed files with 88 additions and 74 deletions
+2 -1
View File
@@ -110,8 +110,9 @@ void Inventory::Update( float fDelta )
if( iLastSecond != iThisSecond ) if( iLastSecond != iThisSecond )
{ {
int iSlotToConsider = rand()%NUM_INVENTORY_SLOTS; int iSlotToConsider = rand()%NUM_INVENTORY_SLOTS;
bool bTimeToUse = (rand()%10)==0;
if( GAMESTATE->m_sInventory[m_PlayerNumber][iSlotToConsider] != "" && if( GAMESTATE->m_sInventory[m_PlayerNumber][iSlotToConsider] != "" &&
rand()%5 == 0 ) bTimeToUse )
{ {
UseItem( iSlotToConsider ); UseItem( iSlotToConsider );
} }
+1 -1
View File
@@ -135,7 +135,7 @@ MusicWheel::MusicWheel()
GAMESTATE->m_pCurSong = pSong; GAMESTATE->m_pCurSong = pSong;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
{ {
GAMESTATE->m_pCurNotes[p] = pNotes; GAMESTATE->m_pCurNotes[p] = pNotes;
GAMESTATE->m_PlayerOptions[p] = po; GAMESTATE->m_PlayerOptions[p] = po;
+8 -2
View File
@@ -102,14 +102,20 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
TapNoteScore score = TNS_MARVELOUS; TapNoteScore score = TNS_MARVELOUS;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
/* If there's no tap note on this row, skip it; the score will always be TNS_NONE. */ /* If there's no tap note on this row, skip it, or else the score will always be TNS_NONE. */
if(GetTapNote(t, row) == TAP_EMPTY) continue; if(GetTapNote(t, row) == TAP_EMPTY)
continue;
score = min( score, GetTapNoteScore(t, row) ); score = min( score, GetTapNoteScore(t, row) );
} }
return score; return score;
} }
bool NoteDataWithScoring::IsRowCompletelyJudged(unsigned row) const
{
return MinTapNoteScore(row) >= TNS_MISS;
}
/* Return the last tap score of a row: the grade of the tap that completed /* Return the last tap score of a row: the grade of the tap that completed
* the row. If the row has no tap notes, return -1. If any tap notes aren't * the row. If the row has no tap notes, return -1. If any tap notes aren't
* graded (any tap is TNS_NONE) or are missed (TNS_MISS), return it. */ * graded (any tap is TNS_NONE) or are missed (TNS_MISS), return it. */
+1
View File
@@ -49,6 +49,7 @@ public:
float GetHoldNoteLife(unsigned h) const; float GetHoldNoteLife(unsigned h) const;
void SetHoldNoteLife(unsigned h, float f); void SetHoldNoteLife(unsigned h, float f);
bool IsRowCompletelyJudged(unsigned row) const;
TapNoteScore MinTapNoteScore(unsigned row) const; TapNoteScore MinTapNoteScore(unsigned row) const;
int LastTapNoteScoreTrack(unsigned row) const; int LastTapNoteScoreTrack(unsigned row) const;
TapNoteScore LastTapNoteScore(unsigned row) const; TapNoteScore LastTapNoteScore(unsigned row) const;
+28 -22
View File
@@ -10,9 +10,9 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Player.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include <math.h> // for fabs() #include <math.h> // for fabs()
#include "Player.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
@@ -195,21 +195,19 @@ void Player::Update( float fDeltaTime )
if( hn.fStartBeat < fSongBeat && fSongBeat < hn.fEndBeat ) // if the song beat is in the range of this hold if( hn.fStartBeat < fSongBeat && fSongBeat < hn.fEndBeat ) // if the song beat is in the range of this hold
{ {
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN ) // TODO: Make the CPU miss sometimes.
// TODO: Make the CPU miss sometimes.
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN )
bIsHoldingButton = true; bIsHoldingButton = true;
m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote; // set host flag so NoteField can do intelligent drawing m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote; // set host flag so NoteField can do intelligent drawing
if( bSteppedOnTapNote ) // this note is not judged and we stepped on its head if( bSteppedOnTapNote ) // this note is not judged and we stepped on its head
{
m_NoteField.GetHoldNote(i).fStartBeat = fSongBeat; // move the start of this Hold m_NoteField.GetHoldNote(i).fStartBeat = fSongBeat; // move the start of this Hold
}
if( bSteppedOnTapNote && bIsHoldingButton ) if( bSteppedOnTapNote && bIsHoldingButton )
{ {
// Increase life // Increase life
// fLife += fDeltaTime/PREFSMAN->m_fJudgeWindowOKSeconds;
// fLife = min( fLife, 1 ); // clamp
fLife = 1; fLife = 1;
m_GhostArrowRow.HoldNote( hn.iTrack ); // update the "electric ghost" effect m_GhostArrowRow.HoldNote( hn.iTrack ); // update the "electric ghost" effect
@@ -240,7 +238,7 @@ void Player::Update( float fDeltaTime )
if( hns != HNS_NONE ) if( hns != HNS_NONE )
{ {
/* this note's been judged */ /* this note has been judged */
HandleHoldScore( hns, tns ); HandleHoldScore( hns, tns );
m_HoldJudgment[hn.iTrack].SetHoldJudgment( hns ); m_HoldJudgment[hn.iTrack].SetHoldJudgment( hns );
} }
@@ -371,11 +369,23 @@ void Player::Step( int col )
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGreatSeconds ) score = TNS_GREAT; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGreatSeconds ) score = TNS_GREAT;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGoodSeconds ) score = TNS_GOOD; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGoodSeconds ) score = TNS_GOOD;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowBooSeconds ) score = TNS_BOO; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowBooSeconds ) score = TNS_BOO;
else score = TNS_NONE; else
{
// if this step is worse than Boo, we shouldn't be here in the first place.
ASSERT(0);
return;
}
} }
else else
{ {
score = PlayerAI::GetTapNoteScore( GAMESTATE->m_PlayerController[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) ); score = PlayerAI::GetTapNoteScore( GAMESTATE->m_PlayerController[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) );
/* AI will generate misses here. Don't handle a miss like a regular note because
* we want the judgment animation to appear delayed. Instead, return early if
* AI generated a miss, and let UpdateMissedTapNotesOlderThan() detect and handle the
* misses. */
if( score == TNS_MISS )
return;
} }
if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming ) if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming )
@@ -387,11 +397,14 @@ void Player::Step( int col )
SetTapNoteScore(col, iIndexOverlappingNote, score); SetTapNoteScore(col, iIndexOverlappingNote, score);
SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset); SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
if ( score >= TNS_GREAT ) if( GAMESTATE->m_PlayerController[m_PlayerNumber] == HUMAN &&
score >= TNS_GREAT )
HandleAutosync(fNoteOffset); HandleAutosync(fNoteOffset);
if (score > TNS_NONE && MinTapNoteScore(iIndexOverlappingNote) >= TNS_BOO ) ASSERT( score != TNS_NONE );
OnRowDestroyed( iIndexOverlappingNote );
if( IsRowCompletelyJudged(iIndexOverlappingNote) )
OnRowCompletelyJudged( iIndexOverlappingNote );
} }
if( !bDestroyedNote ) if( !bDestroyedNote )
@@ -420,9 +433,9 @@ void Player::HandleAutosync(float fNoteOffset)
} }
void Player::OnRowDestroyed( int iIndexThatWasSteppedOn ) void Player::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
{ {
LOG->Trace( "Player::OnRowDestroyed" ); LOG->Trace( "Player::OnRowCompletelyJudged" );
/* Find the minimum score of the row. This will never be TNS_NONE, since this /* Find the minimum score of the row. This will never be TNS_NONE, since this
* function is only called when a row is completed. */ * function is only called when a row is completed. */
@@ -515,14 +528,9 @@ void Player::CrossedRow( int iNoteRow )
{ {
// check to see if there's at the crossed row // check to see if there's at the crossed row
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{
if( GetTapNote(t, iNoteRow) != TAP_EMPTY ) if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
{ if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN )
TapNoteScore tns = PlayerAI::GetTapNoteScore( GAMESTATE->m_PlayerController[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) ); Step( t );
if( tns!=TNS_MISS )
this->Step( t );
}
}
} }
@@ -572,8 +580,6 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
if( m_pLifeMeter ) { if( m_pLifeMeter ) {
m_pLifeMeter->ChangeLife( holdScore, tapScore ); m_pLifeMeter->ChangeLife( holdScore, tapScore );
// refresh Oni life meter
m_pLifeMeter->OnDancePointsChange(); m_pLifeMeter->OnDancePointsChange();
} }
} }
+1 -1
View File
@@ -54,7 +54,7 @@ public:
protected: protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void OnRowDestroyed( int iStepIndex ); void OnRowCompletelyJudged( int iStepIndex );
void HandleTapRowScore( unsigned row ); void HandleTapRowScore( unsigned row );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
void HandleAutosync(float fNoteOffset); void HandleAutosync(float fNoteOffset);
+7 -5
View File
@@ -23,7 +23,7 @@ struct TapScoreDistribution
float fRand = randomf(0,1); float fRand = randomf(0,1);
ASSERT( iDifficultyExponent >= 1 ); ASSERT( iDifficultyExponent >= 1 );
fRand = powf(fRand, iDifficultyExponent); fRand = powf(fRand, iDifficultyExponent);
for( int i=0; i<NUM_TAP_NOTE_SCORES; i++ ) for( int i=TNS_MISS; i<=TNS_MARVELOUS; i++ )
if( fRand <= fCumulativeProbability[i] ) if( fRand <= fCumulativeProbability[i] )
return (TapNoteScore)i; return (TapNoteScore)i;
ASSERT(0); // the last probability must be 1.0, so we should never get here! ASSERT(0); // the last probability must be 1.0, so we should never get here!
@@ -67,10 +67,10 @@ TapScoreDistribution TAP_SCORE_DISTRIBUTIONS[NUM_PLAYER_CONTROLLERS] =
{ {
0.00f, // TNS_NONE 0.00f, // TNS_NONE
0.005f, // TNS_MISS 0.005f, // TNS_MISS
0.010f, // TNS_BOO 0.007f, // TNS_BOO
0.03f, // TNS_GOOD 0.01f, // TNS_GOOD
0.10f, // TNS_GREAT 0.10f, // TNS_GREAT
0.50f, // TNS_PERFECT 0.60f, // TNS_PERFECT
1.00f, // TNS_MARVELOUS 1.00f, // TNS_MARVELOUS
}, },
// CPU_AUTOPLAY // CPU_AUTOPLAY
@@ -88,5 +88,7 @@ TapScoreDistribution TAP_SCORE_DISTRIBUTIONS[NUM_PLAYER_CONTROLLERS] =
TapNoteScore PlayerAI::GetTapNoteScore( PlayerController pc, int iSumOfAttackLevels ) TapNoteScore PlayerAI::GetTapNoteScore( PlayerController pc, int iSumOfAttackLevels )
{ {
return TAP_SCORE_DISTRIBUTIONS[pc].GetTapNoteScore( iSumOfAttackLevels+1 ); TapNoteScore tns = TAP_SCORE_DISTRIBUTIONS[pc].GetTapNoteScore( iSumOfAttackLevels+1 );
ASSERT( tns != TNS_NONE ); // sanity check on PlayerAI's result
return tns;
} }
+1 -1
View File
@@ -114,7 +114,7 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const
if( !MenuI.IsValid() ) if( !MenuI.IsValid() )
return; return;
if( !GAMESTATE->IsPlayerEnabled(MenuI.player) ) if( !GAMESTATE->IsHumanPlayer(MenuI.player) )
return; return;
switch( MenuI.button ) switch( MenuI.button )
+3
View File
@@ -29,6 +29,7 @@
#include "NoteSkinManager.h" #include "NoteSkinManager.h"
#include "Notes.h" #include "Notes.h"
#include <utility> #include <utility>
#include "NoteFieldPositioning.h"
const float RECORD_HOLD_SECONDS = 0.3f; const float RECORD_HOLD_SECONDS = 0.3f;
@@ -271,6 +272,8 @@ ScreenEdit::ScreenEdit()
GAMESTATE->m_PlayerController[PLAYER_1] = HUMAN; GAMESTATE->m_PlayerController[PLAYER_1] = HUMAN;
m_Player.SetXY( PLAYER_X, PLAYER_Y ); m_Player.SetXY( PLAYER_X, PLAYER_Y );
GAMESTATE->m_Position[PLAYER_1]->LoadFromStyleDef(GAMESTATE->GetCurrentStyleDef(), PLAYER_1);
m_Fade.SetClosed(); m_Fade.SetClosed();
m_sprHelp.Load( THEME->GetPathTo("Graphics","ScreenEdit help") ); m_sprHelp.Load( THEME->GetPathTo("Graphics","ScreenEdit help") );
+9 -9
View File
@@ -189,16 +189,16 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type )
case stage: case stage:
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], stageStats.fScore[p], bNewRecord[p] ); GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], stageStats.fScore[p], bNewRecord[p] );
} }
break; break;
case summary: case summary:
{ {
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
bool bIsPlayerEnabled[NUM_PLAYERS]; bool bIsHumanPlayer[NUM_PLAYERS];
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
bIsPlayerEnabled[p] = GAMESTATE->IsPlayerEnabled(p); bIsHumanPlayer[p] = GAMESTATE->IsHumanPlayer(p);
RankingCategory cat[NUM_PLAYERS]; RankingCategory cat[NUM_PLAYERS];
int iRankingIndex[NUM_PLAYERS]; int iRankingIndex[NUM_PLAYERS];
@@ -208,7 +208,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type )
cat[p] = AverageMeterToRankingCategory( fAverageMeter ); cat[p] = AverageMeterToRankingCategory( fAverageMeter );
} }
SONGMAN->AddScores( nt, bIsPlayerEnabled, cat, stageStats.fScore, iRankingIndex ); SONGMAN->AddScores( nt, bIsHumanPlayer, cat, stageStats.fScore, iRankingIndex );
COPY( GAMESTATE->m_RankingCategory, cat ); COPY( GAMESTATE->m_RankingCategory, cat );
COPY( GAMESTATE->m_iRankingIndex, iRankingIndex ); COPY( GAMESTATE->m_iRankingIndex, iRankingIndex );
@@ -218,14 +218,14 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type )
case course: case course:
{ {
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
bool bIsPlayerEnabled[NUM_PLAYERS]; bool bIsHumanPlayer[NUM_PLAYERS];
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
bIsPlayerEnabled[p] = GAMESTATE->IsPlayerEnabled(p); bIsHumanPlayer[p] = GAMESTATE->IsHumanPlayer(p);
int iRankingIndex[NUM_PLAYERS]; int iRankingIndex[NUM_PLAYERS];
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
pCourse->AddScores( nt, bIsPlayerEnabled, stageStats.iActualDancePoints, stageStats.fAliveSeconds, iRankingIndex, bNewRecord ); pCourse->AddScores( nt, bIsHumanPlayer, stageStats.iActualDancePoints, stageStats.fAliveSeconds, iRankingIndex, bNewRecord );
COPY( GAMESTATE->m_iRankingIndex, iRankingIndex ); COPY( GAMESTATE->m_iRankingIndex, iRankingIndex );
GAMESTATE->m_pRankingCourse = pCourse; GAMESTATE->m_pRankingCourse = pCourse;
GAMESTATE->m_RankingNotesType = nt; GAMESTATE->m_RankingNotesType = nt;
@@ -483,7 +483,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type )
case 3: iValue = stageStats.iTapNoteScores[p][TNS_GOOD]; break; case 3: iValue = stageStats.iTapNoteScores[p][TNS_GOOD]; break;
case 4: iValue = stageStats.iTapNoteScores[p][TNS_BOO]; break; case 4: iValue = stageStats.iTapNoteScores[p][TNS_BOO]; break;
case 5: iValue = stageStats.iTapNoteScores[p][TNS_MISS]; break; case 5: iValue = stageStats.iTapNoteScores[p][TNS_MISS]; break;
case 6: iValue = stageStats.iTapNoteScores[p][HNS_OK]; break; case 6: iValue = stageStats.iHoldNoteScores[p][HNS_OK]; break;
case 7: iValue = stageStats.iMaxCombo[p]; break; case 7: iValue = stageStats.iMaxCombo[p]; break;
default: iValue = 0; ASSERT(0); default: iValue = 0; ASSERT(0);
} }
@@ -829,7 +829,7 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn )
{ {
bool bOnePassed = false; bool bOnePassed = false;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
bOnePassed |= !GAMESTATE->m_CurStageStats.bFailed[p]; bOnePassed |= !GAMESTATE->m_CurStageStats.bFailed[p];
if( bOnePassed ) if( bOnePassed )
+3 -3
View File
@@ -379,7 +379,7 @@ void ScreenEz2SelectMusic::DrawPrimitives()
void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn ) void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn )
{ {
if( !GAMESTATE->IsPlayerEnabled(pn) ) if( !GAMESTATE->IsHumanPlayer(pn) )
return; return;
if( m_arrayNotes[pn].empty() ) if( m_arrayNotes[pn].empty() )
return; return;
@@ -406,7 +406,7 @@ void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn )
void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn ) void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn )
{ {
if( !GAMESTATE->IsPlayerEnabled(pn if( !GAMESTATE->IsHumanPlayer(pn
) ) ) )
return; return;
if( m_arrayNotes[pn].empty() ) if( m_arrayNotes[pn].empty() )
@@ -464,7 +464,7 @@ void ScreenEz2SelectMusic::MusicChanged()
for( pn=0; pn<NUM_PLAYERS; pn++ ) for( pn=0; pn<NUM_PLAYERS; pn++ )
{ {
if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(pn) ) ) if( !GAMESTATE->IsHumanPlayer( PlayerNumber(pn) ) )
continue; continue;
for( unsigned i=0; i<m_arrayNotes[pn].size(); i++ ) for( unsigned i=0; i<m_arrayNotes[pn].size(); i++ )
{ {
+2 -8
View File
@@ -943,16 +943,10 @@ void ScreenGameplay::Update( float fDeltaTime )
int iRowNow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); int iRowNow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
if( iRowNow >= 0 ) if( iRowNow >= 0 )
{ {
for( int r=m_iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update for( ; m_iRowLastCrossed <= iRowNow; m_iRowLastCrossed++ ) // for each index we crossed since the last update
{
for( pn=0; pn<NUM_PLAYERS; pn++ ) for( pn=0; pn<NUM_PLAYERS; pn++ )
{
if( GAMESTATE->IsPlayerEnabled(pn) ) if( GAMESTATE->IsPlayerEnabled(pn) )
m_Player[pn].CrossedRow( r ); m_Player[pn].CrossedRow( m_iRowLastCrossed );
}
}
m_iRowLastCrossed = iRowNow;
} }
if( GAMESTATE->m_SongOptions.m_bAssistTick && IsTimeToPlayTicks()) if( GAMESTATE->m_SongOptions.m_bAssistTick && IsTimeToPlayTicks())
+1 -1
View File
@@ -47,7 +47,7 @@ ScreenInstructions::ScreenInstructions()
Difficulty easiestDifficulty = (Difficulty)(NUM_DIFFICULTIES-1); Difficulty easiestDifficulty = (Difficulty)(NUM_DIFFICULTIES-1);
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
continue; continue;
easiestDifficulty = min( easiestDifficulty, GAMESTATE->m_PreferredDifficulty[p] ); easiestDifficulty = min( easiestDifficulty, GAMESTATE->m_PreferredDifficulty[p] );
} }
+2 -2
View File
@@ -144,7 +144,7 @@ ScreenNameEntry::ScreenNameEntry()
// remove modifiers that may have been on the last song // remove modifiers that may have been on the last song
GAMESTATE->m_PlayerOptions[p] = PlayerOptions(); GAMESTATE->m_PlayerOptions[p] = PlayerOptions();
ASSERT( GAMESTATE->IsPlayerEnabled(p) ); // they better be enabled if they made a high score! ASSERT( GAMESTATE->IsHumanPlayer(p) ); // they better be enabled if they made a high score!
m_GrayArrowRow[p].Load( (PlayerNumber)p ); m_GrayArrowRow[p].Load( (PlayerNumber)p );
m_GrayArrowRow[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] ); m_GrayArrowRow[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
@@ -363,7 +363,7 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
StageStats stats; StageStats stats;
GAMESTATE->GetFinalEvalStatsAndSongs( stats, vSongs ); GAMESTATE->GetFinalEvalStatsAndSongs( stats, vSongs );
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
max_grade = max( max_grade, stats.GetGrade((PlayerNumber)p) ); max_grade = max( max_grade, stats.GetGrade((PlayerNumber)p) );
if( max_grade >= GRADE_AA ) if( max_grade >= GRADE_AA )
SCREENMAN->SetNewScreen( "ScreenCredits" ); SCREENMAN->SetNewScreen( "ScreenCredits" );
+5 -5
View File
@@ -100,7 +100,7 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRow[], int iNumOptionLin
// init highlights and underlines // init highlights and underlines
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip continue; // skip
for( int l=0; l<m_iNumOptionRows; l++ ) for( int l=0; l<m_iNumOptionRows; l++ )
@@ -226,7 +226,7 @@ void ScreenOptions::InitOptionsText()
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
{ {
BitmapText &option = m_textItems[i][p]; BitmapText &option = m_textItems[i][p];
@@ -386,7 +386,7 @@ void ScreenOptions::UpdateEnabledDisabled()
{ {
bool bThisRowIsSelected = false; bool bThisRowIsSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] == i ) if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == i )
bThisRowIsSelected = true; bThisRowIsSelected = true;
m_sprBullets[i].SetDiffuse( bThisRowIsSelected ? colorSelected : colorNotSelected ); m_sprBullets[i].SetDiffuse( bThisRowIsSelected ? colorSelected : colorNotSelected );
@@ -403,7 +403,7 @@ void ScreenOptions::UpdateEnabledDisabled()
bool bThisRowIsSelectedByBoth = true; bool bThisRowIsSelectedByBoth = true;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] != i ) if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != i )
bThisRowIsSelectedByBoth = false; bThisRowIsSelectedByBoth = false;
m_textItems[i][0].SetDiffuse( bThisRowIsSelectedByBoth ? colorNotSelected : colorSelected ); m_textItems[i][0].SetDiffuse( bThisRowIsSelectedByBoth ? colorNotSelected : colorSelected );
if( bThisRowIsSelectedByBoth ) if( bThisRowIsSelectedByBoth )
@@ -511,7 +511,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn )
{ {
bool bAllOnExit = true; bool bAllOnExit = true;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] != m_iNumOptionRows ) if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != m_iNumOptionRows )
bAllOnExit = false; bAllOnExit = false;
if( m_iCurrentRow[pn] != m_iNumOptionRows ) // not on exit if( m_iCurrentRow[pn] != m_iNumOptionRows ) // not on exit
+2 -2
View File
@@ -51,8 +51,8 @@ ScreenPrompt::ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, bool b
m_rectAnswerBox.SetDiffuse( RageColor(0.5f,0.5f,1.0f,0.7f) ); m_rectAnswerBox.SetDiffuse( RageColor(0.5f,0.5f,1.0f,0.7f) );
this->AddChild( &m_rectAnswerBox ); this->AddChild( &m_rectAnswerBox );
m_textAnswer[0].LoadFromFont( THEME->GetPathTo("Fonts","header1") ); m_textAnswer[0].LoadFromFont( THEME->GetPathTo("Fonts","_shared1") );
m_textAnswer[1].LoadFromFont( THEME->GetPathTo("Fonts","header1") ); m_textAnswer[1].LoadFromFont( THEME->GetPathTo("Fonts","_shared1") );
m_textAnswer[0].SetY( PROMPT_Y ); m_textAnswer[0].SetY( PROMPT_Y );
m_textAnswer[1].SetY( PROMPT_Y ); m_textAnswer[1].SetY( PROMPT_Y );
this->AddChild( &m_textAnswer[0] ); this->AddChild( &m_textAnswer[0] );
+1 -1
View File
@@ -232,7 +232,7 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
case SM_MenuTimer: case SM_MenuTimer:
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
MenuStart( (PlayerNumber)p ); MenuStart( (PlayerNumber)p );
} }
break; break;
+3 -3
View File
@@ -101,7 +101,7 @@ ScreenSelectCourse::ScreenSelectCourse()
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) ) if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
continue; // skip continue; // skip
m_sprHighScoreFrame[p].Load( THEME->GetPathTo("Graphics","ScreenSelectCourse score frame") ); m_sprHighScoreFrame[p].Load( THEME->GetPathTo("Graphics","ScreenSelectCourse score frame") );
@@ -211,7 +211,7 @@ void ScreenSelectCourse::Input( const DeviceInput& DeviceI, InputEventType type,
if( MenuI.button == MENU_BUTTON_RIGHT || MenuI.button == MENU_BUTTON_LEFT ) if( MenuI.button == MENU_BUTTON_RIGHT || MenuI.button == MENU_BUTTON_LEFT )
{ {
if( !MenuI.IsValid() ) return; if( !MenuI.IsValid() ) return;
if( !GAMESTATE->IsPlayerEnabled(MenuI.player) ) return; if( !GAMESTATE->IsHumanPlayer(MenuI.player) ) return;
int dir = 0; int dir = 0;
if(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) ) if(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) )
@@ -432,7 +432,7 @@ void ScreenSelectCourse::UpdateOptionsDisplays()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
{ {
CString s = GAMESTATE->m_PlayerOptions[p].GetString(); CString s = GAMESTATE->m_PlayerOptions[p].GetString();
s.Replace( ", ", "\n" ); s.Replace( ", ", "\n" );
+6 -6
View File
@@ -183,7 +183,7 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
} }
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsHumanPlayer(p) )
{ {
MenuRight( (PlayerNumber)p ); MenuRight( (PlayerNumber)p );
MenuLeft( (PlayerNumber)p ); MenuLeft( (PlayerNumber)p );
@@ -227,7 +227,7 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
// If anyone has already chosen, don't allow changing of pages // If anyone has already chosen, don't allow changing of pages
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && m_bChosen[p] ) if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
return; return;
bool bPageIncreasing = newPage > m_CurrentPage; bool bPageIncreasing = newPage > m_CurrentPage;
@@ -257,7 +257,7 @@ void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice,
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip continue; // skip
if( p!=pn && m_CurrentPage==PAGE_1 ) if( p!=pn && m_CurrentPage==PAGE_1 )
@@ -333,7 +333,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
// check to see if everyone has chosen // check to see if everyone has chosen
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( GAMESTATE->IsPlayerEnabled((PlayerNumber)p) && m_bChosen[p] == false ) if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) && m_bChosen[p] == false )
return; return;
} }
this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on
@@ -357,7 +357,7 @@ void ScreenSelectDifficulty::TweenOnScreen()
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) ) if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
continue; continue;
float fCursorX = GetCursorX( (PlayerNumber)p ); float fCursorX = GetCursorX( (PlayerNumber)p );
@@ -380,7 +380,7 @@ void ScreenSelectDifficulty::TweenOffScreen()
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) ) if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
continue; continue;
m_sprCursor[p].Command( CURSOR_OFF_COMMAND ); m_sprCursor[p].Command( CURSOR_OFF_COMMAND );
+2 -1
View File
@@ -81,7 +81,8 @@ Grade StageStats::GetGrade( PlayerNumber pn )
iTapNoteScores[pn][TNS_GREAT] == 0 && iTapNoteScores[pn][TNS_GREAT] == 0 &&
iTapNoteScores[pn][TNS_GOOD] == 0 && iTapNoteScores[pn][TNS_GOOD] == 0 &&
iTapNoteScores[pn][TNS_BOO] == 0 && iTapNoteScores[pn][TNS_BOO] == 0 &&
iTapNoteScores[pn][TNS_MISS] == 0 ) iTapNoteScores[pn][TNS_MISS] == 0 &&
iHoldNoteScores[pn][HNS_NG] == 0 )
return GRADE_AAAA; return GRADE_AAAA;
if ( fPercentDancePoints == 1.00 ) return GRADE_AAA; if ( fPercentDancePoints == 1.00 ) return GRADE_AAA;