Skip to content

Commit

Permalink
SHERLOCK: Fix map display
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed May 26, 2015
1 parent 8751abb commit 361dc4e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 19 deletions.
3 changes: 1 addition & 2 deletions engines/sherlock/map.cpp
Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion engines/sherlock/map.h
Expand Up @@ -76,7 +76,7 @@ class Map {
ImageFile *_mapCursors;
ImageFile *_shapes;
ImageFile *_iconShapes;
Common::Array<WalkSequence> _walkSequences;
WalkSequences _walkSequences;
Point32 _lDrawnPos;
int _point;
bool _placesShown;
Expand Down
28 changes: 28 additions & 0 deletions engines/sherlock/objects.cpp
Expand Up @@ -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];

Expand Down
7 changes: 6 additions & 1 deletion engines/sherlock/objects.h
Expand Up @@ -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

Expand Down Expand Up @@ -157,7 +162,7 @@ class Sprite {
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
Expand Down
15 changes: 1 addition & 14 deletions engines/sherlock/people.cpp
Expand Up @@ -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);
}
Expand Down Expand Up @@ -156,15 +144,14 @@ 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;
p._adjust = Common::Point(0, 0);

// 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) {
Expand Down
1 change: 0 additions & 1 deletion engines/sherlock/people.h
Expand Up @@ -77,7 +77,6 @@ class Person : public Sprite {

// Rose Tattoo fields
Common::String _walkVGSName; // Name of walk library person is using
Common::Array<WalkSequence> _walkSequences;
public:
Person();

Expand Down

0 comments on commit 361dc4e

Please sign in to comment.