rnd-20040112-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 12 Jan 2004 01:56:26 +0000 (02:56 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:45:19 +0000 (10:45 +0200)
src/conftime.h
src/editor.c
src/files.c
src/main.h

index 79da32aa0a140f1f64216a651b3a8674ed02c4b9..2065c69e476400d80597b5ac341f7513f72916f5 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-01-11 19:16]"
+#define COMPILE_DATE_STRING "[2004-01-12 02:53]"
index f098b1f5f9b025757e32804e850927f4f05251ba..2c878e4a47f878e57d6dd2d8186c5fff4bdec92e 100644 (file)
@@ -4753,7 +4753,7 @@ static void UnmapLevelEditorToolboxDrawingGadgets()
 
 static void UnmapDrawingArea(int id)
 {
-  UnmapGadget(level_editor_gadget[id]);
+  UnmapGadget(level_editor_gadget[drawingarea_info[id].gadget_id]);
 }
 
 static void UnmapLevelEditorWindowGadgets()
@@ -5144,6 +5144,15 @@ static void CopyCustomElementPropertiesToEditor(int element)
 static void CopyGroupElementPropertiesToEditor(int element)
 {
   group_element_info = *element_info[element].group;
+  custom_element = element_info[element];      /* needed for description */
+}
+
+static void CopyElementPropertiesToEditor(int element)
+{
+  if (IS_CUSTOM_ELEMENT(element))
+    CopyCustomElementPropertiesToEditor(element);
+  else if (IS_GROUP_ELEMENT(element))
+    CopyGroupElementPropertiesToEditor(element);
 }
 
 static void CopyCustomElementPropertiesToGame(int element)
@@ -5282,10 +5291,19 @@ static void CopyCustomElementPropertiesToGame(int element)
 
 static void CopyGroupElementPropertiesToGame(int element)
 {
+  element_info[element] = custom_element;
+  *element_info[element].group = group_element_info;
+
   /* mark that this group element has been modified */
   element_info[element].modified_settings = TRUE;
+}
 
-  *element_info[element].group = group_element_info;
+static void CopyElementPropertiesToGame(int element)
+{
+  if (IS_CUSTOM_ELEMENT(element))
+    CopyCustomElementPropertiesToGame(element);
+  else if (IS_GROUP_ELEMENT(element))
+    CopyGroupElementPropertiesToGame(element);
 }
 
 void DrawLevelEd()
@@ -5867,7 +5885,8 @@ static void DrawPropertiesTabulatorGadgets()
   int i;
 
   /* draw additional "advanced" tabulator for custom elements */
-  if (IS_CUSTOM_ELEMENT(properties_element))
+  if (IS_CUSTOM_ELEMENT(properties_element) ||
+      IS_GROUP_ELEMENT(properties_element))
     id_last = ED_TEXTBUTTON_ID_PROPERTIES_ADVANCED;
 
   for (i = id_first; i <= id_last; i++)
@@ -5969,6 +5988,12 @@ static void DrawPropertiesInfo()
              "[Custom Element %d]", properties_element - EL_CUSTOM_START + 1);
     screen_line++;
   }
+  else if (IS_GROUP_ELEMENT(properties_element))
+  {
+    DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
+             "[Group Element %d]", properties_element - EL_GROUP_START + 1);
+    screen_line++;
+  }
 #endif
 
   /* ----- print number of elements / percentage of this element in level */
@@ -6197,27 +6222,35 @@ static void DrawPropertiesConfig()
     /* draw text input gadgets */
     MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
   }
