rnd-20070822-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 22 Aug 2007 20:22:44 +0000 (22:22 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:55:54 +0000 (10:55 +0200)
* fixed problem with broken crumbled graphics after level set changes
  when using R'n'D custom artwork with level sets using the EMC engine

ChangeLog
src/conftime.h
src/engines.h
src/game_em/graphics.c
src/main.h
src/tools.c

index 9c14c0e5b0085fea1c9b65c2eab359847b5c5281..5969c51397391bb68a6a56dfcf5aecf1f2dbacbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-05-07
+       * fixed problem with broken crumbled graphics after level set changes
+         when using R'n'D custom artwork with level sets using the EMC engine
+
 2007-05-07
        * fixed invisible "joysticks deactivated ..." text on setup input screen
 
index 965c66845d97d9e73b650fc7e9bcb17e516765ba..efc5d524c769608daa6fcf42400f69a6ca0381cf 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-05-08 01:19"
+#define COMPILE_DATE_STRING "2007-08-22 22:17"
index d5415f82ae9ab38a36303a40b117adcb9a285008..998a22ca429348cc79fe4b7001fa9afbadb4bb94 100644 (file)
@@ -34,7 +34,8 @@ extern void PlayLevelSound_EM(int, int, int, int);
 extern void InitGraphicInfo_EM(void);
 
 void SetGfxAnimation_EM(int, int, int, int);
-void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *, int, int);
+void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *,
+                                 Bitmap **, int *, int *, int, int);
 void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *);
 
 #endif /* ENGINES_H */
index f33d4db800e610b6f53ead1bb26fd9aee8d6f261..a908126ccc1d142bd65701d91618abcefd7ac415 100644 (file)
@@ -151,6 +151,8 @@ static struct GraphicInfo_EM *getObjectGraphic(int x, int y)
 
   if (!game.use_native_emc_graphics_engine)
     getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y,
+                                &g->crumbled_bitmap,
+                                &g->crumbled_src_x, &g->crumbled_src_y,
                                 x - 2, y - 2);
   return g;
 }
@@ -220,6 +222,13 @@ static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy,
   if (crm == 0)                /* no crumbled edges for this tile */
     return;
 
