diff options
-rw-r--r-- | engines/pegasus/timers.cpp | 32 | ||||
-rw-r--r-- | engines/pegasus/timers.h | 6 |
2 files changed, 12 insertions, 26 deletions
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp index b88f9cd574..50cc9bc6d8 100644 --- a/engines/pegasus/timers.cpp +++ b/engines/pegasus/timers.cpp @@ -73,13 +73,8 @@ TimeBase::TimeBase(const TimeScale preferredScale) { } TimeBase::~TimeBase() { - if (_master) - _master->_slaves.remove(this); - ((PegasusEngine *)g_engine)->removeTimeBase(this); disposeAllCallBacks(); - - // TODO: Remove slaves? Make them remove themselves? } void TimeBase::setTime(const TimeValue time, const TimeScale scale) { @@ -88,6 +83,12 @@ void TimeBase::setTime(const TimeValue time, const TimeScale scale) { } TimeValue TimeBase::getTime(const TimeScale scale) { + // HACK: Emulate the master TimeBase code here for the one case that needs it in the + // game. Note that none of the master TimeBase code in this file should actually be + // used as a reference for anything ever. + if (_master) + return _master->getTime(scale); + return _time.getNumerator() * ((scale == 0) ? _preferredScale : scale) / _time.getDenominator(); } @@ -99,10 +100,6 @@ void TimeBase::setRate(const Common::Rational rate) { _paused = false; } -Common::Rational TimeBase::getEffectiveRate() const { - return _rate * ((_master == 0) ? 1 : _master->getEffectiveRate()); -} - void TimeBase::start() { if (_paused) _pausedRate = 1; @@ -193,18 +190,15 @@ TimeValue TimeBase::getDuration(const TimeScale scale) const { } void TimeBase::setMasterTimeBase(TimeBase *tb) { - // TODO: We're just ignoring the master (except for effective rate) - // for now to simplify things - if (_master) - _master->_slaves.remove(this); - _master = tb; - - if (_master) - _master->_slaves.push_back(this); } void TimeBase::updateTime() { + if (_master) { + _master->updateTime(); + return; + } + if (_lastMillis == 0) { _lastMillis = g_system->getMillis(); } else { @@ -212,7 +206,7 @@ void TimeBase::updateTime() { if (_lastMillis == curTime) // No change return; - _time += Common::Rational(curTime - _lastMillis, 1000) * getEffectiveRate(); + _time += Common::Rational(curTime - _lastMillis, 1000) * getRate(); _lastMillis = curTime; } } @@ -234,8 +228,6 @@ void TimeBase::checkCallBacks() { else if (_time <= startTime) _time = startTime; - // TODO: Update the slaves? - Common::Rational time = Common::Rational(getTime(), getScale()); // Check if we've triggered any callbacks diff --git a/engines/pegasus/timers.h b/engines/pegasus/timers.h index bcdca6e860..944930d21b 100644 --- a/engines/pegasus/timers.h +++ b/engines/pegasus/timers.h @@ -26,7 +26,6 @@ #ifndef PEGASUS_TIMERS_H #define PEGASUS_TIMERS_H -#include "common/list.h" #include "common/rational.h" #include "common/func.h" @@ -122,11 +121,6 @@ protected: Common::Rational _time; uint32 _lastMillis, _pauseStart; - -private: - Common::Rational getEffectiveRate() const; - - Common::List<TimeBase *> _slaves; }; // Type passed to initCallBack() |