rnd-20030509-1-src
authorHolger Schemel <info@artsoft.org>
Fri, 9 May 2003 21:15:47 +0000 (23:15 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:41:48 +0000 (10:41 +0200)
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/main.h
src/tools.c

index 868fb084a3f80ba5ae8391c46426caf4dbb2ef35..0c98764c8336ab3b8b1b7b1717b8f37cad5a675d 100644 (file)
@@ -959,7 +959,7 @@ struct ConfigInfo image_config[] =
   { "amoeba.shrinking.ypos",                   "6"                     },
   { "amoeba.shrinking.frames",                 "3"                     },
   { "amoeba.shrinking.delay",                  "2"                     },
-  { "amoeba.shrinking.anim_mode",              "loop,linear,reverse"   },
+  { "amoeba.shrinking.anim_mode",              "linear,reverse"        },
   { "amoeba_wet",                              "RocksElements.pcx"     },
   { "amoeba_wet.xpos",                         "8"                     },
   { "amoeba_wet.ypos",                         "6"                     },
@@ -3345,6 +3345,10 @@ struct ConfigInfo image_config[] =
   { "editor.element_border.xpos",              "0"                     },
   { "editor.element_border.ypos",              "0"                     },
 
+  { "editor.element_border_input",             "RocksElements.pcx"     },
+  { "editor.element_border_input.xpos",                "0"                     },
+  { "editor.element_border_input.ypos",                "0"                     },
+
   { "background",                              UNDEFINED_FILENAME      },
   { "background.MAIN",                         UNDEFINED_FILENAME      },
   { "background.LEVELS",                       UNDEFINED_FILENAME      },
index b24103bdaef8c04c079a40aaab73f91ec9c8970c..32ca0562568e20e75acf8f426bca63a83648d649 100644 (file)
 #define IMG_GLOBAL_BORDER                              861
 #define IMG_GLOBAL_DOOR                                        862
 #define IMG_EDITOR_ELEMENT_BORDER                      863
-#define IMG_BACKGROUND                                 864
-#define IMG_BACKGROUND_MAIN                            865
-#define IMG_BACKGROUND_LEVELS                          866
-#define IMG_BACKGROUND_SCORES                          867
-#define IMG_BACKGROUND_EDITOR                          868
-#define IMG_BACKGROUND_INFO                            869
-#define IMG_BACKGROUND_SETUP                           870
-#define IMG_BACKGROUND_DOOR                            871
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        864
+#define IMG_BACKGROUND                                 865
+#define IMG_BACKGROUND_MAIN                            866
+#define IMG_BACKGROUND_LEVELS                          867
+#define IMG_BACKGROUND_SCORES                          868
+#define IMG_BACKGROUND_EDITOR                          869
+#define IMG_BACKGROUND_INFO                            870
+#define IMG_BACKGROUND_SETUP                           871
+#define IMG_BACKGROUND_DOOR                            872
 
-#define NUM_IMAGE_FILES                                        872
+#define NUM_IMAGE_FILES                                        873
 
 #endif /* CONF_GFX_H */
index 261aacbf7f3363b41528249a8aa083b4eddd4cff..33e3efedffc53cfcd0855d775aaf6c5bc507b36d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-05-07 23:10]"
+#define COMPILE_DATE_STRING "[2003-05-09 23:12]"
index 8e326ea29e5fe32324bbf40c97b7f8aabaacc448..7324819387f808b5c364ec825789e4c5e16eaccc 100644 (file)
 #define ED_AREA_ELEM_CONTENT2_YPOS     (ED_COUNTER_YPOS2(5) + \
                                         ED_GADGET_DISTANCE)
 
+#define ED_AREA_ELEM_CONTENT3_XPOS     (24 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT3_YPOS     (ED_COUNTER_YPOS2(6) + \
+                                        ED_GADGET_DISTANCE)
+
 /* values for random placement background drawing area */
 #define ED_AREA_RANDOM_BACKGROUND_XPOS (29 * MINI_TILEX)
 #define ED_AREA_RANDOM_BACKGROUND_YPOS (31 * MINI_TILEY)
 #define GADGET_ID_CUSTOM_WALKABLE_OVER (GADGET_ID_CHECKBUTTON_FIRST + 15)
 #define GADGET_ID_CUSTOM_WALKABLE_INSIDE (GADGET_ID_CHECKBUTTON_FIRST+ 16)
 #define GADGET_ID_CUSTOM_WALKABLE_UNDER        (GADGET_ID_CHECKBUTTON_FIRST + 17)