-
-  if (IS_GROUP_ELEMENT(properties_element))
+  else if (IS_GROUP_ELEMENT(properties_element))
   {
     /* draw stickybutton gadget */
     i = ED_CHECKBUTTON_ID_STICK_ELEMENT;
     checkbutton_info[i].y = ED_SETTINGS_YPOS(0);
     MapCheckbuttonGadget(i);
 
+    /* draw counter gadgets */
     MapCounterButtons(ED_COUNTER_ID_GROUP_CONTENT);
 
+    /* draw drawing area gadgets */
     DrawGroupElementArea(properties_element);
+
+    /* draw text input gadgets */
+    MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
   }
 }
 
 static void DrawPropertiesAdvancedDrawingAreas()
 {
   MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
-  MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
-  MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
 
-  DrawCustomChangeContentArea();
+  if (IS_CUSTOM_ELEMENT(properties_element))
+  {
+    MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
+    MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
+
+    DrawCustomChangeContentArea();
+  }
 
   redraw_mask |= REDRAW_FIELD;
 }
@@ -6231,27 +6264,42 @@ static void DrawPropertiesAdvanced()
   checkbutton_info[i].y = ED_SETTINGS_YPOS(0);
   MapCheckbuttonGadget(i);
 
-  /* draw checkbutton gadgets */
-  for (i =  ED_CHECKBUTTON_ID_CHANGE_FIRST;
-       i <= ED_CHECKBUTTON_ID_CHANGE_LAST; i++)
+  if (IS_CUSTOM_ELEMENT(properties_element))
+  {
+    /* draw checkbutton gadgets */
+    for (i =  ED_CHECKBUTTON_ID_CHANGE_FIRST;
+        i <= ED_CHECKBUTTON_ID_CHANGE_LAST; i++)
     MapCheckbuttonGadget(i);
 
-  /* draw counter gadgets */
-  for (i = ED_COUNTER_ID_CHANGE_FIRST; i <= ED_COUNTER_ID_CHANGE_LAST; i++)
-    MapCounterButtons(i);
+    /* draw counter gadgets */
+    for (i =  ED_COUNTER_ID_CHANGE_FIRST;
+        i <= ED_COUNTER_ID_CHANGE_LAST; i++)
+      MapCounterButtons(i);
+
+    /* draw selectbox gadgets */
+    for (i =  ED_SELECTBOX_ID_CHANGE_FIRST;
+        i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
+      MapSelectboxGadget(i);
 
-  /* draw selectbox gadgets */
-  for (i = ED_SELECTBOX_ID_CHANGE_FIRST; i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
-    MapSelectboxGadget(i);
+    /* draw textbutton gadgets */
+    for (i =  ED_TEXTBUTTON_ID_CHANGE_FIRST;
+        i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
+      MapTextbuttonGadget(i);
 
-  /* draw textbutton gadgets */
-  for (i=ED_TEXTBUTTON_ID_CHANGE_FIRST; i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
-    MapTextbuttonGadget(i);
+    /* draw graphicbutton gadgets */
+    for (i =  ED_GRAPHICBUTTON_ID_CHANGE_FIRST;
+        i <= ED_GRAPHICBUTTON_ID_CHANGE_LAST; i++)
+      MapGraphicbuttonGadget(i);
+  }
+  else if (IS_GROUP_ELEMENT(properties_element))
+  {
+    /* draw checkbutton gadgets */
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE);
 
-  /* draw graphicbutton gadgets */
-  for (i =  ED_GRAPHICBUTTON_ID_CHANGE_FIRST;
-       i <= ED_GRAPHICBUTTON_ID_CHANGE_LAST; i++)
-    MapGraphicbuttonGadget(i);
+    /* draw textbutton gadgets */
+    MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE);
+  }
 
   /* draw drawing area gadgets */
   DrawPropertiesAdvancedDrawingAreas();
@@ -6311,14 +6359,11 @@ static void DrawPropertiesWindow()
 
   /* make sure that previous properties edit mode exists for this element */
   if (edit_mode_properties == ED_MODE_PROPERTIES_ADVANCED &&
-      !IS_CUSTOM_ELEMENT(properties_element))
+      !IS_CUSTOM_ELEMENT(properties_element) &&
+      !IS_GROUP_ELEMENT(properties_element))
     edit_mode_properties = ED_MODE_PROPERTIES_CONFIG;
 
-  if (IS_CUSTOM_ELEMENT(properties_element))
-    CopyCustomElementPropertiesToEditor(properties_element);
-
-  if (IS_GROUP_ELEMENT(properties_element))
-    CopyGroupElementPropertiesToEditor(properties_element);
+  CopyElementPropertiesToEditor(properties_element);
 
   UnmapLevelEditorWindowGadgets();
   UnmapLevelEditorToolboxDrawingGadgets();
@@ -7104,7 +7149,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
          new_element = GFX_ELEMENT(new_element);
          custom_element.gfx_element = new_element;
 
-         CopyCustomElementPropertiesToGame(properties_element);
+         CopyElementPropertiesToGame(properties_element);
 
          UpdateCustomElementGraphicGadgets();
 
@@ -7256,6 +7301,8 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
        PickDrawingElement(button, custom_element_change.content[sx][sy]);
       else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
        PickDrawingElement(button, custom_element_change.trigger_element);
+      else if (id == GADGET_ID_GROUP_CONTENT)
+       PickDrawingElement(button, group_element_info.element[sx]);
       else if (id == GADGET_ID_RANDOM_BACKGROUND)
        PickDrawingElement(button, random_placement_background_element);
       else if (id >= GADGET_ID_ELEMENT_CONTENT_0 &&
@@ -7342,7 +7389,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi)
        counter_id <= ED_COUNTER_ID_CUSTOM_LAST) ||
       (counter_id >= ED_COUNTER_ID_CHANGE_FIRST &&
        counter_id <= ED_COUNTER_ID_CHANGE_LAST))
