rnd-20030703-1-src
[rocksndiamonds.git] / src / init.c
index 88bfaeb84572c4362ad2a65a79231309e073f8fd..7e4b1727863b3c5ffd3b1cd59a9da024e5fdae19 100644 (file)
@@ -428,6 +428,19 @@ void InitElementGraphicInfo()
     if (graphic_info[graphic].bitmap == NULL)
       continue;
 
+    if ((action > -1 || direction > -1) && el2img(element) != -1)
+    {
+      boolean base_redefined = getImageListEntry(el2img(element))->redefined;
+      boolean act_dir_redefined = getImageListEntry(graphic)->redefined;
+
+      /* if the base graphic ("emerald", for example) has been redefined,
+        but not the action graphic ("emerald.falling", for example), do not
+        use an existing (in this case considered obsolete) action graphic
+        anymore, but use the automatically determined default graphic */
+      if (base_redefined && !act_dir_redefined)
+       continue;
+    }
+
     if (action < 0)
       action = ACTION_DEFAULT;
 
@@ -455,6 +468,10 @@ void InitElementGraphicInfo()
     if (action < 0)
       action = ACTION_DEFAULT;
 
+    if (direction < 0)
+      for (dir=0; dir<NUM_DIRECTIONS; dir++)
+       element_info[element].direction_graphic[action][dir] = -1;
+
     if (direction > -1)
       element_info[element].direction_graphic[action][direction] = graphic;
     else
@@ -464,19 +481,19 @@ void InitElementGraphicInfo()
   /* now set all '-1' values to element specific default values */
   for (i=0; i<MAX_NUM_ELEMENTS; i++)
   {
-    int default_action_graphic = element_info[i].graphic[ACTION_DEFAULT];
-    int default_action_direction_graphic[NUM_DIRECTIONS];
+    int default_graphic = element_info[i].graphic[ACTION_DEFAULT];
+    int default_direction_graphic[NUM_DIRECTIONS];
 
-    if (default_action_graphic == -1)
-      default_action_graphic = IMG_CHAR_QUESTION;
+    if (default_graphic == -1)
+      default_graphic = IMG_CHAR_QUESTION;
 
     for (dir=0; dir<NUM_DIRECTIONS; dir++)
     {
-      default_action_direction_graphic[dir] =
+      default_direction_graphic[dir] =
        element_info[i].direction_graphic[ACTION_DEFAULT][dir];
 
-      if (default_action_direction_graphic[dir] == -1)
-       default_action_direction_graphic[dir] = default_action_graphic;
+      if (default_direction_graphic[dir] == -1)
+       default_direction_graphic[dir] = default_graphic;
     }
 
     for (act=0; act<NUM_ACTIONS; act++)
@@ -485,18 +502,32 @@ void InitElementGraphicInfo()
                            act == ACTION_SNAPPING ||
                            act == ACTION_COLLECTING);
 
+      /* generic default action graphic (defined by "[default]" directive) */
+      int default_action_graphic = element_info[EL_DEFAULT].graphic[act];
+
+      /* look for special default action graphic (classic game specific) */
+      if (IS_BD_ELEMENT(i) && element_info[EL_BD_DEFAULT].graphic[act] != -1)
+       default_action_graphic = element_info[EL_BD_DEFAULT].graphic[act];
+      if (IS_SP_ELEMENT(i) && element_info[EL_SP_DEFAULT].graphic[act] != -1)
+       default_action_graphic = element_info[EL_SP_DEFAULT].graphic[act];
+      if (IS_SB_ELEMENT(i) && element_info[EL_SB_DEFAULT].graphic[act] != -1)
+       default_action_graphic = element_info[EL_SB_DEFAULT].graphic[act];
+
+      if (default_action_graphic == -1)
+       default_action_graphic = default_graphic;
+
       for (dir=0; dir<NUM_DIRECTIONS; dir++)
       {
-       int default_direction_graphic = element_info[i].graphic[act];
+       int default_action_direction_graphic = element_info[i].graphic[act];
 
        /* no graphic for current action -- use default direction graphic */
-       if (default_direction_graphic == -1)
-         default_direction_graphic =
-           (act_remove ? IMG_EMPTY : default_action_direction_graphic[dir]);
+       if (default_action_direction_graphic == -1)
+         default_action_direction_graphic =
+           (act_remove ? IMG_EMPTY : default_direction_graphic[dir]);
 
        if (element_info[i].direction_graphic[act][dir] == -1)
          element_info[i].direction_graphic[act][dir] =
-           default_direction_graphic;
+           default_action_direction_graphic;
       }
 
       /* no graphic for this specific action -- use default action graphic */
@@ -541,6 +572,10 @@ void InitElementSpecialGraphicInfo()
     boolean base_redefined = getImageListEntry(el2img(element))->redefined;
     boolean special_redefined = getImageListEntry(graphic)->redefined;
 
