[Scummvm-git-logs] scummvm master -> 3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca

dreammaster dreammaster at scummvm.org
Wed Feb 14 03:33:02 CET 2018


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

Summary:
3f7fcaec5f XEEN: Move reseting dream sequence cutscene into the engine class


Commit: 3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca
    https://github.com/scummvm/scummvm/commit/3f7fcaec5f36b9eeeeb895f3ec078fb8e60068ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-13T21:33:02-05:00

Commit Message:
XEEN: Move reseting dream sequence cutscene into the engine class

Changed paths:
    engines/xeen/interface.cpp
    engines/xeen/swordsofxeen/swordsofxeen.cpp
    engines/xeen/swordsofxeen/swordsofxeen.h
    engines/xeen/worldofxeen/worldofxeen.cpp
    engines/xeen/worldofxeen/worldofxeen.h
    engines/xeen/xeen.h


diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 3ac885f..2f12c4e 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 05998ce..671a1bc 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 784fba0..2eda3de 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 dbccf46..9bc6394 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 1122115..f985947 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 d3a7fed..cbf9ff3 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);





More information about the Scummvm-git-logs mailing list