[Scummvm-git-logs] scummvm master -> 381d4e89656704e73f94638d2c666c67386fe92f

dreammaster dreammaster at scummvm.org
Fri Sep 23 19:12:07 CEST 2016


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:
381d4e8965 XEEN: Add dispatcher for cutscenes, menu, and gameplay


Commit: 381d4e89656704e73f94638d2c666c67386fe92f
    https://github.com/scummvm/scummvm/commit/381d4e89656704e73f94638d2c666c67386fe92f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-23T13:11:29-04:00

Commit Message:
XEEN: Add dispatcher for cutscenes, menu, and gameplay

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



diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index 0ad76ce..19ca2f2 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -34,19 +34,50 @@ WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *g
 	_seenDarkSideIntro = false;
 }
 
-void WorldOfXeenEngine::showIntro() {
-	File::setCurrentArchive(INTRO_ARCHIVE);
-
-	// **DEBUG**
-	if (gDebugLevel == 0)
-		return;
-
-	showCloudsEnding();
-	/*
-	bool completed = showDarkSideTitle();
-	if (!_seenDarkSideIntro && completed)
-		showDarkSideIntro();
-		*/
+void WorldOfXeenEngine::outerGameLoop() {
+	_pendingAction = getGameID() == GType_DarkSide ? WOX_DARKSIDE_INTRO : WOX_CLOUDS_INTRO;
+
+	while (!shouldQuit() && _pendingAction != WOX_QUIT) {
+		switch (_pendingAction) {
+		case WOX_CLOUDS_INTRO:
+			if (showCloudsTitle())
+				showCloudsIntro();
+			_pendingAction = WOX_MENU;
+			break;
+
+		case WOX_CLOUDS_ENDING:
+			showCloudsEnding();
+			_pendingAction = WOX_MENU;
+			break;
+
+		case WOX_DARKSIDE_INTRO:
+			if (showDarkSideTitle())
+				showDarkSideIntro();
+			_pendingAction = WOX_MENU;
+			break;
+
+		case WOX_DARKSIDE_ENDING:
+			showDarkSideEnding();
+			_pendingAction = WOX_MENU;
+			break;
+
+		case WOX_WORLD_ENDING:
+			// TODO
+			return;
+
+		case WOX_MENU:
+			// TODO
+			_pendingAction = WOX_PLAY_GAME;
+			break;
+
+		case WOX_PLAY_GAME:
+			playGame();
+			break;
+
+		default:
+			break;
+		}
+	}
 }
 
 } // End of namespace WorldOfXeen
diff --git a/engines/xeen/worldofxeen/worldofxeen.h b/engines/xeen/worldofxeen/worldofxeen.h
index 3dceb89..41fe4b3 100644
--- a/engines/xeen/worldofxeen/worldofxeen.h
+++ b/engines/xeen/worldofxeen/worldofxeen.h
@@ -30,6 +30,11 @@
 namespace Xeen {
 namespace WorldOfXeen {
 
+enum WOXGameAction {
+	WOX_QUIT, WOX_CLOUDS_INTRO, WOX_CLOUDS_ENDING, WOX_DARKSIDE_INTRO,
+	WOX_DARKSIDE_ENDING, WOX_WORLD_ENDING, WOX_MENU, WOX_PLAY_GAME
+};
+
 /**
  * Implements a descendant of the base Xeen engine to handle 
  * Clouds of Xeen, Dark Side of Xeen, and Worlds of Xeen specific
@@ -38,12 +43,22 @@ namespace WorldOfXeen {
 class WorldOfXeenEngine: public XeenEngine, public CloudsCutscenes, 
 		public DarkSideCutscenes {
 protected:
-	virtual void showIntro();
+	/**
+	 * Outer gameplay loop responsible for dispatching control to game-specific
+	 * intros, main menus, or to play the actual game
+	 */
+	virtual void outerGameLoop();
 public:
 	bool _seenDarkSideIntro;
+	WOXGameAction _pendingAction;
 public:
 	WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc);
 	virtual ~WorldOfXeenEngine() {}
+
+	/**
+	 * Set the next overall game action to do
+	 */
+	void setPendingAction(WOXGameAction action) { _pendingAction = action; }
 };
 
 } // End of namespace WorldOfXeen
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 493ffbf..341af61 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -121,17 +121,7 @@ void XeenEngine::initialize() {
 Common::Error XeenEngine::run() {
 	initialize();
 
-	showIntro();
-	if (shouldQuit())
-		return Common::kNoError;
-	File::setCurrentArchive(GAME_ARCHIVE);
-	_sound->stopAllAudio();
-
-	showMainMenu();
-	if (shouldQuit())
-		return Common::kNoError;
-
-	playGame();
+	outerGameLoop();
 
 	return Common::kNoError;
 }
@@ -273,18 +263,14 @@ void XeenEngine::writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeade
 //	out->writeUint32LE(_events->getFrameCounter());
 }
 
-void XeenEngine::showMainMenu() {
-	//OptionsMenu::show(this);
-}
-
 void XeenEngine::playGame() {
 	_saves->reset();
+	File::setCurrentArchive(GAME_ARCHIVE);
+	_sound->stopAllAudio();
+
 	play();
 }
 
-/*
- * Secondary method for handling the actual gameplay
- */
 void XeenEngine::play() {
 	// TODO: Init variables
 	_quitMode = 0;
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 3c8084b..5cd30aa 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -104,15 +104,17 @@ private:
 	Common::RandomSource _randomSource;
 	int _loadSaveSlot;
 
-	void showMainMenu();
-
 	void play();
 
 	void pleaseWait();
 
 	void gameLoop();
 protected:
-	virtual void showIntro() = 0;
+	/**
+	 * Outer gameplay loop responsible for dispatching control to game-specific
+	 * intros, main menus, or to play the actual game
+	 */
+	virtual void outerGameLoop() = 0;
 
 	/**
 	 * Play the game





More information about the Scummvm-git-logs mailing list