#define ED_AREA_ELEM_CONTENT_XPOS ( 2 * MINI_TILEX)
#define ED_AREA_ELEM_CONTENT_YPOS (22 * MINI_TILEY)
+#define ED_AREA_ELEM_CONTENT2_XPOS ( 2 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT2_YPOS (28 * MINI_TILEY)
+
/* 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)
/* drawing toolbox buttons */
#define GADGET_ID_NONE -1
-#define GADGET_ID_SINGLE_ITEMS 0
-#define GADGET_ID_CONNECTED_ITEMS 1
-#define GADGET_ID_LINE 2
-#define GADGET_ID_ARC 3
-#define GADGET_ID_RECTANGLE 4
-#define GADGET_ID_FILLED_BOX 5
-#define GADGET_ID_WRAP_UP 6
-#define GADGET_ID_TEXT 7
-#define GADGET_ID_FLOOD_FILL 8
-#define GADGET_ID_WRAP_LEFT 9
-#define GADGET_ID_PROPERTIES 10
-#define GADGET_ID_WRAP_RIGHT 11
-#define GADGET_ID_RANDOM_PLACEMENT 12
-#define GADGET_ID_GRAB_BRUSH 13
-#define GADGET_ID_WRAP_DOWN 14
-#define GADGET_ID_PICK_ELEMENT 15
-#define GADGET_ID_UNDO 16
-#define GADGET_ID_INFO 17
-#define GADGET_ID_SAVE 18
-#define GADGET_ID_CLEAR 19
-#define GADGET_ID_TEST 20
-#define GADGET_ID_EXIT 21
+#define GADGET_ID_TOOLBOX_FIRST 0
+
+#define GADGET_ID_SINGLE_ITEMS (GADGET_ID_TOOLBOX_FIRST + 0)
+#define GADGET_ID_CONNECTED_ITEMS (GADGET_ID_TOOLBOX_FIRST + 1)
+#define GADGET_ID_LINE (GADGET_ID_TOOLBOX_FIRST + 2)
+#define GADGET_ID_ARC (GADGET_ID_TOOLBOX_FIRST + 3)
+#define GADGET_ID_RECTANGLE (GADGET_ID_TOOLBOX_FIRST + 4)
+#define GADGET_ID_FILLED_BOX (GADGET_ID_TOOLBOX_FIRST + 5)
+#define GADGET_ID_WRAP_UP (GADGET_ID_TOOLBOX_FIRST + 6)
+#define GADGET_ID_TEXT (GADGET_ID_TOOLBOX_FIRST + 7)
+#define GADGET_ID_FLOOD_FILL (GADGET_ID_TOOLBOX_FIRST + 8)
+#define GADGET_ID_WRAP_LEFT (GADGET_ID_TOOLBOX_FIRST + 9)
+#define GADGET_ID_PROPERTIES (GADGET_ID_TOOLBOX_FIRST + 10)
+#define GADGET_ID_WRAP_RIGHT (GADGET_ID_TOOLBOX_FIRST + 11)
+#define GADGET_ID_RANDOM_PLACEMENT (GADGET_ID_TOOLBOX_FIRST + 12)
+#define GADGET_ID_GRAB_BRUSH (GADGET_ID_TOOLBOX_FIRST + 13)
+#define GADGET_ID_WRAP_DOWN (GADGET_ID_TOOLBOX_FIRST + 14)
+#define GADGET_ID_PICK_ELEMENT (GADGET_ID_TOOLBOX_FIRST + 15)
+#define GADGET_ID_UNDO (GADGET_ID_TOOLBOX_FIRST + 16)
+#define GADGET_ID_INFO (GADGET_ID_TOOLBOX_FIRST + 17)
+#define GADGET_ID_SAVE (GADGET_ID_TOOLBOX_FIRST + 18)
+#define GADGET_ID_CLEAR (GADGET_ID_TOOLBOX_FIRST + 19)
+#define GADGET_ID_TEST (GADGET_ID_TOOLBOX_FIRST + 20)
+#define GADGET_ID_EXIT (GADGET_ID_TOOLBOX_FIRST + 21)
/* counter button identifiers */
-#define GADGET_ID_ELEM_SCORE_DOWN 22
-#define GADGET_ID_ELEM_SCORE_TEXT 23
-#define GADGET_ID_ELEM_SCORE_UP 24
-#define GADGET_ID_ELEM_CONTENT_DOWN 25
-#define GADGET_ID_ELEM_CONTENT_TEXT 26
-#define GADGET_ID_ELEM_CONTENT_UP 27
-#define GADGET_ID_LEVEL_XSIZE_DOWN 28
-#define GADGET_ID_LEVEL_XSIZE_TEXT 29
-#define GADGET_ID_LEVEL_XSIZE_UP 30
-#define GADGET_ID_LEVEL_YSIZE_DOWN 31
-#define GADGET_ID_LEVEL_YSIZE_TEXT 32
-#define GADGET_ID_LEVEL_YSIZE_UP 33
-#define GADGET_ID_LEVEL_RANDOM_DOWN 34
-#define GADGET_ID_LEVEL_RANDOM_TEXT 35
-#define GADGET_ID_LEVEL_RANDOM_UP 36
-#define GADGET_ID_LEVEL_COLLECT_DOWN 37
-#define GADGET_ID_LEVEL_COLLECT_TEXT 38
-#define GADGET_ID_LEVEL_COLLECT_UP 39
-#define GADGET_ID_LEVEL_TIMELIMIT_DOWN 40
-#define GADGET_ID_LEVEL_TIMELIMIT_TEXT 41
-#define GADGET_ID_LEVEL_TIMELIMIT_UP 42
-#define GADGET_ID_LEVEL_TIMESCORE_DOWN 43
-#define GADGET_ID_LEVEL_TIMESCORE_TEXT 44
-#define GADGET_ID_LEVEL_TIMESCORE_UP 45
-#define GADGET_ID_SELECT_LEVEL_DOWN 46
-#define GADGET_ID_SELECT_LEVEL_TEXT 47
-#define GADGET_ID_SELECT_LEVEL_UP 48
+#define GADGET_ID_COUNTER_FIRST (GADGET_ID_TOOLBOX_FIRST + 22)
+
+#define GADGET_ID_ELEM_SCORE_DOWN (GADGET_ID_COUNTER_FIRST + 0)
+#define GADGET_ID_ELEM_SCORE_TEXT (GADGET_ID_COUNTER_FIRST + 1)
+#define GADGET_ID_ELEM_SCORE_UP (GADGET_ID_COUNTER_FIRST + 2)
+#define GADGET_ID_ELEM_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 3)
+#define GADGET_ID_ELEM_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 4)
+#define GADGET_ID_ELEM_CONTENT_UP (GADGET_ID_COUNTER_FIRST + 5)
+#define GADGET_ID_LEVEL_XSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 6)
+#define GADGET_ID_LEVEL_XSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 7)
+#define GADGET_ID_LEVEL_XSIZE_UP (GADGET_ID_COUNTER_FIRST + 8)
+#define GADGET_ID_LEVEL_YSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 9)
+#define GADGET_ID_LEVEL_YSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 10)
+#define GADGET_ID_LEVEL_YSIZE_UP (GADGET_ID_COUNTER_FIRST + 11)
+#define GADGET_ID_LEVEL_RANDOM_DOWN (GADGET_ID_COUNTER_FIRST + 12)
+#define GADGET_ID_LEVEL_RANDOM_TEXT (GADGET_ID_COUNTER_FIRST + 13)
+#define GADGET_ID_LEVEL_RANDOM_UP (GADGET_ID_COUNTER_FIRST + 14)
+#define GADGET_ID_LEVEL_COLLECT_DOWN (GADGET_ID_COUNTER_FIRST + 15)
+#define GADGET_ID_LEVEL_COLLECT_TEXT (GADGET_ID_COUNTER_FIRST + 16)
+#define GADGET_ID_LEVEL_COLLECT_UP (GADGET_ID_COUNTER_FIRST + 17)
+#define GADGET_ID_LEVEL_TIMELIMIT_DOWN (GADGET_ID_COUNTER_FIRST + 18)
+#define GADGET_ID_LEVEL_TIMELIMIT_TEXT (GADGET_ID_COUNTER_FIRST + 19)
+#define GADGET_ID_LEVEL_TIMELIMIT_UP (GADGET_ID_COUNTER_FIRST + 20)
+#define GADGET_ID_LEVEL_TIMESCORE_DOWN (GADGET_ID_COUNTER_FIRST + 21)
+#define GADGET_ID_LEVEL_TIMESCORE_TEXT (GADGET_ID_COUNTER_FIRST + 22)
+#define GADGET_ID_LEVEL_TIMESCORE_UP (GADGET_ID_COUNTER_FIRST + 23)
+#define GADGET_ID_SELECT_LEVEL_DOWN (GADGET_ID_COUNTER_FIRST + 24)
+#define GADGET_ID_SELECT_LEVEL_TEXT (GADGET_ID_COUNTER_FIRST + 25)
+#define GADGET_ID_SELECT_LEVEL_UP (GADGET_ID_COUNTER_FIRST + 26)
/* drawing area identifiers */
-#define GADGET_ID_DRAWING_LEVEL 49
-#define GADGET_ID_ELEM_CONTENT_0 50
-#define GADGET_ID_ELEM_CONTENT_1 51
-#define GADGET_ID_ELEM_CONTENT_2 52
-#define GADGET_ID_ELEM_CONTENT_3 53
-#define GADGET_ID_ELEM_CONTENT_4 54
-#define GADGET_ID_ELEM_CONTENT_5 55
-#define GADGET_ID_ELEM_CONTENT_6 56
-#define GADGET_ID_ELEM_CONTENT_7 57
-#define GADGET_ID_AMOEBA_CONTENT 58
-#define GADGET_ID_RANDOM_BACKGROUND 59
+#define GADGET_ID_DRAWING_AREA_FIRST (GADGET_ID_COUNTER_FIRST + 27)
+
+#define GADGET_ID_DRAWING_LEVEL (GADGET_ID_DRAWING_AREA_FIRST + 0)
+#define GADGET_ID_ELEM_CONTENT_0 (GADGET_ID_DRAWING_AREA_FIRST + 1)
+#define GADGET_ID_ELEM_CONTENT_1 (GADGET_ID_DRAWING_AREA_FIRST + 2)
+#define GADGET_ID_ELEM_CONTENT_2 (GADGET_ID_DRAWING_AREA_FIRST + 3)
+#define GADGET_ID_ELEM_CONTENT_3 (GADGET_ID_DRAWING_AREA_FIRST + 4)
+#define GADGET_ID_ELEM_CONTENT_4 (GADGET_ID_DRAWING_AREA_FIRST + 5)
+#define GADGET_ID_ELEM_CONTENT_5 (GADGET_ID_DRAWING_AREA_FIRST + 6)
+#define GADGET_ID_ELEM_CONTENT_6 (GADGET_ID_DRAWING_AREA_FIRST + 7)
+#define GADGET_ID_ELEM_CONTENT_7 (GADGET_ID_DRAWING_AREA_FIRST + 8)
+#define GADGET_ID_AMOEBA_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 9)
+#define GADGET_ID_CUSTOM_CHANGED (GADGET_ID_DRAWING_AREA_FIRST + 10)
+#define GADGET_ID_RANDOM_BACKGROUND (GADGET_ID_DRAWING_AREA_FIRST + 11)
/* text input identifiers */
-#define GADGET_ID_LEVEL_NAME 60
-#define GADGET_ID_LEVEL_AUTHOR 61
+#define GADGET_ID_TEXT_INPUT_FIRST (GADGET_ID_DRAWING_AREA_FIRST + 12)
+
+#define GADGET_ID_LEVEL_NAME (GADGET_ID_TEXT_INPUT_FIRST + 0)
+#define GADGET_ID_LEVEL_AUTHOR (GADGET_ID_TEXT_INPUT_FIRST + 1)
/* selectbox identifiers */
-#define GADGET_ID_SELECTBOX_TEST 62
+#define GADGET_ID_SELECTBOX_FIRST (GADGET_ID_TEXT_INPUT_FIRST + 2)
+
+#define GADGET_ID_SELECTBOX_TEST (GADGET_ID_SELECTBOX_FIRST + 0)
/* gadgets for scrolling of drawing area */
-#define GADGET_ID_SCROLL_UP 63
-#define GADGET_ID_SCROLL_DOWN 64
-#define GADGET_ID_SCROLL_LEFT 65
-#define GADGET_ID_SCROLL_RIGHT 66
-#define GADGET_ID_SCROLL_HORIZONTAL 67
-#define GADGET_ID_SCROLL_VERTICAL 68
+#define GADGET_ID_SCROLLING_FIRST (GADGET_ID_SELECTBOX_FIRST + 1)
+
+#define GADGET_ID_SCROLL_UP (GADGET_ID_SCROLLING_FIRST + 0)
+#define GADGET_ID_SCROLL_DOWN (GADGET_ID_SCROLLING_FIRST + 1)
+#define GADGET_ID_SCROLL_LEFT (GADGET_ID_SCROLLING_FIRST + 2)
+#define GADGET_ID_SCROLL_RIGHT (GADGET_ID_SCROLLING_FIRST + 3)
+#define GADGET_ID_SCROLL_HORIZONTAL (GADGET_ID_SCROLLING_FIRST + 4)
+#define GADGET_ID_SCROLL_VERTICAL (GADGET_ID_SCROLLING_FIRST + 5)
/* gadgets for scrolling element list */
-#define GADGET_ID_SCROLL_LIST_UP 69
-#define GADGET_ID_SCROLL_LIST_DOWN 70
-#define GADGET_ID_SCROLL_LIST_VERTICAL 71
+#define GADGET_ID_SCROLLING_LIST_FIRST (GADGET_ID_SCROLLING_FIRST + 6)
+
+#define GADGET_ID_SCROLL_LIST_UP (GADGET_ID_SCROLLING_LIST_FIRST + 0)
+#define GADGET_ID_SCROLL_LIST_DOWN (GADGET_ID_SCROLLING_LIST_FIRST + 1)
+#define GADGET_ID_SCROLL_LIST_VERTICAL (GADGET_ID_SCROLLING_LIST_FIRST + 2)
/* buttons for level/element properties */
-#define GADGET_ID_RANDOM_PERCENTAGE 72
-#define GADGET_ID_RANDOM_QUANTITY 73
-#define GADGET_ID_RANDOM_RESTRICTED 74
-#define GADGET_ID_DOUBLE_SPEED 75
-#define GADGET_ID_GRAVITY 76
-#define GADGET_ID_STICK_ELEMENT 77
-#define GADGET_ID_EM_SLIPPERY_GEMS 78
-#define GADGET_ID_CUSTOM_INDESTRUCTIBLE 79
-#define GADGET_ID_CUSTOM_CAN_FALL 80
-#define GADGET_ID_CUSTOM_CAN_SMASH 81
-#define GADGET_ID_CUSTOM_PUSHABLE 82
-#define GADGET_ID_CUSTOM_SLIPPERY 83
+#define GADGET_ID_CHECKBUTTON_FIRST (GADGET_ID_SCROLLING_LIST_FIRST + 3)
+
+#define GADGET_ID_RANDOM_PERCENTAGE (GADGET_ID_CHECKBUTTON_FIRST + 0)
+#define GADGET_ID_RANDOM_QUANTITY (GADGET_ID_CHECKBUTTON_FIRST + 1)
+#define GADGET_ID_RANDOM_RESTRICTED (GADGET_ID_CHECKBUTTON_FIRST + 2)
+#define GADGET_ID_DOUBLE_SPEED (GADGET_ID_CHECKBUTTON_FIRST + 3)
+#define GADGET_ID_GRAVITY (GADGET_ID_CHECKBUTTON_FIRST + 4)
+#define GADGET_ID_STICK_ELEMENT (GADGET_ID_CHECKBUTTON_FIRST + 5)
+#define GADGET_ID_EM_SLIPPERY_GEMS (GADGET_ID_CHECKBUTTON_FIRST + 6)
+#define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 7)
+#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 8)
+#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 9)
+#define GADGET_ID_CUSTOM_PUSHABLE (GADGET_ID_CHECKBUTTON_FIRST + 10)
+#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 11)
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST 84
+#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 12)
#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
ED_NUM_ELEMENTLIST_BUTTONS - 1)
level_editor_gadget[id] = gi;
}
- /* ... one for the amoeba content */
+ /* ... one for the amoeba content ... */
id = GADGET_ID_AMOEBA_CONTENT;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_X, SX + ED_AREA_ELEM_CONTENT_XPOS,
level_editor_gadget[id] = gi;
+ /* ... one for each custom element change target element ... */
+ id = GADGET_ID_CUSTOM_CHANGED;
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_X, SX + ED_AREA_ELEM_CONTENT2_XPOS,
+ GDI_Y, SY + ED_AREA_ELEM_CONTENT2_YPOS,
+ GDI_WIDTH, MINI_TILEX,
+ GDI_HEIGHT, MINI_TILEY,
+ GDI_TYPE, GD_TYPE_DRAWING_AREA,
+ GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
+ GDI_CALLBACK_ACTION, HandleDrawingAreas,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+
/* ... and one for random placement background restrictions */
id = GADGET_ID_RANDOM_BACKGROUND;
MapDrawingArea(GADGET_ID_AMOEBA_CONTENT);
}
+static void DrawCustomChangedArea()
+{
+ int area_x = ED_AREA_ELEM_CONTENT2_XPOS / MINI_TILEX;
+ int area_y = ED_AREA_ELEM_CONTENT2_YPOS / MINI_TILEY;
+ int area_sx = SX + ED_AREA_ELEM_CONTENT2_XPOS;
+ int area_sy = SY + ED_AREA_ELEM_CONTENT2_YPOS;
+ int i = properties_element - EL_CUSTOM_START;
+
+ 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] = level.custom_element_successor[i];
+
+ DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY);
+ DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
+
+ DrawText(area_sx + TILEX, area_sy + 1, "Element after change", FONT_TEXT_1);
+
+ MapDrawingArea(GADGET_ID_CUSTOM_CHANGED);
+}
+
static void DrawElementContentAreas()
{
int counter_id = ED_COUNTER_ID_ELEM_CONTENT;
else
DrawElementContentAreas();
}
+ else if (IS_CUSTOM_ELEMENT(properties_element))
+ DrawCustomChangedArea();
}
if (IS_GEM(properties_element))
if (id == GADGET_ID_AMOEBA_CONTENT)
level.amoeba_content = new_element;
+ else if (id == GADGET_ID_CUSTOM_CHANGED &&
+ IS_CUSTOM_ELEMENT(properties_element))
+ {
+ int i = properties_element - EL_CUSTOM_START;
+
+ level.custom_element_successor[i] = new_element;
+ }
else if (id == GADGET_ID_RANDOM_BACKGROUND)
random_placement_background_element = new_element;
else if (id >= GADGET_ID_ELEM_CONTENT_0 &&
else if (id == GADGET_ID_AMOEBA_CONTENT)
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"Amoeba content");
+ else if (id == GADGET_ID_CUSTOM_CHANGED)
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
+ "Next element after change");
else if (id == GADGET_ID_RANDOM_BACKGROUND)
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"Random placement background");
Ur[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = EL_EXIT_CLOSED;
for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+ {
+ level.custom_element_successor[i] = EL_EMPTY_SPACE;
Properties1[EL_CUSTOM_START + i] = EP_BITMASK_DEFAULT;
+ }
BorderElement = EL_STEELWALL;
return chunk_size;
}
+static int LoadLevel_CUS2(FILE *file, int chunk_size, struct LevelInfo *level)
+{
+ int num_changed_custom_elements = getFile16BitBE(file);
+ int chunk_size_expected = 2 + num_changed_custom_elements * 4;
+ int i;
+
+ if (chunk_size_expected != chunk_size)
+ {
+ ReadUnusedBytesFromFile(file, chunk_size - 2);
+ return chunk_size_expected;
+ }
+
+ for (i=0; i < num_changed_custom_elements; i++)
+ {
+ int element = getFile16BitBE(file);
+ int custom_element_successor = getFile16BitBE(file);
+ int i = element - EL_CUSTOM_START;
+
+ if (IS_CUSTOM_ELEMENT(element))
+ level->custom_element_successor[i] = custom_element_successor;
+ else
+ Error(ERR_WARN, "invalid custom element number %d", element);
+ }
+
+ return chunk_size;
+}
+
void LoadLevelFromFilename(char *filename)
{
char cookie[MAX_LINE_LEN];
{ "CONT", -1, LoadLevel_CONT },
{ "CNT2", LEVEL_CHUNK_CNT2_SIZE, LoadLevel_CNT2 },
{ "CUS1", -1, LoadLevel_CUS1 },
+ { "CUS2", -1, LoadLevel_CUS2 },
{ NULL, 0, NULL }
};
putFile16BitBE(file, content_array[i][x][y]);
}
-static void SaveLevel_CUS1(FILE *file, int num_changed_custom_elements)
+static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level,
+ int num_changed_custom_elements)
{
int i, check = 0;
Error(ERR_WARN, "inconsistent number of custom element properties");
}
+static void SaveLevel_CUS2(FILE *file, struct LevelInfo *level,
+ int num_changed_custom_elements)
+{
+ int i, check = 0;
+
+ putFile16BitBE(file, num_changed_custom_elements);
+
+ for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+ {
+ int element = EL_CUSTOM_START + i;
+
+ if (level->custom_element_successor[i] != EL_EMPTY_SPACE)
+ {
+ if (check < num_changed_custom_elements)
+ {
+ putFile16BitBE(file, element);
+ putFile16BitBE(file, level->custom_element_successor[i]);
+ }
+
+ check++;
+ }
+ }
+
+ if (check != num_changed_custom_elements) /* should not happen */
+ Error(ERR_WARN, "inconsistent number of custom element successors");
+}
+
void SaveLevel(int level_nr)
{
char *filename = getLevelFilename(level_nr);
int body_chunk_size;
- int num_changed_custom_elements = 0;
+ int num_changed_custom_elements1 = 0;
+ int num_changed_custom_elements2 = 0;
int i, x, y;
FILE *file;
/* check for non-standard custom elements and calculate "CUS1" chunk size */
for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
if (Properties1[EL_CUSTOM_START + i] != EP_BITMASK_DEFAULT)
- num_changed_custom_elements++;
+ num_changed_custom_elements1++;
+
+ /* check for non-standard custom elements and calculate "CUS2" chunk size */
+ for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+ if (level.custom_element_successor[i] != EL_EMPTY_SPACE)
+ num_changed_custom_elements2++;
putFileChunkBE(file, "RND1", CHUNK_SIZE_UNDEFINED);
putFileChunkBE(file, "CAVE", CHUNK_SIZE_NONE);
SaveLevel_CNT2(file, &level, EL_BD_AMOEBA);
}
- if (num_changed_custom_elements > 0)
+ if (num_changed_custom_elements1 > 0)
+ {
+ putFileChunkBE(file, "CUS1", 2 + num_changed_custom_elements1 * 6);
+ SaveLevel_CUS1(file, &level, num_changed_custom_elements1);
+ }
+
+ if (num_changed_custom_elements2 > 0)
{
- putFileChunkBE(file, "CUS1", 2 + num_changed_custom_elements * 6);
- SaveLevel_CUS1(file, num_changed_custom_elements);
+ putFileChunkBE(file, "CUS2", 2 + num_changed_custom_elements2 * 4);
+ SaveLevel_CUS2(file, &level, num_changed_custom_elements2);
}
fclose(file);