aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-25 12:23:19 -0400
committerMatthew Hoops2011-09-25 12:23:19 -0400
commit4aed723368b9a4e82205bc3ed950a4e04ba3d8dc (patch)
tree11edb01b8d3a29bb5867ef15db004470b7ba9a74 /engines
parent647c83b514f1c942eaf71f838c0afd848c547b91 (diff)
downloadscummvm-rg350-4aed723368b9a4e82205bc3ed950a4e04ba3d8dc.tar.gz
scummvm-rg350-4aed723368b9a4e82205bc3ed950a4e04ba3d8dc.tar.bz2
scummvm-rg350-4aed723368b9a4e82205bc3ed950a4e04ba3d8dc.zip
PEGASUS: Fix startFaderSync
Since we're not running in multiple threads anymore, we cannot have the fader hold the main thread to itself.
Diffstat (limited to 'engines')
-rwxr-xr-xengines/pegasus/fader.cpp25
-rwxr-xr-xengines/pegasus/fader.h3
2 files changed, 19 insertions, 9 deletions
diff --git a/engines/pegasus/fader.cpp b/engines/pegasus/fader.cpp
index c3cfe9d263..3d8305b2c9 100755
--- a/engines/pegasus/fader.cpp
+++ b/engines/pegasus/fader.cpp
@@ -31,6 +31,7 @@ namespace Pegasus {
Fader::Fader() {
_currentValue = 0;
_currentFaderMove._numKnots = 0;
+ _syncMode = false;
}
void Fader::setFaderValue(const uint32 newValue) {
@@ -85,19 +86,13 @@ void Fader::startFader(const FaderMoveSpec &spec) {
void Fader::startFaderSync(const FaderMoveSpec &spec) {
if (initFaderMove(spec)) {
+ _syncMode = true;
+
setFlags(0);
setScale(spec._faderScale);
setSegment(spec._knots[0].knotTime, spec._knots[spec._numKnots - 1].knotTime);
setTime(spec._knots[0].knotTime);
- start();
-
- while (isFading())
- useIdleTime();
-
- // Once more, for good measure, to make sure that there are no boundary
- // condition problems.
- useIdleTime();
- stopFader();
+ start();
}
}
@@ -144,6 +139,18 @@ void Fader::timeChanged(const TimeValue newTime) {
}
}
+void Fader::checkCallBacks() {
+ IdlerTimeBase::checkCallBacks();
+
+ if (_syncMode && !isRunning()) {
+ // Once more, for good measure, to make sure that there are no boundary
+ // condition problems.
+ useIdleTime();
+ stopFader();
+ _syncMode = false;
+ }
+}
+
void FaderMoveSpec::makeOneKnotFaderSpec(const uint32 knotValue) {
_numKnots = 1;
_knots[0].knotTime = 0;
diff --git a/engines/pegasus/fader.h b/engines/pegasus/fader.h
index fe5b1ae1ba..83f5a819c2 100755
--- a/engines/pegasus/fader.h
+++ b/engines/pegasus/fader.h
@@ -89,12 +89,15 @@ public:
void getCurrentFaderMove(FaderMoveSpec &spec) { spec = _currentFaderMove; }
+ virtual void checkCallBacks();
+
protected:
bool initFaderMove(const FaderMoveSpec &);
virtual void timeChanged(const TimeValue);
uint32 _currentValue;
FaderMoveSpec _currentFaderMove;
+ bool _syncMode;
};
class FaderAnimation : public DisplayElement, public Fader {