Skip to content

Commit

Permalink
SHERLOCK: Implement changes for checkObject
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 3, 2015
1 parent 2cec902 commit 3dac0c6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
32 changes: 30 additions & 2 deletions engines/sherlock/objects.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand All @@ -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]);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions engines/sherlock/objects.h
Expand Up @@ -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:
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3dac0c6

Please sign in to comment.