MADS: Fix dialog speech timing in Phantom. Some more renaming

This commit is contained in:
Filippos Karapetis 2022-11-14 00:49:20 +02:00
parent aed9bb5f92
commit a4150f1495
2 changed files with 35 additions and 35 deletions

View File

@ -348,11 +348,11 @@ void GameConversations::update(bool flag) {
ConvDialog &dialog = _runningConv->_data._dialogs[_verbId];
if (dialog._speechIndex) {
_runningConv->_cnd._messageList3.clear();
_runningConv->_cnd._messageList3.push_back(dialog._speechIndex);
_runningConv->_cnd._playerSpeechList.clear();
_runningConv->_cnd._playerSpeechList.push_back(dialog._speechIndex);
}
generateText(dialog._textLineIndex, _runningConv->_cnd._messageList3);
generateText(dialog._textLineIndex, _runningConv->_cnd._playerSpeechList);
_currentMode = CONVMODE_NEXT;
if (_heroTrigger) {
@ -369,7 +369,7 @@ void GameConversations::update(bool flag) {
removeActiveWindow();
_personSpeaking = 0;
executeEntry(_verbId);
generateMessage(_runningConv->_cnd._messageList1, _runningConv->_cnd._messageList3);
generateMessage(_runningConv->_cnd._playerMessageList, _runningConv->_cnd._playerSpeechList);
if (_heroTrigger && _popupVisible) {
_vm->_game->_scene._action._activeAction._verbId = _verbId;
@ -387,7 +387,7 @@ void GameConversations::update(bool flag) {
removeActiveWindow();
_personSpeaking = _speakerVal;
generateMessage(_runningConv->_cnd._messageList2, _runningConv->_cnd._messageList4);
generateMessage(_runningConv->_cnd._actorMessageList, _runningConv->_cnd._actorSpeechList);
_currentMode = CONVMODE_NEXT;
@ -454,15 +454,15 @@ void GameConversations::generateMessage(Common::Array<int> &messageList, Common:
}
}
// Show the dialog
_popupVisible = true;
_dialog->show();
// Play the speech if one was provided
if (voiceList.size() > 0) {
_vm->_audio->setSoundGroup(_runningConv->_data._speechFile);
_vm->_audio->playSound(voiceList[0] - 1);
}
// Show the dialog
_popupVisible = true;
_dialog->show();
}
bool GameConversations::nextNode() {
@ -475,10 +475,10 @@ int GameConversations::executeEntry(int index) {
ConvDialog &dlg = _runningConv->_data._dialogs[index];
ConversationVar &var0 = _runningConv->_cnd._vars[0];
_runningConv->_cnd._messageList1.clear();
_runningConv->_cnd._messageList2.clear();
_runningConv->_cnd._messageList3.clear();
_runningConv->_cnd._messageList4.clear();
_runningConv->_cnd._playerMessageList.clear();
_runningConv->_cnd._actorMessageList.clear();
_runningConv->_cnd._playerSpeechList.clear();
_runningConv->_cnd._actorSpeechList.clear();
_nextStartNode->_val = var0._val;
bool flag = true;
@ -563,23 +563,23 @@ void GameConversations::scriptMessage(ScriptEntry &scrEntry) {
int entryVal = scrEntry._entries2[randomIndex]._v2;
if (scrEntry._command == CMD_MESSAGE1) {
_runningConv->_cnd._messageList2.push_back(entryVal);
_runningConv->_cnd._actorMessageList.push_back(entryVal);
if (scrEntry._entries2.size() <= 1) {
for (uint idx = 0; idx < scrEntry._entries.size(); ++idx)
_runningConv->_cnd._messageList4.push_back(scrEntry._entries[idx]);
_runningConv->_cnd._actorSpeechList.push_back(scrEntry._entries[idx]);
}
else if (scrEntry._entries.size() > 0 && randomIndex < (int)scrEntry._entries.size()) {
_runningConv->_cnd._messageList4.push_back(entryVal);
_runningConv->_cnd._actorSpeechList.push_back(entryVal);
}
} else {
_runningConv->_cnd._messageList1.push_back(entryVal);
_runningConv->_cnd._playerMessageList.push_back(entryVal);
if (scrEntry._entries2.size() <= 1) {
for (uint idx = 0; idx < scrEntry._entries.size(); ++idx)
_runningConv->_cnd._messageList3.push_back(scrEntry._entries[idx]);
_runningConv->_cnd._playerSpeechList.push_back(scrEntry._entries[idx]);
} else if (scrEntry._entries.size() > 0 && randomIndex < (int)scrEntry._entries.size()) {
_runningConv->_cnd._messageList3.push_back(entryVal);
_runningConv->_cnd._playerSpeechList.push_back(entryVal);
}
}
}
@ -755,31 +755,31 @@ void ConversationConditionals::load(const Common::String &filename) {
convFile->skip(4);
_messageList1.resize(convFile->readUint16LE());
_messageList2.resize(convFile->readUint16LE());
_messageList3.resize(convFile->readUint16LE());
_messageList4.resize(convFile->readUint16LE());
_playerMessageList.resize(convFile->readUint16LE());
_actorMessageList.resize(convFile->readUint16LE());
_playerSpeechList.resize(convFile->readUint16LE());
_actorSpeechList.resize(convFile->readUint16LE());
convFile->skip(20);
for (uint idx = 0; idx < 10; ++idx) {
int v = convFile->readUint16LE();
if (idx < _messageList1.size())
_messageList1[idx] = v;
if (idx < _playerMessageList.size())
_playerMessageList[idx] = v;
}
for (uint idx = 0; idx < 10; ++idx) {
int v = convFile->readUint16LE();
if (idx < _messageList2.size())
_messageList2[idx] = v;
if (idx < _actorMessageList.size())
_actorMessageList[idx] = v;
}
for (uint idx = 0; idx < 10; ++idx) {
int v = convFile->readUint16LE();
if (idx < _messageList3.size())
_messageList3[idx] = v;
if (idx < _playerSpeechList.size())
_playerSpeechList[idx] = v;
}
for (uint idx = 0; idx < 10; ++idx) {
int v = convFile->readUint16LE();
if (idx < _messageList4.size())
_messageList4[idx] = v;
if (idx < _actorSpeechList.size())
_actorSpeechList[idx] = v;
}
delete convFile;

View File

@ -276,10 +276,10 @@ struct ConversationConditionals {
int _numImports;
int _currentNode;
Common::Array<int> _messageList1;
Common::Array<int> _messageList2;
Common::Array<int> _messageList3;
Common::Array<int> _messageList4;
Common::Array<int> _playerMessageList;
Common::Array<int> _actorMessageList;
Common::Array<int> _playerSpeechList;
Common::Array<int> _actorSpeechList;
/**
* Constructor