|
From: Tapio V. <aa...@us...> - 2009-12-29 12:43:48
|
Module: performous
Branch: master
Commit: ecf26eeb4a65d85df65556e12ae5e5bc2a17fe2a
Author: Tapio Vierros <tap...@gm...>
Date: Tue Dec 29 13:41:17 2009 +0200
Fix most graphical bugs in instrument rewinding by not showing past notes.
Some remain in holds.
---
game/guitargraph.cc | 11 +++++++++--
game/guitargraph.hh | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 790121c..c1220dd 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -261,6 +261,8 @@ void GuitarGraph::endHold(int fret, double time) {
for (Chords::iterator it = m_chords.begin(); it != m_chords.end(); ++it) {
if (time >= it->begin && time <= it->end) {
it->releaseTimes[fret] = time;
+ if (it->status < 100 && time >= it->end - maxTolerance)
+ it->status += 100; // Mark as past note for rewinding
break;
}
}
@@ -522,10 +524,15 @@ void GuitarGraph::draw(double time) {
for (Chords::iterator it = m_chords.begin(); it != m_chords.end(); ++it) {
float tBeg = it->begin - time;
float tEnd = it->end - time;
- if (tEnd < past) continue;
if (tBeg > future) break;
+ if (tEnd < past) {
+ if (it->status < 100) it->status += 100; // Mark as past note for rewinding
+ continue;
+ }
+ if (it->status >= 100 || (tBeg > maxTolerance
+ && it->status > 0)) continue; // Don't show past chords when rewinding
for (int fret = 0; fret < 5; ++fret) { // Loop through the frets
- if (!it->fret[fret]) continue;
+ if (!it->fret[fret] || (tBeg > maxTolerance && it->releaseTimes[fret] > 0)) continue;
if (tEnd > future) tEnd = future;
unsigned event = m_notes[it->dur[fret]];
float glow = 0.0f;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 30209f6..1e3ebee 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -20,7 +20,7 @@ struct Chord {
Duration const* dur[5];
int polyphony;
bool tappable;
- int status; // Guitar: 0 = not played, 10 = tapped, 20 = picked, 30 = released, drums: number of pads hit
+ int status; // Guitar: 0 = not played, 10 = tapped, 20 = picked, 30 = released, drums: number of pads hit, all: >100 = past
int score;
AnimValue hitAnim[5];
double releaseTimes[5];
|