From 3dac0c66462fa50e577d29e504d99fdb0a796866 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 3 Jun 2015 18:42:32 -0400 Subject: [PATCH] SHERLOCK: Implement changes for checkObject --- engines/sherlock/objects.cpp | 32 ++++++++++++++++++++++++++++++-- engines/sherlock/objects.h | 18 ++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index 4527c4e92ab6..124e7c5c1cbb 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -648,9 +648,18 @@ void Object::checkObject() { codeFound = true; int v = _sequences[_frameNumber]; - if (v >= 228) { + // Check for a Talk or Listen Sequence + if (IS_ROSE_TATTOO && v == ALLOW_TALK_CODE) { + if (_gotoSeq) { + setObjTalkSequence(_gotoSeq); + } else { + ++_frameNumber; + } + } else if (IS_ROSE_TATTOO && (v == TALK_SEQ_CODE || v == TALK_LISTEN_CODE)) { + error("TODO"); + } else if (v >= GOTO_CODE) { // Goto code found - v -= 228; + v -= GOTO_CODE; _seqCounter2 = _seqCounter; _seqStack = _frameNumber + 1; setObjSequence(v, false); @@ -686,6 +695,12 @@ void Object::checkObject() { default: break; } + } else if (IS_ROSE_TATTOO && v == TELEPORT_CODE) { + error("TODO"); + } else if (IS_ROSE_TATTOO && v == CALL_TALK_CODE) { + error("TODO"); + } else if (IS_ROSE_TATTOO && v == HIDE_CODE) { + error("TODO"); } else { v -= 128; @@ -708,6 +723,14 @@ void Object::checkObject() { // Will be incremented below to return back to original value --_frameNumber; v = 0; + + } else if (IS_ROSE_TATTOO && v == 10) { + // Set delta for objects + _delta = Common::Point(READ_LE_UINT16(&_sequences[_frameNumber + 1]), + READ_LE_UINT16(&_sequences[_frameNumber + 3])); + _noShapeSize = Common::Point(0, 0); + _frameNumber += 4; + } else if (v == 10) { // Set delta for objects Common::Point pt(_sequences[_frameNumber + 1], _sequences[_frameNumber + 2]); @@ -723,6 +746,7 @@ void Object::checkObject() { _delta = pt; _frameNumber += 2; + } else if (v < USE_COUNT) { for (int idx = 0; idx < NAMES_COUNT; ++idx) { checkNameForCodes(_use[v]._names[idx], nullptr); @@ -863,6 +887,10 @@ void Object::setObjSequence(int seq, bool wait) { } } +void Object::setObjTalkSequence(int seq) { + error("TODO: setObjTalkSequence"); +} + int Object::checkNameForCodes(const Common::String &name, const char *const messages[]) { Map &map = *_vm->_map; People &people = *_vm->_people; diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index e7b26d12c1c9..936adc57d0e9 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -82,6 +82,15 @@ enum { #define SEQ_TO_CODE 67 #define FLIP_CODE (64 + 128) #define SOUND_CODE (34 + 128) +#define HIDE_CODE (7+128) // Code for hiding/unhiding an object from a Sequence +#define CALL_TALK_CODE (8+128) // Code for call a Talk File from a Sequence +#define TELEPORT_CODE (9+128) // Code for setting Teleport Data (X,Y) +#define MOVE_CODE (10+128) // Code for setting Movement Delta (X,Y) + +#define GOTO_CODE 228 +#define TALK_SEQ_CODE 252 // Code specifying start of talk sequence frames in a Sequence +#define TALK_LISTEN_CODE 251 // Code specifying start of talk listen frames in a Sequence +#define ALLOW_TALK_CODE 250 class Point32 { public: @@ -268,6 +277,15 @@ class Object { * It then sets the frame number of the start of that sequence */ void setObjSequence(int seq, bool wait); + + /** + * Adjusts the frame and sequence variables of a sprite that corresponds to the current speaker + * so that it points to the beginning of the sequence number's talk sequence in the object's + * sequence buffer + * @param seq Which sequence to use (if there's more than 1) + * @remarks 1: First talk seq, 2: second talk seq, etc. + */ + void setObjTalkSequence(int seq); public: static bool _countCAnimFrames;