Community

SCI Programming => SCI Syntax Help => Topic started by: ZvikaZ on April 13, 2020, 11:31:03 AM

Title: `DoSound sndSTOP` stops another sound resource?!
Post by: ZvikaZ on April 13, 2020, 11:31:03 AM
Hi there to all SCI experts.

I've found something strange with SQ4, while investigating a bug report on ScummVM, and would really like your advice.
It seems to me like some bug in original Sierra SCI interpreter, but I'd like to hear more opinions regarding the situation...

The short story:
Open SQ4 in SCICompanion, and make the following changes to script #1:

Add at the beginning:
Code: [Select]
(use Sound)

Change in `changeState`, state 0 to be:
Code: [Select]
(0
;Z (gLongSong loop: -1 playBed:)
(myPukeSound play:)
(gLongSong number: 886 loop: 1 play:)
(DoSound sndSTOP myPukeSound)     ;why does it stop?
;Z end
(= cycles 1)

Add at the end of the file:

Code: [Select]
(instance myPukeSound of Sound
(properties
number 162   ; try to change me to 9
)
)


Now, no sound will play at all, because of the `(DoSound sndSTOP myPukeSound)`.
(you can comment it and listen that it does play)
Why?
It doesn't make sense to me.

Furthermore, if we change `myPukeSound ` to use other sound resource, such as 9, then the `sndSTOP ` doesn't stop the music.

Is there any logic to this behaviour?
Or is it indeed some kind of a bug in the original SCI interperter?

The long story:
I've got to this while investigating https://bugs.scummvm.org/ticket/11265 (https://bugs.scummvm.org/ticket/11265), and suggested a fix to one of the issues at https://github.com/scummvm/scummvm/pull/2165 (https://github.com/scummvm/scummvm/pull/2165).
You can read there all the details.

Thanks!
Zvika