|
From: Tapio V. <aa...@us...> - 2009-12-14 14:43:53
|
Module: performous
Branch: master
Commit: e536449de1310d79701fc3967e05eeeabcfe0a2e
Author: Tapio Vierros <tap...@gm...>
Date: Mon Dec 14 16:40:09 2009 +0200
Fixes to disappearing instrument notes.
* No more 'jumping' when note is played early
* Drum chords handled correctly
* Drum bass pedal disappears also
---
game/guitargraph.cc | 11 ++++++-----
game/guitargraph.hh | 5 +++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d4d748a..46b62e0 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -512,10 +512,10 @@ void GuitarGraph::draw(double time) {
c.r += glow;
c.g += glow;
c.b += glow;
- if (glow > 0.5f && tEnd < 0.1f && it->hitAnim.get() == 0.0)
- it->hitAnim.setTarget(1.0);
+ 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.get(),
+ drawNote(fret, c, tBeg, tEnd, whammy, it->tappable, glow > 0.5f, it->hitAnim[fret].get(),
it->releaseTimes[fret] > 0.0 ? it->releaseTimes[fret] - time : 0.0);
}
}
@@ -561,11 +561,12 @@ void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd, fl
float x = -2.0f + fret;
if (m_drums) x -= 0.5f;
if (m_drums && fret == 0) {
+ if (hit || hitAnim > 0) return;
c.a = time2a(tBeg); glColor4fv(c);
- drawBar(tBeg, 0.01f);
+ drawBar(tBeg, 0.015f);
return;
}
- float yBeg = (hit || hitAnim > 0) ? time2y(0.0) : time2y(tBeg);
+ float yBeg = (hit || hitAnim > 0) ? std::min(time2y(0.0), time2y(tBeg)): time2y(tBeg);
float yEnd = time2y(tEnd);
if (yBeg - 2 * fretWid >= yEnd) {
if (releaseTime != 0.0 && tEnd - releaseTime > 0.1) yBeg = time2y(releaseTime);
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index b9ec155..833fc80 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -22,11 +22,12 @@ struct Chord {
bool tappable;
int status; // Guitar: 0 = not played, 10 = tapped, 20 = picked, 30 = released, drums: number of pads hit
int score;
- AnimValue hitAnim;
+ AnimValue hitAnim[5];
double releaseTimes[5];
- Chord(): begin(), end(), polyphony(), tappable(), status(), score(), hitAnim(0.0, 1.5) {
+ Chord(): begin(), end(), polyphony(), tappable(), status(), score() {
std::fill(fret, fret + 5, false);
std::fill(dur, dur + 5, static_cast<Duration const*>(NULL));
+ std::fill(hitAnim, hitAnim + 5, AnimValue(0.0, 1.5));
std::fill(releaseTimes, releaseTimes + 5, 0.0);
}
bool matches(bool const* fretPressed) {
|