[Scummvm-cvs-logs] scummvm master -> 8216e6dabfb2f460ff92fd7d04688fb0b34072fa

criezy criezy at scummvm.org
Sun Sep 1 23:05:52 CEST 2013


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

Summary:
3ab88c464a MORTEVIELLE: Fix computation of elapsed time around midnight
8216e6dabf MORTEVIELLE: Freeze clock in game when pausing the game


Commit: 3ab88c464aed6ec81f1b9596914b17ffb4e4ab99
    https://github.com/scummvm/scummvm/commit/3ab88c464aed6ec81f1b9596914b17ffb4e4ab99
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-09-01T14:04:30-07:00

Commit Message:
MORTEVIELLE: Fix computation of elapsed time around midnight

Replace use of getTimeAndDate() by getMillis() when computing
elapsed time. This fixes an issue when playing around midnight.
Also rename some variables for clarity (since they contain a time
in seconds having Hour in the name was a bit confusing).

Changed paths:
    engines/mortevielle/mortevielle.h
    engines/mortevielle/utils.cpp



diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 4c096c1..cf49be1 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -214,8 +214,8 @@ private:
 	int  _minute;
 	int  _curSearchObjId;
 	int  _controlMenu;
-	int  _startHour;
-	int  _endHour;
+	int  _startTime;
+	int  _endTime;
 	Common::Point _stdPal[91][17];
 
 	int  _x26KeyCount;
@@ -229,7 +229,7 @@ private:
 	int  _x;
 	int  _y;
 	int  _currentHourCount;
-	int  _currentDayHour;
+	int  _currentTime;
 
 	Common::String _hintPctMessage;
 	byte  *_cfiecBuffer;
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 5ca29d8..7809143 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -413,8 +413,8 @@ void MortevielleEngine::prepareScreenType3() {
  * @remarks	Originally called 'calch'
  */
 void MortevielleEngine::updateHour(int &day, int &hour, int &minute) {
-	int newHour = readclock();
-	int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration);
+	int newTime = readclock();
+	int th = _currentHourCount + ((newTime - _currentTime) / _inGameHourDuration);
 	minute = ((th % 2) + _currHalfHour) * 30;
 	hour = ((uint)th >> 1) + _currHour;
 	if (minute == 60) {
@@ -1082,7 +1082,7 @@ void MortevielleEngine::initGame() {
 	if (!_coreVar._alreadyEnteredManor)
 		_blo = true;
 	_inGameHourDuration = kTime1;
-	_currentDayHour = readclock();
+	_currentTime = readclock();
 }
 
 /**
@@ -1465,8 +1465,8 @@ void MortevielleEngine::gameLoaded() {
 	_x = 0;
 	_y = 0;
 	_num = 0;
-	_startHour = 0;
-	_endHour = 0;
+	_startTime = 0;
+	_endTime = 0;
 	_searchCount = 0;
 	_roomDoorId = OWN_ROOM;
 	_syn = true;
@@ -2156,12 +2156,7 @@ void MortevielleEngine::drawRightFrame() {
  * Read the current system time
  */
 int MortevielleEngine::readclock() {
-	TimeDate dateTime;
-	g_system->getTimeAndDate(dateTime);
-
-	int m = dateTime.tm_min * 60;
-	int h = dateTime.tm_hour * 3600;
-	return h + m + dateTime.tm_sec;
+	return (int)(g_system->getMillis() / 1000);
 }
 
 /**
@@ -2224,12 +2219,12 @@ void MortevielleEngine::prepareRoom() {
 		if (_coreVar._faithScore > 65)
 			_inGameHourDuration -= ((_inGameHourDuration / 3) * 2);
 
-		int newHour = readclock();
-		if ((newHour - _currentDayHour) > _inGameHourDuration) {
+		int newTime = readclock();
+		if ((newTime - _currentTime) > _inGameHourDuration) {
 			bool activeMenu = _menu._menuActive;
 			_menu.eraseMenu();
-			_currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration);
-			_currentDayHour = newHour;
+			_currentHourCount += ((newTime - _currentTime) / _inGameHourDuration);
+			_currentTime = newTime;
 			switch (_place) {
 			case GREEN_ROOM:
 			case DARKBLUE_ROOM:
@@ -2279,7 +2274,7 @@ void MortevielleEngine::prepareRoom() {
 					_currBitIndex = 0;
 					if (!_uptodatePresence) {
 						_uptodatePresence = true;
-						_startHour = readclock();
+						_startTime = readclock();
 						if (getRandomNumber(1, 5) < 5) {
 							clearVerbBar();
 							prepareScreenType2();
@@ -2297,11 +2292,11 @@ void MortevielleEngine::prepareRoom() {
 				_menu.drawMenu();
 		}
 	}
-	_endHour = readclock();
-	if ((_uptodatePresence) && ((_endHour - _startHour) > 17)) {
+	_endTime = readclock();
+	if ((_uptodatePresence) && ((_endTime - _startTime) > 17)) {
 		getPresenceBitIndex(_place);
 		_uptodatePresence = false;
-		_startHour = 0;
+		_startTime = 0;
 		if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM))
 			_anyone = true;
 	}


Commit: 8216e6dabfb2f460ff92fd7d04688fb0b34072fa
    https://github.com/scummvm/scummvm/commit/8216e6dabfb2f460ff92fd7d04688fb0b34072fa
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-09-01T14:04:30-07:00

Commit Message:
MORTEVIELLE: Freeze clock in game when pausing the game

Changed paths:
    engines/mortevielle/mortevielle.cpp
    engines/mortevielle/mortevielle.h



diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index f13f8cb..d434150 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -63,6 +63,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr
 	_mouseClick = false;
 	_inMainGameLoop = false;
 	_quitGame = false;
+	_pauseStartTime = -1;
 
 	_roomPresenceLuc = false;
 	_roomPresenceIda = false;
@@ -165,6 +166,25 @@ Common::String MortevielleEngine::generateSaveFilename(const Common::String &tar
 }
 
 /**
+ * Pause the game.
+ */
+void MortevielleEngine::pauseEngineIntern(bool pause) {
+	Engine::pauseEngineIntern(pause);
+	if (pause) {
+		if (_pauseStartTime == -1)
+			_pauseStartTime = readclock();
+	} else {
+		if (_pauseStartTime != -1) {
+			int pauseEndTime = readclock();
+			_currentTime += (pauseEndTime - _pauseStartTime);
+			if (_uptodatePresence)
+				_startTime += (pauseEndTime - _pauseStartTime);
+		}
+		_pauseStartTime = -1;
+	}
+}
+
+/**
  * Initialize the game state
  */
 Common::ErrorCode MortevielleEngine::initialize() {
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index cf49be1..fc4961b 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -230,6 +230,7 @@ private:
 	int  _y;
 	int  _currentHourCount;
 	int  _currentTime;
+	int  _pauseStartTime;
 
 	Common::String _hintPctMessage;
 	byte  *_cfiecBuffer;
@@ -446,6 +447,7 @@ public:
 	virtual Common::Error loadGameState(int slot);
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
 	virtual Common::Error run();
+	virtual void pauseEngineIntern(bool pause);
 	uint32 getGameFlags() const;
 	Common::Language getLanguage() const;
 	Common::Language getOriginalLanguage() const;






More information about the Scummvm-git-logs mailing list