+    /* if the base graphic ("emerald", for example) has been redefined,
+       but not the special graphic ("emerald.EDITOR", for example), do not
+       use an existing (in this case considered obsolete) special graphic
+       anymore, but use the automatically created (down-scaled) graphic */
     if (base_redefined && !special_redefined)
       continue;
 
@@ -610,7 +645,7 @@ static void set_graphic_parameters(int graphic, char **parameter_raw)
     anim_frames_per_col = src_bitmap->height / graphic_info[graphic].height;
   }
 
-  /* correct x or y offset dependant of vertical or horizontal frame order */
+  /* correct x or y offset dependent of vertical or horizontal frame order */
   if (parameter[GFX_ARG_VERTICAL])     /* frames are ordered vertically */
   {
     graphic_info[graphic].offset_y =
@@ -851,48 +886,61 @@ static void InitElementSoundInfo()
          element_info[j].sound[action] = sound;
   }
 
-  /* initialize element/sound mapping from dynamic configuration */
+  /* initialize element class/sound mapping from dynamic configuration */
   for (i=0; i < num_property_mappings; i++)
   {
-    int element = property_mapping[i].base_index;
-    int action  = property_mapping[i].ext1_index;
-    int sound   = property_mapping[i].artwork_index;
+    int element_class = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
+    int action        = property_mapping[i].ext1_index;
+    int sound         = property_mapping[i].artwork_index;
 
-    if (element >= MAX_NUM_ELEMENTS)
+    if (element_class < 0 || element_class >= MAX_NUM_ELEMENTS)
       continue;
 
     if (action < 0)
       action = ACTION_DEFAULT;
 
-    element_info[element].sound[action] = sound;
+    for (j=0; j < MAX_NUM_ELEMENTS; j++)
+      if (strcmp(element_info[j].class_name,
+                element_info[element_class].class_name) == 0)
+       element_info[j].sound[action] = sound;
   }
 
-  /* initialize element class/sound mapping from dynamic configuration */
+  /* initialize element/sound mapping from dynamic configuration */
   for (i=0; i < num_property_mappings; i++)
   {
-    int element_class = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
-    int action        = property_mapping[i].ext1_index;
-    int sound         = property_mapping[i].artwork_index;
+    int element = property_mapping[i].base_index;
+    int action  = property_mapping[i].ext1_index;
+    int sound   = property_mapping[i].artwork_index;
 
-    if (element_class < 0 || element_class >= MAX_NUM_ELEMENTS)
+    if (element >= MAX_NUM_ELEMENTS)
       continue;
 
     if (action < 0)
       action = ACTION_DEFAULT;
 
-    for (j=0; j < MAX_NUM_ELEMENTS; j++)
-      if (strcmp(element_info[j].class_name,
-                element_info[element_class].class_name) == 0)
-       element_info[j].sound[action] = sound;
+    element_info[element].sound[action] = sound;
   }
 
   /* now set all '-1' values to element specific default values */
   for (i=0; i<MAX_NUM_ELEMENTS; i++)
   {
-    int default_action_sound = element_info[i].sound[ACTION_DEFAULT];
-
     for (act=0; act < NUM_ACTIONS; act++)
     {
+      /* generic default action sound (defined by "[default]" directive) */
+      int default_action_sound = element_info[EL_DEFAULT].sound[act];
+
+      /* look for special default action sound (classic game specific) */
+      if (IS_BD_ELEMENT(i) && element_info[EL_BD_DEFAULT].sound[act] != -1)
+       default_action_sound = element_info[EL_BD_DEFAULT].sound[act];
+      if (IS_SP_ELEMENT(i) && element_info[EL_SP_DEFAULT].sound[act] != -1)
+       default_action_sound = element_info[EL_SP_DEFAULT].sound[act];
+      if (IS_SB_ELEMENT(i) && element_info[EL_SB_DEFAULT].sound[act] != -1)
+       default_action_sound = element_info[EL_SB_DEFAULT].sound[act];
+
+      /* look for element specific default sound (independent from action) */
+      if (element_info[i].sound[ACTION_DEFAULT] != -1)
+       default_action_sound = element_info[i].sound[ACTION_DEFAULT];
+
       /* no sound for this specific action -- use default action sound */
       if (element_info[i].sound[act] == -1)
        element_info[i].sound[act] = default_action_sound;
@@ -1056,10 +1104,6 @@ static void ReinitializeSounds()
   InitSoundInfo();             /* sound properties mapping */
   InitElementSoundInfo();      /* element game sound mapping */
 
-#if 1
-  InitElementSoundInfo();      /* element game sound mapping */
-#endif
-
   InitPlaySoundLevel();                /* internal game sound settings */
 }
 
@@ -1080,7 +1124,7 @@ void InitElementPropertiesStatic()
     EL_INVISIBLE_SAND,
     EL_INVISIBLE_SAND_ACTIVE,
 
-    /* !!! currently not diggable, but handled by 'ep_dont_go_to' !!! */
+    /* !!! currently not diggable, but handled by 'ep_dont_run_into' !!! */
 #if 0
     EL_LANDMINE,
     EL_TRAP_ACTIVE,
@@ -1122,6 +1166,62 @@ void InitElementPropertiesStatic()
     -1
   };
 
