minor comments changes
[rocksndiamonds.git] / src / game_em / logic.c
index e149fc6f0561cee15d147667d7855e7a029a064a..42166ebb9e802dc5a57b8ce0aa3f9f5135e3101e 100644 (file)
@@ -115,7 +115,7 @@ static void Lboom_generic(int x, int y, int element, int element_middle)
 
 static void Lboom_bug(int x, int y, int by_element)
 {
-  next[x][y] = Znormal;
+  next[x][y] = Zbug;
 
   Lboom_generic(x, y, Xemerald, Xdiamond);
 
@@ -126,7 +126,7 @@ static void Lboom_bug(int x, int y, int by_element)
 
 static void Lboom_tank(int x, int y, int by_element)
 {
-  next[x][y] = Znormal;
+  next[x][y] = Ztank;
 
   Lboom_generic(x, y, Xblank, Xblank);
 
@@ -137,7 +137,7 @@ static void Lboom_tank(int x, int y, int by_element)
 
 static void Lboom_eater(int x, int y, int by_element)
 {
-  next[x][y] = Znormal;
+  next[x][y] = Zeater;
 
   boom[x-1][y-1] = lev.eater_array[lev.eater_pos][0];
   boom[x][y-1]   = lev.eater_array[lev.eater_pos][1];
@@ -5565,18 +5565,20 @@ static void Lspring_fall(int x, int y)
 
 static void Lpush_emerald_e(int x, int y)
 {
+  cave[x][y] = Yemerald_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xemerald;
-      next[x][y] = Xemerald;
       return;
 
 #ifdef ACID_ROLL
@@ -5588,8 +5590,6 @@ static void Lpush_emerald_e(int x, int y)
     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)
@@ -5597,30 +5597,28 @@ static void Lpush_emerald_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Yemerald_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Yemerald_e;
-      next[x+1][y] = Xemerald_pause;
-      return;
   }
+
+  cave[x+1][y] = Yemerald_e;
+  next[x+1][y] = Xemerald_pause;
 }
 
 static void Lpush_emerald_w(int x, int y)
 {
+  cave[x][y] = Yemerald_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xemerald;
-      next[x][y] = Xemerald;
       return;
 
 #ifdef ACID_ROLL
@@ -5632,8 +5630,6 @@ static void Lpush_emerald_w(int x, int y)
     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)
@@ -5641,30 +5637,28 @@ static void Lpush_emerald_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Yemerald_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Yemerald_w;
-      next[x-1][y] = Xemerald_pause;
-      return;
   }
+
+  cave[x-1][y] = Yemerald_w;
+  next[x-1][y] = Xemerald_pause;
 }
 
 static void Lpush_diamond_e(int x, int y)
 {
+  cave[x][y] = Ydiamond_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xdiamond;
-      next[x][y] = Xdiamond;
       return;
 
 #ifdef ACID_ROLL
@@ -5676,8 +5670,6 @@ static void Lpush_diamond_e(int x, int y)
     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)
@@ -5685,30 +5677,28 @@ static void Lpush_diamond_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ydiamond_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ydiamond_e;
-      next[x+1][y] = Xdiamond_pause;
-      return;
   }
+
+  cave[x+1][y] = Ydiamond_e;
+  next[x+1][y] = Xdiamond_pause;
 }
 
 static void Lpush_diamond_w(int x, int y)
 {
+  cave[x][y] = Ydiamond_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xdiamond;
-      next[x][y] = Xdiamond;
       return;
 
 #ifdef ACID_ROLL
@@ -5720,8 +5710,6 @@ static void Lpush_diamond_w(int x, int y)
     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)
@@ -5729,30 +5717,28 @@ static void Lpush_diamond_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ydiamond_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ydiamond_w;
-      next[x-1][y] = Xdiamond_pause;
-      return;
   }
+
+  cave[x-1][y] = Ydiamond_w;
+  next[x-1][y] = Xdiamond_pause;
 }
 
 static void Lpush_stone_e(int x, int y)
 {
+  cave[x][y] = Ystone_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xstone;
-      next[x][y] = Xstone;
       return;
 
 #ifdef ACID_ROLL
@@ -5764,8 +5750,6 @@ static void Lpush_stone_e(int x, int y)
     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)
@@ -5773,30 +5757,28 @@ static void Lpush_stone_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ystone_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ystone_e;
-      next[x+1][y] = Xstone_pause;
-      return;
   }
+
+  cave[x+1][y] = Ystone_e;
+  next[x+1][y] = Xstone_pause;
 }
 
 static void Lpush_stone_w(int x, int y)
 {
+  cave[x][y] = Ystone_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xstone;
-      next[x][y] = Xstone;
       return;
 
 #ifdef ACID_ROLL
@@ -5808,8 +5790,6 @@ static void Lpush_stone_w(int x, int y)
     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)
