From 6fa57389a2711a83103ebde63779743f7ac2b96d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 08:06:04 -0400 Subject: TITANIC: Finished PET Conversations input line processing --- engines/titanic/messages/messages.h | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 8 +++++++- engines/titanic/pet_control/pet_text.cpp | 4 ++++ engines/titanic/pet_control/pet_text.h | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 3af65c29da..4c8ccaf43a 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -345,7 +345,7 @@ MESSAGE0(CSubTurnOnMsg); MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CSummonBotQueryMsg, CString, npcName, ""); MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL"); -MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); +MESSAGE2(CTextInputMsg, CString, input, "", CString, response, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); MESSAGE0(CTransitMsg); diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d7fe68ef88..ae5bbd6e24 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -256,7 +256,13 @@ void CPetConversations::textLineEntered(const CString &textLine) { return; if (_petControl->_activeNPC) { - warning("TODO: textLineEntered"); + _log.addLine("- " + textLine, getColor(0)); + + CTextInputMsg inputMsg(textLine, ""); + inputMsg.execute(_petControl->_activeNPC); + + if (!inputMsg._response.empty()) + _log.addLine(inputMsg._response); } else { _log.addLine("There is no one here to talk to", getColor(1)); } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a092255d7c..349e419513 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -320,6 +320,10 @@ int CPetText::getPageHeight(CScreenManager *screenManager) { } } +void CPetText::addLine(const CString &str) { + addLine(str, _textR, _textG, _textB); +} + void CPetText::addLine(const CString &str, uint color) { addLine(str, color & 0xff, (color >> 8) & 0xff, (color >> 16) & 0xff); diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 00eab10146..a3d136a2d4 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -204,6 +204,11 @@ public: */ void scrollToBottom(CScreenManager *screenManager); + /** + * Add a line to the text + */ + void addLine(const CString &str); + /** * Add a line to the text */ -- cgit v1.2.3