-    CopyCustomElementPropertiesToGame(properties_element);
+    CopyElementPropertiesToGame(properties_element);
 }
 
 static void HandleTextInputGadgets(struct GadgetInfo *gi)
@@ -7353,7 +7400,7 @@ static void HandleTextInputGadgets(struct GadgetInfo *gi)
 
   if (type_id == ED_TEXTINPUT_ID_ELEMENT_NAME)
   {
-    CopyCustomElementPropertiesToGame(properties_element);
+    CopyElementPropertiesToGame(properties_element);
 
     ModifyEditorElementList(); /* update changed button info text */
   }
@@ -7383,7 +7430,7 @@ static void HandleSelectboxGadgets(struct GadgetInfo *gi)
            type_id <= ED_SELECTBOX_ID_CUSTOM_LAST) ||
           (type_id >= ED_SELECTBOX_ID_CHANGE_FIRST &&
            type_id <= ED_SELECTBOX_ID_CHANGE_LAST))
-    CopyCustomElementPropertiesToGame(properties_element);
+    CopyElementPropertiesToGame(properties_element);
 }
 
 static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
@@ -7480,7 +7527,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi)
        type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST &&
        type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE))
   {
-    CopyCustomElementPropertiesToGame(properties_element);
+    CopyElementPropertiesToGame(properties_element);
   }
 
   if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC)
@@ -8162,6 +8209,9 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
     else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
       DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "%s",
                getElementInfoText(custom_element_change.trigger_element));
+    else if (id == GADGET_ID_GROUP_CONTENT)
+      DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "%s",
+               getElementInfoText(group_element_info.element[sx]));
     else if (id == GADGET_ID_RANDOM_BACKGROUND)
       DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "%s",
                getElementInfoText(random_placement_background_element));
@@ -8194,6 +8244,9 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
     else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
       DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
                "Other element triggering change");
+    else if (id == GADGET_ID_GROUP_CONTENT)
+      DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
+               "Group element position: %d", sx + 1);
     else if (id == GADGET_ID_RANDOM_BACKGROUND)
       DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
                "Random placement background");
index 135920b8ecbcb6c729eeb9fb51bd317e71d960a4..214c50af2ccfde08b83c316295d5876cb831af46 100644 (file)
 #define LEVEL_CHUNK_CNT3_UNUSED        10      /* unused CNT3 chunk bytes    */
 #define LEVEL_CPART_CUS3_SIZE  134     /* size of CUS3 chunk part    */
 #define LEVEL_CPART_CUS3_UNUSED        15      /* unused CUS3 bytes / part   */
