aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2011-09-13 19:47:31 +1000
committerPaul Gilbert2011-09-13 19:47:31 +1000
commite20647eae3e4e139c30c058e238848d2b3728631 (patch)
tree7728d628483478c31b698fee80683c3e94298f6d /engines
parentdd75ebd96b96dc12df11e98f4011a1119b230b5d (diff)
downloadscummvm-rg350-e20647eae3e4e139c30c058e238848d2b3728631.tar.gz
scummvm-rg350-e20647eae3e4e139c30c058e238848d2b3728631.tar.bz2
scummvm-rg350-e20647eae3e4e139c30c058e238848d2b3728631.zip
TSAGE: Synchronise UI fields in savegames so it is correctly shown when restoring
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/blue_force/blueforce_ui.cpp33
-rw-r--r--engines/tsage/blue_force/blueforce_ui.h4
-rw-r--r--engines/tsage/core.cpp6
-rw-r--r--engines/tsage/globals.cpp2
4 files changed, 43 insertions, 2 deletions
diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp
index 8f40d2b565..75ab9a60a4 100644
--- a/engines/tsage/blue_force/blueforce_ui.cpp
+++ b/engines/tsage/blue_force/blueforce_ui.cpp
@@ -264,6 +264,34 @@ void UICollection::draw() {
UIElements::UIElements(): UICollection() {
_cursorVisage.setVisage(1, 5);
+ _saver->addLoadNotifier(&UIElements::loadNotifierProc);
+}
+
+void UIElements::synchronize(Serializer &s) {
+ UICollection::synchronize(s);
+
+ s.syncAsSint16LE(_slotStart);
+ s.syncAsSint16LE(_scoreValue);
+ s.syncAsByte(_active);
+
+ int count = _itemList.size();
+ s.syncAsSint16LE(count);
+ if (s.isLoading()) {
+ // Load in item list
+ _itemList.clear();
+
+ for (int idx = 0; idx < count; ++idx) {
+ int itemId;
+ s.syncAsSint16LE(itemId);
+ _itemList.push_back(itemId);
+ }
+ } else {
+ // Save item list
+ for (int idx = 0; idx < count; ++idx) {
+ int itemId = _itemList[idx];
+ s.syncAsSint16LE(itemId);
+ }
+ }
}
void UIElements::process(Event &event) {
@@ -471,6 +499,11 @@ void UIElements::scrollInventory(bool isLeft) {
updateInventory();
}
+void UIElements::loadNotifierProc(bool postFlag) {
+ if (postFlag && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.show();
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/blue_force/blueforce_ui.h
index 927e667cff..d9c593b900 100644
--- a/engines/tsage/blue_force/blueforce_ui.h
+++ b/engines/tsage/blue_force/blueforce_ui.h
@@ -136,6 +136,8 @@ public:
Visage _cursorVisage;
UIElements();
+ virtual Common::String getClassName() { return "UIElements"; }
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL) { error("Wrong init() called"); }
virtual void process(Event &event);
@@ -143,6 +145,8 @@ public:
void updateInventory();
void addScore(int amount);
void scrollInventory(bool isLeft);
+
+ static void loadNotifierProc(bool postFlag);
};
} // End of namespace BlueForce
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 7656a6cfaa..252a7b2bf9 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1423,8 +1423,12 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) {
}
}
+ Rect tempRect = bounds;
+ if (_vm->getGameID() == GType_BlueForce)
+ tempRect.setHeight(BF_GLOBALS._interfaceY);
+
_globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface,
- bounds, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), NULL);
+ tempRect, Rect(0, 0, tempRect.width(), tempRect.height()), NULL);
for (SynchronizedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i)
delete *i;
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 1895fbc2d2..75af19db0b 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -224,7 +224,7 @@ void BlueForceGlobals::reset() {
_driveFromScene = 300;
_driveToScene = 0;
- _interfaceY = 0;
+ _interfaceY = BF_INTERFACE_Y;
_v51C44 = 1;
_dayNumber = 0;
_v4CEA4 = 0;