rnd-20111007-1-src
[rocksndiamonds.git] / src / game_em / synchro_2.c
index 3207f3688b685e5e9f4736b680f0a00a17225baf..c4b9a678b3e1e9dbf5ebb3302986d70c76736abf 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)
@@ -46,7 +43,7 @@ void synchro_2(void)
 {
   int x = 0;
   int y = 1;
-  unsigned long random = RandomEM;
+  unsigned int random = RandomEM;
   short *cave_cache = Cave[y]; /* might be a win */
   int score = 0;
 
@@ -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;
@@ -4719,6 +4716,16 @@ void synchro_2(void)
        case Xacid_6:
        case Xacid_7:
        case Xacid_8:
+#if 1
+         Cave[y][x] = Xsand_stonesand_quickout_1;
+         if (Cave[y][x+1] == Xblank)
+           Cave[y][x+1] = Yacid_splash_eB;
+         if (Cave[y][x-1] == Xblank)
+           Cave[y][x-1] = Yacid_splash_wB;
+         Next[y][x] = Xsand_stonesand_quickout_2;
+         play_element_sound(x, y, SAMPLE_acid, Xacid_1);
+         goto loop;
+#else
          Cave[y][x] = Xsand_stonesand_3;
          if (Cave[y][x+1] == Xblank)
            Cave[y][x+1] = Yacid_splash_eB;
@@ -4727,15 +4734,24 @@ void synchro_2(void)
          Next[y][x] = Xsand_stonesand_4;
          play_element_sound(x, y, SAMPLE_acid, Xacid_1);
          goto loop;
+#endif
 
        case Xblank:
        case Yacid_splash_eB:
        case Yacid_splash_wB:
+#if 1
+         Cave[y][x] = Xsand_stonesand_quickout_1;
+         Cave[y+1][x] = Xsand_stoneout_1;
+         Next[y][x] = Xsand_stonesand_quickout_2;
+         Next[y+1][x] = Xsand_stoneout_2;
+         goto loop;
+#else
          Cave[y][x] = Xsand_stonesand_3;
          Cave[y+1][x] = Xsand_stoneout_1;
          Next[y][x] = Xsand_stonesand_4;
          Next[y+1][x] = Xsand_stoneout_2;
          goto loop;
+#endif
 
        case Xsand:
          Cave[y][x] = Xsand_stonesand_1;
@@ -4780,6 +4796,16 @@ void synchro_2(void)
       Next[y][x] = Xsand;
       goto loop;
 
+#if 1
+    case Xsand_stonesand_quickout_1:
+      Next[y][x] = Xsand_stonesand_quickout_2;
+      goto loop;
+
+    case Xsand_stonesand_quickout_2:
+      Next[y][x] = Xsand;
+      goto loop;
+#endif
+
     case Xsand_stoneout_1:
       Next[y][x] = Xsand_stoneout_2;
       goto loop;
@@ -4881,7 +4907,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 +4926,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;