fixed pushed objects going into acid in EM engine for old tapes
[rocksndiamonds.git] / src / game_em / logic.c
index 3c68bfb9f73ea6250de9abf3ef47b29ec65ad8a1..ba9c05e5301b331f4cb64afc8398aff3d84190ca 100644 (file)
@@ -245,6 +245,15 @@ static void Lboom_next_new(int x, int y, int element)
   next[x][y] = element;
 }
 
+static void Lpush_element_old(int x, int y, int element)
+{
+  if (!game_em.use_old_push_elements)
+    return;
+
+  cave[x][y] = element;
+  next[x][y] = element;
+}
+
 static boolean player_killed(struct PLAYER *ply)
 {
   int x = ply->x;
@@ -5709,6 +5718,9 @@ static void Lpush_emerald_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5720,6 +5732,7 @@ static void Lpush_emerald_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xemerald);
       return;
 
 #ifdef ACID_ROLL
@@ -5731,6 +5744,8 @@ static void Lpush_emerald_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -5751,6 +5766,9 @@ static void Lpush_emerald_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5762,6 +5780,7 @@ static void Lpush_emerald_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xemerald);
       return;
 
 #ifdef ACID_ROLL
@@ -5773,6 +5792,8 @@ static void Lpush_emerald_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)
@@ -5793,6 +5814,9 @@ static void Lpush_diamond_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5804,6 +5828,7 @@ static void Lpush_diamond_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xdiamond);
       return;
 
 #ifdef ACID_ROLL
@@ -5815,6 +5840,8 @@ static void Lpush_diamond_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -5835,6 +5862,9 @@ static void Lpush_diamond_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5846,6 +5876,7 @@ static void Lpush_diamond_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xdiamond);
       return;
 
 #ifdef ACID_ROLL
@@ -5857,6 +5888,8 @@ static void Lpush_diamond_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)
@@ -5877,6 +5910,9 @@ static void Lpush_stone_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5888,6 +5924,7 @@ static void Lpush_stone_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xstone);
       return;
 
 #ifdef ACID_ROLL
@@ -5899,6 +5936,8 @@ static void Lpush_stone_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -5919,6 +5958,9 @@ static void Lpush_stone_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5930,6 +5972,7 @@ static void Lpush_stone_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xstone);
       return;
 
 #ifdef ACID_ROLL
@@ -5941,6 +5984,8 @@ static void Lpush_stone_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)
@@ -5961,6 +6006,9 @@ static void Lpush_bomb_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -5972,6 +6020,7 @@ static void Lpush_bomb_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xbomb);
       return;
 
 #ifdef ACID_ROLL
@@ -5983,6 +6032,8 @@ static void Lpush_bomb_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -6003,6 +6054,9 @@ static void Lpush_bomb_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -6014,6 +6068,7 @@ static void Lpush_bomb_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xbomb);
       return;
 
 #ifdef ACID_ROLL
@@ -6025,6 +6080,8 @@ static void Lpush_bomb_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)
@@ -6045,6 +6102,9 @@ static void Lpush_nut_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -6056,6 +6116,7 @@ static void Lpush_nut_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xnut);
       return;
 
 #ifdef ACID_ROLL
@@ -6067,6 +6128,8 @@ static void Lpush_nut_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -6087,6 +6150,9 @@ static void Lpush_nut_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -6098,6 +6164,7 @@ static void Lpush_nut_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xnut);
       return;
 
 #ifdef ACID_ROLL
@@ -6109,6 +6176,8 @@ static void Lpush_nut_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)
@@ -6129,6 +6198,9 @@ static void Lpush_spring_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -6140,6 +6212,7 @@ static void Lpush_spring_e(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xspring);
       return;
 
 #ifdef ACID_ROLL
@@ -6151,6 +6224,8 @@ static void Lpush_spring_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x+2][y-1] == Xblank)
        cave[x+2][y-1] = Xsplash_e;
       if (cave[x][y-1] == Xblank)
@@ -6171,6 +6246,9 @@ static void Lpush_spring_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
+      if (!game_em.use_old_push_elements)
+       break;
     case Zborder:
     case Zbug:
     case Ztank:
@@ -6182,6 +6260,7 @@ static void Lpush_spring_w(int x, int y)
     case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
+      Lpush_element_old(x, y, Xspring);
       return;
 
 #ifdef ACID_ROLL
@@ -6193,6 +6272,8 @@ static void Lpush_spring_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
+      if (game_em.use_old_push_into_acid)
+       break;
       if (cave[x][y-1] == Xblank)
        cave[x][y-1] = Xsplash_e;
       if (cave[x-2][y-1] == Xblank)