aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/people.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-15 20:26:36 -0400
committerPaul Gilbert2015-08-15 20:26:36 -0400
commit621a37bbe30756a7983c1e5463389539898d41a5 (patch)
treed5f1fa95dd03590865d875a91a64f3a776987bad /engines/sherlock/people.cpp
parent11e327c4e7d41e01378cbdbaf339bbd09881f326 (diff)
downloadscummvm-rg350-621a37bbe30756a7983c1e5463389539898d41a5.tar.gz
scummvm-rg350-621a37bbe30756a7983c1e5463389539898d41a5.tar.bz2
scummvm-rg350-621a37bbe30756a7983c1e5463389539898d41a5.zip
SHERLOCK: Fix saving/loading when characters are moving
Diffstat (limited to 'engines/sherlock/people.cpp')
-rw-r--r--engines/sherlock/people.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index d91d7fa69a..25f379b68b 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -64,6 +64,40 @@ const char *const WALK_LIB_NAMES[NUM_IN_WALK_LIB] = {
/*----------------------------------------------------------------*/
+void PointQueue::push(const Common::Point &pt) {
+ _impl.push_back(pt);
+}
+
+Common::Point PointQueue::pop() {
+ Common::Point tmp = front();
+ _impl.pop_front();
+ return tmp;
+}
+
+void PointQueue::synchronize(Common::Serializer &s) {
+ int count = _impl.size();
+ s.syncAsUint16LE(count);
+
+ if (s.isSaving()) {
+ for (Common::List<Common::Point>::iterator i = _impl.begin(); i != _impl.end(); ++i) {
+ Common::Point &pt = *i;
+ s.syncAsSint16LE(pt.x);
+ s.syncAsSint16LE(pt.y);
+ }
+ } else {
+ int xp, yp;
+
+ _impl.clear();
+ for (int idx = 0; idx < count; ++idx) {
+ s.syncAsSint16LE(xp);
+ s.syncAsSint16LE(yp);
+ _impl.push_back(Common::Point(xp, yp));
+ }
+ }
+}
+
+/*----------------------------------------------------------------*/
+
Person::Person() : Sprite() {
_walkLoaded = false;
_oldWalkSequence = -1;
@@ -194,15 +228,19 @@ void People::reset() {
p._use[0]._verb = "";
p._use[1]._verb = "";
}
-
+
+ if (!saves._justLoaded) {
+ p._walkCount = 0;
+ p._walkTo.clear();
+ p._delta = Point32(0, 0);
+ }
+
p._imageFrame = nullptr;
p._frameNumber = 1;
p._startSeq = 0;
- p._delta = Point32(0, 0);
p._oldPosition = Common::Point(0, 0);
p._oldSize = Common::Point(0, 0);
p._misc = 0;
- p._walkCount = 0;
p._pickUp = "";
p._allow = 0;
p._noShapeSize = Common::Point(0, 0);
@@ -220,7 +258,6 @@ void People::reset() {
p._adjust = Common::Point(0, 0);
// Load the default walk sequences
- p._walkTo.clear();
p._oldWalkSequence = -1;
p._walkSequences.clear();
if (IS_SERRATED_SCALPEL) {