-#define GADGET_ID_CUSTOM_CHANGEABLE    (GADGET_ID_CHECKBUTTON_FIRST + 18)
-#define GADGET_ID_CHANGE_DELAY_FIXED   (GADGET_ID_CHECKBUTTON_FIRST + 19)
-#define GADGET_ID_CHANGE_DELAY_RANDOM  (GADGET_ID_CHECKBUTTON_FIRST + 20)
+#define GADGET_ID_CUSTOM_USE_GRAPHIC   (GADGET_ID_CHECKBUTTON_FIRST + 18)
+#define GADGET_ID_CUSTOM_CHANGEABLE    (GADGET_ID_CHECKBUTTON_FIRST + 19)
+#define GADGET_ID_CHANGE_DELAY_FIXED   (GADGET_ID_CHECKBUTTON_FIRST + 20)
+#define GADGET_ID_CHANGE_DELAY_RANDOM  (GADGET_ID_CHECKBUTTON_FIRST + 21)
 
 /* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST    (GADGET_ID_CHECKBUTTON_FIRST + 21)
+#define GADGET_ID_ELEMENTLIST_FIRST    (GADGET_ID_CHECKBUTTON_FIRST + 22)
 #define GADGET_ID_ELEMENTLIST_LAST     (GADGET_ID_ELEMENTLIST_FIRST +  \
                                        ED_NUM_ELEMENTLIST_BUTTONS - 1)
 
 #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_OVER 13
 #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_INSIDE 14
 #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_UNDER        15
-#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE    16
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED   17
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM  18
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC   16
+#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE    17
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED   18
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM  19
 
-#define ED_NUM_CHECKBUTTONS                    19
+#define ED_NUM_CHECKBUTTONS                    20
 
 #define ED_CHECKBUTTON_ID_LEVEL_FIRST  ED_CHECKBUTTON_ID_DOUBLE_SPEED
 #define ED_CHECKBUTTON_ID_LEVEL_LAST   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
 
 #define ED_CHECKBUTTON_ID_CUSTOM_FIRST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
-#define ED_CHECKBUTTON_ID_CUSTOM_LAST  ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_UNDER
+#define ED_CHECKBUTTON_ID_CUSTOM_LAST  ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
 
 #define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE
 #define ED_CHECKBUTTON_ID_CHANGE_LAST  ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM
@@ -580,7 +586,7 @@ static boolean random_placement_background_restricted = FALSE;
 static boolean stick_element_properties_window = FALSE;
 static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES];
 static boolean custom_element_change_events[NUM_CHANGE_EVENTS];
-static struct CustomElementChangeInfo custom_element_change;
+static struct CustomElementInfo custom_element;
 
 static struct
 {
@@ -669,7 +675,7 @@ static struct
     0,                                 999,
     GADGET_ID_CHANGE_DELAY_FIX_DOWN,   GADGET_ID_CHANGE_DELAY_FIX_UP,
     GADGET_ID_CHANGE_DELAY_FIX_TEXT,
-    &custom_element_change.delay_fixed,
+    &custom_element.change.delay_fixed,
     NULL,                              "units (fixed)"
   },
   {
@@ -677,7 +683,7 @@ static struct
     0,                                 999,
     GADGET_ID_CHANGE_DELAY_RND_DOWN,   GADGET_ID_CHANGE_DELAY_RND_UP,
     GADGET_ID_CHANGE_DELAY_RND_TEXT,
-    &custom_element_change.delay_random,
+    &custom_element.change.delay_random,
     NULL,                              "units (random)"
   }
 };
@@ -741,7 +747,7 @@ static struct
     GADGET_ID_CHANGE_TIME_UNITS,
     0,
     options_change_time_units, &index_change_time_units,
-    &custom_element_change.delay_frames,
+    &custom_element.change.delay_frames,
     "delay units given in", "time units for change"
   },
   {
@@ -930,71 +936,77 @@ static struct
     "slip down from certain flat walls","use EM style slipping behaviour"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(6),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(7),
     GADGET_ID_CUSTOM_INDESTRUCTIBLE,
     &custom_element_properties[EP_INDESTRUCTIBLE],
     "indestructible",                  "element cannot be destroyed"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(7),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(8),
     GADGET_ID_CUSTOM_DIGGABLE,
     &custom_element_properties[EP_DIGGABLE],
     "diggable",                                "element can be digged away"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(8),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(9),
     GADGET_ID_CUSTOM_COLLECTIBLE,
     &custom_element_properties[EP_COLLECTIBLE],
     "collectible",                     "element can be collected"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(9),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(10),
     GADGET_ID_CUSTOM_PUSHABLE,
     &custom_element_properties[EP_PUSHABLE],
     "pushable",                                "element can be pushed"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(10),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(11),
     GADGET_ID_CUSTOM_CAN_FALL,
     &custom_element_properties[EP_CAN_FALL],
     "can fall",                                "element can fall down"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(11),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(12),
     GADGET_ID_CUSTOM_CAN_SMASH,
     &custom_element_properties[EP_CAN_SMASH],
     "can smash",                       "element can smash other elements"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(12),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(13),
     GADGET_ID_CUSTOM_CAN_MOVE,
     &custom_element_properties[EP_CAN_MOVE],
     "can move",                                "element can move in some direction"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(13),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(14),
     GADGET_ID_CUSTOM_SLIPPERY,
     &custom_element_properties[EP_SLIPPERY],
     "slippery",                                "other elements can fall down from it"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(14),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(15),
     GADGET_ID_CUSTOM_WALKABLE_OVER,
     &custom_element_properties[EP_WALKABLE_OVER],
     "player can walk over",            "player can walk over this element"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(15),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(16),
     GADGET_ID_CUSTOM_WALKABLE_INSIDE,
     &custom_element_properties[EP_WALKABLE_INSIDE],
     "player can walk inside",          "player can walk inside this element"
   },
   {
-    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(16),
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(17),
     GADGET_ID_CUSTOM_WALKABLE_UNDER,
     &custom_element_properties[EP_WALKABLE_UNDER],
     "player can walk under",           "player can walk under this element"
   },
+  {
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(6),
+    GADGET_ID_CUSTOM_USE_GRAPHIC,
+    &custom_element.use_gfx_element,
+    "use graphic of element:",         "use optional custom graphic element"
+  },
   {
     ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS2(5),
     GADGET_ID_CUSTOM_CHANGEABLE,
@@ -1048,6 +1060,7 @@ static void ModifyEditorElementList();
 static void DrawDrawingWindow();
 static void DrawLevelInfoWindow();
 static void DrawPropertiesWindow();
+static boolean checkPropertiesConfig();
 static void CopyLevelToUndoBuffer(int);
 static void HandleDrawingAreas(struct GadgetInfo *);
 static void HandleCounterButtons(struct GadgetInfo *);
@@ -2400,12 +2413,12 @@ static void CreateDrawingAreas()
   /* ... one for each custom element optional graphic element ... */
   id = GADGET_ID_CUSTOM_GRAPHIC;
   gi = CreateGadget(GDI_CUSTOM_ID, id,
-                   GDI_X, SX + 2 * MINI_TILEX,
-                   GDI_Y, SY + 4 * MINI_TILEY + MINI_TILEY / 2,
-                   GDI_WIDTH, TILEX,
-                   GDI_HEIGHT, TILEY,
+                   GDI_X, SX + ED_AREA_ELEM_CONTENT3_XPOS,
+                   GDI_Y, SY + ED_AREA_ELEM_CONTENT3_YPOS,
+                   GDI_WIDTH, MINI_TILEX,
+                   GDI_HEIGHT, MINI_TILEY,
                    GDI_TYPE, GD_TYPE_DRAWING_AREA,
-                   GDI_ITEM_SIZE, TILEX, TILEY,
+                   GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
                    GDI_EVENT_MASK, event_mask,
                    GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
                    GDI_CALLBACK_ACTION, HandleDrawingAreas,
@@ -2976,7 +2989,7 @@ static void CopyCustomElementPropertiesToEditor(int element)
   int i;
 
   i = properties_element - EL_CUSTOM_START;
-  custom_element_change = level.custom_element[i].change;
+  custom_element = level.custom_element[i];
 
   for (i=0; i < NUM_ELEMENT_PROPERTIES; i++)
     custom_element_properties[i] = HAS_PROPERTY(element, i);
@@ -2990,7 +3003,7 @@ static void CopyCustomElementPropertiesToGame(int element)
   int i;
 
   i = properties_element - EL_CUSTOM_START;
-  level.custom_element[i].change = custom_element_change;
+  level.custom_element[i] = custom_element;
 
   for (i=0; i < NUM_ELEMENT_PROPERTIES; i++)
     SET_PROPERTY(element, i, custom_element_properties[i]);
@@ -3000,7 +3013,7 @@ static void CopyCustomElementPropertiesToGame(int element)
 
   /* copy change events also to special level editor variable */
   i = properties_element - EL_CUSTOM_START;
-  custom_element_change = level.custom_element[i].change;
+  custom_element = level.custom_element[i];
 }
 
 void DrawLevelEd()
