|
From: Lasse Kärkkäi. <tr...@us...> - 2009-11-14 18:45:14
|
Module: performous
Branch: dance
Commit: 0c7fdeb13c0c1a913175bdf396c3c9e2a01ad3e0
Author: Tapio Vierros <tap...@gm...>
Date: Sat Nov 14 18:40:35 2009 +0200
Hiscore database includes difficulty into the track-attribute.
---
game/database.hh | 8 +++-----
game/guitargraph.cc | 2 ++
game/guitargraph.hh | 1 +
game/screen_sing.cc | 9 ++++++---
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/game/database.hh b/game/database.hh
index f23da1d..4463692 100644
--- a/game/database.hh
+++ b/game/database.hh
@@ -11,12 +11,10 @@
struct ScoreItem {
int score;
- std::string track;
+ std::string track; // includes difficulty
+ std::string track_simple; // no difficulty
glutil::Color color;
- bool operator < (ScoreItem const& other)
- {
- return score < other.score;
- }
+ bool operator < (ScoreItem const& other) { return score < other.score; }
};
/**Access to a database for performous which holds
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index e437130..60281c5 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -316,6 +316,8 @@ void GuitarGraph::nextTrack() {
updateNeck();
}
+std::string GuitarGraph::getDifficultyString() const { return diffv[m_level].name; }
+
void GuitarGraph::difficultyAuto(bool tryKeep) {
if (tryKeep && difficulty(Difficulty(m_level))) return;
for (int level = 0; level < DIFFICULTYCOUNT; ++level) if (difficulty(Difficulty(level))) return;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 9bd3517..8adaafc 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -60,6 +60,7 @@ class GuitarGraph {
std::string getTrackIndex() const { return m_track_index->first; }
int getScore() const { return m_score * m_scoreFactor; }
std::string getTrack() const { return m_track_index->first; }
+ std::string getDifficultyString() const;
private:
void fail(double time, int fret);
void endHold(int fret);
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index c068189..0314037 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -326,6 +326,7 @@ ScoreWindow::ScoreWindow(Instruments& instruments, Database& database):
ScoreItem item;
item.score = p->getScore();
item.track = "vocals";
+ item.track_simple = "vocals";
item.color = glutil::Color(p->m_color.r, p->m_color.g, p->m_color.b);
if (item.score < 500) { p = m_database.cur.erase(p); continue; }
@@ -334,12 +335,14 @@ ScoreWindow::ScoreWindow(Instruments& instruments, Database& database):
for (Instruments::iterator it = instruments.begin(); it != instruments.end(); ++it) {
ScoreItem item;
item.score = it->getScore();
- item.track = it->getTrack();
+ item.track_simple = it->getTrack();
+ item.track = it->getTrack() + "-" + it->getDifficultyString();
+ if (item.score < 500) { std::cout << "kick " << item.track << std::endl; it = instruments.erase(it); continue; }
+
if (item.track == "drums") item.color = glutil::Color(0.1f, 0.1f, 0.1f);
else if (item.track == "bass") item.color = glutil::Color(0.5f, 0.3f, 0.1f);
else item.color = glutil::Color(1.0f, 0.0f, 0.0f);
- if (item.score < 500) { std::cout << "kick " << item.track << std::endl; it = instruments.erase(it); continue; }
std::cout << "insert " << item.track << " score: " << item.score << std::endl;
m_database.scores.push_back(item);
}
@@ -384,7 +387,7 @@ void ScoreWindow::draw() {
m_score_text.render(boost::lexical_cast<std::string>(score));
m_score_text.dimensions().middle(x).top(0.24).fixedHeight(0.05);
m_score_text.draw();
- m_score_text.render(p->track);
+ m_score_text.render(p->track_simple);
m_score_text.dimensions().middle(x).top(0.20).fixedHeight(0.05);
m_score_text.draw();
glColor3f(1.0f, 1.0f, 1.0f);
|