+  static int ep_dont_run_into[] =
+  {
+    /* same elements as in 'ep_dont_touch' */
+    EL_BUG,
+    EL_SPACESHIP,
+    EL_BD_BUTTERFLY,
+    EL_BD_FIREFLY,
+
+    /* same elements as in 'ep_dont_collide_with' */
+    EL_YAMYAM,
+    EL_DARK_YAMYAM,
+    EL_ROBOT,
+    EL_PACMAN,
+    EL_SP_SNIKSNAK,
+    EL_SP_ELECTRON,
+
+    /* new elements */
+    EL_AMOEBA_DROP,
+    EL_ACID,
+
+    /* !!! maybe this should better be handled by 'ep_diggable' !!! */
+#if 1
+    EL_SP_BUGGY_BASE_ACTIVE,
+    EL_TRAP_ACTIVE,
+    EL_LANDMINE,
+#endif
+    -1
+  };
+
+  static int ep_dont_collide_with[] =
+  {
+    /* same elements as in 'ep_dont_touch' */
+    EL_BUG,
+    EL_SPACESHIP,
+    EL_BD_BUTTERFLY,
+    EL_BD_FIREFLY,
+
+    /* new elements */
+    EL_YAMYAM,
+    EL_DARK_YAMYAM,
+    EL_ROBOT,
+    EL_PACMAN,
+    EL_SP_SNIKSNAK,
+    EL_SP_ELECTRON,
+    -1
+  };
+
+  static int ep_dont_touch[] =
+  {
+    EL_BUG,
+    EL_SPACESHIP,
+    EL_BD_BUTTERFLY,
+    EL_BD_FIREFLY,
+    -1
+  };
+
   static int ep_indestructible[] =
   {
     EL_STEELWALL,
@@ -1196,10 +1296,18 @@ void InitElementPropertiesStatic()
     EL_SWITCHGATE_OPENING,
     EL_SWITCHGATE_CLOSED,
     EL_SWITCHGATE_CLOSING,
+#if 0
+    EL_SWITCHGATE_SWITCH_UP,
+    EL_SWITCHGATE_SWITCH_DOWN,
+#endif
     EL_TIMEGATE_OPEN,
     EL_TIMEGATE_OPENING,
     EL_TIMEGATE_CLOSED,
     EL_TIMEGATE_CLOSING,
+#if 0
+    EL_TIMEGATE_SWITCH,
+    EL_TIMEGATE_SWITCH_ACTIVE,
+#endif
     EL_TUBE_ANY,
     EL_TUBE_VERTICAL,
     EL_TUBE_HORIZONTAL,
@@ -1251,6 +1359,33 @@ void InitElementPropertiesStatic()
     -1
   };
 
+  static int ep_can_change[] =
+  {
+    -1
+  };
+
+  static int ep_can_move[] =
+  {
+    EL_BUG,
+    EL_SPACESHIP,
+    EL_BD_BUTTERFLY,
+    EL_BD_FIREFLY,
+    EL_YAMYAM,
+    EL_DARK_YAMYAM,
+    EL_ROBOT,
+    EL_PACMAN,
+    EL_MOLE,
+    EL_PENGUIN,
+    EL_PIG,
+    EL_DRAGON,
+    EL_SATELLITE,
+    EL_SP_SNIKSNAK,
+    EL_SP_ELECTRON,
+    EL_BALLOON,
+    EL_SPRING,
+    -1
+  };
+
   static int ep_can_fall[] =
   {
     EL_ROCK,
@@ -1279,7 +1414,7 @@ void InitElementPropertiesStatic()
     -1
   };
 
-  static int ep_can_smash[] =
+  static int ep_can_smash_player[] =
   {
     EL_ROCK,
     EL_BD_ROCK,
@@ -1304,6 +1439,78 @@ void InitElementPropertiesStatic()
     -1
   };
 
