[Scummvm-git-logs] scummvm master -> fa1028d1a5edb5c0b8fd02fcd0d0ec1a4ce8c698
neuromancer
noreply at scummvm.org
Mon Jan 5 19:48:13 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
e9d866d2bd PRIVATE: fix #16423 subtitles are restored.
fa1028d1a5 PRIVATE: subtitles are now restored when returning from the caseBook.
Commit: e9d866d2bd778a484fb40ad45db62ab168be760c
https://github.com/scummvm/scummvm/commit/e9d866d2bd778a484fb40ad45db62ab168be760c
Author: dhruv (dhruvranger97 at gmail.com)
Date: 2026-01-05T20:48:08+01:00
Commit Message:
PRIVATE: fix #16423 subtitles are restored.
previously, if we paused the game private key and resume it the subtitles were not restored, same was the case for if we click quit and then cancel in the dialog box, this commit fixes both of these issues which refer to point number 1 in #16423.
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 535bbd02fc9..0eabd148294 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -503,7 +503,11 @@ Common::Error PrivateEngine::run() {
if (_subtitles != nullptr) {
if (_subtitledSound != nullptr && isSoundPlaying(*_subtitledSound)) {
_subtitles->drawSubtitle(_mixer->getElapsedTime(_subtitledSound->handle).msecs(), false, _sfxSubtitles);
- } else {
+ }
+ /* Only destroy subtitles if we are not playing a video.
+ If _videoDecoder is valid (even if paused), we must keep the subtitles
+ in memory so they are available when the video resumes. */
+ else if (_videoDecoder == nullptr) {
destroySubtitles();
}
}
@@ -901,6 +905,9 @@ void PrivateEngine::selectPauseGame(Common::Point mousePos) {
_videoDecoder->pauseVideo(true);
_pausedVideo = _videoDecoder;
}
+ if (_subtitles) {
+ _system->hideOverlay();
+ }
_pausedBackgroundSoundName = _bgSound.name;
@@ -925,6 +932,11 @@ void PrivateEngine::resumeGame() {
_pausedVideo = nullptr;
}
+ if (_subtitles) {
+ _system->showOverlay(false);
+ _system->clearOverlay();
+ }
+
if (_videoDecoder) {
_videoDecoder->pauseVideo(false);
_needToDrawScreenFrame = true;
@@ -934,6 +946,13 @@ void PrivateEngine::resumeGame() {
playBackgroundSound(_pausedBackgroundSoundName);
_pausedBackgroundSoundName.clear();
}
+ // force draw the subtitle once
+ // the screen was likely wiped by the pause menu
+ // to account for the subtitle which was already rendered and we wiped the screen before it finished we must
+ // force the subtitle system to ignore its cache and redraw the text.
+ if (_subtitles && _videoDecoder) {
+ _subtitles->drawSubtitle(_videoDecoder->getTime(), true, _sfxSubtitles);
+ }
}
@@ -2355,6 +2374,14 @@ bool PrivateEngine::isSoundPlaying(Sound &sound) {
void PrivateEngine::waitForSoundsToStop() {
while (isSoundPlaying()) {
+ // since this is a blocking wait loop, the main engine loop in run() is not called until this loop finishes
+ // we must manually update and draw subtitles here otherwise sounds
+ // played via fSyncSound will play audio but show no subtitles.
+ if (_subtitles != nullptr) {
+ if (_subtitledSound != nullptr && isSoundPlaying(*_subtitledSound)) {
+ _subtitles->drawSubtitle(_mixer->getElapsedTime(_subtitledSound->handle).msecs(), false, _sfxSubtitles);
+ }
+ }
if (consumeEvents()) {
stopSounds();
return;
@@ -2897,11 +2924,31 @@ void PrivateEngine::drawScreen() {
_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin.x, _origin.y, sa.w, sa.h);
}
- if (_subtitles && _videoDecoder && !_videoDecoder->isPaused())
+ if (_subtitles && _videoDecoder && !_videoDecoder->isPaused()) {
_subtitles->drawSubtitle(_videoDecoder->getTime(), false, _sfxSubtitles);
+ }
_system->updateScreen();
}
+void PrivateEngine::pauseEngineIntern(bool pause) {
+ Engine::pauseEngineIntern(pause);
+
+ // If we are unpausing (returning from quit dialog, etc.)
+ if (!pause && _subtitles) {
+ // reset the overlay
+ _system->showOverlay(false);
+ _system->clearOverlay();
+
+ // force draw the subtitle once
+ // the screen was likely wiped by the dialog/menu
+ // to account for the subtitle which was already rendered and we wiped the screen before it finished we must
+ // force the subtitle system to ignore its cache and redraw the text.
+ if (_subtitles && _videoDecoder) {
+ _subtitles->drawSubtitle(_videoDecoder->getTime(), true, _sfxSubtitles);
+ }
+ }
+}
+
bool PrivateEngine::getRandomBool(uint p) {
uint r = _rnd->getRandomNumber(100);
return (r <= p);
diff --git a/engines/private/private.h b/engines/private/private.h
index adc95c61988..3881c7e9434 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -257,6 +257,7 @@ public:
void restartGame();
void clearAreas();
void initializePath(const Common::FSNode &gamePath) override;
+ void pauseEngineIntern(bool pause) override;
Common::SeekableReadStream *loadAssets();
Common::Archive *loadMacInstaller();
Commit: fa1028d1a5edb5c0b8fd02fcd0d0ec1a4ce8c698
https://github.com/scummvm/scummvm/commit/fa1028d1a5edb5c0b8fd02fcd0d0ec1a4ce8c698
Author: dhruv (dhruvranger97 at gmail.com)
Date: 2026-01-05T20:48:08+01:00
Commit Message:
PRIVATE: subtitles are now restored when returning from the caseBook.
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0eabd148294..a54d8974761 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -68,6 +68,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
_nextSetting = "";
_currentSetting = "";
_pausedSetting = "";
+ _pausedMovieName = "";
_modified = false;
_mode = -1;
_toTake = false;
@@ -904,6 +905,7 @@ void PrivateEngine::selectPauseGame(Common::Point mousePos) {
if (_videoDecoder) {
_videoDecoder->pauseVideo(true);
_pausedVideo = _videoDecoder;
+ _pausedMovieName = _currentMovie;
}
if (_subtitles) {
_system->hideOverlay();
@@ -930,11 +932,19 @@ void PrivateEngine::resumeGame() {
if (_pausedVideo != nullptr) {
_videoDecoder = _pausedVideo;
_pausedVideo = nullptr;
+
+ // restore the name we saved in selectPauseGame
+ if (!_pausedMovieName.empty()) {
+ _currentMovie = _pausedMovieName;
+ _pausedMovieName.clear();
+ }
}
- if (_subtitles) {
- _system->showOverlay(false);
- _system->clearOverlay();
+ // always reload subtitles if a movie is active
+ // we do this unconditionally because the casebook might have loaded
+ // different subtitles while we were paused
+ if (!_currentMovie.empty()) {
+ loadSubtitles(convertPath(_currentMovie));
}
if (_videoDecoder) {
@@ -950,8 +960,14 @@ void PrivateEngine::resumeGame() {
// the screen was likely wiped by the pause menu
// to account for the subtitle which was already rendered and we wiped the screen before it finished we must
// force the subtitle system to ignore its cache and redraw the text.
- if (_subtitles && _videoDecoder) {
- _subtitles->drawSubtitle(_videoDecoder->getTime(), true, _sfxSubtitles);
+ if (_subtitles) {
+ _system->showOverlay(false);
+ _system->clearOverlay();
+ // calling adjustSubtitleSize() makes the next drawSubtitle call perform a full redraw
+ // automatically, so we don't need to pass 'true'
+ adjustSubtitleSize();
+ if (_videoDecoder)
+ _subtitles->drawSubtitle(_videoDecoder->getTime(), false, _sfxSubtitles);
}
}
@@ -1948,6 +1964,7 @@ void PrivateEngine::restartGame() {
// Pause
_pausedSetting = "";
+ _pausedMovieName.clear();
// VSPicture
_nextVS = "";
@@ -1963,6 +1980,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
// We don't want to continue with any sound or videos from a previous game
stopSounds();
destroyVideo();
+ _pausedMovieName.clear();
debugC(1, kPrivateDebugFunction, "loadGameStream");
@@ -2943,8 +2961,11 @@ void PrivateEngine::pauseEngineIntern(bool pause) {
// the screen was likely wiped by the dialog/menu
// to account for the subtitle which was already rendered and we wiped the screen before it finished we must
// force the subtitle system to ignore its cache and redraw the text.
- if (_subtitles && _videoDecoder) {
- _subtitles->drawSubtitle(_videoDecoder->getTime(), true, _sfxSubtitles);
+ if (_videoDecoder) {
+ // calling adjustSubtitleSize() makes the next drawSubtitle call perform a full redraw
+ // automatically, so we don't need to pass 'true'.
+ adjustSubtitleSize();
+ _subtitles->drawSubtitle(_videoDecoder->getTime(), false, _sfxSubtitles);
}
}
}
diff --git a/engines/private/private.h b/engines/private/private.h
index 3881c7e9434..ff48d62ea88 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -252,6 +252,7 @@ public:
Video::SmackerDecoder *_videoDecoder;
Video::SmackerDecoder *_pausedVideo;
+ Common::String _pausedMovieName;
Common::Error run() override;
void restartGame();
More information about the Scummvm-git-logs
mailing list