summaryrefslogtreecommitdiff
path: root/vfg
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2012-12-11 23:13:02 +0000
committerComment <tim@gray.(none)>2012-12-11 23:13:02 +0000
commit1db97e28061caec0b3e8ce998b92e1936edbf2e5 (patch)
tree009549456ccd3529e15be353672c63cdf414db4a /vfg
parent7867f3fb1842639ce5f1b6e66b010cea7028f5cc (diff)
numerous bugfixes
Diffstat (limited to 'vfg')
-rwxr-xr-xvfg/src/Tag.cpp17
-rwxr-xr-xvfg/src/Tag.h4
-rwxr-xr-xvfg/src/testApp.cpp56
-rwxr-xr-xvfg/src/testApp.h12
4 files changed, 65 insertions, 24 deletions
diff --git a/vfg/src/Tag.cpp b/vfg/src/Tag.cpp
index e3ad080..bc087e6 100755
--- a/vfg/src/Tag.cpp
+++ b/vfg/src/Tag.cpp
@@ -8,11 +8,20 @@ void Tag::play(){
isPlaying=true;
startTime=ofGetElapsedTimeMillis();
}
-void Tag::draw(float x, float y, float scale){
+void Tag::1playEnd(){
+ end=true;
+ play();
+}
+void Tag::draw(float x, float y, float scale) {
float time=((float)ofGetElapsedTimeMillis()-startTime)/duration;
float yshift=0.0f;
- if (time<0.4) yshift=pow((time/0.4),0.7)-1.0;
- else if (time>0.75) yshift=-pow((time-0.75)/0.25,0.75);
+ if (end) {
+ if (time<1.0) yshift=pow((time),0.7)-1.0;
+ }
+ else {
+ if (time<0.4) yshift=pow((time/0.4),0.7)-1.0;
+ else if (time>0.75) yshift=-pow((time-0.75)/0.25,0.75);
+ if ((ofGetElapsedTimeMillis()-startTime)>duration) isPlaying=false;
+ }
img.draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale)+(yshift*img.getHeight()*scale),img.getWidth()*scale,img.getHeight()*scale);
- if ((ofGetElapsedTimeMillis()-startTime)>duration) isPlaying=false;
}
diff --git a/vfg/src/Tag.h b/vfg/src/Tag.h
index a75e442..1648136 100755
--- a/vfg/src/Tag.h
+++ b/vfg/src/Tag.h
@@ -22,13 +22,15 @@ class Billboard
class Tag: public Billboard {
public:
- Tag(string name,int d,float xPct=0.5f,float yPct=0.5f): Billboard(name,xPct,yPct) {duration =d; };
+ Tag(string name,int d,float xPct=0.5f,float yPct=0.5f): Billboard(name,xPct,yPct) {duration =d; end=false; };
void draw(float x, float y, float scale=1.0f);
void play();
+ void playEnd();
bool isPlaying;
protected:
int startTime;
int duration;
+ bool end;
};
#endif // TAG_H
diff --git a/vfg/src/testApp.cpp b/vfg/src/testApp.cpp
index a325064..4e5e576 100755
--- a/vfg/src/testApp.cpp
+++ b/vfg/src/testApp.cpp
@@ -49,7 +49,7 @@ void testApp::setup(){
//songs.push_back(new song("WeWishYouAMerryChistmas_v.2.1/VODA_MUS_WEWISHU_Backing_v.2.1.mp3","WeWishYouAMerryChistmas_v.2.1/VODA_MUS_WEWISHU_Lead_v.2.1.mp3","VODA_MUS_WEWISHU_Midi_v.2.2.xml","Lyrics_WeWishYou.2.1.xml","Levels_test.xml"));
- //songs.push_back(new song("SilentNight/VODA_SilentNight_Backing_v.1.1.1.mp3","SilentNight/VODA_SilentNight_Melody_v.1.1.1.mp3","VODA_SilentNight_Midi_v.1.1.1.xml","Lyrics_WeWishYou.2.1.xml","Levels_WeWishYou.2.1.xml"));
+ songs.push_back(new song("SilentNight/VODA_SilentNight_Backing_v.1.1.1.mp3","SilentNight/VODA_SilentNight_Melody_v.1.1.1.mp3","VODA_SilentNight_Midi_v.1.1.3.xml","Lyrics_SilentNight_v1.1.3.xml","Levels_SilentNight_v1.1.3.xml"));
songs.push_back(new song("WeWishYouAMerryChistmas_v.2.1/VODA_MUS_WEWISHU_Backing_v.2.1.mp3","WeWishYouAMerryChistmas_v.2.1/VODA_MUS_WEWISHU_Lead_v.2.1.mp3","VODA_MUS_WEWISHU_Midi_v.2.2.xml","Lyrics_WeWishYou.2.1.xml","Levels_WeWishYou.2.1.xml"));
songs.push_back(new song("DeckTheHalls_v.4.0/VODA_MUS_DeckTheHalls-Backing_v.4.0.mp3","DeckTheHalls_v.4.0/VODA_MUS_DeckTheHalls-Lead_v.4.0.mp3","VODA_MIDI_DeckTheHalls-v.4.0.xml","Lyrics_DeckTheHalls.4.0.xml","Levels_DeckTheHalls.4.0.xml"));
songs.push_back(new song("DingDong.v.2.2/VODA_MUS_DingDong_Backing_v.2.2.mp3","DingDong.v.2.2/VODA_MUS_DingDong_Melody_v.2.2.mp3","VODA_MIDI_DingDong_v.2.2.xml","Lyrics_DingDong.2.2.xml","Levels_DingDong.2.2.xml"));
@@ -79,9 +79,10 @@ void testApp::setup(){
tags.push_back(new Tag("Tags/TAG_Level-2.png",3000,0.5,0));
tags.push_back(new Tag("Tags/TAG_Level-3.png",3000,0.5,0));
tags.push_back(new Tag("Tags/TAG_Level-4.png",3000,0.5,0));
- tags.push_back(new Tag("Tags/PreGame-Practice.png",6000,0.5,0.16667));
+ tags.push_back(new Tag("Tags/PreGame-Practice.png",7000,0.5,0.16667));
tags.push_back(new Tag("Tags/Game-Over.png",3000,0.5,0));
- tags.push_back(new Tag("Tags/Thanks-NEW.png",3000,0.5,0));
+ tags.push_back(new Tag("Tags/Thanks-NEW.png",4000,0.5,0));
+ tags.push_back(new Tag("Tags/TAG_Practice-Run.png",3000,0.5,0));
logos.push_back(new Billboard("Logo-VF.png",0.5,0.0));
@@ -125,7 +126,7 @@ void testApp::setup(){
background.setLoopState(OF_LOOP_NORMAL);
background.play();
- backgroundmusic.loadSound("VODA_MUS_Pre-Game-Music_v.1.1.mp3");
+ backgroundmusic.loadSound("VODA_SFX_PreGameMusic_v.2.0.mp3");
backgroundmusic.setLoop(true);
backgroundmusic.play();
backgroundmusic.setVolume(1.0);
@@ -304,9 +305,11 @@ void testApp::draw(){
case GAME_READY:
case GAME_STARTPLAYING:
case GAME_PRACTICE:
+ case GAME_PRACTICE2:
case GAME_PLAYING:
case GAME_ENDPLAYING:
case GAME_WALKON:
+ case GAME_ENDTITLE:
drawBackgroundLayers();
break;
case GAME_STARTINGADVERT:
@@ -375,6 +378,7 @@ void testApp::draw(){
}
break;
case GAME_INTRO:
+ case GAME_ENDTITLE:
ofEnableAlphaBlending();
seg=(((float)(ofGetElapsedTimeMillis()-segmentStartTime))*.001)/6;
if (seg<1.0f) {
@@ -383,6 +387,7 @@ void testApp::draw(){
}
break;
case GAME_PRACTICE:
+ case GAME_PRACTICE2:
ofEnableAlphaBlending();
missed=practiceSong.missedNote();
if (missed>-1) (*playanimal)[missed].playNow("Shudder");
@@ -423,7 +428,7 @@ void testApp::draw(){
}
- //draw tags and VF logo
+ //draw tags and logos
switch(gamestate) {
case GAME_STARTINGADVERT:
if (segamt<0.5) {
@@ -437,10 +442,14 @@ void testApp::draw(){
ofSetColor(255,255,255,((segamt-0.5)*510));
}
else break;
+ case GAME_ENDTITLE:
+ //DCC LOGO
+ logos[1]->draw((gridX[0]*ofGetHeight())+hOffs,gridY[1]*ofGetHeight(),scale);
case GAME_ENDINGINTRO:
case GAME_READY:
case GAME_STARTPLAYING:
case GAME_PRACTICE:
+ case GAME_PRACTICE2:
case GAME_PLAYING:
case GAME_ENDPLAYING:
case GAME_WALKON:
@@ -451,8 +460,9 @@ void testApp::draw(){
}
logos[0]->draw((gridX[0]*ofGetHeight())+hOffs,0,scale);
break;
+
}
- //draw banner, DCC logo and wirebirds
+ //draw banner and wirebirds
bannerscale=scale;
ofSetColor(255,255,255);
switch(gamestate) {
@@ -481,6 +491,7 @@ void testApp::draw(){
ofEnableAlphaBlending();
banner.draw(ofGetWidth()*0.5,0,bannerscale);
break;
+ case GAME_PRACTICE2:
case GAME_STARTPLAYING:
case GAME_PLAYING:
if (showWire) wirebirds.draw(ofGetWidth()/2,ofGetHeight()*birdpoint,scale);
@@ -494,8 +505,6 @@ void testApp::draw(){
banner.draw(ofGetWidth()*0.5,0,bannerscale);
break;
case GAME_WALKON:
- //DCC LOGO
- //logos[1]->draw((gridX[0]*ofGetHeight())+hOffs,gridY[1]*ofGetHeight(),scale);
bannerscale=scale*(0.675+(max(0.0,min(((float)(ofGetElapsedTimeMillis()-segmentStartTime))*.001,1.0))*0.325));
ofEnableAlphaBlending();
banner.draw(ofGetWidth()*0.5,0,bannerscale);
@@ -505,6 +514,9 @@ void testApp::draw(){
switch(gamestate) {
case GAME_ENDPLAYING:
case GAME_WALKON:
+ case GAME_ENDINGINTRO:
+ case GAME_INTRO:
+ case GAME_ENDTITLE:
if (ofGetWidth()>ofGetHeight()) {
float slice=(ofGetWidth()-ofGetHeight())/2;
ofSetColor(0,0,0);
@@ -548,6 +560,7 @@ void testApp::draw(){
break;
case GAME_STARTPLAYING:
case GAME_PRACTICE:
+ case GAME_PRACTICE2:
break;
case GAME_PLAYING:
backgroundmusic.setVolume(max(0.0,1.0-(segamt*2.0)));
@@ -596,20 +609,26 @@ void testApp::activateGame(){
songs[currentsong]->setTimeframe(timescale);
songs[currentsong]->setFlakeThresh(threshStart,threshEnd);
songs[currentsong]->setKeyThresh(keyThresh);
- songs[currentsong]->play();
+ songs[currentsong]->preRoll(2000);
tags[0]->play();
nextsong=(nextsong+1)%songs.size();
gamestate=GAME_PLAYING;
}
void testApp::activatePractice(){
segmentStartTime=ofGetElapsedTimeMillis();
- gamestate=GAME_PRACTICE;
currentlevel=0;
practiceSong.setTimeframe(timescale);
practiceSong.setFlakeThresh(threshStart,threshEnd);
practiceSong.setKeyThresh(keyThresh);
- practiceSong.preRoll(5000);
- tags[5]->play();
+ if (gamestate==GAME_READY) {
+ gamestate=GAME_PRACTICE;
+ practiceSong.preRoll(4000);
+ tags[8]->play();
+ } else {
+ gamestate=GAME_PRACTICE2;
+ practiceSong.preRoll(5000);
+ tags[5]->play();
+ }
}
void testApp::switchAnimals(){
if (playanimal==&raccoons) playanimal=&penguins;
@@ -623,6 +642,7 @@ void testApp::queueWalkOff(){
//penguins: start + 289 = 8.25
//raccoons: start + 280 = 7.17
for (int i=0;i<3;i++) {
+ (*playanimal)[i].clear();
(*playanimal)[i].playNow("Walk_start");
for (int j=0;j<9;j++) (*playanimal)[i].play("Walking");
}
@@ -672,7 +692,7 @@ void testApp::keyPressed(int key){
}
break;
case ' ':
- if (gamestate==GAME_PRACTICE) {
+ if (gamestate==GAME_PRACTICE||gamestate==GAME_PRACTICE2) {
activateGame();
}
break;
@@ -702,6 +722,14 @@ void testApp::keyPressed(int key){
gamestate=GAME_INTRO;
}
break;
+ case 'p':
+ if (gamestate==GAME_READY) {
+ segmentStartTime=ofGetElapsedTimeMillis();
+ queueWalkOff();
+ tags[7]->playEnd();
+ gamestate=GAME_ENDTITLE;
+ }
+ break;
case 'w':
if (gamestate==GAME_READY) {
segmentStartTime=ofGetElapsedTimeMillis();
@@ -720,7 +748,7 @@ void testApp::keyPressed(int key){
//loadanimals("Raccoons");
playanimal =&raccoons;
break;
- case 'p':
+ case 't':
//loadanimals("Penguins");
playanimal =&penguins;
break;
diff --git a/vfg/src/testApp.h b/vfg/src/testApp.h
index d44973c..2838483 100755
--- a/vfg/src/testApp.h
+++ b/vfg/src/testApp.h
@@ -47,10 +47,11 @@ the 2nd time you play , if you 'die' it doesn't trigger 'end of game', the music
#define GAME_ENDINGADVERT 7
#define GAME_STARTPLAYING 8
#define GAME_PRACTICE 9
-#define GAME_PLAYING 10
-#define GAME_ENDPLAYING 11
-#define GAME_WALKON 12
-#define GAME_ENDTITLE 12
+#define GAME_PRACTICE2 10
+#define GAME_PLAYING 11
+#define GAME_ENDPLAYING 12
+#define GAME_WALKON 13
+#define GAME_ENDTITLE 14
class guiWindow;
@@ -150,7 +151,7 @@ public:
void draw();
void dragEvent(ofDragInfo dragInfo,ofxFenster* win);
void windowMoved(int x, int y);
- string levelnames[13]={
+ string levelnames[14]={
"STARTINGINTRO",
"INTRO",
"ENDINGINTRO",
@@ -160,6 +161,7 @@ public:
"ENDINGADVERT",
"STARTPLAYING",
"PRACTICE",
+ "PRACTICE2",
"PLAYING",
"ENDPLAYING",
"WALKON",