[Scummvm-git-logs] scummvm master -> 1d8a725e13a00ceb8b2d26b831bf3ecf2fc7618d
neuromancer
noreply at scummvm.org
Sun Nov 22 11:40:45 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:
1d8a725e13 HOLLYWOOD: RUNAWAY: reviewed and fixed all the background music playback
Commit: 1d8a725e13a00ceb8b2d26b831bf3ecf2fc7618d
https://github.com/scummvm/scummvm/commit/1d8a725e13a00ceb8b2d26b831bf3ecf2fc7618d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-22T12:35:51+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: reviewed and fixed all the background music playback
Changed paths:
engines/hollywood/runaway/audio.cpp
engines/hollywood/runaway/audio.h
engines/hollywood/runaway/finale.cpp
engines/hollywood/runaway/hospital.cpp
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene2020.cpp
engines/hollywood/runaway/scene4060.cpp
engines/hollywood/runaway/scene4060.h
engines/hollywood/runaway/scene4090.cpp
engines/hollywood/runaway/scene4090.h
engines/hollywood/runaway/scene4100.cpp
engines/hollywood/runaway/scene4140.cpp
engines/hollywood/runaway/scene5020.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5060.cpp
engines/hollywood/runaway/scene5160.cpp
engines/hollywood/runaway/scene5160.h
engines/hollywood/runaway/scene5170.cpp
engines/hollywood/runaway/scene5170.h
engines/hollywood/runaway/scene6080.cpp
engines/hollywood/runaway/scene6200.cpp
engines/hollywood/runaway/scene6210.cpp
engines/hollywood/runaway/scene6220.cpp
engines/hollywood/runaway/scene6226.cpp
engines/hollywood/runaway/scene6250.cpp
engines/hollywood/runaway/scene6260.cpp
engines/hollywood/runaway/scene6280.cpp
engines/hollywood/runaway/scene6290.cpp
engines/hollywood/runaway/scene6300.cpp
engines/hollywood/runaway/scene6350.cpp
engines/hollywood/runaway/scene6370.cpp
engines/hollywood/runaway/scene8220.cpp
engines/hollywood/runaway/scene8380.cpp
diff --git a/engines/hollywood/runaway/audio.cpp b/engines/hollywood/runaway/audio.cpp
index dcd6b339819..8e290aec95a 100644
--- a/engines/hollywood/runaway/audio.cpp
+++ b/engines/hollywood/runaway/audio.cpp
@@ -23,6 +23,7 @@
#include "audio/decoders/raw.h"
#include "common/debug.h"
#include "common/file.h"
+#include "common/random.h"
#include "common/substream.h"
#include "hollywood/debug.h"
@@ -92,6 +93,7 @@ uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool
}
void RunawayAudio::playIntroMusic(uint16 cue) {
+ stopMusic();
// The Pendulo logo uses RESOURCE.002 cue 2 on native channel 7, which
// has the same 16 kHz stereo PCM format as the room music channels.
// Cue 4 accompanies the retail narrator's montage.
@@ -100,12 +102,36 @@ void RunawayAudio::playIntroMusic(uint16 cue) {
}
uint32 RunawayAudio::playMusic(uint16 cue, bool loop) {
+ _musicCue = cue;
+ _musicLooping = loop;
+ _nextMusic = 0;
// Retail/cabin PCM is 16 kHz; the old museum demo uses 22.05 kHz music.
const Common::String archive = Common::String::format("RESOURCE.M%02u", _museum ? 4 : _chapter);
return play(archive.c_str(), cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
Audio::Mixer::kMusicSoundType, _music, 96, loop, _museum ? 22050 : 16000);
}
+void RunawayAudio::updateBackgroundMusic(uint32 now, Common::RandomSource &random, byte firstCue, byte cueCount, byte volume, int repeatDelay) {
+ assert(cueCount);
+ if (musicPlaying()) {
+ _nextMusic = 0;
+ return;
+ }
+ if (!_nextMusic) {
+ // The original leaves these pauses between background tracks.
+ static const uint delays[] = {0, 60000, 30000, 15000};
+ _nextMusic = now + (repeatDelay < 0 ? delays[random.getRandomNumber(ARRAYSIZE(delays) - 1)] : (uint)repeatDelay);
+ }
+ if ((int32)(now - _nextMusic) >= 0) {
+ byte cue;
+ do {
+ cue = firstCue + random.getRandomNumber(cueCount - 1);
+ } while (cueCount > 1 && cue == _musicCue);
+ playMusic(cue, false);
+ setMusicVolume(volume);
+ }
+}
+
void RunawayAudio::setMusicVolume(byte volume) {
_music.setVolume(volume);
}
@@ -186,6 +212,9 @@ void RunawayAudio::playFootstep(byte surface, byte variant, byte volume, int x)
void RunawayAudio::stopMusic() {
_music.stop();
+ _musicCue = 0;
+ _musicLooping = false;
+ _nextMusic = 0;
}
void RunawayAudio::playPointer() {
@@ -212,6 +241,7 @@ void RunawayAudio::playMenuMusic() {
playMusic(11);
return;
}
+ stopMusic();
// Options volume preview and credits use shared music cue 1, channel 7.
play("RESOURCE.002", 1, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
Audio::Mixer::kMusicSoundType, _music, 255, true, 16000);
diff --git a/engines/hollywood/runaway/audio.h b/engines/hollywood/runaway/audio.h
index 76c5deab9f1..67ec50bfdd6 100644
--- a/engines/hollywood/runaway/audio.h
+++ b/engines/hollywood/runaway/audio.h
@@ -24,6 +24,10 @@
#include "hollywood/sound.h"
+namespace Common {
+class RandomSource;
+}
+
namespace Hollywood {
class RunawayAudio {
@@ -34,6 +38,9 @@ public:
void setChapter(byte chapter);
void playIntroMusic(uint16 cue = 2);
uint32 playMusic(uint16 cue, bool loop = true);
+ void updateBackgroundMusic(uint32 now, Common::RandomSource &random, byte firstCue, byte cueCount, byte volume = 96, int repeatDelay = -1);
+ uint16 musicCue() const { return _musicCue; }
+ bool musicLooping() const { return _musicLooping && musicPlaying(); }
void playMusicEffect(uint16 cue, byte volume = Audio::Mixer::kMaxChannelVolume, byte channel = 0, bool loop = false);
void setMusicVolume(byte volume);
void setEffectVolume(byte channel, byte volume);
@@ -63,6 +70,9 @@ private:
byte _chapter = 3;
Audio::Mixer *_mixer;
SoundChannel _music, _speech, _effects[3], _footsteps[14], _pointer;
+ uint16 _musicCue = 0;
+ bool _musicLooping = false;
+ uint32 _nextMusic = 0;
int _listenerX = 512;
};
diff --git a/engines/hollywood/runaway/finale.cpp b/engines/hollywood/runaway/finale.cpp
index 715f629b391..bea30fa78be 100644
--- a/engines/hollywood/runaway/finale.cpp
+++ b/engines/hollywood/runaway/finale.cpp
@@ -29,9 +29,8 @@ void RunawayRoomScene::resumeFinaleOutdoorAudio(bool entering, uint16 windCue, b
if (!_audio.effectPlaying(2)) {
_audio.playEffect(windCue, windVolume, 2, true);
}
- if (entering || !_audio.musicPlaying()) {
- _musicCue = 12 + _random.getRandomNumber(4);
- _audio.playMusic(_musicCue, false);
+ if (entering || !_audio.musicPlaying() || _audio.musicLooping()) {
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
}
}
@@ -101,21 +100,10 @@ void RunawayRoomScene::resumeFinaleJailAudio(bool entering) {
_audio.playMusic(18, false);
}
_audio.setMusicVolume(191);
- _nextMusic = 0;
}
void RunawayRoomScene::updateFinaleJailAudio() {
- if (!_audio.musicPlaying()) {
- if (!_nextMusic) {
- static const uint delays[] = {0, 60000, 30000, 15000};
- _nextMusic = _now + delays[_random.getRandomNumber(ARRAYSIZE(delays) - 1)];
- }
- if ((int32)(_now - _nextMusic) >= 0) {
- _audio.playMusic(18, false);
- _audio.setMusicVolume(191);
- _nextMusic = 0;
- }
- }
+ _audio.updateBackgroundMusic(_now, _random, 18, 1, 191);
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/hospital.cpp b/engines/hollywood/runaway/hospital.cpp
index 12d4e363ea3..80ba3c8f891 100644
--- a/engines/hollywood/runaway/hospital.cpp
+++ b/engines/hollywood/runaway/hospital.cpp
@@ -91,21 +91,7 @@ void RunawayRoomScene::leaveHospitalRoom(uint16 scene, Common::Point position, b
}
void RunawayRoomScene::updateHospitalAudio() {
- if (!_audio.musicPlaying()) {
- if (!_nextMusic) {
- static const uint16 delays[] = {0, 240, 120, 60};
- _nextMusic = _now + delays[_random.getRandomNumber(3)] * 250;
- }
- if ((int32)(_now - _nextMusic) >= 0) {
- byte cue;
- do {
- cue = 12 + _random.getRandomNumber(3);
- } while (cue == _musicCue);
- _musicCue = cue;
- _audio.playMusic(cue, false);
- _nextMusic = 0;
- }
- }
+ _audio.updateBackgroundMusic(_now, _random, 12, 4);
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 29935ffc763..a9d11e14347 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -133,16 +133,62 @@ void RunawayRoomScene::resume() {
}
void RunawayRoomScene::resumeAmbientAudio(bool entering) {
+ // Close-ups and conversations retain the surrounding scene's music.
+ const bool keepMusic = _room == 4140 || _room == 5130 || _room == 5140 || _room == 6270 || _room == 6390;
+ if (keepMusic) {
+ return;
+ }
+ if (!_audio.musicPlaying() || (entering && _audio.musicLooping())) {
+ const uint16 cue = museumChapter() ? 13 : desertChapter() ? 12 :
+ townChapter() ? 12 + _random.getRandomNumber(4) : 11;
+ _audio.playMusic(cue, _game != kRunawayFullGame);
+ }
+}
+
+void RunawayRoomScene::updateAmbientMusic() {
if (museumChapter()) {
- if (entering || !_audio.musicPlaying()) {
- _audio.playMusic(12, false);
+ if (_room == 4100) {
+ if (!_audio.musicPlaying()) {
+ _audio.playMusic(11);
+ }
+ } else if (_room != 4090 && _room != 4140) {
+ _audio.updateBackgroundMusic(_now, _random, 14, 3);
}
} else if (desertChapter()) {
- if (!_audio.musicPlaying()) {
- _audio.playMusic(12);
+ if (_room == 5160 || _room == 5170) {
+ if (!_audio.musicPlaying()) {
+ _audio.playMusic(16);
+ _audio.setMusicVolume(_room == 5170 ? 179 : 255);
+ }
+ } else if (_room != 5060 && _room != 5130 && _room != 5140) {
+ _audio.updateBackgroundMusic(_now, _random, 13, 2);
+ }
+ } else if (townChapter()) {
+ switch (_room) {
+ case 6200:
+ case 6210:
+ _audio.updateBackgroundMusic(_now, _random, 18, 1, 191);
+ break;
+ case 6250:
+ _audio.updateBackgroundMusic(_now, _random, 22, 1);
+ break;
+ case 6290:
+ _audio.updateBackgroundMusic(_now, _random, _town.joshuaGone ? 12 : 19, _town.joshuaGone ? 5 : 1);
+ break;
+ case 6300:
+ if (_town.kevinAway) {
+ updateOutdoorMusic(5);
+ }
+ break;
+ case 6270:
+ case 6280:
+ case 6370:
+ case 6390:
+ break;
+ default:
+ updateOutdoorMusic(5);
+ break;
}
- } else if (!_audio.musicPlaying()) {
- _audio.playMusic(11, !hospitalChapter());
}
}
@@ -621,6 +667,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
}
if (speaking() && _speech.finished(now))
skipSpeech();
+ updateAmbientMusic();
if (townChapter() || hopiChapter() || finaleChapter()) {
updateGameplay(elapsed);
if (_sequence.active() || _transition.scene)
@@ -680,23 +727,7 @@ void RunawayRoomScene::findGameplayWalkPath(Common::Point target) {
}
void RunawayRoomScene::updateOutdoorMusic(byte cueCount) {
- if (_audio.musicPlaying()) {
- _nextMusic = 0;
- return;
- }
- if (!_nextMusic) {
- static const uint16 pauses[] = {0, 240, 120, 60};
- _nextMusic = _now + pauses[_random.getRandomNumber(3)] * 250;
- }
- if ((int32)(_now - _nextMusic) >= 0) {
- byte cue;
- do {
- cue = 12 + _random.getRandomNumber(cueCount - 1);
- } while (cue == _musicCue);
- _musicCue = cue;
- _audio.playMusic(cue, false);
- _nextMusic = 0;
- }
+ _audio.updateBackgroundMusic(_now, _random, 12, cueCount);
}
void RunawayRoomScene::deferAction(uint16 action) {
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index b8f905088f5..9074a18c88d 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -278,6 +278,7 @@ protected:
void updateFinaleOutdoorAudio(byte wildlifeVolume = 0);
void resumeFinaleJailAudio(bool entering);
void updateFinaleJailAudio();
+ void updateAmbientMusic();
void updateOutdoorMusic(byte cueCount = 3);
void updateGameplay(uint32 delta);
void findGameplayWalkPath(Common::Point target);
@@ -344,8 +345,6 @@ protected:
byte _conversation = 0, _dialogueDepth = 0, _dialogueNode = 0, _dialogueIntro = 0;
bool _dialogueEnding = false;
uint16 _afterConversation = 0;
- byte _musicCue = 11;
- uint32 _nextMusic = 0;
uint32 _finaleAmbientTick = 0;
byte _finaleLastAmbient = 0;
bool _entering = false;
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
index 016411b34f0..dac03f5699b 100644
--- a/engines/hollywood/runaway/scene2020.cpp
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -492,6 +492,8 @@ RunawayRoomScene::ActionResult Scene2020::dispatchCustomSceneAction(uint16 actio
say(34);
return kHandled;
}
+ _audio.playMusic(33, false);
+ _audio.setMusicVolume(255);
beginRoomAnimation(action, 19, 35);
_actionFrames.push_back(33);
for (int frame = 32; frame >= 0; --frame) {
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
index 193119ad67a..a24a203c182 100644
--- a/engines/hollywood/runaway/scene4060.cpp
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -163,6 +163,14 @@ bool Scene4060::loadCustomResources() {
return _willyAnimation.load(_archive, 8, 22);
}
+void Scene4060::resumeAmbientAudio(bool entering) {
+ if (entering && (_entryScene == 4062 || _entryScene == 4065)) {
+ _audio.playMusic(13, false);
+ } else {
+ RunawayRoomScene::resumeAmbientAudio(entering);
+ }
+}
+
bool Scene4060::applyCustomBackgroundPatches() {
// The red indicator stays off once Willy has refilled the machine.
return !_museum.coffeeMachine || applyPatch(5);
@@ -612,7 +620,7 @@ void Scene4060::finishCustomFilm() {
case kCliveFilm:
_entryScene = 4060;
changeFloor(true, Common::Point(607, 323));
- _audio.playMusic(12, false);
+ _audio.playMusic(13, false);
break;
case kPhoneFilm:
_museum.phoneUsed = 1;
diff --git a/engines/hollywood/runaway/scene4060.h b/engines/hollywood/runaway/scene4060.h
index 06f5db159db..2c1d27b217f 100644
--- a/engines/hollywood/runaway/scene4060.h
+++ b/engines/hollywood/runaway/scene4060.h
@@ -37,6 +37,7 @@ private:
bool loadCustomResources() override;
bool applyCustomBackgroundPatches() override;
void applyCustomHotspotState() override;
+ void resumeAmbientAudio(bool entering) override;
void runCustomEntrySequence() override;
void advanceCustomGameplayLoop(uint32 delta) override;
void updateActor(uint elapsed, int scrollDirection, bool inventoryOpen) override;
diff --git a/engines/hollywood/runaway/scene4090.cpp b/engines/hollywood/runaway/scene4090.cpp
index 4b13457ecef..a0f5bf30a58 100644
--- a/engines/hollywood/runaway/scene4090.cpp
+++ b/engines/hollywood/runaway/scene4090.cpp
@@ -86,6 +86,12 @@ bool Scene4090::applyCustomBackgroundPatches() {
return !museumChapter() || !_museum.coffeeBeansTaken || applyPatch(4);
}
+void Scene4090::resumeAmbientAudio(bool entering) {
+ if (entering || !_audio.musicPlaying()) {
+ _audio.playMusic(12);
+ }
+}
+
void Scene4090::runCustomEntrySequence() {
if (!_museum.exhibitionVisited) {
_museum.exhibitionVisited = 1;
diff --git a/engines/hollywood/runaway/scene4090.h b/engines/hollywood/runaway/scene4090.h
index b3a6408da10..ce32ec3bbc6 100644
--- a/engines/hollywood/runaway/scene4090.h
+++ b/engines/hollywood/runaway/scene4090.h
@@ -34,6 +34,7 @@ public:
private:
bool applyCustomBackgroundPatches() override;
+ void resumeAmbientAudio(bool entering) override;
void runCustomEntrySequence() override;
ActionResult dispatchCustomSceneAction(uint16 action) override;
float actorHeight() const override;
diff --git a/engines/hollywood/runaway/scene4100.cpp b/engines/hollywood/runaway/scene4100.cpp
index 71264d45d81..65452e01fac 100644
--- a/engines/hollywood/runaway/scene4100.cpp
+++ b/engines/hollywood/runaway/scene4100.cpp
@@ -167,7 +167,7 @@ void Scene4100::runCustomEntrySequence() {
void Scene4100::resumeAmbientAudio(bool entering) {
if (entering || !_audio.musicPlaying()) {
- _audio.playMusic(11, false);
+ _audio.playMusic(11);
}
}
@@ -257,6 +257,8 @@ RunawayRoomScene::ActionResult Scene4100::dispatchCustomSceneAction(uint16 actio
if (!_museum.chamberOpen) {
say(9);
} else {
+ _audio.playMusic(23, false);
+ _audio.setMusicVolume(255);
say(9, 1);
_museum.maskTaken = 1;
_inventory.add(11);
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
index c0a5484449f..8134b9ff246 100644
--- a/engines/hollywood/runaway/scene4140.cpp
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -59,7 +59,6 @@ void Scene4140::click(Common::Point mouse, RunawayVerb verb, byte item) {
} else if (id == 12) { // Confirm the security code.
if (_keyCount == 4 && _museum.keypad >= 3 && _museum.keypadDigits == 8137) {
_keyResult = 2;
- _museum.keypad = 4;
_audio.playEffect(31);
say(3, 3);
deferMuseumAction(414);
@@ -148,6 +147,13 @@ bool Scene4140::drawCustomComposite(Graphics::ManagedSurface &viewport) {
void Scene4140::finishCustomAnimation(uint16 action) {
if (action == 414) {
+ if (_keyResult == 2 && _museum.keypad != 4) {
+ _museum.keypad = 4;
+ if (museumChapter()) {
+ _audio.playMusic(23, false);
+ _audio.setMusicVolume(255);
+ }
+ }
leaveMuseumRoom(4063, Common::Point(1153, 297), 7);
}
}
diff --git a/engines/hollywood/runaway/scene5020.cpp b/engines/hollywood/runaway/scene5020.cpp
index d9f82c86b84..083c41a20f2 100644
--- a/engines/hollywood/runaway/scene5020.cpp
+++ b/engines/hollywood/runaway/scene5020.cpp
@@ -150,6 +150,9 @@ RunawayRoomScene::ActionResult Scene5020::dispatchCustomSceneAction(uint16 actio
}
void Scene5020::runCustomEntrySequence() {
+ if (_entryScene == 5021) {
+ _audio.playMusic(12, false);
+ }
if (_entryScene == 5021 && !_desert.escapedCabin) {
_desert.escapedCabin = 1;
say(0);
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index 43ea6ad1ac9..e465f20e130 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -165,8 +165,9 @@ void Scene5030::start(uint32 now) {
}
void Scene5030::resume() {
- if (!_audio.musicPlaying())
- _audio.playMusic(11);
+ if (_entering || !_audio.musicPlaying()) {
+ _audio.playMusic(11, _game != kRunawayFullGame);
+ }
if (_entering) {
_entering = false;
if (_entryScene == 5031) {
@@ -820,6 +821,10 @@ void Scene5030::startAction(Action action) {
frames = 43;
break;
case kOpenHatch:
+ if (_game == kRunawayFullGame) {
+ _audio.playMusic(20, false);
+ _audio.setMusicVolume(255);
+ }
chunk = 36;
frames = 47;
applyPatch(24);
@@ -1093,6 +1098,9 @@ void Scene5030::update(uint32 now, int scrollDirection, bool inventoryOpen) {
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
const uint32 pausedTime = now - _lastUpdate;
_lastUpdate = now;
+ if (_game == kRunawayFullGame) {
+ _audio.updateBackgroundMusic(now, _random, 17, 3, 96, 30000);
+ }
if (_speechRow && !_audio.speechPlaying() && _speech.finished(now))
skipSpeech();
if (inventoryOpen && !inventoryPresentation()) {
diff --git a/engines/hollywood/runaway/scene5060.cpp b/engines/hollywood/runaway/scene5060.cpp
index eb1208e0285..4f049dda7d6 100644
--- a/engines/hollywood/runaway/scene5060.cpp
+++ b/engines/hollywood/runaway/scene5060.cpp
@@ -150,6 +150,7 @@ RunawayRoomScene::ActionResult Scene5060::dispatchCustomSceneAction(uint16 actio
deferDesertAction(491);
break;
case 491: // Move to the rescue briefing.
+ _audio.stopMusic();
leaveDesertRoom(5130);
break;
case 302: // Go to the desert overview.
@@ -431,9 +432,10 @@ Common::U32String Scene5060::hotspotName(byte id) const {
}
void Scene5060::resumeAmbientAudio(bool entering) {
- if (!_audio.musicPlaying()) {
+ if (entering || !_audio.musicPlaying()) {
_audio.playMusic(21);
}
+ _audio.setMusicVolume(255);
}
bool Scene5060::lulaDancing() const {
diff --git a/engines/hollywood/runaway/scene5160.cpp b/engines/hollywood/runaway/scene5160.cpp
index 43279c3081b..63f897d8612 100644
--- a/engines/hollywood/runaway/scene5160.cpp
+++ b/engines/hollywood/runaway/scene5160.cpp
@@ -87,6 +87,13 @@ bool Scene5160::loadCustomResources() {
_refrigeratorAnimation.load(_archive, 12, 1);
}
+void Scene5160::resumeAmbientAudio(bool entering) {
+ if (_audio.musicCue() != 16 || !_audio.musicPlaying()) {
+ _audio.playMusic(16);
+ }
+ _audio.setMusicVolume(255);
+}
+
bool Scene5160::applyCustomBackgroundPatches() {
return (_desert.needle != 2 || applyPatch(8)) && (!_desert.glassesTaken || applyPatch(9)) &&
(_desert.lipstickShelf >= 2 || applyPatch(10)) &&
diff --git a/engines/hollywood/runaway/scene5160.h b/engines/hollywood/runaway/scene5160.h
index ca7c40cd922..5247ec94f59 100644
--- a/engines/hollywood/runaway/scene5160.h
+++ b/engines/hollywood/runaway/scene5160.h
@@ -35,6 +35,7 @@ private:
bool loadCustomResources() override;
bool applyCustomBackgroundPatches() override;
void applyCustomHotspotState() override;
+ void resumeAmbientAudio(bool entering) override;
float actorHeight() const override;
void setupActorDepth(RunawayActor::RenderParams ¶ms) const override;
ActionResult dispatchCustomSceneAction(uint16 action) override;
diff --git a/engines/hollywood/runaway/scene5170.cpp b/engines/hollywood/runaway/scene5170.cpp
index 1f77ce63892..3404f81241b 100644
--- a/engines/hollywood/runaway/scene5170.cpp
+++ b/engines/hollywood/runaway/scene5170.cpp
@@ -94,6 +94,13 @@ bool Scene5170::loadCustomResources() {
_ambientAnimations[3].load(_archive, 11, 3);
}
+void Scene5170::resumeAmbientAudio(bool entering) {
+ if (_audio.musicCue() != 16 || !_audio.musicPlaying()) {
+ _audio.playMusic(16, false);
+ }
+ _audio.setMusicVolume(179);
+}
+
bool Scene5170::applyCustomBackgroundPatches() {
_doorFrame = doorClosed() ? 0 : 24;
return (_desert.vacuum != 2 || applyPatch(7)) && (!_desert.glassesTaken || applyPatch(8)) &&
diff --git a/engines/hollywood/runaway/scene5170.h b/engines/hollywood/runaway/scene5170.h
index 8f924f982f4..3395c46cec1 100644
--- a/engines/hollywood/runaway/scene5170.h
+++ b/engines/hollywood/runaway/scene5170.h
@@ -36,6 +36,7 @@ private:
bool loadCustomResources() override;
bool applyCustomBackgroundPatches() override;
void applyCustomHotspotState() override;
+ void resumeAmbientAudio(bool entering) override;
void advanceCustomGameplayLoop(uint32 delta) override;
void handleAnimationFrameHook() override;
float actorHeight() const override;
diff --git a/engines/hollywood/runaway/scene6080.cpp b/engines/hollywood/runaway/scene6080.cpp
index 02bcc84d7c9..776e477ad7d 100644
--- a/engines/hollywood/runaway/scene6080.cpp
+++ b/engines/hollywood/runaway/scene6080.cpp
@@ -103,6 +103,8 @@ void Scene6080::runCustomEntrySequence() {
_walkPath.reset(_position);
_facing = 7;
_mineOscarPresent = true;
+ _audio.playMusic(39, false);
+ _audio.setMusicVolume(255);
say(20, 0, false, 1);
say(20, 1);
say(20, 2, false, 1);
diff --git a/engines/hollywood/runaway/scene6200.cpp b/engines/hollywood/runaway/scene6200.cpp
index 6dada46cf25..6d3cd1157dd 100644
--- a/engines/hollywood/runaway/scene6200.cpp
+++ b/engines/hollywood/runaway/scene6200.cpp
@@ -96,7 +96,7 @@ void Scene6200::applyCustomHotspotState() {
void Scene6200::resumeAmbientAudio(bool entering) {
const bool restart = entering && _entryScene == 6200;
if (restart || !_audio.musicPlaying()) {
- _audio.playMusic(18);
+ _audio.playMusic(18, false);
_audio.setMusicVolume(191);
} else if (entering) {
_audio.setMusicVolume(191);
diff --git a/engines/hollywood/runaway/scene6210.cpp b/engines/hollywood/runaway/scene6210.cpp
index 79ef927b9d0..65c880f0483 100644
--- a/engines/hollywood/runaway/scene6210.cpp
+++ b/engines/hollywood/runaway/scene6210.cpp
@@ -66,7 +66,7 @@ const char *Scene6210::actionCaptionVariant(byte id, bool look, byte item) const
void Scene6210::resumeAmbientAudio(bool entering) {
if (!_audio.musicPlaying()) {
- _audio.playMusic(18);
+ _audio.playMusic(18, false);
_audio.setMusicVolume(191);
} else if (entering) {
_audio.setMusicVolume(191);
diff --git a/engines/hollywood/runaway/scene6220.cpp b/engines/hollywood/runaway/scene6220.cpp
index c249742d840..5807b05f799 100644
--- a/engines/hollywood/runaway/scene6220.cpp
+++ b/engines/hollywood/runaway/scene6220.cpp
@@ -93,7 +93,9 @@ void Scene6220::applyCustomHotspotState() {
void Scene6220::resumeAmbientAudio(bool entering) {
if (entering && _entryScene == 6223) {
- _audio.playMusic(12 + _random.getRandomNumber(4));
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
+ } else if (entering && _entryScene == 6220 && _town.streetVisited && !_random.getRandomNumber(5)) {
+ _audio.playMusic(20, false);
} else {
RunawayRoomScene::resumeAmbientAudio(entering);
}
diff --git a/engines/hollywood/runaway/scene6226.cpp b/engines/hollywood/runaway/scene6226.cpp
index e7f32588071..857a3b7fb6e 100644
--- a/engines/hollywood/runaway/scene6226.cpp
+++ b/engines/hollywood/runaway/scene6226.cpp
@@ -78,6 +78,8 @@ void Scene6226::applyCustomHotspotState() {
void Scene6226::resumeAmbientAudio(bool entering) {
if (!_town.kevinAway && (entering || !_audio.musicPlaying())) {
_audio.playMusic(12 + _random.getRandomNumber(4), false);
+ } else {
+ RunawayRoomScene::resumeAmbientAudio(entering);
}
}
diff --git a/engines/hollywood/runaway/scene6250.cpp b/engines/hollywood/runaway/scene6250.cpp
index 354e1aedd26..7e321c6acc8 100644
--- a/engines/hollywood/runaway/scene6250.cpp
+++ b/engines/hollywood/runaway/scene6250.cpp
@@ -65,7 +65,9 @@ bool Scene6250::loadCustomResources() {
}
void Scene6250::resumeAmbientAudio(bool entering) {
- _audio.playMusic(21);
+ if (_audio.musicCue() != 21 || !_audio.musicPlaying()) {
+ _audio.playMusic(21);
+ }
}
void Scene6250::runCustomEntrySequence() {
diff --git a/engines/hollywood/runaway/scene6260.cpp b/engines/hollywood/runaway/scene6260.cpp
index 3cb1eca15e5..3901ca44e05 100644
--- a/engines/hollywood/runaway/scene6260.cpp
+++ b/engines/hollywood/runaway/scene6260.cpp
@@ -96,6 +96,8 @@ void Scene6260::runCustomEntrySequence() {
beginRoomAnimation(401, 5, 88, nullptr, 0, true, 60);
} else if (_entryScene == 6262) {
// The steam shot is seen outside before returning to the cab.
+ _audio.playMusic(39, false);
+ _audio.setMusicVolume(255);
beginRoomAnimation(402, 9, 45, nullptr, 0, true, 60);
_actionFrames.insert_at(0, 0);
} else {
diff --git a/engines/hollywood/runaway/scene6280.cpp b/engines/hollywood/runaway/scene6280.cpp
index 89471a4f22d..7d2d9752b29 100644
--- a/engines/hollywood/runaway/scene6280.cpp
+++ b/engines/hollywood/runaway/scene6280.cpp
@@ -77,7 +77,9 @@ void Scene6280::applyCustomHotspotState() {
}
void Scene6280::resumeAmbientAudio(bool entering) {
- _audio.playMusic(30);
+ if (_audio.musicCue() != 30 || !_audio.musicPlaying()) {
+ _audio.playMusic(30);
+ }
_audio.playMusicEffect(38, 128, 1, true);
}
diff --git a/engines/hollywood/runaway/scene6290.cpp b/engines/hollywood/runaway/scene6290.cpp
index 05bd6674a1f..a3d53dde648 100644
--- a/engines/hollywood/runaway/scene6290.cpp
+++ b/engines/hollywood/runaway/scene6290.cpp
@@ -120,8 +120,12 @@ void Scene6290::resumeAmbientAudio(bool entering) {
if (_town.machinePowered && !_town.joshuaGone) {
_audio.playEffectAt(78, kMotorcycleSoundPosition, 178, 1, true);
}
- if (entering || !_audio.musicPlaying()) {
- _audio.playMusic(_town.joshuaGone ? 30 : 19);
+ if (entering && _entryScene == 6290) {
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
+ } else if (_town.joshuaGone) {
+ RunawayRoomScene::resumeAmbientAudio(entering);
+ } else if (entering || !_audio.musicPlaying()) {
+ _audio.playMusic(19, false);
}
}
@@ -498,7 +502,7 @@ RunawayRoomScene::ActionResult Scene6290::dispatchCustomSceneAction(uint16 actio
_town.wrenchDelivered = 2;
}
_town.campLeft = 1;
- _audio.playMusic(12 + _random.getRandomNumber(4));
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
leaveTownRoom(6350);
break;
case 309: // Examine the motorcycle before or after the repair.
diff --git a/engines/hollywood/runaway/scene6300.cpp b/engines/hollywood/runaway/scene6300.cpp
index 53b8bc33e2b..1fb838f07e5 100644
--- a/engines/hollywood/runaway/scene6300.cpp
+++ b/engines/hollywood/runaway/scene6300.cpp
@@ -170,9 +170,11 @@ void Scene6300::prepareCustomGameplayLoop() {
void Scene6300::resumeAmbientAudio(bool entering) {
if (!_town.kevinAway) {
- _audio.playMusic(24);
- } else if (!_audio.musicPlaying()) {
- _audio.playMusic(12 + _random.getRandomNumber(4), false);
+ if (_audio.musicCue() != 24 || !_audio.musicPlaying()) {
+ _audio.playMusic(24);
+ }
+ } else {
+ RunawayRoomScene::resumeAmbientAudio(entering);
}
}
diff --git a/engines/hollywood/runaway/scene6350.cpp b/engines/hollywood/runaway/scene6350.cpp
index 1d0656f7ea1..a21086b6846 100644
--- a/engines/hollywood/runaway/scene6350.cpp
+++ b/engines/hollywood/runaway/scene6350.cpp
@@ -86,7 +86,7 @@ void Scene6350::finishCustomFilm() {
if (!rebuildBackground()) {
error("Cannot update Runaway chapter 4 map");
}
- _audio.playMusic(11);
+ _audio.playMusic(11, false);
say(0);
leaveTownRoom(6220);
}
diff --git a/engines/hollywood/runaway/scene6370.cpp b/engines/hollywood/runaway/scene6370.cpp
index 74418807e49..37ce0b568c7 100644
--- a/engines/hollywood/runaway/scene6370.cpp
+++ b/engines/hollywood/runaway/scene6370.cpp
@@ -107,7 +107,7 @@ RunawayRoomScene::ActionResult Scene6370::dispatchCustomSceneAction(uint16 actio
break;
case 403: // Finish the conversation and return to the street.
_town.sushiMet = 1;
- _audio.playMusic(20);
+ _audio.playMusic(20, false);
_sushiPose = 79;
_sushiTick = _now;
walkTo(Common::Point(1443, 648), 1, true);
diff --git a/engines/hollywood/runaway/scene8220.cpp b/engines/hollywood/runaway/scene8220.cpp
index 22fb248b3a1..027f3eb47ab 100644
--- a/engines/hollywood/runaway/scene8220.cpp
+++ b/engines/hollywood/runaway/scene8220.cpp
@@ -100,12 +100,10 @@ void Scene8220::prepareCustomGameplayLoop() {
void Scene8220::resumeAmbientAudio(bool entering) {
resumeFinaleOutdoorAudio(false, 36, 51);
if (entering && _entryScene == 8220 && (!_finale.streetVisited || !_random.getRandomNumber(5))) {
- _musicCue = 20;
- _audio.playMusic(_musicCue, false);
+ _audio.playMusic(20, false);
_finale.streetVisited = 1;
} else if (entering && _entryScene == 8223) {
- _musicCue = 12 + _random.getRandomNumber(4);
- _audio.playMusic(_musicCue, false);
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
}
_audio.setMusicVolume(255);
}
@@ -140,8 +138,7 @@ void Scene8220::runCustomEntrySequence() {
updateMaps();
_arrivalPhase = kWaitingForCar;
_roomAction = 420;
- _musicCue = 38;
- _audio.playMusic(_musicCue, false);
+ _audio.playMusic(38, false);
_audio.setMusicVolume(255);
_audio.playEffect(67, 178);
return;
@@ -320,9 +317,8 @@ void Scene8220::leaveStreet(uint16 destination, bool advanceResearch) {
if (advanceResearch && _finale.bankResearch == 1) {
_finale.bankResearch = 2;
}
- if (destination == 8350 && _musicCue == 20) {
- _musicCue = 12 + _random.getRandomNumber(4);
- _audio.playMusic(_musicCue, false);
+ if (destination == 8350 && _audio.musicCue() == 20) {
+ _audio.playMusic(12 + _random.getRandomNumber(4), false);
_audio.setMusicVolume(255);
}
leaveRoom(destination);
diff --git a/engines/hollywood/runaway/scene8380.cpp b/engines/hollywood/runaway/scene8380.cpp
index dfea0ebd2a7..5dc701c4c34 100644
--- a/engines/hollywood/runaway/scene8380.cpp
+++ b/engines/hollywood/runaway/scene8380.cpp
@@ -289,6 +289,9 @@ void Scene8380::advanceSushi() {
}
void Scene8380::advanceCustomGameplayLoop(uint32 delta) {
+ if (!_audio.musicPlaying()) {
+ resumeAmbientAudio(false);
+ }
while (_now - _sushiTick >= 80) {
_sushiTick += 80;
advanceSushi();
@@ -377,6 +380,10 @@ void Scene8380::deliverItem(uint16 action) {
}
void Scene8380::receiveRecordings() {
+ if (_finale.recordings >= 3) {
+ _audio.playMusic(38, false);
+ _audio.setMusicVolume(255);
+ }
exchange(83, 0, 0);
if (_finale.recordings < 3) {
exchange(83, 1, 1);
More information about the Scummvm-git-logs
mailing list