added pushed objects going into acid (with compile time option)
[rocksndiamonds.git] / src / game_em / logic.c
index bfe1d8436e78a4a03b4117bdf5e26e875412e790..e149fc6f0561cee15d147667d7855e7a029a064a 100644 (file)
@@ -9,6 +9,8 @@
 
 
 #define SPRING_ROLL    /* spring rolling off round things continues to roll */
+#define ACID_ROLL      /* rolling objects go into acid rather than remove it */
+
 #define USE_CHANGED_ACID_STUFF
 
 #define RANDOM_RAW     (seed = seed << 31 | seed >> 1)
@@ -533,7 +535,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -546,7 +548,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -1124,7 +1126,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -1135,7 +1137,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -5577,6 +5579,25 @@ static void Lpush_emerald_e(int x, int y)
       next[x][y] = Xemerald;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Yemerald_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Yemerald_eB;
       next[x][y] = Xblank;
@@ -5602,6 +5623,25 @@ static void Lpush_emerald_w(int x, int y)
       next[x][y] = Xemerald;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Yemerald_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Yemerald_wB;
       next[x][y] = Xblank;
@@ -5627,6 +5667,25 @@ static void Lpush_diamond_e(int x, int y)
       next[x][y] = Xdiamond;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ydiamond_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ydiamond_eB;
       next[x][y] = Xblank;
@@ -5652,6 +5711,25 @@ static void Lpush_diamond_w(int x, int y)
       next[x][y] = Xdiamond;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ydiamond_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ydiamond_wB;
       next[x][y] = Xblank;
@@ -5677,6 +5755,25 @@ static void Lpush_stone_e(int x, int y)
       next[x][y] = Xstone;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ystone_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ystone_eB;
       next[x][y] = Xblank;
@@ -5702,6 +5799,25 @@ static void Lpush_stone_w(int x, int y)
       next[x][y] = Xstone;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ystone_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ystone_wB;
       next[x][y] = Xblank;
@@ -5727,6 +5843,25 @@ static void Lpush_bomb_e(int x, int y)
       next[x][y] = Xbomb;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ybomb_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ybomb_eB;
       next[x][y] = Xblank;
@@ -5752,6 +5887,25 @@ static void Lpush_bomb_w(int x, int y)
       next[x][y] = Xbomb;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ybomb_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ybomb_wB;
       next[x][y] = Xblank;
@@ -5777,6 +5931,25 @@ static void Lpush_nut_e(int x, int y)
       next[x][y] = Xnut;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ynut_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ynut_eB;
       next[x][y] = Xblank;
@@ -5802,6 +5975,25 @@ static void Lpush_nut_w(int x, int y)
       next[x][y] = Xnut;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Ynut_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Ynut_wB;
       next[x][y] = Xblank;
@@ -5827,6 +6019,25 @@ static void Lpush_spring_e(int x, int y)
       next[x][y] = Xspring;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Yspring_eB;
+      next[x][y] = Xblank;
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Yspring_eB;
       next[x][y] = Xblank;
@@ -5852,6 +6063,25 @@ static void Lpush_spring_w(int x, int y)
       next[x][y] = Xspring;
       return;
 
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      cave[x][y] = Yspring_wB;
+      next[x][y] = Xblank;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
+      return;
+#endif
+
     default:
       cave[x][y] = Yspring_wB;
       next[x][y] = Xblank;
@@ -6551,7 +6781,7 @@ static void Lslide_ew(int x, int y)
 
 static void Lexit(int x, int y)
 {
-  if (lev.required > 0)
+  if (lev.gems_needed > 0)
     return;
 
   switch (RANDOM(64) / 21)