added playing door/gate sound when wrapping-around in EM engine
[rocksndiamonds.git] / src / game_em / logic.c
index de3966c1b137e44ab3ed66e17f693ab86788b37f..290066440bb70e75bcc3b48ad1f46bc702a5ee18 100644 (file)
@@ -12,8 +12,7 @@
 #define ACID_ROLL      /* rolling objects go into acid rather than remove it */
 #define ACID_PLAYER    /* player gets killed by acid, but without explosion */
 
-#define RANDOM_RAW     (seed = seed << 31 | seed >> 1)
-#define RANDOM(x)      (RANDOM_RAW % x)
+#define RANDOM(x)      ((seed = seed << 31 | seed >> 1) % x)
 
 static short **cave, **next, **boom;
 static unsigned int seed;
@@ -1280,6 +1279,11 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
     }
   }
 
+  /* check for wrap-around movement */
+  if (ply->x < lev.left ||
+      ply->x > lev.right - 1)
+    play_element_sound(oldx, oldy, SOUND_door, Xdoor_1);
+
   return result;
 }