aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/blue_force/blueforce_ui.cpp
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/tsage/blue_force/blueforce_ui.cpp
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/tsage/blue_force/blueforce_ui.cpp')
-rw-r--r--engines/tsage/blue_force/blueforce_ui.cpp33
1 files changed, 33 insertions, 0 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