From 386e26cf0f543f4c49d2231cacf79b5bcfc5bb61 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 8 Dec 2024 18:18:03 +0100 Subject: [PATCH] fixed playing sounds at wrap-around BD cave positions This change completes commit daf84901, which only fixed sounds at wrap-around BD cave positions when using the non-native sound engine. --- src/game_bd/bd_sound.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game_bd/bd_sound.c b/src/game_bd/bd_sound.c index 9aaddd0e..55654f2c 100644 --- a/src/game_bd/bd_sound.c +++ b/src/game_bd/bd_sound.c @@ -478,6 +478,10 @@ 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 (sound == GD_S_NONE) return; @@ -495,10 +499,6 @@ void gd_sound_play(GdCave *cave, GdSound sound, GdElement element, int x, int y) if (!game.use_native_bd_sound_engine) { - // fix wrap-around cave positions for non-native sound engine - x = (x + cave->w) % cave->w; - y = (y + cave->h) % cave->h; - // when not using native sound engine, just play the sound PlayLevelSound_BD(x, y, element, sound); -- 2.34.1