exult / exult

Exult is a project to recreate Ultima 7 for modern operating systems, using the game's original plot, data, and graphics files.
http://exult.info
GNU General Public License v2.0
491 stars 77 forks source link

Bell SFX fails to play on Monk Isle #496

Open DominusExult opened 2 months ago

DominusExult commented 2 months ago

The "bell" sfx fails to play on Monk Isle when the monks scatter on to their next schedule and bark things like "The Bells!" etc. It should play the sfx as bells are playing a quick song when they start moving around.

from our old SF tracker https://sourceforge.net/p/exult/bugs/1900/

DominusExult commented 2 months ago

This is actually curios. The bells are sfx 6 and the debug log shows Exult playing them but they are not heard. This is happening at around 8:112am (the attached savegame (rename to sav instead of zip) is a bit before that): exult224si.sav.zip

Running usecode 00fa () with event 2, depth 0
Running usecode 09a0 (0001, 0005) with event 2, depth 1
Returning ([ 60000211b5b8 ]) from usecode 09a0
...back into usecode 00fa
Running usecode 09a0 (0002, 0005) with event 2, depth 1
Returning ([ 60000211b4e8 ]) from usecode 09a0
...back into usecode 00fa
Running usecode 0994 () with event 2, depth 1
Running usecode 0993 ([ 0997, 0432, 0000 ]) with event 2, depth 2
Returning (0002) from usecode 0993
...back into usecode 0994
Returning (0002) from usecode 0994
...back into usecode 00fa
Running usecode 09a0 (0003, 0005) with event 2, depth 1
Returning ([ 6000021184f8 ]) from usecode 09a0
...back into usecode 00fa
Executing intrinsic 1
Running usecode 097f (000d, "@The bells!@", ff31) with event 2, depth 1
Running usecode 0983 (ff31) with event 2, depth 2
Returning (0001) from usecode 0983
...back into usecode 097f
Executing intrinsic 2
Returning from usecode 097f
...back into usecode 00fa
Running usecode 097f (0009, "@The bells!@", ff2d) with event 2, depth 1
Running usecode 0983 (ff2d) with event 2, depth 2
Returning (0001) from usecode 0983
...back into usecode 097f
Executing intrinsic 2
Returning from usecode 097f
...back into usecode 00fa
Running usecode 097f (000a, "@Hear the bells!@", ff2f) with event 2, depth 1
Running usecode 0983 (ff2f) with event 2, depth 2
Returning (0001) from usecode 0983
...back into usecode 097f
Executing intrinsic 2
Returning from usecode 097f
...back into usecode 00fa
Running usecode 097f (0009, "@The bells!@", ff2c) with event 2, depth 1
Running usecode 0983 (ff2c) with event 2, depth 2
Returning (0001) from usecode 0983
...back into usecode 097f
Executing intrinsic 2
Returning from usecode 097f
...back into usecode 00fa
Running usecode 097f (000f, "@Quickly!@", ff2b) with event 2, depth 1
Running usecode 0983 (ff2b) with event 2, depth 2
Returning (0001) from usecode 0983
...back into usecode 097f
Executing intrinsic 2
Returning from usecode 097f
...back into usecode 00fa
Executing intrinsic 2
Aborting from usecode 00fa
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
Running usecode 00fa () with event 2, depth 0
Running usecode 09a0 (0001, 0005) with event 2, depth 1
Returning ([ 60000211b5b8 ]) from usecode 09a0
...back into usecode 00fa
Running usecode 09a0 (0002, 0005) with event 2, depth 1
Returning ([ 60000211b4e8 ]) from usecode 09a0
...back into usecode 00fa
Running usecode 084d (0009, ff31) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff31) with event 2, depth 1
Returning ([ 095c, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff31) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2d) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2d) with event 2, depth 1
Returning ([ 0980, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2d) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2f) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2f) with event 2, depth 1
Returning ([ 096f, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2f) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2c) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2c) with event 2, depth 1
Returning ([ 096a, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2c) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2b) with event 2, depth 1
Returning (0007) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2b) with event 2, depth 1
Returning ([ 0968, 04ba, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2b) with event 2, depth 1
Returning (0007) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2a) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2a) with event 2, depth 1
Returning ([ 0960, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2a) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff30) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff30) with event 2, depth 1
Returning ([ 0972, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff30) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084d (0009, ff2e) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Running usecode 084e (0009, ff2e) with event 2, depth 1
Returning ([ 0968, 04b1, 0000 ]) from usecode 084e
...back into usecode 00fa
Running usecode 084d (0009, ff2e) with event 2, depth 1
Returning (0004) from usecode 084d
...back into usecode 00fa
Setting global flag: 625
Executing intrinsic 2
Returning from usecode 00fa
Running usecode 04cf () with event 0, depth 0
Running usecode 0954 () with event 0, depth 1
Returning ("milord") from usecode 0954
...back into usecode 04cf
Running usecode 0994 () with event 0, depth 1
Running usecode 0993 ([ 0997, 0432, 0000 ]) with event 0, depth 2
Returning (0002) from usecode 0993
...back into usecode 0994
Returning (0002) from usecode 0994
...back into usecode 04cf
Running usecode 0953 () with event 0, depth 1
Returning ("Exult") from usecode 0953
...back into usecode 04cf
Running usecode 09a0 (0001, 0005) with event 0, depth 1
Returning ([ 60000211b5b8 ]) from usecode 09a0
...back into usecode 04cf
Returning from usecode 04cf
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
***#ticks = 10004, blits = 89, FPS:  8.89644
Asking center tile for obj. 607 not on map
Playing SFX: 6
Game paused
Game resumed
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
Asking center tile for obj. 607 not on map
Playing SFX: 6
***#ticks = 10005, blits = 84, FPS:  8.3958
Clock updated to 8:15
DominusExult commented 2 months ago

The problem is that the distance is at 256, so Exult doesn't play it (or rather the volume is at 0). When I force set the distance to 1 in Audio.cc::642 the bell plays. Why it sets the distance so high, no idea. Edit: it looks for obj 607 (that's the path egg numbers) somewhere. And since it isn't on the map the distance is 256 for some reason.

