Skip to content

Commit

Permalink
Fix odd judge counting in Replays
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Sep 6, 2018
1 parent 1d1b166 commit 2f5d2d4
Showing 1 changed file with 49 additions and 22 deletions.
71 changes: 49 additions & 22 deletions src/NoteDataWithScoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "PlayerStageStats.h"
#include "ThemeMetric.h"
#include "TimingData.h"
#include "GamePreferences.h"

namespace
{
Expand All @@ -21,36 +22,62 @@ int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )
{
float scoretime = -9999;
int best_track = -1;
for( int t=0; t<in.GetNumTracks(); t++ )
if (GamePreferences::m_AutoPlay == PC_REPLAY)
{
/* Skip empty tracks and mines */
const TapNote &tn = in.GetTapNote( t, iRow );
if (tn.type == TapNoteType_Empty ||
tn.type == TapNoteType_Mine ||
tn.type == TapNoteType_Fake ||
tn.type == TapNoteType_AutoKeysound)
continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID )
continue;

TapNoteScore tns = tn.result.tns;

if ( tns == TNS_Miss || (!GAMESTATE->CountNotesSeparately() && tns == TNS_None) )
// In replay mode, judging misses as the "last" tap of every single row breaks judge counting.
// Since we judge left to right in Replay, we just check to see which track was last judged.
for (int t = in.GetNumTracks() - 1; t >= 0; t--)
{
const TapNote &tn = in.GetTapNote(t, iRow);
if (tn.type == TapNoteType_Empty ||
tn.type == TapNoteType_Mine ||
tn.type == TapNoteType_Fake ||
tn.type == TapNoteType_AutoKeysound)
continue;
if (tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID)
continue;

TapNoteScore tns = tn.result.tns;
if (tns == TNS_None)
continue;
best_track = t;
return t;
}
if ( tns == TNS_None )
continue;
return best_track;
}
else
{
for( int t=0; t<in.GetNumTracks(); t++ )
{
/* Skip empty tracks and mines */
const TapNote &tn = in.GetTapNote( t, iRow );
if (tn.type == TapNoteType_Empty ||
tn.type == TapNoteType_Mine ||
tn.type == TapNoteType_Fake ||
tn.type == TapNoteType_AutoKeysound)
continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID )
continue;

TapNoteScore tns = tn.result.tns;

if ( tns == TNS_Miss || (!GAMESTATE->CountNotesSeparately() && tns == TNS_None) )
{
return t;
}
if ( tns == TNS_None )
continue;


float tm = tn.result.fTapNoteOffset;
if(tm < scoretime) continue;
float tm = tn.result.fTapNoteOffset;
if(tm < scoretime) continue;

scoretime = tm;
best_track = t;
}
scoretime = tm;
best_track = t;
}

return best_track;
return best_track;
}
}

/* Return the minimum tap score of a row: the lowest grade of the tap in the row.
Expand Down

0 comments on commit 2f5d2d4

Please sign in to comment.