aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/hdb.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-05-29 02:01:28 +0530
committerEugene Sandulenko2019-09-03 17:16:41 +0200
commit208c6430d6a7312f8c877cada1468be4749868b2 (patch)
treefe22bbb52858e0306cf23b4fafbc9ecec321ca45 /engines/hdb/hdb.cpp
parent6082037f740fe42b2d77a214d45fd6ec24d57625 (diff)
downloadscummvm-rg350-208c6430d6a7312f8c877cada1468be4749868b2.tar.gz
scummvm-rg350-208c6430d6a7312f8c877cada1468be4749868b2.tar.bz2
scummvm-rg350-208c6430d6a7312f8c877cada1468be4749868b2.zip
HDB: Add the GameState and State Management
Diffstat (limited to 'engines/hdb/hdb.cpp')
-rw-r--r--engines/hdb/hdb.cpp59
1 files changed, 55 insertions, 4 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index f9c360c375..aa5f2c7381 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -28,7 +28,6 @@
#include "common/file.h"
#include "common/error.h"
#include "graphics/surface.h"
-#include "graphics/palette.h"
#include "hdb.h"
#include "console.h"
@@ -47,16 +46,68 @@ HDBGame::~HDBGame() {
DebugMan.clearAllDebugChannels();
}
+bool HDBGame::init() {
+ voiceless = false;
+
+ /*
+ Game Subsystem Initializations
+ */
+
+ // Init _fileMan
+ if (_fileMan->openMPC("hyperdemo.mpc")) {
+ gameShutdown = false;
+ return true;
+ }
+
+ error("FileMan::openMPC: Cannot find the hyperspace.mpc data file.");
+ return false;
+}
+
+void HDBGame::start() {
+ gameState = GameState::GAME_TITLE;
+}
+
+/*
+ Changes the current GameState to the next one.
+ Game State Transitions are deterministic: each state can
+ only a particular state. The next state is held in gameState.
+
+ TODO: All the functionality hasn't been implemented yet since
+ their subsystems are incomplete. This section needs to be periodically
+ updated as soon as the subsytems are improved.
+*/
+void HDBGame::changeGameState() {
+
+ switch (gameState) {
+ case GameState::GAME_TITLE:
+ gameState = GameState::GAME_MENU;
+ break;
+ case GameState::GAME_MENU:
+ gameState = GameState::GAME_PLAY;
+ break;
+ case GameState::GAME_PLAY:
+ gameState = GameState::GAME_MENU;
+ break;
+ }
+}
+
Common::Error HDBGame::run() {
// Initializes Graphics
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(800, 600, &format);
_console = new Console();
- //readMPC("hyperdemo.mpc");
+ /*
+ if (!_game->init()) {
+ error("Couldn't initialize Game.");
+ return Common::kUnknownError;
+ }
- Common::String s1("Tests");
-
+ _game->start();
+
+ _game->mainLoop();
+ */
+
while (!shouldQuit()) {
Common::Event event;