+#if 0
+  if (x == 3 && y == 3 && frame == 0)
+    printf("::: %d, %d\n",
+          graphic_info_em_object[207][0].crumbled_src_x,
+          graphic_info_em_object[207][0].crumbled_src_y);
+#endif
+
   for (i = 0; i < 4; i++)
   {
     if (crm & (1 << i))
index 2866d903601970bb802d24762d3987058d733751..c191f6ac3e3a685889700bcfffed32211914c62d 100644 (file)
 
 #if CREATE_SPECIAL_EDITION_RND_JUE
 #undef  PROGRAM_TITLE_STRING
-#define PROGRAM_TITLE_STRING           "R'n'D - Version Jue"
+#define PROGRAM_TITLE_STRING           "R'n'D - jue"
 #undef  PROGRAM_UNIX_DATADIR_STRING
 #define PROGRAM_UNIX_DATADIR_STRING    ".rocksndiamonds-jue"
 #endif
index 0522aae07e601f8f0ea0f6b64bca815539cf4091..f593aeda20954a08accc0e65f332ecf1d8ce1be0 100644 (file)
@@ -6042,6 +6042,8 @@ void SetGfxAnimation_EM(int tile, int frame_em, int x, int y)
 
 void getGraphicSourceObjectExt_EM(int tile, int frame_em,
                                  Bitmap **src_bitmap, int *src_x, int *src_y,
+                                 Bitmap **crumbled_src_bitmap,
+                                 int *crumbled_src_x, int *crumbled_src_y,
                                  int x, int y)
 {
   int element         = object_mapping[tile].element_rnd;
@@ -6058,6 +6060,12 @@ void getGraphicSourceObjectExt_EM(int tile, int frame_em,
   int graphic = (direction == MV_NONE ?
                 el_act2img(effective_element, action) :
                 el_act_dir2img(effective_element, action, direction));
+  int crumbled = (direction == MV_NONE ?
+                 el_act2crm(effective_element, action) :
+                 el_act_dir2crm(effective_element, action, direction));
+  int base_graphic = el_act2img(effective_element, ACTION_DEFAULT);
+  int base_crumbled = el_act2crm(effective_element, ACTION_DEFAULT);
+  boolean has_crumbled_graphics = (base_crumbled != base_graphic);
   struct GraphicInfo *g = &graphic_info[graphic];
   int sync_frame;
 
@@ -6093,6 +6101,28 @@ void getGraphicSourceObjectExt_EM(int tile, int frame_em,
                                sync_frame);
 
   getGraphicSourceExt(graphic, frame, src_bitmap, src_x, src_y, FALSE);
+
+#if 0
+  if (x == 1 && y == 1 && frame == 0)
+    printf("--> %d, %d, %d\n", *crumbled_src_x, *crumbled_src_y, tile);
+#endif
+
+#if 0
+  getGraphicSource(crumbled, frame, crumbled_src_bitmap,
+                  crumbled_src_x, crumbled_src_y);
+#endif
+
+#if 0
+  *crumbled_src_bitmap = NULL;
+  *crumbled_src_x = 0;
+  *crumbled_src_y = 0;
+
+  if (has_crumbled_graphics && crumbled != IMG_EMPTY_SPACE)
+  {
+    getGraphicSource(crumbled, frame, crumbled_src_bitmap,
+                    crumbled_src_x, crumbled_src_y);
+  }
+#endif
 }
 
 void getGraphicSourcePlayerExt_EM(int player_nr, int anim, int frame_em,
@@ -6292,6 +6322,7 @@ void InitGraphicInfo_EM(void)
       boolean has_action_graphics = (graphic != base_graphic);
       boolean has_crumbled_graphics = (base_crumbled != base_graphic);
       struct GraphicInfo *g = &graphic_info[graphic];
+      struct GraphicInfo *g_crumbled = &graphic_info[crumbled];
       struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
       Bitmap *src_bitmap;
       int src_x, src_y;
@@ -6444,17 +6475,43 @@ void InitGraphicInfo_EM(void)
 #endif
 
       /* if element can be crumbled, but certain action graphics are just empty
-        space (like snapping sand with the original R'n'D graphics), do not
+        space (like instantly snapping sand to empty space in 1 frame), do not
         treat these empty space graphics as crumbled graphics in EMC engine */
       if (has_crumbled_graphics && crumbled != IMG_EMPTY_SPACE)
       {
-       getGraphicSource(crumbled, frame, &src_bitmap, &src_x, &src_y);
+       int frame_crumbled = getAnimationFrame(g_crumbled->anim_frames,
+                                              g_crumbled->anim_delay,
+                                              g_crumbled->anim_mode,
+                                              g_crumbled->anim_start_frame,
+                                              sync_frame);
+
+       getGraphicSource(crumbled, frame_crumbled, &src_bitmap, &src_x, &src_y);
 
        g_em->has_crumbled_graphics = TRUE;
        g_em->crumbled_bitmap = src_bitmap;
        g_em->crumbled_src_x = src_x;
        g_em->crumbled_src_y = src_y;
        g_em->crumbled_border_size = graphic_info[crumbled].border_size;
+
+
+#if 0
+       if (g_em == &graphic_info_em_object[207][0])
+         printf("... %d, %d [%d, %d, %d, %d] [%d, %d, %d, %d, %d, %d => %d]\n",
+                graphic_info_em_object[207][0].crumbled_src_x,
+                graphic_info_em_object[207][0].crumbled_src_y,
+
+                crumbled, frame, src_x, src_y,
+
+                g->anim_frames,
+                g->anim_delay,
+                g->anim_mode,
+                g->anim_start_frame,
+                sync_frame,
+                gfx.anim_random_frame,
+                frame);
+#endif
+
+
       }
 
 #if 0