@@ -3276,9 +3289,11 @@ static void DrawDrawingWindow()
   MapMainDrawingArea();
 }
 
-static void DrawElementBorder(int dest_x, int dest_y, int width, int height)
+static void DrawElementBorder(int dest_x, int dest_y, int width, int height,
+                             boolean input)
 {
-  int border_graphic = IMG_EDITOR_ELEMENT_BORDER;
+  int border_graphic =
+    (input ? IMG_EDITOR_ELEMENT_BORDER_INPUT : IMG_EDITOR_ELEMENT_BORDER);
   Bitmap *src_bitmap;
   int src_x, src_y;
   int num_mini_tilex = width / MINI_TILEX + 1;
@@ -3305,7 +3320,7 @@ static void DrawRandomPlacementBackgroundArea()
 
   ElementContent[0][0][0] = random_placement_background_element;
 
-  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY);
+  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE);
   DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
 
   MapDrawingArea(GADGET_ID_RANDOM_BACKGROUND);
@@ -3413,7 +3428,7 @@ static void DrawAmoebaContentArea()
 
   ElementContent[0][0][0] = level.amoeba_content;
 
-  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY);
+  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE);
   DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
 
   DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba", FONT_TEXT_1);
@@ -3421,6 +3436,53 @@ static void DrawAmoebaContentArea()
   MapDrawingArea(GADGET_ID_AMOEBA_CONTENT);
 }
 
+static void DrawCustomGraphicElementArea()
+{
+  struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_GRAPHIC];
+#if 0
+  int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE;
+  int yoffset_right2 = ED_BORDER_SIZE;
+  int i = ED_CHECKBUTTON_ID_CUSTOM_GRAPHIC;
+  int text_len = strlen(checkbutton_info[i].text);
+  int text_width = text_len * getFontWidth(FONT_TEXT_1);
+  int xpos = checkbutton_info[i].x + 2 * xoffset_right2 + text_width;
+  int ypos = checkbutton_info[i].y + yoffset_right2;
+#else
+  int xpos = ED_AREA_ELEM_CONTENT3_XPOS;
+  int ypos = ED_AREA_ELEM_CONTENT3_YPOS;
+#endif
+  int area_x = xpos / MINI_TILEX;
+  int area_y = ypos / MINI_TILEY;
+  int area_sx = SX + xpos;
+  int area_sy = SY + ypos;
+
+  if (!IS_CUSTOM_ELEMENT(properties_element))
+  {
+    /* this should never happen */
+    Error(ERR_WARN, "element %d is no custom element", properties_element);
+
+    return;
+  }
+
+  ElementContent[0][0][0] = custom_element.gfx_element;
+
+  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE);
+#if 1
+  DrawMiniGraphicExt(drawto,
+                    gi->x,
+                    gi->y,
+                    el2edimg(ElementContent[0][0][0]));
+#else
+  DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
+#endif
+
+#if 0
+  DrawText(area_sx + TILEX, area_sy + 1, "Element after change", FONT_TEXT_1);
+#endif
+
+  MapDrawingArea(GADGET_ID_CUSTOM_GRAPHIC);
+}
+
 static void DrawCustomChangedArea()
 {
   struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CHANGED];