+  static int ep_can_smash_enemies[] =
+  {
+    EL_ROCK,
+    EL_BD_ROCK,
+    EL_SP_ZONK,
+    -1
+  };
+
+  static int ep_can_smash_everything[] =
+  {
+    EL_ROCK,
+    EL_BD_ROCK,
+    EL_SP_ZONK,
+    -1
+  };
+
+  static int ep_can_explode_by_fire[] =
+  {
+    /* same elements as in 'ep_can_explode_impact' */
+    EL_BOMB,
+    EL_SP_DISK_ORANGE,
+    EL_DX_SUPABOMB,
+
+    /* same elements as in 'ep_can_explode_smashed' */
+    EL_SATELLITE,
+    EL_PIG,
+    EL_DRAGON,
+    EL_MOLE,
+
+    /* new elements */
+    EL_DYNAMITE_ACTIVE,
+    EL_DYNAMITE,
+    EL_DYNABOMB_PLAYER_1_ACTIVE,
+    EL_DYNABOMB_PLAYER_2_ACTIVE,
+    EL_DYNABOMB_PLAYER_3_ACTIVE,
+    EL_DYNABOMB_PLAYER_4_ACTIVE,
+    EL_DYNABOMB_INCREASE_NUMBER,
+    EL_DYNABOMB_INCREASE_SIZE,
+    EL_DYNABOMB_INCREASE_POWER,
+    EL_SP_DISK_RED_ACTIVE,
+    EL_BUG,
+    EL_PENGUIN,
+    EL_SP_DISK_RED,
+    EL_SP_DISK_YELLOW,
+    EL_SP_SNIKSNAK,
+    EL_SP_ELECTRON,
+    -1
+  };
+
+  static int ep_can_explode_smashed[] =
+  {
+    /* same elements as in 'ep_can_explode_impact' */
+    EL_BOMB,
+    EL_SP_DISK_ORANGE,
+    EL_DX_SUPABOMB,
+
+    /* new elements */
+    EL_SATELLITE,
+    EL_PIG,
+    EL_DRAGON,
+    EL_MOLE,
+    -1
+  };
+
+  static int ep_can_explode_impact[] =
+  {
+    EL_BOMB,
+    EL_SP_DISK_ORANGE,
+    EL_DX_SUPABOMB,
+    -1
+  };
+
   static int ep_walkable_over[] =
   {
     EL_EMPTY_SPACE,
@@ -1319,6 +1526,9 @@ void InitElementPropertiesStatic()
     EL_GATE_2_GRAY,
     EL_GATE_3_GRAY,
     EL_GATE_4_GRAY,
+    EL_PENGUIN,
+    EL_PIG,
+    EL_DRAGON,
     -1
   };
 
@@ -1382,19 +1592,19 @@ void InitElementPropertiesStatic()
   static int ep_pushable[] =
   {
     EL_ROCK,
-    EL_BD_ROCK,
     EL_BOMB,
+    EL_DX_SUPABOMB,
     EL_NUT,
     EL_TIME_ORB_EMPTY,
-    EL_SOKOBAN_FIELD_FULL,
-    EL_SOKOBAN_OBJECT,
-    EL_SATELLITE,
     EL_SP_ZONK,
     EL_SP_DISK_ORANGE,
+    EL_SPRING,
+    EL_BD_ROCK,
+    EL_SOKOBAN_OBJECT,
+    EL_SOKOBAN_FIELD_FULL,
+    EL_SATELLITE,
     EL_SP_DISK_YELLOW,
     EL_BALLOON,
-    EL_SPRING,
-    EL_DX_SUPABOMB,
     -1
   };
 
@@ -1416,51 +1626,6 @@ void InitElementPropertiesStatic()
     -1
   };
 
-  static int ep_can_move[] =
-  {
-    /* only stored in level file */
-    EL_BUG_RIGHT,
-    EL_BUG_UP,
-    EL_BUG_LEFT,
-    EL_BUG_DOWN,
-    EL_SPACESHIP_RIGHT,
-    EL_SPACESHIP_UP,
-    EL_SPACESHIP_LEFT,
-    EL_SPACESHIP_DOWN,
-    EL_BD_BUTTERFLY_RIGHT,
-    EL_BD_BUTTERFLY_UP,
-    EL_BD_BUTTERFLY_LEFT,
-    EL_BD_BUTTERFLY_DOWN,
-    EL_BD_FIREFLY_RIGHT,
-    EL_BD_FIREFLY_UP,
-    EL_BD_FIREFLY_LEFT,
-    EL_BD_FIREFLY_DOWN,
-    EL_PACMAN_RIGHT,
-    EL_PACMAN_UP,
-    EL_PACMAN_LEFT,
-    EL_PACMAN_DOWN,
-
-    /* level file and runtime elements */
-    EL_BUG,
-    EL_SPACESHIP,
-    EL_BD_BUTTERFLY,
-    EL_BD_FIREFLY,
-    EL_YAMYAM,
-    EL_DARK_YAMYAM,
-    EL_ROBOT,
-    EL_PACMAN,
-    EL_MOLE,
-    EL_PENGUIN,
-    EL_PIG,
-    EL_DRAGON,
-    EL_SATELLITE,
-    EL_SP_SNIKSNAK,
-    EL_SP_ELECTRON,
-    EL_BALLOON,
-    EL_SPRING,
-    -1
-  };
-
   static int ep_can_pass_magic_wall[] =
   {
     EL_ROCK,
@@ -1505,82 +1670,6 @@ void InitElementPropertiesStatic()
     -1
   };
 
