[Scummvm-git-logs] scummvm master -> 364542e9e149534df54ec07a07dce0b20cae897e
sluicebox
22204938+sluicebox at users.noreply.github.com
Wed Feb 24 02:23:43 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
196d666e70 SCI: Remove outdated PHARKAS script patch
364542e9e1 SCI: Fully implement kDoAudio(13) for PHARKAS CD
Commit: 196d666e70af952d23e3affc8ff18d73c0f545d0
https://github.com/scummvm/scummvm/commit/196d666e70af952d23e3affc8ff18d73c0f545d0
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-02-23T18:22:25-08:00
Commit Message:
SCI: Remove outdated PHARKAS script patch
This patch removes a call to kDoAudio(13) because at the time it was
written, the subop was unimplemented and didn't return a value.
kDoAudio(13) was later changed to always return 1 so this patch has been
moot for a while. Now we need this script to do what it's supposed to
and detect sound interruptions so I'm about to implement kDoAudio(13).
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 7324e0b703..c2b0d78656 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -1822,34 +1822,6 @@ static const uint16 freddypharkasPatchIntroScaling[] = {
PATCH_END
};
-// PointsSound::check waits for a signal. If no signal is received, it'll call
-// kDoSound(0x0d) which is a dummy in sierra sci. ScummVM and will use acc
-// (which is not set by the dummy) to trigger sound disposal. This somewhat
-// worked in sierra sci because the sample was already playing in the sound
-// driver. In our case, that would also stop the sample from playing, so we
-// patch it out. The "score" code is already buggy and sets volume to 0 when
-// playing.
-// Applies to at least: English PC-CD
-// Responsible method: PointsSound::check in script 0
-// Fixes bug: #5059
-static const uint16 freddypharkasSignatureScoreDisposal[] = {
- 0x67, 0x32, // pTos 32 (selector theAudCount)
- 0x78, // push1
- SIG_MAGICDWORD,
- 0x39, 0x0d, // pushi 0d
- 0x43, 0x75, 0x02, // callk DoAudio
- 0x1c, // ne?
- 0x31, // bnt [skip disposal]
- SIG_END
-};
-
-static const uint16 freddypharkasPatchScoreDisposal[] = {
- 0x34, PATCH_UINT16(0x0000), // ldi 0000
- 0x34, PATCH_UINT16(0x0000), // ldi 0000
- 0x34, PATCH_UINT16(0x0000), // ldi 0000
- PATCH_END
-};
-
// In script 235, rm235::init and sEnterFrom500 disable icon 7+8 of iconbar (CD
// only). When picking up the canister after placing it down, the scripts will
// disable all the other icons. This results in IconBar::disable doing endless
@@ -2111,7 +2083,6 @@ static const uint16 freddypharkasPatchDeskLetter[] = {
// script, description, signature patch
static const SciScriptPatcherEntry freddypharkasSignatures[] = {
- { true, 0, "CD: score early disposal", 1, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
{ true, 15, "Mac: broken inventory", 1, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory },
{ true, 110, "intro scaling workaround", 2, freddypharkasSignatureIntroScaling, freddypharkasPatchIntroScaling },
{ false, 200, "Mac: skip broken hop singh scene", 1, freddypharkasSignatureMacHopSingh, freddypharkasPatchMacHopSingh },
Commit: 364542e9e149534df54ec07a07dce0b20cae897e
https://github.com/scummvm/scummvm/commit/364542e9e149534df54ec07a07dce0b20cae897e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-02-23T18:22:25-08:00
Commit Message:
SCI: Fully implement kDoAudio(13) for PHARKAS CD
Now that we match SSCI behavior when it comes to interrupting samples
when new samples play, we need to implement kDoAudio(13) so that the CD
version of Freddy Pharkas can detect these interruptions. Otherwise,
the game will softlock if the points sound effect or narration is
interrupted.
Changed paths:
engines/sci/engine/ksound.cpp
engines/sci/sound/audio.cpp
engines/sci/sound/audio.h
engines/sci/sound/soundcmd.cpp
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 25cdf7249a..b81ca78b79 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -196,6 +196,10 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+ if (argv[0].toUint16() == kSciAudioPlay) {
+ g_sci->_audio->incrementPlayCounter();
+ }
+
debugC(kDebugLevelSound, "kDoAudio: play sample %d, module %d", number, module);
// return sample length in ticks
@@ -287,19 +291,23 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, 1);
case 13:
- // SSCI returns a serial number for the played audio
- // here, used in the PointsSound class. The reason is severalfold:
-
- // 1. SSCI does not support multiple wave effects at once
- // 2. FPFP may disable its icon bar during the points sound.
- // 3. Each new sound preempts any sound already playing.
- // 4. If the points sound is interrupted before completion,
- // the icon bar could remain disabled.
-
- // Since points (1) and (3) do not apply to us, we can simply
- // return a constant here. This is equivalent to the
- // old behavior, as above.
- return make_reg(0, 1);
+ // SSCI returns a counter that increments each time a sample
+ // is played. This is used by the PointsSound and Narrator
+ // classes to detect if their sound was interrupted by
+ // another sample playing, since only one can play at a time.
+ // The counter is incremented on each kDoAudio(Play) and on
+ // each kDoSound(Play) when the sound is a sample, since SSCI
+ // just passes those on to kDoAudio.
+ //
+ // When awarding points, the icon bar is often disabled, and
+ // PointsSound:check polls its signal to detect when the
+ // sound is completed so that it can re-enable the icon bar.
+ // If the sound is interrupted by another sample then the icon
+ // bar could remain permanently disabled, so the play counter
+ // is stored before playing and PointsSound:check polls for
+ // a change. The Narrator class also does this to detect
+ // if speech was interrupted so that the game can continue.
+ return make_reg(0, g_sci->_audio->getPlayCounter());
case 17:
// Seems to be some sort of audio sync, used in SQ6. Silenced the
// warning due to the high level of spam it produces. (takes no params)
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index a5dfa16879..ef5d4815a8 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -44,7 +44,7 @@
namespace Sci {
AudioPlayer::AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(11025),
- _audioCdStart(0), _initCD(false) {
+ _audioCdStart(0), _initCD(false), _playCounter(0) {
_mixer = g_system->getMixer();
_wPlayFlag = false;
@@ -567,4 +567,12 @@ int AudioPlayer::audioCdPosition() {
return (g_system->getMillis() - _audioCdStart) * 60 / 1000;
}
+void AudioPlayer::incrementPlayCounter() {
+ _playCounter++;
+}
+
+uint16 AudioPlayer::getPlayCounter() {
+ return _playCounter;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h
index 4d0d3115e8..6358c535a0 100644
--- a/engines/sci/sound/audio.h
+++ b/engines/sci/sound/audio.h
@@ -77,6 +77,9 @@ public:
void stopAllAudio();
+ void incrementPlayCounter();
+ uint16 getPlayCounter();
+
private:
ResourceManager *_resMan;
uint16 _audioRate;
@@ -85,6 +88,7 @@ private:
uint32 _audioCdStart;
bool _wPlayFlag;
bool _initCD;
+ uint16 _playCounter;
};
} // End of namespace Sci
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index f2c58e46aa..f8db23180e 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -240,6 +240,12 @@ void SoundCommandParser::processPlaySound(reg_t obj, bool playBed, bool restorin
_music->soundPlay(musicSlot, restoring);
+ // Increment the sample play counter used by Pharkas CD.
+ // SSCI calls kDoAudio(Play) which did this. See kDoAudio(13).
+ if (musicSlot->isSample) {
+ _audio->incrementPlayCounter();
+ }
+
// Reset any left-over signals
musicSlot->signal = 0;
musicSlot->fadeStep = 0;
More information about the Scummvm-git-logs
mailing list