#pragma once #include "ofMain.h" #include "ofxXmlSettings.h" //event times are absolute integer milliseconds //--------------------------------------------------------------------------------------------------------------------------------------------- class levelscore { public: void load(string filename) { ofxXmlSettings XML; if( !XML.loadFile(filename) ){ printf("unable to load %s check data/ folder\n",filename.c_str()); }else{ if(XML.pushTag("VFxmas")) { for (int i=0;i::iterator iter; int lives=0; for (iter = levels.begin(); iter != levels.end(); ++iter) { if (iter->first<=time) lives=iter->second; else break; } return lives; } int getLevel(int time) { map::iterator iter; int level=-1; for (iter = levels.begin(); iter != levels.end(); ++iter) { if (iter->first<=time) level++; else break; } return level; } int getLowerBound(int level) { map::iterator iter=levels.begin(); int bound=0; for (int i=0;i<=level;i++) { bound=iter->first; iter++; } return bound; } private: map levels; }; //--------------------------------------------------------------------------------------------------------------------------------------------- class note { public: note(int n,int v,int d=0) { num=n; velocity=v; duration=d; activated=false; } int num; int velocity; int duration; //may be needed another time? bool activated; void activate() { activated=true; } }; //--------------------------------------------------------------------------------------------------------------------------------------------- class lyric { public: lyric(string s,int d) { text=s; duration=d; } string text; int duration; }; //--------------------------------------------------------------------------------------------------------------------------------------------- class score { //basics of timelime public: long startTime; void start() { startTime=ofGetElapsedTimeMillis(); } void start(int _st) { startTime=_st; } ofxXmlSettings XML; }; //--------------------------------------------------------------------------------------------------------------------------------------------- class lyricscore: public score { //draws lyrics to screen for a certain time public: lyricscore() { font.loadFont("verdana.ttf", 30, true, true); font.setLineHeight(34.0f); font.setLetterSpacing(1.035); ypos=(int)(((float)ofGetHeight())*0.97f); //set lyric position fadeout=500; //ms } void load(string filename) { if( !XML.loadFile(filename) ){ printf("unable to load %s check data/ folder\n",filename.c_str()); }else{ int multiplier=1000/XML.getAttribute("VFxmas", "timebase",0,0); if(XML.pushTag("VFxmas")) { for (int i=0;i lyrics; ofTrueTypeFont font; int ypos; int fadeout; }; //--------------------------------------------------------------------------------------------------------------------------------------------- class musicscore: public score { //draws notes to screen for a certain time and certain parameters, checks when they become ready public: musicscore(); void parseMidi(string filename); void setTimeframe(int millis); void setNowpoint(float pct); void drawNotes(levelscore *levels); void drawFlakes(levelscore *levels); void playerControl(int key,int threshold); void makeFlakes(int threshStart,int threshEnd); int missedFlakes; bool missedLast; bool perfect; private: map notes; map flakes; int timeframe; ofImage flake; float nowpoint; }; //--------------------------------------------------------------------------------------------------------------------------------------------- class song { public: song(string backfile,string melfile,string musfile,string lyricfile,string levelfile); void play(); void stop(); void preRoll(long preroll); void setTimeframe(int millis); void setFlakeThresh(int tS,int tE); void setKeythresh(int millis); void drawNotes(); void draw(); bool isPlaying; void playerControl(int key); private: ofSoundPlayer backing; ofSoundPlayer melody; lyricscore lyrics; musicscore notes; levelscore levels; long startTime; bool isPreroll; int fThreshStart,fThreshEnd,keyThresh; }; //--------------------------------------------------------------------------------------------------------------------------------------------- /* Game Animation & Sound Demo – NK to overlay latest version of Deck the Halls on 10 second animated sequence by COB Wednesday 7th November for visual and aural aesthetic sign-off. RM to send through latest version of Deck the Halls today (6th November). Game Development – TR presented initial demo today. Usability looks good. NK to provide first suite of graphics by COB Wednesday 7th November. Latency Test – TR and GK to perform end-to-end latency test next Monday 12th November once Vodafone have connected the 1800 number to the 01 number. Any issues noted in the testing to be flagged to BL. Game Over – Players who miss a certain amount of notes in a row will be kicked out of the game early. The number of notes that can be missed in a row will decrease as the game goes on (subject to testing and tweaking): Stage 1 – N/A (it will not be possible to be kicked out in Stage 1) Stage 2 – 5 notes missed will mean Game Over Stage 3 – 4 notes missed will mean Game Over Stage 4 – 3 notes missed will mean Game Over Scoring – Scoring will be based on the level of the game you achieve. There will be 4 scoring brackets (subject to testing and tweaking): Scoring Bracket 1 - Those who make it to Level 2 (see above - it's not possible to be kicked out in Level 1) Scoring Bracket 2 – Those who make it to Level 3 Scoring Bracket 3 – Those who make it to Level 4 Scoring Bracket 4 – Those who don't miss any notes in Level 4 */