mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-07 10:21:31 +00:00
HDB: Add the GameState and State Management
This commit is contained in:
parent
6082037f74
commit
208c6430d6
@ -35,4 +35,4 @@ Console::~Console() {
|
||||
_visible = false;
|
||||
}
|
||||
|
||||
} // End of namespace Plumbers
|
||||
} // End of namespace HDB
|
||||
|
@ -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;
|
||||
|
@ -35,16 +35,13 @@
|
||||
#include "engines/util.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "file-manager.h"
|
||||
|
||||
#define MAX_SNDCACHE_MEM 0x400000 // 4Mb of sounds in memory
|
||||
#define MAX_TILES_CACHED 3500 // Max no of tiles in memory at once
|
||||
#define GFX_CACHE_LIMIT 0x800000
|
||||
|
||||
/*
|
||||
Subsystem Includes
|
||||
*/
|
||||
|
||||
#include "file-manager.h"
|
||||
|
||||
struct ADGameDescription;
|
||||
|
||||
namespace HDB {
|
||||
@ -54,6 +51,13 @@ enum HDBDebugChannels {
|
||||
kDebugExample2 = 1 << 1
|
||||
};
|
||||
|
||||
enum GameState {
|
||||
GAME_TITLE,
|
||||
GAME_MENU,
|
||||
GAME_PLAY,
|
||||
GAME_LOADING
|
||||
};
|
||||
|
||||
class HDBGame : public Engine {
|
||||
public:
|
||||
HDBGame(OSystem *syst, const ADGameDescription *gameDesc);
|
||||
@ -66,6 +70,15 @@ public:
|
||||
const char *getGameId() const;
|
||||
Common::Platform getPlatform() const;
|
||||
|
||||
// Game related members;
|
||||
|
||||
bool init();
|
||||
|
||||
void start();
|
||||
void changeGameState();
|
||||
|
||||
bool gameShutdown;
|
||||
|
||||
private:
|
||||
Console *_console;
|
||||
|
||||
@ -74,7 +87,12 @@ private:
|
||||
*/
|
||||
|
||||
FileMan* _fileMan;
|
||||
|
||||
|
||||
// Game Variables
|
||||
|
||||
GameState gameState;
|
||||
bool voiceless;
|
||||
|
||||
};
|
||||
|
||||
}// End of namespace HDB
|
||||
|
Loading…
Reference in New Issue
Block a user