aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-05-26 08:18:50 -0400
committerPaul Gilbert2015-05-26 08:18:50 -0400
commit0cc79979fc27a097037ca580dda78607080d5ac4 (patch)
tree4b94857f4efacc778f2c63d088c61353bc78d451
parente1e39ea3d2e358b47fc26cc52244f536ee2a0a01 (diff)
downloadscummvm-rg350-0cc79979fc27a097037ca580dda78607080d5ac4.tar.gz
scummvm-rg350-0cc79979fc27a097037ca580dda78607080d5ac4.tar.bz2
scummvm-rg350-0cc79979fc27a097037ca580dda78607080d5ac4.zip
SHERLOCK: Fix map display
-rw-r--r--engines/sherlock/map.cpp3
-rw-r--r--engines/sherlock/map.h2
-rw-r--r--engines/sherlock/objects.cpp28
-rw-r--r--engines/sherlock/objects.h7
-rw-r--r--engines/sherlock/people.cpp15
-rw-r--r--engines/sherlock/people.h1
6 files changed, 37 insertions, 19 deletions
diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp
index 4f034d8889..ffbca3fb42 100644
--- a/engines/sherlock/map.cpp
+++ b/engines/sherlock/map.cpp
@@ -293,7 +293,6 @@ void Map::setupSprites() {
p._type = CHARACTER;
p._position = Common::Point(12400, 5000);
p._sequenceNumber = 0;
- p._walkSequences = _walkSequences;
p._images = _shapes;
p._imageFrame = nullptr;
p._frameNumber = 0;
@@ -306,8 +305,8 @@ void Map::setupSprites() {
p._noShapeSize = Common::Point(0, 0);
p._goto = Common::Point(28000, 15000);
p._status = 0;
+ p._walkSequences = _walkSequences;
p.setImageFrame();
-
scene._bgShapes.clear();
}
diff --git a/engines/sherlock/map.h b/engines/sherlock/map.h
index 198b31e7d3..e0c7d038c4 100644
--- a/engines/sherlock/map.h
+++ b/engines/sherlock/map.h
@@ -76,7 +76,7 @@ private:
ImageFile *_mapCursors;
ImageFile *_shapes;
ImageFile *_iconShapes;
- Common::Array<WalkSequence> _walkSequences;
+ WalkSequences _walkSequences;
Point32 _lDrawnPos;
int _point;
bool _placesShown;
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 31a209fea3..73387261c8 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -366,6 +366,34 @@ void Sprite::checkSprite() {
/*----------------------------------------------------------------*/
+void WalkSequence::load(Common::SeekableReadStream &s) {
+ char buffer[9];
+ s.read(buffer, 9);
+ _vgsName = Common::String(buffer);
+ _horizFlip = s.readByte() != 0;
+
+ _sequences.resize(s.readUint16LE());
+ s.read(&_sequences[0], _sequences.size());
+}
+
+/*----------------------------------------------------------------*/
+
+WalkSequences &WalkSequences::operator=(const WalkSequences &src) {
+ resize(src.size());
+ for (uint idx = 0; idx < size(); ++idx) {
+ const WalkSequence &wSrc = src[idx];
+ WalkSequence &wDest = (*this)[idx];
+ wDest._horizFlip = wSrc._horizFlip;
+
+ wDest._sequences.resize(wSrc._sequences.size());
+ Common::copy(&wSrc._sequences[0], &wSrc._sequences[0] + wSrc._sequences.size(), &wDest._sequences[0]);
+ }
+
+ return *this;
+}
+
+/*----------------------------------------------------------------*/
+
void ActionType::load(Common::SeekableReadStream &s) {
char buffer[12];
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 7fe44c0a23..99746c9956 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -117,6 +117,11 @@ struct WalkSequence {
void load(Common::SeekableReadStream &s);
};
+class WalkSequences : public Common::Array < WalkSequence > {
+public:
+ WalkSequences &operator=(const WalkSequences &src);
+};
+
enum { REVERSE_DIRECTION = 0x80 };
#define NAMES_COUNT 4
@@ -157,7 +162,7 @@ public:
Common::String _examine; // Examine in-depth description
Common::String _pickUp; // Message for if you can't pick up object
- Common::Array<WalkSequence> _walkSequences; // Holds animation sequences
+ WalkSequences _walkSequences; // Holds animation sequences
ImageFile *_images; // Sprite images
ImageFrame *_imageFrame; // Pointer to shape in the images
int _walkCount; // Character walk counter
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index bac147f489..6beae4817e 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -68,18 +68,6 @@ const char *const WALK_LIB_NAMES[10] = {
/*----------------------------------------------------------------*/
-void WalkSequence::load(Common::SeekableReadStream &s) {
- char buffer[9];
- s.read(buffer, 9);
- _vgsName = Common::String(buffer);
- _horizFlip = s.readByte() != 0;
-
- _sequences.resize(s.readUint16LE());
- s.read(&_sequences[0], _sequences.size());
-}
-
-/*----------------------------------------------------------------*/
-
Person::Person() : Sprite(), _walkLoaded(false), _npcIndex(0), _npcStack(0), _npcPause(false) {
Common::fill(&_npcPath[0], &_npcPath[MAX_NPC_PATH], 0);
}
@@ -156,7 +144,6 @@ void People::reset() {
p._gotoSeq = p._talkSeq = 0;
p._restoreSlot = 0;
p._startSeq = 0;
- p._walkSequences.clear();
p._altImages = nullptr;
p._altSequences = 0;
p._centerWalk = true;
@@ -164,7 +151,7 @@ void People::reset() {
// Load the default walk sequences
p._oldWalkSequence = -1;
-
+ p._walkSequences.clear();
if (IS_SERRATED_SCALPEL) {
p._walkSequences.resize(MAX_HOLMES_SEQUENCE);
for (int seqIdx = 0; seqIdx < MAX_HOLMES_SEQUENCE; ++seqIdx) {
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 72bdc515b7..272c418a42 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -77,7 +77,6 @@ public:
// Rose Tattoo fields
Common::String _walkVGSName; // Name of walk library person is using
- Common::Array<WalkSequence> _walkSequences;
public:
Person();