-  static int ep_dont_touch[] =
-  {
-    EL_BUG,
-    EL_SPACESHIP,
-    EL_BD_BUTTERFLY,
-    EL_BD_FIREFLY,
-    -1
-  };
-
-  static int ep_enemy[] =
-  {
-    EL_BUG,
-    EL_SPACESHIP,
-    EL_BD_BUTTERFLY,
-    EL_BD_FIREFLY,
-    EL_YAMYAM,
-    EL_DARK_YAMYAM,
-    EL_ROBOT,
-    EL_PACMAN,
-    EL_SP_SNIKSNAK,
-    EL_SP_ELECTRON,
-    -1
-  };
-
-  static int ep_dont_go_to[] =
-  {
-    EL_BUG,
-    EL_SPACESHIP,
-    EL_BD_BUTTERFLY,
-    EL_BD_FIREFLY,
-    EL_YAMYAM,
-    EL_DARK_YAMYAM,
-    EL_ROBOT,
-    EL_PACMAN,
-    EL_AMOEBA_DROP,
-    EL_ACID,
-    EL_SP_SNIKSNAK,
-    EL_SP_ELECTRON,
-
-    /* !!! maybe this should better be handled by 'ep_diggable' !!! */
-#if 1
-    EL_SP_BUGGY_BASE_ACTIVE,
-    EL_TRAP_ACTIVE,
-    EL_LANDMINE,
-#endif
-    -1
-  };
-
-  static int ep_can_explode[] =
-  {
-    EL_BOMB,
-    EL_DYNAMITE_ACTIVE,
-    EL_DYNAMITE,
-    EL_DYNABOMB_PLAYER_1_ACTIVE,
-    EL_DYNABOMB_PLAYER_2_ACTIVE,
-    EL_DYNABOMB_PLAYER_3_ACTIVE,
-    EL_DYNABOMB_PLAYER_4_ACTIVE,
-    EL_DYNABOMB_INCREASE_NUMBER,
-    EL_DYNABOMB_INCREASE_SIZE,
-    EL_DYNABOMB_INCREASE_POWER,
-    EL_SP_DISK_RED_ACTIVE,
-    EL_BUG,
-    EL_MOLE,
-    EL_PENGUIN,
-    EL_PIG,
-    EL_DRAGON,
-    EL_SATELLITE,
-    EL_SP_DISK_RED,
-    EL_SP_DISK_ORANGE,
-    EL_SP_DISK_YELLOW,
-    EL_SP_SNIKSNAK,
-    EL_SP_ELECTRON,
-    EL_DX_SUPABOMB,
-    -1
-  };
-
   static int ep_bd_element[] =
   {
     EL_EMPTY,
@@ -1657,6 +1746,11 @@ void InitElementPropertiesStatic()
     EL_INVISIBLE_WALL,
     /* more than one murphy in a level results in an inactive clone */
     EL_SP_MURPHY_CLONE,
+    /* runtime elements*/
+    EL_SP_DISK_RED_ACTIVE,
+    EL_SP_TERMINAL_ACTIVE,
+    EL_SP_BUGGY_BASE_ACTIVATING,
+    EL_SP_BUGGY_BASE_ACTIVE,
     -1
   };
 
@@ -1959,6 +2053,22 @@ void InitElementPropertiesStatic()
     -1
   };
 
