[Scummvm-cvs-logs] scummvm master -> 091f2e9df835cb688db456570862a327e04be748

clone2727 clone2727 at gmail.com
Sun Feb 3 23:50:02 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
091f2e9df8 PEGASUS: Fix the pressure door 'static' screens


Commit: 091f2e9df835cb688db456570862a327e04be748
    https://github.com/scummvm/scummvm/commit/091f2e9df835cb688db456570862a327e04be748
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-02-03T14:37:40-08:00

Commit Message:
PEGASUS: Fix the pressure door 'static' screens

This does not do a full implementation of master time bases for the one case in the game that uses it.

Changed paths:
    engines/pegasus/timers.cpp
    engines/pegasus/timers.h



diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp
index b88f9cd..50cc9bc 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 bcdca6e..944930d 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()






More information about the Scummvm-git-logs mailing list