|
From: Yoda-JM <yo...@us...> - 2012-11-06 00:39:04
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Nov 5 09:30:37 2012 +0200
Fix skipping over instrumental breaks in duet.
---
game/screen_sing.cc | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index cc09f77..2274ac3 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -318,8 +318,12 @@ void ScreenSing::manageEvent(SDL_Event event) {
else if (status == Song::INSTRUMENTAL_BREAK) {
if (time < 0) m_audio.seek(0.0);
else {
- // FIXME: Should check for all layout singers
- double diff = m_layout_singer[0].lyrics_begin() - 3.0 - time;
+ // TODO: Instead of calculating here, calculate instrumental breaks right after song loading and store in Song data structures
+ double diff = getNaN();
+ for (size_t i = 0; i < m_layout_singer.size(); ++i) {
+ double d = m_layout_singer[i].lyrics_begin() - 3.0 - time;
+ if (!(d > diff)) diff = d; // Store smallest d in diff (notice NaN handling)
+ }
if (diff > 0.0) m_audio.seek(diff);
}
}
|