|
From: Tapio V. <aa...@us...> - 2010-08-21 19:54:06
|
Module: performous
Branch: master
Commit: efe23cdc5277f549558781817238c9433b37d7a0
Author: Tapio Vierros <tap...@gm...>
Date: Sat Aug 21 22:53:16 2010 +0300
Skip note rendering if time is NaN.
---
game/dancegraph.cc | 10 +++--
game/guitargraph.cc | 91 ++++++++++++++++++++++++++-------------------------
2 files changed, 52 insertions(+), 49 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 1ed5e18..710d976 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -441,10 +441,12 @@ void DanceGraph::draw(double time) {
}
// Draw the notes
- for (DanceNotes::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (it->note.end - time < past) continue;
- if (it->note.begin - time > future) continue;
- drawNote(*it, time); // Let's just do all the calculating in the sub, instead of passing them as a long list
+ if (time == time) { // Check that time is not NaN
+ for (DanceNotes::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
+ if (it->note.end - time < past) continue;
+ if (it->note.begin - time > future) continue;
+ drawNote(*it, time); // Let's just do all the calculating in the sub, instead of passing them as a long list
+ }
}
}
drawInfo(time, offsetX, dimensions); // Go draw some texts and other interface stuff
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 409298e..18053fc 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -812,57 +812,58 @@ void GuitarGraph::draw(double time) {
drawNote(4, c, m_dfIt->end - time, m_dfIt->end - time, 0, false, false, 0, 0);
}
}
- // Iterate chords
- for (Chords::iterator it = m_chords.begin(); it != m_chords.end(); ++it) {
- float tBeg = it->begin - time;
- float tEnd = m_drums ? tBeg : it->end - time;
- if (tBeg > future) break;
- if (tEnd < past) {
- if (it->status < 100) it->status += 100; // Mark as past note for rewinding
- continue;
- }
- // Don't show past chords when rewinding
- if (it->status >= 100 || (tBeg > maxTolerance && it->status > 0)) continue;
- // Handle notes during drum fills / BREs
- if (drumfill && it->begin >= m_dfIt->begin - maxTolerance
- && it->begin <= m_dfIt->end + maxTolerance) {
- if (it->status == 0) {
- it->status = it->polyphony; // Mark as hit so that streak doesn't reset
- m_drumfillScore += it->polyphony * 50.0; // Count points from notes under drum fill
+ if (time == time) { // Check that time is not NaN
+ // Iterate chords
+ for (Chords::iterator it = m_chords.begin(); it != m_chords.end(); ++it) {
+ float tBeg = it->begin - time;
+ float tEnd = m_drums ? tBeg : it->end - time;
+ if (tBeg > future) break;
+ if (tEnd < past) {
+ if (it->status < 100) it->status += 100; // Mark as past note for rewinding
+ continue;
}
- continue;
- }
- // Loop through the frets
- for (int fret = 0; fret < m_pads; ++fret) {
- 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;
- float whammy = 0.0f;
- if (event > 0) {
- glow = m_events[event - 1].glow.get();
- whammy = m_events[event - 1].whammy.get();
+ // Don't show past chords when rewinding
+ if (it->status >= 100 || (tBeg > maxTolerance && it->status > 0)) continue;
+ // Handle notes during drum fills / BREs
+ if (drumfill && it->begin >= m_dfIt->begin - maxTolerance
+ && it->begin <= m_dfIt->end + maxTolerance) {
+ if (it->status == 0) {
+ it->status = it->polyphony; // Mark as hit so that streak doesn't reset
+ m_drumfillScore += it->polyphony * 50.0; // Count points from notes under drum fill
+ }
+ continue;
}
- // Set the default color (disabled state)
- glutil::Color c(0.5f, 0.5f, 0.5f);
- if (!joining(time)) {
- // Get a color for the fret and adjust it if GodMode is on
- c = colorize(color(fret), it->begin);
- if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
- // Further adjust the color if the note is hit
- c.r += glow * 0.2f;
- c.g += glow * 0.2f;
- c.b += glow * 0.2f;
+ // Loop through the frets
+ for (int fret = 0; fret < m_pads; ++fret) {
+ 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;
+ float whammy = 0.0f;
+ if (event > 0) {
+ glow = m_events[event - 1].glow.get();
+ whammy = m_events[event - 1].whammy.get();
+ }
+ // Set the default color (disabled state)
+ glutil::Color c(0.5f, 0.5f, 0.5f);
+ if (!joining(time)) {
+ // Get a color for the fret and adjust it if GodMode is on
+ c = colorize(color(fret), it->begin);
+ if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
+ // Further adjust the color if the note is hit
+ c.r += glow * 0.2f;
+ c.g += glow * 0.2f;
+ c.b += glow * 0.2f;
+ }
+ if (glow > 0.5f && tEnd < 0.1f && it->hitAnim[fret].get() == 0.0)
+ it->hitAnim[fret].setTarget(1.0);
+ // Call the actual note drawing function
+ drawNote(fret, c, tBeg, tEnd, whammy, it->tappable, glow > 0.5f, it->hitAnim[fret].get(),
+ it->releaseTimes[fret] > 0.0 ? it->releaseTimes[fret] - time : getNaN());
}
- if (glow > 0.5f && tEnd < 0.1f && it->hitAnim[fret].get() == 0.0)
- it->hitAnim[fret].setTarget(1.0);
- // Call the actual note drawing function
- drawNote(fret, c, tBeg, tEnd, whammy, it->tappable, glow > 0.5f, it->hitAnim[fret].get(),
- it->releaseTimes[fret] > 0.0 ? it->releaseTimes[fret] - time : getNaN());
}
}
} //< disable lighting
-
// Draw flames
for (int fret = 0; fret < m_pads; ++fret) { // Loop through the frets
if (m_drums && fret == 0) { // Skip bass drum
|