diff options
author | Paul Gilbert | 2016-05-17 17:54:59 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:12:48 -0400 |
commit | 5da19b674d3b9d24517a266e369728f3b5c2957a (patch) | |
tree | 3338ac43d34ea6d6c1236d31846b2d468cee0120 /engines/titanic/true_talk | |
parent | aead3a0083edd7ac5e1f748f422ee25695676a4a (diff) | |
download | scummvm-rg350-5da19b674d3b9d24517a266e369728f3b5c2957a.tar.gz scummvm-rg350-5da19b674d3b9d24517a266e369728f3b5c2957a.tar.bz2 scummvm-rg350-5da19b674d3b9d24517a266e369728f3b5c2957a.zip |
TITANIC: Changed TTinput to TTsentence to match original
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/script_handler.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_hist.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_hist.h | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 52 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.h | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.cpp (renamed from engines/titanic/true_talk/tt_input.cpp) | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.h (renamed from engines/titanic/true_talk/tt_input.h) | 18 |
9 files changed, 59 insertions, 59 deletions
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 0b600f9be0..ab5b97122d 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,7 +21,7 @@ */ #include "titanic/true_talk/script_handler.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/titanic.h" namespace Titanic { @@ -63,15 +63,15 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip if (!roomScript || !line.isValid()) return SS_5; - TTinput *input = new TTinput(_inputCtr++, line, this, roomScript, npcScript); - _parser.preprocess(input); - roomScript->preprocess(input); - npcScript->preprocess(input); + TTsentence *sentence = new TTsentence(_inputCtr++, line, this, roomScript, npcScript); + _parser.preprocess(sentence); + roomScript->preprocess(sentence); + npcScript->preprocess(sentence); warning("TODO: CScriptHandler::processInput"); // TODO - delete input; + delete sentence; return SS_VALID; } diff --git a/engines/titanic/true_talk/tt_hist.cpp b/engines/titanic/true_talk/tt_hist.cpp index 8c9aeb3684..e0f6cb88b6 100644 --- a/engines/titanic/true_talk/tt_hist.cpp +++ b/engines/titanic/true_talk/tt_hist.cpp @@ -21,11 +21,11 @@ */ #include "titanic/true_talk/tt_hist.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" namespace Titanic { -TThist::TThist(TTinput *input) { +TThist::TThist(TTsentence *sentence) { // TODO } diff --git a/engines/titanic/true_talk/tt_hist.h b/engines/titanic/true_talk/tt_hist.h index f910e6eb5a..7ba0032a4d 100644 --- a/engines/titanic/true_talk/tt_hist.h +++ b/engines/titanic/true_talk/tt_hist.h @@ -25,19 +25,19 @@ namespace Titanic { -class TTinput; +class TTsentence; class TThist { protected: int _field0; - TTinput *_input; + TTsentence *_input; public: - TThist(TTinput *input); + TThist(TTsentence *sentence); }; class TTscriptHist : public TThist { public: - TTscriptHist(TTinput *input) : TThist(input) {} + TTscriptHist(TTsentence *sentence) : TThist(sentence) {} }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 66cb57bcd4..a965c70394 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -22,13 +22,13 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/titanic.h" namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), - _input(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { loadArrays(); } @@ -66,34 +66,34 @@ void TTparser::loadArrays() { } -int TTparser::preprocess(TTinput *input) { - _input = input; - if (normalize(input)) +int TTparser::preprocess(TTsentence *sentence) { + _sentence = sentence; + if (normalize(sentence)) return 0; // Scan for and replace common slang and contractions with verbose versions - searchAndReplace(input->_normalizedLine, _replacements1); - searchAndReplace(input->_normalizedLine, _replacements2); + searchAndReplace(sentence->_normalizedLine, _replacements1); + searchAndReplace(sentence->_normalizedLine, _replacements2); // Check entire normalized line against common phrases to replace for (uint idx = 0; idx < _phrases.size(); idx += 2) { - if (!_phrases[idx].compareTo(input->_normalizedLine)) - input->_normalizedLine = _phrases[idx + 1]; + if (!_phrases[idx].compareTo(sentence->_normalizedLine)) + sentence->_normalizedLine = _phrases[idx + 1]; } // Do a further search and replace of roman numerals to decimal - searchAndReplace(input->_normalizedLine, _replacements3); + searchAndReplace(sentence->_normalizedLine, _replacements3); // Replace any roman numerals, spelled out words, etc. with decimal numbers CTrueTalkManager::_v1 = -1000; int idx = 0; do { - idx = replaceNumbers(input->_normalizedLine, idx); + idx = replaceNumbers(sentence->_normalizedLine, idx); } while (idx >= 0); - if (CTrueTalkManager::_v1 == -1000 && !input->_normalizedLine.empty()) { + if (CTrueTalkManager::_v1 == -1000 && !sentence->_normalizedLine.empty()) { // Scan the text for any numeric digits - for (const char *strP = input->_normalizedLine.c_str(); *strP; ++strP) { + for (const char *strP = sentence->_normalizedLine.c_str(); *strP; ++strP) { if (Common::isDigit(*strP)) { // Found digit, so convert it and any following ones CTrueTalkManager::_v1 = atoi(strP); @@ -105,9 +105,9 @@ int TTparser::preprocess(TTinput *input) { return 0; } -int TTparser::normalize(TTinput *input) { +int TTparser::normalize(TTsentence *sentence) { TTstring *destLine = new TTstring(); - const TTstring &srcLine = input->_initialLine; + const TTstring &srcLine = sentence->_initialLine; int srcSize = srcLine.size(); int savedIndex = 0; int counter1 = 0; @@ -124,7 +124,7 @@ int TTparser::normalize(TTinput *input) { (*destLine) += toupper(c); } else if (Common::isDigit(c)) { if (c == '0' && isEmoticon(srcLine, index)) { - input->set38(10); + sentence->set38(10); } else { // Iterate through all the digits of the number (*destLine) += c; @@ -135,7 +135,7 @@ int TTparser::normalize(TTinput *input) { bool flag = false; switch (c) { case '!': - input->set38(3); + sentence->set38(3); break; case '\'': @@ -144,13 +144,13 @@ int TTparser::normalize(TTinput *input) { break; case '.': - input->set38(1); + sentence->set38(1); break; case ':': commandVal = isEmoticon(srcLine, index); if (commandVal) { - input->set38(commandVal); + sentence->set38(commandVal); index += 2; } else { flag = true; @@ -160,10 +160,10 @@ int TTparser::normalize(TTinput *input) { case ';': commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { - input->set38(7); + sentence->set38(7); index += 2; } else if (commandVal != 0) { - input->set38(commandVal); + sentence->set38(commandVal); index += 2; } break; @@ -172,7 +172,7 @@ int TTparser::normalize(TTinput *input) { ++index; commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { - input->set38(12); + sentence->set38(12); } else { --index; flag = true; @@ -183,7 +183,7 @@ int TTparser::normalize(TTinput *input) { ++index; commandVal = isEmoticon(srcLine, index); if (commandVal == 6 || commandVal == 9) { - input->set38(11); + sentence->set38(11); } else { --index; flag = true; @@ -191,7 +191,7 @@ int TTparser::normalize(TTinput *input) { break; case '?': - input->set38(2); + sentence->set38(2); break; default: @@ -207,14 +207,14 @@ int TTparser::normalize(TTinput *input) { } if (counter1 >= 4) - input->set38(4); + sentence->set38(4); // Remove any trailing spaces while (destLine->hasSuffix(" ")) destLine->deleteLastChar(); // Copy out the normalized line - input->_normalizedLine = *destLine; + sentence->_normalizedLine = *destLine; delete destLine; return 0; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 4dbc4d4c48..da63336783 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TT_PARSER_H #define TITANIC_TT_PARSER_H -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_string.h" namespace Titanic { @@ -60,7 +60,7 @@ private: * Normalizes a passed input, taking care of things like removing extra * spaces and lowercasing everything */ - int normalize(TTinput *input); + int normalize(TTsentence *sentence); /** * Submethod called by normalize to handle expanding contacted word pairs @@ -115,7 +115,7 @@ private: public: CScriptHandler *_owner; int _field4; - TTinput *_input; + TTsentence *_sentence; int _fieldC; int _field10; int _field14; @@ -127,7 +127,7 @@ public: * Preprocesses the passed input text, to handle things like lowercasing * all the words, and replcaing common slang with their full equivalents */ - int preprocess(TTinput *input); + int preprocess(TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 092e5bb6ea..16783dec0f 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -73,9 +73,9 @@ void TTscriptBase::reset() { _field48 = 0; } -int TTscriptBase::preprocess(TTinput *input) { +int TTscriptBase::preprocess(TTsentence *sentence) { delete _hist; - _hist = new TTscriptHist(input); + _hist = new TTscriptHist(sentence); return _hist ? SS_VALID : SS_7; } diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index f55d06c799..9bcb33467d 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -32,7 +32,7 @@ enum ScriptChangedResult { SCR_1 = 1, SCR_2 = 2, SCR_3 = 3, SCR_4 = 4, SCR_5 = 5 }; -class TTinput; +class TTsentence; class TTscriptBase { private: @@ -65,7 +65,7 @@ public: /** * Gets passed a newly created input wrapper during conversation text processing */ - int preprocess(TTinput *input); + int preprocess(TTsentence *sentence); virtual void proc2(int v); diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 102f86fc27..e5968bd35a 100644 --- a/engines/titanic/true_talk/tt_input.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -20,19 +20,19 @@ * */ -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/script_handler.h" namespace Titanic { -TTinputSubBase::TTinputSubBase() : _field0(0), _field4(0), _field8(0), +TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0) { } /*------------------------------------------------------------------------*/ -TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, +TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), @@ -40,7 +40,7 @@ TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } -void TTinput::set38(int val) { +void TTsentence::set38(int val) { _field38 = val; } diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_sentence.h index e378e9b3ab..94d7bfc8d9 100644 --- a/engines/titanic/true_talk/tt_input.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -20,8 +20,8 @@ * */ -#ifndef TITANIC_TT_INPUT_H -#define TITANIC_TT_INPUT_H +#ifndef TITANIC_TT_SENTENCE_H +#define TITANIC_TT_SENTENCE_H #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" @@ -31,7 +31,7 @@ namespace Titanic { class CScriptHandler; -class TTinputSubBase { +class TTsentenceSubBase { public: int _field0; int _field4; @@ -44,17 +44,17 @@ public: int _field20; int _field24; public: - TTinputSubBase(); + TTsentenceSubBase(); }; -class TTinputSub : public TTinputSubBase { +class TTsentenceSub : public TTsentenceSubBase { public: }; -class TTinput { +class TTsentence { private: CScriptHandler *_owner; - TTinputSub _sub; + TTsentenceSub _sub; int _field2C; int _inputCtr; int _field34; @@ -69,7 +69,7 @@ public: TTstring _initialLine; TTstring _normalizedLine; public: - TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, + TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); void set38(int v); @@ -77,4 +77,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_TT_INPUT_H */ +#endif /* TITANIC_TT_SENTENCE_H */ |