diff options
Diffstat (limited to 'engines/titanic/true_talk')
22 files changed, 120 insertions, 144 deletions
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7da2ab6201..b773e8af30 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -44,8 +44,7 @@ static const RoomDialogueId ROOM_DIALOGUE_IDS[] = { BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), - _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0), - _room107First(false) { + _responseFlag(false), _room107First(false) { CTrueTalkManager::setFlags(25, 0); CTrueTalkManager::setFlags(24, 0); CTrueTalkManager::setFlags(40, 0); @@ -72,7 +71,7 @@ void BellbotScript::setupSentences() { for (int idx = 1; idx < 20; ++idx) _sentences[idx].load(CString::format("Sentences/Bellbot/%d", idx)); - _field2DC = 0; + _responseFlag = false; _field68 = 0; _entryCount = 0; } @@ -370,7 +369,7 @@ ScriptChangedResult BellbotScript::scriptChanged(const TTroomScript *roomScript, break; case 157: - _field2DC = 1; + _responseFlag = true; break; case 158: @@ -378,7 +377,7 @@ ScriptChangedResult BellbotScript::scriptChanged(const TTroomScript *roomScript, break; case 3: - if (_field2DC) { + if (_responseFlag) { if (randomResponse0(roomScript, id)) return SCR_2; } else { @@ -386,7 +385,7 @@ ScriptChangedResult BellbotScript::scriptChanged(const TTroomScript *roomScript, applyResponse(); } - _field2DC = 0; + _responseFlag = false; CTrueTalkManager::_v9 = 0; // Deliberate fall-through default: diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 3080b56902..6f57ee718f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -35,10 +35,7 @@ private: TTsentenceEntries _sentences[20]; TTcommonPhraseArray _phrases; int _array[150]; - int _field2D0; - int _field2D4; - int _field2D8; - int _field2DC; + bool _responseFlag; bool _room107First; private: /** diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp index 34eb164779..cbd3685315 100644 --- a/engines/titanic/true_talk/dialogue_file.cpp +++ b/engines/titanic/true_talk/dialogue_file.cpp @@ -60,7 +60,7 @@ DialogueResource *CDialogueFile::addToCache(int index) { // Scan cache for a free slot uint cacheIndex = 0; - while (cacheIndex < _cache.size() && !_cache[cacheIndex]._active) + while (cacheIndex < _cache.size() && _cache[cacheIndex]._active) ++cacheIndex; if (cacheIndex == _cache.size()) return nullptr; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 64e789a4b9..2741e6b640 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -33,9 +33,8 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _resources(g_vm->_exeResources), - _parser(this), _field10(0), _inputCtr(0), - _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), - _concept4P(nullptr), _field30(0) { + _parser(this), _inputCtr(0), _concept1P(nullptr), + _concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr) { g_vm->_scriptHandler = this; g_vm->_script = _script; g_vm->_exeResources.reset(this, val1, val2); @@ -60,19 +59,18 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp if (result == SCR_1) result = npcScript->notifyScript(roomScript, dialogueId); - if (result != SCR_3 && result != SCR_4) - return result; + if (dialogueId == 3 || dialogueId == 4) { + delete _concept1P; + delete _concept2P; + delete _concept3P; + delete _concept4P; + _concept1P = nullptr; + _concept2P = nullptr; + _concept3P = nullptr; + _concept4P = nullptr; + } ++_inputCtr; - delete _concept1P; - delete _concept2P; - delete _concept3P; - delete _concept4P; - _concept1P = nullptr; - _concept2P = nullptr; - _concept3P = nullptr; - _concept4P = nullptr; - return result; } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 193c60f719..01aa2ef1c5 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -39,9 +39,7 @@ class CScriptHandler { private: CTitleEngine *_owner; CExeResources &_resources; - int _field10; int _inputCtr; - int _field30; private: void handleWord1(const TTstring *str); void handleWord2(const TTstring *str); diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 4dd45ba335..079067389d 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -40,8 +40,7 @@ void CTitleEngine::setup(int val1, int val2) { /*------------------------------------------------------------------------*/ -STtitleEngine::STtitleEngine(): CTitleEngine(), - _responseP(nullptr), _field58(0) { +STtitleEngine::STtitleEngine(): CTitleEngine(), _responseP(nullptr) { } STtitleEngine::~STtitleEngine() { @@ -49,7 +48,6 @@ STtitleEngine::~STtitleEngine() { } void STtitleEngine::reset() { - _field58 = 0; _indexes.clear(); } @@ -58,6 +56,7 @@ void STtitleEngine::setup(int val1, int val2) { } int STtitleEngine::setResponse(TTscriptBase *script, TTresponse *response) { + _responseP = response; _indexes.clear(); for (TTresponse *respP = response; respP; respP = respP->getNext()) { _indexes.push_back(respP->getDialogueId()); @@ -66,10 +65,6 @@ int STtitleEngine::setResponse(TTscriptBase *script, TTresponse *response) { return 0; } -void STtitleEngine::dump(int val1, int val2) { - // TODO -} - SimpleFile *STtitleEngine::open(const CString &name) { Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( CString::format("TEXT/%s", name.c_str())); diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index afd2d3b92f..ca7a5dcd14 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -57,12 +57,6 @@ public: * Sets a conversation reponse */ virtual int setResponse(TTscriptBase *script, TTresponse *response) { return SS_4; } - - virtual int proc4(int unused) const = 0; - virtual int proc5(int64 unused) const = 0; - virtual int proc6(int64 unused) const = 0; - virtual int proc7(int64 unused) const = 0; - virtual int proc8() const = 0; /** * Open a designated file @@ -73,8 +67,7 @@ public: class STtitleEngine : public CTitleEngine { private: Common::SeekableReadStream *_stream; - TTresponse *_responseP; - int _field58; + const TTresponse *_responseP; public: Common::Array<uint> _indexes; Common::Array<byte> _data; @@ -94,14 +87,6 @@ public: */ virtual int setResponse(TTscriptBase *script, TTresponse *response); - virtual void dump(int val1, int val2); - - virtual int proc4(int unused) const { return 0; } - virtual int proc5(int64 unused) const { return 0; } - virtual int proc6(int64 unused) const { return 0; } - virtual int proc7(int64 unused) const { return 0; } - virtual int proc8() const { return 0; } - /** * Open a designated file */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 19beee9796..be9ca667de 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -219,10 +219,6 @@ void CTrueTalkManager::removeCompleted() { } } -void CTrueTalkManager::update2() { - //warning("CTrueTalkManager::update2"); -} - void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { TTnpcScript *npcScript = getNpcScript(npc); TTroomScript *roomScript = getRoomScript(); @@ -351,14 +347,14 @@ void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTroomScript *roomScript, if (dialogueStr.empty()) return; - int soundId = readDialogSound(); + uint speechDuration = readDialogueSpeech(); TTtalker *talker = new TTtalker(this, npc); _talkers.push_back(talker); bool isParrot = npc->getName().contains("parrot"); triggerNPC(npc); playSpeech(talker, roomScript, view, isParrot); - talker->speechStarted(dialogueStr, _titleEngine._indexes[0], soundId); + talker->speechStarted(dialogueStr, _titleEngine._indexes[0], speechDuration); } #define STRING_BUFFER_SIZE 2048 @@ -404,30 +400,30 @@ CString CTrueTalkManager::readDialogueString() { return result; } -int CTrueTalkManager::readDialogSound() { - _field18 = 0; +uint CTrueTalkManager::readDialogueSpeech() { + _speechDuration = 0; for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { CWaveFile *waveFile = _gameManager->_sound.getTrueTalkSound( _dialogueFile, _titleEngine._indexes[idx] - _dialogueId); if (waveFile) { - _field18 = waveFile->fn1(); + _speechDuration += waveFile->getDuration(); } } - return _field18; + return _speechDuration; } void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { CTrueTalkSelfQueueAnimSetMsg queueSetMsg; if (queueSetMsg.execute(npc)) { - if (_field18 > 300) { - CTrueTalkQueueUpAnimSetMsg upMsg(_field18); + if (_speechDuration > 300) { + CTrueTalkQueueUpAnimSetMsg upMsg(_speechDuration); upMsg.execute(npc); } } else { CTrueTalkGetAnimSetMsg getAnimMsg; - if (_field18 > 300) { + if (_speechDuration > 300) { do { getAnimMsg.execute(npc); if (!getAnimMsg._endFrame) @@ -439,10 +435,10 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { uint numFrames = getAnimMsg._endFrame - getAnimMsg._startFrame; int64 val = (numFrames * 1000) * 0x88888889; uint diff = (val >> (32 + 5)) - 500; - _field18 += diff; + _speechDuration += diff; getAnimMsg._index++; - } while (_field18 > 0); + } while (_speechDuration > 0); } } } @@ -494,13 +490,13 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV // Setup proximities CProximity p1, p2, p3; if (isParrot) { - p1._channel = 3; - p2._channel = 5; - p3._channel = 4; + p1._channelMode = 3; + p2._channelMode = 5; + p3._channelMode = 4; } else { - p1._channel = 0; - p2._channel = 1; - p3._channel = 2; + p1._channelMode = 0; + p2._channelMode = 1; + p3._channelMode = 2; } if (milli > 0) { @@ -517,7 +513,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV p2._elevation = 0; } - _gameManager->_sound.stopChannel(p1._channel); + _gameManager->_sound.stopChannel(p1._channelMode); if (view) { p1._positioningMode = POSMODE_VECTOR; view->getPosition(p1._posX, p1._posY, p1._posZ); @@ -589,9 +585,9 @@ int CTrueTalkManager::getPassengerClass() const { return gameState ? gameState->_passengerClass : 4; } -int CTrueTalkManager::getState14() const { +Season CTrueTalkManager::getCurrentSeason() const { CGameState *gameState = getGameState(); - return gameState ? gameState->_field14 : 0; + return gameState ? gameState->_seasonNum : SEASON_SUMMER; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 8a8895917a..3abf4c181c 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -31,6 +31,7 @@ #include "titanic/true_talk/tt_quotes_tree.h" #include "titanic/true_talk/tt_scripts.h" #include "titanic/true_talk/tt_talker.h" +#include "titanic/game_state.h" namespace Titanic { @@ -49,7 +50,7 @@ private: int _currentCharId; CDialogueFile *_dialogueFile; int _dialogueId; - int _field18; + uint _speechDuration; TTtalkerList _talkers; private: /** @@ -95,9 +96,10 @@ private: CString readDialogueString(); /** - * Read in the sound from the dialogue file + * Read in the speech from the dialogue file + * @returns Duration of the speech in seconds */ - int readDialogSound(); + uint readDialogueSpeech(); /** * Triggers animation for the NPC @@ -200,8 +202,6 @@ public: */ CGameManager *getGameManager() const; - void update2(); - /** * Start a TrueTalk conversation */ @@ -237,7 +237,7 @@ public: */ int getPassengerClass() const; - int getState14() const; + Season getCurrentSeason() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 61c3b0e00c..74e2f4f66b 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -332,7 +332,7 @@ int TTnpcScript::handleQuote(const TTroomScript *roomScript, const TTsentence *s uint TTnpcScript::getRangeValue(uint id) { TTscriptRange *range = findRange(id); if (!range) - return 0; + return id; switch (range->_mode) { case SF_RANDOM: { @@ -579,14 +579,14 @@ int TTnpcScript::getValue(int testNum) const { case 4: if (g_vm->_trueTalkManager) { - switch (g_vm->_trueTalkManager->getState14()) { - case 1: + switch (g_vm->_trueTalkManager->getCurrentSeason()) { + case SEASON_AUTUMN: CTrueTalkManager::_v6 = 3; break; - case 2: + case SEASON_WINTER: CTrueTalkManager::_v6 = 0; break; - case 3: + case SEASON_SPRING: CTrueTalkManager::_v6 = 1; break; default: @@ -634,13 +634,12 @@ uint TTnpcScript::getDialogueId(uint tagId) { } } - uint oldTagId = tagId; tagId = getRangeValue(tagId); - if (tagId != oldTagId) + if (tagId != origId) tagId = getRangeValue(tagId); - oldTagId = getDialsBitset(); - uint newId = updateState(origId, tagId, oldTagId); + uint dialBits = getDialsBitset(); + uint newId = updateState(origId, tagId, dialBits); if (!newId) return 0; @@ -654,7 +653,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { if (tableP->_id == newId) break; } - uint newVal = tableP->_values[oldTagId]; + uint newVal = tableP->_values[dialBits]; // First slot dialogue Ids idx = 0; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 1d9c199054..95a302d53c 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -575,7 +575,7 @@ int TTparser::loadRequests(TTword *word) { if (_sentenceConcept) { if (_sentenceConcept->get18() == 0 || _sentenceConcept->get18() == 2) { - TTaction *action = static_cast<TTaction *>(word); + TTaction *action = dynamic_cast<TTaction *>(word); _sentenceConcept->set18(action->getVal()); } } @@ -1273,7 +1273,7 @@ int TTparser::considerRequests(TTword *word) { break; } - TTparserNode *nextP = static_cast<TTparserNode *>(nodeP->_nextP); + TTparserNode *nextP = dynamic_cast<TTparserNode *>(nodeP->_nextP); if (flag) delete nodeP; nodeP = nextP; @@ -1375,7 +1375,7 @@ void TTparser::removeConcept(TTconcept *concept) { void TTparser::removeNode(TTparserNode *node) { if (!node->_priorP) // Node is the head of the chain, so reset parser's nodes pointer - _nodesP = static_cast<TTparserNode *>(node->_nextP); + _nodesP = dynamic_cast<TTparserNode *>(node->_nextP); delete node; } @@ -1525,7 +1525,7 @@ int TTparser::fn2(TTword *word) { case 602: case 607: - return checkReferent(static_cast<TTpronoun *>(word)); + return checkReferent(dynamic_cast<TTpronoun *>(word)); case 608: return 1; diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index b8fbca7d39..a49a5a5bd1 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -34,7 +34,7 @@ TTroomScriptBase::TTroomScriptBase(int scriptId, /*------------------------------------------------------------------------*/ TTroomScript::TTroomScript(int scriptId) : - TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { + TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0), _field54(0) { } bool TTroomScript::proc8() const { diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 4109134501..2f58ad1400 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -118,37 +118,41 @@ void TTscriptBase::applyResponse() { } void TTscriptBase::deleteResponses() { - while (_respTailP) { - _respHeadP = _respTailP; - _respTailP = _respHeadP->getLink(); - delete _respHeadP; + while (_respHeadP) { + _respTailP = _respHeadP; + _respHeadP = _respTailP->getLink(); + delete _respTailP; } } -void TTscriptBase::appendResponse(int val1, int *val2, int val3) { - if (!val2 || val1 <= *val2) { - if (_respHeadP) { - _respHeadP = new TTresponse(_respHeadP); +void TTscriptBase::appendResponse(int index, int *maxP, int id) { + if (id && (!maxP || index <= *maxP)) { + if (_respTailP) { + // Prior fragments already exist, so append to end of chain + _respTailP = new TTresponse(_respTailP); } else { - _respHeadP = new TTresponse(val3, 3); - if (_respTailP) - _respTailP->addLink(_respHeadP); + // Currently no tail + _respTailP = new TTresponse(id, 3); + if (_respHeadP) + _respHeadP->addLink(_respTailP); else - _respTailP = _respHeadP; + _respHeadP = _respTailP; } } } -void TTscriptBase::appendResponse(int val1, int *val2, const TTstring &str) { - if (!val2 || val1 <= *val2) { - if (_respHeadP) { - _respHeadP = new TTresponse(str); +void TTscriptBase::appendResponse(int index, int *maxP, const TTstring &str) { + if (!maxP || index <= *maxP) { + if (_respTailP) { + // Prior fragments already exist, so append to end of chain + _respTailP = new TTresponse(str); } else { - _respHeadP = new TTresponse(str); - if (_respTailP) - _respTailP->addLink(_respHeadP); + // Currently no tail + _respTailP = new TTresponse(str); + if (_respHeadP) + _respHeadP->addLink(_respTailP); else - _respTailP = _respHeadP; + _respHeadP = _respTailP; } } } diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index c489dcb0a7..869b0beb64 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -51,8 +51,8 @@ protected: int _state; TThist *_hist2P; int _field3C; - TTresponse *_respHeadP; TTresponse *_respTailP; + TTresponse *_respHeadP; TTresponse *_oldResponseP; int _status; protected: @@ -62,14 +62,21 @@ protected: void deleteResponses(); /** - * Creates and appends a new response to the script + * Creates and appends a new response fragment to the script specified by + * the given conversation Id */ - void appendResponse(int val1, int *val2, int val3); + void appendResponse(int index, int *maxP, int id); - void appendResponse(int val1, int *val2, const TTstring &str); + /** + * Creates and appends a new response fragment string to the script + */ + void appendResponse(int index, int *maxP, const TTstring &str); - void appendResponse2(int val1, int *val2, const TTstring &str) { - appendResponse(val1, val2, str); + /** + * Creates and appends a new response fragment string to the script + */ + void appendResponse2(int index, int *maxP, const TTstring &str) { + appendResponse(index, maxP, str); } /** diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 9588ee021e..3fae527770 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -28,7 +28,7 @@ namespace Titanic { TTsentenceConcept *TTsentenceConcept::addSibling() { - if (this == nullptr || _nextP != nullptr) + if (_nextP != nullptr) // This should never happen return nullptr; @@ -83,7 +83,7 @@ void TTsentence::copyFrom(const TTsentence &src) { if (src._nodesP) { // Source has processed nodes, so duplicate them for (TTsentenceNode *node = src._nodesP; node; - node = static_cast<TTsentenceNode *>(node->_nextP)) { + node = dynamic_cast<TTsentenceNode *>(node->_nextP)) { TTsentenceNode *newNode = new TTsentenceNode(node->_wordP); if (_nodesP) _nodesP->addToTail(newNode); @@ -319,7 +319,7 @@ bool TTsentence::localWord(const char *str) const { bool result = false; for (TTsentenceNode *nodeP = _nodesP; nodeP && !result; - nodeP = static_cast<TTsentenceNode *>(nodeP->_nextP)) { + nodeP = dynamic_cast<TTsentenceNode *>(nodeP->_nextP)) { TTsynonym syn; if (!nodeP->_wordP) continue; diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index 2bb0c5a74b..5a21d73a9b 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -55,7 +55,7 @@ void TTstringNode::initialize(TTstringNode *oldNode) { } TTstringNode *TTstringNode::findByName(const TTstring &str, int mode) { - for (TTstringNode *nodeP = this; nodeP; nodeP = static_cast<TTstringNode *>(nodeP->_nextP)) { + for (TTstringNode *nodeP = this; nodeP; nodeP = dynamic_cast<TTstringNode *>(nodeP->_nextP)) { if (nodeP->_mode == mode || (mode == 3 && nodeP->_mode < 3)) { if (nodeP->_string == str) return nodeP; diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index 0f56c5cb22..b476efefcb 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -60,7 +60,7 @@ TTsynonym *TTsynonym::copyFrom(const TTsynonym *src) { } int TTsynonym::save(SimpleFile *file) { - for (TTstringNode *synP = this; synP; synP = static_cast<TTstringNode *>(synP->_nextP)) { + for (TTstringNode *synP = this; synP; synP = dynamic_cast<TTstringNode *>(synP->_nextP)) { file->writeFormat("%s", " 0 "); synP->_string.save(file); file->writeFormat("%c", ' '); diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index 61443a4835..da7628f483 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -26,10 +26,10 @@ namespace Titanic { -void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { +void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint speechHandle) { _dialogueId = dialogueId; - CTrueTalkNotifySpeechStartedMsg msg(soundId, dialogueId, 0); + CTrueTalkNotifySpeechStartedMsg msg(speechHandle, dialogueId, 0); msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } @@ -40,13 +40,13 @@ TTtalker::~TTtalker() { petControl->convAddLine(_line); // Notify the end of the speech - CTrueTalkNotifySpeechEndedMsg endedMsg(_field24, _dialogueId); + CTrueTalkNotifySpeechEndedMsg endedMsg(_talkEndState, _dialogueId); endedMsg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } void TTtalker::endSpeech(int val) { _done = true; - _field24 = val; + _talkEndState = val; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 636eb0c022..a83bddd952 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -37,19 +37,19 @@ public: CTrueTalkNPC *_npc; CString _line; int _dialogueId; - int _field24; + int _talkEndState; int _done; public: TTtalker() : _owner(nullptr), _npc(nullptr), - _dialogueId(0), _field24(0), _done(0) {} + _dialogueId(0), _talkEndState(0), _done(0) {} TTtalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : - _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _done(0) {} + _owner(owner), _npc(npc), _dialogueId(0), _talkEndState(0), _done(0) {} ~TTtalker(); /** * Start a new speech */ - void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); + void speechStarted(const CString &dialogueStr, uint dialogueId, uint speechHandle); /** * End the speech diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 08d6e9e1a7..062a6b65c0 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -32,8 +32,8 @@ namespace Titanic {
-TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr),
- _fieldC(0), _field10(0), _vocabMode(val) {
+TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr),
+ _word(nullptr), _vocabMode(val) {
load("STVOCAB.TXT");
}
@@ -288,7 +288,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) {
if (word->_wordClass == WC_ACTION) {
- static_cast<TTaction *>(word)->setVal(1);
+ dynamic_cast<TTaction *>(word)->setVal(1);
}
} else {
tempStr = str;
@@ -331,7 +331,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -350,7 +350,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr);
if (word && word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -393,7 +393,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -412,7 +412,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr);
if (word) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index fc7ee2e102..614d1bbf02 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -34,8 +34,6 @@ private: TTword *_headP; TTword *_tailP; TTword *_word; - int _fieldC; - int _field10; int _vocabMode; private: /** diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index df6ee5c7bc..c8676e4b1e 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -173,7 +173,7 @@ bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const if (!_synP) return false; - const TTsynonym *synP = static_cast<const TTsynonym *>(_synP->findByName(str, mode)); + const TTsynonym *synP = dynamic_cast<const TTsynonym *>(_synP->findByName(str, mode)); if (synP) { dest->copyFrom(synP); dest->_priorP = nullptr; |