aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp57
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.h17
-rw-r--r--engines/xeen/xeen.cpp22
-rw-r--r--engines/xeen/xeen.h8
4 files changed, 69 insertions, 35 deletions
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index 0ad76ce09b..19ca2f2bb1 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 3dceb891ee..41fe4b3b83 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 493ffbf129..341af615e7 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 3c8084b2bd..5cd30aaf7a 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