diff options
author | Strangerke | 2014-12-28 17:21:16 +0100 |
---|---|---|
committer | Strangerke | 2014-12-28 17:21:16 +0100 |
commit | c0a8a360833a7330b75f771fdb762568e48a9e37 (patch) | |
tree | fde8819f99c3aede5adf52bdadc6cffad0efea83 /engines/access | |
parent | 6590898e6c1e46210e0c49a12874e02d1ad46d6f (diff) | |
download | scummvm-rg350-c0a8a360833a7330b75f771fdb762568e48a9e37.tar.gz scummvm-rg350-c0a8a360833a7330b75f771fdb762568e48a9e37.tar.bz2 scummvm-rg350-c0a8a360833a7330b75f771fdb762568e48a9e37.zip |
ACCESS: MM - Implement some game logic
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/martian/martian_game.cpp | 76 | ||||
-rw-r--r-- | engines/access/martian/martian_game.h | 4 |
2 files changed, 68 insertions, 12 deletions
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp index 6392206209..6722120211 100644 --- a/engines/access/martian/martian_game.cpp +++ b/engines/access/martian/martian_game.cpp @@ -37,25 +37,77 @@ MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDes MartianEngine::~MartianEngine() { } +void MartianEngine::initObjects() { + _room = new MartianRoom(this); + _scripts = new MartianScripts(this); +} + +void MartianEngine::configSelect() { + // No implementation required in MM +} + +void MartianEngine::initVariables() { + warning("TODO: initVariables"); + + // Set player room and position + _player->_roomNumber = 7; + + _inventory->_startInvItem = 0; + _inventory->_startInvBox = 0; + Common::fill(&_objectsTable[0], &_objectsTable[100], (SpriteResource *)nullptr); + _player->_playerOff = false; + + // Setup timers + const int TIMER_DEFAULTS[] = { 4, 10, 8, 1, 1, 1, 1, 2 }; + for (int i = 0; i < 32; ++i) { + TimerEntry te; + te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1; + te._flag = 1; + + _timers.push_back(te); + } + + _player->_playerX = _player->_rawPlayer.x = TRAVEL_POS[_player->_roomNumber][0]; + _player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1]; + _room->_selectCommand = -1; + _events->setNormalCursor(CURSOR_CROSSHAIRS); + _mouseMode = 0; + _numAnimTimers = 0; +} + void MartianEngine::playGame() { - // Do introduction - doIntroduction(); - if (shouldQuit()) - return; + // Initialize Amazon game-specific objects + initObjects(); // Setup the game setupGame(); + configSelect(); - _screen->clearScreen(); - _screen->setPanel(0); - _screen->forceFadeOut(); + if (_loadSaveSlot == -1) { + // Do introduction + doIntroduction(); + if (shouldQuit()) + return; + } - _events->showCursor(); + do { + _restartFl = false; + _screen->clearScreen(); + _screen->setPanel(0); + _screen->forceFadeOut(); + _events->showCursor(); - // Setup and execute the room - _room = new MartianRoom(this); - _scripts = new MartianScripts(this); - _room->doRoom(); + initVariables(); + + // If there's a pending savegame to load, load it + if (_loadSaveSlot != -1) { + loadGameState(_loadSaveSlot); + _loadSaveSlot = -1; + } + + // Execute the room + _room->doRoom(); + } while (_restartFl); } void MartianEngine::doIntroduction() { diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h index a83b67a288..812aa37ed1 100644 --- a/engines/access/martian/martian_game.h +++ b/engines/access/martian/martian_game.h @@ -53,6 +53,10 @@ private: */ void setupGame(); + void initObjects(); + void configSelect(); + void initVariables(); + protected: /** * Play the game |