rnd-20060820-2-src
[rocksndiamonds.git] / src / game_em / synchro_2.c
index 5079b7c253d7b31a8339f97aaf0b1b67bb99d46c..7657bf8ddfda096fbbf52f131f4bd540900ec8a8 100644 (file)
@@ -8,10 +8,7 @@
  * compilers suck.
  */
 
-#include "display.h"
-#include "tile.h"
-#include "level.h"
-#include "sample.h"
+#include "main_em.h"
 
 
 #define RANDOM (random = random << 31 | random >> 1)
@@ -44,15 +41,15 @@ static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
 
 void synchro_2(void)
 {
-  register unsigned int x = 0;
-  register unsigned int y = 1;
-  register unsigned long random = RandomEM;
-  register unsigned short *cave_cache = Cave[y]; /* might be a win */
-  unsigned long score = 0;
-
-  unsigned int temp = 0;       /* initialized to make compilers happy */
-  unsigned int dx; /* only needed to find closest player */
-  unsigned int dy;
+  int x = 0;
+  int y = 1;
+  unsigned long random = RandomEM;
+  short *cave_cache = Cave[y]; /* might be a win */
+  int score = 0;
+
+  int temp = 0;                        /* initialized to make compilers happy */
+  int dx;                      /* only needed to find closest player */
+  int dy;
   int element;
 
  loop:
@@ -614,7 +611,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.bug_score;
@@ -640,7 +637,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.tank_score;
@@ -700,7 +697,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
          Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
          Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
@@ -721,7 +718,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.alien_score;
@@ -802,7 +799,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -2841,7 +2838,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -2866,7 +2863,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.bug_score;
@@ -2892,7 +2889,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.tank_score;
@@ -2914,7 +2911,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
          Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
          Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
@@ -2935,7 +2932,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.alien_score;
@@ -4192,7 +4189,7 @@ void synchro_2(void)
          Boom[y+1][x-1] = Xblank;
          Boom[y+1][x] = Xblank;
          Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -4881,7 +4878,7 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xemerald;
       Boom[y+1][x] = Xemerald;
       Boom[y+1][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, element);
 #endif
       goto loop;
@@ -4900,19 +4897,22 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xblank;
       Boom[y+1][x] = Xblank;
       Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, element);
 #endif
       goto loop;
 
     case Xboom_android:
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Xandroid);
 #endif
     case Xboom_1:
       Next[y][x] = Xboom_2;
-#if 1
-      play_sound(x, y, SAMPLE_boom);
+#if !PLAY_ELEMENT_SOUND
+      if (x != lev.exit_x && y != lev.exit_y)
+       play_sound(x, y, SAMPLE_boom);
+      else
+       lev.exit_x = lev.exit_y = -1;
 #endif
       goto loop;