|
From: Tapio V. <aa...@us...> - 2009-10-28 16:08:29
|
Module: performous
Branch: dance
Commit: 91d606e8b50fc2fbfb4371fab682773098653f41
Author: Tapio Vierros <tap...@gm...>
Date: Tue Oct 27 22:33:08 2009 +0200
Score normalization to 0-10000 range for instruments.
---
game/guitargraph.cc | 13 +++++++++----
game/guitargraph.hh | 4 +++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index f8dfc74..d170864 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -59,6 +59,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_correctness(0.0, 5.0),
m_score(),
+ m_scoreFactor(),
m_streak(),
m_longestStreak()
{
@@ -218,9 +219,9 @@ void GuitarGraph::drumHit(double time, int fret) {
m_chordIt->score += score;
m_score += score;
if (m_chordIt->status == m_chordIt->polyphony) {
- m_score -= m_chordIt->score;
- m_chordIt->score *= m_chordIt->polyphony;
- m_score += m_chordIt->score;
+ //m_score -= m_chordIt->score;
+ //m_chordIt->score *= m_chordIt->polyphony;
+ //m_score += m_chordIt->score;
m_streak += 1;
if (m_streak > m_longestStreak) m_longestStreak = m_streak;
std::cout << "FULL HIT!" << std::endl;
@@ -349,7 +350,7 @@ void GuitarGraph::draw(double time) {
m_text.draw(txt);
} else {
m_text.dimensions.screenBottom(-0.30).middle(0.32 * dimensions.w() + offsetX);
- m_text.draw(boost::lexical_cast<std::string>(unsigned(m_score)));
+ m_text.draw(boost::lexical_cast<std::string>(unsigned(getScore())));
m_text.dimensions.screenBottom(-0.27).middle(0.32 * dimensions.w() + offsetX);
m_text.draw(boost::lexical_cast<std::string>(unsigned(m_streak)) + "/"
+ boost::lexical_cast<std::string>(unsigned(m_longestStreak)));
@@ -495,6 +496,7 @@ void GuitarGraph::drawBar(double time, float h) {
void GuitarGraph::updateChords() {
m_chords.clear();
+ m_scoreFactor = 0;
Durations::size_type pos[5] = {}, size[5] = {};
Durations const* durations[5] = {};
for (int fret = 0; fret < 5; ++fret) {
@@ -532,6 +534,8 @@ void GuitarGraph::updateChords() {
tapfret = fret;
++c.polyphony;
++pos[fret];
+ m_scoreFactor += 50;
+ if (d.end - d.begin > 0.0) m_scoreFactor += 50.0 * (d.end - d.begin);
}
// Check if the chord is tappable
if (!m_drums && c.polyphony == 1) {
@@ -543,5 +547,6 @@ void GuitarGraph::updateChords() {
m_chords.push_back(c);
}
m_chordIt = m_chords.begin();
+ m_scoreFactor = 10000.0 / m_scoreFactor; // normalize maximum score factor
}
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index e0c007b..e0eb849 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -55,7 +55,8 @@ class GuitarGraph {
double dead(double time) const { return time > -0.5 && m_dead > 50; }
unsigned stream() const { return m_stream; }
double correctness() const { return m_correctness.get(); }
- std::string getTrackIndex() const { return m_track_index;}
+ std::string getTrackIndex() const { return m_track_index; }
+ int getScore() const { return m_score * m_scoreFactor; }
private:
void fail(double time, int fret);
void endHold(int fret);
@@ -109,6 +110,7 @@ class GuitarGraph {
NoteStatus m_notes;
AnimValue m_correctness;
double m_score;
+ double m_scoreFactor;
int m_streak;
int m_longestStreak;
};
|