From 9c66934608cd6f756c170bcb050ee4d6452f0a36 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 12 Jun 2015 22:03:15 +0300 Subject: SHERLOCK: RT: Initial implementation of cmdWalkHolmesToCoords --- engines/sherlock/scalpel/scalpel_talk.cpp | 13 +++++++++++++ engines/sherlock/scalpel/scalpel_talk.h | 1 + engines/sherlock/talk.cpp | 13 ------------- engines/sherlock/talk.h | 1 - engines/sherlock/tattoo/tattoo_talk.cpp | 22 ++++++++++++++++++++-- engines/sherlock/tattoo/tattoo_talk.h | 1 + 6 files changed, 35 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 3dc99c236b..17b251fe47 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -452,6 +452,19 @@ OpcodeReturn ScalpelTalk::cmdRemovePortrait(const byte *&str) { return RET_SUCCESS; } +OpcodeReturn ScalpelTalk::cmdWalkToCoords(const byte *&str) { + People &people = *_vm->_people; + ++str; + + people.walkToCoords(Point32(((str[0] - 1) * 256 + str[1] - 1) * FIXED_INT_MULTIPLIER, + str[2] * FIXED_INT_MULTIPLIER), str[3] - 1); + if (_talkToAbort) + return RET_EXIT; + + str += 3; + return RET_SUCCESS; +} + OpcodeReturn ScalpelTalk::cmdSfxCommand(const byte *&str) { Sound &sound = *_vm->_sound; Common::String tempString; diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index a3ac0f2845..5794813457 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -51,6 +51,7 @@ private: OpcodeReturn cmdSfxCommand(const byte *&str); OpcodeReturn cmdSummonWindow(const byte *&str); OpcodeReturn cmdCarriageReturn(const byte *&str); + OpcodeReturn cmdWalkToCoords(const byte *&str); protected: /** * Display the talk interface window diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index 17e7333055..bfb5a40ade 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1455,19 +1455,6 @@ OpcodeReturn Talk::cmdWalkToCAnimation(const byte *&str) { return _talkToAbort ? RET_EXIT : RET_SUCCESS; } -OpcodeReturn Talk::cmdWalkToCoords(const byte *&str) { - People &people = *_vm->_people; - ++str; - - people.walkToCoords(Point32(((str[0] - 1) * 256 + str[1] - 1) * FIXED_INT_MULTIPLIER, - str[2] * FIXED_INT_MULTIPLIER), str[3] - 1); - if (_talkToAbort) - return RET_EXIT; - - str += 3; - return RET_SUCCESS; -} - void Talk::talkWait(const byte *&str) { if (!_pauseFlag && _charCount < 160) _charCount = 160; diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index bbe3e86a48..e47f2d9df4 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -252,7 +252,6 @@ protected: OpcodeReturn cmdStealthModeDeactivate(const byte *&str); OpcodeReturn cmdToggleObject(const byte *&str); OpcodeReturn cmdWalkToCAnimation(const byte *&str); - OpcodeReturn cmdWalkToCoords(const byte *&str); protected: /** * Display the talk interface window diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index a46ab405f9..ea1f16db48 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -43,7 +43,7 @@ const byte TATTOO_OPCODES[] = { 0, // OP_REMOVE_PORTRAIT 0, // OP_CLEAR_WINDOW 176, // OP_ADJUST_OBJ_SEQUENCE - 177, // OP_WALK_TO_COORDS + 177, // OP_WALK_HOlMES_TO_COORDS 178, // OP_PAUSE_WITHOUT_CONTROL 179, // OP_BANISH_WINDOW 0, // OP_SUMMON_WINDOW @@ -124,7 +124,7 @@ TattooTalk::TattooTalk(SherlockEngine *vm) : Talk(vm) { (OpcodeMethod)&TattooTalk::cmdMouseOnOff, (OpcodeMethod)&TattooTalk::cmdSetWalkControl, (OpcodeMethod)&TattooTalk::cmdAdjustObjectSequence, - (OpcodeMethod)&TattooTalk::cmdWalkToCoords, + (OpcodeMethod)&TattooTalk::cmdWalkHolmesToCoords, (OpcodeMethod)&TattooTalk::cmdPauseWithoutControl, (OpcodeMethod)&TattooTalk::cmdBanishWindow, (OpcodeMethod)&TattooTalk::cmdSetTalkSequence, @@ -234,6 +234,24 @@ OpcodeReturn TattooTalk::cmdMouseOnOff(const byte *&str) { return RET_SUCCESS; } +OpcodeReturn TattooTalk::cmdWalkHolmesToCoords(const byte *&str) { + People &people = *_vm->_people; + ++str; + + int x = (str[0] - 1) * 256 + str[1] - 1; + if (x > 16384) + x = -1 * (x - 16384); + // TODO: The RT walkToCoords call has an extra parameter, person, which is 0 (Holmes) here + warning("TODO: cmdWalkHolmesToCoords - call RT walkToCoords variant"); + people.walkToCoords(Point32(x * FIXED_INT_MULTIPLIER, + ((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), DIRECTION_CONVERSION[str[4] - 1]); + if (_talkToAbort) + return RET_EXIT; + + str += 4; + return RET_SUCCESS; +} + OpcodeReturn TattooTalk::cmdGotoScene(const byte *&str) { Map &map = *_vm->_map; People &people = *_vm->_people; diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h index ab032a7434..d7464c3979 100644 --- a/engines/sherlock/tattoo/tattoo_talk.h +++ b/engines/sherlock/tattoo/tattoo_talk.h @@ -40,6 +40,7 @@ private: OpcodeReturn cmdSwitchSpeaker(const byte *&str); OpcodeReturn cmdMouseOnOff(const byte *&str); OpcodeReturn cmdGotoScene(const byte *&str); + OpcodeReturn cmdWalkHolmesToCoords(const byte *&str); OpcodeReturn cmdNextSong(const byte *&str); OpcodeReturn cmdPassword(const byte *&str); OpcodeReturn cmdPlaySong(const byte *&str); -- cgit v1.2.3