aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-02-13 21:33:02 -0500
committerPaul Gilbert2018-02-13 21:33:02 -0500
commit3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca (patch)
treed27f4f4d11fb879b44ba432c6bfbb90c1fa17005
parent5380e3a2ca795c6cf6b54e2bb5d3b2c9bcb55dd6 (diff)
downloadscummvm-rg350-3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca.tar.gz
scummvm-rg350-3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca.tar.bz2
scummvm-rg350-3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca.zip
XEEN: Move reseting dream sequence cutscene into the engine class
-rw-r--r--engines/xeen/interface.cpp39
-rw-r--r--engines/xeen/swordsofxeen/swordsofxeen.cpp4
-rw-r--r--engines/xeen/swordsofxeen/swordsofxeen.h5
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp36
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.h5
-rw-r--r--engines/xeen/xeen.h5
6 files changed, 57 insertions, 37 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 3ac885f210..2f12c4ea32 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -991,12 +991,8 @@ bool Interface::checkMoveDirection(int key) {
}
void Interface::rest() {
- EventsManager &events = *_vm->_events;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
- Screen &screen = *_vm->_screen;
- Sound &sound = *_vm->_sound;
- Windows &windows = *_vm->_windows;
map.cellFlagLookup(party._mazePosition);
@@ -1043,39 +1039,8 @@ void Interface::rest() {
party.changeTime(map._isOutdoors ? 380 : 470);
}
- if (_vm->getRandomNumber(1, 20) == 1) {
- // Show dream
- screen.saveBackground();
- screen.fadeOut();
- events.hideCursor();
-
- screen.loadBackground("scene1.raw");
- windows[0].update();
- screen.fadeIn();
-
- events.updateGameCounter();
- while (!_vm->shouldExit() && events.timeElapsed() < 7)
- events.pollEventsAndWait();
-
- sound.playSound("dreams2.voc", 1);
- while (!_vm->shouldExit() && sound.isPlaying())
- events.pollEventsAndWait();
-
- sound.playSound("laff1.voc", 1);
- while (!_vm->shouldExit() && sound.isPlaying())
- events.pollEventsAndWait();
-
- events.updateGameCounter();
- while (!_vm->shouldExit() && events.timeElapsed() < 7)
- events.pollEventsAndWait();
-
- screen.fadeOut();
- events.setCursor(0);
- screen.restoreBackground();
- windows[0].update();
-
- screen.fadeIn();
- }
+ if (_vm->getRandomNumber(1, 20) == 1)
+ _vm->dream();
party.resetTemps();
diff --git a/engines/xeen/swordsofxeen/swordsofxeen.cpp b/engines/xeen/swordsofxeen/swordsofxeen.cpp
index 05998ce56a..671a1bce92 100644
--- a/engines/xeen/swordsofxeen/swordsofxeen.cpp
+++ b/engines/xeen/swordsofxeen/swordsofxeen.cpp
@@ -39,6 +39,10 @@ void SwordsOfXeenEngine::death() {
error("TODO: Swords of Xeen death screen");
}
+void SwordsOfXeenEngine::dream() {
+ error("TODO: Swords of Xeen dream sequence, if any");
+}
+
void SwordsOfXeenEngine::showCutscene(const Common::String &name, int status, uint score) {
_quitMode = QMODE_MENU;
}
diff --git a/engines/xeen/swordsofxeen/swordsofxeen.h b/engines/xeen/swordsofxeen/swordsofxeen.h
index 784fba0849..2eda3dec29 100644
--- a/engines/xeen/swordsofxeen/swordsofxeen.h
+++ b/engines/xeen/swordsofxeen/swordsofxeen.h
@@ -53,6 +53,11 @@ public:
* Show a cutscene
*/
virtual void showCutscene(const Common::String &name, int status, uint score);
+
+ /**
+ * Dream sequence
+ */
+ virtual void dream();
};
#define SWORDS_VM (*(::Xeen::SwordsOfXeen::SwordsOfXeenEngine *)g_vm)
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index dbccf460ea..9bc6394f48 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -170,6 +170,42 @@ void WorldOfXeenEngine::death() {
w.update();
}
+void WorldOfXeenEngine::dream() {
+ Windows &windows = *_windows;
+ Graphics::ManagedSurface savedBg;
+
+ savedBg.copyFrom(*_screen);
+ _screen->fadeOut();
+ _events->hideCursor();
+
+ _screen->loadBackground("scene1.raw");
+ windows[0].update();
+ _screen->fadeIn();
+
+ _events->updateGameCounter();
+ while (!shouldExit() && _events->timeElapsed() < 7)
+ _events->pollEventsAndWait();
+
+ _sound->playSound("dreams2.voc", 1);
+ while (!shouldExit() && _sound->isPlaying())
+ _events->pollEventsAndWait();
+
+ _sound->playSound("laff1.voc", 1);
+ while (!shouldExit() && _sound->isPlaying())
+ _events->pollEventsAndWait();
+
+ _events->updateGameCounter();
+ while (!shouldExit() && _events->timeElapsed() < 7)
+ _events->pollEventsAndWait();
+
+ _screen->fadeOut();
+ _events->setCursor(0);
+ _screen->blitFrom(savedBg);
+ windows[0].update();
+
+ _screen->fadeIn();
+}
+
void WorldOfXeenEngine::showCutscene(const Common::String &name, int status, uint score) {
_sound->stopAllAudio();
_events->clearEvents();
diff --git a/engines/xeen/worldofxeen/worldofxeen.h b/engines/xeen/worldofxeen/worldofxeen.h
index 1122115498..f985947af4 100644
--- a/engines/xeen/worldofxeen/worldofxeen.h
+++ b/engines/xeen/worldofxeen/worldofxeen.h
@@ -64,6 +64,11 @@ public:
virtual void showCutscene(const Common::String &name, int status, uint score);
/**
+ * Dream sequence
+ */
+ virtual void dream();
+
+ /**
* Set the next overall game action to do
*/
void setPendingAction(WOXGameAction action) { _pendingAction = action; }
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index d3a7fedb80..cbf9ff3ed4 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -213,6 +213,11 @@ public:
*/
virtual void showCutscene(const Common::String &name, int status, uint score) {}
+ /**
+ * Dream sequence
+ */
+ virtual void dream() = 0;
+
static Common::String printMil(uint value);
static Common::String printK(uint value);