+#define LEVEL_CHUNK_GRP1_SIZE  74      /* size of level GRP1 chunk   */
 #define TAPE_HEADER_SIZE       20      /* size of tape file header   */
 #define TAPE_HEADER_UNUSED     3       /* unused tape header bytes   */
 
+#define LEVEL_CHUNK_CNT3_SIZE(x) (LEVEL_CHUNK_CNT3_HEADER + (x))
 #define LEVEL_CHUNK_CUS3_SIZE(x) (2 + (x) * LEVEL_CPART_CUS3_SIZE)
 #define LEVEL_CHUNK_CUS4_SIZE(x) (48 + 48 + (x) * 48)
-#define LEVEL_CHUNK_GRP1_SIZE(x) (2 + 8 + (x) * 2)
 
 /* file identifier strings */
 #define LEVEL_COOKIE_TMPL      "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_x.x"
@@ -177,76 +178,79 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
 
   for (i = 0; i < MAX_NUM_ELEMENTS; i++)
   {
-    setElementChangePages(&element_info[i], 1);
-    setElementChangeInfoToDefaults(element_info[i].change);
-  }
-
-  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
-  {
-    int element = EL_CUSTOM_START + i;
+    int element = i;
 
-    for (j = 0; j < MAX_ELEMENT_NAME_LEN + 1; j++)
-      element_info[element].description[j] = '\0';
-    if (element_info[element].custom_description != NULL)
-      strncpy(element_info[element].description,
-             element_info[element].custom_description, MAX_ELEMENT_NAME_LEN);
-    else
-      strcpy(element_info[element].description,
-            element_info[element].editor_description);
+    setElementChangePages(&element_info[element], 1);
+    setElementChangeInfoToDefaults(element_info[element].change);
 
-    element_info[element].use_gfx_element = FALSE;
-    element_info[element].gfx_element = EL_EMPTY_SPACE;
+    if (IS_CUSTOM_ELEMENT(element) || IS_GROUP_ELEMENT(element))
+    {
+      for (j = 0; j < MAX_ELEMENT_NAME_LEN + 1; j++)
+       element_info[element].description[j] = '\0';
 
-    element_info[element].collect_score = 10;          /* special default */
-    element_info[element].collect_count = 1;           /* special default */
+      if (element_info[element].custom_description != NULL)
+       strncpy(element_info[element].description,
+               element_info[element].custom_description,MAX_ELEMENT_NAME_LEN);
+      else
+       strcpy(element_info[element].description,
+              element_info[element].editor_description);
 
-    element_info[element].push_delay_fixed = -1;       /* initialize later */
-    element_info[element].push_delay_random = -1;      /* initialize later */
-    element_info[element].move_delay_fixed = 0;
-    element_info[element].move_delay_random = 0;
+      element_info[element].use_gfx_element = FALSE;
+      element_info[element].gfx_element = EL_EMPTY_SPACE;
+    }
 
-    element_info[element].move_pattern = MV_ALL_DIRECTIONS;
-    element_info[element].move_direction_initial = MV_NO_MOVING;
-    element_info[element].move_stepsize = TILEX / 8;
+    if (IS_CUSTOM_ELEMENT(element))
+    {
+      element_info[element].collect_score = 10;                /* special default */
+      element_info[element].collect_count = 1;         /* special default */
 
-    element_info[element].slippery_type = SLIPPERY_ANY_RANDOM;
+      element_info[element].push_delay_fixed = -1;     /* initialize later */
+      element_info[element].push_delay_random = -1;    /* initialize later */
+      element_info[element].move_delay_fixed = 0;
+      element_info[element].move_delay_random = 0;
 
-    for (x = 0; x < 3; x++)
-      for (y = 0; y < 3; y++)
-       element_info[element].content[x][y] = EL_EMPTY_SPACE;
+      element_info[element].move_pattern = MV_ALL_DIRECTIONS;
+      element_info[element].move_direction_initial = MV_NO_MOVING;
+      element_info[element].move_stepsize = TILEX / 8;
 
-    element_info[element].access_type = 0;
-    element_info[element].access_layer = 0;
-    element_info[element].walk_to_action = 0;
-    element_info[element].smash_targets = 0;
-    element_info[element].deadliness = 0;
-    element_info[element].consistency = 0;
+      element_info[element].slippery_type = SLIPPERY_ANY_RANDOM;
 
-    element_info[element].can_explode_by_fire = FALSE;
-    element_info[element].can_explode_smashed = FALSE;
-    element_info[element].can_explode_impact = FALSE;
+      for (x = 0; x < 3; x++)
+       for (y = 0; y < 3; y++)
+         element_info[element].content[x][y] = EL_EMPTY_SPACE;
 
-    element_info[element].current_change_page = 0;
+      element_info[element].access_type = 0;
+      element_info[element].access_layer = 0;
+      element_info[element].walk_to_action = 0;
+      element_info[element].smash_targets = 0;
+      element_info[element].deadliness = 0;
+      element_info[element].consistency = 0;
 
-    /* start with no properties at all */
-    for (j = 0; j < NUM_EP_BITFIELDS; j++)
-      Properties[element][j] = EP_BITMASK_DEFAULT;
+      element_info[element].can_explode_by_fire = FALSE;
+      element_info[element].can_explode_smashed = FALSE;
+      element_info[element].can_explode_impact = FALSE;
 
-    element_info[element].modified_settings = FALSE;
-  }
+      element_info[element].current_change_page = 0;
 
-  for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
-  {
-    int element = EL_GROUP_START + i;
+      /* start with no properties at all */
+      for (j = 0; j < NUM_EP_BITFIELDS; j++)
+       Properties[element][j] = EP_BITMASK_DEFAULT;
 
-    if (element_info[element].group == NULL)
-      element_info[element].group =
-       checked_malloc(sizeof(struct ElementGroupInfo));
+      element_info[element].modified_settings = FALSE;
+    }
+    else if (IS_GROUP_ELEMENT(element))
+    {
+      /* initialize memory for list of elements in group */
+      if (element_info[element].group == NULL)
+       element_info[element].group =
+         checked_malloc(sizeof(struct ElementGroupInfo));
 
-    for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
-      element_info[element].group->element[j] = EL_EMPTY_SPACE;
+      for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
+       element_info[element].group->element[j] = EL_EMPTY_SPACE;
 
-    element_info[element].group->num_elements = 1;
+      /* default: only one element in group */
+      element_info[element].group->num_elements = 1;
+    }
   }
 
   BorderElement = EL_STEELWALL;
