[Scummvm-cvs-logs] scummvm master -> 8950549b440d6649bf1021015f72c2af919703fe
dreammaster
dreammaster at scummvm.org
Sun Aug 16 19:44:43 CEST 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8950549b44 SHERLOCK: Further fixes to character movement across saves
Commit: 8950549b440d6649bf1021015f72c2af919703fe
https://github.com/scummvm/scummvm/commit/8950549b440d6649bf1021015f72c2af919703fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-16T13:42:58-04:00
Commit Message:
SHERLOCK: Further fixes to character movement across saves
Restoring movement across save didn't work, so properly handle
stopping any moving characters when loading a savegame
Changed paths:
engines/sherlock/people.cpp
engines/sherlock/people.h
engines/sherlock/saveload.cpp
engines/sherlock/scalpel/scalpel_people.cpp
engines/sherlock/tattoo/tattoo_people.cpp
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 25f379b..739abb0 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -64,40 +64,6 @@ 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;
@@ -219,25 +185,19 @@ void People::reset() {
if (IS_SERRATED_SCALPEL) {
p._type = CHARACTER;
- p._sequenceNumber = (int)Tattoo::STOP_DOWNRIGHT;
p._position = Point32(100 * FIXED_INT_MULTIPLIER, 110 * FIXED_INT_MULTIPLIER);
} else if (!talk._scriptMoreFlag && !saves._justLoaded) {
p._type = (idx == 0) ? CHARACTER : INVALID;
- p._sequenceNumber = (int)Scalpel::STOP_DOWNRIGHT;
p._position = Point32(36 * FIXED_INT_MULTIPLIER, 29 * FIXED_INT_MULTIPLIER);
p._use[0]._verb = "";
p._use[1]._verb = "";
}
- if (!saves._justLoaded) {
- p._walkCount = 0;
- p._walkTo.clear();
- p._delta = Point32(0, 0);
- }
-
+ p._sequenceNumber = IS_SERRATED_SCALPEL ? (int)Tattoo::STOP_DOWNRIGHT : (int)Tattoo::STOP_DOWNRIGHT;
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;
@@ -258,6 +218,8 @@ void People::reset() {
p._adjust = Common::Point(0, 0);
// Load the default walk sequences
+ p._walkCount = 0;
+ p._walkTo.clear();
p._oldWalkSequence = -1;
p._walkSequences.clear();
if (IS_SERRATED_SCALPEL) {
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index b97dc71..d790e4c 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -56,21 +56,6 @@ struct PersonData {
_name(name), _portrait(portrait), _stillSequences(stillSequences), _talkSequences(talkSequences) {}
};
-class PointQueue {
-private:
- Common::List<Common::Point> _impl;
-public:
- PointQueue() : _impl() {}
-
- bool empty() const { return _impl.empty(); }
- void clear() { _impl.clear(); }
- Common::Point &front() { return _impl.front(); }
- const Common::Point &front() const { return _impl.front(); }
- void push(const Common::Point &pt);
- Common::Point pop();
- void synchronize(Common::Serializer &s);
-};
-
class Person : public Sprite {
protected:
/**
@@ -78,7 +63,7 @@ protected:
*/
virtual Common::Point getSourcePoint() const = 0;
public:
- PointQueue _walkTo;
+ Common::Queue<Common::Point> _walkTo;
int _srcZone, _destZone;
bool _walkLoaded;
Common::String _portrait;
diff --git a/engines/sherlock/saveload.cpp b/engines/sherlock/saveload.cpp
index c20f783..f32552c 100644
--- a/engines/sherlock/saveload.cpp
+++ b/engines/sherlock/saveload.cpp
@@ -201,6 +201,7 @@ void SaveManager::createThumbnail() {
}
void SaveManager::loadGame(int slot) {
+ Events &events = *_vm->_events;
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(
generateSaveName(slot));
if (!saveFile)
@@ -222,9 +223,11 @@ void SaveManager::loadGame(int slot) {
synchronize(s);
delete saveFile;
+ events.clearEvents();
}
void SaveManager::saveGame(int slot, const Common::String &name) {
+ Events &events = *_vm->_events;
Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(
generateSaveName(slot));
@@ -239,6 +242,7 @@ void SaveManager::saveGame(int slot, const Common::String &name) {
out->finalize();
delete out;
+ events.clearEvents();
}
Common::String SaveManager::generateSaveName(int slot) {
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp
index 9ff3127..0b8caf3 100644
--- a/engines/sherlock/scalpel/scalpel_people.cpp
+++ b/engines/sherlock/scalpel/scalpel_people.cpp
@@ -371,15 +371,11 @@ Common::Point ScalpelPerson::getSourcePoint() const {
}
void ScalpelPerson::synchronize(Serializer &s) {
+ if (_walkCount)
+ gotoStand();
+
s.syncAsSint32LE(_position.x);
s.syncAsSint32LE(_position.y);
- s.syncAsSint32LE(_delta.x);
- s.syncAsSint32LE(_delta.y);
- s.syncAsSint16LE(_sequenceNumber);
- s.syncAsSint16LE(_walkCount);
-
- // Walk to list
- _walkTo.synchronize(s);
}
/*----------------------------------------------------------------*/
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index 19010a6..c5b03b2 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -968,20 +968,18 @@ void TattooPerson::checkWalkGraphics() {
}
void TattooPerson::synchronize(Serializer &s) {
- s.syncAsSint32LE(_position.x);
- s.syncAsSint32LE(_position.y);
- s.syncAsSint32LE(_delta.x);
- s.syncAsSint32LE(_delta.y);
- s.syncAsSint16LE(_sequenceNumber);
- s.syncAsSint16LE(_walkCount);
-
if (s.isSaving()) {
SpriteType type = (_type == INVALID && _walkLoaded) ? HIDDEN_CHARACTER : _type;
s.syncAsSint16LE(type);
} else {
+ if (_walkCount)
+ gotoStand();
+
s.syncAsSint16LE(_type);
}
+ s.syncAsSint32LE(_position.x);
+ s.syncAsSint32LE(_position.y);
s.syncString(_walkVGSName);
s.syncString(_description);
s.syncString(_examine);
@@ -992,9 +990,6 @@ void TattooPerson::synchronize(Serializer &s) {
s.syncAsSint32LE(_npcPause);
s.syncAsByte(_lookHolmes);
s.syncAsByte(_updateNPCPath);
-
- // Walk to list
- _walkTo.synchronize(s);
// Verbs
for (int idx = 0; idx < 2; ++idx)
More information about the Scummvm-git-logs
mailing list