From fd6da47906ed8cbb7fa96ea56aaf352bd103f6b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Jun 2015 19:21:48 -0400 Subject: [PATCH] SHERLOCK: Implemented remaining new sequence opcodes in checkObject --- engines/sherlock/objects.cpp | 47 +++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index ce303873dd9..0b3c2943762 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -750,6 +750,7 @@ void Object::toggleHidden() { void Object::checkObject() { Scene &scene = *_vm->_scene; Sound &sound = *_vm->_sound; + Talk &talk = *_vm->_talk; int checkFrame = _allow ? MAX_FRAME : FRAMES_END; bool codeFound; @@ -788,7 +789,10 @@ void Object::checkObject() { ++_frameNumber; } } else if (IS_ROSE_TATTOO && (v == TALK_SEQ_CODE || v == TALK_LISTEN_CODE)) { - error("TODO"); + if (_talkSeq) + setObjTalkSequence(_talkSeq); + else + setObjSequence(0, false); } else if (v >= GOTO_CODE) { // Goto code found v -= GOTO_CODE; @@ -828,11 +832,46 @@ void Object::checkObject() { break; } } else if (IS_ROSE_TATTOO && v == TELEPORT_CODE) { - error("TODO"); + _position.x = READ_LE_UINT16(&_sequences[_frameNumber + 1]); + _position.y = READ_LE_UINT16(&_sequences[_frameNumber + 3]); + + _frameNumber += 5; } else if (IS_ROSE_TATTOO && v == CALL_TALK_CODE) { - error("TODO"); + Common::String filename; + for (int idx = 0; idx < 8; ++idx) { + if (_sequences[_frameNumber + 1 + idx] != 1) + filename += (char)_sequences[_frameNumber + 1 + idx]; + else + break; + } + + _frameNumber += 8; + talk.talkTo(filename); + } else if (IS_ROSE_TATTOO && v == HIDE_CODE) { - error("TODO"); + switch (_sequences[_frameNumber + 2]) { + case 1: + // Hide Object + if (scene._bgShapes[_sequences[_frameNumber + 1] - 1]._type != HIDDEN) + scene._bgShapes[_sequences[_frameNumber + 1] - 1].toggleHidden(); + break; + + case 2: + // Activate Object + if (scene._bgShapes[_sequences[_frameNumber + 1] - 1]._type == HIDDEN) + scene._bgShapes[_sequences[_frameNumber + 1] - 1].toggleHidden(); + break; + + case 3: + // Toggle Object + scene._bgShapes[_sequences[_frameNumber + 1] - 1].toggleHidden(); + break; + + default: + break; + } + _frameNumber += 3; + } else { v -= 128;