|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:27
|
Module: performous
Branch: portaudio
Commit: 2ea1b45f0368a74a30f8782d318598495823c1ba
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jun 23 21:35:13 2010 +0300
Add a popup at the beginning of a dance stop.
---
game/dancegraph.cc | 16 ++++++++++++++--
game/dancegraph.hh | 1 +
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index cf9c556..5b19a65 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -78,7 +78,8 @@ DanceGraph::DanceGraph(Audio& audio, Song const& song):
m_arrows_cursor(getThemePath("arrows_cursor.svg")),
m_arrows_hold(getThemePath("arrows_hold.svg")),
m_mine(getThemePath("mine.svg")),
- m_flow_direction(1)
+ m_flow_direction(1),
+ m_insideStop()
{
// Initialize some arrays
for(size_t i = 0; i < max_panels; i++) {
@@ -177,11 +178,22 @@ void DanceGraph::difficulty(DanceDifficulty level) {
void DanceGraph::engine() {
double time = m_audio.getPosition();
time -= config["audio/controller_delay"].f();
+ // Handle stops
+ bool outsideStop = true;
for (Song::Stops::const_iterator it = m_song.stops.begin(), end = m_song.stops.end(); it != end; ++it) {
if (it->first >= time) break;
- if (time < it->first + it->second) { time = it->first; break; } // Inside stop
+ if (time < it->first + it->second) { // Inside stop
+ time = it->first;
+ if (!m_insideStop) {
+ m_popups.push_back(Popup(_("STOP!"), glutil::Color(1.0f, 0.8f, 0.0), 2.0, m_popupText.get()));
+ m_insideStop = true;
+ }
+ outsideStop = false;
+ break;
+ }
time -= it->second;
}
+ if (outsideStop && m_insideStop) m_insideStop = false;
if (joining(time)) m_dead = 0; // Disable dead counting while joining
bool difficulty_changed = false;
// Handle all events
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index cfdd705..0eff7b7 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -80,5 +80,6 @@ class DanceGraph: public InstrumentGraph {
// Misc
int m_arrow_map[max_panels]; /// game mode dependant mapping of arrows' ordering at cursor
int m_flow_direction;
+ bool m_insideStop;
};
|