+  static int ep_classic_enemy[] =
+  {
+    EL_BUG,
+    EL_SPACESHIP,
+    EL_BD_BUTTERFLY,
+    EL_BD_FIREFLY,
+
+    EL_YAMYAM,
+    EL_DARK_YAMYAM,
+    EL_ROBOT,
+    EL_PACMAN,
+    EL_SP_SNIKSNAK,
+    EL_SP_ELECTRON,
+    -1
+  };
+
   static int ep_belt[] =
   {
     EL_CONVEYOR_BELT_1_LEFT,
@@ -2136,7 +2246,9 @@ void InitElementPropertiesStatic()
     EL_DYNABOMB_INCREASE_NUMBER,
     EL_DYNABOMB_INCREASE_SIZE,
     EL_DYNABOMB_INCREASE_POWER,
+#if 0
     EL_SOKOBAN_OBJECT,
+#endif
     EL_SOKOBAN_FIELD_EMPTY,
     EL_SOKOBAN_FIELD_FULL,
     EL_WALL_EMERALD_RED,
@@ -2166,7 +2278,9 @@ void InitElementPropertiesStatic()
     EL_SP_PORT_VERTICAL,
     EL_SP_PORT_ANY,
     EL_SP_DISK_RED,
+#if 0
     EL_SP_DISK_YELLOW,
+#endif
     EL_SP_CHIP_SINGLE,
     EL_SP_CHIP_LEFT,
     EL_SP_CHIP_RIGHT,
@@ -2231,10 +2345,20 @@ void InitElementPropertiesStatic()
   {
     { ep_diggable,             EP_DIGGABLE             },
     { ep_collectible,          EP_COLLECTIBLE          },
+    { ep_dont_run_into,                EP_DONT_RUN_INTO        },
+    { ep_dont_collide_with,    EP_DONT_COLLIDE_WITH    },
+    { ep_dont_touch,           EP_DONT_TOUCH           },
     { ep_indestructible,       EP_INDESTRUCTIBLE       },
     { ep_slippery,             EP_SLIPPERY             },
+    { ep_can_change,           EP_CAN_CHANGE           },
+    { ep_can_move,             EP_CAN_MOVE             },
     { ep_can_fall,             EP_CAN_FALL             },
-    { ep_can_smash,            EP_CAN_SMASH            },
+    { ep_can_smash_player,     EP_CAN_SMASH_PLAYER     },
+    { ep_can_smash_enemies,    EP_CAN_SMASH_ENEMIES    },
+    { ep_can_smash_everything, EP_CAN_SMASH_EVERYTHING },
+    { ep_can_explode_by_fire,  EP_CAN_EXPLODE_BY_FIRE  },
+    { ep_can_explode_smashed,  EP_CAN_EXPLODE_SMASHED  },
+    { ep_can_explode_impact,   EP_CAN_EXPLODE_IMPACT   },
     { ep_walkable_over,                EP_WALKABLE_OVER        },
     { ep_walkable_inside,      EP_WALKABLE_INSIDE      },
     { ep_walkable_under,       EP_WALKABLE_UNDER       },
@@ -2243,15 +2367,11 @@ void InitElementPropertiesStatic()
     { ep_passable_under,       EP_PASSABLE_UNDER       },
     { ep_pushable,             EP_PUSHABLE             },
 
-    { ep_player,               EP_PLAYER               },
     { ep_can_be_crumbled,      EP_CAN_BE_CRUMBLED      },
-    { ep_can_move,             EP_CAN_MOVE             },
+
+    { ep_player,               EP_PLAYER               },
     { ep_can_pass_magic_wall,  EP_CAN_PASS_MAGIC_WALL  },
     { ep_switchable,           EP_SWITCHABLE           },
-    { ep_dont_touch,           EP_DONT_TOUCH           },
-    { ep_enemy,                        EP_ENEMY                },
-    { ep_dont_go_to,           EP_DONT_GO_TO           },
-    { ep_can_explode,          EP_CAN_EXPLODE          },
     { ep_bd_element,           EP_BD_ELEMENT           },
     { ep_sp_element,           EP_SP_ELEMENT           },
     { ep_sb_element,           EP_SB_ELEMENT           },
@@ -2261,6 +2381,7 @@ void InitElementPropertiesStatic()
     { ep_food_pig,             EP_FOOD_PIG             },
     { ep_historic_wall,                EP_HISTORIC_WALL        },
     { ep_historic_solid,       EP_HISTORIC_SOLID       },
+    { ep_classic_enemy,                EP_CLASSIC_ENEMY        },
     { ep_belt,                 EP_BELT                 },
     { ep_belt_active,          EP_BELT_ACTIVE          },
     { ep_belt_switch,          EP_BELT_SWITCH          },
@@ -2275,7 +2396,40 @@ void InitElementPropertiesStatic()
     { NULL,                    -1                      }
   };
 
-  int i, j;
+  static int copy_properties[][5] =
+  {
+    {
+      EL_BUG,
+      EL_BUG_LEFT,             EL_BUG_RIGHT,
+      EL_BUG_UP,               EL_BUG_DOWN
+    },
+    {
+      EL_SPACESHIP,
+      EL_SPACESHIP_LEFT,       EL_SPACESHIP_RIGHT,
+      EL_SPACESHIP_UP,         EL_SPACESHIP_DOWN
+    },
+    {
+      EL_BD_BUTTERFLY,
+      EL_BD_BUTTERFLY_LEFT,    EL_BD_BUTTERFLY_RIGHT,
+      EL_BD_BUTTERFLY_UP,      EL_BD_BUTTERFLY_DOWN
+    },
+    {
+      EL_BD_FIREFLY,
+      EL_BD_FIREFLY_LEFT,      EL_BD_FIREFLY_RIGHT,
+      EL_BD_FIREFLY_UP,                EL_BD_FIREFLY_DOWN
+    },
+    {
+      EL_PACMAN,
+      EL_PACMAN_LEFT,          EL_PACMAN_RIGHT,
+      EL_PACMAN_UP,            EL_PACMAN_DOWN
+    },
+    {
+      -1,
+      -1, -1, -1, -1
+    }
+  };
+
+  int i, j, k;
 
   /* always start with reliable default values (element has no properties) */
   for (i=0; i < MAX_NUM_ELEMENTS; i++)
@@ -2287,6 +2441,13 @@ void InitElementPropertiesStatic()
     for (j=0; (element_properties[i].elements)[j] != -1; j++)
       SET_PROPERTY((element_properties[i].elements)[j],
                   element_properties[i].property, TRUE);
+
+  /* copy properties to some elements that are only stored in level file */
+  for (i=0; i < NUM_ELEMENT_PROPERTIES; i++)
+    for (j=0; copy_properties[j][0] != -1; j++)
+      if (HAS_PROPERTY(copy_properties[j][0], i))
+       for (k=1; k<=4; k++)
+         SET_PROPERTY(copy_properties[j][k], i, TRUE);
 }
 
 void InitElementPropertiesEngine(int engine_version)
