void KyraEngine_MR::snd_playVoiceFile(int file) { char filename[16]; snprintf(filename, 16, "%.08u", (uint)file); if (speechEnabled()) _voiceSoundChannel = _soundDigital->playSound(filename, 0xFE, Audio::Mixer::kSpeechSoundType, 255); }
void KyraEngine_MR::openTalkFile(int file) { char talkFilename[16]; if (file == 0) { strcpy(talkFilename, "ANYTALK.TLK"); } else { if (_currentTalkFile > 0) { sprintf(talkFilename, "CH%dTALK.TLK", _currentTalkFile); _res->unloadPakFile(talkFilename); } sprintf(talkFilename, "CH%dTALK.TLK", file); } _currentTalkFile = file; if (!_res->loadPakFile(talkFilename)) { if (speechEnabled()) { warning("Couldn't load voice file '%s', falling back to text only mode", talkFilename); _configVoice = 0; // Sync the config manager with the new settings writeSettings(); } } }
void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration) { uint8 startAnimFrames[] = { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 }; uint16 chatTicks; int16 convoInitialized; int8 chatPartnerNum; if (_currentCharacter->sceneId == 210) return; snd_voiceWaitForFinish(true); convoInitialized = initCharacterChat(charNum); chatPartnerNum = getChatPartnerNum(); if (chatPartnerNum >= 0 && chatPartnerNum < 5) backupChatPartnerAnimFrame(chatPartnerNum); if (charNum < 5) { _characterList[charNum].currentAnimFrame = startAnimFrames[charNum]; _charSayUnk3 = charNum; _talkingCharNum = charNum; _animator->animRefreshNPC(charNum); } char *processedString = _text->preprocessString(chatStr); int lineNum = _text->buildMessageSubstrings(processedString); int16 yPos = _characterList[charNum].y1; yPos -= ((_scaleTable[yPos] * _characterList[charNum].height) >> 8); yPos -= 8; yPos -= lineNum * 10; if (yPos < 11) yPos = 11; if (yPos > 100) yPos = 100; _text->_talkMessageY = yPos; _text->_talkMessageH = lineNum * 10; const bool printText = textEnabled(); if (printText) { _animator->restoreAllObjectBackgrounds(); _screen->copyRegion(12, _text->_talkMessageY, 12, 136, 296, _text->_talkMessageH, 2, 2); _text->printCharacterText(processedString, charNum, _characterList[charNum].x1); } if (chatDuration == -2) chatTicks = strlen(processedString) * 9; else chatTicks = chatDuration; if (!speechEnabled()) vocFile = -1; waitForChatToFinish(vocFile, chatTicks, chatStr, charNum, printText); if (printText) { _animator->restoreAllObjectBackgrounds(); _screen->copyRegion(12, 136, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 2); _animator->preserveAllBackgrounds(); _animator->prepDrawAllObjects(); _screen->copyRegion(12, _text->_talkMessageY, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 0); _animator->flagAllObjectsForRefresh(); _animator->copyChangedObjectsForward(0); } if (chatPartnerNum != -1 && chatPartnerNum < 5) restoreChatPartnerAnimFrame(chatPartnerNum); endCharacterChat(charNum, convoInitialized); }
void KyraEngine_MR::snd_playVoiceFile(int file) { Common::String filename = Common::String::format("%.08u", (uint)file); if (speechEnabled()) _voiceSoundChannel = _soundDigital->playSound(filename.c_str(), 0xFE, Audio::Mixer::kSpeechSoundType, 255); }