|
From: Jaakko N. <jni...@us...> - 2009-11-25 20:44:53
|
Module: performous
Branch: dance
Commit: 91bee4def7adcb2918b88aaaf0fc2c524fd27c97
Author: Jaakko Nikkola <jaa...@tk...>
Date: Wed Nov 25 22:43:46 2009 +0200
Hold notes added as normal notes, and Mines added in Note type enum.
---
game/notes.hh | 3 ++-
game/songparser-sm.cc | 43 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/game/notes.hh b/game/notes.hh
index 4d43e89..916d0d9 100644
--- a/game/notes.hh
+++ b/game/notes.hh
@@ -73,7 +73,8 @@ struct Note {
/// power of note
mutable double power;
/// note type
- enum Type { FREESTYLE = 'F', NORMAL = ':', GOLDEN = '*', SLIDE = '+', SLEEP = '-'} type;
+ int danceType; ///1 for tap, 2 for hold begin note, 3 for hold end etc. (perhars enum could be made)
+ enum Type { FREESTYLE = 'F', NORMAL = ':', GOLDEN = '*', SLIDE = '+', SLEEP = '-', MINE = 'M'} type;
int note; ///< MIDI pitch of the note (at the end for slide notes)
int notePrev; ///< MIDI pitch of the previous note (should be same as note for everything but SLIDE)
/// lyrics syllable for that note
diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc
index 00450eb..03fea2a 100644
--- a/game/songparser-sm.cc
+++ b/game/songparser-sm.cc
@@ -145,6 +145,7 @@ Notes SongParser::smParseNotes(std::string line, bool endOfInput) {
double tm = 0; //time counter
double dur; //note duration
+ std::vector<int> holdMarks(4, -1); //vector to contain mark for the chord where hold began for each "fret" (-1 if no mark set)
while(getline(line)) {
if (line.empty() || line == "\r") continue;
if (line[0] == '/' && line[1] == '/') continue;
@@ -158,9 +159,24 @@ Notes SongParser::smParseNotes(std::string line, bool endOfInput) {
DanceChord _chord = chords.at(j);
for(int i = 0; i<4; i++) {
if(_chord.find(i) != _chord.end()) {
+ //if(_chord[i].danceType == 1) {
_chord[i].begin = tm;
_chord[i].end = tm;
notes.push_back(_chord[i]); //note added to notes container used in DanceTrack
+ /*}
+ if(_chord[i].danceType == 2) {
+ _chord[i].begin = tm;
+ notes.push_back(_chord[i]); //note added to notes container used in DanceTrack
+ }
+ if(_chord[i].danceType == 3) {
+ if(holdMarks.at(i) < 0) throw std::runtime_error("hold end without beginning");
+ std::cout << "mark1" << std::endl;
+ Note _note = notes.at(holdMarks.at(i));
+ std::cout << "mark2" << std::endl;
+ _note.end = tm;
+ std::cout << "mark3" << std::endl;
+ holdMarks.at(i) = -1;
+ }*/
}
}
tm += dur;
@@ -172,11 +188,36 @@ Notes SongParser::smParseNotes(std::string line, bool endOfInput) {
DanceChord chord;
std::istringstream iss(line);
for(int i =0; i<4; i++){
- if(iss.get() == '1') {
+ char notetype = iss.get();
+ if(notetype == '1' || notetype == '2') {
+ Note note;
+ note.note = i;
+ //note.danceType = 1;
+ chord[i] = note;
+ }
+ if(notetype == 'M') {
Note note;
note.note = i;
+ note.type = Note::MINE;
+ chord[i] = note;
+ }
+ /*
+ if(notetype == '2') {
+ std::cout << "hold begin" << std::endl;
+ Note note;
+ note.note = i;
+ note.danceType = 2;
+ chord[i] = note;
+ holdMarks.at(i) = count;
+ }
+ if(notetype == '3') {
+ std::cout << "hold end" << std::endl;
+ Note note;
+ note.note = i;
+ note.danceType = 3;
chord[i] = note;
}
+ */
}
lcount++;
count++;
|