diff options
author | Paul Gilbert | 2015-03-31 20:37:59 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-03-31 20:37:59 -0400 |
commit | 54ecf6cda88f6a32b0e12f9fdb2698c540d76bd4 (patch) | |
tree | 2195280038c1be83a11c8208e7aa0234560a90c0 /engines | |
parent | 87521eb504ddb8f05c6b61cfdaf3c757f5adce64 (diff) | |
download | scummvm-rg350-54ecf6cda88f6a32b0e12f9fdb2698c540d76bd4.tar.gz scummvm-rg350-54ecf6cda88f6a32b0e12f9fdb2698c540d76bd4.tar.bz2 scummvm-rg350-54ecf6cda88f6a32b0e12f9fdb2698c540d76bd4.zip |
SHERLOCK: Implemented talk method
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/talk.cpp | 97 |
1 files changed, 96 insertions, 1 deletions
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index a84ce7cd70..e5d6cea64a 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -406,9 +406,104 @@ void Talk::talkTo(const Common::String &filename) { events.setCursor(ARROW); } +/** + * Main method for handling conversations when a character to talk to has been + * selected. It will make Holmes walk to the person to talk to, draws the + * interface window for the conversation and passes on control to give the + * player a list of options to make a selection from + */ void Talk::talk(int objNum) { + Events &events = *_vm->_events; + People &people = *_vm->_people; + Scene &scene = *_vm->_scene; + Screen &screen = *_vm->_screen; + Scripts &scripts = *_vm->_scripts; + UserInterface &ui = *_vm->_ui; + Object &obj = scene._bgShapes[objNum]; - // TODO + ui._windowBounds.top = CONTROLS_Y; + ui._infoFlag = true; + _speaker = 128; + loadTalkFile(scene._bgShapes[objNum]._name); + + // Find the first statement with the correct flags + int select = -1; + for (uint idx = 0; idx < _statements.size(); ++idx) { + if (_statements[idx]._talkMap == 0) { + select = idx; + break; + } + } + if (select == -1) + error("No entry matched all required flags"); + + // See if the statement is a stealth mode reply + Statement &statement = _statements[select]; + if (statement._statement.hasPrefix("^")) { + _sequenceStack.clear(); + + // Start talk in stealth mode + _talkStealth = 2; + + talkTo(obj._name); + } else if (statement._statement.hasPrefix("*")) { + // Character being spoken to will speak first + _sequenceStack.clear(); + scripts.pushSeq(_talkTo); + scripts.setStillSeq(_talkTo); + + events.setCursor(WAIT); + if (obj._lookPosition.y != 0) + // Need to walk to character first + people.walkToCoords(Common::Point(obj._lookPosition.x, obj._lookPosition.y * 100), + obj._lookFacing); + events.setCursor(ARROW); + + if (_talkToAbort) + talkTo(obj._name); + } else { + // Holmes will be speaking first + _sequenceStack.clear(); + scripts.pushSeq(_talkTo); + scripts.setStillSeq(_talkTo); + + _talkToFlag = false; + events.setCursor(WAIT); + if (obj._lookPosition.y != 0) + // Walk over to person to talk to + people.walkToCoords(Common::Point(obj._lookPosition.x, obj._lookPosition.y * 100), + obj._lookFacing); + events.setCursor(ARROW); + + if (!_talkToAbort) { + // See if walking over triggered a conversation + if (_talkToFlag) { + if (_talkToFlag == 1) { + events.setCursor(ARROW); + // _sequenceStack._count = 1; + scripts.pullSeq(); + } + } else { + drawInterface(); + + events._pressed = events._released = false; + _talkIndex = select; + displayTalk(false); + ui._selector = ui._oldSelector = -1; + + if (!ui._windowStyle) { + screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, + SHERLOCK_SCREEN_HEIGHT)); + } else { + ui.summonWindow(); + } + + ui._windowOpen = true; + } + + _talkToFlag = -1; + } + } } /** |