@@ -3449,9 +3511,9 @@ static void DrawCustomChangedArea()
     return;
   }
 
-  ElementContent[0][0][0] = custom_element_change.successor;
+  ElementContent[0][0][0] = custom_element.change.successor;
 
-  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY);
+  DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE);
 #if 1
   DrawMiniGraphicExt(drawto,
                     gi->x,
@@ -3501,7 +3563,7 @@ static void DrawElementContentAreas()
   for (i=0; i<level.num_yam_contents; i++)
     DrawElementBorder(area_sx + 5 * (i % 4) * MINI_TILEX,
                      area_sy + 6 * (i / 4) * MINI_TILEY,
-                     3 * MINI_TILEX, 3 * MINI_TILEY);
+                     3 * MINI_TILEX, 3 * MINI_TILEY, TRUE);
 
   DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
           "Content", FONT_TEXT_1);
@@ -3526,189 +3588,6 @@ static void DrawElementContentAreas()
     MapDrawingArea(GADGET_ID_ELEMENT_CONTENT_0 + i);
 }
 
-#define TEXT_COLLECTING                "Score for collecting"
-#define TEXT_SMASHING          "Score for smashing"
-#define TEXT_CRACKING          "Score for cracking"
-#define TEXT_SPEED             "Speed of amoeba growth"
-#define TEXT_DURATION          "Duration when activated"
-
-static struct
-{
-  int element;
-  int *value;
-  char *text;
-} elements_with_counter[] =
-{
-  { EL_EMERALD,                &level.score[SC_EMERALD],       TEXT_COLLECTING },
-  { EL_BD_DIAMOND,     &level.score[SC_EMERALD],       TEXT_COLLECTING },
-  { EL_EMERALD_YELLOW, &level.score[SC_EMERALD],       TEXT_COLLECTING },
-  { EL_EMERALD_RED,    &level.score[SC_EMERALD],       TEXT_COLLECTING },
-  { EL_EMERALD_PURPLE, &level.score[SC_EMERALD],       TEXT_COLLECTING },
-  { EL_DIAMOND,                &level.score[SC_DIAMOND],       TEXT_COLLECTING },
-  { EL_BUG_RIGHT,      &level.score[SC_BUG],           TEXT_SMASHING   },
-  { EL_BUG_UP,         &level.score[SC_BUG],           TEXT_SMASHING   },
-  { EL_BUG_LEFT,       &level.score[SC_BUG],           TEXT_SMASHING   },
-  { EL_BUG_DOWN,       &level.score[SC_BUG],           TEXT_SMASHING   },
-  { EL_BD_BUTTERFLY_RIGHT,&level.score[SC_BUG],                TEXT_SMASHING   },
-  { EL_BD_BUTTERFLY_UP,   &level.score[SC_BUG],                TEXT_SMASHING   },
-  { EL_BD_BUTTERFLY_LEFT, &level.score[SC_BUG],                TEXT_SMASHING   },
-  { EL_BD_BUTTERFLY_DOWN, &level.score[SC_BUG],                TEXT_SMASHING   },
-  { EL_SPACESHIP_RIGHT,        &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
-  { EL_SPACESHIP_UP,   &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
-  { EL_SPACESHIP_LEFT, &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
-  { EL_SPACESHIP_DOWN, &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
-  { EL_BD_FIREFLY_RIGHT,&level.score[SC_SPACESHIP],    TEXT_SMASHING   },
-  { EL_BD_FIREFLY_UP,  &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
-  { EL_BD_FIREFLY_LEFT, &level.score[SC_SPACESHIP],    TEXT_SMASHING   },
-  { EL_BD_FIREFLY_DOWN, &level.score[SC_SPACESHIP],    TEXT_SMASHING   },
-  { EL_YAMYAM,         &level.score[SC_YAMYAM],        TEXT_SMASHING   },
-  { EL_DARK_YAMYAM,    &level.score[SC_YAMYAM],        TEXT_SMASHING   },
-  { EL_ROBOT,          &level.score[SC_ROBOT],         TEXT_SMASHING   },
-  { EL_PACMAN_RIGHT,   &level.score[SC_PACMAN],        TEXT_SMASHING   },
-  { EL_PACMAN_UP,      &level.score[SC_PACMAN],        TEXT_SMASHING   },
-  { EL_PACMAN_LEFT,    &level.score[SC_PACMAN],        TEXT_SMASHING   },
-  { EL_PACMAN_DOWN,    &level.score[SC_PACMAN],        TEXT_SMASHING   },
-  { EL_NUT,            &level.score[SC_NUT],           TEXT_CRACKING   },
-  { EL_DYNAMITE,       &level.score[SC_DYNAMITE],      TEXT_COLLECTING },
-  { EL_KEY_1,          &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_KEY_2,          &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_KEY_3,          &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_KEY_4,          &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_EM_KEY_1_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_EM_KEY_2_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_EM_KEY_3_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_EM_KEY_4_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
-  { EL_AMOEBA_WET,     &level.amoeba_speed,            TEXT_SPEED      },
-  { EL_AMOEBA_DRY,     &level.amoeba_speed,            TEXT_SPEED      },
-  { EL_AMOEBA_FULL,    &level.amoeba_speed,            TEXT_SPEED      },
-  { EL_BD_AMOEBA,      &level.amoeba_speed,            TEXT_SPEED      },
-  { EL_MAGIC_WALL,     &level.time_magic_wall,         TEXT_DURATION   },
-  { EL_ROBOT_WHEEL,    &level.time_wheel,              TEXT_DURATION   },
-  { -1,                        NULL,                           NULL            }
-};
-
-static boolean checkPropertiesConfig()
-{
-  int i;
-
-  if (IS_GEM(properties_element) ||
-      IS_CUSTOM_ELEMENT(properties_element) ||
-      HAS_CONTENT(properties_element))
-    return TRUE;
-  else
-    for (i=0; elements_with_counter[i].element != -1; i++)
-      if (elements_with_counter[i].element == properties_element)
-       return TRUE;
-
-  return FALSE;
-}
-
-static void DrawPropertiesConfig()
-{
-  boolean element_has_score = FALSE;
-  char *element_score_text = NULL;
-  static int temporary_dummy_score = 0;
-  int counter_id = ED_COUNTER_ID_ELEMENT_SCORE;
-  int xoffset_right = getCounterGadgetWidth();
-  int yoffset_right = ED_BORDER_SIZE;
-  int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE;
-  int yoffset_right2 = ED_BORDER_SIZE;
-  int i, x, y;
-
-  /* check if there are elements where a score can be chosen for */
-  for (i=0; elements_with_counter[i].element != -1; i++)
-  {
-    if (elements_with_counter[i].element == properties_element)
-    {
-#if 1
-      counterbutton_info[counter_id].value = elements_with_counter[i].value;
-      element_score_text = elements_with_counter[i].text;
-      element_has_score = TRUE;
-#else
-      int x = counterbutton_info[counter_id].x + xoffset_right;
-      int y = counterbutton_info[counter_id].y + yoffset_right;
-
-      counterbutton_info[counter_id].value = elements_with_counter[i].value;
-      DrawTextF(x, y, FONT_TEXT_1, elements_with_counter[i].text);
-
-      ModifyEditorCounter(counter_id,  *counterbutton_info[counter_id].value);
-      MapCounterButtons(counter_id);
-#endif
-      break;
-    }
-  }
-
-  if (IS_CUSTOM_ELEMENT(properties_element))
-  {
-    counterbutton_info[counter_id].value = &temporary_dummy_score;
-    element_score_text = "Score for certain actions";
-    element_has_score = TRUE;
-  }
-
-  if (element_has_score)
-  {
-    int x = counterbutton_info[counter_id].x + xoffset_right;
-    int y = counterbutton_info[counter_id].y + yoffset_right;
-
-    DrawTextF(x, y, FONT_TEXT_1, element_score_text);
-
-    ModifyEditorCounter(counter_id,  *counterbutton_info[counter_id].value);
-    MapCounterButtons(counter_id);
-  }
-
-  if (HAS_CONTENT(properties_element))
-  {
-    /* draw stickybutton gadget */
-    i = ED_CHECKBUTTON_ID_STICK_ELEMENT;
-    checkbutton_info[i].y = ED_COUNTER_YPOS(4);
-    x = checkbutton_info[i].x + xoffset_right2;
-    y = checkbutton_info[i].y + yoffset_right2;
-
-    DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
-    ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
-                GDI_CHECKED, *checkbutton_info[i].value,
-                GDI_Y, SY + checkbutton_info[i].y, GDI_END);
-    MapCheckbuttonGadget(i);
-
-    if (HAS_CONTENT(properties_element))
-    {
-      if (IS_AMOEBOID(properties_element))
-       DrawAmoebaContentArea();
-      else
-       DrawElementContentAreas();
-    }
-  }
-
-  if (IS_GEM(properties_element))
-  {
-    /* draw checkbutton gadget */
-    i = ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS;
-    x = checkbutton_info[i].x + xoffset_right2;
-    y = checkbutton_info[i].y + yoffset_right2;
-
-    DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
-    ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
-                GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
-    MapCheckbuttonGadget(i);
-  }
-
-  if (IS_CUSTOM_ELEMENT(properties_element))
-  {
-    /* draw checkbutton gadgets */
-    for (i =  ED_CHECKBUTTON_ID_CUSTOM_FIRST;
-        i <= ED_CHECKBUTTON_ID_CUSTOM_LAST; i++)
-    {
-      x = checkbutton_info[i].x + xoffset_right2;
-      y = checkbutton_info[i].y + yoffset_right2;
-
-      DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
-      ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
-                  GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
-      MapCheckbuttonGadget(i);
-    }
-  }
-}
-
 char *getElementDescriptionFilename(int element)
 {
   char *docs_dir = options.docs_directory;
@@ -4021,6 +3900,192 @@ static void DrawPropertiesInfo()
     PrintInfoText("No description available.", FONT_TEXT_1, screen_line);
 }
 
+#define TEXT_COLLECTING                "Score for collecting"
+#define TEXT_SMASHING          "Score for smashing"
+#define TEXT_CRACKING          "Score for cracking"
+#define TEXT_SPEED             "Speed of amoeba growth"
+#define TEXT_DURATION          "Duration when activated"
+
+static struct
+{
+  int element;
+  int *value;
+  char *text;
+} elements_with_counter[] =
+{
+  { EL_EMERALD,                &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_BD_DIAMOND,     &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_EMERALD_YELLOW, &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_EMERALD_RED,    &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_EMERALD_PURPLE, &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_DIAMOND,                &level.score[SC_DIAMOND],       TEXT_COLLECTING },
+  { EL_BUG_RIGHT,      &level.score[SC_BUG],           TEXT_SMASHING   },
+  { EL_BUG_UP,         &level.score[SC_BUG],           TEXT_SMASHING   },
+  { EL_BUG_LEFT,       &level.score[SC_BUG],           TEXT_SMASHING   },
+  { EL_BUG_DOWN,       &level.score[SC_BUG],           TEXT_SMASHING   },
+  { EL_BD_BUTTERFLY_RIGHT,&level.score[SC_BUG],                TEXT_SMASHING   },
+  { EL_BD_BUTTERFLY_UP,   &level.score[SC_BUG],                TEXT_SMASHING   },
+  { EL_BD_BUTTERFLY_LEFT, &level.score[SC_BUG],                TEXT_SMASHING   },
+  { EL_BD_BUTTERFLY_DOWN, &level.score[SC_BUG],                TEXT_SMASHING   },
+  { EL_SPACESHIP_RIGHT,        &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
+  { EL_SPACESHIP_UP,   &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
+  { EL_SPACESHIP_LEFT, &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
+  { EL_SPACESHIP_DOWN, &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
+  { EL_BD_FIREFLY_RIGHT,&level.score[SC_SPACESHIP],    TEXT_SMASHING   },
+  { EL_BD_FIREFLY_UP,  &level.score[SC_SPACESHIP],     TEXT_SMASHING   },
+  { EL_BD_FIREFLY_LEFT, &level.score[SC_SPACESHIP],    TEXT_SMASHING   },
+  { EL_BD_FIREFLY_DOWN, &level.score[SC_SPACESHIP],    TEXT_SMASHING   },
+  { EL_YAMYAM,         &level.score[SC_YAMYAM],        TEXT_SMASHING   },
+  { EL_DARK_YAMYAM,    &level.score[SC_YAMYAM],        TEXT_SMASHING   },
+  { EL_ROBOT,          &level.score[SC_ROBOT],         TEXT_SMASHING   },
+  { EL_PACMAN_RIGHT,   &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_PACMAN_UP,      &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_PACMAN_LEFT,    &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_PACMAN_DOWN,    &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_NUT,            &level.score[SC_NUT],           TEXT_CRACKING   },
+  { EL_DYNAMITE,       &level.score[SC_DYNAMITE],      TEXT_COLLECTING },
+  { EL_KEY_1,          &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_KEY_2,          &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_KEY_3,          &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_KEY_4,          &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_EM_KEY_1_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_EM_KEY_2_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_EM_KEY_3_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_EM_KEY_4_FILE,  &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_AMOEBA_WET,     &level.amoeba_speed,            TEXT_SPEED      },
+  { EL_AMOEBA_DRY,     &level.amoeba_speed,            TEXT_SPEED      },
+  { EL_AMOEBA_FULL,    &level.amoeba_speed,            TEXT_SPEED      },
+  { EL_BD_AMOEBA,      &level.amoeba_speed,            TEXT_SPEED      },
+  { EL_MAGIC_WALL,     &level.time_magic_wall,         TEXT_DURATION   },
+  { EL_ROBOT_WHEEL,    &level.time_wheel,              TEXT_DURATION   },
+  { -1,                        NULL,                           NULL            }
+};
+
+static boolean checkPropertiesConfig()
+{
+  int i;
+
+  if (IS_GEM(properties_element) ||
+      IS_CUSTOM_ELEMENT(properties_element) ||
+      HAS_CONTENT(properties_element))
+    return TRUE;
+  else
+    for (i=0; elements_with_counter[i].element != -1; i++)
+      if (elements_with_counter[i].element == properties_element)
+       return TRUE;
+
+  return FALSE;
+}
+
+static void DrawPropertiesConfig()
+{
+  boolean element_has_score = FALSE;
+  char *element_score_text = NULL;
+  static int temporary_dummy_score = 0;
+  int counter_id = ED_COUNTER_ID_ELEMENT_SCORE;
+  int xoffset_right = getCounterGadgetWidth();
+  int yoffset_right = ED_BORDER_SIZE;
+  int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE;
+  int yoffset_right2 = ED_BORDER_SIZE;
+  int i, x, y;
+
+  /* check if there are elements where a score can be chosen for */
+  for (i=0; elements_with_counter[i].element != -1; i++)
+  {
+    if (elements_with_counter[i].element == properties_element)
+    {
+#if 1
+      counterbutton_info[counter_id].value = elements_with_counter[i].value;
+      element_score_text = elements_with_counter[i].text;
+      element_has_score = TRUE;
+#else
+      int x = counterbutton_info[counter_id].x + xoffset_right;
+      int y = counterbutton_info[counter_id].y + yoffset_right;
+
+      counterbutton_info[counter_id].value = elements_with_counter[i].value;
+      DrawTextF(x, y, FONT_TEXT_1, elements_with_counter[i].text);
+
+      ModifyEditorCounter(counter_id,  *counterbutton_info[counter_id].value);
+      MapCounterButtons(counter_id);
+#endif
+      break;
+    }
+  }
+
+  if (IS_CUSTOM_ELEMENT(properties_element))
+  {
+    counterbutton_info[counter_id].value = &temporary_dummy_score;
+    element_score_text = "Score for certain actions";
+    element_has_score = TRUE;
+  }
+
+  if (element_has_score)
+  {
+    int x = counterbutton_info[counter_id].x + xoffset_right;
+    int y = counterbutton_info[counter_id].y + yoffset_right;
+
+    DrawTextF(x, y, FONT_TEXT_1, element_score_text);
+
+    ModifyEditorCounter(counter_id,  *counterbutton_info[counter_id].value);
+    MapCounterButtons(counter_id);
+  }
+
+  if (HAS_CONTENT(properties_element) ||
+      IS_CUSTOM_ELEMENT(properties_element))
+  {
+    /* draw stickybutton gadget */
+    i = ED_CHECKBUTTON_ID_STICK_ELEMENT;
+    if (HAS_CONTENT(properties_element))
+      checkbutton_info[i].y = ED_COUNTER_YPOS(4);
+    else
+      checkbutton_info[i].y = ED_COUNTER_YPOS2(5);
+    x = checkbutton_info[i].x + xoffset_right2;
+    y = checkbutton_info[i].y + yoffset_right2;
+
+    DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
+    ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
+                GDI_CHECKED, *checkbutton_info[i].value,
+                GDI_Y, SY + checkbutton_info[i].y, GDI_END);
+    MapCheckbuttonGadget(i);
+
+    if (IS_CUSTOM_ELEMENT(properties_element))
+      DrawCustomGraphicElementArea();
+    else if (IS_AMOEBOID(properties_element))
+      DrawAmoebaContentArea();
+    else
+      DrawElementContentAreas();
+  }
+
+  if (IS_GEM(properties_element))
+  {
+    /* draw checkbutton gadget */
+    i = ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS;
+    x = checkbutton_info[i].x + xoffset_right2;
+    y = checkbutton_info[i].y + yoffset_right2;
+
+    DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
+    ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
+                GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
+    MapCheckbuttonGadget(i);
+  }
+
+  if (IS_CUSTOM_ELEMENT(properties_element))
+  {
+    /* draw checkbutton gadgets */
+    for (i =  ED_CHECKBUTTON_ID_CUSTOM_FIRST;
+        i <= ED_CHECKBUTTON_ID_CUSTOM_LAST; i++)
+    {
+      x = checkbutton_info[i].x + xoffset_right2;
+      y = checkbutton_info[i].y + yoffset_right2;
+
+      DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text);
+      ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
+                  GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
+      MapCheckbuttonGadget(i);
+    }
+  }
+}
+
 static void DrawPropertiesAdvanced()
 {
   char infotext[MAX_OUTPUT_LINESIZE + 1];
@@ -4073,11 +4138,6 @@ static void DrawPropertiesAdvanced()
     MapCheckbuttonGadget(i);
   }
 
-  /* map gadget for optional graphic element */
-  MapDrawingArea(GADGET_ID_CUSTOM_GRAPHIC);
-
-  DrawCustomChangedArea();
-
   /* draw selectbox gadgets */
   for (i=ED_SELECTBOX_ID_CHANGE_FIRST; i<=ED_SELECTBOX_ID_CHANGE_LAST; i++)
   {
@@ -4095,6 +4155,8 @@ static void DrawPropertiesAdvanced()
 #endif
     MapSelectboxGadget(i);
   }
+
+  DrawCustomChangedArea();
 }
 
 static void DrawPropertiesWindow()
@@ -4124,7 +4186,7 @@ static void DrawPropertiesWindow()
 
   DrawElementBorder(SX + xstart * MINI_TILEX,
                    SY + ystart * MINI_TILEY + MINI_TILEY / 2,
-                   TILEX, TILEY);
+                   TILEX, TILEY, FALSE);
   DrawGraphicAnimationExt(drawto,
                          SX + xstart * MINI_TILEX,
                          SY + ystart * MINI_TILEY + MINI_TILEY / 2,
@@ -4876,28 +4938,24 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
 
        if (id == GADGET_ID_AMOEBA_CONTENT)
          level.amoeba_content = new_element;
-       else if (id == GADGET_ID_CUSTOM_GRAPHIC &&
-                IS_CUSTOM_ELEMENT(properties_element))
+       else if (id == GADGET_ID_CUSTOM_GRAPHIC)
        {
          int i = properties_element - EL_CUSTOM_START;
 
-         if (IS_CUSTOM_ELEMENT(new_element))
-           new_element = CUSTOM_ELEMENT_INFO(new_element).change.gfx_element;
-
-         custom_element_change.gfx_element = new_element;
-         level.custom_element[i].change = custom_element_change;
+         new_element = GFX_ELEMENT(new_element);
+         custom_element.gfx_element = new_element;
+         level.custom_element[i] = custom_element;
 
          ModifyEditorElementList();
 
          FrameCounter = 0;     /* restart animation frame counter */
        }
-       else if (id == GADGET_ID_CUSTOM_CHANGED &&
-                IS_CUSTOM_ELEMENT(properties_element))
+       else if (id == GADGET_ID_CUSTOM_CHANGED)
        {
          int i = properties_element - EL_CUSTOM_START;
 
-         custom_element_change.successor = new_element;
-         level.custom_element[i].change = custom_element_change;
+         custom_element.change.successor = new_element;
+         level.custom_element[i] = custom_element;
        }
        else if (id == GADGET_ID_RANDOM_BACKGROUND)
          random_placement_background_element = new_element;
@@ -5123,6 +5181,9 @@ static void HandleCheckbuttons(struct GadgetInfo *gi)
       (type_id >= ED_CHECKBUTTON_ID_CHANGE_FIRST &&
        type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST))
     CopyCustomElementPropertiesToGame(properties_element);
+
+  if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC)
+    ModifyEditorElementList();
 }
 
 static void HandleControlButtons(struct GadgetInfo *gi)
index fadd0b6de8614682dfc32a69124cccaab36c2080..ce657d225e0f8e89710df0ce47b46d85a50daa83 100644 (file)
@@ -99,11 +99,13 @@ static void setLevelInfoToDefaults()
   {
     int element = EL_CUSTOM_START + i;
 
+    level.custom_element[i].use_gfx_element = FALSE;
+    level.custom_element[i].gfx_element = EL_EMPTY_SPACE;
+
     level.custom_element[i].change.events = CE_BITMASK_DEFAULT;
-    level.custom_element[i].change.gfx_element = element;
-    level.custom_element[i].change.successor = EL_EMPTY_SPACE;
     level.custom_element[i].change.delay_fixed = 0;
     level.custom_element[i].change.delay_random = 0;
+    level.custom_element[i].change.successor = EL_EMPTY_SPACE;
 
     /* start with no properties at all */
     for (j=0; j < NUM_EP_BITFIELDS; j++)
index 7436b1d9ae07ca7823359240c53ea48b72d273a3..cd8e534197d5bb95bad9bce7a6663f8eb03c9bf7 100644 (file)
@@ -6594,7 +6594,8 @@ int DigField(struct PlayerInfo *player,
 #if 1
        if (mode != DF_SNAP)
        {
-         GfxElement[x][y] = element;
+         GfxElement[x][y] =
+           (CAN_BE_CRUMBLED(element) ? EL_SAND : GFX_ELEMENT(element));
          player->is_digging = TRUE;
        }
 #endif
index 54340c1fda9da59d7c0be45eb1ae59cb69d3aa8f..8e918517e81c98d298f113bc8704258bb979962e 100644 (file)
 
 /* macros for pre-defined properties */
 #define ELEM_IS_PLAYER(e)      HAS_PROPERTY(e, EP_PLAYER)
-#define CAN_BE_CRUMBLED(e)     HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED)
+#define CAN_BE_CRUMBLED_OLD(e) HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED)
+#define CAN_BE_CRUMBLED(e)     HAS_PROPERTY(GFX_ELEMENT(e),EP_CAN_BE_CRUMBLED)
 #define CAN_MOVE(e)            HAS_PROPERTY(e, EP_CAN_MOVE)
 #define CAN_PASS_MAGIC_WALL(e) HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
 #define IS_SWITCHABLE(e)       HAS_PROPERTY(e, EP_SWITCHABLE)
 #define IS_CUSTOM_ELEMENT(e)   ((e) >= EL_CUSTOM_START &&      \
                                 (e) <= EL_CUSTOM_END)
 
+#define GFX_ELEMENT(e)         (IS_CUSTOM_ELEMENT(e) &&                  \
+                                CUSTOM_ELEMENT_INFO(e).use_gfx_element ? \
+                                CUSTOM_ELEMENT_INFO(e).gfx_element : e)
+
 #define IS_PLAYER(x,y)         (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
 #define IS_FREE(x,y)           (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x,y))
@@ -1012,19 +1017,20 @@ struct PlayerInfo
 
 struct CustomElementChangeInfo
 {
-  unsigned long events;        /* bitfield for change events */
-
-  short gfx_element;   /* optional custom graphic element */
+  unsigned long events;                /* bitfield for change events */
 
-  short successor;     /* new custom element after change */
+  int delay_fixed;             /* added frame delay before changed (fixed) */
+  int delay_random;            /* added frame delay before changed (random) */
+  int delay_frames;            /* either 1 (frames) or 50 (seconds; 50 fps) */
 
-  int delay_fixed;     /* added frame delay before changed (fixed) */
-  int delay_random;    /* added frame delay before changed (random) */
-  int delay_frames;    /* either 1 (frames) or 50 (seconds; 50 fps) */
+  short successor;             /* new custom element after change */
 };
 
 struct CustomElementInfo
 {
+  boolean use_gfx_element;
+  short gfx_element;           /* optional custom graphic element */
+
   struct CustomElementChangeInfo change;
 };
 
index 3961f93dde442a06bf93e2259a5a2fc0ceafd2ec..4fe2668937485e97ab2235f780cd78a38a3947c3 100644 (file)
@@ -1199,7 +1199,8 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
 
       element = (IN_LEV_FIELD(xx, yy) ? Feld[xx][yy] : EL_STEELWALL);
 
-      if (CAN_BE_CRUMBLED(element))    /* neighbour is of same type */
+      /* check if neighbour field is of same type */
+      if (CAN_BE_CRUMBLED(element))
        continue;
 
       if (i == 1 || i == 2)
@@ -2390,47 +2391,43 @@ int get_next_element(int element)
 
 int el_act_dir2img(int element, int action, int direction)
 {
+  element = GFX_ELEMENT(element);
   direction = MV_DIR_BIT(direction);
 
-  if (IS_CUSTOM_ELEMENT(element))
-    element = CUSTOM_ELEMENT_INFO(element).change.gfx_element;
-
   return element_info[element].direction_graphic[action][direction];
 }
 
 int el_act2img(int element, int action)
 {
-  if (IS_CUSTOM_ELEMENT(element))
-    element = CUSTOM_ELEMENT_INFO(element).change.gfx_element;
+  element = GFX_ELEMENT(element);
 
   return element_info[element].graphic[action];
 }
 
 int el_dir2img(int element, int direction)
 {
+  element = GFX_ELEMENT(element);
+
   return el_act_dir2img(element, ACTION_DEFAULT, direction);
 }
 
 int el2img(int element)
 {
-  if (IS_CUSTOM_ELEMENT(element))
-    element = CUSTOM_ELEMENT_INFO(element).change.gfx_element;
+  element = GFX_ELEMENT(element);
 
   return element_info[element].graphic[ACTION_DEFAULT];
 }
 
 int el2edimg(int element)
 {
-  if (IS_CUSTOM_ELEMENT(element))
-    element = CUSTOM_ELEMENT_INFO(element).change.gfx_element;
+  element = GFX_ELEMENT(element);
 
   return element_info[element].special_graphic[GFX_SPECIAL_ARG_EDITOR];
 }
 
 int el2preimg(int element)
 {
-  if (IS_CUSTOM_ELEMENT(element))
-    element = CUSTOM_ELEMENT_INFO(element).change.gfx_element;
+  element = GFX_ELEMENT(element);
 
   return element_info[element].special_graphic[GFX_SPECIAL_ARG_PREVIEW];
 }