simplify TimingAssist
add "exact" sound
This commit is contained in:
@@ -111,7 +111,8 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 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 isn't complete (not all taps have been hit), return -1. */
|
* 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. */
|
||||||
int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
||||||
{
|
{
|
||||||
float scoretime = -9999;
|
float scoretime = -9999;
|
||||||
@@ -122,7 +123,7 @@ int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
|||||||
if(GetTapNote(t, row) == TAP_EMPTY) continue;
|
if(GetTapNote(t, row) == TAP_EMPTY) continue;
|
||||||
|
|
||||||
TapNoteScore tns = GetTapNoteScore(t, row);
|
TapNoteScore tns = GetTapNoteScore(t, row);
|
||||||
if(tns == TNS_MISS) return t;
|
if(tns == TNS_NONE || tns == TNS_MISS) return t;
|
||||||
|
|
||||||
float tm = GetTapNoteOffset(t, row);
|
float tm = GetTapNoteOffset(t, row);
|
||||||
if(tm < scoretime) continue;
|
if(tm < scoretime) continue;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TimingAssist::TimingAssist()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Miss.Load(ANNOUNCER->GetPathTo("gameplay assist miss"));
|
Miss.Load(ANNOUNCER->GetPathTo("gameplay assist miss"));
|
||||||
|
Exact.Load(ANNOUNCER->GetPathTo("gameplay assist exact"));
|
||||||
memset(data, 0, sizeof(data));
|
memset(data, 0, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +56,20 @@ void TimingAssist::Update(float fDeltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimingAssist::Announce(TapNoteScore tns, bool early)
|
||||||
|
{
|
||||||
|
/* Only one miss and perfect/marv sound. We could have early/late
|
||||||
|
* sounds for perfect and marvelous, but let's just have one "exact"
|
||||||
|
* sound. We should have something else for advanced players who
|
||||||
|
* actually do want to know if they're late or early for a marvelous. */
|
||||||
|
if(tns == TNS_MISS)
|
||||||
|
Miss.PlayRandom();
|
||||||
|
else if(tns == TNS_PERFECT || tns == TNS_MARVELOUS)
|
||||||
|
Exact.PlayRandom();
|
||||||
|
else
|
||||||
|
Timing[tns][early].PlayRandom();
|
||||||
|
}
|
||||||
|
|
||||||
void TimingAssist::DoTimingAssist(PlayerNumber pn)
|
void TimingAssist::DoTimingAssist(PlayerNumber pn)
|
||||||
{
|
{
|
||||||
ASSERT(data[pn]);
|
ASSERT(data[pn]);
|
||||||
@@ -65,33 +80,19 @@ void TimingAssist::DoTimingAssist(PlayerNumber pn)
|
|||||||
const int maxrow = BeatToNoteRow(GAMESTATE->m_fSongBeat);
|
const int maxrow = BeatToNoteRow(GAMESTATE->m_fSongBeat);
|
||||||
for( ; LastRow <= maxrow; LastRow++)
|
for( ; LastRow <= maxrow; LastRow++)
|
||||||
{
|
{
|
||||||
TapNoteScore mintns = data[pn]->MinTapNoteScore(LastRow);
|
|
||||||
|
|
||||||
/* If the minimum score is TNS_NONE, then not all notes on this row have
|
|
||||||
* been graded, so stop. */
|
|
||||||
if(mintns == TNS_NONE) return;
|
|
||||||
|
|
||||||
/* Don't announce if the score is the maximum. */
|
|
||||||
if(mintns == TNS_MARVELOUS) continue;
|
|
||||||
if(mintns == TNS_PERFECT && !PREFSMAN->m_bMarvelousTiming) continue;
|
|
||||||
|
|
||||||
if(mintns == TNS_MISS)
|
|
||||||
{
|
|
||||||
Miss.PlayRandom();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int last_tns_track = data[pn]->LastTapNoteScoreTrack(LastRow);
|
const int last_tns_track = data[pn]->LastTapNoteScoreTrack(LastRow);
|
||||||
|
|
||||||
/* We shouldn't get here if there're no notes on this row, since MinTNS
|
/* -1 means the row has no tap notes; it's irrelevant. */
|
||||||
* above should have returned TNS_NONE. */
|
if(last_tns_track == -1) continue;
|
||||||
ASSERT(last_tns_track != -1);
|
|
||||||
|
|
||||||
const TapNoteScore last_tns = data[pn]->GetTapNoteScore(last_tns_track, LastRow);
|
const TapNoteScore last_tns = data[pn]->GetTapNoteScore(last_tns_track, LastRow);
|
||||||
|
/* TNS_NONE means the row is incomplete--it hasn't been graded yet. */
|
||||||
|
if(last_tns == TNS_NONE) return;
|
||||||
|
|
||||||
const float offset = data[pn]->GetTapNoteOffset(last_tns_track, LastRow);
|
const float offset = data[pn]->GetTapNoteOffset(last_tns_track, LastRow);
|
||||||
const bool early = offset < 0;
|
const bool early = offset < 0;
|
||||||
|
|
||||||
Timing[last_tns][early].PlayRandom();
|
Announce(last_tns, early);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void DoTimingAssist(PlayerNumber pn);
|
void DoTimingAssist(PlayerNumber pn);
|
||||||
|
void Announce(TapNoteScore tns, bool early);
|
||||||
|
|
||||||
RandomSample Timing[NUM_TAP_NOTE_SCORES][2];
|
RandomSample Timing[NUM_TAP_NOTE_SCORES][2];
|
||||||
RandomSample Miss;
|
RandomSample Miss, Exact;
|
||||||
|
|
||||||
NoteDataWithScoring *data[NUM_PLAYERS];
|
NoteDataWithScoring *data[NUM_PLAYERS];
|
||||||
int LastRow;
|
int LastRow;
|
||||||
|
|||||||
Reference in New Issue
Block a user