rnd-20050122-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 22 Jan 2005 17:21:42 +0000 (18:21 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:48:43 +0000 (10:48 +0200)
src/conftime.h
src/game_em/graphics.c
src/game_em/main_em.h
src/game_em/tab_generate.c
src/tools.c

index 95a65b29bcdd5f94a480eac9051adffce8ad8b1b..ab86a087724bcb94bb6cae0f69d078e4dcd27c6c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2005-01-22 17:10]"
+#define COMPILE_DATE_STRING "[2005-01-22 18:19]"
index 93100cb306d5aacbc398dc6c56fed92da7fcf379..bd9331755b0334896e5046266b7fd4c37a47905d 100644 (file)
@@ -96,7 +96,7 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy,
   }
   else
   {
-    if (width != TILEX || height != TILEY)
+    if ((width != TILEX || height != TILEY) && !g->preserve_background)
       ClearRectangle(screenBitmap, sx * TILEX, sy * TILEY, TILEX, TILEY);
 
     if (width > 0 && height > 0)
index a34f10fdf95e6c7d7ccb56bbc92881bb9d5e9749..1cc7a5b5b36e0f457e35115ae01ecd1e95bfae94 100644 (file)
@@ -655,11 +655,13 @@ struct GraphicInfo_EM
   int dst_offset_x, dst_offset_y;
   int width, height;
 
-  boolean has_crumbled_graphics;
   Bitmap *crumbled_bitmap;
   int crumbled_src_x, crumbled_src_y;
   int crumbled_border_size;
 
+  boolean has_crumbled_graphics;
+  boolean preserve_background;
+
   int unique_identifier;       /* used to identify needed screen updates */
 };
 
index 7ed460c08fd0fc1ed7c326ca952394c473260b23..75c47b3795afc0345af4817394b0130b9e051ab8 100644 (file)
@@ -4602,12 +4602,14 @@ void create_obj_graphics_info_em()
       g->width = TILEX;
       g->height = TILEY;
 
-      g->has_crumbled_graphics = FALSE;
       g->crumbled_bitmap = NULL;
       g->crumbled_src_x = 0;
       g->crumbled_src_y = 0;
       g->crumbled_border_size = 0;
 
+      g->has_crumbled_graphics = FALSE;
+      g->preserve_background = FALSE;
+
       /* create unique graphic identifier to decide if tile must be redrawn */
       g->unique_identifier = obj;
     }
index 33158a4856c1d2c8a45ad742f9f7f2fa8e07650d..05a1293bd789a04e2e5858cbd15175f181b3a362 100644 (file)
@@ -5947,11 +5947,13 @@ void InitGraphicInfo_EM(void)
       g_em->width  = TILEX;
       g_em->height = TILEY;
 
-      g_em->has_crumbled_graphics = FALSE;
       g_em->crumbled_bitmap = NULL;
       g_em->crumbled_src_x = 0;
       g_em->crumbled_src_y = 0;
       g_em->crumbled_border_size = 0;
+
+      g_em->has_crumbled_graphics = FALSE;
+      g_em->preserve_background = FALSE;
 #endif
 
 #if 0
@@ -6030,6 +6032,76 @@ void InitGraphicInfo_EM(void)
        g_em->width  = TILEX - cx * step;
        g_em->height = TILEY - cy * step;
       }
+
+#if 0
+      if (effective_action == ACTION_SMASHED_BY_ROCK &&
+         element_info[effective_element].graphic[effective_action] ==
+         element_info[effective_element].graphic[ACTION_DEFAULT])
+      {
+       int move_dir = MV_DOWN;
+       int dx = (move_dir == MV_LEFT ? -1 : move_dir == MV_RIGHT ? 1 : 0);
+       int dy = (move_dir == MV_UP   ? -1 : move_dir == MV_DOWN  ? 1 : 0);
+       int num_steps = 8;
+       int cx = ABS(dx) * (TILEX / num_steps);
+       int cy = ABS(dy) * (TILEY / num_steps);
+       int step_frame = j + 1;
+       int step = (is_backside ? step_frame : num_steps - step_frame);
+
+       graphic = (el_act_dir2img(EL_ROCK, ACTION_FALLING, MV_DOWN));
+       g = &graphic_info[graphic];
+       sync_frame = j;
+       frame = getAnimationFrame(g->anim_frames,
+                                 g->anim_delay,
+                                 g->anim_mode,
+                                 g->anim_start_frame,
+                                 sync_frame);
+       getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y,
+                           g->double_movement && is_backside);
+
+       g_em->bitmap = src_bitmap;
+       g_em->src_x = src_x;
+       g_em->src_y = src_y;
+       g_em->src_offset_x = 0;
+       g_em->src_offset_y = 0;
+       g_em->dst_offset_x = 0;
+       g_em->dst_offset_y = 0;
+
+       if (is_backside)        /* tile where movement starts */
+       {
+         if (dx < 0 || dy < 0)
+         {
+           g_em->src_offset_x = cx * step;
+           g_em->src_offset_y = cy * step;
+         }
+         else
+         {
+           g_em->dst_offset_x = cx * step;
+           g_em->dst_offset_y = cy * step;
+         }
+       }
+       else                    /* tile where movement ends */
+       {
+         if (dx < 0 || dy < 0)
+         {
+           g_em->dst_offset_x = cx * step;
+           g_em->dst_offset_y = cy * step;
+         }
+         else
+         {
+           g_em->src_offset_x = cx * step;
+           g_em->src_offset_y = cy * step;
+         }
+       }
+
+       g_em->width  = TILEX - cx * step;
+       g_em->height = TILEY - cy * step;
+
+#if 0
+       printf("::: -> '%s'\n", element_info[effective_element].token_name);
+#endif
+      }
+#endif
+
 #endif
 
       /* create unique graphic identifier to decide if tile must be redrawn */
@@ -6103,6 +6175,38 @@ void InitGraphicInfo_EM(void)
     }
   }
 
+#if 1
+  for (i = 0; i < TILE_MAX; i++)
+  {
+    for (j = 0; j < 8; j++)
+    {
+      int element = object_mapping[i].element_rnd;
+      int action = object_mapping[i].action;
+
+      if (action == ACTION_SMASHED_BY_ROCK &&
+         element_info[element].graphic[action] ==
+         element_info[element].graphic[ACTION_DEFAULT])
+      {
+       /* no separate animation for "smashed by rock" -- use rock instead */
+       struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
+       struct GraphicInfo_EM *g_xx = &graphic_info_em_object[Ystone_s][7 - j];
+
+       g_em->bitmap            = g_xx->bitmap;
+       g_em->src_x             = g_xx->src_x;
+       g_em->src_y             = g_xx->src_y;
+       g_em->src_offset_x      = g_xx->src_offset_x;
+       g_em->src_offset_y      = g_xx->src_offset_y;
+       g_em->dst_offset_x      = g_xx->dst_offset_x;
+       g_em->dst_offset_y      = g_xx->dst_offset_y;
+       g_em->width             = g_xx->width;
+       g_em->height            = g_xx->height;
+
+       g_em->preserve_background = TRUE;
+      }
+    }
+  }
+#endif
+
   for (p = 0; p < 2; p++)
   {
     for (i = 0; i < SPR_MAX; i++)