@@ -2297,16 +2458,16 @@ void InitElementPropertiesEngine(int engine_version)
     EP_AMOEBALIVE,
     EP_AMOEBOID,
     EP_PFORTE,
-    EP_ENEMY,
+    EP_DONT_COLLIDE_WITH,
     EP_MAUER,
     EP_CAN_FALL,
     EP_CAN_SMASH,
     EP_CAN_PASS_MAGIC_WALL,
     EP_CAN_MOVE,
     EP_DONT_TOUCH,
-    EP_DONT_GO_TO,
+    EP_DONT_RUN_INTO,
     EP_GEM,
-    EP_CAN_EXPLODE,
+    EP_CAN_EXPLODE_BY_FIRE,
     EP_PUSHABLE,
     EP_PLAYER,
     EP_HAS_CONTENT,
@@ -2326,26 +2487,31 @@ void InitElementPropertiesEngine(int engine_version)
 
   static int no_wall_properties[] =
   {
-    EP_AMOEBALIVE,
-    EP_AMOEBOID,
-    EP_CAN_BE_CRUMBLED,
-    EP_ENEMY,
-    EP_CAN_FALL,
-    EP_CAN_SMASH,
+    EP_DIGGABLE,
+    EP_COLLECTIBLE,
+    EP_DONT_RUN_INTO,
+    EP_DONT_COLLIDE_WITH,
     EP_CAN_MOVE,
-    EP_DONT_GO_TO,
-    EP_FOOD_DARK_YAMYAM,
-    EP_GEM,
-    EP_FOOD_PENGUIN,
+    EP_CAN_FALL,
+    EP_CAN_SMASH_PLAYER,
+    EP_CAN_SMASH_ENEMIES,
+    EP_CAN_SMASH_EVERYTHING,
     EP_PUSHABLE,
+
+    EP_CAN_BE_CRUMBLED,
+
     EP_PLAYER,
-    EP_ACCESSIBLE,
-    EP_DIGGABLE,
-    EP_COLLECTIBLE,
-    EP_ACTIVE_BOMB,
+    EP_GEM,
+    EP_FOOD_DARK_YAMYAM,
+    EP_FOOD_PENGUIN,
     EP_BELT,
     EP_BELT_ACTIVE,
     EP_TUBE,
+    EP_AMOEBOID,
+    EP_AMOEBALIVE,
+    EP_ACTIVE_BOMB,
+
+    EP_ACCESSIBLE,
     -1
   };
 
@@ -2355,7 +2521,7 @@ void InitElementPropertiesEngine(int engine_version)
   InitElementPropertiesStatic();
 #endif
 