@@ -650,8 +654,7 @@ static int LoadLevel_CNT3(FILE *file, int chunk_size, struct LevelInfo *level)
 
   ReadUnusedBytesFromFile(file, LEVEL_CHUNK_CNT3_UNUSED);
 
-  chunk_size_expected = LEVEL_CHUNK_CNT3_HEADER + envelope_len;
-
+  chunk_size_expected = LEVEL_CHUNK_CNT3_SIZE(envelope_len);
   if (chunk_size_expected != chunk_size)
   {
     ReadUnusedBytesFromFile(file, chunk_size - LEVEL_CHUNK_CNT3_HEADER);
@@ -819,7 +822,8 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
   {
     Error(ERR_WARN, "invalid custom element number %d", element);
 
-    element = EL_DUMMY;
+    ReadUnusedBytesFromFile(file, chunk_size - 2);
+    return chunk_size;
   }
 
   ei = &element_info[element];
@@ -921,8 +925,8 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
 
 static int LoadLevel_GRP1(FILE *file, int chunk_size, struct LevelInfo *level)
 {
+  struct ElementInfo *ei;
   struct ElementGroupInfo *group;
-  int chunk_size_expected;
   int element;
   int i;
 
@@ -936,21 +940,23 @@ static int LoadLevel_GRP1(FILE *file, int chunk_size, struct LevelInfo *level)
     return chunk_size;
   }
 
+  ei = &element_info[element];
+
+  for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++)
+    ei->description[i] = getFile8Bit(file);
+  ei->description[MAX_ELEMENT_NAME_LEN] = 0;
+
   group = element_info[element].group;
 
   group->num_elements = getFile8Bit(file);
 
