fixed playing non-native sounds at wrap-around BD cave positions
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 1 Dec 2024 14:50:19 +0000 (15:50 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 1 Dec 2024 14:50:22 +0000 (15:50 +0100)
src/game_bd/bd_sound.c

index 5468cb72d9a704b1f5f96ba69a838be65fcb5edc..b139025e1cc03c96bb98c3dca6a7e8e5b4f00d71 100644 (file)
@@ -494,6 +494,10 @@ 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);