@@ -5817,30 +5797,28 @@ static void Lpush_stone_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ystone_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ystone_w;
-      next[x-1][y] = Xstone_pause;
-      return;
   }
+
+  cave[x-1][y] = Ystone_w;
+  next[x-1][y] = Xstone_pause;
 }
 
 static void Lpush_bomb_e(int x, int y)
 {
+  cave[x][y] = Ybomb_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xbomb;
-      next[x][y] = Xbomb;
       return;
 
 #ifdef ACID_ROLL
@@ -5852,8 +5830,6 @@ static void Lpush_bomb_e(int x, int y)
     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)
@@ -5861,30 +5837,28 @@ static void Lpush_bomb_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ybomb_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ybomb_e;
-      next[x+1][y] = Xbomb_pause;
-      return;
   }
+
+  cave[x+1][y] = Ybomb_e;
+  next[x+1][y] = Xbomb_pause;
 }
 
 static void Lpush_bomb_w(int x, int y)
 {
+  cave[x][y] = Ybomb_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xbomb;
-      next[x][y] = Xbomb;
       return;
 
 #ifdef ACID_ROLL
@@ -5896,8 +5870,6 @@ static void Lpush_bomb_w(int x, int y)
     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)
@@ -5905,30 +5877,28 @@ static void Lpush_bomb_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ybomb_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ybomb_w;
-      next[x-1][y] = Xbomb_pause;
-      return;
   }
+
+  cave[x-1][y] = Ybomb_w;
+  next[x-1][y] = Xbomb_pause;
 }
 
 static void Lpush_nut_e(int x, int y)
 {
+  cave[x][y] = Ynut_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xnut;
-      next[x][y] = Xnut;
       return;
 
 #ifdef ACID_ROLL
@@ -5940,8 +5910,6 @@ static void Lpush_nut_e(int x, int y)
     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)
@@ -5949,30 +5917,28 @@ static void Lpush_nut_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ynut_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ynut_e;
-      next[x+1][y] = Xnut_pause;
-      return;
   }
+
+  cave[x+1][y] = Ynut_e;
+  next[x+1][y] = Xnut_pause;
 }
 
 static void Lpush_nut_w(int x, int y)
 {
+  cave[x][y] = Ynut_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xnut;
-      next[x][y] = Xnut;
       return;
 
 #ifdef ACID_ROLL
@@ -5984,8 +5950,6 @@ static void Lpush_nut_w(int x, int y)
     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)
@@ -5993,30 +5957,28 @@ static void Lpush_nut_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Ynut_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ynut_w;
-      next[x-1][y] = Xnut_pause;
-      return;
   }
+
+  cave[x-1][y] = Ynut_w;
+  next[x-1][y] = Xnut_pause;
 }
 
 static void Lpush_spring_e(int x, int y)
 {
+  cave[x][y] = Yspring_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xspring;
-      next[x][y] = Xspring;
       return;
 
 #ifdef ACID_ROLL
@@ -6028,8 +5990,6 @@ static void Lpush_spring_e(int x, int y)
     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)
@@ -6037,30 +5997,28 @@ static void Lpush_spring_e(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Yspring_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Yspring_e;
-      next[x+1][y] = Xspring_e;
-      return;
   }
+
+  cave[x+1][y] = Yspring_e;
+  next[x+1][y] = Xspring_e;
 }
 
 static void Lpush_spring_w(int x, int y)
 {
+  cave[x][y] = Yspring_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
-    case Zplayer:
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
     case Xboom_android:
     case Xboom_1:
-      cave[x][y] = Xspring;
-      next[x][y] = Xspring;
       return;
 
 #ifdef ACID_ROLL
@@ -6072,8 +6030,6 @@ static void Lpush_spring_w(int x, int y)
     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)
@@ -6081,14 +6037,10 @@ static void Lpush_spring_w(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 #endif
-
-    default:
-      cave[x][y] = Yspring_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Yspring_w;
-      next[x-1][y] = Xspring_w;
-      return;
   }
+
+  cave[x-1][y] = Yspring_w;
+  next[x-1][y] = Xspring_w;
 }
 
 static void Ldynamite_1(int x, int y)
@@ -6858,7 +6810,9 @@ static void Lboom_one(int x, int y, boolean by_dynamite)
   switch (cave[x][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
     case Xboom_bug:
     case Xboom_bomb:
@@ -6954,7 +6908,15 @@ static void Lexplode(int x, int y)
 {
   switch (cave[x][y])
   {
-    case Znormal:
+    case Zbug:
+      Lboom_nine(x, y, FALSE);
+      break;
+
+    case Ztank:
+      Lboom_nine(x, y, FALSE);
+      break;
+
+    case Zeater:
       Lboom_nine(x, y, FALSE);
       break;