aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/mortevielle.cpp20
-rw-r--r--engines/mortevielle/mortevielle.h9
-rw-r--r--engines/mortevielle/mouse.h1
-rw-r--r--engines/mortevielle/utils.cpp36
4 files changed, 41 insertions, 25 deletions
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index f13f8cb65b..d434150977 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 4c096c1f71..5ae94987a0 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,8 @@ private:
int _x;
int _y;
int _currentHourCount;
- int _currentDayHour;
+ int _currentTime;
+ int _pauseStartTime;
Common::String _hintPctMessage;
byte *_cfiecBuffer;
@@ -446,6 +447,8 @@ 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);
+ virtual GUI::Debugger *getDebugger() {return &_debugger;}
uint32 getGameFlags() const;
Common::Language getLanguage() const;
Common::Language getOriginalLanguage() const;
diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h
index 1b9856e2c4..594031d816 100644
--- a/engines/mortevielle/mouse.h
+++ b/engines/mortevielle/mouse.h
@@ -37,7 +37,6 @@ class MouseHandler {
private:
MortevielleEngine *_vm;
- int s_s[12][6];
int _counter;
public:
Common::Point _pos;
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 5ca29d849c..0b13df239c 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;
}
@@ -2369,8 +2364,7 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
- strncpy(tmp, s.c_str() + idx - 1, size);
- tmp[size] = '\0';
+ Common::strlcpy(tmp, s.c_str() + idx - 1, size + 1);
Common::String result(tmp);
delete[] tmp;