From 21f98fff46e48e79d3e977d4f20edf90022a825a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 09:46:25 -0400 Subject: TITANIC: Fix cursor and entering text in PET Conversations area --- engines/titanic/input_translator.cpp | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 15 +++++---------- engines/titanic/pet_control/pet_text.cpp | 2 +- engines/titanic/support/screen_manager.cpp | 4 +++- engines/titanic/support/text_cursor.cpp | 6 ++---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 499d0f6293..571b6dfa14 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -100,7 +100,7 @@ void CInputTranslator::keyDown(const Common::KeyState &keyState) { _inputHandler->handleMessage(msg); } - if (keyState.ascii >= 32 && keyState.ascii <= 127) { + if (keyState.ascii <= 127) { CKeyCharMsg msg(keyState.ascii); _inputHandler->handleMessage(msg); } diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d4298dada1..eb2f9716b6 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -465,17 +465,12 @@ bool CPetConversations::handleKey(const Common::KeyState &keyState) { case Common::KEYCODE_KP1: scrollToBottom(); break; - case Common::KEYCODE_BACKSPACE: - // Erase key in text input - _textInput.handleKey((char)Common::KEYCODE_BACKSPACE); - case Common::KEYCODE_RETURN: - case Common::KEYCODE_KP_ENTER: - // Text line finished - textLineEntered(_textInput.getText()); - return true; default: - if (keyState.ascii >= 32 && keyState.ascii) - _textInput.handleKey(keyState.ascii); + if (keyState.ascii > 0 && keyState.ascii) { + if (_textInput.handleKey(keyState.ascii)) + // Text line finished, so process line + textLineEntered(_textInput.getText()); + } return true; } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 1065e6f825..1d2740249f 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -192,7 +192,7 @@ void CPetText::resize(uint count) { CString CPetText::getText() const { CString result = ""; - for (int idx = 0; idx < _lineCount; ++idx) + for (int idx = 0; idx <= _lineCount; ++idx) result += _array[idx]._line; return result; diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 1a43d78dd0..b0e249d7b3 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -116,7 +116,9 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac } void OSScreenManager::drawCursors() { - // Nothing needed here, since ScummVM handles cursor drawing + // The original did both text and mouse cursor drawing here. + // For ScummVM, we only need to worry about the text cursor + _textCursor->draw(); } DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index dc78d5350d..ad3fe4ed26 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -80,10 +80,8 @@ void CTextCursor::draw() { _backRenderSurface->_ddSurface->fillRect(&cursorRect, _cursorR, _cursorG, _cursorB); } - } - - if (_active && _blinkVisible) { - _screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos); + + //_screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos); } } -- cgit v1.2.3