-  /* set all special, combined or engine dependant element properties */
+  /* set all special, combined or engine dependent element properties */
   for (i=0; i < MAX_NUM_ELEMENTS; i++)
   {
 #if 0
@@ -2430,6 +2596,31 @@ void InitElementPropertiesEngine(int engine_version)
       SET_PROPERTY(i, EP_EXPLOSION_PROOF, (IS_INDESTRUCTIBLE(i) &&
                                           !IS_WALKABLE_OVER(i) &&
                                           !IS_WALKABLE_UNDER(i)));
+
+    if (IS_CUSTOM_ELEMENT(i))
+    {
+      /* ---------- DONT_COLLIDE_WITH / DONT_RUN_INTO ---------------------- */
+      if (DONT_TOUCH(i))
+       SET_PROPERTY(i, EP_DONT_COLLIDE_WITH, TRUE);
+      if (DONT_COLLIDE_WITH(i))
+       SET_PROPERTY(i, EP_DONT_RUN_INTO, TRUE);
+
+      /* ---------- CAN_SMASH_ENEMIES / CAN_SMASH_PLAYER ------------------- */
+      if (CAN_SMASH_EVERYTHING(i))
+       SET_PROPERTY(i, EP_CAN_SMASH_ENEMIES, TRUE);
+      if (CAN_SMASH_ENEMIES(i))
+       SET_PROPERTY(i, EP_CAN_SMASH_PLAYER, TRUE);
+    }
+
+    /* ---------- CAN_SMASH ------------------------------------------------ */
+    SET_PROPERTY(i, EP_CAN_SMASH, (CAN_SMASH_PLAYER(i) ||
+                                  CAN_SMASH_ENEMIES(i) ||
+                                  CAN_SMASH_EVERYTHING(i)));
+
+    /* ---------- CAN_EXPLODE ---------------------------------------------- */
+    SET_PROPERTY(i, EP_CAN_EXPLODE, (CAN_EXPLODE_BY_FIRE(i) ||
+                                    CAN_EXPLODE_SMASHED(i) ||
+                                    CAN_EXPLODE_BY_FIRE(i)));
   }
 
 #if 0
@@ -2474,6 +2665,22 @@ void InitElementPropertiesEngine(int engine_version)
                 (level.em_slippery_gems &&
                  engine_version > VERSION_IDENT(2,0,1)));
   }
+
+#if 0
+  /* dynamically adjust element properties according to game engine version */
+#if 0
+  if (engine_version < RELEASE_IDENT(2,2,0,7))
+#endif
+  {
+    for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+    {
+      int element = EL_CUSTOM_START + i;
+
+      element_info[element].push_delay_fixed = 2;
+      element_info[element].push_delay_random = 8;
+    }
+  }
+#endif
 }
 
 static void InitGlobal()
@@ -2607,6 +2814,16 @@ static void InitArtworkInfo()
   LoadArtworkInfo();
 }
 
+static char *get_string_in_brackets(char *string)
+{
+  char *string_in_brackets = checked_malloc(strlen(string) + 3);
+
+  sprintf(string_in_brackets, "[%s]", string);
+
+  return string_in_brackets;
+}
+
+#if 0
 static char *get_element_class_token(int element)
 {
   char *element_class_name = element_info[element].class_name;
@@ -2617,10 +2834,21 @@ static char *get_element_class_token(int element)
   return element_class_token;
 }
 
+static char *get_action_class_token(int action)
+{
+  char *action_class_name = &element_action_info[action].suffix[1];
+  char *action_class_token = checked_malloc(strlen(action_class_name) + 3);
+
+  sprintf(action_class_token, "[%s]", action_class_name);
+
+  return action_class_token;
+}
+#endif
+
 static void InitArtworkConfig()
 {
   static char *image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS + 1];
-  static char *sound_id_prefix[MAX_NUM_ELEMENTS + MAX_NUM_ELEMENTS + 1];
+  static char *sound_id_prefix[2 * MAX_NUM_ELEMENTS + 1];
   static char *action_id_suffix[NUM_ACTIONS + 1];
   static char *direction_id_suffix[NUM_DIRECTIONS + 1];
   static char *special_id_suffix[NUM_SPECIAL_GFX_ARGS + 1];
@@ -2671,8 +2899,9 @@ static void InitArtworkConfig()
   for (i=0; i<MAX_NUM_ELEMENTS; i++)
     sound_id_prefix[i] = element_info[i].token_name;
   for (i=0; i<MAX_NUM_ELEMENTS; i++)
-    sound_id_prefix[MAX_NUM_ELEMENTS + i] = get_element_class_token(i);
-  sound_id_prefix[MAX_NUM_ELEMENTS + MAX_NUM_ELEMENTS] = NULL;
+    sound_id_prefix[MAX_NUM_ELEMENTS + i] =
+      get_string_in_brackets(element_info[i].class_name);
+  sound_id_prefix[2 * MAX_NUM_ELEMENTS] = NULL;
 
   for (i=0; i<NUM_ACTIONS; i++)
     action_id_suffix[i] = element_action_info[i].suffix;
@@ -2904,7 +3133,7 @@ void ReloadCustomArtwork()
 
   /* custom level artwork configured in level series configuration file
      always overrides custom level artwork stored in level series directory
-     and (level independant) custom artwork configured in setup menue */
+     and (level independent) custom artwork configured in setup menue */
   if (leveldir_current->graphics_set != NULL)
     gfx_new_identifier = leveldir_current->graphics_set;
   if (leveldir_current->sounds_set != NULL)
@@ -3069,7 +3298,7 @@ void CloseAllAndExit(int exit_value)
   FreeTileClipmasks();
 
   CloseVideoDisplay();
-  ClosePlatformDependantStuff();
+  ClosePlatformDependentStuff();
 
   exit(exit_value);
 }