aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorlukaslw2014-03-08 00:31:27 +0100
committerlukaslw2014-03-08 16:21:57 +0100
commit579c343d1361801c936eedae50d956018a7d83f4 (patch)
tree00617fedf76b5a2628bd2fad35124b8ce8ef3806 /engines/draci/game.cpp
parentda157fbccc7e094f16bc78e2ddadfc2ea29676f4 (diff)
downloadscummvm-rg350-579c343d1361801c936eedae50d956018a7d83f4.tar.gz
scummvm-rg350-579c343d1361801c936eedae50d956018a7d83f4.tar.bz2
scummvm-rg350-579c343d1361801c936eedae50d956018a7d83f4.zip
DRACI: Saving improvements (item in hand and hero position).
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index e5ff1f079a..98777a7eca 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -926,10 +926,12 @@ void Game::inventoryDraw() {
void Game::inventoryReload() {
// Make sure all items are loaded into memory (e.g., after loading a
// savegame) by re-putting them on the same spot in the inventory.
+ GameItem *tempItem = _currentItem;
for (uint i = 0; i < kInventorySlots; ++i) {
putItem(_inventory[i], i);
}
setPreviousItemPosition(0);
+ _currentItem = tempItem;
}
void Game::inventorySwitch(int keycode) {
@@ -1572,7 +1574,7 @@ Game::~Game() {
delete[] _items;
}
-void Game::DoSync(Common::Serializer &s) {
+void Game::DoSync(Common::Serializer &s, uint8 saveVersion) {
s.syncAsUint16LE(_currentRoom._roomNum);
for (uint i = 0; i < _info._numObjects; ++i) {
@@ -1603,6 +1605,25 @@ void Game::DoSync(Common::Serializer &s) {
s.syncAsSint16LE(_dialogueVars[i]);
}
+ if(saveVersion >= 2) {
+ setPositionLoaded(true);
+ if (s.isSaving()) {
+ s.syncAsSint16LE(_hero.x);
+ s.syncAsSint16LE(_hero.y);
+
+ int handItemID = _currentItem ? _currentItem->_absNum : -1;
+ s.syncAsSint16LE(handItemID);
+ } else {
+ s.syncAsSint16LE(_heroLoading.x);
+ s.syncAsSint16LE(_heroLoading.y);
+
+ int handItemID = -1;
+ s.syncAsSint16LE(handItemID);
+ _currentItem = getItem(handItemID);
+ }
+ } else {
+ _currentItem = 0;
+ }
}
static double real_to_double(byte real[6]) {