|
From: Tapio V. <aa...@us...> - 2009-12-30 09:15:10
|
Module: performous
Branch: master
Commit: f5d641b17bc84b345bac436562a8daf6848e2015
Author: Tapio Vierros <tap...@gm...>
Date: Wed Dec 30 11:04:39 2009 +0200
Dying is again based on passed notes rather than time.
---
game/dancegraph.cc | 16 ++++++++--------
game/dancegraph.hh | 4 ++--
game/guitargraph.cc | 14 +++++++-------
game/guitargraph.hh | 4 ++--
game/screen_sing.cc | 8 ++++----
5 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 2113887..8b065a0 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -9,7 +9,7 @@
namespace {
const std::string diffv[] = { "Beginner", "Easy", "Medium", "Hard", "Challenge" };
- const float death_delay = 20.0f; // Delay in seconds after which the player is hidden
+ const int death_delay = 25; // Delay in notes after which the player is hidden
const float not_joined = -100; // A value that indicates player hasn't joined
const float join_delay = 7.0f; // Time to select track/difficulty when joining mid-game
const float past = -0.4f;
@@ -66,7 +66,7 @@ DanceGraph::DanceGraph(Audio& audio, Song const& song):
m_longestStreak(),
m_bigStreak(),
m_jointime(not_joined),
- m_acttime()
+ m_dead()
{
m_popupText.reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
@@ -125,8 +125,8 @@ void DanceGraph::gameMode(int direction) {
}
/// Are we alive?
-bool DanceGraph::dead(double time) const {
- return m_jointime == not_joined || time > (m_acttime + death_delay);
+bool DanceGraph::dead() const {
+ return m_jointime == not_joined || m_dead >= death_delay;
}
/// Get the difficulty as displayable string
@@ -180,6 +180,7 @@ void DanceGraph::engine() {
}
if(!it->releaseTime) it->releaseTime = time;
}
+ ++m_dead;
}
// Holding button when mine comes?
@@ -194,12 +195,11 @@ void DanceGraph::engine() {
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
- // Handle joining and keeping alive
- if (m_jointime == not_joined) {
- m_jointime = (time < 0.0 ? -join_delay : time); // join
+ m_dead = 0; // Keep alive
+ if (m_jointime == not_joined) { // Handle joining
+ m_jointime = (time < 0.0 ? -join_delay : time);
break;
}
- m_acttime = time;
// Difficulty / mode selection
if (time < m_jointime + join_delay) {
if (ev.type == input::Event::PRESS) {
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index e196fce..f5c901c 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -39,7 +39,7 @@ class DanceGraph {
void engine();
void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
unsigned stream() const { return m_stream; }
- bool dead(double time) const;
+ bool dead() const;
double correctness() const { return m_correctness.get(); }
int getScore() const { return (m_score > 0 ? m_score : 0) * m_scoreFactor; }
std::string getGameMode() const { return m_gamingMode; }
@@ -96,6 +96,6 @@ class DanceGraph {
std::string m_gamingMode;
DanceTracks::const_iterator m_curTrackIt;
double m_jointime;
- double m_acttime;
+ int m_dead;
};
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 6b78e2a..18850c1 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -17,7 +17,7 @@ namespace {
{ "Expert", 0x60 }
};
const size_t diffsz = sizeof(diffv) / sizeof(*diffv);
- const float death_delay = 20.0f; // Delay in seconds after which the player is hidden
+ const int death_delay = 25; // Delay in notes after which the player is hidden
const float not_joined = -100; // A value that indicates player hasn't joined
const float join_delay = 6.0f; // Time to select track/difficulty when joining mid-game
const float g_angle = 80.0f;
@@ -90,7 +90,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
m_longestStreak(),
m_bigStreak(),
m_jointime(not_joined),
- m_acttime()
+ m_dead()
{
try {
m_fretObj.load(getThemePath("fret.obj"));
@@ -153,9 +153,8 @@ void GuitarGraph::engine() {
double whammy = 0;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
- // Handle joining and keeping alive
- if (m_jointime == not_joined) m_jointime = (time < 0.0 ? -join_delay : time); // join
- m_acttime = time;
+ m_dead = 0; // Keep alive
+ if (m_jointime == not_joined) m_jointime = (time < 0.0 ? -join_delay : time); // Handle joining
// Guitar specific actions
if (!m_drums) {
if ((ev.type == input::Event::PRESS || ev.type == input::Event::RELEASE) && ev.button == input::STARPOWER_BUTTON) {
@@ -189,6 +188,7 @@ void GuitarGraph::engine() {
while (m_chordIt != m_chords.end() && m_chordIt->begin + maxTolerance < time) {
if ( (m_drums && m_chordIt->status != m_chordIt->polyphony)
|| (!m_drums && m_chordIt->status == 0) ) endStreak();
+ ++m_dead;
++m_chordIt;
}
// Adjust the correctness value
@@ -239,8 +239,8 @@ void GuitarGraph::engine() {
}
/// Are we alive?
-bool GuitarGraph::dead(double time) const {
- return m_jointime == not_joined || time > (m_acttime + death_delay);
+bool GuitarGraph::dead() const {
+ return m_jointime == not_joined || m_dead >= death_delay;
}
/// Attempt to activate GodMode
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index d22820b..e383e9f 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -60,7 +60,7 @@ class GuitarGraph {
void engine();
void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
unsigned stream() const { return m_stream; }
- bool dead(double time) const;
+ bool dead() const;
double correctness() const { return m_correctness.get(); }
std::string getTrackIndex() const { return m_track_index->first; }
int getScore() const { return m_score * m_scoreFactor; }
@@ -140,6 +140,6 @@ class GuitarGraph {
int m_longestStreak;
int m_bigStreak;
double m_jointime;
- double m_acttime;
+ int m_dead;
};
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 7104127..e99ba0b 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -103,13 +103,13 @@ bool ScreenSing::instrumentLayout(double time) {
int count = 0, i = 0;
// Count active instruments
for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it)
- if (!it->dead(time)) count++;
+ if (!it->dead()) count++;
double iw = std::min(0.5, 1.0 / count);
typedef std::pair<unsigned, double> CountSum;
std::map<std::string, CountSum> volume; // Stream id to (count, sum)
for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) {
it->engine(); // Run engine even when dead so that joining is possible
- if (!it->dead(time)) {
+ if (!it->dead()) {
it->position((0.5 + i - 0.5 * count) * iw, iw); // Do layout stuff
CountSum& cs = volume[it->getTrackIndex()];
cs.first++;
@@ -144,11 +144,11 @@ void ScreenSing::danceLayout(double time) {
int count = 0, i = 0;
// Count active dancers
for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it)
- if (!it->dead(time)) count++;
+ if (!it->dead()) count++;
double iw = std::min(0.5, 1.0 / m_dancers.size());
for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it) {
it->engine(); // Run engine even when dead so that joining is possible
- if (!it->dead(time)) {
+ if (!it->dead()) {
it->position((0.5 + i - 0.5 * count) * iw, iw); // Do layout stuff
it->draw(time);
++i;
|