dc7fdc82ce8e760028335d404cbe00f4b5ac3987
[rocksndiamonds.git] / src / editor.c
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // editor.c
10 // ============================================================================
11
12 #include <math.h>
13
14 #include "libgame/libgame.h"
15
16 #include "editor.h"
17 #include "screens.h"
18 #include "tools.h"
19 #include "files.h"
20 #include "game.h"
21 #include "init.h"
22 #include "tape.h"
23
24
25 #define INFOTEXT_UNKNOWN_ELEMENT        "unknown"
26
27
28 /*
29   -----------------------------------------------------------------------------
30   screen and artwork graphic pixel position definitions
31   -----------------------------------------------------------------------------
32 */
33
34 /* values for the control window */
35 #define ED_CTRL1_BUTTONS_HORIZ          4
36 #define ED_CTRL1_BUTTONS_VERT           4
37 #define ED_CTRL2_BUTTONS_HORIZ          3
38 #define ED_CTRL2_BUTTONS_VERT           2
39 #define ED_CTRL3_BUTTONS_HORIZ          3
40 #define ED_CTRL3_BUTTONS_VERT           1
41 #define ED_CTRL4_BUTTONS_HORIZ          2
42 #define ED_CTRL4_BUTTONS_VERT           1
43 #define ED_CTRL5_BUTTONS_HORIZ          1
44 #define ED_CTRL5_BUTTONS_VERT           1
45
46 #define ED_NUM_CTRL1_BUTTONS   (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
47 #define ED_NUM_CTRL2_BUTTONS   (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
48 #define ED_NUM_CTRL3_BUTTONS   (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT)
49 #define ED_NUM_CTRL4_BUTTONS   (ED_CTRL4_BUTTONS_HORIZ * ED_CTRL4_BUTTONS_VERT)
50 #define ED_NUM_CTRL5_BUTTONS   (ED_CTRL5_BUTTONS_HORIZ * ED_CTRL5_BUTTONS_VERT)
51 #define ED_NUM_CTRL1_2_BUTTONS (ED_NUM_CTRL1_BUTTONS   + ED_NUM_CTRL2_BUTTONS)
52 #define ED_NUM_CTRL1_3_BUTTONS (ED_NUM_CTRL1_2_BUTTONS + ED_NUM_CTRL3_BUTTONS)
53 #define ED_NUM_CTRL1_4_BUTTONS (ED_NUM_CTRL1_3_BUTTONS + ED_NUM_CTRL4_BUTTONS)
54 #define ED_NUM_CTRL_BUTTONS    (ED_NUM_CTRL1_4_BUTTONS + ED_NUM_CTRL5_BUTTONS)
55
56 /* values for the element list */
57 #define ED_ELEMENTLIST_XPOS             (editor.palette.x)
58 #define ED_ELEMENTLIST_YPOS             (editor.palette.y)
59 #define ED_ELEMENTLIST_XSIZE            (graphic_info[IMG_EDITOR_PALETTE_BUTTON].width)
60 #define ED_ELEMENTLIST_YSIZE            (graphic_info[IMG_EDITOR_PALETTE_BUTTON].height)
61 #define ED_ELEMENTLIST_BUTTONS_HORIZ    (editor.palette.cols)
62 #define ED_ELEMENTLIST_BUTTONS_VERT     (editor.palette.rows)
63 #define ED_NUM_ELEMENTLIST_BUTTONS      (ED_ELEMENTLIST_BUTTONS_HORIZ * \
64                                          ED_ELEMENTLIST_BUTTONS_VERT)
65
66 /* standard distances */
67 #define ED_GADGET_NORMAL_DISTANCE       (editor.gadget.normal_spacing)
68 #define ED_GADGET_SMALL_DISTANCE        (editor.gadget.small_spacing)
69 #define ED_GADGET_TINY_DISTANCE         (editor.gadget.tiny_spacing)
70 #define ED_GADGET_LINE_DISTANCE         (editor.gadget.line_spacing)
71 #define ED_GADGET_TEXT_DISTANCE         (editor.gadget.text_spacing)
72 #define ED_TAB_BAR_HEIGHT               (editor.gadget.separator_line.height)
73 #define ED_DRAWINGAREA_TEXT_DISTANCE    (ED_GADGET_TEXT_DISTANCE +      \
74                                          ED_DRAWINGAREA_BORDER_SIZE)
75 #define ED_GADGET_SPACE_DISTANCE        (getFontWidth(FONT_TEXT_1))
76
77 /* values for drawingarea gadgets */
78 #define IMG_BORDER_1                    IMG_EDITOR_ELEMENT_BORDER
79 #define IMG_BORDER_2                    IMG_EDITOR_ELEMENT_BORDER_INPUT
80 #define ED_ELEMENT_BORDER               (graphic_info[IMG_BORDER_1].border_size)
81 #define ED_DRAWINGAREA_BORDER_SIZE      (graphic_info[IMG_BORDER_2].border_size)
82 #define ED_DRAWINGAREA_TILE_SIZE        (graphic_info[IMG_BORDER_2].tile_size)
83
84 /* values for checkbutton gadgets */
85 #define ED_CHECKBUTTON_XSIZE         (graphic_info[IMG_EDITOR_CHECKBOX].width)
86 #define ED_CHECKBUTTON_YSIZE         (graphic_info[IMG_EDITOR_CHECKBOX].height)
87
88 #define ED_TABBUTTON_XSIZE           (graphic_info[IMG_EDITOR_TABBUTTON].width)
89 #define ED_TABBUTTON_YSIZE           (graphic_info[IMG_EDITOR_TABBUTTON].height)
90
91 #define ED_LEVEL_SETTINGS_TABS_X        (editor.settings.tabs.x)
92 #define ED_LEVEL_SETTINGS_TABS_Y        (editor.settings.tabs.y)
93 #define ED_ELEMENT_SETTINGS_TABS_X      (editor.settings.tabs.x)
94 #define ED_ELEMENT_SETTINGS_TABS_Y      (editor.settings.tabs.y +       \
95                                          editor.settings.tabs.yoffset2)
96
97 #define ED_SETTINGS_TABS_XOFFSET        (editor.settings.tabs.draw_xoffset)
98 #define ED_SETTINGS_TABS_YOFFSET        (editor.settings.tabs.draw_yoffset)
99
100 #define ED_LEVEL_SETTINGS_XSTART        (ED_LEVEL_SETTINGS_TABS_X +     \
101                                          ED_SETTINGS_TABS_XOFFSET)
102 #define ED_LEVEL_SETTINGS_YSTART        (ED_LEVEL_SETTINGS_TABS_Y +     \
103                                          ED_TABBUTTON_YSIZE +           \
104                                          ED_GADGET_TINY_DISTANCE +      \
105                                          ED_TAB_BAR_HEIGHT +            \
106                                          ED_SETTINGS_TABS_YOFFSET +     \
107                                          getFontHeight(FONT_TEXT_1) +   \
108                                          ED_GADGET_TEXT_DISTANCE)
109 #define ED_ELEMENT_SETTINGS_XSTART      (ED_ELEMENT_SETTINGS_TABS_X +   \
110                                          ED_SETTINGS_TABS_XOFFSET)
111 #define ED_ELEMENT_SETTINGS_YSTART      (ED_ELEMENT_SETTINGS_TABS_Y +   \
112                                          ED_TABBUTTON_YSIZE +           \
113                                          ED_GADGET_TINY_DISTANCE +      \
114                                          ED_TAB_BAR_HEIGHT +            \
115                                          ED_SETTINGS_TABS_YOFFSET)
116
117 #define ED_SETTINGS_XOFFSET             (ED_CHECKBUTTON_XSIZE +         \
118                                          ED_GADGET_TEXT_DISTANCE)
119 #define ED_SETTINGS_YOFFSET             (ED_CHECKBUTTON_YSIZE +         \
120                                          ED_GADGET_LINE_DISTANCE)
121
122 #define ED_POS_LEVEL_SETTINGS_RANGE     (10000)
123 #define ED_POS_LEVEL_SETTINGS_FIRST     (1 * ED_POS_LEVEL_SETTINGS_RANGE)
124 #define ED_POS_LEVEL_SETTINGS_LAST      (2 * ED_POS_LEVEL_SETTINGS_RANGE - 1)
125 #define ED_POS_ELEMENT_SETTINGS_FIRST   (2 * ED_POS_LEVEL_SETTINGS_RANGE)
126 #define ED_POS_ELEMENT_SETTINGS_LAST    (3 * ED_POS_LEVEL_SETTINGS_RANGE - 1)
127
128 #define ED_LEVEL_SETTINGS_XPOS(n)       (ED_POS_LEVEL_SETTINGS_FIRST + (n))
129 #define ED_LEVEL_SETTINGS_YPOS(n)       (ED_POS_LEVEL_SETTINGS_FIRST + (n))
130
131 #define ED_ELEMENT_SETTINGS_XPOS(n)     (ED_POS_ELEMENT_SETTINGS_FIRST + (n))
132 #define ED_ELEMENT_SETTINGS_YPOS(n)     (ED_POS_ELEMENT_SETTINGS_FIRST + (n))
133
134 #define IS_POS_LEVEL_SETTINGS(n)      ((n) >= ED_POS_LEVEL_SETTINGS_FIRST && \
135                                        (n) <= ED_POS_LEVEL_SETTINGS_LAST)
136 #define IS_POS_ELEMENT_SETTINGS(n)    ((n) >= ED_POS_ELEMENT_SETTINGS_FIRST && \
137                                        (n) <= ED_POS_ELEMENT_SETTINGS_LAST)
138
139 #define ED_LEVEL_SETTINGS_LINE(n)       ((n) - ED_POS_LEVEL_SETTINGS_FIRST)
140 #define ED_ELEMENT_SETTINGS_LINE(n)     ((n) - ED_POS_ELEMENT_SETTINGS_FIRST)
141
142 #define ED_LEVEL_SETTINGS_X(n)          (ED_LEVEL_SETTINGS_XSTART +     \
143                                          (n) * ED_SETTINGS_XOFFSET)
144 #define ED_LEVEL_SETTINGS_Y(n)          (ED_LEVEL_SETTINGS_YSTART +     \
145                                          (n) * ED_SETTINGS_YOFFSET)
146
147 #define ED_ELEMENT_SETTINGS_X(n)        (ED_ELEMENT_SETTINGS_XSTART +   \
148                                          (n) * ED_SETTINGS_XOFFSET)
149 #define ED_ELEMENT_SETTINGS_Y(n)        (ED_ELEMENT_SETTINGS_YSTART +   \
150                                          (n) * ED_SETTINGS_YOFFSET)
151
152 #define ED_POS_TO_LEVEL_SETTINGS_X(n)   \
153   (ED_LEVEL_SETTINGS_X(ED_LEVEL_SETTINGS_LINE(n)))
154 #define ED_POS_TO_LEVEL_SETTINGS_Y(n)   \
155   (ED_LEVEL_SETTINGS_Y(ED_LEVEL_SETTINGS_LINE(n)))
156
157 #define ED_POS_TO_ELEMENT_SETTINGS_X(n) \
158   (ED_ELEMENT_SETTINGS_X(ED_ELEMENT_SETTINGS_LINE(n)))
159 #define ED_POS_TO_ELEMENT_SETTINGS_Y(n) \
160   (ED_ELEMENT_SETTINGS_Y(ED_ELEMENT_SETTINGS_LINE(n)))
161
162 #define ED_SETTINGS_X(n)                (IS_POS_LEVEL_SETTINGS(n) ?     \
163                                          ED_POS_TO_LEVEL_SETTINGS_X(n) : \
164                                          IS_POS_ELEMENT_SETTINGS(n) ?   \
165                                          ED_POS_TO_ELEMENT_SETTINGS_X(n) : (n))
166 #define ED_SETTINGS_Y(n)                (IS_POS_LEVEL_SETTINGS(n) ?     \
167                                          ED_POS_TO_LEVEL_SETTINGS_Y(n) : \
168                                          IS_POS_ELEMENT_SETTINGS(n) ?   \
169                                          ED_POS_TO_ELEMENT_SETTINGS_Y(n) : (n))
170
171 #define ED_TAB_SETTINGS_X(n)            (IS_POS_LEVEL_SETTINGS(n) ?     \
172                                          ED_LEVEL_SETTINGS_TABS_X :     \
173                                          ED_ELEMENT_SETTINGS_TABS_X)
174 #define ED_TAB_SETTINGS_Y(n)            (IS_POS_LEVEL_SETTINGS(n) ?     \
175                                          ED_LEVEL_SETTINGS_TABS_Y :     \
176                                          ED_ELEMENT_SETTINGS_TABS_Y)
177
178 #define ED_SETTINGS_XOFF(n)             (5 * ((n) % 4) *                \
179                                          ED_DRAWINGAREA_TILE_SIZE)
180 #define ED_SETTINGS_YOFF(n)             (5 * ((n) / 4) *                \
181                                          ED_DRAWINGAREA_TILE_SIZE)
182
183 #define ED_AREA_XOFFSET_1(n)            ((n) != 0 ?                     \
184                                          ED_DRAWINGAREA_BORDER_SIZE : 0)
185 #define ED_AREA_YOFFSET_1(n)            ((n) != 0 ?                     \
186                                          (ED_CHECKBUTTON_YSIZE -        \
187                                           ED_DRAWINGAREA_TILE_SIZE) / 2 : 0)
188
189 #define ED_AREA_XOFFSET_2(n)      (0)
190 #define ED_AREA_YOFFSET_2(n)      ((n) == 3 ?                   \
191                                    ((n) - 1) * ED_DRAWINGAREA_TILE_SIZE / 2 : 0)
192
193 #define ED_AREA_SETTINGS_X(i)      (ED_SETTINGS_X((i).x) +              \
194                                     ED_SETTINGS_XOFF((i).xoffset) +     \
195                                     ED_AREA_XOFFSET_1((i).x) -          \
196                                     ED_AREA_XOFFSET_2((i).area_xsize))
197 #define ED_AREA_SETTINGS_Y(i)      (ED_SETTINGS_Y((i).y) +              \
198                                     ED_SETTINGS_YOFF((i).yoffset) +     \
199                                     ED_AREA_YOFFSET_1((i).y) -          \
200                                     ED_AREA_YOFFSET_2((i).area_ysize))
201
202 /* values for element content drawing areas */
203 #define ED_AREA_1X1_LSETTINGS_XPOS(n)   ED_LEVEL_SETTINGS_XPOS(n)
204 #define ED_AREA_1X1_LSETTINGS_YPOS(n)   ED_LEVEL_SETTINGS_YPOS(n)
205 #define ED_AREA_1X1_LSETTINGS_XOFF      (0)
206 #define ED_AREA_1X1_LSETTINGS_YOFF      (0)
207
208 #define ED_AREA_1X1_SETTINGS_XPOS(n)    ED_ELEMENT_SETTINGS_XPOS(n)
209 #define ED_AREA_1X1_SETTINGS_YPOS(n)    ED_ELEMENT_SETTINGS_YPOS(n)
210 #define ED_AREA_1X1_SETTINGS_XOFF       (0)
211 #define ED_AREA_1X1_SETTINGS_YOFF       (0)
212
213 #define ED_AREA_3X3_SETTINGS_XPOS(n)    ED_ELEMENT_SETTINGS_XPOS(n)
214 #define ED_AREA_3X3_SETTINGS_YPOS(n)    ED_ELEMENT_SETTINGS_YPOS(n)
215 #define ED_AREA_3X3_SETTINGS_XOFF       (0)
216 #define ED_AREA_3X3_SETTINGS_YOFF       (0)
217
218 /* element content */
219 #define ED_AREA_ELEMENT_CONTENT_XOFF(n) (n)
220 #define ED_AREA_ELEMENT_CONTENT_YOFF(n) (n)
221
222 /* yamyam content */
223 #define ED_XPOS_YAM                     0
224 #define ED_YPOS_YAM                     5
225 #define ED_AREA_YAMYAM_CONTENT_XPOS     ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_YAM)
226 #define ED_AREA_YAMYAM_CONTENT_YPOS     ED_ELEMENT_SETTINGS_YPOS(ED_YPOS_YAM)
227 #define ED_AREA_YAMYAM_CONTENT_XOFF(n)  ED_AREA_ELEMENT_CONTENT_XOFF(n)
228 #define ED_AREA_YAMYAM_CONTENT_YOFF(n)  ED_AREA_ELEMENT_CONTENT_YOFF(n)
229 #define ED_AREA_YAMYAM_CONTENT_X(n)     (ED_ELEMENT_SETTINGS_X(ED_XPOS_YAM) + \
230                                          ED_SETTINGS_XOFF(n))
231 #define ED_AREA_YAMYAM_CONTENT_Y(n)     (ED_ELEMENT_SETTINGS_Y(ED_YPOS_YAM) + \
232                                          ED_SETTINGS_YOFF(n) +          \
233                                          ED_AREA_YOFFSET_1(ED_YPOS_YAM) - \
234                                          ED_AREA_YOFFSET_2(3))
235
236 /* magic ball content */
237 #define ED_XPOS_BALL                    0
238 #define ED_YPOS_BALL                    6
239 #define ED_AREA_MAGIC_BALL_CONTENT_XPOS ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_BALL)
240 #define ED_AREA_MAGIC_BALL_CONTENT_YPOS ED_ELEMENT_SETTINGS_YPOS(ED_YPOS_BALL)
241 #define ED_AREA_MAGIC_BALL_CONTENT_XOFF(n) ED_AREA_ELEMENT_CONTENT_XOFF(n)
242 #define ED_AREA_MAGIC_BALL_CONTENT_YOFF(n) ED_AREA_ELEMENT_CONTENT_YOFF(n)
243 #define ED_AREA_MAGIC_BALL_CONTENT_X(n) (ED_ELEMENT_SETTINGS_X(ED_XPOS_BALL) + \
244                                          ED_SETTINGS_XOFF(n))
245 #define ED_AREA_MAGIC_BALL_CONTENT_Y(n) (ED_ELEMENT_SETTINGS_Y(ED_YPOS_BALL) + \
246                                          ED_SETTINGS_YOFF(n) +          \
247                                          ED_AREA_YOFFSET_1(ED_YPOS_BALL) - \
248                                          ED_AREA_YOFFSET_2(3))
249
250 /* values for scrolling gadgets for drawing area */
251 #define ED_SCROLLBUTTON_XSIZE           16
252 #define ED_SCROLLBUTTON_YSIZE           16
253
254 #define ED_SCROLL_UP_XPOS               (SXSIZE - ED_SCROLLBUTTON_XSIZE)
255 #define ED_SCROLL_UP_YPOS               (0)
256 #define ED_SCROLL_DOWN_XPOS             ED_SCROLL_UP_XPOS
257 #define ED_SCROLL_DOWN_YPOS             (SYSIZE - 3 * ED_SCROLLBUTTON_YSIZE)
258 #define ED_SCROLL_LEFT_XPOS             (0)
259 #define ED_SCROLL_LEFT_YPOS             (SYSIZE - 2 * ED_SCROLLBUTTON_YSIZE)
260 #define ED_SCROLL_RIGHT_XPOS            (SXSIZE - 2 * ED_SCROLLBUTTON_XSIZE)
261 #define ED_SCROLL_RIGHT_YPOS            ED_SCROLL_LEFT_YPOS
262 #define ED_SCROLL_HORIZONTAL_XPOS       (ED_SCROLL_LEFT_XPOS +          \
263                                          ED_SCROLLBUTTON_XSIZE)
264 #define ED_SCROLL_HORIZONTAL_YPOS       ED_SCROLL_LEFT_YPOS
265 #define ED_SCROLL_HORIZONTAL_XSIZE      (SXSIZE - 3 * ED_SCROLLBUTTON_XSIZE)
266 #define ED_SCROLL_HORIZONTAL_YSIZE      ED_SCROLLBUTTON_YSIZE
267 #define ED_SCROLL_VERTICAL_XPOS         ED_SCROLL_UP_XPOS
268 #define ED_SCROLL_VERTICAL_YPOS         (ED_SCROLL_UP_YPOS +            \
269                                          ED_SCROLLBUTTON_YSIZE)
270 #define ED_SCROLL_VERTICAL_XSIZE        ED_SCROLLBUTTON_XSIZE
271 #define ED_SCROLL_VERTICAL_YSIZE        (SYSIZE - 4 * ED_SCROLLBUTTON_YSIZE)
272
273 /* values for scrolling gadgets for element list */
274 #define ED_SCROLLBUTTON2_XSIZE          (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].width)
275 #define ED_SCROLLBUTTON2_YSIZE          (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].height)
276
277 #define ED_SCROLL2_UP_XPOS              (ED_ELEMENTLIST_XPOS +          \
278                                          ED_ELEMENTLIST_BUTTONS_HORIZ * \
279                                          ED_ELEMENTLIST_XSIZE)
280 #define ED_SCROLL2_UP_YPOS              ED_ELEMENTLIST_YPOS
281 #define ED_SCROLL2_DOWN_XPOS            ED_SCROLL2_UP_XPOS
282 #define ED_SCROLL2_DOWN_YPOS            (ED_SCROLL2_UP_YPOS +           \
283                                          ED_ELEMENTLIST_BUTTONS_VERT *  \
284                                          ED_ELEMENTLIST_YSIZE -         \
285                                          ED_SCROLLBUTTON2_YSIZE)
286 #define ED_SCROLL2_VERTICAL_XPOS        ED_SCROLL2_UP_XPOS
287 #define ED_SCROLL2_VERTICAL_YPOS        (ED_SCROLL2_UP_YPOS +           \
288                                          ED_SCROLLBUTTON2_YSIZE)
289 #define ED_SCROLL2_VERTICAL_XSIZE       ED_SCROLLBUTTON2_XSIZE
290 #define ED_SCROLL2_VERTICAL_YSIZE       (ED_ELEMENTLIST_BUTTONS_VERT *  \
291                                          ED_ELEMENTLIST_YSIZE -         \
292                                          2 * ED_SCROLLBUTTON2_YSIZE)
293
294 /* values for ClearEditorGadgetInfoText() and HandleEditorGadgetInfoText() */
295 #define INFOTEXT_FONT           FONT_TEXT_2
296 #define INFOTEXT_XSIZE          SXSIZE
297 #define INFOTEXT_YSIZE          getFontHeight(INFOTEXT_FONT)
298 #define INFOTEXT_YSIZE_FULL     (INFOTEXT_YSIZE + ED_GADGET_SMALL_DISTANCE)
299 #define INFOTEXT_XPOS           SX
300 #define INFOTEXT_YPOS           (SY + SYSIZE - INFOTEXT_YSIZE)
301
302
303 /*
304   -----------------------------------------------------------------------------
305   editor gadget definitions
306   -----------------------------------------------------------------------------
307 */
308
309 /* drawing toolbox buttons */
310 #define GADGET_ID_NONE                  -1
311 #define GADGET_ID_TOOLBOX_FIRST         0
312
313 #define GADGET_ID_SINGLE_ITEMS          (GADGET_ID_TOOLBOX_FIRST + 0)
314 #define GADGET_ID_CONNECTED_ITEMS       (GADGET_ID_TOOLBOX_FIRST + 1)
315 #define GADGET_ID_LINE                  (GADGET_ID_TOOLBOX_FIRST + 2)
316 #define GADGET_ID_ARC                   (GADGET_ID_TOOLBOX_FIRST + 3)
317 #define GADGET_ID_RECTANGLE             (GADGET_ID_TOOLBOX_FIRST + 4)
318 #define GADGET_ID_FILLED_BOX            (GADGET_ID_TOOLBOX_FIRST + 5)
319 #define GADGET_ID_WRAP_UP               (GADGET_ID_TOOLBOX_FIRST + 6)
320 #define GADGET_ID_TEXT                  (GADGET_ID_TOOLBOX_FIRST + 7)
321 #define GADGET_ID_FLOOD_FILL            (GADGET_ID_TOOLBOX_FIRST + 8)
322 #define GADGET_ID_WRAP_LEFT             (GADGET_ID_TOOLBOX_FIRST + 9)
323 #define GADGET_ID_ZOOM                  (GADGET_ID_TOOLBOX_FIRST + 10)
324 #define GADGET_ID_WRAP_RIGHT            (GADGET_ID_TOOLBOX_FIRST + 11)
325 #define GADGET_ID_RANDOM_PLACEMENT      (GADGET_ID_TOOLBOX_FIRST + 12)
326 #define GADGET_ID_GRAB_BRUSH            (GADGET_ID_TOOLBOX_FIRST + 13)
327 #define GADGET_ID_WRAP_DOWN             (GADGET_ID_TOOLBOX_FIRST + 14)
328 #define GADGET_ID_PICK_ELEMENT          (GADGET_ID_TOOLBOX_FIRST + 15)
329
330 #define GADGET_ID_UNDO                  (GADGET_ID_TOOLBOX_FIRST + 16)
331 #define GADGET_ID_INFO                  (GADGET_ID_TOOLBOX_FIRST + 17)
332 #define GADGET_ID_SAVE                  (GADGET_ID_TOOLBOX_FIRST + 18)
333 #define GADGET_ID_CLEAR                 (GADGET_ID_TOOLBOX_FIRST + 19)
334 #define GADGET_ID_TEST                  (GADGET_ID_TOOLBOX_FIRST + 20)
335 #define GADGET_ID_EXIT                  (GADGET_ID_TOOLBOX_FIRST + 21)
336
337 #define GADGET_ID_CUSTOM_COPY_FROM      (GADGET_ID_TOOLBOX_FIRST + 22)
338 #define GADGET_ID_CUSTOM_COPY_TO        (GADGET_ID_TOOLBOX_FIRST + 23)
339 #define GADGET_ID_CUSTOM_EXCHANGE       (GADGET_ID_TOOLBOX_FIRST + 24)
340 #define GADGET_ID_CUSTOM_COPY           (GADGET_ID_TOOLBOX_FIRST + 25)
341 #define GADGET_ID_CUSTOM_PASTE          (GADGET_ID_TOOLBOX_FIRST + 26)
342
343 #define GADGET_ID_PROPERTIES            (GADGET_ID_TOOLBOX_FIRST + 27)
344
345 /* counter gadget identifiers */
346 #define GADGET_ID_COUNTER_FIRST         (GADGET_ID_TOOLBOX_FIRST + 28)
347
348 #define GADGET_ID_SELECT_LEVEL_DOWN     (GADGET_ID_COUNTER_FIRST + 0)
349 #define GADGET_ID_SELECT_LEVEL_TEXT     (GADGET_ID_COUNTER_FIRST + 1)
350 #define GADGET_ID_SELECT_LEVEL_UP       (GADGET_ID_COUNTER_FIRST + 2)
351 #define GADGET_ID_LEVEL_XSIZE_DOWN      (GADGET_ID_COUNTER_FIRST + 3)
352 #define GADGET_ID_LEVEL_XSIZE_TEXT      (GADGET_ID_COUNTER_FIRST + 4)
353 #define GADGET_ID_LEVEL_XSIZE_UP        (GADGET_ID_COUNTER_FIRST + 5)
354 #define GADGET_ID_LEVEL_YSIZE_DOWN      (GADGET_ID_COUNTER_FIRST + 6)
355 #define GADGET_ID_LEVEL_YSIZE_TEXT      (GADGET_ID_COUNTER_FIRST + 7)
356 #define GADGET_ID_LEVEL_YSIZE_UP        (GADGET_ID_COUNTER_FIRST + 8)
357 #define GADGET_ID_LEVEL_RANDOM_DOWN     (GADGET_ID_COUNTER_FIRST + 9)
358 #define GADGET_ID_LEVEL_RANDOM_TEXT     (GADGET_ID_COUNTER_FIRST + 10)
359 #define GADGET_ID_LEVEL_RANDOM_UP       (GADGET_ID_COUNTER_FIRST + 11)
360 #define GADGET_ID_LEVEL_GEMSLIMIT_DOWN  (GADGET_ID_COUNTER_FIRST + 12)
361 #define GADGET_ID_LEVEL_GEMSLIMIT_TEXT  (GADGET_ID_COUNTER_FIRST + 13)
362 #define GADGET_ID_LEVEL_GEMSLIMIT_UP    (GADGET_ID_COUNTER_FIRST + 14)
363 #define GADGET_ID_LEVEL_TIMELIMIT_DOWN  (GADGET_ID_COUNTER_FIRST + 15)
364 #define GADGET_ID_LEVEL_TIMELIMIT_TEXT  (GADGET_ID_COUNTER_FIRST + 16)
365 #define GADGET_ID_LEVEL_TIMELIMIT_UP    (GADGET_ID_COUNTER_FIRST + 17)
366 #define GADGET_ID_LEVEL_TIMESCORE_DOWN  (GADGET_ID_COUNTER_FIRST + 18)
367 #define GADGET_ID_LEVEL_TIMESCORE_TEXT  (GADGET_ID_COUNTER_FIRST + 19)
368 #define GADGET_ID_LEVEL_TIMESCORE_UP    (GADGET_ID_COUNTER_FIRST + 20)
369 #define GADGET_ID_LEVEL_RANDOM_SEED_DOWN (GADGET_ID_COUNTER_FIRST + 21)
370 #define GADGET_ID_LEVEL_RANDOM_SEED_TEXT (GADGET_ID_COUNTER_FIRST + 22)
371 #define GADGET_ID_LEVEL_RANDOM_SEED_UP  (GADGET_ID_COUNTER_FIRST + 23)
372 #define GADGET_ID_ELEMENT_VALUE1_DOWN   (GADGET_ID_COUNTER_FIRST + 24)
373 #define GADGET_ID_ELEMENT_VALUE1_TEXT   (GADGET_ID_COUNTER_FIRST + 25)
374 #define GADGET_ID_ELEMENT_VALUE1_UP     (GADGET_ID_COUNTER_FIRST + 26)
375 #define GADGET_ID_ELEMENT_VALUE2_DOWN   (GADGET_ID_COUNTER_FIRST + 27)
376 #define GADGET_ID_ELEMENT_VALUE2_TEXT   (GADGET_ID_COUNTER_FIRST + 28)
377 #define GADGET_ID_ELEMENT_VALUE2_UP     (GADGET_ID_COUNTER_FIRST + 29)
378 #define GADGET_ID_ELEMENT_VALUE3_DOWN   (GADGET_ID_COUNTER_FIRST + 30)
379 #define GADGET_ID_ELEMENT_VALUE3_TEXT   (GADGET_ID_COUNTER_FIRST + 31)
380 #define GADGET_ID_ELEMENT_VALUE3_UP     (GADGET_ID_COUNTER_FIRST + 32)
381 #define GADGET_ID_ELEMENT_VALUE4_DOWN   (GADGET_ID_COUNTER_FIRST + 33)
382 #define GADGET_ID_ELEMENT_VALUE4_TEXT   (GADGET_ID_COUNTER_FIRST + 34)
383 #define GADGET_ID_ELEMENT_VALUE4_UP     (GADGET_ID_COUNTER_FIRST + 35)
384 #define GADGET_ID_YAMYAM_CONTENT_DOWN   (GADGET_ID_COUNTER_FIRST + 36)
385 #define GADGET_ID_YAMYAM_CONTENT_TEXT   (GADGET_ID_COUNTER_FIRST + 37)
386 #define GADGET_ID_YAMYAM_CONTENT_UP     (GADGET_ID_COUNTER_FIRST + 38)
387 #define GADGET_ID_BALL_CONTENT_DOWN     (GADGET_ID_COUNTER_FIRST + 39)
388 #define GADGET_ID_BALL_CONTENT_TEXT     (GADGET_ID_COUNTER_FIRST + 40)
389 #define GADGET_ID_BALL_CONTENT_UP       (GADGET_ID_COUNTER_FIRST + 41)
390 #define GADGET_ID_ANDROID_CONTENT_DOWN  (GADGET_ID_COUNTER_FIRST + 42)
391 #define GADGET_ID_ANDROID_CONTENT_TEXT  (GADGET_ID_COUNTER_FIRST + 43)
392 #define GADGET_ID_ANDROID_CONTENT_UP    (GADGET_ID_COUNTER_FIRST + 44)
393 #define GADGET_ID_ENVELOPE_XSIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 45)
394 #define GADGET_ID_ENVELOPE_XSIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 46)
395 #define GADGET_ID_ENVELOPE_XSIZE_UP     (GADGET_ID_COUNTER_FIRST + 47)
396 #define GADGET_ID_ENVELOPE_YSIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 48)
397 #define GADGET_ID_ENVELOPE_YSIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 49)
398 #define GADGET_ID_ENVELOPE_YSIZE_UP     (GADGET_ID_COUNTER_FIRST + 50)
399 #define GADGET_ID_INVENTORY_SIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 51)
400 #define GADGET_ID_INVENTORY_SIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 52)
401 #define GADGET_ID_INVENTORY_SIZE_UP     (GADGET_ID_COUNTER_FIRST + 53)
402 #define GADGET_ID_CUSTOM_SCORE_DOWN     (GADGET_ID_COUNTER_FIRST + 54)
403 #define GADGET_ID_CUSTOM_SCORE_TEXT     (GADGET_ID_COUNTER_FIRST + 55)
404 #define GADGET_ID_CUSTOM_SCORE_UP       (GADGET_ID_COUNTER_FIRST + 56)
405 #define GADGET_ID_CUSTOM_GEMCOUNT_DOWN  (GADGET_ID_COUNTER_FIRST + 57)
406 #define GADGET_ID_CUSTOM_GEMCOUNT_TEXT  (GADGET_ID_COUNTER_FIRST + 58)
407 #define GADGET_ID_CUSTOM_GEMCOUNT_UP    (GADGET_ID_COUNTER_FIRST + 59)
408 #define GADGET_ID_CUSTOM_VALUE_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 60)
409 #define GADGET_ID_CUSTOM_VALUE_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 61)
410 #define GADGET_ID_CUSTOM_VALUE_FIX_UP   (GADGET_ID_COUNTER_FIRST + 62)
411 #define GADGET_ID_CUSTOM_VALUE_RND_DOWN (GADGET_ID_COUNTER_FIRST + 63)
412 #define GADGET_ID_CUSTOM_VALUE_RND_TEXT (GADGET_ID_COUNTER_FIRST + 64)
413 #define GADGET_ID_CUSTOM_VALUE_RND_UP   (GADGET_ID_COUNTER_FIRST + 65)
414 #define GADGET_ID_PUSH_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 66)
415 #define GADGET_ID_PUSH_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 67)
416 #define GADGET_ID_PUSH_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 68)
417 #define GADGET_ID_PUSH_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 69)
418 #define GADGET_ID_PUSH_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 70)
419 #define GADGET_ID_PUSH_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 71)
420 #define GADGET_ID_DROP_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 72)
421 #define GADGET_ID_DROP_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 73)
422 #define GADGET_ID_DROP_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 74)
423 #define GADGET_ID_DROP_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 75)
424 #define GADGET_ID_DROP_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 76)
425 #define GADGET_ID_DROP_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 77)
426 #define GADGET_ID_MOVE_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 78)
427 #define GADGET_ID_MOVE_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 79)
428 #define GADGET_ID_MOVE_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 80)
429 #define GADGET_ID_MOVE_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 81)
430 #define GADGET_ID_MOVE_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 82)
431 #define GADGET_ID_MOVE_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 83)
432 #define GADGET_ID_EXPLOSION_DELAY_DOWN  (GADGET_ID_COUNTER_FIRST + 84)
433 #define GADGET_ID_EXPLOSION_DELAY_TEXT  (GADGET_ID_COUNTER_FIRST + 85)
434 #define GADGET_ID_EXPLOSION_DELAY_UP    (GADGET_ID_COUNTER_FIRST + 86)
435 #define GADGET_ID_IGNITION_DELAY_DOWN   (GADGET_ID_COUNTER_FIRST + 87)
436 #define GADGET_ID_IGNITION_DELAY_TEXT   (GADGET_ID_COUNTER_FIRST + 88)
437 #define GADGET_ID_IGNITION_DELAY_UP     (GADGET_ID_COUNTER_FIRST + 89)
438 #define GADGET_ID_CHANGE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 90)
439 #define GADGET_ID_CHANGE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 91)
440 #define GADGET_ID_CHANGE_DELAY_FIX_UP   (GADGET_ID_COUNTER_FIRST + 92)
441 #define GADGET_ID_CHANGE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 93)
442 #define GADGET_ID_CHANGE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 94)
443 #define GADGET_ID_CHANGE_DELAY_RND_UP   (GADGET_ID_COUNTER_FIRST + 95)
444 #define GADGET_ID_CHANGE_CONT_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 96)
445 #define GADGET_ID_CHANGE_CONT_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 97)
446 #define GADGET_ID_CHANGE_CONT_RND_UP    (GADGET_ID_COUNTER_FIRST + 98)
447 #define GADGET_ID_GROUP_CONTENT_DOWN    (GADGET_ID_COUNTER_FIRST + 99)
448 #define GADGET_ID_GROUP_CONTENT_TEXT    (GADGET_ID_COUNTER_FIRST + 100)
449 #define GADGET_ID_GROUP_CONTENT_UP      (GADGET_ID_COUNTER_FIRST + 101)
450
451 /* drawing area identifiers */
452 #define GADGET_ID_DRAWING_AREA_FIRST    (GADGET_ID_COUNTER_FIRST + 102)
453
454 #define GADGET_ID_DRAWING_LEVEL         (GADGET_ID_DRAWING_AREA_FIRST + 0)
455 #define GADGET_ID_YAMYAM_CONTENT_0      (GADGET_ID_DRAWING_AREA_FIRST + 1)
456 #define GADGET_ID_YAMYAM_CONTENT_1      (GADGET_ID_DRAWING_AREA_FIRST + 2)
457 #define GADGET_ID_YAMYAM_CONTENT_2      (GADGET_ID_DRAWING_AREA_FIRST + 3)
458 #define GADGET_ID_YAMYAM_CONTENT_3      (GADGET_ID_DRAWING_AREA_FIRST + 4)
459 #define GADGET_ID_YAMYAM_CONTENT_4      (GADGET_ID_DRAWING_AREA_FIRST + 5)
460 #define GADGET_ID_YAMYAM_CONTENT_5      (GADGET_ID_DRAWING_AREA_FIRST + 6)
461 #define GADGET_ID_YAMYAM_CONTENT_6      (GADGET_ID_DRAWING_AREA_FIRST + 7)
462 #define GADGET_ID_YAMYAM_CONTENT_7      (GADGET_ID_DRAWING_AREA_FIRST + 8)
463 #define GADGET_ID_MAGIC_BALL_CONTENT_0  (GADGET_ID_DRAWING_AREA_FIRST + 9)
464 #define GADGET_ID_MAGIC_BALL_CONTENT_1  (GADGET_ID_DRAWING_AREA_FIRST + 10)
465 #define GADGET_ID_MAGIC_BALL_CONTENT_2  (GADGET_ID_DRAWING_AREA_FIRST + 11)
466 #define GADGET_ID_MAGIC_BALL_CONTENT_3  (GADGET_ID_DRAWING_AREA_FIRST + 12)
467 #define GADGET_ID_MAGIC_BALL_CONTENT_4  (GADGET_ID_DRAWING_AREA_FIRST + 13)
468 #define GADGET_ID_MAGIC_BALL_CONTENT_5  (GADGET_ID_DRAWING_AREA_FIRST + 14)
469 #define GADGET_ID_MAGIC_BALL_CONTENT_6  (GADGET_ID_DRAWING_AREA_FIRST + 15)
470 #define GADGET_ID_MAGIC_BALL_CONTENT_7  (GADGET_ID_DRAWING_AREA_FIRST + 16)
471 #define GADGET_ID_ANDROID_CONTENT       (GADGET_ID_DRAWING_AREA_FIRST + 17)
472 #define GADGET_ID_AMOEBA_CONTENT        (GADGET_ID_DRAWING_AREA_FIRST + 18)
473 #define GADGET_ID_START_ELEMENT         (GADGET_ID_DRAWING_AREA_FIRST + 19)
474 #define GADGET_ID_ARTWORK_ELEMENT       (GADGET_ID_DRAWING_AREA_FIRST + 20)
475 #define GADGET_ID_EXPLOSION_ELEMENT     (GADGET_ID_DRAWING_AREA_FIRST + 21)
476 #define GADGET_ID_INVENTORY_CONTENT     (GADGET_ID_DRAWING_AREA_FIRST + 22)
477 #define GADGET_ID_CUSTOM_GRAPHIC        (GADGET_ID_DRAWING_AREA_FIRST + 23)
478 #define GADGET_ID_CUSTOM_CONTENT        (GADGET_ID_DRAWING_AREA_FIRST + 24)
479 #define GADGET_ID_CUSTOM_MOVE_ENTER     (GADGET_ID_DRAWING_AREA_FIRST + 25)
480 #define GADGET_ID_CUSTOM_MOVE_LEAVE     (GADGET_ID_DRAWING_AREA_FIRST + 26)
481 #define GADGET_ID_CUSTOM_CHANGE_TARGET  (GADGET_ID_DRAWING_AREA_FIRST + 27)
482 #define GADGET_ID_CUSTOM_CHANGE_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 28)
483 #define GADGET_ID_CUSTOM_CHANGE_TRIGGER (GADGET_ID_DRAWING_AREA_FIRST + 29)
484 #define GADGET_ID_CUSTOM_CHANGE_ACTION  (GADGET_ID_DRAWING_AREA_FIRST + 30)
485 #define GADGET_ID_GROUP_CONTENT         (GADGET_ID_DRAWING_AREA_FIRST + 31)
486 #define GADGET_ID_RANDOM_BACKGROUND     (GADGET_ID_DRAWING_AREA_FIRST + 32)
487
488 /* text input identifiers */
489 #define GADGET_ID_TEXT_INPUT_FIRST      (GADGET_ID_DRAWING_AREA_FIRST + 33)
490
491 #define GADGET_ID_LEVEL_NAME            (GADGET_ID_TEXT_INPUT_FIRST + 0)
492 #define GADGET_ID_LEVEL_AUTHOR          (GADGET_ID_TEXT_INPUT_FIRST + 1)
493 #define GADGET_ID_ELEMENT_NAME          (GADGET_ID_TEXT_INPUT_FIRST + 2)
494
495 /* text area identifiers */
496 #define GADGET_ID_TEXT_AREA_FIRST       (GADGET_ID_TEXT_INPUT_FIRST + 3)
497
498 #define GADGET_ID_ENVELOPE_INFO         (GADGET_ID_TEXT_AREA_FIRST + 0)
499
500 /* selectbox identifiers */
501 #define GADGET_ID_SELECTBOX_FIRST       (GADGET_ID_TEXT_AREA_FIRST + 1)
502
503 #define GADGET_ID_TIME_OR_STEPS         (GADGET_ID_SELECTBOX_FIRST + 0)
504 #define GADGET_ID_GAME_ENGINE_TYPE      (GADGET_ID_SELECTBOX_FIRST + 1)
505 #define GADGET_ID_WIND_DIRECTION        (GADGET_ID_SELECTBOX_FIRST + 2)
506 #define GADGET_ID_PLAYER_SPEED          (GADGET_ID_SELECTBOX_FIRST + 3)
507 #define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 4)
508 #define GADGET_ID_CUSTOM_EXPLOSION_TYPE (GADGET_ID_SELECTBOX_FIRST + 5)
509 #define GADGET_ID_CUSTOM_DEADLINESS     (GADGET_ID_SELECTBOX_FIRST + 6)
510 #define GADGET_ID_CUSTOM_MOVE_PATTERN   (GADGET_ID_SELECTBOX_FIRST + 7)
511 #define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 8)
512 #define GADGET_ID_CUSTOM_MOVE_STEPSIZE  (GADGET_ID_SELECTBOX_FIRST + 9)
513 #define GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE (GADGET_ID_SELECTBOX_FIRST + 10)
514 #define GADGET_ID_CUSTOM_SMASH_TARGETS  (GADGET_ID_SELECTBOX_FIRST + 11)
515 #define GADGET_ID_CUSTOM_SLIPPERY_TYPE  (GADGET_ID_SELECTBOX_FIRST + 12)
516 #define GADGET_ID_CUSTOM_ACCESS_TYPE    (GADGET_ID_SELECTBOX_FIRST + 13)
517 #define GADGET_ID_CUSTOM_ACCESS_LAYER   (GADGET_ID_SELECTBOX_FIRST + 14)
518 #define GADGET_ID_CUSTOM_ACCESS_PROTECTED (GADGET_ID_SELECTBOX_FIRST + 15)
519 #define GADGET_ID_CUSTOM_ACCESS_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 16)
520 #define GADGET_ID_CHANGE_TIME_UNITS     (GADGET_ID_SELECTBOX_FIRST + 17)
521 #define GADGET_ID_CHANGE_DIRECT_ACTION  (GADGET_ID_SELECTBOX_FIRST + 18)
522 #define GADGET_ID_CHANGE_OTHER_ACTION   (GADGET_ID_SELECTBOX_FIRST + 19)
523 #define GADGET_ID_CHANGE_SIDE           (GADGET_ID_SELECTBOX_FIRST + 20)
524 #define GADGET_ID_CHANGE_PLAYER         (GADGET_ID_SELECTBOX_FIRST + 21)
525 #define GADGET_ID_CHANGE_PAGE           (GADGET_ID_SELECTBOX_FIRST + 22)
526 #define GADGET_ID_CHANGE_REPLACE_WHEN   (GADGET_ID_SELECTBOX_FIRST + 23)
527 #define GADGET_ID_ACTION_TYPE           (GADGET_ID_SELECTBOX_FIRST + 24)
528 #define GADGET_ID_ACTION_MODE           (GADGET_ID_SELECTBOX_FIRST + 25)
529 #define GADGET_ID_ACTION_ARG            (GADGET_ID_SELECTBOX_FIRST + 26)
530 #define GADGET_ID_SELECT_CHANGE_PAGE    (GADGET_ID_SELECTBOX_FIRST + 27)
531 #define GADGET_ID_GROUP_CHOICE_MODE     (GADGET_ID_SELECTBOX_FIRST + 28)
532
533 /* textbutton identifiers */
534 #define GADGET_ID_TEXTBUTTON_FIRST      (GADGET_ID_SELECTBOX_FIRST + 29)
535
536 #define GADGET_ID_LEVELINFO_LEVEL       (GADGET_ID_TEXTBUTTON_FIRST + 0)
537 #define GADGET_ID_LEVELINFO_EDITOR      (GADGET_ID_TEXTBUTTON_FIRST + 1)
538 #define GADGET_ID_PROPERTIES_INFO       (GADGET_ID_TEXTBUTTON_FIRST + 2)
539 #define GADGET_ID_PROPERTIES_CONFIG     (GADGET_ID_TEXTBUTTON_FIRST + 3)
540 #define GADGET_ID_PROPERTIES_CONFIG_1   (GADGET_ID_TEXTBUTTON_FIRST + 4)
541 #define GADGET_ID_PROPERTIES_CONFIG_2   (GADGET_ID_TEXTBUTTON_FIRST + 5)
542 #define GADGET_ID_PROPERTIES_CHANGE     (GADGET_ID_TEXTBUTTON_FIRST + 6)
543 #define GADGET_ID_SAVE_AS_TEMPLATE      (GADGET_ID_TEXTBUTTON_FIRST + 7)
544 #define GADGET_ID_ADD_CHANGE_PAGE       (GADGET_ID_TEXTBUTTON_FIRST + 8)
545 #define GADGET_ID_DEL_CHANGE_PAGE       (GADGET_ID_TEXTBUTTON_FIRST + 9)
546
547 /* graphicbutton identifiers */
548 #define GADGET_ID_GRAPHICBUTTON_FIRST   (GADGET_ID_TEXTBUTTON_FIRST + 10)
549
550 #define GADGET_ID_PREV_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 0)
551 #define GADGET_ID_NEXT_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 1)
552 #define GADGET_ID_COPY_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 2)
553 #define GADGET_ID_PASTE_CHANGE_PAGE     (GADGET_ID_GRAPHICBUTTON_FIRST + 3)
554
555 /* gadgets for scrolling of drawing area */
556 #define GADGET_ID_SCROLLING_FIRST       (GADGET_ID_GRAPHICBUTTON_FIRST + 4)
557
558 #define GADGET_ID_SCROLL_UP             (GADGET_ID_SCROLLING_FIRST + 0)
559 #define GADGET_ID_SCROLL_DOWN           (GADGET_ID_SCROLLING_FIRST + 1)
560 #define GADGET_ID_SCROLL_LEFT           (GADGET_ID_SCROLLING_FIRST + 2)
561 #define GADGET_ID_SCROLL_RIGHT          (GADGET_ID_SCROLLING_FIRST + 3)
562 #define GADGET_ID_SCROLL_HORIZONTAL     (GADGET_ID_SCROLLING_FIRST + 4)
563 #define GADGET_ID_SCROLL_VERTICAL       (GADGET_ID_SCROLLING_FIRST + 5)
564
565 /* gadgets for scrolling element list */
566 #define GADGET_ID_SCROLLING_LIST_FIRST  (GADGET_ID_SCROLLING_FIRST + 6)
567
568 #define GADGET_ID_SCROLL_LIST_UP        (GADGET_ID_SCROLLING_LIST_FIRST + 0)
569 #define GADGET_ID_SCROLL_LIST_DOWN      (GADGET_ID_SCROLLING_LIST_FIRST + 1)
570 #define GADGET_ID_SCROLL_LIST_VERTICAL  (GADGET_ID_SCROLLING_LIST_FIRST + 2)
571
572 /* checkbuttons/radiobuttons for level/element properties */
573 #define GADGET_ID_CHECKBUTTON_FIRST     (GADGET_ID_SCROLLING_LIST_FIRST + 3)
574
575 #define GADGET_ID_RANDOM_PERCENTAGE     (GADGET_ID_CHECKBUTTON_FIRST + 0)
576 #define GADGET_ID_RANDOM_QUANTITY       (GADGET_ID_CHECKBUTTON_FIRST + 1)
577 #define GADGET_ID_RANDOM_RESTRICTED     (GADGET_ID_CHECKBUTTON_FIRST + 2)
578 #define GADGET_ID_STICK_ELEMENT         (GADGET_ID_CHECKBUTTON_FIRST + 3)
579 #define GADGET_ID_EM_SLIPPERY_GEMS      (GADGET_ID_CHECKBUTTON_FIRST + 4)
580 #define GADGET_ID_EM_EXPLODES_BY_FIRE   (GADGET_ID_CHECKBUTTON_FIRST + 5)
581 #define GADGET_ID_USE_SPRING_BUG        (GADGET_ID_CHECKBUTTON_FIRST + 6)
582 #define GADGET_ID_USE_TIME_ORB_BUG      (GADGET_ID_CHECKBUTTON_FIRST + 7)
583 #define GADGET_ID_RANDOM_BALL_CONTENT   (GADGET_ID_CHECKBUTTON_FIRST + 8)
584 #define GADGET_ID_INITIAL_BALL_STATE    (GADGET_ID_CHECKBUTTON_FIRST + 9)
585 #define GADGET_ID_GROW_INTO_DIGGABLE    (GADGET_ID_CHECKBUTTON_FIRST + 10)
586 #define GADGET_ID_AUTO_EXIT_SOKOBAN     (GADGET_ID_CHECKBUTTON_FIRST + 11)
587 #define GADGET_ID_CONTINUOUS_SNAPPING   (GADGET_ID_CHECKBUTTON_FIRST + 12)
588 #define GADGET_ID_BLOCK_SNAP_FIELD      (GADGET_ID_CHECKBUTTON_FIRST + 13)
589 #define GADGET_ID_BLOCK_LAST_FIELD      (GADGET_ID_CHECKBUTTON_FIRST + 14)
590 #define GADGET_ID_SP_BLOCK_LAST_FIELD   (GADGET_ID_CHECKBUTTON_FIRST + 15)
591 #define GADGET_ID_INSTANT_RELOCATION    (GADGET_ID_CHECKBUTTON_FIRST + 16)
592 #define GADGET_ID_SHIFTED_RELOCATION    (GADGET_ID_CHECKBUTTON_FIRST + 17)
593 #define GADGET_ID_USE_START_ELEMENT     (GADGET_ID_CHECKBUTTON_FIRST + 18)
594 #define GADGET_ID_USE_ARTWORK_ELEMENT   (GADGET_ID_CHECKBUTTON_FIRST + 19)
595 #define GADGET_ID_USE_EXPLOSION_ELEMENT (GADGET_ID_CHECKBUTTON_FIRST + 20)
596 #define GADGET_ID_INITIAL_GRAVITY       (GADGET_ID_CHECKBUTTON_FIRST + 21)
597 #define GADGET_ID_USE_INITIAL_INVENTORY (GADGET_ID_CHECKBUTTON_FIRST + 22)
598 #define GADGET_ID_CAN_PASS_TO_WALKABLE  (GADGET_ID_CHECKBUTTON_FIRST + 23)
599 #define GADGET_ID_CAN_FALL_INTO_ACID    (GADGET_ID_CHECKBUTTON_FIRST + 24)
600 #define GADGET_ID_CAN_MOVE_INTO_ACID    (GADGET_ID_CHECKBUTTON_FIRST + 25)
601 #define GADGET_ID_DONT_COLLIDE_WITH     (GADGET_ID_CHECKBUTTON_FIRST + 26)
602 #define GADGET_ID_ENVELOPE_AUTOWRAP     (GADGET_ID_CHECKBUTTON_FIRST + 27)
603 #define GADGET_ID_ENVELOPE_CENTERED     (GADGET_ID_CHECKBUTTON_FIRST + 28)
604 #define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 29)
605 #define GADGET_ID_CUSTOM_CAN_EXPLODE    (GADGET_ID_CHECKBUTTON_FIRST + 30)
606 #define GADGET_ID_CUSTOM_EXPLODE_FIRE   (GADGET_ID_CHECKBUTTON_FIRST + 31)
607 #define GADGET_ID_CUSTOM_EXPLODE_SMASH  (GADGET_ID_CHECKBUTTON_FIRST + 32)
608 #define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 33)
609 #define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 34)
610 #define GADGET_ID_CUSTOM_DEADLY         (GADGET_ID_CHECKBUTTON_FIRST + 35)
611 #define GADGET_ID_CUSTOM_CAN_MOVE       (GADGET_ID_CHECKBUTTON_FIRST + 36)
612 #define GADGET_ID_CUSTOM_CAN_FALL       (GADGET_ID_CHECKBUTTON_FIRST + 37)
613 #define GADGET_ID_CUSTOM_CAN_SMASH      (GADGET_ID_CHECKBUTTON_FIRST + 38)
614 #define GADGET_ID_CUSTOM_SLIPPERY       (GADGET_ID_CHECKBUTTON_FIRST + 39)
615 #define GADGET_ID_CUSTOM_ACCESSIBLE     (GADGET_ID_CHECKBUTTON_FIRST + 40)
616 #define GADGET_ID_CUSTOM_GRAV_REACHABLE (GADGET_ID_CHECKBUTTON_FIRST + 41)
617 #define GADGET_ID_CUSTOM_USE_LAST_VALUE (GADGET_ID_CHECKBUTTON_FIRST + 42)
618 #define GADGET_ID_CUSTOM_USE_GRAPHIC    (GADGET_ID_CHECKBUTTON_FIRST + 43)
619 #define GADGET_ID_CUSTOM_USE_TEMPLATE   (GADGET_ID_CHECKBUTTON_FIRST + 44)
620 #define GADGET_ID_CUSTOM_CAN_CHANGE     (GADGET_ID_CHECKBUTTON_FIRST + 45)
621 #define GADGET_ID_CHANGE_USE_CONTENT    (GADGET_ID_CHECKBUTTON_FIRST + 46)
622 #define GADGET_ID_CHANGE_USE_EXPLOSION  (GADGET_ID_CHECKBUTTON_FIRST + 47)
623 #define GADGET_ID_CHANGE_ONLY_COMPLETE  (GADGET_ID_CHECKBUTTON_FIRST + 48)
624 #define GADGET_ID_CHANGE_USE_RANDOM     (GADGET_ID_CHECKBUTTON_FIRST + 49)
625 #define GADGET_ID_CHANGE_HAS_ACTION     (GADGET_ID_CHECKBUTTON_FIRST + 50)
626 #define GADGET_ID_CHANGE_DELAY          (GADGET_ID_CHECKBUTTON_FIRST + 51)
627 #define GADGET_ID_CHANGE_BY_DIRECT_ACT  (GADGET_ID_CHECKBUTTON_FIRST + 52)
628 #define GADGET_ID_CHANGE_BY_OTHER_ACT   (GADGET_ID_CHECKBUTTON_FIRST + 53)
629
630 /* gadgets for buttons in element list */
631 #define GADGET_ID_ELEMENTLIST_FIRST     (GADGET_ID_CHECKBUTTON_FIRST + 54)
632 #define GADGET_ID_ELEMENTLIST_LAST      (GADGET_ID_ELEMENTLIST_FIRST +  \
633                                         ED_NUM_ELEMENTLIST_BUTTONS - 1)
634
635 #define NUM_EDITOR_GADGETS              (GADGET_ID_ELEMENTLIST_LAST + 1)
636
637 /* radio button numbers */
638 #define RADIO_NR_NONE                   0
639 #define RADIO_NR_DRAWING_TOOLBOX        1
640 #define RADIO_NR_RANDOM_ELEMENTS        2
641
642 /* values for counter gadgets */
643 #define ED_COUNTER_ID_SELECT_LEVEL      0
644 #define ED_COUNTER_ID_LEVEL_XSIZE       1
645 #define ED_COUNTER_ID_LEVEL_YSIZE       2
646 #define ED_COUNTER_ID_LEVEL_GEMSLIMIT   3
647 #define ED_COUNTER_ID_LEVEL_TIMELIMIT   4
648 #define ED_COUNTER_ID_LEVEL_TIMESCORE   5
649 #define ED_COUNTER_ID_LEVEL_RANDOM_SEED 6
650 #define ED_COUNTER_ID_LEVEL_RANDOM      7
651 #define ED_COUNTER_ID_ELEMENT_VALUE1    8
652 #define ED_COUNTER_ID_ELEMENT_VALUE2    9
653 #define ED_COUNTER_ID_ELEMENT_VALUE3    10
654 #define ED_COUNTER_ID_ELEMENT_VALUE4    11
655 #define ED_COUNTER_ID_YAMYAM_CONTENT    12
656 #define ED_COUNTER_ID_BALL_CONTENT      13
657 #define ED_COUNTER_ID_ANDROID_CONTENT   14
658 #define ED_COUNTER_ID_ENVELOPE_XSIZE    15
659 #define ED_COUNTER_ID_ENVELOPE_YSIZE    16
660 #define ED_COUNTER_ID_INVENTORY_SIZE    17
661 #define ED_COUNTER_ID_CUSTOM_SCORE      18
662 #define ED_COUNTER_ID_CUSTOM_GEMCOUNT   19
663 #define ED_COUNTER_ID_CUSTOM_VALUE_FIX  20
664 #define ED_COUNTER_ID_CUSTOM_VALUE_RND  21
665 #define ED_COUNTER_ID_PUSH_DELAY_FIX    22
666 #define ED_COUNTER_ID_PUSH_DELAY_RND    23
667 #define ED_COUNTER_ID_DROP_DELAY_FIX    24
668 #define ED_COUNTER_ID_DROP_DELAY_RND    25
669 #define ED_COUNTER_ID_MOVE_DELAY_FIX    26
670 #define ED_COUNTER_ID_MOVE_DELAY_RND    27
671 #define ED_COUNTER_ID_EXPLOSION_DELAY   28
672 #define ED_COUNTER_ID_IGNITION_DELAY    29
673 #define ED_COUNTER_ID_GROUP_CONTENT     30
674 #define ED_COUNTER_ID_CHANGE_DELAY_FIX  31
675 #define ED_COUNTER_ID_CHANGE_DELAY_RND  32
676 #define ED_COUNTER_ID_CHANGE_CONT_RND   33
677
678 #define ED_NUM_COUNTERBUTTONS           34
679
680 #define ED_COUNTER_ID_LEVEL_FIRST       ED_COUNTER_ID_LEVEL_XSIZE
681 #define ED_COUNTER_ID_LEVEL_LAST        ED_COUNTER_ID_LEVEL_RANDOM_SEED
682 #define ED_COUNTER_ID_EDITOR_FIRST      ED_COUNTER_ID_LEVEL_RANDOM
683 #define ED_COUNTER_ID_EDITOR_LAST       ED_COUNTER_ID_LEVEL_RANDOM
684
685 #define ED_COUNTER_ID_CUSTOM1_FIRST     ED_COUNTER_ID_CUSTOM_SCORE
686 #define ED_COUNTER_ID_CUSTOM1_LAST      ED_COUNTER_ID_DROP_DELAY_RND
687 #define ED_COUNTER_ID_CUSTOM2_FIRST     ED_COUNTER_ID_MOVE_DELAY_FIX
688 #define ED_COUNTER_ID_CUSTOM2_LAST      ED_COUNTER_ID_IGNITION_DELAY
689 #define ED_COUNTER_ID_CUSTOM_FIRST      ED_COUNTER_ID_CUSTOM1_FIRST
690 #define ED_COUNTER_ID_CUSTOM_LAST       ED_COUNTER_ID_CUSTOM2_LAST
691
692 #define ED_COUNTER_ID_CHANGE_FIRST      ED_COUNTER_ID_CHANGE_DELAY_FIX
693 #define ED_COUNTER_ID_CHANGE_LAST       ED_COUNTER_ID_CHANGE_CONT_RND
694
695 /* values for scrollbutton gadgets */
696 #define ED_SCROLLBUTTON_ID_AREA_UP      0
697 #define ED_SCROLLBUTTON_ID_AREA_DOWN    1
698 #define ED_SCROLLBUTTON_ID_AREA_LEFT    2
699 #define ED_SCROLLBUTTON_ID_AREA_RIGHT   3
700 #define ED_SCROLLBUTTON_ID_LIST_UP      4
701 #define ED_SCROLLBUTTON_ID_LIST_DOWN    5
702
703 #define ED_NUM_SCROLLBUTTONS            6
704
705 #define ED_SCROLLBUTTON_ID_AREA_FIRST   ED_SCROLLBUTTON_ID_AREA_UP
706 #define ED_SCROLLBUTTON_ID_AREA_LAST    ED_SCROLLBUTTON_ID_AREA_RIGHT
707
708 /* values for scrollbar gadgets */
709 #define ED_SCROLLBAR_ID_AREA_HORIZONTAL 0
710 #define ED_SCROLLBAR_ID_AREA_VERTICAL   1
711 #define ED_SCROLLBAR_ID_LIST_VERTICAL   2
712
713 #define ED_NUM_SCROLLBARS               3
714
715 #define ED_SCROLLBAR_ID_AREA_FIRST      ED_SCROLLBAR_ID_AREA_HORIZONTAL
716 #define ED_SCROLLBAR_ID_AREA_LAST       ED_SCROLLBAR_ID_AREA_VERTICAL
717
718 /* values for text input gadgets */
719 #define ED_TEXTINPUT_ID_LEVEL_NAME      0
720 #define ED_TEXTINPUT_ID_LEVEL_AUTHOR    1
721 #define ED_TEXTINPUT_ID_ELEMENT_NAME    2
722
723 #define ED_NUM_TEXTINPUT                3
724
725 #define ED_TEXTINPUT_ID_LEVEL_FIRST     ED_TEXTINPUT_ID_LEVEL_NAME
726 #define ED_TEXTINPUT_ID_LEVEL_LAST      ED_TEXTINPUT_ID_LEVEL_AUTHOR
727
728 /* values for text area gadgets */
729 #define ED_TEXTAREA_ID_ENVELOPE_INFO    0
730
731 #define ED_NUM_TEXTAREAS                        1
732
733 #define ED_TEXTAREA_ID_LEVEL_FIRST      ED_TEXTAREA_ID_ENVELOPE
734 #define ED_TEXTAREA_ID_LEVEL_LAST       ED_TEXTAREA_ID_ENVELOPE
735
736 /* values for selectbox gadgets */
737 #define ED_SELECTBOX_ID_TIME_OR_STEPS           0
738 #define ED_SELECTBOX_ID_GAME_ENGINE_TYPE        1
739 #define ED_SELECTBOX_ID_WIND_DIRECTION          2
740 #define ED_SELECTBOX_ID_PLAYER_SPEED            3
741 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE      4
742 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER     5
743 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED 6
744 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION 7
745 #define ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION   8
746 #define ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN     9
747 #define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION   10      
748 #define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE    11
749 #define ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE  12
750 #define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS    13
751 #define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE    14
752 #define ED_SELECTBOX_ID_CUSTOM_DEADLINESS       15
753 #define ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE   16
754 #define ED_SELECTBOX_ID_CHANGE_TIME_UNITS       17
755 #define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION    18
756 #define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION     19
757 #define ED_SELECTBOX_ID_CHANGE_SIDE             20
758 #define ED_SELECTBOX_ID_CHANGE_PLAYER           21
759 #define ED_SELECTBOX_ID_CHANGE_PAGE             22
760 #define ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN     23
761 #define ED_SELECTBOX_ID_ACTION_TYPE             24
762 #define ED_SELECTBOX_ID_ACTION_MODE             25
763 #define ED_SELECTBOX_ID_ACTION_ARG              26
764 #define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE      27
765 #define ED_SELECTBOX_ID_GROUP_CHOICE_MODE       28
766
767 #define ED_NUM_SELECTBOX                        29
768
769 #define ED_SELECTBOX_ID_LEVEL_FIRST     ED_SELECTBOX_ID_TIME_OR_STEPS
770 #define ED_SELECTBOX_ID_LEVEL_LAST      ED_SELECTBOX_ID_WIND_DIRECTION
771
772 #define ED_SELECTBOX_ID_CUSTOM1_FIRST   ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
773 #define ED_SELECTBOX_ID_CUSTOM1_LAST    ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION
774 #define ED_SELECTBOX_ID_CUSTOM2_FIRST   ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN
775 #define ED_SELECTBOX_ID_CUSTOM2_LAST    ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE
776 #define ED_SELECTBOX_ID_CUSTOM_FIRST    ED_SELECTBOX_ID_CUSTOM1_FIRST
777 #define ED_SELECTBOX_ID_CUSTOM_LAST     ED_SELECTBOX_ID_CUSTOM2_LAST
778
779 #define ED_SELECTBOX_ID_CHANGE_FIRST    ED_SELECTBOX_ID_CHANGE_TIME_UNITS
780 #define ED_SELECTBOX_ID_CHANGE_LAST     ED_SELECTBOX_ID_SELECT_CHANGE_PAGE
781
782 /* values for textbutton gadgets */
783 #define ED_TEXTBUTTON_ID_LEVELINFO_LEVEL        0
784 #define ED_TEXTBUTTON_ID_LEVELINFO_EDITOR       1
785 #define ED_TEXTBUTTON_ID_PROPERTIES_INFO        2
786 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG      3
787 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1    4
788 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2    5
789 #define ED_TEXTBUTTON_ID_PROPERTIES_CHANGE      6
790 #define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE       7
791 #define ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE        8
792 #define ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE        9
793
794 #define ED_NUM_TEXTBUTTONS                      10
795
796 #define ED_TEXTBUTTON_ID_LEVELINFO_FIRST ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
797 #define ED_TEXTBUTTON_ID_LEVELINFO_LAST  ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
798
799 #define ED_TEXTBUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
800 #define ED_TEXTBUTTON_ID_PROPERTIES_LAST  ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
801
802 #define ED_TEXTBUTTON_ID_CHANGE_FIRST   ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
803 #define ED_TEXTBUTTON_ID_CHANGE_LAST    ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
804
805 /* values for graphicbutton gadgets */
806 #define ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE    0
807 #define ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE    1
808 #define ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE    2
809 #define ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE   3
810
811 #define ED_NUM_GRAPHICBUTTONS                   4
812
813 #define ED_GRAPHICBUTTON_ID_CHANGE_FIRST  ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE
814 #define ED_GRAPHICBUTTON_ID_CHANGE_LAST   ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE
815
816 /* values for checkbutton gadgets */
817 #define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED     0
818 #define ED_CHECKBUTTON_ID_STICK_ELEMENT         1
819 #define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS      2
820 #define ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE   3
821 #define ED_CHECKBUTTON_ID_USE_SPRING_BUG        4
822 #define ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG      5
823 #define ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT   6
824 #define ED_CHECKBUTTON_ID_INITIAL_BALL_STATE    7
825 #define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE    8
826 #define ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN     9
827 #define ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING   10
828 #define ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD      11
829 #define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD      12
830 #define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD   13
831 #define ED_CHECKBUTTON_ID_INSTANT_RELOCATION    14
832 #define ED_CHECKBUTTON_ID_SHIFTED_RELOCATION    15
833 #define ED_CHECKBUTTON_ID_USE_START_ELEMENT     16
834 #define ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT   17
835 #define ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT 18
836 #define ED_CHECKBUTTON_ID_INITIAL_GRAVITY       19
837 #define ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY 20
838 #define ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE  21
839 #define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID    22
840 #define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID    23
841 #define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH     24
842 #define ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP     25
843 #define ED_CHECKBUTTON_ID_ENVELOPE_CENTERED     26
844 #define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC    27
845 #define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE   28
846 #define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE     29
847 #define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE 30
848 #define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE 31
849 #define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 32
850 #define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 33
851 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE       34
852 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL       35
853 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH      36
854 #define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY       37
855 #define ED_CHECKBUTTON_ID_CUSTOM_DEADLY         38
856 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE    39
857 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE   40
858 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH  41
859 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 42
860 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE     43
861 #define ED_CHECKBUTTON_ID_CHANGE_DELAY          44
862 #define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT  45
863 #define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT   46
864 #define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION  47
865 #define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT    48
866 #define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE  49
867 #define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM     50
868 #define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION     51
869
870 #define ED_NUM_CHECKBUTTONS                     52
871
872 #define ED_CHECKBUTTON_ID_EDITOR_FIRST  ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
873 #define ED_CHECKBUTTON_ID_EDITOR_LAST   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
874
875 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
876 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST  ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
877 #define ED_CHECKBUTTON_ID_CUSTOM2_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE
878 #define ED_CHECKBUTTON_ID_CUSTOM2_LAST  ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT
879 #define ED_CHECKBUTTON_ID_CUSTOM_FIRST  ED_CHECKBUTTON_ID_CUSTOM1_FIRST
880 #define ED_CHECKBUTTON_ID_CUSTOM_LAST   ED_CHECKBUTTON_ID_CUSTOM2_LAST
881
882 #define ED_CHECKBUTTON_ID_CHANGE_FIRST  ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
883 #define ED_CHECKBUTTON_ID_CHANGE_LAST   ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION
884
885 /* values for radiobutton gadgets */
886 #define ED_RADIOBUTTON_ID_PERCENTAGE    0
887 #define ED_RADIOBUTTON_ID_QUANTITY      1
888
889 #define ED_NUM_RADIOBUTTONS             2
890
891 #define ED_RADIOBUTTON_ID_EDITOR_FIRST  ED_RADIOBUTTON_ID_PERCENTAGE
892 #define ED_RADIOBUTTON_ID_EDITOR_LAST   ED_RADIOBUTTON_ID_QUANTITY
893
894 /* values for drawing area gadgets */
895 #define ED_DRAWING_ID_DRAWING_LEVEL             0
896 #define ED_DRAWING_ID_YAMYAM_CONTENT_0          1
897 #define ED_DRAWING_ID_YAMYAM_CONTENT_1          2
898 #define ED_DRAWING_ID_YAMYAM_CONTENT_2          3
899 #define ED_DRAWING_ID_YAMYAM_CONTENT_3          4
900 #define ED_DRAWING_ID_YAMYAM_CONTENT_4          5
901 #define ED_DRAWING_ID_YAMYAM_CONTENT_5          6
902 #define ED_DRAWING_ID_YAMYAM_CONTENT_6          7
903 #define ED_DRAWING_ID_YAMYAM_CONTENT_7          8
904 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_0      9
905 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_1      10
906 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_2      11
907 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_3      12
908 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_4      13
909 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_5      14
910 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_6      15
911 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_7      16
912 #define ED_DRAWING_ID_ANDROID_CONTENT           17
913 #define ED_DRAWING_ID_AMOEBA_CONTENT            18
914 #define ED_DRAWING_ID_START_ELEMENT             19
915 #define ED_DRAWING_ID_ARTWORK_ELEMENT           20
916 #define ED_DRAWING_ID_EXPLOSION_ELEMENT         21
917 #define ED_DRAWING_ID_INVENTORY_CONTENT         22
918 #define ED_DRAWING_ID_CUSTOM_GRAPHIC            23
919 #define ED_DRAWING_ID_CUSTOM_CONTENT            24
920 #define ED_DRAWING_ID_CUSTOM_MOVE_ENTER         25
921 #define ED_DRAWING_ID_CUSTOM_MOVE_LEAVE         26
922 #define ED_DRAWING_ID_CUSTOM_CHANGE_TARGET      27
923 #define ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT     28
924 #define ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER     29
925 #define ED_DRAWING_ID_CUSTOM_CHANGE_ACTION      30
926 #define ED_DRAWING_ID_GROUP_CONTENT             31
927 #define ED_DRAWING_ID_RANDOM_BACKGROUND         32
928
929 #define ED_NUM_DRAWING_AREAS                    33
930
931
932 /*
933   -----------------------------------------------------------------------------
934   some internally used definitions
935   -----------------------------------------------------------------------------
936 */
937
938 /* values for CopyLevelToUndoBuffer() */
939 #define UNDO_IMMEDIATE                  0
940 #define UNDO_ACCUMULATE                 1
941
942 /* values for scrollbars */
943 #define ED_SCROLL_NO                    0
944 #define ED_SCROLL_LEFT                  1
945 #define ED_SCROLL_RIGHT                 2
946 #define ED_SCROLL_UP                    4
947 #define ED_SCROLL_DOWN                  8
948
949 /* screens in the level editor */
950 #define ED_MODE_DRAWING                 0
951 #define ED_MODE_INFO                    1
952 #define ED_MODE_PROPERTIES              2
953
954 /* sub-screens in the global settings section */
955 #define ED_MODE_LEVELINFO_LEVEL         ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
956 #define ED_MODE_LEVELINFO_EDITOR        ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
957
958 /* sub-screens in the element properties section */
959 #define ED_MODE_PROPERTIES_INFO         ED_TEXTBUTTON_ID_PROPERTIES_INFO
960 #define ED_MODE_PROPERTIES_CONFIG       ED_TEXTBUTTON_ID_PROPERTIES_CONFIG
961 #define ED_MODE_PROPERTIES_CONFIG_1     ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1
962 #define ED_MODE_PROPERTIES_CONFIG_2     ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2
963 #define ED_MODE_PROPERTIES_CHANGE       ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
964
965 /* how many steps can be cancelled */
966 #define NUM_UNDO_STEPS                  (64 + 1)
967
968 /* values for elements with score for certain actions */
969 #define MIN_SCORE                       0
970 #define MAX_SCORE                       999
971
972 /* values for elements with count for collecting */
973 #define MIN_COLLECT_COUNT               0
974 #define MAX_COLLECT_COUNT               999
975
976 /* values for random placement */
977 #define RANDOM_USE_PERCENTAGE           0
978 #define RANDOM_USE_QUANTITY             1
979
980 /* default value for element tile size in drawing area */
981 #define DEFAULT_EDITOR_TILESIZE         MINI_TILESIZE
982
983
984 /*
985   -----------------------------------------------------------------------------
986   some internally used data structure definitions
987   -----------------------------------------------------------------------------
988 */
989
990 static struct
991 {
992   int graphic;
993   int gadget_id;
994   struct XY *pos;
995   int gadget_type;
996   char *infotext;
997   char shortcut;
998 } controlbutton_info[ED_NUM_CTRL_BUTTONS] =
999 {
1000   /* note: some additional characters are already reserved for "cheat mode"
1001      shortcuts (":XYZ" style) -- for details, see "events.c" */
1002
1003   /* ---------- toolbox control buttons ------------------------------------ */
1004
1005   {
1006     IMG_EDITOR_BUTTON_GFX_DRAW_SINGLE,          GADGET_ID_SINGLE_ITEMS,
1007     &editor.button.draw_single,                 GD_TYPE_RADIO_BUTTON,
1008     "draw single items",                        's'
1009   },
1010   {
1011     IMG_EDITOR_BUTTON_GFX_DRAW_CONNECTED,       GADGET_ID_CONNECTED_ITEMS,
1012     &editor.button.draw_connected,              GD_TYPE_RADIO_BUTTON,
1013     "draw connected items",                     'd'
1014   },
1015   {
1016     IMG_EDITOR_BUTTON_GFX_DRAW_LINE,            GADGET_ID_LINE,
1017     &editor.button.draw_line,                   GD_TYPE_RADIO_BUTTON,
1018     "draw lines",                               'l'
1019   },
1020   {
1021     IMG_EDITOR_BUTTON_GFX_DRAW_ARC,             GADGET_ID_ARC,
1022     &editor.button.draw_arc,                    GD_TYPE_RADIO_BUTTON,
1023     "draw arcs",                                'a'
1024   },
1025   {
1026     IMG_EDITOR_BUTTON_GFX_DRAW_RECTANGLE,       GADGET_ID_RECTANGLE,
1027     &editor.button.draw_rectangle,              GD_TYPE_RADIO_BUTTON,
1028     "draw outline rectangles",                  'r'
1029   },
1030   {
1031     IMG_EDITOR_BUTTON_GFX_DRAW_FILLED_BOX,      GADGET_ID_FILLED_BOX,
1032     &editor.button.draw_filled_box,             GD_TYPE_RADIO_BUTTON,
1033     "draw filled rectangles",                   'R'
1034   },
1035   {
1036     IMG_EDITOR_BUTTON_GFX_ROTATE_UP,            GADGET_ID_WRAP_UP,
1037     &editor.button.rotate_up,                   GD_TYPE_NORMAL_BUTTON,
1038     "wrap (rotate) level up",                   0
1039   },
1040   {
1041     IMG_EDITOR_BUTTON_GFX_DRAW_TEXT,            GADGET_ID_TEXT,
1042     &editor.button.draw_text,                   GD_TYPE_RADIO_BUTTON,
1043     "enter text elements",                      't'
1044   },
1045   {
1046     IMG_EDITOR_BUTTON_GFX_FLOOD_FILL,           GADGET_ID_FLOOD_FILL,
1047     &editor.button.flood_fill,                  GD_TYPE_RADIO_BUTTON,
1048     "flood fill",                               'f'
1049   },
1050   {
1051     IMG_EDITOR_BUTTON_GFX_ROTATE_LEFT,          GADGET_ID_WRAP_LEFT,
1052     &editor.button.rotate_left,                 GD_TYPE_NORMAL_BUTTON,
1053     "wrap (rotate) level left",                 0
1054   },
1055   {
1056     IMG_EDITOR_BUTTON_GFX_ZOOM_LEVEL,           GADGET_ID_ZOOM,
1057     &editor.button.zoom_level,                  GD_TYPE_NORMAL_BUTTON,
1058     "zoom level tile size",                     '+'
1059   },
1060   {
1061     IMG_EDITOR_BUTTON_GFX_ROTATE_RIGHT,         GADGET_ID_WRAP_RIGHT,
1062     &editor.button.rotate_right,                GD_TYPE_NORMAL_BUTTON,
1063     "wrap (rotate) level right",                0
1064   },
1065   {
1066     IMG_EDITOR_BUTTON_GFX_DRAW_RANDOM,          GADGET_ID_RANDOM_PLACEMENT,
1067     &editor.button.draw_random,                 GD_TYPE_NORMAL_BUTTON,
1068     "random element placement",                 0
1069   },
1070   {
1071     IMG_EDITOR_BUTTON_GFX_GRAB_BRUSH,           GADGET_ID_GRAB_BRUSH,
1072     &editor.button.grab_brush,                  GD_TYPE_RADIO_BUTTON,
1073     "grab brush",                               'b'
1074   },
1075   {
1076     IMG_EDITOR_BUTTON_GFX_ROTATE_DOWN,          GADGET_ID_WRAP_DOWN,
1077     &editor.button.rotate_down,                 GD_TYPE_NORMAL_BUTTON,
1078     "wrap (rotate) level down",                 0
1079   },
1080   {
1081     IMG_EDITOR_BUTTON_GFX_PICK_ELEMENT,         GADGET_ID_PICK_ELEMENT,
1082     &editor.button.pick_element,                GD_TYPE_RADIO_BUTTON,
1083     "pick drawing element",                     ','
1084   },
1085
1086   /* ---------- level control buttons -------------------------------------- */
1087
1088   {
1089     IMG_EDITOR_BUTTON_GFX_UNDO,                 GADGET_ID_UNDO,
1090     &editor.button.undo,                        GD_TYPE_NORMAL_BUTTON,
1091     "undo/redo last operation",                 'u'
1092   },
1093   {
1094     IMG_EDITOR_BUTTON_GFX_CONF,                 GADGET_ID_INFO,
1095     &editor.button.conf,                        GD_TYPE_NORMAL_BUTTON,
1096     "properties of level",                      'I'
1097   },
1098   {
1099     IMG_EDITOR_BUTTON_GFX_SAVE,                 GADGET_ID_SAVE,
1100     &editor.button.save,                        GD_TYPE_NORMAL_BUTTON,
1101     "save level",                               'S'
1102   },
1103   {
1104     IMG_EDITOR_BUTTON_GFX_CLEAR,                GADGET_ID_CLEAR,
1105     &editor.button.clear,                       GD_TYPE_NORMAL_BUTTON,
1106     "clear level",                              'C'
1107   },
1108   {
1109     IMG_EDITOR_BUTTON_GFX_TEST,                 GADGET_ID_TEST,
1110     &editor.button.test,                        GD_TYPE_NORMAL_BUTTON,
1111     "test level",                               'T'
1112   },
1113   {
1114     IMG_EDITOR_BUTTON_GFX_EXIT,                 GADGET_ID_EXIT,
1115     &editor.button.exit,                        GD_TYPE_NORMAL_BUTTON,
1116     "exit level editor",                        'E'
1117   },
1118
1119   /* ---------- CE and GE control buttons ---------------------------------- */
1120
1121   {
1122     IMG_EDITOR_BUTTON_GFX_CE_COPY_FROM,         GADGET_ID_CUSTOM_COPY_FROM,
1123     &editor.button.ce_copy_from,                GD_TYPE_RADIO_BUTTON,
1124     "copy settings from other element",         0
1125   },
1126   {
1127     IMG_EDITOR_BUTTON_GFX_CE_COPY_TO,           GADGET_ID_CUSTOM_COPY_TO,
1128     &editor.button.ce_copy_to,                  GD_TYPE_RADIO_BUTTON,
1129     "copy settings to other element",           0
1130   },
1131   {
1132     IMG_EDITOR_BUTTON_GFX_CE_SWAP,              GADGET_ID_CUSTOM_EXCHANGE,
1133     &editor.button.ce_swap,                     GD_TYPE_RADIO_BUTTON,
1134     "exchange element with other element",      0
1135   },
1136   {
1137     IMG_EDITOR_BUTTON_GFX_CE_COPY,              GADGET_ID_CUSTOM_COPY,
1138     &editor.button.ce_copy,                     GD_TYPE_NORMAL_BUTTON,
1139     "copy settings from this element",          0
1140   },
1141   {
1142     IMG_EDITOR_BUTTON_GFX_CE_PASTE,             GADGET_ID_CUSTOM_PASTE,
1143     &editor.button.ce_paste,                    GD_TYPE_NORMAL_BUTTON,
1144     "paste settings to this element",           0
1145   },
1146
1147   /* ---------- palette control buttons ------------------------------------ */
1148
1149   {
1150     IMG_EDITOR_BUTTON_GFX_PROPERTIES,           GADGET_ID_PROPERTIES,
1151     &editor.button.properties,                  GD_TYPE_NORMAL_BUTTON,
1152     "properties of drawing element",            'p'
1153   }
1154 };
1155
1156 static int random_placement_value = 10;
1157 static int random_placement_method = RANDOM_USE_QUANTITY;
1158 static int random_placement_background_element = EL_SAND;
1159 static boolean random_placement_background_restricted = FALSE;
1160 static boolean stick_element_properties_window = FALSE;
1161 static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES];
1162 static boolean custom_element_change_events[NUM_CHANGE_EVENTS];
1163 static struct ElementChangeInfo custom_element_change;
1164 static struct ElementGroupInfo group_element_info;
1165 static struct ElementInfo custom_element;
1166
1167 static struct
1168 {
1169   int x, y;
1170   int min_value, max_value;
1171   int gadget_id_down, gadget_id_up;
1172   int gadget_id_text;
1173   int gadget_id_align;
1174   int *value;
1175   char *text_above, *text_left, *text_right;
1176 } counterbutton_info[ED_NUM_COUNTERBUTTONS] =
1177 {
1178   /* ---------- current level number --------------------------------------- */
1179
1180   {
1181     -1, -1,     /* these values are not constant, but can change at runtime */
1182     1,                                  100,
1183     GADGET_ID_SELECT_LEVEL_DOWN,        GADGET_ID_SELECT_LEVEL_UP,
1184     GADGET_ID_SELECT_LEVEL_TEXT,        GADGET_ID_NONE,
1185     &level_nr,
1186     NULL,                               NULL, NULL
1187   },
1188
1189   /* ---------- level and editor settings ---------------------------------- */
1190
1191   {
1192     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(4),
1193     MIN_LEV_FIELDX,                     MAX_LEV_FIELDX,
1194     GADGET_ID_LEVEL_XSIZE_DOWN,         GADGET_ID_LEVEL_XSIZE_UP,
1195     GADGET_ID_LEVEL_XSIZE_TEXT,         GADGET_ID_NONE,
1196     &level.fieldx,
1197     "playfield size:",                  NULL, "width",
1198   },
1199   {
1200     -1,                                 ED_LEVEL_SETTINGS_YPOS(4),
1201     MIN_LEV_FIELDY,                     MAX_LEV_FIELDY,
1202     GADGET_ID_LEVEL_YSIZE_DOWN,         GADGET_ID_LEVEL_YSIZE_UP,
1203     GADGET_ID_LEVEL_YSIZE_TEXT,         GADGET_ID_LEVEL_XSIZE_UP,
1204     &level.fieldy,
1205     NULL,                               " ", "height",
1206   },
1207   {
1208     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(5),
1209     0,                                  999,
1210     GADGET_ID_LEVEL_GEMSLIMIT_DOWN,     GADGET_ID_LEVEL_GEMSLIMIT_UP,
1211     GADGET_ID_LEVEL_GEMSLIMIT_TEXT,     GADGET_ID_NONE,
1212     &level.gems_needed,
1213     NULL,                               "number of gems to collect:", NULL
1214   },
1215   {
1216     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(7),
1217     0,                                  9999,
1218     GADGET_ID_LEVEL_TIMELIMIT_DOWN,     GADGET_ID_LEVEL_TIMELIMIT_UP,
1219     GADGET_ID_LEVEL_TIMELIMIT_TEXT,     GADGET_ID_NONE,
1220     &level.time,
1221     "time or step limit to solve level:", NULL, NULL
1222   },
1223   {
1224     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(9),
1225     0,                                  999,
1226     GADGET_ID_LEVEL_TIMESCORE_DOWN,     GADGET_ID_LEVEL_TIMESCORE_UP,
1227     GADGET_ID_LEVEL_TIMESCORE_TEXT,     GADGET_ID_NONE,
1228     &level.score[SC_TIME_BONUS],
1229     "score for each second/step left:", NULL, NULL
1230   },
1231   {
1232     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(12),
1233     0,                                  9999,
1234     GADGET_ID_LEVEL_RANDOM_SEED_DOWN,   GADGET_ID_LEVEL_RANDOM_SEED_UP,
1235     GADGET_ID_LEVEL_RANDOM_SEED_TEXT,   GADGET_ID_NONE,
1236     &level.random_seed,
1237     NULL,                               "random seed:", "(0 => random)"
1238   },
1239   {
1240     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(0),
1241     1,                                  100,
1242     GADGET_ID_LEVEL_RANDOM_DOWN,        GADGET_ID_LEVEL_RANDOM_UP,
1243     GADGET_ID_LEVEL_RANDOM_TEXT,        GADGET_ID_NONE,
1244     &random_placement_value,
1245     "random element placement:",        NULL, "in"
1246   },
1247
1248   /* ---------- element settings: configure (various elements) ------------- */
1249
1250   {
1251     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
1252     MIN_SCORE,                          MAX_SCORE,
1253     GADGET_ID_ELEMENT_VALUE1_DOWN,      GADGET_ID_ELEMENT_VALUE1_UP,
1254     GADGET_ID_ELEMENT_VALUE1_TEXT,      GADGET_ID_NONE,
1255     NULL,                               /* will be set when used */
1256     NULL,                               NULL, NULL
1257   },
1258   {
1259     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
1260     MIN_SCORE,                          MAX_SCORE,
1261     GADGET_ID_ELEMENT_VALUE2_DOWN,      GADGET_ID_ELEMENT_VALUE2_UP,
1262     GADGET_ID_ELEMENT_VALUE2_TEXT,      GADGET_ID_NONE,
1263     NULL,                               /* will be set when used */
1264     NULL,                               NULL, NULL
1265   },
1266   {
1267     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
1268     MIN_SCORE,                          MAX_SCORE,
1269     GADGET_ID_ELEMENT_VALUE3_DOWN,      GADGET_ID_ELEMENT_VALUE3_UP,
1270     GADGET_ID_ELEMENT_VALUE3_TEXT,      GADGET_ID_NONE,
1271     NULL,                               /* will be set when used */
1272     NULL,                               NULL, NULL
1273   },
1274   {
1275     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1276     MIN_SCORE,                          MAX_SCORE,
1277     GADGET_ID_ELEMENT_VALUE4_DOWN,      GADGET_ID_ELEMENT_VALUE4_UP,
1278     GADGET_ID_ELEMENT_VALUE4_TEXT,      GADGET_ID_NONE,
1279     NULL,                               /* will be set when used */
1280     NULL,                               NULL, NULL
1281   },
1282   {
1283     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1284     MIN_ELEMENT_CONTENTS,               MAX_ELEMENT_CONTENTS,
1285     GADGET_ID_YAMYAM_CONTENT_DOWN,      GADGET_ID_YAMYAM_CONTENT_UP,
1286     GADGET_ID_YAMYAM_CONTENT_TEXT,      GADGET_ID_NONE,
1287     &level.num_yamyam_contents,
1288     NULL,                               NULL, "number of content areas"
1289   },
1290   {
1291     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
1292     MIN_ELEMENT_CONTENTS,               MAX_ELEMENT_CONTENTS,
1293     GADGET_ID_BALL_CONTENT_DOWN,        GADGET_ID_BALL_CONTENT_UP,
1294     GADGET_ID_BALL_CONTENT_TEXT,        GADGET_ID_NONE,
1295     &level.num_ball_contents,
1296     NULL,                               NULL, "number of content areas"
1297   },
1298   {
1299     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
1300     MIN_ANDROID_ELEMENTS,               MAX_ANDROID_ELEMENTS,
1301     GADGET_ID_ANDROID_CONTENT_DOWN,     GADGET_ID_ANDROID_CONTENT_UP,
1302     GADGET_ID_ANDROID_CONTENT_TEXT,     GADGET_ID_NONE,
1303     &level.num_android_clone_elements,
1304     NULL,                               NULL, "number of clonable elements"
1305   },
1306   {
1307     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
1308     MIN_ENVELOPE_XSIZE,                 MAX_ENVELOPE_XSIZE,
1309     GADGET_ID_ENVELOPE_XSIZE_DOWN,      GADGET_ID_ENVELOPE_XSIZE_UP,
1310     GADGET_ID_ENVELOPE_XSIZE_TEXT,      GADGET_ID_NONE,
1311     NULL,                               /* will be set when used */
1312     NULL,                               NULL, "width",
1313   },
1314   {
1315     -1,                                 ED_ELEMENT_SETTINGS_YPOS(0),
1316     MIN_ENVELOPE_YSIZE,                 MAX_ENVELOPE_YSIZE,
1317     GADGET_ID_ENVELOPE_YSIZE_DOWN,      GADGET_ID_ENVELOPE_YSIZE_UP,
1318     GADGET_ID_ENVELOPE_YSIZE_TEXT,      GADGET_ID_ENVELOPE_XSIZE_UP,
1319     NULL,                               /* will be set when used */
1320     NULL,                               " ", "height",
1321   },
1322   {
1323     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
1324     MIN_INITIAL_INVENTORY_SIZE,         MAX_INITIAL_INVENTORY_SIZE,
1325     GADGET_ID_INVENTORY_SIZE_DOWN,      GADGET_ID_INVENTORY_SIZE_UP,
1326     GADGET_ID_INVENTORY_SIZE_TEXT,      GADGET_ID_NONE,
1327     &level.initial_inventory_size[0],
1328     NULL,                               NULL, "number of inventory elements"
1329   },
1330
1331   /* ---------- element settings: configure 1 (custom elements) ------------ */
1332
1333   {
1334     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
1335     MIN_SCORE,                          MAX_SCORE,
1336     GADGET_ID_CUSTOM_SCORE_DOWN,        GADGET_ID_CUSTOM_SCORE_UP,
1337     GADGET_ID_CUSTOM_SCORE_TEXT,        GADGET_ID_NONE,
1338     &custom_element.collect_score_initial,
1339     NULL,                               "CE score", " "
1340   },
1341   {
1342     -1,                                 ED_ELEMENT_SETTINGS_YPOS(5),
1343     MIN_COLLECT_COUNT,                  MAX_COLLECT_COUNT,
1344     GADGET_ID_CUSTOM_GEMCOUNT_DOWN,     GADGET_ID_CUSTOM_GEMCOUNT_UP,
1345     GADGET_ID_CUSTOM_GEMCOUNT_TEXT,     GADGET_ID_CUSTOM_SCORE_UP,
1346     &custom_element.collect_count_initial,
1347     NULL,                               "CE count", NULL
1348   },
1349   {
1350     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
1351     0,                                  9999,
1352     GADGET_ID_CUSTOM_VALUE_FIX_DOWN,    GADGET_ID_CUSTOM_VALUE_FIX_UP,
1353     GADGET_ID_CUSTOM_VALUE_FIX_TEXT,    GADGET_ID_NONE,
1354     &custom_element.ce_value_fixed_initial,
1355     NULL,                               "CE value", NULL
1356   },
1357   {
1358     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
1359     0,                                  9999,
1360     GADGET_ID_CUSTOM_VALUE_RND_DOWN,    GADGET_ID_CUSTOM_VALUE_RND_UP,
1361     GADGET_ID_CUSTOM_VALUE_RND_TEXT,    GADGET_ID_CUSTOM_VALUE_FIX_UP,
1362     &custom_element.ce_value_random_initial,
1363     NULL,                               "+random", NULL
1364   },
1365   {
1366     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(6),
1367     0,                                  999,
1368     GADGET_ID_PUSH_DELAY_FIX_DOWN,      GADGET_ID_PUSH_DELAY_FIX_UP,
1369     GADGET_ID_PUSH_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1370     &custom_element.push_delay_fixed,
1371     NULL,                               "push delay", NULL
1372   },
1373   {
1374     -1,                                 ED_ELEMENT_SETTINGS_YPOS(6),
1375     0,                                  999,
1376     GADGET_ID_PUSH_DELAY_RND_DOWN,      GADGET_ID_PUSH_DELAY_RND_UP,
1377     GADGET_ID_PUSH_DELAY_RND_TEXT,      GADGET_ID_PUSH_DELAY_FIX_UP,
1378     &custom_element.push_delay_random,
1379     NULL,                               "+random", NULL
1380   },
1381   {
1382     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(7),
1383     0,                                  999,
1384     GADGET_ID_DROP_DELAY_FIX_DOWN,      GADGET_ID_DROP_DELAY_FIX_UP,
1385     GADGET_ID_DROP_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1386     &custom_element.drop_delay_fixed,
1387     NULL,                               "drop delay", NULL
1388   },
1389   {
1390     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
1391     0,                                  999,
1392     GADGET_ID_DROP_DELAY_RND_DOWN,      GADGET_ID_DROP_DELAY_RND_UP,
1393     GADGET_ID_DROP_DELAY_RND_TEXT,      GADGET_ID_DROP_DELAY_FIX_UP,
1394     &custom_element.drop_delay_random,
1395     NULL,                               "+random", NULL
1396   },
1397
1398   /* ---------- element settings: configure 2 (custom elements) ------------ */
1399
1400   {
1401     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
1402     0,                                  999,
1403     GADGET_ID_MOVE_DELAY_FIX_DOWN,      GADGET_ID_MOVE_DELAY_FIX_UP,
1404     GADGET_ID_MOVE_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1405     &custom_element.move_delay_fixed,
1406     NULL,                               "move delay", NULL
1407   },
1408   {
1409     -1,                                 ED_ELEMENT_SETTINGS_YPOS(5),
1410     0,                                  999,
1411     GADGET_ID_MOVE_DELAY_RND_DOWN,      GADGET_ID_MOVE_DELAY_RND_UP,
1412     GADGET_ID_MOVE_DELAY_RND_TEXT,      GADGET_ID_MOVE_DELAY_FIX_UP,
1413     &custom_element.move_delay_random,
1414     NULL,                               "+random", NULL
1415   },
1416   {
1417     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(12),
1418     0,                                  999,
1419     GADGET_ID_EXPLOSION_DELAY_DOWN,     GADGET_ID_EXPLOSION_DELAY_UP,
1420     GADGET_ID_EXPLOSION_DELAY_TEXT,     GADGET_ID_NONE,
1421     &custom_element.explosion_delay,
1422     NULL,                               "explosion delay", NULL
1423   },
1424   {
1425     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(13),
1426     0,                                  999,
1427     GADGET_ID_IGNITION_DELAY_DOWN,      GADGET_ID_IGNITION_DELAY_UP,
1428     GADGET_ID_IGNITION_DELAY_TEXT,      GADGET_ID_NONE,
1429     &custom_element.ignition_delay,
1430     NULL,                               "ignition delay", "(by fire)"
1431   },
1432
1433   /* ---------- element settings: configure (group elements) --------------- */
1434
1435   {
1436     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1437     MIN_ELEMENTS_IN_GROUP,              MAX_ELEMENTS_IN_GROUP,
1438     GADGET_ID_GROUP_CONTENT_DOWN,       GADGET_ID_GROUP_CONTENT_UP,
1439     GADGET_ID_GROUP_CONTENT_TEXT,       GADGET_ID_NONE,
1440     &group_element_info.num_elements,
1441     NULL,                               NULL, "number of elements in group"
1442   },
1443
1444   /* ---------- element settings: advanced (custom elements) --------------- */
1445
1446   {
1447     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(2),
1448     0,                                  999,
1449     GADGET_ID_CHANGE_DELAY_FIX_DOWN,    GADGET_ID_CHANGE_DELAY_FIX_UP,
1450     GADGET_ID_CHANGE_DELAY_FIX_TEXT,    GADGET_ID_NONE,
1451     &custom_element_change.delay_fixed,
1452     NULL,                               "CE delay", NULL,
1453   },
1454   {
1455     -1,                                 ED_ELEMENT_SETTINGS_YPOS(2),
1456     0,                                  999,
1457     GADGET_ID_CHANGE_DELAY_RND_DOWN,    GADGET_ID_CHANGE_DELAY_RND_UP,
1458     GADGET_ID_CHANGE_DELAY_RND_TEXT,    GADGET_ID_CHANGE_DELAY_FIX_UP,
1459     &custom_element_change.delay_random,
1460     NULL,                               "+random", NULL
1461   },
1462   {
1463     ED_ELEMENT_SETTINGS_XPOS(3),        ED_ELEMENT_SETTINGS_YPOS(12),
1464     0,                                  100,
1465     GADGET_ID_CHANGE_CONT_RND_DOWN,     GADGET_ID_CHANGE_CONT_RND_UP,
1466     GADGET_ID_CHANGE_CONT_RND_TEXT,     GADGET_ID_NONE,
1467     &custom_element_change.random_percentage,
1468     NULL,                               "use random replace:", "%"
1469   },
1470 };
1471
1472 static struct
1473 {
1474   int x, y;
1475   int gadget_id;
1476   int size;
1477   char *value;
1478   char *text_above, *infotext;
1479 } textinput_info[ED_NUM_TEXTINPUT] =
1480 {
1481   {
1482     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(0),
1483     GADGET_ID_LEVEL_NAME,
1484     MAX_LEVEL_NAME_LEN,
1485     level.name,
1486     "Title:", "Title"
1487   },
1488   {
1489     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(2),
1490     GADGET_ID_LEVEL_AUTHOR,
1491     MAX_LEVEL_AUTHOR_LEN,
1492     level.author,
1493     "Author:", "Author"
1494   },
1495   {
1496     -1, -1,     /* these values are not constant, but can change at runtime */
1497     GADGET_ID_ELEMENT_NAME,
1498     MAX_ELEMENT_NAME_LEN - 2,           /* currently 2 chars less editable */
1499     custom_element.description,
1500     NULL, "Element name"
1501   }
1502 };
1503
1504 static struct
1505 {
1506   int x, y;
1507   int gadget_id;
1508   int xsize, ysize;
1509   char *value;
1510   char *text_above, *infotext;
1511 } textarea_info[ED_NUM_TEXTAREAS] =
1512 {
1513   {
1514     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1515     GADGET_ID_ENVELOPE_INFO,
1516     MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
1517     NULL,
1518     "Envelope Content:", "Envelope Content"
1519   }
1520 };
1521
1522 static struct ValueTextInfo options_time_or_steps[] =
1523 {
1524   { 0,                          "seconds"                       },
1525   { 1,                          "steps"                         },
1526
1527   { -1,                         NULL                            }
1528 };
1529
1530 static struct ValueTextInfo options_game_engine_type[] =
1531 {
1532   { GAME_ENGINE_TYPE_RND,       "Rocks'n'Diamonds"              },
1533   { GAME_ENGINE_TYPE_EM,        "Emerald Mine"                  },
1534   { GAME_ENGINE_TYPE_SP,        "Supaplex"                      },
1535
1536   { -1,                         NULL                            }
1537 };
1538
1539 static struct ValueTextInfo options_wind_direction[] =
1540 {
1541   { MV_START_NONE,              "none"                          },
1542   { MV_START_LEFT,              "left"                          },
1543   { MV_START_RIGHT,             "right"                         },
1544   { MV_START_UP,                "up"                            },
1545   { MV_START_DOWN,              "down"                          },
1546
1547   { -1,                         NULL                            }
1548 };
1549
1550 static struct ValueTextInfo options_player_speed[] =
1551 {
1552   { 0,                          "frozen"                        },
1553   { 1,                          "very slow"                     },
1554   { 2,                          "slow"                          },
1555   { 4,                          "normal"                        },
1556   { 8,                          "fast"                          },
1557   { 16,                         "very fast"                     },
1558   { 32,                         "ultrafast"                     },
1559
1560   { -1,                         NULL                            }
1561 };
1562
1563 static struct ValueTextInfo options_access_type[] =
1564 {
1565   { EP_WALKABLE,                "walkable"                      },
1566   { EP_PASSABLE,                "passable"                      },
1567
1568   { -1,                         NULL                            }
1569 };
1570
1571 static struct ValueTextInfo options_access_layer[] =
1572 {
1573   { EP_ACCESSIBLE_OVER,         "over"                          },
1574   { EP_ACCESSIBLE_INSIDE,       "inside"                        },
1575   { EP_ACCESSIBLE_UNDER,        "under"                         },
1576
1577   { -1,                         NULL                            }
1578 };
1579
1580 static struct ValueTextInfo options_access_protected[] =
1581 {
1582   { 0,                          "unprotected"                   },
1583   { 1,                          "protected"                     },
1584
1585   { -1,                         NULL                            }
1586 };
1587
1588 static struct ValueTextInfo options_access_direction[] =
1589 {
1590   { MV_NO_DIRECTION,            "no direction"                  },
1591   { MV_LEFT,                    "left"                          },
1592   { MV_RIGHT,                   "right"                         },
1593   { MV_UP,                      "up"                            },
1594   { MV_DOWN,                    "down"                          },
1595   { MV_LEFT  | MV_UP,           "left + up"                     },
1596   { MV_LEFT  | MV_DOWN,         "left + down"                   },
1597   { MV_RIGHT | MV_UP,           "right + up"                    },
1598   { MV_RIGHT | MV_DOWN,         "right + down"                  },
1599   { MV_HORIZONTAL,              "horizontal"                    },
1600   { MV_VERTICAL,                "vertical"                      },
1601   { MV_HORIZONTAL | MV_UP,      "horizontal + up"               },
1602   { MV_HORIZONTAL | MV_DOWN,    "horizontal + down"             },
1603   { MV_VERTICAL   | MV_LEFT,    "vertical + left"               },
1604   { MV_VERTICAL   | MV_RIGHT,   "vertical + right"              },
1605   { MV_ALL_DIRECTIONS,          "all directions"                },
1606
1607   { -1,                         NULL                            }
1608 };
1609
1610 static struct ValueTextInfo options_walk_to_action[] =
1611 {
1612   { EP_DIGGABLE,                "diggable"                      },
1613   { EP_COLLECTIBLE_ONLY,        "collectible"                   },
1614   { EP_DROPPABLE,               "collectible & droppable"       },
1615   { EP_THROWABLE,               "collectible & throwable"       },
1616   { EP_PUSHABLE,                "pushable"                      },
1617
1618   { -1,                         NULL                            }
1619 };
1620
1621 static struct ValueTextInfo options_move_pattern[] =
1622 {
1623   { MV_LEFT,                    "left"                          },
1624   { MV_RIGHT,                   "right"                         },
1625   { MV_UP,                      "up"                            },
1626   { MV_DOWN,                    "down"                          },
1627   { MV_HORIZONTAL,              "horizontal"                    },
1628   { MV_VERTICAL,                "vertical"                      },
1629   { MV_ALL_DIRECTIONS,          "all directions"                },
1630   { MV_WIND_DIRECTION,          "wind direction"                },
1631   { MV_TOWARDS_PLAYER,          "towards player"                },
1632   { MV_AWAY_FROM_PLAYER,        "away from player"              },
1633   { MV_ALONG_LEFT_SIDE,         "along left side"               },
1634   { MV_ALONG_RIGHT_SIDE,        "along right side"              },
1635   { MV_TURNING_LEFT,            "turning left"                  },
1636   { MV_TURNING_RIGHT,           "turning right"                 },
1637   { MV_TURNING_LEFT_RIGHT,      "turning left, right"           },
1638   { MV_TURNING_RIGHT_LEFT,      "turning right, left"           },
1639   { MV_TURNING_RANDOM,          "turning random"                },
1640   { MV_MAZE_RUNNER,             "maze runner style"             },
1641   { MV_MAZE_HUNTER,             "maze hunter style"             },
1642   { MV_WHEN_PUSHED,             "when pushed"                   },
1643   { MV_WHEN_DROPPED,            "when dropped/thrown"           },
1644
1645   { -1,                         NULL                            }
1646 };
1647
1648 static struct ValueTextInfo options_move_direction[] =
1649 {
1650   { MV_START_AUTOMATIC,         "automatic"                     },
1651   { MV_START_LEFT,              "left"                          },
1652   { MV_START_RIGHT,             "right"                         },
1653   { MV_START_UP,                "up"                            },
1654   { MV_START_DOWN,              "down"                          },
1655   { MV_START_RANDOM,            "random"                        },
1656   { MV_START_PREVIOUS,          "previous"                      },
1657
1658   { -1,                         NULL                            }
1659 };
1660
1661 static struct ValueTextInfo options_move_stepsize[] =
1662 {
1663   { 0,                          "not moving"                    },
1664   { 1,                          "very slow"                     },
1665   { 2,                          "slow"                          },
1666   { 4,                          "normal"                        },
1667   { 8,                          "fast"                          },
1668   { 16,                         "very fast"                     },
1669   { 32,                         "even faster"                   },
1670
1671   { -1,                         NULL                            }
1672 };
1673
1674 static struct ValueTextInfo options_move_leave_type[] =
1675 {
1676   { LEAVE_TYPE_UNLIMITED,       "leave behind"                  },
1677   { LEAVE_TYPE_LIMITED,         "change it to"                  },
1678
1679   { -1,                         NULL                            }
1680 };
1681
1682 static struct ValueTextInfo options_smash_targets[] =
1683 {
1684   { EP_CAN_SMASH_PLAYER,        "player"                        },
1685 #if 0
1686   { EP_CAN_SMASH_ENEMIES,       "enemies"                       },
1687 #endif
1688   { EP_CAN_SMASH_EVERYTHING,    "everything"                    },
1689
1690   { -1,                         NULL                            }
1691 };
1692
1693 static struct ValueTextInfo options_slippery_type[] =
1694 {
1695   { SLIPPERY_ANY_RANDOM,        "random"                        },
1696   { SLIPPERY_ANY_LEFT_RIGHT,    "left, right"                   },
1697   { SLIPPERY_ANY_RIGHT_LEFT,    "right, left"                   },
1698   { SLIPPERY_ONLY_LEFT,         "only left"                     },
1699   { SLIPPERY_ONLY_RIGHT,        "only right"                    },
1700
1701   { -1,                         NULL                            }
1702 };
1703
1704 static struct ValueTextInfo options_deadliness[] =
1705 {
1706   { EP_DONT_RUN_INTO,           "running into"                  },
1707   { EP_DONT_COLLIDE_WITH,       "colliding with"                },
1708   { EP_DONT_GET_HIT_BY,         "getting hit by"                },
1709   { EP_DONT_TOUCH,              "touching"                      },
1710
1711   { -1,                         NULL                            }
1712 };
1713
1714 static struct ValueTextInfo options_explosion_type[] =
1715 {
1716   { EXPLODES_3X3,               "3x3"                           },
1717   { EXPLODES_CROSS,             "3+3"                           },
1718   { EXPLODES_1X1,               "1x1"                           },
1719
1720   { -1,                         NULL                            }
1721 };
1722
1723 static struct ValueTextInfo options_time_units[] =
1724 {
1725   { 1,                          "frames"                        },
1726   { FRAMES_PER_SECOND,          "seconds"                       },
1727
1728   { -1,                         NULL                            }
1729 };
1730
1731 static struct ValueTextInfo options_change_direct_action[] =
1732 {
1733   { CE_TOUCHED_BY_PLAYER,       "touched by player"             },
1734   { CE_PRESSED_BY_PLAYER,       "pressed by player"             },
1735   { CE_SWITCHED_BY_PLAYER,      "switched by player"            },
1736   { CE_SNAPPED_BY_PLAYER,       "snapped by player"             },
1737   { CE_PUSHED_BY_PLAYER,        "pushed by player"              },
1738   { CE_ENTERED_BY_PLAYER,       "entered by player"             },
1739   { CE_LEFT_BY_PLAYER,          "left by player"                },
1740   { CE_DROPPED_BY_PLAYER,       "dropped/thrown by player"      },
1741   { CE_SWITCHED,                "switched"                      },
1742   { CE_HITTING_SOMETHING,       "hitting something"             },
1743   { CE_HIT_BY_SOMETHING,        "hit by something"              },
1744 #if 0
1745   { CE_BLOCKED,                 "blocked"                       },
1746 #endif
1747   { CE_IMPACT,                  "impact (on something)"         },
1748   { CE_SMASHED,                 "smashed (from above)"          },
1749 #if 0
1750   { CE_VALUE_CHANGES,           "CE value changes"              },
1751   { CE_SCORE_CHANGES,           "CE score changes"              },
1752 #endif
1753   { CE_VALUE_GETS_ZERO,         "CE value gets 0"               },
1754   { CE_SCORE_GETS_ZERO,         "CE score gets 0"               },
1755
1756   { -1,                         NULL                            }
1757 };
1758
1759 static struct ValueTextInfo options_change_other_action[] =
1760 {
1761   { CE_PLAYER_TOUCHES_X,        "player touches"                },
1762   { CE_PLAYER_PRESSES_X,        "player presses"                },
1763   { CE_PLAYER_SWITCHES_X,       "player switches"               },
1764   { CE_PLAYER_SNAPS_X,          "player snaps"                  },
1765   { CE_PLAYER_PUSHES_X,         "player pushes"                 },
1766   { CE_PLAYER_ENTERS_X,         "player enters"                 },
1767   { CE_PLAYER_LEAVES_X,         "player leaves"                 },
1768   { CE_PLAYER_DIGS_X,           "player digs"                   },
1769   { CE_PLAYER_COLLECTS_X,       "player collects"               },
1770   { CE_PLAYER_DROPS_X,          "player drops/throws"           },
1771   { CE_TOUCHING_X,              "touching"                      },
1772   { CE_HITTING_X,               "hitting"                       },
1773   { CE_DIGGING_X,               "digging"                       },
1774   { CE_HIT_BY_X,                "hit by"                        },
1775   { CE_SWITCH_OF_X,             "switch of"                     },
1776   { CE_CHANGE_OF_X,             "change by page of"             },
1777   { CE_EXPLOSION_OF_X,          "explosion of"                  },
1778   { CE_MOVE_OF_X,               "move of"                       },
1779   { CE_CREATION_OF_X,           "creation of"                   },
1780   { CE_VALUE_CHANGES_OF_X,      "CE value changes of"           },
1781   { CE_SCORE_CHANGES_OF_X,      "CE score changes of"           },
1782   { CE_VALUE_GETS_ZERO_OF_X,    "CE value gets 0 of"            },
1783   { CE_SCORE_GETS_ZERO_OF_X,    "CE score gets 0 of"            },
1784
1785   { -1,                         NULL                            }
1786 };
1787
1788 static struct ValueTextInfo options_change_trigger_side[] =
1789 {
1790   { CH_SIDE_LEFT,               "left"                          },
1791   { CH_SIDE_RIGHT,              "right"                         },
1792   { CH_SIDE_TOP,                "top"                           },
1793   { CH_SIDE_BOTTOM,             "bottom"                        },
1794   { CH_SIDE_LEFT_RIGHT,         "left/right"                    },
1795   { CH_SIDE_TOP_BOTTOM,         "top/bottom"                    },
1796   { CH_SIDE_ANY,                "any"                           },
1797
1798   { -1,                         NULL                            }
1799 };
1800
1801 static struct ValueTextInfo options_change_trigger_player[] =
1802 {
1803   { CH_PLAYER_1,                "1"                             },
1804   { CH_PLAYER_2,                "2"                             },
1805   { CH_PLAYER_3,                "3"                             },
1806   { CH_PLAYER_4,                "4"                             },
1807   { CH_PLAYER_ANY,              "any"                           },
1808
1809   { -1,                         NULL                            }
1810 };
1811
1812 static struct ValueTextInfo options_change_trigger_page[] =
1813 {
1814   { (1 << 0),                   "1"                             },
1815   { (1 << 1),                   "2"                             },
1816   { (1 << 2),                   "3"                             },
1817   { (1 << 3),                   "4"                             },
1818   { (1 << 4),                   "5"                             },
1819   { (1 << 5),                   "6"                             },
1820   { (1 << 6),                   "7"                             },
1821   { (1 << 7),                   "8"                             },
1822   { (1 << 8),                   "9"                             },
1823   { (1 << 9),                   "10"                            },
1824   { (1 << 10),                  "11"                            },
1825   { (1 << 11),                  "12"                            },
1826   { (1 << 12),                  "13"                            },
1827   { (1 << 13),                  "14"                            },
1828   { (1 << 14),                  "15"                            },
1829   { (1 << 15),                  "16"                            },
1830   { (1 << 16),                  "17"                            },
1831   { (1 << 17),                  "18"                            },
1832   { (1 << 18),                  "19"                            },
1833   { (1 << 19),                  "20"                            },
1834   { (1 << 20),                  "21"                            },
1835   { (1 << 21),                  "22"                            },
1836   { (1 << 22),                  "23"                            },
1837   { (1 << 23),                  "24"                            },
1838   { (1 << 24),                  "25"                            },
1839   { (1 << 25),                  "26"                            },
1840   { (1 << 26),                  "27"                            },
1841   { (1 << 27),                  "28"                            },
1842   { (1 << 28),                  "29"                            },
1843   { (1 << 29),                  "30"                            },
1844   { (1 << 30),                  "31"                            },
1845   { (1 << 31),                  "32"                            },
1846   { CH_PAGE_ANY,                "any"                           },
1847
1848   { -1,                         NULL                            }
1849 };
1850
1851 static struct ValueTextInfo options_change_replace_when[] =
1852 {
1853   { CP_WHEN_EMPTY,              "empty"                         },
1854   { CP_WHEN_WALKABLE,           "walkable"                      },
1855   { CP_WHEN_DIGGABLE,           "diggable"                      },
1856   { CP_WHEN_COLLECTIBLE,        "collectible"                   },
1857   { CP_WHEN_REMOVABLE,          "removable"                     },
1858   { CP_WHEN_DESTRUCTIBLE,       "destructible"                  },
1859
1860   { -1,                         NULL                            }
1861 };
1862
1863 static struct ValueTextInfo options_action_type[] =
1864 {
1865   { CA_NO_ACTION,               "no action"                     },
1866   { CA_UNDEFINED,               " "                             },
1867   { CA_HEADLINE_LEVEL_ACTIONS,  "[level]"                       },
1868   { CA_RESTART_LEVEL,           "restart level"                 },
1869   { CA_SHOW_ENVELOPE,           "show envelope"                 },
1870   { CA_SET_LEVEL_TIME,          "set time"                      },
1871   { CA_SET_LEVEL_SCORE,         "set score"                     },
1872   { CA_SET_LEVEL_GEMS,          "set gems"                      },
1873   { CA_SET_LEVEL_WIND,          "set wind dir."                 },
1874   { CA_SET_LEVEL_RANDOM_SEED,   "set rand. seed"                },
1875   { CA_UNDEFINED,               " "                             },
1876   { CA_HEADLINE_PLAYER_ACTIONS, "[player]"                      },
1877   { CA_MOVE_PLAYER,             "move player"                   },
1878   { CA_EXIT_PLAYER,             "exit player"                   },
1879   { CA_KILL_PLAYER,             "kill player"                   },
1880   { CA_SET_PLAYER_KEYS,         "set keys"                      },
1881   { CA_SET_PLAYER_SPEED,        "set speed"                     },
1882   { CA_SET_PLAYER_SHIELD,       "set shield"                    },
1883   { CA_SET_PLAYER_GRAVITY,      "set gravity"                   },
1884   { CA_SET_PLAYER_ARTWORK,      "set artwork"                   },
1885   { CA_SET_PLAYER_INVENTORY,    "set inventory"                 },
1886   { CA_UNDEFINED,               " "                             },
1887   { CA_HEADLINE_CE_ACTIONS,     "[CE]"                          },
1888   { CA_SET_CE_VALUE,            "set CE value"                  },
1889   { CA_SET_CE_SCORE,            "set CE score"                  },
1890   { CA_SET_CE_ARTWORK,          "set CE artwork"                },
1891   { CA_UNDEFINED,               " "                             },
1892   { CA_HEADLINE_ENGINE_ACTIONS, "[engine]"                      },
1893   { CA_SET_ENGINE_SCAN_MODE,    "set scan mode"                 },
1894
1895   { -1,                         NULL                            }
1896 };
1897
1898 static struct ValueTextInfo options_action_mode_none[] =
1899 {
1900   { CA_MODE_UNDEFINED,          " "                             },
1901
1902   { -1,                         NULL                            }
1903 };
1904
1905 static struct ValueTextInfo options_action_mode_assign[] =
1906 {
1907   { CA_MODE_SET,                "="                             },
1908
1909   { -1,                         NULL                            }
1910 };
1911
1912 static struct ValueTextInfo options_action_mode_add_remove[] =
1913 {
1914   { CA_MODE_ADD,                "+"                             },
1915   { CA_MODE_SUBTRACT,           "-"                             },
1916
1917   { -1,                         NULL                            }
1918 };
1919
1920 static struct ValueTextInfo options_action_mode_calculate[] =
1921 {
1922   { CA_MODE_SET,                "="                             },
1923   { CA_MODE_ADD,                "+"                             },
1924   { CA_MODE_SUBTRACT,           "-"                             },
1925   { CA_MODE_MULTIPLY,           "*"                             },
1926   { CA_MODE_DIVIDE,             "/"                             },
1927   { CA_MODE_MODULO,             "%"                             },
1928
1929   { -1,                         NULL                            }
1930 };
1931
1932 static struct ValueTextInfo options_action_arg_none[] =
1933 {
1934   { CA_ARG_UNDEFINED,           "         "                     },
1935
1936   { -1,                         NULL                            }
1937 };
1938
1939 static struct ValueTextInfo options_action_arg_player[] =
1940 {
1941   { CA_ARG_PLAYER_HEADLINE,     "[player]"                      },
1942   { CA_ARG_PLAYER_1,            "1"                             },
1943   { CA_ARG_PLAYER_2,            "2"                             },
1944   { CA_ARG_PLAYER_3,            "3"                             },
1945   { CA_ARG_PLAYER_4,            "4"                             },
1946   { CA_ARG_PLAYER_ANY,          "any"                           },
1947   { CA_ARG_PLAYER_TRIGGER,      "trigger"                       },
1948   { CA_ARG_PLAYER_ACTION,       "action ->"                     },
1949
1950   { -1,                         NULL                            }
1951 };
1952
1953 static struct ValueTextInfo options_action_arg_number[] =
1954 {
1955   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1956   { CA_ARG_0,                   "0"                             },
1957   { CA_ARG_1,                   "1"                             },
1958   { CA_ARG_2,                   "2"                             },
1959   { CA_ARG_3,                   "3"                             },
1960   { CA_ARG_4,                   "4"                             },
1961   { CA_ARG_5,                   "5"                             },
1962   { CA_ARG_10,                  "10"                            },
1963   { CA_ARG_100,                 "100"                           },
1964   { CA_ARG_1000,                "1000"                          },
1965   { CA_ARG_UNDEFINED,           " "                             },
1966   { CA_ARG_NUMBER_MIN,          "min"                           },
1967   { CA_ARG_NUMBER_MAX,          "max"                           },
1968   { CA_ARG_UNDEFINED,           " "                             },
1969   { CA_ARG_NUMBER_RESET,        "reset"                         },
1970   { CA_ARG_UNDEFINED,           " "                             },
1971   { CA_ARG_NUMBER_CE_VALUE,     "CE value"                      },
1972   { CA_ARG_NUMBER_CE_SCORE,     "CE score"                      },
1973   { CA_ARG_NUMBER_CE_DELAY,     "CE delay"                      },
1974   { CA_ARG_UNDEFINED,           " "                             },
1975   { CA_ARG_NUMBER_LEVEL_TIME,   "time"                          },
1976   { CA_ARG_NUMBER_LEVEL_GEMS,   "gems"                          },
1977   { CA_ARG_NUMBER_LEVEL_SCORE,  "score"                         },
1978   { CA_ARG_UNDEFINED,           " "                             },
1979   { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]"                    },
1980   { CA_ARG_ELEMENT_CV_TARGET,   "target"                        },
1981   { CA_ARG_ELEMENT_CV_TRIGGER,  "trigger"                       },
1982   { CA_ARG_ELEMENT_CV_ACTION,   "action ->"                     },
1983   { CA_ARG_UNDEFINED,           " "                             },
1984   { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]"                    },
1985   { CA_ARG_ELEMENT_CS_TARGET,   "target"                        },
1986   { CA_ARG_ELEMENT_CS_TRIGGER,  "trigger"                       },
1987   { CA_ARG_ELEMENT_CS_ACTION,   "action ->"                     },
1988
1989   { -1,                         NULL                            }
1990 };
1991
1992 static struct ValueTextInfo options_action_arg_value[] =
1993 {
1994   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1995   { CA_ARG_0,                   "0"                             },
1996   { CA_ARG_1,                   "1"                             },
1997   { CA_ARG_2,                   "2"                             },
1998   { CA_ARG_3,                   "3"                             },
1999   { CA_ARG_4,                   "4"                             },
2000   { CA_ARG_5,                   "5"                             },
2001   { CA_ARG_10,                  "10"                            },
2002   { CA_ARG_100,                 "100"                           },
2003   { CA_ARG_1000,                "1000"                          },
2004   { CA_ARG_UNDEFINED,           " "                             },
2005   { CA_ARG_NUMBER_MIN,          "min"                           },
2006   { CA_ARG_NUMBER_MAX,          "max"                           },
2007   { CA_ARG_UNDEFINED,           " "                             },
2008   { CA_ARG_NUMBER_RESET,        "reset"                         },
2009   { CA_ARG_UNDEFINED,           " "                             },
2010   { CA_ARG_NUMBER_CE_VALUE,     "CE value"                      },
2011   { CA_ARG_NUMBER_CE_SCORE,     "CE score"                      },
2012   { CA_ARG_NUMBER_CE_DELAY,     "CE delay"                      },
2013   { CA_ARG_UNDEFINED,           " "                             },
2014   { CA_ARG_NUMBER_LEVEL_TIME,   "time"                          },
2015   { CA_ARG_NUMBER_LEVEL_GEMS,   "gems"                          },
2016   { CA_ARG_NUMBER_LEVEL_SCORE,  "score"                         },
2017   { CA_ARG_UNDEFINED,           " "                             },
2018   { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]"                    },
2019   { CA_ARG_ELEMENT_CV_TARGET,   "target"                        },
2020   { CA_ARG_ELEMENT_CV_TRIGGER,  "trigger"                       },
2021   { CA_ARG_ELEMENT_CV_ACTION,   "action ->"                     },
2022   { CA_ARG_UNDEFINED,           " "                             },
2023   { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]"                    },
2024   { CA_ARG_ELEMENT_CS_TARGET,   "target"                        },
2025   { CA_ARG_ELEMENT_CS_TRIGGER,  "trigger"                       },
2026   { CA_ARG_ELEMENT_CS_ACTION,   "action ->"                     },
2027   { CA_ARG_UNDEFINED,           " "                             },
2028   { CA_ARG_ELEMENT_NR_HEADLINE, "[element]"                     },
2029   { CA_ARG_ELEMENT_NR_TARGET,   "target"                        },
2030   { CA_ARG_ELEMENT_NR_TRIGGER,  "trigger"                       },
2031   { CA_ARG_ELEMENT_NR_ACTION,   "action ->"                     },
2032
2033   { -1,                         NULL                            }
2034 };
2035
2036 static struct ValueTextInfo options_action_arg_envelope[] =
2037 {
2038   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
2039   { CA_ARG_1,                   "1"                             },
2040   { CA_ARG_2,                   "2"                             },
2041   { CA_ARG_3,                   "3"                             },
2042   { CA_ARG_4,                   "4"                             },
2043   { CA_ARG_UNDEFINED,           " "                             },
2044   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
2045   { CA_ARG_ELEMENT_TARGET,      "target"                        },
2046   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
2047   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
2048
2049   { -1,                         NULL                            }
2050 };
2051
2052 static struct ValueTextInfo options_action_arg_key[] =
2053 {
2054   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
2055   { CA_ARG_1,                   "1"                             },
2056   { CA_ARG_2,                   "2"                             },
2057   { CA_ARG_3,                   "3"                             },
2058   { CA_ARG_4,                   "4"                             },
2059   { CA_ARG_5,                   "5"                             },
2060   { CA_ARG_6,                   "6"                             },
2061   { CA_ARG_7,                   "7"                             },
2062   { CA_ARG_8,                   "8"                             },
2063   { CA_ARG_UNDEFINED,           " "                             },
2064   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
2065   { CA_ARG_ELEMENT_TARGET,      "target"                        },
2066   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
2067   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
2068
2069   { -1,                         NULL                            }
2070 };
2071
2072 static struct ValueTextInfo options_action_arg_speed[] =
2073 {
2074   { CA_ARG_SPEED_HEADLINE,      "[speed]"                       },
2075   { CA_ARG_SPEED_NOT_MOVING,    "frozen"                        },
2076   { CA_ARG_SPEED_VERY_SLOW,     "very slow"                     },
2077   { CA_ARG_SPEED_SLOW,          "slow"                          },
2078   { CA_ARG_SPEED_NORMAL,        "normal"                        },
2079   { CA_ARG_SPEED_FAST,          "fast"                          },
2080   { CA_ARG_SPEED_VERY_FAST,     "very fast"                     },
2081   { CA_ARG_SPEED_EVEN_FASTER,   "ultrafast"                     },
2082   { CA_ARG_UNDEFINED,           " "                             },
2083   { CA_ARG_SPEED_SLOWER,        "slower"                        },
2084   { CA_ARG_SPEED_FASTER,        "faster"                        },
2085   { CA_ARG_UNDEFINED,           " "                             },
2086   { CA_ARG_SPEED_RESET,         "reset"                         },
2087
2088   { -1,                         NULL                            }
2089 };
2090
2091 static struct ValueTextInfo options_action_arg_shield[] =
2092 {
2093   { CA_ARG_SHIELD_HEADLINE,     "[shield]"                      },
2094   { CA_ARG_SHIELD_OFF,          "off"                           },
2095   { CA_ARG_SHIELD_NORMAL,       "normal"                        },
2096   { CA_ARG_SHIELD_DEADLY,       "deadly"                        },
2097
2098   { -1,                         NULL                            }
2099 };
2100
2101 static struct ValueTextInfo options_action_arg_artwork[] =
2102 {
2103   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
2104   { CA_ARG_ELEMENT_TARGET,      "target"                        },
2105   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
2106   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
2107   { CA_ARG_UNDEFINED,           " "                             },
2108   { CA_ARG_ELEMENT_RESET,       "reset"                         },
2109
2110   { -1,                         NULL                            }
2111 };
2112
2113 static struct ValueTextInfo options_action_arg_gravity[] =
2114 {
2115   { CA_ARG_GRAVITY_HEADLINE,    "[gravity]"                     },
2116   { CA_ARG_GRAVITY_ON,          "on"                            },
2117   { CA_ARG_GRAVITY_OFF,         "off"                           },
2118   { CA_ARG_GRAVITY_TOGGLE,      "toggle"                        },
2119
2120   { -1,                         NULL                            }
2121 };
2122
2123 static struct ValueTextInfo options_action_arg_direction[] =
2124 {
2125   { CA_ARG_DIRECTION_HEADLINE,  "[dir.]"                        },
2126   { CA_ARG_DIRECTION_NONE,      "none"                          },
2127   { CA_ARG_DIRECTION_LEFT,      "left"                          },
2128   { CA_ARG_DIRECTION_RIGHT,     "right"                         },
2129   { CA_ARG_DIRECTION_UP,        "up"                            },
2130   { CA_ARG_DIRECTION_DOWN,      "down"                          },
2131   { CA_ARG_DIRECTION_TRIGGER,   "trigger"                       },
2132   { CA_ARG_DIRECTION_TRIGGER_BACK, "-trigger"                   },
2133
2134   { -1,                         NULL                            }
2135 };
2136
2137 static struct ValueTextInfo options_action_arg_scan_mode[] =
2138 {
2139   { CA_ARG_SCAN_MODE_HEADLINE,  "[mode]"                        },
2140   { CA_ARG_SCAN_MODE_NORMAL,    "normal"                        },
2141   { CA_ARG_SCAN_MODE_REVERSE,   "reverse"                       },
2142
2143   { -1,                         NULL                            }
2144 };
2145
2146 static struct ValueTextInfo options_action_arg_inventory[] =
2147 {
2148   { CA_ARG_INVENTORY_HEADLINE,  "[add]"                         },
2149   { CA_ARG_ELEMENT_TARGET,      "+ target"                      },
2150   { CA_ARG_ELEMENT_TRIGGER,     "+ trigger"                     },
2151   { CA_ARG_ELEMENT_ACTION,      "+ action"                      },
2152   { CA_ARG_UNDEFINED,           " "                             },
2153   { CA_ARG_INVENTORY_RM_HEADLINE,"[remove]"                     },
2154   { CA_ARG_INVENTORY_RM_TARGET, "- target"                      },
2155   { CA_ARG_INVENTORY_RM_TRIGGER,"- trigger"                     },
2156   { CA_ARG_INVENTORY_RM_ACTION, "- action"                      },
2157   { CA_ARG_INVENTORY_RM_FIRST,  "- first"                       },
2158   { CA_ARG_INVENTORY_RM_LAST,   "- last"                        },
2159   { CA_ARG_INVENTORY_RM_ALL,    "- all"                         },
2160   { CA_ARG_UNDEFINED,           " "                             },
2161   { CA_ARG_INVENTORY_RESET,     "reset"                         },
2162
2163   { -1,                         NULL                            }
2164 };
2165
2166 static char options_change_page_strings[MAX_CHANGE_PAGES][10];
2167 static struct ValueTextInfo options_change_page[MAX_CHANGE_PAGES + 1] =
2168 {
2169   { -1,                         NULL                            }
2170 };
2171
2172 static struct ValueTextInfo options_group_choice_mode[] =
2173 {
2174   { ANIM_RANDOM,                "random"                        },
2175   { ANIM_LOOP,                  "loop"                          },
2176   { ANIM_LINEAR,                "linear"                        },
2177   { ANIM_PINGPONG,              "pingpong"                      },
2178   { ANIM_PINGPONG2,             "pingpong 2"                    },
2179
2180   { -1,                         NULL                            }
2181 };
2182
2183 static struct ValueTextInfo *action_arg_modes[] =
2184 {
2185   options_action_mode_none,
2186   options_action_mode_assign,
2187   options_action_mode_add_remove,
2188   options_action_mode_calculate,
2189 };
2190
2191 static struct
2192 {
2193   int value;
2194   int mode;
2195   struct ValueTextInfo *options;
2196 }
2197 action_arg_options[] =
2198 {
2199   { CA_NO_ACTION,               0,      options_action_arg_none,        },
2200   { CA_EXIT_PLAYER,             0,      options_action_arg_player,      },
2201   { CA_KILL_PLAYER,             0,      options_action_arg_player,      },
2202   { CA_MOVE_PLAYER,             0,      options_action_arg_direction,   },
2203   { CA_RESTART_LEVEL,           0,      options_action_arg_none,        },
2204   { CA_SHOW_ENVELOPE,           0,      options_action_arg_envelope,    },
2205   { CA_SET_LEVEL_TIME,          3,      options_action_arg_number,      },
2206   { CA_SET_LEVEL_GEMS,          3,      options_action_arg_number,      },
2207   { CA_SET_LEVEL_SCORE,         3,      options_action_arg_number,      },
2208   { CA_SET_LEVEL_WIND,          1,      options_action_arg_direction,   },
2209   { CA_SET_LEVEL_RANDOM_SEED,   1,      options_action_arg_number,      },
2210   { CA_SET_PLAYER_KEYS,         2,      options_action_arg_key,         },
2211   { CA_SET_PLAYER_SPEED,        1,      options_action_arg_speed,       },
2212   { CA_SET_PLAYER_SHIELD,       1,      options_action_arg_shield,      },
2213   { CA_SET_PLAYER_GRAVITY,      1,      options_action_arg_gravity,     },
2214   { CA_SET_PLAYER_ARTWORK,      1,      options_action_arg_artwork,     },
2215   { CA_SET_PLAYER_INVENTORY,    0,      options_action_arg_inventory,   },
2216   { CA_SET_CE_VALUE,            3,      options_action_arg_value,       },
2217   { CA_SET_CE_SCORE,            3,      options_action_arg_value,       },
2218   { CA_SET_CE_ARTWORK,          1,      options_action_arg_artwork,     },
2219   { CA_SET_ENGINE_SCAN_MODE,    1,      options_action_arg_scan_mode,   },
2220
2221   { -1,                         FALSE,  NULL                            }
2222 };
2223
2224 static struct
2225 {
2226   int x, y;
2227   int gadget_id;
2228   int gadget_id_align;
2229   int size;     /* char size of selectbox or '-1' (dynamically determined) */
2230   struct ValueTextInfo *options;
2231   int *value;
2232   char *text_left, *text_right, *infotext;
2233 } selectbox_info[ED_NUM_SELECTBOX] =
2234 {
2235   /* ---------- level and editor settings ---------------------------------- */
2236
2237   {
2238     -1,                                 ED_LEVEL_SETTINGS_YPOS(7),
2239     GADGET_ID_TIME_OR_STEPS,            GADGET_ID_LEVEL_TIMELIMIT_UP,
2240     -1,
2241     options_time_or_steps,
2242     &level.use_step_counter,
2243     NULL, "(0 => no limit)",            "time or step limit"
2244   },
2245   {
2246     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(11),
2247     GADGET_ID_GAME_ENGINE_TYPE,         GADGET_ID_NONE,
2248     -1,
2249     options_game_engine_type,
2250     &level.game_engine_type,
2251     "game engine:", NULL,               "game engine"
2252   },
2253   {
2254     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(10),
2255     GADGET_ID_WIND_DIRECTION,           GADGET_ID_NONE,
2256     -1,
2257     options_wind_direction,
2258     &level.wind_direction_initial,
2259     "initial wind direction:", NULL,    "initial wind direction"
2260   },
2261
2262   /* ---------- element settings: configure (several elements) ------------- */
2263
2264   {
2265     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(6),
2266     GADGET_ID_PLAYER_SPEED,             GADGET_ID_NONE,
2267     -1,
2268     options_player_speed,
2269     &level.initial_player_stepsize[0],
2270     "initial player speed:", NULL,      "initial player speed"
2271   },
2272
2273   /* ---------- element settings: configure 1 (custom elements) ------------ */
2274
2275   {
2276     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(2),
2277     GADGET_ID_CUSTOM_ACCESS_TYPE,       GADGET_ID_NONE,
2278     -1,
2279     options_access_type,
2280     &custom_element.access_type,
2281     NULL, NULL,                         "type of access to this field"
2282   },
2283   {
2284     -1,                                 ED_ELEMENT_SETTINGS_YPOS(2),
2285     GADGET_ID_CUSTOM_ACCESS_LAYER,      GADGET_ID_CUSTOM_ACCESS_TYPE,
2286     -1,
2287     options_access_layer,
2288     &custom_element.access_layer,
2289     NULL, NULL,                         "layer of access for this field"
2290   },
2291   {
2292     -1,                                 ED_ELEMENT_SETTINGS_YPOS(2),
2293     GADGET_ID_CUSTOM_ACCESS_PROTECTED,  GADGET_ID_CUSTOM_ACCESS_LAYER,
2294     -1,
2295     options_access_protected,
2296     &custom_element.access_protected,
2297     NULL, NULL,                         "protected access for this field"
2298   },
2299   {
2300     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(3),
2301     GADGET_ID_CUSTOM_ACCESS_DIRECTION,  GADGET_ID_NONE,
2302     -1,
2303     options_access_direction,
2304     &custom_element.access_direction,
2305     "from", NULL,                       "access direction for this field"
2306   },
2307   {
2308     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
2309     GADGET_ID_CUSTOM_WALK_TO_ACTION,    GADGET_ID_NONE,
2310     -1,
2311     options_walk_to_action,
2312     &custom_element.walk_to_action,
2313     NULL, NULL,                         "diggable/collectible/pushable"
2314   },
2315
2316   /* ---------- element settings: configure 2 (custom elements) ------------ */
2317
2318   {
2319     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(1),
2320     GADGET_ID_CUSTOM_MOVE_PATTERN,      GADGET_ID_NONE,
2321     -1,
2322     options_move_pattern,
2323     &custom_element.move_pattern,
2324     "can move", NULL,                   "element move pattern"
2325   },
2326   {
2327     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(2),
2328     GADGET_ID_CUSTOM_MOVE_DIRECTION,    GADGET_ID_NONE,
2329     -1,
2330     options_move_direction,
2331     &custom_element.move_direction_initial,
2332     "starts moving", NULL,              "initial element move direction"
2333   },
2334   {
2335     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
2336     GADGET_ID_CUSTOM_MOVE_STEPSIZE,     GADGET_ID_NONE,
2337     -1,
2338     options_move_stepsize,
2339     &custom_element.move_stepsize,
2340     "move/fall speed", NULL,            "speed of element movement"
2341   },
2342   {
2343     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(3),
2344     GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,   GADGET_ID_NONE,
2345     -1,
2346     options_move_leave_type,
2347     &custom_element.move_leave_type,
2348     // left text with leading spaces to place gadget next to "can dig" gadget
2349     // (needed because drawing area gadgets created after selectbox gadgets)
2350     // "can dig:    can", ":",          "leave behind or change element"
2351     "            can", ":",             "leave behind or change element"
2352   },
2353   {
2354     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
2355     GADGET_ID_CUSTOM_SMASH_TARGETS,     GADGET_ID_CUSTOM_CAN_SMASH,
2356     -1,
2357     options_smash_targets,
2358     &custom_element.smash_targets,
2359     "can smash", NULL,                  "elements that can be smashed"
2360   },
2361   {
2362     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(8),
2363     GADGET_ID_CUSTOM_SLIPPERY_TYPE,     GADGET_ID_NONE,
2364     -1,
2365     options_slippery_type,
2366     &custom_element.slippery_type,
2367     "slippery", NULL,                   "where other elements fall down"
2368   },
2369   {
2370     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(9),
2371     GADGET_ID_CUSTOM_DEADLINESS,        GADGET_ID_NONE,
2372     -1,
2373     options_deadliness,
2374     &custom_element.deadliness,
2375     "deadly when", NULL,                "deadliness of element"
2376   },
2377   {
2378     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(10),
2379     GADGET_ID_CUSTOM_EXPLOSION_TYPE,    GADGET_ID_NONE,
2380     -1,
2381     options_explosion_type,
2382     &custom_element.explosion_type,
2383     "can explode", NULL,                "explosion type"
2384   },
2385
2386   /* ---------- element settings: advanced (custom elements) --------------- */
2387
2388   {
2389     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(3),
2390     GADGET_ID_CHANGE_TIME_UNITS,        GADGET_ID_NONE,
2391     -1,
2392     options_time_units,
2393     &custom_element_change.delay_frames,
2394     "delay time given in", NULL,        "delay time units for change"
2395   },
2396   {
2397     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(4),
2398     GADGET_ID_CHANGE_DIRECT_ACTION,     GADGET_ID_NONE,
2399     -1,
2400     options_change_direct_action,
2401     &custom_element_change.direct_action,
2402     NULL, NULL,                         "type of direct action"
2403   },
2404   {
2405     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(5),
2406     GADGET_ID_CHANGE_OTHER_ACTION,      GADGET_ID_NONE,
2407     -1,
2408     options_change_other_action,
2409     &custom_element_change.other_action,
2410     NULL, "element:",                   "type of other element action"
2411   },
2412   {
2413     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(6),
2414     GADGET_ID_CHANGE_SIDE,              GADGET_ID_NONE,
2415     -1,
2416     options_change_trigger_side,
2417     &custom_element_change.trigger_side,
2418     "at", "side",                       "element side triggering change"
2419   },
2420   {
2421     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(7),
2422     GADGET_ID_CHANGE_PLAYER,            GADGET_ID_NONE,
2423     -1,
2424     options_change_trigger_player,
2425     &custom_element_change.trigger_player,
2426     "player:", " ",                     "player that causes change"
2427   },
2428   {
2429     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(7),
2430     GADGET_ID_CHANGE_PAGE,              GADGET_ID_CHANGE_PLAYER,
2431     -1,
2432     options_change_trigger_page,
2433     &custom_element_change.trigger_page,
2434     "page:", NULL,                      "change page that causes change"
2435   },
2436   {
2437     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(10),
2438     GADGET_ID_CHANGE_REPLACE_WHEN,      GADGET_ID_NONE,
2439     -1,
2440     options_change_replace_when,
2441     &custom_element_change.replace_when,
2442     "replace when", NULL,               "which elements can be replaced"
2443   },
2444   {
2445     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(13),
2446     GADGET_ID_ACTION_TYPE,              GADGET_ID_NONE,
2447     -1,
2448     options_action_type,
2449     &custom_element_change.action_type,
2450     NULL, NULL,                         "action on specified condition"
2451   },
2452   {
2453     -1,                                 ED_ELEMENT_SETTINGS_YPOS(13),
2454     GADGET_ID_ACTION_MODE,              GADGET_ID_ACTION_TYPE,
2455     -1,
2456     options_action_mode_none,
2457     &custom_element_change.action_mode,
2458     NULL, NULL,                         "action operator"
2459   },
2460   {
2461     -1,                                 ED_ELEMENT_SETTINGS_YPOS(13),
2462     GADGET_ID_ACTION_ARG,               GADGET_ID_ACTION_MODE,
2463     -1,
2464     options_action_arg_none,
2465     &custom_element_change.action_arg,
2466     NULL, NULL,                         "action parameter"
2467   },
2468   {
2469     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(14),
2470     GADGET_ID_SELECT_CHANGE_PAGE,       GADGET_ID_NONE,
2471     3,
2472     options_change_page,
2473     &custom_element.current_change_page,
2474     NULL, NULL,                         "element change page"
2475   },
2476
2477   /* ---------- element settings: configure (group elements) --------------- */
2478
2479   {
2480     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
2481     GADGET_ID_GROUP_CHOICE_MODE,        GADGET_ID_NONE,
2482     -1,
2483     options_group_choice_mode,
2484     &group_element_info.choice_mode,
2485     "choice type:", NULL,               "type of group element choice"
2486   },
2487 };
2488
2489 static struct
2490 {
2491   int x, y;
2492   int gadget_id;
2493   int gadget_id_align;
2494   int size;
2495   char *text;
2496   char *text_left, *text_right, *infotext;
2497 } textbutton_info[ED_NUM_TEXTBUTTONS] =
2498 {
2499   {
2500     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(0),
2501     GADGET_ID_LEVELINFO_LEVEL,          GADGET_ID_NONE,
2502     8,                                  "Level",                        
2503     NULL, NULL,                         "Configure level properties"
2504   },
2505   {
2506     -1,                                 -1,
2507     GADGET_ID_LEVELINFO_EDITOR,         GADGET_ID_LEVELINFO_LEVEL,
2508     8,                                  "Editor",                       
2509     NULL, NULL,                         "Configure editor properties"
2510   },
2511   {
2512     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2513     GADGET_ID_PROPERTIES_INFO,          GADGET_ID_NONE,
2514     8,                                  "Info",                 
2515     NULL, NULL,                         "Show information about element"
2516   },
2517   {
2518     -1,                                 -1,
2519     GADGET_ID_PROPERTIES_CONFIG,        GADGET_ID_PROPERTIES_INFO,
2520     8,                                  "Config",
2521     NULL, NULL,                         "Configure element properties"
2522   },
2523   {
2524     -1,                                 -1,
2525     GADGET_ID_PROPERTIES_CONFIG_1,      GADGET_ID_PROPERTIES_INFO,
2526     8,                                  "Config 1",
2527     NULL, NULL,                         "Configure element properties, part 1"
2528   },
2529   {
2530     -1,                                 -1,
2531     GADGET_ID_PROPERTIES_CONFIG_2,      GADGET_ID_PROPERTIES_CONFIG_1,
2532     8,                                  "Config 2",
2533     NULL, NULL,                         "Configure element properties, part 2"
2534   },
2535   {
2536     -1,                                 -1,
2537     GADGET_ID_PROPERTIES_CHANGE,        GADGET_ID_PROPERTIES_CONFIG_2,
2538     8,                                  "Change",
2539     NULL, NULL,                         "Configure custom element change pages"
2540   },
2541   {
2542     -1,                                 -1,
2543     GADGET_ID_SAVE_AS_TEMPLATE,         GADGET_ID_CUSTOM_USE_TEMPLATE,
2544     -1,                                 "Save",
2545     " ", "As Template",                 "Save current settings as new template"
2546   },
2547   {
2548     -1,                                 -1,
2549     GADGET_ID_ADD_CHANGE_PAGE,          GADGET_ID_PASTE_CHANGE_PAGE,
2550     -1,                                 "New",
2551     NULL, NULL,                         "Add new change page"
2552   },
2553   {
2554     -1,                                 -1,
2555     GADGET_ID_DEL_CHANGE_PAGE,          GADGET_ID_ADD_CHANGE_PAGE,
2556     -1,                                 "Delete",
2557     NULL, NULL,                         "Delete current change page"
2558   },
2559 };
2560
2561 static struct
2562 {
2563   int graphic;
2564   int x, y;
2565   int gadget_id;
2566   int gadget_id_align;
2567   char *text_left, *text_right, *infotext;
2568 } graphicbutton_info[ED_NUM_GRAPHICBUTTONS] =
2569 {
2570   {
2571     IMG_EDITOR_COUNTER_DOWN,
2572     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(14),
2573     GADGET_ID_PREV_CHANGE_PAGE,         GADGET_ID_NONE,
2574     NULL, NULL,                         "select previous change page"
2575   },
2576   {
2577     IMG_EDITOR_COUNTER_UP,
2578     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2579     GADGET_ID_NEXT_CHANGE_PAGE,         GADGET_ID_SELECT_CHANGE_PAGE,
2580     NULL, "change page",                "select next change page"
2581   },
2582   {
2583     IMG_EDITOR_BUTTON_GFX_CP_COPY,
2584     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2585     GADGET_ID_COPY_CHANGE_PAGE,         GADGET_ID_NEXT_CHANGE_PAGE,
2586     " ", NULL,                          "copy settings from this change page"
2587   },
2588   {
2589     IMG_EDITOR_BUTTON_GFX_CP_PASTE,
2590     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2591     GADGET_ID_PASTE_CHANGE_PAGE,        GADGET_ID_COPY_CHANGE_PAGE,
2592     NULL, NULL,                         "paste settings to this change page"
2593   },
2594 };
2595
2596 static struct
2597 {
2598   int x, y;
2599 } scrollbutton_pos[ED_NUM_SCROLLBUTTONS];
2600
2601 static struct
2602 {
2603   int graphic;
2604   int gadget_id;
2605   char *infotext;
2606 } scrollbutton_info[ED_NUM_SCROLLBUTTONS] =
2607 {
2608   {
2609     IMG_EDITOR_PLAYFIELD_SCROLL_UP,
2610     GADGET_ID_SCROLL_UP,
2611     "scroll level editing area up"
2612   },
2613   {
2614     IMG_EDITOR_PLAYFIELD_SCROLL_DOWN,
2615     GADGET_ID_SCROLL_DOWN,
2616     "scroll level editing area down"
2617   },
2618   {
2619     IMG_EDITOR_PLAYFIELD_SCROLL_LEFT,
2620     GADGET_ID_SCROLL_LEFT,
2621     "scroll level editing area left"
2622   },
2623   {
2624     IMG_EDITOR_PLAYFIELD_SCROLL_RIGHT,
2625     GADGET_ID_SCROLL_RIGHT,
2626     "scroll level editing area right"
2627   },
2628   {
2629     IMG_EDITOR_PALETTE_SCROLL_UP,
2630     GADGET_ID_SCROLL_LIST_UP,
2631     "scroll element list up ('Page Up')"
2632   },
2633   {
2634     IMG_EDITOR_PALETTE_SCROLL_DOWN,
2635     GADGET_ID_SCROLL_LIST_DOWN,
2636     "scroll element list down ('Page Down')"
2637   },
2638 };
2639
2640 static struct
2641 {
2642   int x, y;
2643   int width, height;
2644   int wheel_x, wheel_y;
2645   int wheel_width, wheel_height;
2646 } scrollbar_pos[ED_NUM_SCROLLBARS];
2647
2648 static struct
2649 {
2650   int graphic;
2651   int type;
2652   int gadget_id;
2653   char *infotext;
2654 } scrollbar_info[ED_NUM_SCROLLBARS] =
2655 {
2656   {
2657     IMG_EDITOR_PLAYFIELD_SCROLLBAR,
2658     GD_TYPE_SCROLLBAR_HORIZONTAL,
2659     GADGET_ID_SCROLL_HORIZONTAL,
2660     "scroll level editing area horizontally"
2661   },
2662   {
2663     IMG_EDITOR_PLAYFIELD_SCROLLBAR,
2664     GD_TYPE_SCROLLBAR_VERTICAL,
2665     GADGET_ID_SCROLL_VERTICAL,
2666     "scroll level editing area vertically"
2667   },
2668   {
2669     IMG_EDITOR_PALETTE_SCROLLBAR,
2670     GD_TYPE_SCROLLBAR_VERTICAL,
2671     GADGET_ID_SCROLL_LIST_VERTICAL,
2672     "scroll element list vertically"
2673   }
2674 };
2675
2676
2677 static struct
2678 {
2679   int x, y;
2680   int gadget_id;
2681   int gadget_id_align;
2682   int radio_button_nr;
2683   int *value;
2684   int checked_value;
2685   char *text_left, *text_right, *infotext;
2686 } radiobutton_info[ED_NUM_RADIOBUTTONS] =
2687 {
2688   {
2689     -1,                                 ED_LEVEL_SETTINGS_YPOS(0),
2690     GADGET_ID_RANDOM_PERCENTAGE,        GADGET_ID_LEVEL_RANDOM_UP,
2691     RADIO_NR_RANDOM_ELEMENTS,
2692     &random_placement_method,           RANDOM_USE_PERCENTAGE,
2693     " ", "percentage",                  "use percentage for random elements"
2694   },
2695   {
2696     -1,                                 ED_LEVEL_SETTINGS_YPOS(0),
2697     GADGET_ID_RANDOM_QUANTITY,          GADGET_ID_RANDOM_PERCENTAGE,
2698     RADIO_NR_RANDOM_ELEMENTS,
2699     &random_placement_method,           RANDOM_USE_QUANTITY,
2700     " ", "quantity",                    "use quantity for random elements"
2701   }
2702 };
2703
2704 static struct
2705 {
2706   int x, y;
2707   int gadget_id;
2708   int gadget_id_align;
2709   boolean *value;
2710   char *text_left, *text_right, *infotext;
2711 } checkbutton_info[ED_NUM_CHECKBUTTONS] =
2712 {
2713   /* ---------- level and editor settings ---------------------------------- */
2714
2715   {
2716     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(1),
2717     GADGET_ID_RANDOM_RESTRICTED,        GADGET_ID_NONE,
2718     &random_placement_background_restricted,
2719     NULL,
2720     "restrict random placement to:",    "set random placement restriction"
2721   },
2722
2723   /* ---------- element settings: configure (various elements) ------------- */
2724
2725   {
2726     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2727     GADGET_ID_STICK_ELEMENT,            GADGET_ID_NONE,
2728     &stick_element_properties_window,
2729     NULL,
2730     "stick this screen to edit content","stick this screen to edit content"
2731   },
2732   {
2733     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2734     GADGET_ID_EM_SLIPPERY_GEMS,         GADGET_ID_NONE,
2735     &level.em_slippery_gems,
2736     NULL,
2737     "slip down from certain flat walls","use EM/DC style slipping behaviour"
2738   },
2739   {
2740     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2741     GADGET_ID_EM_EXPLODES_BY_FIRE,      GADGET_ID_NONE,
2742     &level.em_explodes_by_fire,
2743     NULL,
2744     "explodes with chain reaction",     "use R'n'D style explosion behaviour"
2745   },
2746   {
2747     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2748     GADGET_ID_USE_SPRING_BUG,           GADGET_ID_NONE,
2749     &level.use_spring_bug,
2750     NULL,
2751     "use spring pushing bug",           "use odd spring pushing behaviour"
2752   },
2753   {
2754     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2755     GADGET_ID_USE_TIME_ORB_BUG,         GADGET_ID_NONE,
2756     &level.use_time_orb_bug,
2757     NULL,
2758     "use time orb bug",                 "use odd time orb behaviour"
2759   },
2760   {
2761     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2762     GADGET_ID_RANDOM_BALL_CONTENT,      GADGET_ID_NONE,
2763     &level.ball_random,
2764     NULL,
2765     "create single random element",     "only create one element from content"
2766   },
2767   {
2768     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2769     GADGET_ID_INITIAL_BALL_STATE,       GADGET_ID_NONE,
2770     &level.ball_state_initial,
2771     NULL,
2772     "magic ball initially activated",   "activate magic ball after level start"
2773   },
2774   {
2775     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2776     GADGET_ID_GROW_INTO_DIGGABLE,       GADGET_ID_NONE,
2777     &level.grow_into_diggable,
2778     NULL,
2779     "can grow into anything diggable",  "grow into more than just sand"
2780   },
2781   {
2782     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2783     GADGET_ID_AUTO_EXIT_SOKOBAN,        GADGET_ID_NONE,
2784     &level.auto_exit_sokoban,
2785     NULL,
2786     "exit level if all fields solved",  "automatically finish Sokoban levels"
2787   },
2788   {
2789     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(8),
2790     GADGET_ID_CONTINUOUS_SNAPPING,      GADGET_ID_NONE,
2791     &level.continuous_snapping,
2792     NULL,
2793     "continuous snapping",              "use snapping without releasing key"
2794   },
2795   {
2796     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(7),
2797     GADGET_ID_BLOCK_SNAP_FIELD,         GADGET_ID_NONE,
2798     &level.block_snap_field,
2799     NULL,
2800     "block snapped field when snapping", "use snapping delay to show animation"
2801   },
2802   {
2803     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2804     GADGET_ID_BLOCK_LAST_FIELD,         GADGET_ID_NONE,
2805     &level.block_last_field,
2806     NULL,
2807     "block last field when moving",     "player blocks last field when moving"
2808   },
2809   {
2810     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2811     GADGET_ID_SP_BLOCK_LAST_FIELD,      GADGET_ID_NONE,
2812     &level.sp_block_last_field,
2813     NULL,
2814     "block last field when moving",     "player blocks last field when moving"
2815   },
2816   {
2817     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
2818     GADGET_ID_INSTANT_RELOCATION,       GADGET_ID_NONE,
2819     &level.instant_relocation,
2820     NULL,
2821     "no scrolling when relocating",     "player gets relocated without delay"
2822   },
2823   {
2824     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
2825     GADGET_ID_SHIFTED_RELOCATION,       GADGET_ID_NONE,
2826     &level.shifted_relocation,
2827     NULL,
2828     "no centering when relocating",     "level not centered after relocation"
2829   },
2830   {
2831     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2832     GADGET_ID_USE_START_ELEMENT,        GADGET_ID_NONE,
2833     &level.use_start_element[0],
2834     NULL,
2835     "use level start element:",        "start level at this element's position"
2836   },
2837   {
2838     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
2839     GADGET_ID_USE_ARTWORK_ELEMENT,      GADGET_ID_NONE,
2840     &level.use_artwork_element[0],
2841     NULL,
2842     "use artwork from element:",        "use player artwork from other element"
2843   },
2844   {
2845     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(11),
2846     GADGET_ID_USE_EXPLOSION_ELEMENT,    GADGET_ID_NONE,
2847     &level.use_explosion_element[0],
2848     NULL,
2849     "use explosion from element:",      "use explosion properties from element"
2850   },
2851   {
2852     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(12),
2853     GADGET_ID_INITIAL_GRAVITY,          GADGET_ID_NONE,
2854     &level.initial_player_gravity[0],
2855     NULL,
2856     "use initial gravity",              "set initial player gravity"
2857   },
2858   {
2859     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2860     GADGET_ID_USE_INITIAL_INVENTORY,    GADGET_ID_NONE,
2861     &level.use_initial_inventory[0],
2862     NULL,
2863     "use initial inventory:",           "use collected elements on level start"
2864   },
2865   {
2866     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(5),
2867     GADGET_ID_CAN_PASS_TO_WALKABLE,     GADGET_ID_NONE,
2868     &level.can_pass_to_walkable,
2869     NULL,
2870     "can pass to walkable element",     "player can pass to empty or walkable"
2871   },
2872   {
2873     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2874     GADGET_ID_CAN_FALL_INTO_ACID,       GADGET_ID_NONE,
2875     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
2876     NULL,
2877     "can fall into acid (with gravity)","player can fall into acid pool"
2878   },
2879   {
2880     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2881     GADGET_ID_CAN_MOVE_INTO_ACID,       GADGET_ID_NONE,
2882     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
2883     NULL,
2884     "can move into acid",               "element can move into acid pool"
2885   },
2886   {
2887     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2888     GADGET_ID_DONT_COLLIDE_WITH,        GADGET_ID_NONE,
2889     &custom_element_properties[EP_DONT_COLLIDE_WITH],
2890     NULL,
2891     "deadly when colliding with",       "element is deadly when hitting player"
2892   },
2893   {
2894     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2895     GADGET_ID_ENVELOPE_AUTOWRAP,        GADGET_ID_NONE,
2896     &level.envelope[0].autowrap,
2897     NULL,
2898     "auto-wrap",                        "automatically wrap envelope text"
2899   },
2900   {
2901     -1,                                 ED_ELEMENT_SETTINGS_YPOS(1),
2902     GADGET_ID_ENVELOPE_CENTERED,        GADGET_ID_ENVELOPE_AUTOWRAP,
2903     &level.envelope[0].centered,
2904     " ",
2905     "centered",                         "automatically center envelope text"
2906   },
2907
2908   /* ---------- element settings: configure 1 (custom elements) ----------- */
2909
2910   {
2911     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2912     GADGET_ID_CUSTOM_USE_GRAPHIC,       GADGET_ID_NONE,
2913     &custom_element.use_gfx_element,
2914     NULL,
2915     "use graphic of element:",          "use existing element graphic"
2916   },
2917   {
2918     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(14),
2919     GADGET_ID_CUSTOM_USE_TEMPLATE,      GADGET_ID_NONE,
2920     &level.use_custom_template,
2921     NULL,
2922     "use template",                     "use template for custom properties"
2923   },
2924   {
2925     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2926     GADGET_ID_CUSTOM_ACCESSIBLE,        GADGET_ID_NONE,
2927     &custom_element_properties[EP_ACCESSIBLE],
2928     NULL,
2929     NULL,                               "player can walk to or pass this field"
2930   },
2931   {
2932     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2933     GADGET_ID_CUSTOM_GRAV_REACHABLE,    GADGET_ID_NONE,
2934     &custom_element_properties[EP_GRAVITY_REACHABLE],
2935     NULL,
2936     "reachable despite gravity",        "player can walk/dig despite gravity"
2937   },
2938   {
2939     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(11),
2940     GADGET_ID_CUSTOM_USE_LAST_VALUE,    GADGET_ID_NONE,
2941     &custom_element.use_last_ce_value,
2942     NULL,
2943     "use last CE value after change",   "use last CE value after change"
2944   },
2945   {
2946     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
2947     GADGET_ID_CUSTOM_WALK_TO_OBJECT,    GADGET_ID_NONE,
2948     &custom_element_properties[EP_WALK_TO_OBJECT],
2949     NULL,
2950     NULL,                               "player can dig/collect/push element"
2951   },
2952   {
2953     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(8),
2954     GADGET_ID_CUSTOM_INDESTRUCTIBLE,    GADGET_ID_NONE,
2955     &custom_element_properties[EP_INDESTRUCTIBLE],
2956     NULL,
2957     "indestructible",                   "element is indestructible"
2958   },
2959
2960   /* ---------- element settings: configure 2 (custom elements) ----------- */
2961
2962   {
2963     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2964     GADGET_ID_CUSTOM_CAN_MOVE,          GADGET_ID_NONE,
2965     &custom_element_properties[EP_CAN_MOVE],
2966     NULL,
2967     NULL,                               "element can move with some pattern"
2968   },
2969   {
2970     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(7),
2971     GADGET_ID_CUSTOM_CAN_FALL,          GADGET_ID_NONE,
2972     &custom_element_properties[EP_CAN_FALL],
2973     NULL,
2974     "can fall",                         "element can fall down"
2975   },
2976   {
2977     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
2978     GADGET_ID_CUSTOM_CAN_SMASH,         GADGET_ID_CUSTOM_CAN_FALL,
2979     &custom_element_properties[EP_CAN_SMASH],
2980     " ",
2981     NULL,                               "element can smash other elements"
2982   },
2983   {
2984     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(8),
2985     GADGET_ID_CUSTOM_SLIPPERY,          GADGET_ID_NONE,
2986     &custom_element_properties[EP_SLIPPERY],
2987     NULL,
2988     NULL,                               "other elements can fall down from it"
2989   },
2990   {
2991     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2992     GADGET_ID_CUSTOM_DEADLY,            GADGET_ID_NONE,
2993     &custom_element_properties[EP_DEADLY],
2994     NULL,
2995     NULL,                               "element can kill the player"
2996   },
2997   {
2998     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
2999     GADGET_ID_CUSTOM_CAN_EXPLODE,       GADGET_ID_NONE,
3000     &custom_element_properties[EP_CAN_EXPLODE],
3001     NULL,
3002     NULL,                               "element can explode"
3003   },
3004   {
3005     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(11),
3006     GADGET_ID_CUSTOM_EXPLODE_FIRE,      GADGET_ID_NONE,
3007     &custom_element_properties[EP_EXPLODES_BY_FIRE],
3008     NULL,
3009     "by fire",                          "element can explode by fire/explosion"
3010   },
3011   {
3012     -1,                                 ED_ELEMENT_SETTINGS_YPOS(11),
3013     GADGET_ID_CUSTOM_EXPLODE_SMASH,     GADGET_ID_CUSTOM_EXPLODE_FIRE,
3014     &custom_element_properties[EP_EXPLODES_SMASHED],
3015     " ",
3016     "smashed",                          "element can explode when smashed"
3017   },
3018   {
3019     -1,                                 ED_ELEMENT_SETTINGS_YPOS(11),
3020     GADGET_ID_CUSTOM_EXPLODE_IMPACT,    GADGET_ID_CUSTOM_EXPLODE_SMASH,
3021     &custom_element_properties[EP_EXPLODES_IMPACT],
3022     " ",
3023     "impact",                           "element can explode on impact"
3024   },
3025
3026   /* ---------- element settings: advanced (custom elements) --------------- */
3027
3028   {
3029     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
3030     GADGET_ID_CUSTOM_CAN_CHANGE,        GADGET_ID_NONE,
3031     &custom_element_change.can_change,
3032     NULL,
3033     "element changes to:",              "change element on specified condition"
3034   },
3035   {
3036     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(2),
3037     GADGET_ID_CHANGE_DELAY,             GADGET_ID_NONE,
3038     &custom_element_change_events[CE_DELAY],
3039     NULL,
3040     NULL,                               "element changes after delay"
3041   },
3042   {
3043     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
3044     GADGET_ID_CHANGE_BY_DIRECT_ACT,     GADGET_ID_NONE,
3045     &custom_element_change_events[CE_BY_DIRECT_ACTION],
3046     NULL,
3047     NULL,                               "element changes by direct action"
3048   },
3049   {
3050     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
3051     GADGET_ID_CHANGE_BY_OTHER_ACT,      GADGET_ID_NONE,
3052     &custom_element_change_events[CE_BY_OTHER_ACTION],
3053     NULL,
3054     NULL,                               "element changes by other element"
3055   },
3056   {
3057     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(8),
3058     GADGET_ID_CHANGE_USE_EXPLOSION,     GADGET_ID_NONE,
3059     &custom_element_change.explode,
3060     NULL,
3061     "explode instead of change",        "element explodes instead of change"
3062   },
3063   {
3064     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(9),
3065     GADGET_ID_CHANGE_USE_CONTENT,       GADGET_ID_NONE,
3066     &custom_element_change.use_target_content,
3067     NULL,
3068     "use extended change target:",      "element changes to more elements"
3069   },
3070   {
3071     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(11),
3072     GADGET_ID_CHANGE_ONLY_COMPLETE,     GADGET_ID_NONE,
3073     &custom_element_change.only_if_complete,
3074     NULL,
3075     "replace all or nothing",           "only replace when all can be changed"
3076   },
3077   {
3078     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(12),
3079     GADGET_ID_CHANGE_USE_RANDOM,        GADGET_ID_NONE,
3080     &custom_element_change.use_random_replace,
3081     NULL,
3082     NULL,                               "use percentage for random replace"
3083   },
3084   {
3085     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(13),
3086     GADGET_ID_CHANGE_HAS_ACTION,        GADGET_ID_NONE,
3087     &custom_element_change.has_action,
3088     NULL,
3089     NULL,                               "execute action on specified condition"
3090   },
3091 };
3092
3093 static struct
3094 {
3095   int x, y;
3096   int xoffset, yoffset;
3097   int gadget_id;
3098   int gadget_id_align;
3099   int *value;
3100   int area_xsize, area_ysize;
3101   char *text_left, *text_right, *text_below, *infotext;
3102 } drawingarea_info[ED_NUM_DRAWING_AREAS] =
3103 {
3104   /* ---------- level playfield content ------------------------------------ */
3105
3106   {
3107     0,                                  0,
3108     0,                                  0,
3109     GADGET_ID_DRAWING_LEVEL,            GADGET_ID_NONE,
3110     NULL,
3111     -1, -1,     /* these values are not constant, but can change at runtime */
3112     NULL, NULL, NULL,                   NULL
3113   },
3114
3115   /* ---------- yam yam content -------------------------------------------- */
3116
3117   {
3118     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3119     ED_AREA_YAMYAM_CONTENT_XOFF(0),     ED_AREA_YAMYAM_CONTENT_YOFF(0),
3120     GADGET_ID_YAMYAM_CONTENT_0,         GADGET_ID_NONE,
3121     &level.yamyam_content[0].e[0][0],   3, 3,
3122     NULL, NULL, "1",                    NULL
3123   },
3124   {
3125     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3126     ED_AREA_YAMYAM_CONTENT_XOFF(1),     ED_AREA_YAMYAM_CONTENT_YOFF(1),
3127     GADGET_ID_YAMYAM_CONTENT_1,         GADGET_ID_NONE,
3128     &level.yamyam_content[1].e[0][0],   3, 3,
3129     NULL, NULL, "2",                    NULL
3130   },
3131   {
3132     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3133     ED_AREA_YAMYAM_CONTENT_XOFF(2),     ED_AREA_YAMYAM_CONTENT_YOFF(2),
3134     GADGET_ID_YAMYAM_CONTENT_2,         GADGET_ID_NONE,
3135     &level.yamyam_content[2].e[0][0],   3, 3,
3136     NULL, NULL, "3",                    NULL
3137   },
3138   {
3139     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3140     ED_AREA_YAMYAM_CONTENT_XOFF(3),     ED_AREA_YAMYAM_CONTENT_YOFF(3),
3141     GADGET_ID_YAMYAM_CONTENT_3,         GADGET_ID_NONE,
3142     &level.yamyam_content[3].e[0][0],   3, 3,
3143     NULL, NULL, "4",                    NULL
3144   },
3145   {
3146     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3147     ED_AREA_YAMYAM_CONTENT_XOFF(4),     ED_AREA_YAMYAM_CONTENT_YOFF(4),
3148     GADGET_ID_YAMYAM_CONTENT_4,         GADGET_ID_NONE,
3149     &level.yamyam_content[4].e[0][0],   3, 3,
3150     NULL, NULL, "5",                    NULL
3151   },
3152   {
3153     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3154     ED_AREA_YAMYAM_CONTENT_XOFF(5),     ED_AREA_YAMYAM_CONTENT_YOFF(5),
3155     GADGET_ID_YAMYAM_CONTENT_5,         GADGET_ID_NONE,
3156     &level.yamyam_content[5].e[0][0],   3, 3,
3157     NULL, NULL, "6",                    NULL
3158   },
3159   {
3160     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3161     ED_AREA_YAMYAM_CONTENT_XOFF(6),     ED_AREA_YAMYAM_CONTENT_YOFF(6),
3162     GADGET_ID_YAMYAM_CONTENT_6,         GADGET_ID_NONE,
3163     &level.yamyam_content[6].e[0][0],   3, 3,
3164     NULL, NULL, "7",                    NULL
3165   },
3166   {
3167     ED_AREA_YAMYAM_CONTENT_XPOS,        ED_AREA_YAMYAM_CONTENT_YPOS,
3168     ED_AREA_YAMYAM_CONTENT_XOFF(7),     ED_AREA_YAMYAM_CONTENT_YOFF(7),
3169     GADGET_ID_YAMYAM_CONTENT_7,         GADGET_ID_NONE,
3170     &level.yamyam_content[7].e[0][0],   3, 3,
3171     NULL, NULL, "8",                    NULL
3172   },
3173
3174   /* ---------- magic ball content ----------------------------------------- */
3175
3176   {
3177     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3178     ED_AREA_MAGIC_BALL_CONTENT_XOFF(0), ED_AREA_MAGIC_BALL_CONTENT_YOFF(0),
3179     GADGET_ID_MAGIC_BALL_CONTENT_0,     GADGET_ID_NONE,
3180     &level.ball_content[0].e[0][0],     3, 3,
3181     NULL, NULL, "1",                    NULL
3182   },
3183   {
3184     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3185     ED_AREA_MAGIC_BALL_CONTENT_XOFF(1), ED_AREA_MAGIC_BALL_CONTENT_YOFF(1),
3186     GADGET_ID_MAGIC_BALL_CONTENT_1,     GADGET_ID_NONE,
3187     &level.ball_content[1].e[0][0],     3, 3,
3188     NULL, NULL, "2",                    NULL
3189   },
3190   {
3191     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3192     ED_AREA_MAGIC_BALL_CONTENT_XOFF(2), ED_AREA_MAGIC_BALL_CONTENT_YOFF(2),
3193     GADGET_ID_MAGIC_BALL_CONTENT_2,     GADGET_ID_NONE,
3194     &level.ball_content[2].e[0][0],     3, 3,
3195     NULL, NULL, "3",                    NULL
3196   },
3197   {
3198     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3199     ED_AREA_MAGIC_BALL_CONTENT_XOFF(3), ED_AREA_MAGIC_BALL_CONTENT_YOFF(3),
3200     GADGET_ID_MAGIC_BALL_CONTENT_3,     GADGET_ID_NONE,
3201     &level.ball_content[3].e[0][0],     3, 3,
3202     NULL, NULL, "4",                    NULL
3203   },
3204   {
3205     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3206     ED_AREA_MAGIC_BALL_CONTENT_XOFF(4), ED_AREA_MAGIC_BALL_CONTENT_YOFF(4),
3207     GADGET_ID_MAGIC_BALL_CONTENT_4,     GADGET_ID_NONE,
3208     &level.ball_content[4].e[0][0],     3, 3,
3209     NULL, NULL, "5",                    NULL
3210   },
3211   {
3212     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3213     ED_AREA_MAGIC_BALL_CONTENT_XOFF(5), ED_AREA_MAGIC_BALL_CONTENT_YOFF(5),
3214     GADGET_ID_MAGIC_BALL_CONTENT_5,     GADGET_ID_NONE,
3215     &level.ball_content[5].e[0][0],     3, 3,
3216     NULL, NULL, "6",                    NULL
3217   },
3218   {
3219     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3220     ED_AREA_MAGIC_BALL_CONTENT_XOFF(6), ED_AREA_MAGIC_BALL_CONTENT_YOFF(6),
3221     GADGET_ID_MAGIC_BALL_CONTENT_6,     GADGET_ID_NONE,
3222     &level.ball_content[6].e[0][0],     3, 3,
3223     NULL, NULL, "7",                    NULL
3224   },
3225   {
3226     ED_AREA_MAGIC_BALL_CONTENT_XPOS,    ED_AREA_MAGIC_BALL_CONTENT_YPOS,
3227     ED_AREA_MAGIC_BALL_CONTENT_XOFF(7), ED_AREA_MAGIC_BALL_CONTENT_YOFF(7),
3228     GADGET_ID_MAGIC_BALL_CONTENT_7,     GADGET_ID_NONE,
3229     &level.ball_content[7].e[0][0],     3, 3,
3230     NULL, NULL, "8",                    NULL
3231   },
3232
3233   /* ---------- android content -------------------------------------------- */
3234
3235   {
3236     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(5),
3237     ED_AREA_1X1_SETTINGS_XOFF,          ED_AREA_1X1_SETTINGS_YOFF,
3238     GADGET_ID_ANDROID_CONTENT,          GADGET_ID_NONE,
3239     &level.android_clone_element[0],    MAX_ANDROID_ELEMENTS, 1,
3240     "elements:", NULL, NULL,            "elements android can clone"
3241   },
3242
3243   /* ---------- amoeba content --------------------------------------------- */
3244
3245   {
3246     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(3),
3247     ED_AREA_1X1_SETTINGS_XOFF,          ED_AREA_1X1_SETTINGS_YOFF,
3248     GADGET_ID_AMOEBA_CONTENT,           GADGET_ID_NONE,
3249     &level.amoeba_content,              1, 1,
3250     "content:", NULL, NULL,             "amoeba content"
3251   },
3252
3253   /* ---------- level start element ---------------------------------------- */
3254
3255   {
3256     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(9),
3257     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3258     GADGET_ID_START_ELEMENT,            GADGET_ID_USE_START_ELEMENT,
3259     &level.start_element[0],            1, 1,
3260     NULL, NULL, NULL,                   "level start element"
3261   },
3262
3263   /* ---------- player artwork element ------------------------------------- */
3264
3265   {
3266     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(10),
3267     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3268     GADGET_ID_ARTWORK_ELEMENT,          GADGET_ID_USE_ARTWORK_ELEMENT,
3269     &level.artwork_element[0],          1, 1,
3270     NULL, NULL, NULL,                   "element for player artwork"
3271   },
3272
3273   /* ---------- player explosion element ----------------------------------- */
3274
3275   {
3276     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(11),
3277     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3278     GADGET_ID_EXPLOSION_ELEMENT,        GADGET_ID_USE_EXPLOSION_ELEMENT,
3279     &level.explosion_element[0],        1, 1,
3280     NULL, NULL, NULL,                   "element for player explosion"
3281   },
3282
3283   /* ---------- player initial inventory ----------------------------------- */
3284
3285   {
3286     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3287     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3288     GADGET_ID_INVENTORY_CONTENT,        GADGET_ID_USE_INITIAL_INVENTORY,
3289     &level.initial_inventory_content[0][0], MAX_INITIAL_INVENTORY_SIZE, 1,
3290     NULL, NULL, NULL,                   "content for initial inventory"
3291   },
3292
3293   /* ---------- element settings: configure 1 (custom elements) ----------- */
3294
3295   /* ---------- custom graphic --------------------------------------------- */
3296
3297   {
3298     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3299     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3300     GADGET_ID_CUSTOM_GRAPHIC,           GADGET_ID_CUSTOM_USE_GRAPHIC,
3301     &custom_element.gfx_element_initial,1, 1,
3302     NULL, NULL, NULL,                   "custom graphic element"
3303   },
3304
3305   /* ---------- element settings: configure 2 (custom elements) ----------- */
3306
3307   /* ---------- custom content (when exploding) ---------------------------- */
3308
3309   {
3310     -1,                                 ED_AREA_3X3_SETTINGS_YPOS(10),
3311     0,                                  ED_AREA_3X3_SETTINGS_YOFF,
3312     GADGET_ID_CUSTOM_CONTENT,           GADGET_ID_NONE, /* align three rows */
3313     &custom_element.content.e[0][0],    3, 3,
3314     "content:", NULL, NULL,             NULL
3315   },
3316
3317   /* ---------- custom enter and leave element (when moving) --------------- */
3318
3319   {
3320     ED_AREA_1X1_SETTINGS_XPOS(1),       ED_AREA_1X1_SETTINGS_YPOS(3),
3321     ED_AREA_1X1_SETTINGS_XOFF,          ED_AREA_1X1_SETTINGS_YOFF,
3322     GADGET_ID_CUSTOM_MOVE_ENTER,        GADGET_ID_NONE,
3323     &custom_element.move_enter_element, 1, 1,
3324     "can dig:", " ", NULL,              "element that can be digged/collected"
3325   },
3326   {
3327     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(3),
3328     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3329     GADGET_ID_CUSTOM_MOVE_LEAVE,        GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,
3330     &custom_element.move_leave_element, 1, 1,
3331     NULL, NULL, NULL,                   "element that will be left behind"
3332   },
3333
3334   /* ---------- element settings: advanced (custom elements) --------------- */
3335
3336   /* ---------- custom change target --------------------------------------- */
3337
3338   {
3339     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3340     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3341     GADGET_ID_CUSTOM_CHANGE_TARGET,     GADGET_ID_CUSTOM_CAN_CHANGE,
3342     &custom_element_change.target_element, 1, 1,
3343     NULL, "after/when:", NULL,          "new target element after change"
3344   },
3345
3346   /* ---------- custom change content (extended change target) ------------- */
3347
3348   {
3349     -1,                                 ED_AREA_3X3_SETTINGS_YPOS(9),
3350     0,                                  ED_AREA_3X3_SETTINGS_YOFF,
3351     GADGET_ID_CUSTOM_CHANGE_CONTENT,    GADGET_ID_NONE, /* align three rows */
3352     &custom_element_change.target_content.e[0][0], 3, 3,
3353     NULL, NULL, NULL,                   "new extended elements after change"
3354   },
3355
3356   /* ---------- custom change trigger (element causing change) ------------- */
3357
3358   {
3359     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(5),
3360     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3361     GADGET_ID_CUSTOM_CHANGE_TRIGGER,    GADGET_ID_CHANGE_OTHER_ACTION,
3362     &custom_element_change.initial_trigger_element, 1, 1,
3363     NULL, NULL, NULL,                   "other element triggering change"
3364   },
3365
3366   /* ---------- custom change action (element used for action) ------------- */
3367
3368   {
3369     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(13),
3370     0,                                  ED_AREA_1X1_SETTINGS_YOFF,
3371     GADGET_ID_CUSTOM_CHANGE_ACTION,     GADGET_ID_ACTION_ARG,
3372     &custom_element_change.action_element, 1, 1,
3373     NULL, NULL, NULL,                   "element used as action parameter"
3374   },
3375
3376   /* ---------- group element content -------------------------------------- */
3377
3378   {
3379     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(2),
3380     ED_AREA_1X1_SETTINGS_XOFF,          ED_AREA_1X1_SETTINGS_YOFF,
3381     GADGET_ID_GROUP_CONTENT,            GADGET_ID_NONE,
3382     &group_element_info.element[0],     MAX_ELEMENTS_IN_GROUP, 1,
3383     "content:", NULL, NULL,             NULL
3384   },
3385
3386   /* ---------- random background (for random painting) -------------------- */
3387
3388   {
3389     -1,                                 ED_AREA_1X1_LSETTINGS_YPOS(1),
3390     0,                                  ED_AREA_1X1_LSETTINGS_YOFF,
3391     GADGET_ID_RANDOM_BACKGROUND,        GADGET_ID_RANDOM_RESTRICTED,
3392     &random_placement_background_element, 1, 1,
3393     NULL, NULL, NULL,                   "random placement background"
3394   },
3395 };
3396
3397
3398 /*
3399   -----------------------------------------------------------------------------
3400   some internally used variables
3401   -----------------------------------------------------------------------------
3402 */
3403
3404 /* maximal size of level editor drawing area */
3405 static int MAX_ED_FIELDX, MAX_ED_FIELDY;
3406
3407 /* actual size of level editor drawing area */
3408 static int ed_fieldx, ed_fieldy;
3409
3410 /* actual position of level editor drawing area in level playfield */
3411 static int level_xpos = -1, level_ypos = -1;
3412
3413 /* actual tile size used to display playfield drawing area */
3414 static int ed_tilesize = DEFAULT_EDITOR_TILESIZE;
3415
3416 #define IN_ED_FIELD(x,y)        IN_FIELD(x, y, ed_fieldx, ed_fieldy)
3417
3418 /* drawing elements on the three mouse buttons */
3419 static int new_element1 = EL_WALL;
3420 static int new_element2 = EL_EMPTY;
3421 static int new_element3 = EL_SAND;
3422
3423 #define IS_VALID_BUTTON(button) (button >= 1 && button <= 3)
3424 #define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
3425                                 (button) == 2 ? new_element2 : \
3426                                 (button) == 3 ? new_element3 : EL_EMPTY)
3427
3428 /* forward declaration for internal use */
3429 static void ModifyEditorCounterValue(int, int);
3430 static void ModifyEditorCounterLimits(int, int, int);
3431 static void ModifyEditorSelectboxValue(int, int);
3432 static void ModifyEditorSelectboxOptions(int, struct ValueTextInfo *);
3433 static void ModifyEditorDrawingArea(int, int, int);
3434 static void ModifyEditorElementList();
3435 static void AdjustElementListScrollbar();
3436 static void RedrawDrawingElements();
3437 static void DrawDrawingWindow();
3438 static void DrawLevelInfoWindow();
3439 static void DrawPropertiesWindow();
3440 static void UpdateCustomElementGraphicGadgets();
3441 static boolean checkPropertiesConfig(int);
3442 static void CopyLevelToUndoBuffer(int);
3443 static void HandleDrawingAreas(struct GadgetInfo *);
3444 static void HandleCounterButtons(struct GadgetInfo *);
3445 static void HandleTextInputGadgets(struct GadgetInfo *);
3446 static void HandleTextAreaGadgets(struct GadgetInfo *);
3447 static void HandleSelectboxGadgets(struct GadgetInfo *);
3448 static void HandleTextbuttonGadgets(struct GadgetInfo *);
3449 static void HandleGraphicbuttonGadgets(struct GadgetInfo *);
3450 static void HandleRadiobuttons(struct GadgetInfo *);
3451 static void HandleCheckbuttons(struct GadgetInfo *);
3452 static void HandleControlButtons(struct GadgetInfo *);
3453 static void HandleDrawingAreaInfo(struct GadgetInfo *);
3454 static void PrintEditorGadgetInfoText(struct GadgetInfo *);
3455
3456 static int num_editor_gadgets = 0;      /* dynamically determined */
3457
3458 static struct GadgetInfo **level_editor_gadget = NULL;
3459 static int *right_gadget_border = NULL;
3460
3461 static int drawing_function = GADGET_ID_SINGLE_ITEMS;
3462 static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
3463 static boolean draw_with_brush = FALSE;
3464 static int properties_element = 0;
3465
3466 static short FieldBackup[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3467 static short UndoBuffer[NUM_UNDO_STEPS][MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3468 static short IntelliDrawBuffer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3469 static int undo_buffer_position = 0;
3470 static int undo_buffer_steps = 0;
3471 static int redo_buffer_steps = 0;
3472
3473 static int edit_mode;
3474 static int edit_mode_levelinfo;
3475 static int edit_mode_properties;
3476
3477 static int element_shift = 0;
3478
3479 static int editor_el_players[] =
3480 {
3481   EL_PLAYER_1,
3482   EL_PLAYER_2,
3483   EL_PLAYER_3,
3484   EL_PLAYER_4
3485 };
3486 static int *editor_el_players_ptr = editor_el_players;
3487 static int num_editor_el_players = SIZEOF_ARRAY_INT(editor_el_players);
3488
3489 static int editor_hl_boulderdash[] =
3490 {
3491   EL_INTERNAL_CASCADE_BD_ACTIVE,
3492   EL_CHAR('B'),
3493   EL_CHAR('D'),
3494   EL_EMPTY,
3495 };
3496
3497 static int editor_el_boulderdash[] =
3498 {
3499   EL_EMPTY,
3500   EL_SAND,
3501   EL_BD_ROCK,
3502   EL_BD_DIAMOND,
3503
3504   EL_STEELWALL,
3505   EL_BD_WALL,
3506   EL_BD_EXPANDABLE_WALL,
3507   EL_BD_MAGIC_WALL,
3508
3509   EL_BD_AMOEBA,
3510   EL_BD_BUTTERFLY_UP,
3511   EL_BD_FIREFLY_UP,
3512   EL_EXIT_CLOSED,
3513
3514   EL_BD_BUTTERFLY_LEFT,
3515   EL_BD_FIREFLY_LEFT,
3516   EL_BD_BUTTERFLY_RIGHT,
3517   EL_BD_FIREFLY_RIGHT,
3518
3519   EL_EMPTY,
3520   EL_BD_BUTTERFLY_DOWN,
3521   EL_BD_FIREFLY_DOWN,
3522   EL_EXIT_OPEN,
3523 };
3524 static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash;
3525 static int *editor_el_boulderdash_ptr = editor_el_boulderdash;
3526 static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash);
3527 static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
3528
3529 static int editor_hl_emerald_mine[] =
3530 {
3531   EL_INTERNAL_CASCADE_EM_ACTIVE,
3532   EL_CHAR('E'),
3533   EL_CHAR('M'),
3534   EL_EMPTY,
3535 };
3536
3537 static int editor_el_emerald_mine[] =
3538 {
3539   EL_SAND,
3540   EL_ROCK,
3541   EL_QUICKSAND_EMPTY,
3542   EL_QUICKSAND_FULL,
3543
3544   EL_STEELWALL,
3545   EL_WALL,
3546   EL_WALL_SLIPPERY,
3547   EL_MAGIC_WALL,
3548
3549   EL_EMERALD,
3550   EL_DIAMOND,
3551   EL_NUT,
3552   EL_BOMB,
3553
3554   EL_WALL_EMERALD,
3555   EL_WALL_DIAMOND,
3556   EL_DYNAMITE,
3557   EL_DYNAMITE_ACTIVE,
3558
3559   EL_YAMYAM,
3560   EL_BUG_UP,
3561   EL_SPACESHIP_UP,
3562   EL_ROBOT,
3563
3564   EL_BUG_LEFT,
3565   EL_SPACESHIP_LEFT,
3566   EL_BUG_RIGHT,
3567   EL_SPACESHIP_RIGHT,
3568
3569   EL_ROBOT_WHEEL,
3570   EL_BUG_DOWN,
3571   EL_SPACESHIP_DOWN,
3572   EL_INVISIBLE_WALL,
3573
3574   EL_ACID_POOL_TOPLEFT,
3575   EL_ACID,
3576   EL_ACID_POOL_TOPRIGHT,
3577   EL_AMOEBA_DROP,
3578
3579   EL_ACID_POOL_BOTTOMLEFT,
3580   EL_ACID_POOL_BOTTOM,
3581   EL_ACID_POOL_BOTTOMRIGHT,
3582   EL_AMOEBA_WET,
3583
3584   EL_EM_KEY_1,
3585   EL_EM_KEY_2,
3586   EL_EM_KEY_3,
3587   EL_EM_KEY_4,
3588
3589   EL_EM_GATE_1,
3590   EL_EM_GATE_2,
3591   EL_EM_GATE_3,
3592   EL_EM_GATE_4,
3593
3594   EL_EM_GATE_1_GRAY,
3595   EL_EM_GATE_2_GRAY,
3596   EL_EM_GATE_3_GRAY,
3597   EL_EM_GATE_4_GRAY,
3598
3599   EL_EM_EXIT_CLOSED,
3600   EL_EM_EXIT_OPEN,
3601   EL_EM_STEEL_EXIT_CLOSED,
3602   EL_EM_STEEL_EXIT_OPEN,
3603 };
3604 static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine;
3605 static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine;
3606 static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine);
3607 static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine);
3608
3609 static int editor_hl_emerald_mine_club[] =
3610 {
3611   EL_INTERNAL_CASCADE_EMC_ACTIVE,
3612   EL_CHAR('E'),
3613   EL_CHAR('M'),
3614   EL_CHAR('C'),
3615 };
3616
3617 static int editor_el_emerald_mine_club[] =
3618 {
3619   EL_EMC_KEY_5,
3620   EL_EMC_KEY_6,
3621   EL_EMC_KEY_7,
3622   EL_EMC_KEY_8,
3623
3624   EL_EMC_GATE_5,
3625   EL_EMC_GATE_6,
3626   EL_EMC_GATE_7,
3627   EL_EMC_GATE_8,
3628
3629   EL_EMC_GATE_5_GRAY,
3630   EL_EMC_GATE_6_GRAY,
3631   EL_EMC_GATE_7_GRAY,
3632   EL_EMC_GATE_8_GRAY,
3633
3634   EL_EMC_STEELWALL_1,
3635   EL_EMC_STEELWALL_2,
3636   EL_EMC_STEELWALL_3,
3637   EL_EMC_STEELWALL_4,
3638
3639   EL_EMC_WALL_13,
3640   EL_EMC_WALL_14,
3641   EL_EMC_WALL_15,
3642   EL_EMC_WALL_16,
3643
3644   EL_EMC_WALL_SLIPPERY_1,
3645   EL_EMC_WALL_SLIPPERY_2,
3646   EL_EMC_WALL_SLIPPERY_3,
3647   EL_EMC_WALL_SLIPPERY_4,
3648
3649   EL_EMC_WALL_1,
3650   EL_EMC_WALL_2,
3651   EL_EMC_WALL_3,
3652   EL_EMC_WALL_4,
3653
3654   EL_EMC_WALL_5,
3655   EL_EMC_WALL_6,
3656   EL_EMC_WALL_7,
3657   EL_EMC_WALL_8,
3658
3659   EL_EMC_WALL_9,
3660   EL_EMC_WALL_10,
3661   EL_EMC_WALL_11,
3662   EL_EMC_WALL_12,
3663
3664   EL_EMC_GRASS,
3665   EL_EMC_FAKE_GRASS,
3666   EL_EMC_PLANT,
3667   EL_EMC_DRIPPER,
3668
3669   EL_EMC_MAGIC_BALL,
3670   EL_EMC_MAGIC_BALL_SWITCH,
3671   EL_SPRING,
3672   EL_EMC_SPRING_BUMPER,
3673
3674   EL_EMC_LENSES,
3675   EL_EMC_MAGNIFIER,
3676   EL_EM_DYNAMITE,
3677   EL_EM_DYNAMITE_ACTIVE,
3678
3679   EL_BALLOON,
3680   EL_YAMYAM_UP,
3681   EL_BALLOON_SWITCH_UP,
3682   EL_BALLOON_SWITCH_ANY,
3683
3684   EL_YAMYAM_LEFT,
3685   EL_BALLOON_SWITCH_LEFT,
3686   EL_YAMYAM_RIGHT,
3687   EL_BALLOON_SWITCH_RIGHT,
3688
3689   EL_EMC_ANDROID,
3690   EL_YAMYAM_DOWN,
3691   EL_BALLOON_SWITCH_DOWN,
3692   EL_BALLOON_SWITCH_NONE,
3693 };
3694 static int *editor_hl_emerald_mine_club_ptr = editor_hl_emerald_mine_club;
3695 static int *editor_el_emerald_mine_club_ptr = editor_el_emerald_mine_club;
3696 static int num_editor_hl_emerald_mine_club=SIZEOF_ARRAY_INT(editor_hl_emerald_mine_club);
3697 static int num_editor_el_emerald_mine_club=SIZEOF_ARRAY_INT(editor_el_emerald_mine_club);
3698
3699 static int editor_hl_rnd[] =
3700 {
3701   EL_INTERNAL_CASCADE_RND_ACTIVE,
3702   EL_CHAR('R'),
3703   EL_CHAR('N'),
3704   EL_CHAR('D'),
3705 };
3706
3707 static int editor_el_rnd[] =
3708 {
3709   EL_KEY_1,
3710   EL_KEY_2,
3711   EL_KEY_3,
3712   EL_KEY_4,
3713
3714   EL_GATE_1,
3715   EL_GATE_2,
3716   EL_GATE_3,
3717   EL_GATE_4,
3718
3719   EL_GATE_1_GRAY,
3720   EL_GATE_2_GRAY,
3721   EL_GATE_3_GRAY,
3722   EL_GATE_4_GRAY,
3723
3724   EL_ARROW_LEFT,
3725   EL_ARROW_RIGHT,
3726   EL_ARROW_UP,
3727   EL_ARROW_DOWN,
3728
3729   EL_AMOEBA_DEAD,
3730   EL_AMOEBA_DRY,
3731   EL_AMOEBA_FULL,
3732   EL_GAME_OF_LIFE,
3733
3734   EL_EMERALD_YELLOW,
3735   EL_EMERALD_RED,
3736   EL_EMERALD_PURPLE,
3737   EL_BIOMAZE,
3738
3739   EL_WALL_EMERALD_YELLOW,
3740   EL_WALL_EMERALD_RED,
3741   EL_WALL_EMERALD_PURPLE,
3742   EL_WALL_BD_DIAMOND,
3743
3744   EL_SPEED_PILL,
3745   EL_PACMAN_UP,
3746   EL_TIME_ORB_FULL,
3747   EL_TIME_ORB_EMPTY,
3748
3749   EL_PACMAN_LEFT,
3750   EL_DARK_YAMYAM,
3751   EL_PACMAN_RIGHT,
3752   EL_EMPTY,
3753
3754   EL_BLACK_ORB,
3755   EL_PACMAN_DOWN,
3756   EL_LAMP,
3757   EL_LAMP_ACTIVE,
3758
3759   EL_DYNABOMB_INCREASE_NUMBER,
3760   EL_DYNABOMB_INCREASE_SIZE,
3761   EL_DYNABOMB_INCREASE_POWER,
3762   EL_STONEBLOCK,
3763
3764   EL_MOLE,
3765   EL_PENGUIN,
3766   EL_PIG,
3767   EL_DRAGON,
3768
3769   EL_BUG,
3770   EL_MOLE_UP,
3771   EL_BD_BUTTERFLY,
3772   EL_BD_FIREFLY,
3773
3774   EL_MOLE_LEFT,
3775   EL_SATELLITE,
3776   EL_MOLE_RIGHT,
3777   EL_PACMAN,
3778
3779   EL_SPACESHIP,
3780   EL_MOLE_DOWN,
3781   EL_INVISIBLE_STEELWALL,
3782   EL_INVISIBLE_WALL,
3783
3784   EL_EXPANDABLE_WALL,
3785   EL_EXPANDABLE_WALL_HORIZONTAL,
3786   EL_EXPANDABLE_WALL_VERTICAL,
3787   EL_EXPANDABLE_WALL_ANY,
3788 };
3789 static int *editor_hl_rnd_ptr = editor_hl_rnd;
3790 static int *editor_el_rnd_ptr = editor_el_rnd;
3791 static int num_editor_hl_rnd = SIZEOF_ARRAY_INT(editor_hl_rnd);
3792 static int num_editor_el_rnd = SIZEOF_ARRAY_INT(editor_el_rnd);
3793
3794 static int editor_hl_sokoban[] =
3795 {
3796   EL_INTERNAL_CASCADE_SB_ACTIVE,
3797   EL_CHAR('S'),
3798   EL_CHAR('B'),
3799   EL_EMPTY,
3800 };
3801
3802 static int editor_el_sokoban[] =
3803 {
3804   EL_SOKOBAN_OBJECT,
3805   EL_SOKOBAN_FIELD_EMPTY,
3806   EL_SOKOBAN_FIELD_FULL,
3807   EL_SOKOBAN_FIELD_PLAYER,
3808 };
3809 static int *editor_hl_sokoban_ptr = editor_hl_sokoban;
3810 static int *editor_el_sokoban_ptr = editor_el_sokoban;
3811 static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban);
3812 static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
3813
3814 static int editor_hl_supaplex[] =
3815 {
3816   EL_INTERNAL_CASCADE_SP_ACTIVE,
3817   EL_CHAR('S'),
3818   EL_CHAR('P'),
3819   EL_EMPTY,
3820 };
3821
3822 static int editor_el_supaplex[] =
3823 {
3824   EL_SP_MURPHY,
3825   EL_EMPTY,
3826   EL_SP_BASE,
3827   EL_SP_BUGGY_BASE,
3828
3829   EL_SP_INFOTRON,
3830   EL_SP_ZONK,
3831   EL_SP_SNIKSNAK,
3832   EL_SP_ELECTRON,
3833
3834   EL_SP_DISK_RED,
3835   EL_SP_DISK_ORANGE,
3836   EL_SP_DISK_YELLOW,
3837   EL_SP_TERMINAL,
3838
3839   EL_SP_EXIT_CLOSED,
3840   EL_SP_PORT_HORIZONTAL,
3841   EL_SP_PORT_VERTICAL,
3842   EL_SP_PORT_ANY,
3843
3844   EL_SP_PORT_LEFT,
3845   EL_SP_PORT_RIGHT,
3846   EL_SP_PORT_UP,
3847   EL_SP_PORT_DOWN,
3848
3849   EL_SP_GRAVITY_PORT_LEFT,
3850   EL_SP_GRAVITY_PORT_RIGHT,
3851   EL_SP_GRAVITY_PORT_UP,
3852   EL_SP_GRAVITY_PORT_DOWN,
3853
3854   EL_SP_GRAVITY_ON_PORT_LEFT,
3855   EL_SP_GRAVITY_ON_PORT_RIGHT,
3856   EL_SP_GRAVITY_ON_PORT_UP,
3857   EL_SP_GRAVITY_ON_PORT_DOWN,
3858
3859   EL_SP_GRAVITY_OFF_PORT_LEFT,
3860   EL_SP_GRAVITY_OFF_PORT_RIGHT,
3861   EL_SP_GRAVITY_OFF_PORT_UP,
3862   EL_SP_GRAVITY_OFF_PORT_DOWN,
3863
3864   EL_SP_HARDWARE_GRAY,
3865   EL_SP_HARDWARE_GREEN,
3866   EL_SP_HARDWARE_BLUE,
3867   EL_SP_HARDWARE_RED,
3868
3869   EL_SP_HARDWARE_BASE_1,
3870   EL_SP_HARDWARE_BASE_2,
3871   EL_SP_HARDWARE_BASE_3,
3872   EL_SP_HARDWARE_BASE_4,
3873
3874   EL_SP_HARDWARE_BASE_5,
3875   EL_SP_HARDWARE_BASE_6,
3876   EL_SP_HARDWARE_YELLOW,
3877   EL_SP_CHIP_TOP,
3878
3879   EL_SP_CHIP_SINGLE,
3880   EL_SP_CHIP_LEFT,
3881   EL_SP_CHIP_RIGHT,
3882   EL_SP_CHIP_BOTTOM,
3883 };
3884 static int *editor_hl_supaplex_ptr = editor_hl_supaplex;
3885 static int *editor_el_supaplex_ptr = editor_el_supaplex;
3886 static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex);
3887 static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
3888
3889 static int editor_hl_diamond_caves[] =
3890 {
3891   EL_INTERNAL_CASCADE_DC_ACTIVE,
3892   EL_CHAR('D'),
3893   EL_CHAR('C'),
3894   EL_CHAR('2'),
3895 };
3896
3897 static int editor_el_diamond_caves[] =
3898 {
3899   EL_PEARL,
3900   EL_CRYSTAL,
3901   EL_WALL_PEARL,
3902   EL_WALL_CRYSTAL,
3903
3904   EL_CONVEYOR_BELT_1_LEFT,
3905   EL_CONVEYOR_BELT_1_MIDDLE,
3906   EL_CONVEYOR_BELT_1_RIGHT,
3907   EL_CONVEYOR_BELT_1_SWITCH_MIDDLE,
3908
3909   EL_CONVEYOR_BELT_2_LEFT,
3910   EL_CONVEYOR_BELT_2_MIDDLE,
3911   EL_CONVEYOR_BELT_2_RIGHT,
3912   EL_CONVEYOR_BELT_2_SWITCH_MIDDLE,
3913
3914   EL_CONVEYOR_BELT_3_LEFT,
3915   EL_CONVEYOR_BELT_3_MIDDLE,
3916   EL_CONVEYOR_BELT_3_RIGHT,
3917   EL_CONVEYOR_BELT_3_SWITCH_MIDDLE,
3918
3919   EL_CONVEYOR_BELT_4_LEFT,
3920   EL_CONVEYOR_BELT_4_MIDDLE,
3921   EL_CONVEYOR_BELT_4_RIGHT,
3922   EL_CONVEYOR_BELT_4_SWITCH_MIDDLE,
3923
3924   EL_CONVEYOR_BELT_1_SWITCH_LEFT,
3925   EL_CONVEYOR_BELT_2_SWITCH_LEFT,
3926   EL_CONVEYOR_BELT_3_SWITCH_LEFT,
3927   EL_CONVEYOR_BELT_4_SWITCH_LEFT,
3928
3929   EL_CONVEYOR_BELT_1_SWITCH_RIGHT,
3930   EL_CONVEYOR_BELT_2_SWITCH_RIGHT,
3931   EL_CONVEYOR_BELT_3_SWITCH_RIGHT,
3932   EL_CONVEYOR_BELT_4_SWITCH_RIGHT,
3933
3934   EL_TIMEGATE_CLOSED,
3935   EL_TIMEGATE_OPEN,
3936   EL_TIMEGATE_SWITCH,
3937   EL_DC_TIMEGATE_SWITCH,
3938
3939   EL_SWITCHGATE_CLOSED,
3940   EL_SWITCHGATE_OPEN,
3941   EL_SWITCHGATE_SWITCH_UP,
3942   EL_SWITCHGATE_SWITCH_DOWN,
3943
3944   EL_LIGHT_SWITCH,
3945   EL_LIGHT_SWITCH_ACTIVE,
3946   EL_DC_SWITCHGATE_SWITCH_UP,
3947   EL_DC_SWITCHGATE_SWITCH_DOWN,
3948
3949   EL_STEEL_EXIT_CLOSED,
3950   EL_STEEL_EXIT_OPEN,
3951   EL_STEELWALL_SLIPPERY,
3952   EL_INVISIBLE_SAND,
3953
3954   EL_QUICKSAND_FAST_EMPTY,
3955   EL_QUICKSAND_FAST_FULL,
3956   EL_LANDMINE,
3957   EL_DC_LANDMINE,
3958
3959   EL_SHIELD_NORMAL,
3960   EL_SHIELD_DEADLY,
3961   EL_EXTRA_TIME,
3962   EL_DC_MAGIC_WALL,
3963
3964   EL_ENVELOPE_1,
3965   EL_ENVELOPE_2,
3966   EL_ENVELOPE_3,
3967   EL_ENVELOPE_4,
3968
3969   EL_SIGN_RADIOACTIVITY,
3970   EL_SIGN_WHEELCHAIR,
3971   EL_SIGN_PARKING,
3972   EL_SIGN_NO_ENTRY,
3973
3974   EL_SIGN_GIVE_WAY,
3975   EL_SIGN_ENTRY_FORBIDDEN,
3976   EL_SIGN_EMERGENCY_EXIT,
3977   EL_SIGN_YIN_YANG,
3978
3979 #if 0
3980   EL_SIGN_SPERMS,
3981   EL_SIGN_BULLET,
3982   EL_SIGN_HEART,
3983   EL_SIGN_CROSS,
3984
3985   EL_SIGN_FRANKIE,