From a5398bd663064d3ebca61c3e49eeb7773eadd612 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Wed, 29 Jun 2011 15:22:43 -0400 Subject: [PATCH] LASTEXPRESS: Fix loading of subtitles from sound name --- engines/lastexpress/sound/entry.cpp | 10 +++++----- engines/lastexpress/sound/sound.cpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp index 4bdb9f7f96e..2840d85ca7d 100644 --- a/engines/lastexpress/sound/entry.cpp +++ b/engines/lastexpress/sound/entry.cpp @@ -752,7 +752,7 @@ void SubtitleEntry::load(Common::String filename, SoundEntry *soundEntry) { _sound = soundEntry; // Load subtitle data - if (_engine->getResourceManager()->hasFile(filename)) { + if (_engine->getResourceManager()->hasFile(_filename)) { if (getSoundQueue()->getSubtitleFlag() & 2) return; @@ -786,6 +786,8 @@ void SubtitleEntry::setupAndDraw() { } getSoundQueue()->setCurrentSubtitle(this); + + // TODO Missing code } void SubtitleEntry::draw() { @@ -801,13 +803,11 @@ void SubtitleEntry::draw() { } void SubtitleEntry::drawOnScreen() { - getSoundQueue()->setSubtitleFlag(getSoundQueue()->getSubtitleFlag() & -1); - if (_data == NULL) return; - if (getSoundQueue()->getSubtitleFlag() & 1) - _engine->getGraphicsManager()->draw(_data, GraphicsManager::kBackgroundOverlay); + getSoundQueue()->setSubtitleFlag(getSoundQueue()->getSubtitleFlag() & -2); + _engine->getGraphicsManager()->draw(_data, GraphicsManager::kBackgroundOverlay); } } // End of namespace LastExpress diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp index ff9e7e5aace..c04b6d361ff 100644 --- a/engines/lastexpress/sound/sound.cpp +++ b/engines/lastexpress/sound/sound.cpp @@ -162,7 +162,8 @@ bool SoundManager::playSoundWithSubtitles(Common::String filename, SoundFlag fla entry->setStatus(entry->getStatus().status | kSoundStatus_8000); } else { // Get subtitles name - while (filename.size() > 4) + uint32 size = filename.size(); + while (filename.size() > size - 4) filename.deleteLastChar(); entry->showSubtitle(filename);