diff options
author | Robert Špalek | 2009-10-04 05:44:23 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-04 05:44:23 +0000 |
commit | df14027c411af320ab6a696f37cbc47e35675393 (patch) | |
tree | 765fc040fe153912ec87a78c65fbde52b65e0f5d /engines/draci/game.cpp | |
parent | bf408b0dbe1b9bcc57c590ec8b2a3ab08644752f (diff) | |
download | scummvm-rg350-df14027c411af320ab6a696f37cbc47e35675393.tar.gz scummvm-rg350-df14027c411af320ab6a696f37cbc47e35675393.tar.bz2 scummvm-rg350-df14027c411af320ab6a696f37cbc47e35675393.zip |
Implemented rudimentary game loading/saving.
Fixed many bugs in the boilerplate. Saving (only) things that really need to
be saved. Loading seems to work modulo dialogs and (possibly) inventory.
svn-id: r44586
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r-- | engines/draci/game.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 5d3c6a3384..297214d8b2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -226,6 +226,8 @@ void Game::loop() { _loopStatus, _loopSubstatus); _vm->handleEvents(); + if (shouldExitLoop()) // after loading + break; // Fetch mouse coordinates int x = _vm->_mouse->getPosX(); @@ -1384,6 +1386,10 @@ int Game::getRoomNum() const { return _currentRoom._roomNum; } +void Game::setRoomNum(int num) { + _currentRoom._roomNum = num; +} + int Game::getPreviousRoomNum() const { return _previousRoom; } @@ -1502,6 +1508,31 @@ Game::~Game() { delete[] _items; } +void Game::DoSync(Common::Serializer &s) { + s.syncAsUint16LE(_currentRoom._roomNum); + + for (uint i = 0; i < _info._numObjects; ++i) { + GameObject& obj = _objects[i]; + s.syncAsSint16LE(obj._location); + s.syncAsByte(obj._visible); + } + + for (uint i = 0; i < _info._numItems; ++i) { + s.syncAsByte(_itemStatus[i]); + } + + for (int i = 0; i < kInventorySlots; ++i) { + s.syncAsSint16LE(_inventory[i]); + } + + for (int i = 0; i < _info._numVariables; ++i) { + s.syncAsSint16LE(_variables[i]); + } + for (uint i = 0; i < _info._numDialogueBlocks; ++i) { + s.syncAsSint16LE(_dialogueVars[i]); + } + +} bool WalkingMap::isWalkable(int x, int y) const { // Convert to map pixels |