From db1ed6db3e44720a7efcfe62b77e166bb8809e1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Nov 2016 18:57:10 -0400 Subject: TITANIC: Correct naming usage for PET Text ending character index --- engines/titanic/pet_control/pet_conversations.cpp | 6 +++--- engines/titanic/pet_control/pet_text.cpp | 4 ++-- engines/titanic/pet_control/pet_text.h | 10 +++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'engines/titanic/pet_control') diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 57076fece5..9b7e08aaaf 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -116,9 +116,9 @@ void CPetConversations::draw(CScreenManager *screenManager) { _textInput.draw(screenManager); if (_logChanged) { - int startIndex = _log.getLinesStart(); - if (startIndex >= 0) { - int npcNum = _log.getNPCNum(1, startIndex); + int endIndex = _log.displayEndIndex(); + if (endIndex >= 0) { + int npcNum = _log.getNPCNum(1, endIndex); if (npcNum > 0 && npcNum < 10) _npcNum = npcNum - 1; } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 97bb0be02d..3ad14d0d5e 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -26,7 +26,7 @@ namespace Titanic { CPetText::CPetText(uint count) : _stringsMerged(false), _maxCharsPerLine(-1), _lineCount(0), - _linesStart(-1), _unused1(0), _unused2(0), _unused3(0), + _displayEndCharIndex(-1), _unused1(0), _unused2(0), _unused3(0), _backR(0xff), _backG(0xff), _backB(0xff), _textR(0), _textG(0), _textB(200), _fontNumber(0), _npcFlag(0), _npcId(0), _hasBorder(true), @@ -173,7 +173,7 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect.grow(-2); int oldFontNumber = screenManager->setFontNumber(_fontNumber); - _linesStart = screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor); + _displayEndCharIndex = screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor); screenManager->setFontNumber(oldFontNumber); } diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index a48ab91117..671ab4b916 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -43,7 +43,7 @@ private: Rect _bounds; int _maxCharsPerLine; int _lineCount; - int _linesStart; + int _displayEndCharIndex; int _unused1; int _unused2; int _unused3; @@ -176,9 +176,10 @@ public: void setNPC(int npcFlag, int npcId); /** - * Get the index into _lines where on-screen text starts + * Returns the character index into _lines of the last + * character to be displayed on-screen */ - int getLinesStart() const { return _linesStart; } + int displayEndIndex() const { return _displayEndCharIndex; } /** * Scroll the text up @@ -246,6 +247,9 @@ public: /** * Get an NPC Number embedded within on-screen text. * Used by the PET log to encode which NPC spoke + * @param ident Npc Type. Always passed as 1 + * @param startIndex Starting index to scan backwards + * through the log text to find an NPC ident sequence */ int getNPCNum(uint ident, uint startIndex); -- cgit v1.2.3