aboutsummaryrefslogtreecommitdiff
path: root/engines/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/engine.cpp')
-rw-r--r--engines/engine.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 14715ccaac..b8ddc631df 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -46,7 +46,7 @@
#include "gui/debugger.h"
#include "gui/message.h"
-#include "gui/GuiManager.h"
+#include "gui/gui-manager.h"
#include "sound/mixer.h"
@@ -94,10 +94,11 @@ Engine::Engine(OSystem *syst)
_saveFileMan(_system->getSavefileManager()),
_targetName(ConfMan.getActiveDomainName()),
_pauseLevel(0),
+ _pauseStartTime(0),
+ _engineStartTime(_system->getMillis()),
_mainMenuDialog(NULL) {
g_engine = this;
- Common::setDebugOutputFormatter(defaultOutputFormatter);
Common::setErrorOutputFormatter(defaultOutputFormatter);
Common::setErrorHandler(defaultErrorHandler);
@@ -154,7 +155,10 @@ void initCommonGFX(bool defaultTo1XScaler) {
// See if the game should default to 1x scaler
if (useDefaultGraphicsMode && defaultTo1XScaler) {
- g_system->resetGraphicsScale();
+ // FIXME: As a hack, we use "1x" here. Would be nicer to use
+ // getDefaultGraphicsMode() instead, but right now, we do not specify
+ // whether that is a 1x scaler or not...
+ g_system->setGraphicsMode("1x");
} else {
// Override global scaler with any game-specific define
if (ConfMan.hasKey("gfx_mode")) {
@@ -377,9 +381,12 @@ void Engine::pauseEngine(bool pause) {
_pauseLevel--;
if (_pauseLevel == 1 && pause) {
+ _pauseStartTime = _system->getMillis();
pauseEngineIntern(true);
} else if (_pauseLevel == 0) {
pauseEngineIntern(false);
+ _engineStartTime += _system->getMillis() - _pauseStartTime;
+ _pauseStartTime = 0;
}
}
@@ -395,6 +402,24 @@ void Engine::openMainMenuDialog() {
syncSoundSettings();
}
+uint32 Engine::getTotalPlayTime() const {
+ if (!_pauseLevel)
+ return _system->getMillis() - _engineStartTime;
+ else
+ return _pauseStartTime - _engineStartTime;
+}
+
+void Engine::setTotalPlayTime(uint32 time) {
+ const uint32 currentTime = _system->getMillis();
+
+ // We need to reset the pause start time here in case the engine is already
+ // paused to avoid any incorrect play time counting.
+ if (_pauseLevel > 0)
+ _pauseStartTime = currentTime;
+
+ _engineStartTime = currentTime - time;
+}
+
int Engine::runDialog(GUI::Dialog &dialog) {
pauseEngine(true);
int result = dialog.runModal();