aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2017-02-20 17:20:47 +0100
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commit9153393219b398ce5a7a8122d9af38e32e128059 (patch)
tree212f1183e15c7546f966c8c9b6539837e1fccda0 /engines
parent1aa42338025543814ac0dbf41ed62c03ccf01ba8 (diff)
downloadscummvm-rg350-9153393219b398ce5a7a8122d9af38e32e128059.tar.gz
scummvm-rg350-9153393219b398ce5a7a8122d9af38e32e128059.tar.bz2
scummvm-rg350-9153393219b398ce5a7a8122d9af38e32e128059.zip
MOHAWK: Allow games to opt out of the default video manager
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/cstime.cpp14
-rw-r--r--engines/mohawk/cstime.h4
-rw-r--r--engines/mohawk/livingbooks.cpp14
-rw-r--r--engines/mohawk/livingbooks.h3
-rw-r--r--engines/mohawk/mohawk.cpp14
-rw-r--r--engines/mohawk/mohawk.h2
-rw-r--r--engines/mohawk/myst.cpp14
-rw-r--r--engines/mohawk/myst.h3
-rw-r--r--engines/mohawk/riven.cpp14
-rw-r--r--engines/mohawk/riven.h2
10 files changed, 68 insertions, 16 deletions
diff --git a/engines/mohawk/cstime.cpp b/engines/mohawk/cstime.cpp
index b2889be714..f3760a58ed 100644
--- a/engines/mohawk/cstime.cpp
+++ b/engines/mohawk/cstime.cpp
@@ -54,6 +54,7 @@ MohawkEngine_CSTime::MohawkEngine_CSTime(OSystem *syst, const MohawkGameDescript
_console = 0;
_gfx = 0;
+ _video = 0;
_sound = 0;
_cursor = 0;
_interface = 0;
@@ -68,6 +69,7 @@ MohawkEngine_CSTime::~MohawkEngine_CSTime() {
delete _view;
delete _console;
delete _sound;
+ delete _video;
delete _gfx;
delete _rnd;
}
@@ -77,6 +79,7 @@ Common::Error MohawkEngine_CSTime::run() {
_console = new CSTimeConsole(this);
_gfx = new CSTimeGraphics(this);
+ _video = new VideoManager(this);
_sound = new Sound(this);
_cursor = new DefaultCursorManager(this, ID_CURS);
@@ -184,6 +187,17 @@ void MohawkEngine_CSTime::update() {
_system->delayMillis(10);
}
+void MohawkEngine_CSTime::pauseEngineIntern(bool pause) {
+ MohawkEngine::pauseEngineIntern(pause);
+
+ if (pause) {
+ _video->pauseVideos();
+ } else {
+ _video->resumeVideos();
+ _system->updateScreen();
+ }
+}
+
void MohawkEngine_CSTime::initCase() {
_interface->openResFile();
_interface->install();
diff --git a/engines/mohawk/cstime.h b/engines/mohawk/cstime.h
index 393032aaa9..1c39a86ca0 100644
--- a/engines/mohawk/cstime.h
+++ b/engines/mohawk/cstime.h
@@ -35,6 +35,7 @@ namespace Mohawk {
class CSTimeCase;
class CSTimeInterface;
class CSTimeView;
+class VideoManager;
enum {
kCSTimeEventNothing = 0xffff,
@@ -136,6 +137,7 @@ public:
Common::RandomSource *_rnd;
+ VideoManager *_video;
Sound *_sound;
CSTimeGraphics *_gfx;
bool _needsUpdate;
@@ -181,6 +183,8 @@ private:
Common::List<CSTimeEvent> _events;
void triggerEvent(CSTimeEvent &event);
+
+ void pauseEngineIntern(bool) override;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 6ee18d1576..340dfd16f7 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -145,6 +145,7 @@ MohawkEngine_LivingBooks::MohawkEngine_LivingBooks(OSystem *syst, const MohawkGa
_rnd = new Common::RandomSource("livingbooks");
_sound = NULL;
+ _video = NULL;
_page = NULL;
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -160,6 +161,7 @@ MohawkEngine_LivingBooks::~MohawkEngine_LivingBooks() {
delete _console;
delete _sound;
+ delete _video;
delete _gfx;
delete _rnd;
_bookInfoFile.clear();
@@ -184,6 +186,7 @@ Common::Error MohawkEngine_LivingBooks::run() {
error("Could not find xRes/yRes variables");
_gfx = new LBGraphics(this, _screenWidth, _screenHeight);
+ _video = new VideoManager(this);
_sound = new Sound(this);
if (getGameType() != GType_LIVINGBOOKSV1)
@@ -287,6 +290,17 @@ Common::Error MohawkEngine_LivingBooks::run() {
return Common::kNoError;
}
+void MohawkEngine_LivingBooks::pauseEngineIntern(bool pause) {
+ MohawkEngine::pauseEngineIntern(pause);
+
+ if (pause) {
+ _video->pauseVideos();
+ } else {
+ _video->resumeVideos();
+ _system->updateScreen();
+ }
+}
+
void MohawkEngine_LivingBooks::loadBookInfo(const Common::String &filename) {
if (!_bookInfoFile.loadFromFile(filename))
error("Could not open %s as a config file", filename.c_str());
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index cf67c1ee8e..e0f8635568 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -714,6 +714,7 @@ public:
Common::RandomSource *_rnd;
+ VideoManager *_video;
Sound *_sound;
LBGraphics *_gfx;
bool _needsRedraw, _needsUpdate;
@@ -817,6 +818,8 @@ private:
Common::String getStringFromConfig(const Common::String &section, const Common::String &key);
Common::String getStringFromConfig(const Common::String &section, const Common::String &key, Common::String &leftover);
int getIntFromConfig(const Common::String &section, const Common::String &key);
+
+ void pauseEngineIntern(bool) override;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index 40290d4e4c..53481af8a7 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -41,13 +41,11 @@ MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc)
// Setup mixer
syncSoundSettings();
- _video = 0;
_pauseDialog = 0;
_cursor = 0;
}
MohawkEngine::~MohawkEngine() {
- delete _video;
delete _pauseDialog;
delete _cursor;
@@ -57,23 +55,11 @@ MohawkEngine::~MohawkEngine() {
}
Common::Error MohawkEngine::run() {
- _video = new VideoManager(this);
_pauseDialog = new PauseDialog(this, _("The game is paused. Press any key to continue."));
return Common::kNoError;
}
-void MohawkEngine::pauseEngineIntern(bool pause) {
- Engine::pauseEngineIntern(pause);
-
- if (pause) {
- _video->pauseVideos();
- } else {
- _video->resumeVideos();
- _system->updateScreen();
- }
-}
-
void MohawkEngine::pauseGame() {
runDialog(*_pauseDialog);
}
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index bc0d642bce..fe2c15739c 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -100,7 +100,6 @@ public:
bool hasFeature(EngineFeature f) const;
- VideoManager *_video;
CursorManager *_cursor;
virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
@@ -118,7 +117,6 @@ public:
private:
PauseDialog *_pauseDialog;
- void pauseEngineIntern(bool);
protected:
// An array holding the main Mohawk archives require by the games
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index e887436e98..d1da36af7a 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -76,6 +76,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_hoverResource = nullptr;
_sound = nullptr;
+ _video = nullptr;
_gfx = nullptr;
_console = nullptr;
_scriptParser = nullptr;
@@ -89,6 +90,7 @@ MohawkEngine_Myst::~MohawkEngine_Myst() {
DebugMan.clearAllDebugChannels();
delete _gfx;
+ delete _video;
delete _sound;
delete _console;
delete _scriptParser;
@@ -222,6 +224,7 @@ Common::Error MohawkEngine_Myst::run() {
MohawkEngine::run();
_gfx = new MystGraphics(this);
+ _video = new VideoManager(this);
_sound = new Sound(this);
_console = new MystConsole(this);
_gameState = new MystGameState(this, _saveFileMan);
@@ -420,6 +423,17 @@ void MohawkEngine_Myst::pollAndDiscardEvents() {
}
}
+void MohawkEngine_Myst::pauseEngineIntern(bool pause) {
+ MohawkEngine::pauseEngineIntern(pause);
+
+ if (pause) {
+ _video->pauseVideos();
+ } else {
+ _video->resumeVideos();
+ _system->updateScreen();
+ }
+}
+
void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
debug(2, "changeToStack(%d)", stack);
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 2414b71cb1..f313e381c8 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -201,6 +201,7 @@ public:
bool _showResourceRects;
+ VideoManager *_video;
Sound *_sound;
MystGraphics *_gfx;
MystGameState *_gameState;
@@ -270,6 +271,8 @@ private:
void loadCursorHints();
uint16 _currentCursor;
uint16 _mainCursor; // Also defines the current page being held (white, blue, red, or none)
+
+ void pauseEngineIntern(bool) override;
};
template<class T>
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 2a651cf0de..f8b302b8d9 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -60,6 +60,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_extrasFile = nullptr;
_stack = nullptr;
_gfx = nullptr;
+ _video = nullptr;
_sound = nullptr;
_rnd = nullptr;
_scriptMan = nullptr;
@@ -91,6 +92,7 @@ MohawkEngine_Riven::~MohawkEngine_Riven() {
delete _card;
delete _stack;
delete _sound;
+ delete _video;
delete _gfx;
delete _console;
delete _extrasFile;
@@ -116,6 +118,7 @@ Common::Error MohawkEngine_Riven::run() {
SearchMan.add("arcriven.z", &_installerArchive, 0, false);
_gfx = new RivenGraphics(this);
+ _video = new VideoManager(this);
_sound = new RivenSoundManager(this);
_console = new RivenConsole(this);
_saveLoad = new RivenSaveLoad(this, _saveFileMan);
@@ -283,6 +286,17 @@ void MohawkEngine_Riven::doFrame() {
_system->delayMillis(10);
}
+void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
+ MohawkEngine::pauseEngineIntern(pause);
+
+ if (pause) {
+ _video->pauseVideos();
+ } else {
+ _video->resumeVideos();
+ _system->updateScreen();
+ }
+}
+
// Stack/Card-Related Functions
void MohawkEngine_Riven::changeToStack(uint16 n) {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index f7ef95b31b..a8e9939b43 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -83,6 +83,7 @@ public:
MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc);
virtual ~MohawkEngine_Riven();
+ VideoManager *_video;
RivenSoundManager *_sound;
RivenGraphics *_gfx;
Common::RandomSource *_rnd;
@@ -126,6 +127,7 @@ private:
Common::SharedPtr<TimerProc> _timerProc;
uint32 _timerTime;
+ void pauseEngineIntern(bool) override;
public:
// Stack/card/script funtions
RivenStack *constructStackById(uint16 id);