|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-25 08:32:32
|
Module: performous
Branch: master
Commit: a6dcb4d6314b680229d8afec66136780bd9b7cc7
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 25 11:30:51 2009 +0300
Make cover browser stop at target if more than one second has elapsed since the previous frame (typically happens when the player has been in singing screen).
---
game/animvalue.hh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/animvalue.hh b/game/animvalue.hh
index e3771a2..1f36eac 100644
--- a/game/animvalue.hh
+++ b/game/animvalue.hh
@@ -62,7 +62,11 @@ class AnimAcceleration {
double duration = seconds(curtime) - seconds(m_time);
m_time = curtime;
if (!(duration > 0.0)) return m_position; // Negative value or NaN, or no songs - skip processing
- if (duration > 1.0) duration = 1.0; // No more than one second per frame
+ if (duration > 1.0) {
+ // More than one second has elapsed, assume that we have stopped on target already
+ m_velocity = 0.0;
+ return m_position = m_target;
+ }
std::size_t rounds = 1.0 + 1000.0 * duration; // 1 ms or shorter timesteps
double t = duration / rounds;
for (std::size_t i = 0; i < rounds; ++i) {
|