-  /* some free bytes for future values and padding */
-  ReadUnusedBytesFromFile(file, 7);
+  ei->use_gfx_element = getFile8Bit(file);
+  ei->gfx_element = checkLevelElement(getFile16BitBE(file));
 
-  chunk_size_expected = LEVEL_CHUNK_GRP1_SIZE(group->num_elements);
-  if (chunk_size_expected != chunk_size)
-  {
-    ReadUnusedBytesFromFile(file, chunk_size - 10);
-    return chunk_size_expected;
-  }
+  /* some free bytes for future values and padding */
+  ReadUnusedBytesFromFile(file, 4);
 
-  for (i = 0; i < group->num_elements; i++)
+  for (i = 0; i < MAX_ELEMENTS_IN_GROUP; i++)
     group->element[i] = checkLevelElement(getFile16BitBE(file));
 
   /* mark this group element as modified */
@@ -2070,17 +2076,24 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
 
 static void SaveLevel_GRP1(FILE *file, struct LevelInfo *level, int element)
 {
-  struct ElementGroupInfo *group = element_info[element].group;
+  struct ElementInfo *ei = &element_info[element];
+  struct ElementGroupInfo *group = ei->group;
   int i;
 
   putFile16BitBE(file, element);
 
+  for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++)
+    putFile8Bit(file, ei->description[i]);
+
   putFile8Bit(file, group->num_elements);
 
+  putFile8Bit(file, ei->use_gfx_element);
+  putFile16BitBE(file, ei->gfx_element);
+
   /* some free bytes for future values and padding */
-  WriteUnusedBytesToFile(file, 7);
+  WriteUnusedBytesToFile(file, 4);
 
-  for (i = 0; i < group->num_elements; i++)
+  for (i = 0; i < MAX_ELEMENTS_IN_GROUP; i++)
     putFile16BitBE(file, group->element[i]);
 }
 
@@ -2158,7 +2171,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
     {
       int envelope_len = strlen(level->envelope_text[i]) + 1;
 
-      putFileChunkBE(file, "CNT3", LEVEL_CHUNK_CNT3_HEADER + envelope_len);
+      putFileChunkBE(file, "CNT3", LEVEL_CHUNK_CNT3_SIZE(envelope_len));
       SaveLevel_CNT3(file, level, EL_ENVELOPE_1 + i);
     }
   }
@@ -2189,9 +2202,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
 
       if (element_info[element].modified_settings)
       {
-       int num_elements = element_info[element].group->num_elements;
-
-       putFileChunkBE(file, "GRP1", LEVEL_CHUNK_GRP1_SIZE(num_elements));
+       putFileChunkBE(file, "GRP1", LEVEL_CHUNK_GRP1_SIZE);
        SaveLevel_GRP1(file, level, element);
       }
     }
index 39692e8562ad56d763a6ae1893267286b26b3aa2..f3f625dc5906dafa5225298b46ff748d8d748833 100644 (file)
@@ -1476,7 +1476,7 @@ struct ElementInfo
   char *class_name;            /* element class used in config files */
   char *editor_description;    /* pre-defined description for level editor */
   char *custom_description;    /* alternative description from config file */
-  char description[MAX_ELEMENT_NAME_LEN + 1];  /* for custom elements */
+  char description[MAX_ELEMENT_NAME_LEN + 1];  /* for custom/group elements */
 
   /* ---------- graphic and sound definitions ---------- */