[Scummvm-git-logs] scummvm master -> ae8c870dea59928e37df83e5259239e2261c6528
mduggan
noreply at scummvm.org
Mon Jun 1 09:40:30 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
ae8c870dea ACCESS: Fix sfx number for comic viewer
Commit: ae8c870dea59928e37df83e5259239e2261c6528
https://github.com/scummvm/scummvm/commit/ae8c870dea59928e37df83e5259239e2261c6528
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2026-06-01T19:39:55+10:00
Commit Message:
ACCESS: Fix sfx number for comic viewer
Don't overwrite active room sfx, only add them to the end.
This fixes a crash if you clicked on something that plays sfx in the initial
comic.
Changed paths:
engines/access/noctropolis/noctropolis_comicviewer.cpp
engines/access/sound.cpp
engines/access/sound.h
diff --git a/engines/access/noctropolis/noctropolis_comicviewer.cpp b/engines/access/noctropolis/noctropolis_comicviewer.cpp
index b47601a5a32..c099bea5a6a 100644
--- a/engines/access/noctropolis/noctropolis_comicviewer.cpp
+++ b/engines/access/noctropolis/noctropolis_comicviewer.cpp
@@ -78,7 +78,7 @@ PageResult ComicViewer::runPage(const ComicPage *page) {
_bubbleSprites = new SpriteResource(_vm, bubbleData);
delete bubbleData;
- bool playedSound = false;
+ int loadedSoundIdx = -1;
while (result == kPageResultNone) {
_vm->_events->pollEvents();
@@ -128,11 +128,12 @@ PageResult ComicViewer::runPage(const ComicPage *page) {
const ComicBlock &hotspot = page->blocks[hotspotIndex];
if (hotspot.soundFileIndex >= 0) {
- _vm->_sound->loadSoundTable(1, hotspot.soundFileIndex, hotspot.soundResIndex);
- _vm->_sound->playSound(1);
- playedSound = true;
+ if (loadedSoundIdx >= 0)
+ _vm->_sound->freeSound(loadedSoundIdx);
+ loadedSoundIdx = _vm->_sound->loadAndAddSound(hotspot.soundFileIndex, hotspot.soundResIndex);
+ _vm->_sound->playSound(loadedSoundIdx);
}
- // TODO: Play hotspot sound
+
for (int bubbleIndex = 0; bubbleIndex < hotspot.numBoxes; bubbleIndex++) {
const ComicBox &bubble = hotspot.boxes[bubbleIndex];
// Slightly lazy, just save/restore whole screen when
@@ -157,9 +158,8 @@ PageResult ComicViewer::runPage(const ComicPage *page) {
}
}
- if (playedSound) {
- _vm->_sound->freeSound(1);
- }
+ if (loadedSoundIdx >= 0)
+ _vm->_sound->freeSound(loadedSoundIdx);
delete _bubbleSprites;
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 0f7f4dc861a..b54bb14c776 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -84,13 +84,14 @@ void SoundManager::loadSoundTable(int idx, int fileNum, int subfile, int priorit
_soundTable[idx] = SoundEntry(soundResource, priority, fileNum, subfile);
}
-void SoundManager::loadAndAddSound(const FileIdent &ident, int priority) {
- loadAndAddSound(ident._fileNum, ident._subFile);
+int SoundManager::loadAndAddSound(const FileIdent &ident, int priority) {
+ return loadAndAddSound(ident._fileNum, ident._subFile);
}
-void SoundManager::loadAndAddSound(int fileNum, int subfile, int priority) {
+int SoundManager::loadAndAddSound(int fileNum, int subfile, int priority) {
Resource *res = _vm->_files->loadFile(fileNum, subfile);
_soundTable.push_back(SoundEntry(res, priority, fileNum, subfile));
+ return _soundTable.size() - 1;
}
bool SoundManager::hasLoadedSound(const FileIdent &ident) const {
@@ -107,7 +108,10 @@ void SoundManager::freeSound(int idx) {
stopSound();
assert(!isSoundQueued(idx));
delete _soundTable[idx]._res;
- _soundTable[idx] = SoundEntry();
+ if (idx == (int)_soundTable.size() - 1)
+ _soundTable.pop_back();
+ else
+ _soundTable[idx] = SoundEntry();
}
void SoundManager::playSound(int soundIndex, bool loop /* = false */) {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 61ab0d74c85..739d5c8a59e 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -79,8 +79,8 @@ public:
void loadSoundTable(int idx, int fileNum, int subfile, int priority = 1);
// load and add a single sound resource to the table
- void loadAndAddSound(int fileNum, int subfile, int priority = 1);
- void loadAndAddSound(const FileIdent &ident, int priority = 1);
+ int loadAndAddSound(int fileNum, int subfile, int priority = 1);
+ int loadAndAddSound(const FileIdent &ident, int priority = 1);
bool hasLoadedSound(const FileIdent &ident) const;
More information about the Scummvm-git-logs
mailing list