|
From: Tapio V. <aa...@us...> - 2009-11-27 13:27:37
|
Module: performous
Branch: dance
Commit: b65ae226f6b4d6b6eada6e1a30acec57bd55525c
Author: Tapio Vierros <tap...@gm...>
Date: Fri Nov 27 13:41:40 2009 +0200
Graphical handling of hold note hitting ending prematurely.
(Requires DanceNote's releaseTime to be set correctly.)
---
game/dancegraph.cc | 19 ++++++++++---------
game/dancegraph.hh | 5 +++--
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 2596fe7..8904152 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -234,22 +234,18 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
float yEnd = time2y(tEnd);
glutil::Color c = color(arrow_i);
- double glow = note.hitAnim.get();
- //c.a = std::sqrt(1.0 - glow);
- c.r += glow *.5;
- c.g += glow *.5;
- c.b += glow *.5;
-
if (tEnd - tBeg > 0.1) {
// Draw holds
glColor4fv(c);
- if (note.isHit) {
- // TODO: What if hold is ended prematurely?
+ if (note.isHit && note.releaseTime <= 0) {
yBeg = std::max(time2y(0.0), yBeg);
yEnd = std::max(time2y(0.0), yEnd);
glColor3f(1.0f, 1.0f, 1.0f);
+ // Hack to test hold releasing
+ //if (time > note.note.begin + 1) note.releaseTime = time;
}
- {
+ if (note.releaseTime > 0) yBeg = time2y(note.releaseTime - time);
+ { // Scope block for Begin and UseTexture
UseTexture tblock(m_arrow_hold);
glutil::Begin block(GL_TRIANGLE_STRIP);
vertexPair(x, yEnd, 1.0f);
@@ -259,7 +255,12 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
drawArrow(arrow_i, x, yBeg, s);
} else {
// Draw short note
+ double glow = note.hitAnim.get();
+ //c.a = std::sqrt(1.0 - glow);
c.a = 1.0 - glow;
+ c.r += glow *.5;
+ c.g += glow *.5;
+ c.b += glow *.5;
s = arrowScale + glow;
glColor4fv(c);
if (mine) drawMine(x, yBeg, int(time*360) % 360, s);
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index 9e064fb..6b0f430 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -14,9 +14,10 @@ class Song;
struct DanceNote {
DanceNote(Note note) :
- note(note), hitAnim(0.0, 5.0), score(0), isHit(false) {}
+ note(note), hitAnim(0.0, 5.0), releaseTime(0), score(0), isHit(false) {}
Note note;
- AnimValue hitAnim;
+ AnimValue hitAnim; /// for animating hits
+ double releaseTime; /// tells when a hold was ended
int score;
bool isHit;
};
|