diff options
author | Paul Gilbert | 2015-05-24 22:33:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-24 22:33:41 -0400 |
commit | 8331fa886f4fa9031de17652632b3a12e1f84f06 (patch) | |
tree | 56000f76b95b6aef86e9d4e0341bf9d6d9ea5fdd /engines | |
parent | 1f9f01c5714930e96eb7713c74fe826fe85d1457 (diff) | |
download | scummvm-rg350-8331fa886f4fa9031de17652632b3a12e1f84f06.tar.gz scummvm-rg350-8331fa886f4fa9031de17652632b3a12e1f84f06.tar.bz2 scummvm-rg350-8331fa886f4fa9031de17652632b3a12e1f84f06.zip |
SHERLOCK: Fix People data initialization and general start fixes
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/events.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 121 | ||||
-rw-r--r-- | engines/sherlock/people.cpp | 79 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 12 |
5 files changed, 135 insertions, 80 deletions
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index 94ddc9a792..c2015079a8 100644 --- a/engines/sherlock/events.cpp +++ b/engines/sherlock/events.cpp @@ -42,6 +42,8 @@ Events::Events(SherlockEngine *vm) { _pressed = _released = false; _rightPressed = _rightReleased = false; _oldButtons = _oldRightButton = false; + + loadCursors("rmouse.vgs"); } Events::~Events() { diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index f1047628e4..2a0de7f26e 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -116,12 +116,43 @@ struct WalkSequence { void load(Common::SeekableReadStream &s); }; +enum { REVERSE_DIRECTION = 0x80 }; +#define NAMES_COUNT 4 + +struct ActionType { + int _cAnimNum; + int _cAnimSpeed; + Common::String _names[NAMES_COUNT]; + + /** + * Load the data for the action + */ + void load(Common::SeekableReadStream &s); +}; + +struct UseType { + int _cAnimNum; + int _cAnimSpeed; + Common::String _names[NAMES_COUNT]; + int _useFlag; // Which flag USE will set (if any) + Common::String _target; + Common::String _verb; + + UseType(); + + /** + * Load the data for the UseType + */ + void load(Common::SeekableReadStream &s, bool isRoseTattoo); +}; + + class Sprite { private: static SherlockEngine *_vm; public: - Common::String _name; - Common::String _description; + Common::String _name; + Common::String _description; Common::String _examine; // Examine in-depth description Common::String _pickUp; // Message for if you can't pick up object @@ -142,73 +173,69 @@ public: int _status; // Status: open/closed, moved/not moved int8 _misc; // Miscellaneous use int _numFrames; // How many frames the object has - ImageFile *_altImages; - bool _altSequences; + + // Rose Tattoo fields + int _startSeq; // Frame sequence starts at + int _flags; // Flags for the sprite + int _aType; // Tells if this is an object, person, talk, etc. + int _lookFrames; // How many frames to play of a canim before pausing + int _seqCounter; // How many times the sequence has been run + Common::Point _lookPosition; // Where to look when examining object + int _lookFacing; // Direction to face when examining object + int _lookCAnim; + int _seqStack; // Allow gosubs to return to calling frame + int _seqTo; // Allows 1-5, 8-3 type sequences encoded in 2 bytes + uint _descOffset; // Tells where description starts in description text for scene + int _seqCounter2; // Counter of calling frame sequence + uint _seqSize; // Size of sequence + UseType _use[6]; + int _quickDraw; // Flag telling whether to use quick draw routine or not + int _scaleVal; // Tells how to scale the sprite + int _requiredFlags1; // This flag must also be set, or the sprite is hidden + int _gotoSeq; // Used by Talk to tell which sequence to goto when able + int _talkSeq; // Tells which talk sequence currently in use (Talk or Listen) + int _restoreSlot; // Used when talk returns to the previous sequence + ImageFrame *_stopFrames[8]; // Stop/rest frame for each direction + ImageFile *_altImages; // Images used for alternate NPC sequences + bool _altSequences; // Which of the sequences the alt graphics apply to (0: main, 1=NPC seq) + int _centerWalk; // Flag telling the walk code to offset the walk destination + Common::Point _adjust; // Fine tuning adjustment to position when drawn + int _oldWalkSequence; public: Sprite() { clear(); } static void setVm(SherlockEngine *vm) { _vm = vm; } /** - * Reset the data for the sprite - */ + * Reset the data for the sprite + */ void clear(); /** - * Updates the image frame poiner for the sprite - */ + * Updates the image frame poiner for the sprite + */ void setImageFrame(); /** - * This adjusts the sprites position, as well as it's animation sequence: - */ + * This adjusts the sprites position, as well as it's animation sequence: + */ void adjustSprite(); /** - * Checks the sprite's position to see if it's collided with any special objects - */ + * Checks the sprite's position to see if it's collided with any special objects + */ void checkSprite(); /** - * Return frame width - */ + * Return frame width + */ int frameWidth() const { return _imageFrame ? _imageFrame->_frame.w : 0; } - - /** - * Return frame height - */ - int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; } -}; - -enum { REVERSE_DIRECTION = 0x80 }; -#define NAMES_COUNT 4 - -struct ActionType { - int _cAnimNum; - int _cAnimSpeed; - Common::String _names[NAMES_COUNT]; - - /** - * Load the data for the action - */ - void load(Common::SeekableReadStream &s); -}; - -struct UseType { - int _cAnimNum; - int _cAnimSpeed; - Common::String _names[NAMES_COUNT]; - int _useFlag; // Which flag USE will set (if any) - Common::String _target; - Common::String _verb; - - UseType(); /** - * Load the data for the UseType - */ - void load(Common::SeekableReadStream &s, bool isRoseTattoo); + * Return frame height + */ + int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; } }; enum { OBJ_BEHIND = 1, OBJ_FLIPPED = 2, OBJ_FORWARD = 4, TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 }; diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index 7879f29105..c03dde80ad 100644 --- a/engines/sherlock/people.cpp +++ b/engines/sherlock/people.cpp @@ -124,36 +124,55 @@ People::~People() { } void People::reset() { - // Note: The engine has theoretical support for two player characters but only the first one is used. - // Watson is, instead, handled by a different sprite in each scene, with a very simple initial movement, if any - Sprite &p = _data[PLAYER]; - - p._description = "Sherlock Holmes!"; - p._type = CHARACTER; - p._position = Common::Point(10000, 11000); - p._sequenceNumber = STOP_DOWNRIGHT; - p._imageFrame = nullptr; - p._frameNumber = 1; - p._delta = Common::Point(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); - p._goto = Common::Point(0, 0); - p._status = 0; - - // Load the default walk sequences - p._walkSequences.resize(MAX_HOLMES_SEQUENCE); - for (int idx = 0; idx < MAX_HOLMES_SEQUENCE; ++idx) { - p._walkSequences[idx]._sequences.clear(); - - const byte *pSrc = &CHARACTER_SEQUENCES[idx][0]; - do { - p._walkSequences[idx]._sequences.push_back(*pSrc); - } while (*pSrc++); + _data[0]._description = "Sherlock Holmes!"; + + // Note: Serrated Scalpel only uses a single Person slot for Sherlock.. Watson is handled by scene sprites + int count = IS_SERRATED_SCALPEL ? 1 : MAX_PLAYERS; + for (int idx = 0; idx < count; ++idx) { + Sprite &p = _data[idx]; + + p._type = (idx == 0) ? CHARACTER : INVALID; + if (IS_SERRATED_SCALPEL) + p._position = Point32(10000, 11000); + else + p._position = Point32(36000, 29000); + + p._sequenceNumber = STOP_DOWNRIGHT; + p._imageFrame = nullptr; + p._frameNumber = 1; + p._delta = Common::Point(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); + p._goto = Common::Point(0, 0); + p._status = 0; + p._seqTo = 0; + p._seqCounter = p._seqCounter2 = 0; + p._seqStack = 0; + 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.resize(MAX_HOLMES_SEQUENCE); + for (int idx = 0; idx < MAX_HOLMES_SEQUENCE; ++idx) { + p._walkSequences[idx]._sequences.clear(); + + const byte *pSrc = &CHARACTER_SEQUENCES[idx][0]; + do { + p._walkSequences[idx]._sequences.push_back(*pSrc); + } while (*pSrc++); + } } // Reset any walk path in progress when Sherlock leaves scenes diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 2a107b4d5e..6b72188146 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -813,7 +813,6 @@ void ScalpelEngine::startScene() { break; } - _events->loadCursors("rmouse.vgs"); _events->setCursor(ARROW); if (_scene->_goToScene == 99) { diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index 22e77fb869..e3f8c7b8dd 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1577,12 +1577,20 @@ OpcodeReturn Talk::cmdGotoScene(const byte *&str) { } OpcodeReturn Talk::cmdHolmesOff(const byte *&str) { - _vm->_people->_holmesOn = false; + People &people = *_vm->_people; + people._holmesOn = false; + if (IS_ROSE_TATTOO) + people[PLAYER]._type = REMOVE; + return RET_SUCCESS; } OpcodeReturn Talk::cmdHolmesOn(const byte *&str) { - _vm->_people->_holmesOn = true; + People &people = *_vm->_people; + people._holmesOn = true; + if (IS_ROSE_TATTOO) + people[PLAYER]._type = CHARACTER; + return RET_SUCCESS; } |