summaryrefslogtreecommitdiff
path: root/vfg/src/music.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vfg/src/music.cpp')
-rwxr-xr-xvfg/src/music.cpp42
1 files changed, 29 insertions, 13 deletions
diff --git a/vfg/src/music.cpp b/vfg/src/music.cpp
index ed442cd..eda58be 100755
--- a/vfg/src/music.cpp
+++ b/vfg/src/music.cpp
@@ -10,7 +10,7 @@ int notemap(int n) {
int note=n-firstnote;
if (note<5) return 0;
else if (note <9) return 1;
- else return 2;
+ else return 2;
}
//----------------------------------------------------------------------------------------------------------
void lyricscore::draw(){
@@ -30,8 +30,9 @@ void lyricscore::draw(){
musicscore::musicscore() {
timeframe=2000;
missedLast=false;
- nowpoint=1.0f;
-
+ nowpoint=1.0f;
+ missedNote=-1;
+
snowflakes.push_back(Puppet());
snowflakes.push_back(Puppet());
snowflakes.push_back(Puppet());
@@ -141,7 +142,9 @@ void musicscore::makeFlakes(int threshStart,int threshEnd){
}
lastNote=iter->second;
lastTime=iter->first;
- }
+ }
+ missedFlake=flakes.end();
+ missedNote=-1;
}
void musicscore::setTimeframe(int millis) {timeframe=millis;}
void musicscore::setNowpoint(float pct) {nowpoint=pct;}
@@ -180,27 +183,37 @@ void musicscore::drawFlakes(levelscore *levels) {
int thisnote=iter->second->num-firstnote;
int thisstart=iter->first-scoreStart;
int thislength=iter->second->duration;
-
+
//if (iter->second->activated) ofSetColor(255,255,255);
//else ofSetColor(ofColor::fromHsb(((float)thisnote*255)/numnotes,200,255));
-
+
//if (iter->second->activated&&(!iter->second->disintegrated)) iter->second->disintegrate();
-
+
ofSetColor(255,255,255);
iter->second->draw((notemap(iter->second->num)*300)+100,ofGetHeight()-(thisstart*heightStep));
//todo - make all drawing resolution independent
-
+
}
- //check for unactivated flakes within this segment: is there a more efficient way?
- //is it the number of flakes they can lose per segment?
+ //check for unactivated flakes within this segment: is there a more efficient way?
+ //need to know when a flake has just been missed
+
missedFlakes=0;
- missedLast=false;
+ missedLast=false;
+ map<int,flake*>::iterator missed=flakes.end();
+ int scoreTime=ofGetElapsedTimeMillis()-startTime;
for (iter = flakes.lower_bound(levels->getLowerBound(levels->getLevel(scoreStart))); iter != flakes.upper_bound(scoreStart); iter++){
if (!iter->second->activated) {
- missedFlakes++;
+ missedFlakes++;
+ missed=iter;
}
missedLast=!iter->second->activated;
- }
+ }
+ if ((missed!=flakes.end())&&(missedFlake!=missed)) {
+ missedFlake=missed;
+ missedNote=notemap(iter->second->num);
+ }
+ else missedNote=-1;
+
ofDisableAlphaBlending();
}
void musicscore::playerControl(int key,int threshold){
@@ -281,3 +294,6 @@ void song::draw(){
void song::playerControl(int key){
notes.playerControl(key,keyThresh);
}
+int song::missedNote(){
+ return notes.missedNote;
+}