|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-15 01:34:47
|
Module: performous
Branch: master
Commit: 34646e81d281c3458702c3d4e82dc07b039618ad
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jan 15 03:34:34 2010 +0200
Skip scoring if the note hasn't begun yet (fixes flashing on the next note)
---
game/player.cc | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/game/player.cc b/game/player.cc
index 8b8c7f5..7de86d5 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -25,6 +25,7 @@ void Player::update() {
double endTime = Engine::TIMESTEP * m_pos;
// Iterate over all the notes that are considered for this timestep
while (m_scoreIt != m_song.notes.end()) {
+ if (endTime < m_scoreIt->begin) break; // The note begins later than on this timestep
// If tone was detected, calculate score
if (t) {
double note = m_song.scale.getNote(t->freq);
@@ -33,7 +34,7 @@ void Player::update() {
m_score += score_addition;
m_noteScore += score_addition;
m_lineScore += score_addition;
- // Add power
+ // Add power if already on the note
m_scoreIt->power = std::max(m_scoreIt->power, m_scoreIt->powerFactor(note));
}
// If a row of lyrics ends, calculate how well it went
@@ -42,7 +43,7 @@ void Player::update() {
} else {
m_maxLineScore = 0; // Not in SLEEP note anymore, so reset maximum
}
- if (endTime < m_scoreIt->end) break;
+ if (endTime < m_scoreIt->end) break; // The note continues past this timestep
// Set accuracy
m_scoreIt->accuracy = std::max(m_scoreIt->accuracy, m_noteScore / m_song.m_scoreFactor / m_scoreIt->maxScore());
m_noteScore = 0; // Reset noteScore as we are moving on to the next one
|