It then has the problem similar to #504 that each call for playing the sfx actually plays and makes it not "nice". Here an exclusivity should also apply and only play one instance of the sfx at a time.

NotStanley4330 commented 2 months ago

Yeah this is probably well suited to the proposed exclusivity tag in shape_info.txt . Would be really nice to fix the long standing issue with the soundscape in exult. I'll poke at it.

DominusExult commented 2 months ago

yeah, except that it is not a shape_sfx in this case. But perhaps a general sfx exclusivity would be needed (though that would prevent playing back some that would be nice, like when NPCs open/close a shutter at nearly the same time).

NotStanley4330 commented 2 months ago

Ohhhhh that's right this isn't shape related. Yeah would be much better to try to do a general exclusivity. I'll look at our overall sfx player and see if I can build that in somehow. I'm curious, is it a case in the original that if multiple sfx attempt to play at once that they just play back to back? Or do the other effects just get lost?

DominusExult commented 2 months ago

With a quick test I think the other effect just gets lost. But I need to test with different sfx "sources" (like a shape that plays sfx while something like the usecode controlled sfx plays).

NotStanley4330 commented 2 months ago

That will definitely be easier to implement if it turns out to be the case. Pure sfx exclusivity would be a simple enough check to implement.

DominusExult commented 2 months ago

With a quick test I think the other effect just gets lost. But I need to test with different sfx "sources" (like a shape that plays sfx while something like the usecode controlled sfx plays).

strike that - I had some thinking mistake. I don't think there is any case that a shape sfx will be the same played by a usecode event. As for a test of shape sfx in the original, only one sfx is played even if there are several shape sources (e.g. several energy fields).

DominusExult commented 2 months ago

My proposed „exclusive sfx“ would be wrong in this instance. I‘ve hacked an exclusive stx way and the above distance hack and the bells only play once. All three subsequent bell tolling are ignored then. So in this case a delay is needed.

DominusExult commented 1 month ago

Thanks to @marzojr providing the code for 5149ade the bells play now. BUT as mentioned before they play wrong as they play almost at the same time, while they should be playing one after the other.

But it's puzzling me. In Exult it changes how many times sfx 6 is getting played sometimes only 4 times, sometimes 10 or more times. In the original it is pretty consistently playing 2 times, except when you arrive via the serpent gate, then it plays one time (Exult almost doesn't want to stop playing when you arrive via the serpent gate).

My guess is that maybe the usecode schedule it stems from needs some check (is it already playing the sfx? delay until finished and only play once again during a certain time?) https://github.com/exult/exult/blob/master/usecode/ucsched.cc#L643

Bells in Exult: https://youtu.be/b5Da9s8UXVA Bells in the original: https://youtu.be/dAzXw2NLBuI

Original savegame (wait a tiny bit) GAME07.U7.zip