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