fixed smooth movement for elements in magic wall with no space below
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 6 Oct 2024 18:00:06 +0000 (20:00 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 6 Oct 2024 18:00:09 +0000 (20:00 +0200)
src/game_bd/bd_caveengine.c
src/game_bd/bd_graphics.c

index df6553dcf7421f59d05cc0ceef49f4eb8c2f43d4..cee8d4e7cceb0003bcccb75a1c61a8fcfecef1c5 100644 (file)
@@ -1624,12 +1624,19 @@ static boolean do_fall_try_magic(GdCave *cave, int x, int y, GdDirection fall_di
     if (cave->magic_wall_state == GD_MW_DORMANT)
       cave->magic_wall_state = GD_MW_ACTIVE;
 
-    if (cave->magic_wall_state == GD_MW_ACTIVE &&
-       is_like_space(cave, x, y, twice[fall_dir]))
+    if (cave->magic_wall_state == GD_MW_ACTIVE)
     {
-      // if magic wall active and place underneath, it turns element
-      // into anything the effect says to do.
-      store_dir(cave, x, y, twice[fall_dir], magic);
+      if (is_like_space(cave, x, y, twice[fall_dir]))
+      {
+        // if magic wall active and place underneath, it turns element
+        // into anything the effect says to do.
+        store_dir(cave, x, y, twice[fall_dir], magic);
+      }
+      else
+      {
+        // store from/to directions in special buffers for smooth movement animations
+        store_dir_buffer(cave, x, y, fall_dir);
+      }
     }
 
     // active or non-active or anything, element falling in will always disappear
index 107acc6b3b6777721ce09ea08f359baac40c3f51..74d6b6e9f32c2677d4ebf694fe8105b5807a47a8 100644 (file)
@@ -605,9 +605,10 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
     tile_from = game->element_buffer[new_y][new_x];
     draw_from = game->drawing_buffer[new_y][new_x];
 
-    if (is_double_movement)
+    if (is_double_movement || tile_from == O_MAGIC_WALL)
     {
-      // for magic wall or slime, use source tile instead of target tile
+      // for magic wall or slime, use source tile instead of (changed) target tile
+      // also required for element falling into magic wall with no space below it
       tile_from = tile_last;
       draw_from = draw_last;
     }