aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-12-08 20:54:18 +0000
committerMartin Kiewitz2009-12-08 20:54:18 +0000
commita2d7505e8118bd7af5fe8f3f2a184af5e6ac3834 (patch)
treeca3e51302f4edaf656c22651825ada191e3175c1 /engines
parent5f178e86500b93d6d0c5fb65ce2908522319e703 (diff)
downloadscummvm-rg350-a2d7505e8118bd7af5fe8f3f2a184af5e6ac3834.tar.gz
scummvm-rg350-a2d7505e8118bd7af5fe8f3f2a184af5e6ac3834.tar.bz2
scummvm-rg350-a2d7505e8118bd7af5fe8f3f2a184af5e6ac3834.zip
SCI: Saving picPort now (fixes loading saved games in castle of dr. brain)
svn-id: r46292
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/savegame.cpp15
-rw-r--r--engines/sci/engine/savegame.h2
-rw-r--r--engines/sci/gui/gui.cpp6
-rw-r--r--engines/sci/gui/gui.h1
-rw-r--r--engines/sci/gui32/gui32.cpp8
-rw-r--r--engines/sci/gui32/gui32.h1
6 files changed, 32 insertions, 1 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 90694cf84f..fb4e658b54 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -340,6 +340,21 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
s.skip(4, VER(12), VER(12)); // obsolete: used to be status_bar_foreground
s.skip(4, VER(12), VER(12)); // obsolete: used to be status_bar_background
+ if (s.getVersion() >= 13) {
+ // Save/Load picPort as well (cause sierra sci also does this)
+ int16 picPortTop, picPortLeft;
+ Common::Rect picPortRect;
+ if (s.isSaving())
+ picPortRect = _gui->getPortPic(&picPortTop, &picPortLeft);
+
+ s.syncBytes((byte *)&picPortRect, sizeof(picPortRect));
+ s.syncAsSint16LE(picPortTop);
+ s.syncAsSint16LE(picPortLeft);
+
+ if (s.isLoading())
+ _gui->setPortPic(picPortRect, picPortTop, picPortLeft, true);
+ }
+
sync_SegManagerPtr(s, resMan, _segMan);
syncArray<Class>(s, _segMan->_classtable);
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index 95f3099f07..ade9715c48 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -36,7 +36,7 @@ namespace Sci {
struct EngineState;
enum {
- CURRENT_SAVEGAME_VERSION = 12,
+ CURRENT_SAVEGAME_VERSION = 13,
MINIMUM_SAVEGAME_VERSION = 9
};
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index d649e5b478..ef6fc92bbc 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -126,6 +126,12 @@ void SciGui::setPort(uint16 portPtr) {
};
}
+Common::Rect SciGui::getPortPic(int16 *picTop, int16 *picLeft) {
+ *picTop = _windowMgr->_picWind->top;
+ *picLeft = _windowMgr->_picWind->left;
+ return _windowMgr->_picWind->rect;
+}
+
void SciGui::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag) {
_windowMgr->_picWind->rect = rect;
_windowMgr->_picWind->top = picTop;
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index 150c84bed3..006fa1189d 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -63,6 +63,7 @@ public:
virtual void wait(int16 ticks);
virtual void setPort(uint16 portPtr);
+ virtual Common::Rect getPortPic(int16 *picTop, int16 *picLeft);
virtual void setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag);
virtual reg_t getPort();
virtual void globalToLocal(int16 *x, int16 *y);
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index f48437b291..acfcc65377 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -420,6 +420,14 @@ void SciGui32::setPort(uint16 portPtr) {
_s->port = new_port;
}
+Common::Rect SciGui32::getPortPic(int16 *picTop, int16 *picLeft) {
+ // Don't want to fiddle around with oldgui, so we just return defaults when saving games
+ Common::Rect defaultRect(0, 0, 320, 200);
+ *picTop = 10;
+ *picLeft = 0;
+ return defaultRect;
+}
+
void SciGui32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag) {
if (activated_icon_bar) {
port_origin_x = port_origin_y = 0;
diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h
index 51f57c0615..48d1b7fb5c 100644
--- a/engines/sci/gui32/gui32.h
+++ b/engines/sci/gui32/gui32.h
@@ -42,6 +42,7 @@ public:
void wait(int16 ticks);
void setPort(uint16 portPtr);
+ Common::Rect getPortPic(int16 *picTop, int16 *picLeft);
void setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag);
reg_t getPort();
void globalToLocal(int16 *x, int16 *y);