From 4c8fe1a3afdbe4c3188db6ebe23b768027d59456 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 14 Dec 2024 18:18:25 +0100 Subject: [PATCH] fixed playing loop sounds when using native BD game engine When using the native BD game engine, but not using the native BD sound engine, loop sounds were not played anymore due to a bug with off-playfield sound positions. This bug was introduced by commit 386e26cf. --- src/game_bd/bd_sound.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game_bd/bd_sound.c b/src/game_bd/bd_sound.c index 55654f2c..794610c4 100644 --- a/src/game_bd/bd_sound.c +++ b/src/game_bd/bd_sound.c @@ -478,9 +478,12 @@ static void gd_sound_info_to_play(int channel, int x, int y, int element, int so // plays sound in a cave void gd_sound_play(GdCave *cave, GdSound sound, GdElement element, int x, int y) { - // fix wrap-around cave positions - x = (x + cave->w) % cave->w; - y = (y + cave->h) % cave->h; + if (x != -1 || y != -1) + { + // fix wrap-around cave positions + x = (x + cave->w) % cave->w; + y = (y + cave->h) % cave->h; + } if (sound == GD_S_NONE) return; -- 2.34.1