1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
14 #include "libgame/libgame.h"
25 #define INFOTEXT_UNKNOWN_ELEMENT "unknown"
28 // ----------------------------------------------------------------------------
29 // screen and artwork graphic pixel position definitions
30 // ----------------------------------------------------------------------------
32 // values for the control window
33 #define ED_CTRL1_BUTTONS_HORIZ 4 // toolbox
34 #define ED_CTRL1_BUTTONS_VERT 4
35 #define ED_CTRL2_BUTTONS_HORIZ 3 // level
36 #define ED_CTRL2_BUTTONS_VERT 2
37 #define ED_CTRL3_BUTTONS_HORIZ 3 // CE and GE
38 #define ED_CTRL3_BUTTONS_VERT 1
39 #define ED_CTRL4_BUTTONS_HORIZ 2 // CE and GE
40 #define ED_CTRL4_BUTTONS_VERT 1
41 #define ED_CTRL5_BUTTONS_HORIZ 1 // properties
42 #define ED_CTRL5_BUTTONS_VERT 1
43 #define ED_CTRL6_BUTTONS_HORIZ 3 // properties
44 #define ED_CTRL6_BUTTONS_VERT 1
45 #define ED_CTRL7_BUTTONS_HORIZ 1 // palette
46 #define ED_CTRL7_BUTTONS_VERT 1
48 #define ED_NUM_CTRL1_BUTTONS (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
49 #define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
50 #define ED_NUM_CTRL3_BUTTONS (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT)
51 #define ED_NUM_CTRL4_BUTTONS (ED_CTRL4_BUTTONS_HORIZ * ED_CTRL4_BUTTONS_VERT)
52 #define ED_NUM_CTRL5_BUTTONS (ED_CTRL5_BUTTONS_HORIZ * ED_CTRL5_BUTTONS_VERT)
53 #define ED_NUM_CTRL6_BUTTONS (ED_CTRL6_BUTTONS_HORIZ * ED_CTRL6_BUTTONS_VERT)
54 #define ED_NUM_CTRL7_BUTTONS (ED_CTRL7_BUTTONS_HORIZ * ED_CTRL7_BUTTONS_VERT)
55 #define ED_NUM_CTRL1_2_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS)
56 #define ED_NUM_CTRL1_3_BUTTONS (ED_NUM_CTRL1_2_BUTTONS + ED_NUM_CTRL3_BUTTONS)
57 #define ED_NUM_CTRL1_4_BUTTONS (ED_NUM_CTRL1_3_BUTTONS + ED_NUM_CTRL4_BUTTONS)
58 #define ED_NUM_CTRL1_5_BUTTONS (ED_NUM_CTRL1_4_BUTTONS + ED_NUM_CTRL5_BUTTONS)
59 #define ED_NUM_CTRL1_6_BUTTONS (ED_NUM_CTRL1_5_BUTTONS + ED_NUM_CTRL6_BUTTONS)
60 #define ED_NUM_CTRL1_7_BUTTONS (ED_NUM_CTRL1_6_BUTTONS + ED_NUM_CTRL7_BUTTONS)
61 #define ED_NUM_CTRL_BUTTONS ED_NUM_CTRL1_7_BUTTONS
63 // values for the element list
64 #define ED_ELEMENTLIST_XPOS (editor.palette.x)
65 #define ED_ELEMENTLIST_YPOS (editor.palette.y)
66 #define ED_ELEMENTLIST_XSIZE (graphic_info[IMG_EDITOR_PALETTE_BUTTON].width)
67 #define ED_ELEMENTLIST_YSIZE (graphic_info[IMG_EDITOR_PALETTE_BUTTON].height)
68 #define ED_ELEMENTLIST_COLS MAX(1, editor.palette.cols)
69 #define ED_ELEMENTLIST_ROWS MAX(1, editor.palette.rows)
70 #define ED_ELEMENTLIST_BUTTONS_HORIZ (ED_ELEMENTLIST_COLS)
71 #define ED_ELEMENTLIST_BUTTONS_VERT (ED_ELEMENTLIST_ROWS)
72 #define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \
73 ED_ELEMENTLIST_BUTTONS_VERT)
76 #define ED_GADGET_NORMAL_DISTANCE (editor.gadget.normal_spacing)
77 #define ED_GADGET_SMALL_DISTANCE (editor.gadget.small_spacing)
78 #define ED_GADGET_TINY_DISTANCE (editor.gadget.tiny_spacing)
79 #define ED_GADGET_LINE_DISTANCE (editor.gadget.line_spacing)
80 #define ED_GADGET_TEXT_DISTANCE (editor.gadget.text_spacing)
81 #define ED_TAB_BAR_HEIGHT (editor.gadget.separator_line.height)
82 #define ED_DRAWINGAREA_TEXT_DISTANCE (ED_GADGET_TEXT_DISTANCE + \
83 ED_DRAWINGAREA_BORDER_SIZE)
84 #define ED_GADGET_SPACE_DISTANCE (getFontWidth(FONT_TEXT_1))
86 // values for drawingarea gadgets
87 #define IMG_BORDER_1 IMG_EDITOR_ELEMENT_BORDER
88 #define IMG_BORDER_2 IMG_EDITOR_ELEMENT_BORDER_INPUT
89 #define ED_ELEMENT_BORDER (graphic_info[IMG_BORDER_1].border_size)
90 #define ED_DRAWINGAREA_BORDER_SIZE (graphic_info[IMG_BORDER_2].border_size)
91 #define ED_DRAWINGAREA_TILE_SIZE (editor.drawingarea.tile_size)
93 // values for checkbutton gadgets
94 #define ED_CHECKBUTTON_XSIZE (graphic_info[IMG_EDITOR_CHECKBOX].width)
95 #define ED_CHECKBUTTON_YSIZE (graphic_info[IMG_EDITOR_CHECKBOX].height)
97 #define ED_TABBUTTON_XSIZE (graphic_info[IMG_EDITOR_TABBUTTON].width)
98 #define ED_TABBUTTON_YSIZE (graphic_info[IMG_EDITOR_TABBUTTON].height)
100 #define ED_SETTINGS_LEVEL_TABS_X (editor.settings.tabs.x)
101 #define ED_SETTINGS_LEVEL_TABS_Y (editor.settings.tabs.y)
102 #define ED_SETTINGS_ENGINE_TABS_X (editor.settings.tabs.x)
103 #define ED_SETTINGS_ENGINE_TABS_Y (editor.settings.tabs.y + \
104 ED_TABBUTTON_YSIZE + \
105 ED_GADGET_TINY_DISTANCE + \
106 ED_TAB_BAR_HEIGHT + \
107 ED_GADGET_TEXT_DISTANCE)
108 #define ED_SETTINGS_ELEMENT_TABS_X (editor.settings.tabs.x)
109 #define ED_SETTINGS_ELEMENT_TABS_Y (editor.settings.tabs.y + \
110 editor.settings.tabs.yoffset2)
112 #define ED_SETTINGS_TABS_XOFFSET (editor.settings.tabs.draw_xoffset)
113 #define ED_SETTINGS_TABS_YOFFSET (editor.settings.tabs.draw_yoffset)
115 #define ED_LEVEL_TABS_XSTART (ED_SETTINGS_LEVEL_TABS_X)
116 #define ED_LEVEL_TABS_YSTART (ED_SETTINGS_LEVEL_TABS_Y)
117 #define ED_LEVEL_SETTINGS_XSTART (ED_SETTINGS_LEVEL_TABS_X + \
118 ED_SETTINGS_TABS_XOFFSET)
119 #define ED_LEVEL_SETTINGS_YSTART (ED_SETTINGS_LEVEL_TABS_Y + \
120 ED_TABBUTTON_YSIZE + \
121 ED_GADGET_TINY_DISTANCE + \
122 ED_TAB_BAR_HEIGHT + \
123 ED_SETTINGS_TABS_YOFFSET + \
124 getFontHeight(FONT_TEXT_1) + \
125 ED_GADGET_TEXT_DISTANCE)
126 #define ED_ENGINE_TABS_XSTART (ED_SETTINGS_ENGINE_TABS_X)
127 #define ED_ENGINE_TABS_YSTART (ED_SETTINGS_ENGINE_TABS_Y)
128 #define ED_ENGINE_SETTINGS_XSTART (ED_SETTINGS_ENGINE_TABS_X + \
129 ED_SETTINGS_TABS_XOFFSET)
130 #define ED_ENGINE_SETTINGS_YSTART (ED_SETTINGS_ENGINE_TABS_Y + \
131 ED_TABBUTTON_YSIZE + \
132 ED_GADGET_TINY_DISTANCE + \
133 ED_TAB_BAR_HEIGHT + \
134 ED_SETTINGS_TABS_YOFFSET + \
135 getFontHeight(FONT_TEXT_1) + \
136 ED_GADGET_TEXT_DISTANCE)
137 #define ED_ELEMENT_TABS_XSTART (ED_SETTINGS_ELEMENT_TABS_X)
138 #define ED_ELEMENT_TABS_YSTART (ED_SETTINGS_ELEMENT_TABS_Y)
139 #define ED_ELEMENT_SETTINGS_XSTART (ED_SETTINGS_ELEMENT_TABS_X + \
140 ED_SETTINGS_TABS_XOFFSET)
141 #define ED_ELEMENT_SETTINGS_YSTART (ED_SETTINGS_ELEMENT_TABS_Y + \
142 ED_TABBUTTON_YSIZE + \
143 ED_GADGET_TINY_DISTANCE + \
144 ED_TAB_BAR_HEIGHT + \
145 ED_SETTINGS_TABS_YOFFSET)
147 #define ED_SETTINGS_XOFFSET (ED_CHECKBUTTON_XSIZE + \
148 ED_GADGET_TEXT_DISTANCE)
149 #define ED_SETTINGS_YOFFSET (ED_CHECKBUTTON_YSIZE + \
150 ED_GADGET_LINE_DISTANCE)
152 #define ED_POS_RANGE (10000)
153 #define ED_POS_LEVEL_TABS_FIRST (1 * ED_POS_RANGE)
154 #define ED_POS_LEVEL_TABS_LAST (2 * ED_POS_RANGE - 1)
155 #define ED_POS_LEVEL_SETTINGS_FIRST (2 * ED_POS_RANGE)
156 #define ED_POS_LEVEL_SETTINGS_LAST (3 * ED_POS_RANGE - 1)
157 #define ED_POS_ENGINE_TABS_FIRST (3 * ED_POS_RANGE)
158 #define ED_POS_ENGINE_TABS_LAST (4 * ED_POS_RANGE - 1)
159 #define ED_POS_ENGINE_SETTINGS_FIRST (4 * ED_POS_RANGE)
160 #define ED_POS_ENGINE_SETTINGS_LAST (5 * ED_POS_RANGE - 1)
161 #define ED_POS_ELEMENT_TABS_FIRST (5 * ED_POS_RANGE)
162 #define ED_POS_ELEMENT_TABS_LAST (6 * ED_POS_RANGE - 1)
163 #define ED_POS_ELEMENT_SETTINGS_FIRST (6 * ED_POS_RANGE)
164 #define ED_POS_ELEMENT_SETTINGS_LAST (7 * ED_POS_RANGE - 1)
166 #define ED_LEVEL_TABS_XPOS(n) (ED_POS_LEVEL_TABS_FIRST + (n))
167 #define ED_LEVEL_TABS_YPOS(n) (ED_POS_LEVEL_TABS_FIRST + (n))
169 #define ED_LEVEL_SETTINGS_XPOS(n) (ED_POS_LEVEL_SETTINGS_FIRST + (n))
170 #define ED_LEVEL_SETTINGS_YPOS(n) (ED_POS_LEVEL_SETTINGS_FIRST + (n))
172 #define ED_ENGINE_TABS_XPOS(n) (ED_POS_ENGINE_TABS_FIRST + (n))
173 #define ED_ENGINE_TABS_YPOS(n) (ED_POS_ENGINE_TABS_FIRST + (n))
175 #define ED_ENGINE_SETTINGS_XPOS(n) (ED_POS_ENGINE_SETTINGS_FIRST + (n))
176 #define ED_ENGINE_SETTINGS_YPOS(n) (ED_POS_ENGINE_SETTINGS_FIRST + (n))
178 #define ED_ELEMENT_TABS_XPOS(n) (ED_POS_ELEMENT_TABS_FIRST + (n))
179 #define ED_ELEMENT_TABS_YPOS(n) (ED_POS_ELEMENT_TABS_FIRST + (n))
181 #define ED_ELEMENT_SETTINGS_XPOS(n) (ED_POS_ELEMENT_SETTINGS_FIRST + (n))
182 #define ED_ELEMENT_SETTINGS_YPOS(n) (ED_POS_ELEMENT_SETTINGS_FIRST + (n))
184 #define IS_POS_LEVEL_TABS(n) ((n) >= ED_POS_LEVEL_TABS_FIRST && \
185 (n) <= ED_POS_LEVEL_TABS_LAST)
186 #define IS_POS_LEVEL_SETTINGS(n) ((n) >= ED_POS_LEVEL_SETTINGS_FIRST && \
187 (n) <= ED_POS_LEVEL_SETTINGS_LAST)
188 #define IS_POS_ENGINE_TABS(n) ((n) >= ED_POS_ENGINE_TABS_FIRST && \
189 (n) <= ED_POS_ENGINE_TABS_LAST)
190 #define IS_POS_ENGINE_SETTINGS(n) ((n) >= ED_POS_ENGINE_SETTINGS_FIRST && \
191 (n) <= ED_POS_ENGINE_SETTINGS_LAST)
192 #define IS_POS_ELEMENT_TABS(n) ((n) >= ED_POS_ELEMENT_TABS_FIRST && \
193 (n) <= ED_POS_ELEMENT_TABS_LAST)
194 #define IS_POS_ELEMENT_SETTINGS(n) ((n) >= ED_POS_ELEMENT_SETTINGS_FIRST && \
195 (n) <= ED_POS_ELEMENT_SETTINGS_LAST)
197 #define ED_LEVEL_TABS_LINE(n) ((n) - ED_POS_LEVEL_TABS_FIRST)
198 #define ED_LEVEL_SETTINGS_LINE(n) ((n) - ED_POS_LEVEL_SETTINGS_FIRST)
199 #define ED_ENGINE_TABS_LINE(n) ((n) - ED_POS_ENGINE_TABS_FIRST)
200 #define ED_ENGINE_SETTINGS_LINE(n) ((n) - ED_POS_ENGINE_SETTINGS_FIRST)
201 #define ED_ELEMENT_TABS_LINE(n) ((n) - ED_POS_ELEMENT_TABS_FIRST)
202 #define ED_ELEMENT_SETTINGS_LINE(n) ((n) - ED_POS_ELEMENT_SETTINGS_FIRST)
204 #define ED_LEVEL_TABS_X(n) (ED_LEVEL_TABS_XSTART + \
205 (n) * ED_SETTINGS_TABS_XOFFSET)
206 #define ED_LEVEL_TABS_Y(n) (ED_LEVEL_TABS_YSTART + \
207 (n) * ED_SETTINGS_TABS_YOFFSET)
209 #define ED_LEVEL_SETTINGS_X(n) (ED_LEVEL_SETTINGS_XSTART + \
210 (n) * ED_SETTINGS_XOFFSET)
211 #define ED_LEVEL_SETTINGS_Y(n) (ED_LEVEL_SETTINGS_YSTART + \
212 (n) * ED_SETTINGS_YOFFSET)
214 #define ED_ENGINE_TABS_X(n) (ED_ENGINE_TABS_XSTART + \
215 (n) * ED_SETTINGS_TABS_XOFFSET)
216 #define ED_ENGINE_TABS_Y(n) (ED_ENGINE_TABS_YSTART + \
217 (n) * ED_SETTINGS_TABS_YOFFSET)
219 #define ED_ENGINE_SETTINGS_X(n) (ED_ENGINE_SETTINGS_XSTART + \
220 (n) * ED_SETTINGS_XOFFSET)
221 #define ED_ENGINE_SETTINGS_Y(n) (ED_ENGINE_SETTINGS_YSTART + \
222 (n) * ED_SETTINGS_YOFFSET)
224 #define ED_ELEMENT_TABS_X(n) (ED_ELEMENT_TABS_XSTART + \
225 (n) * ED_SETTINGS_TABS_XOFFSET)
226 #define ED_ELEMENT_TABS_Y(n) (ED_ELEMENT_TABS_YSTART + \
227 (n) * ED_SETTINGS_TABS_YOFFSET)
229 #define ED_ELEMENT_SETTINGS_X(n) (ED_ELEMENT_SETTINGS_XSTART + \
230 (n) * ED_SETTINGS_XOFFSET)
231 #define ED_ELEMENT_SETTINGS_Y(n) (ED_ELEMENT_SETTINGS_YSTART + \
232 (n) * ED_SETTINGS_YOFFSET)
234 #define ED_POS_TO_LEVEL_TABS_X(n) \
235 (ED_LEVEL_TABS_X(ED_LEVEL_TABS_LINE(n)))
236 #define ED_POS_TO_LEVEL_TABS_Y(n) \
237 (ED_LEVEL_TABS_Y(ED_LEVEL_TABS_LINE(n)))
239 #define ED_POS_TO_LEVEL_SETTINGS_X(n) \
240 (ED_LEVEL_SETTINGS_X(ED_LEVEL_SETTINGS_LINE(n)))
241 #define ED_POS_TO_LEVEL_SETTINGS_Y(n) \
242 (ED_LEVEL_SETTINGS_Y(ED_LEVEL_SETTINGS_LINE(n)))
244 #define ED_POS_TO_ENGINE_TABS_X(n) \
245 (ED_ENGINE_TABS_X(ED_ENGINE_TABS_LINE(n)))
246 #define ED_POS_TO_ENGINE_TABS_Y(n) \
247 (ED_ENGINE_TABS_Y(ED_ENGINE_TABS_LINE(n)))
249 #define ED_POS_TO_ENGINE_SETTINGS_X(n) \
250 (ED_ENGINE_SETTINGS_X(ED_ENGINE_SETTINGS_LINE(n)))
251 #define ED_POS_TO_ENGINE_SETTINGS_Y(n) \
252 (ED_ENGINE_SETTINGS_Y(ED_ENGINE_SETTINGS_LINE(n)))
254 #define ED_POS_TO_ELEMENT_TABS_X(n) \
255 (ED_ELEMENT_TABS_X(ED_ELEMENT_TABS_LINE(n)))
256 #define ED_POS_TO_ELEMENT_TABS_Y(n) \
257 (ED_ELEMENT_TABS_Y(ED_ELEMENT_TABS_LINE(n)))
259 #define ED_POS_TO_ELEMENT_SETTINGS_X(n) \
260 (ED_ELEMENT_SETTINGS_X(ED_ELEMENT_SETTINGS_LINE(n)))
261 #define ED_POS_TO_ELEMENT_SETTINGS_Y(n) \
262 (ED_ELEMENT_SETTINGS_Y(ED_ELEMENT_SETTINGS_LINE(n)))
264 #define ED_SETTINGS_X(n) (IS_POS_LEVEL_TABS(n) ? \
265 ED_POS_TO_LEVEL_TABS_X(n) : \
266 IS_POS_LEVEL_SETTINGS(n) ? \
267 ED_POS_TO_LEVEL_SETTINGS_X(n) : \
268 IS_POS_ENGINE_TABS(n) ? \
269 ED_POS_TO_ENGINE_TABS_X(n) : \
270 IS_POS_ENGINE_SETTINGS(n) ? \
271 ED_POS_TO_ENGINE_SETTINGS_X(n) : \
272 IS_POS_ELEMENT_TABS(n) ? \
273 ED_POS_TO_ELEMENT_TABS_X(n) : \
274 IS_POS_ELEMENT_SETTINGS(n) ? \
275 ED_POS_TO_ELEMENT_SETTINGS_X(n) : (n))
276 #define ED_SETTINGS_Y(n) (IS_POS_LEVEL_TABS(n) ? \
277 ED_POS_TO_LEVEL_TABS_Y(n) : \
278 IS_POS_LEVEL_SETTINGS(n) ? \
279 ED_POS_TO_LEVEL_SETTINGS_Y(n) : \
280 IS_POS_ENGINE_TABS(n) ? \
281 ED_POS_TO_ENGINE_TABS_Y(n) : \
282 IS_POS_ENGINE_SETTINGS(n) ? \
283 ED_POS_TO_ENGINE_SETTINGS_Y(n) : \
284 IS_POS_ELEMENT_TABS(n) ? \
285 ED_POS_TO_ELEMENT_TABS_Y(n) : \
286 IS_POS_ELEMENT_SETTINGS(n) ? \
287 ED_POS_TO_ELEMENT_SETTINGS_Y(n) : (n))
289 #define ED_SETTINGS_XOFF(n) (5 * ((n) % 4) * \
290 ED_DRAWINGAREA_TILE_SIZE)
291 #define ED_SETTINGS_YOFF(n) (5 * ((n) / 4) * \
292 ED_DRAWINGAREA_TILE_SIZE)
294 #define ED_AREA_XOFFSET_1(n) ((n) != 0 ? \
295 ED_DRAWINGAREA_BORDER_SIZE : 0)
296 #define ED_AREA_YOFFSET_1(n) ((n) != 0 ? \
297 (ED_CHECKBUTTON_YSIZE - \
298 ED_DRAWINGAREA_TILE_SIZE) / 2 : 0)
300 #define ED_AREA_XOFFSET_2(n) (0)
301 #define ED_AREA_YOFFSET_2(n) ((n) == 3 ? \
302 ((n) - 1) * ED_DRAWINGAREA_TILE_SIZE / 2 : 0)
304 #define ED_AREA_SETTINGS_X(i) (ED_SETTINGS_X((i).x) + \
305 ED_SETTINGS_XOFF((i).xoffset) + \
306 ED_AREA_XOFFSET_1((i).x) - \
307 ED_AREA_XOFFSET_2((i).area_xsize))
308 #define ED_AREA_SETTINGS_Y(i) (ED_SETTINGS_Y((i).y) + \
309 ED_SETTINGS_YOFF((i).yoffset) + \
310 ED_AREA_YOFFSET_1((i).y) - \
311 ED_AREA_YOFFSET_2((i).area_ysize))
313 // values for element content drawing areas
314 #define ED_AREA_1X1_LSETTINGS_XPOS(n) ED_LEVEL_SETTINGS_XPOS(n)
315 #define ED_AREA_1X1_LSETTINGS_YPOS(n) ED_LEVEL_SETTINGS_YPOS(n)
316 #define ED_AREA_1X1_LSETTINGS_XOFF (0)
317 #define ED_AREA_1X1_LSETTINGS_YOFF (0)
319 #define ED_AREA_1X1_SETTINGS_XPOS(n) ED_ELEMENT_SETTINGS_XPOS(n)
320 #define ED_AREA_1X1_SETTINGS_YPOS(n) ED_ELEMENT_SETTINGS_YPOS(n)
321 #define ED_AREA_1X1_SETTINGS_XOFF (0)
322 #define ED_AREA_1X1_SETTINGS_YOFF (0)
324 #define ED_AREA_3X3_SETTINGS_XPOS(n) ED_ELEMENT_SETTINGS_XPOS(n)
325 #define ED_AREA_3X3_SETTINGS_YPOS(n) ED_ELEMENT_SETTINGS_YPOS(n)
326 #define ED_AREA_3X3_SETTINGS_XOFF (0)
327 #define ED_AREA_3X3_SETTINGS_YOFF (0)
330 #define ED_AREA_ELEMENT_CONTENT_XOFF(n) (n)
331 #define ED_AREA_ELEMENT_CONTENT_YOFF(n) (n)
334 #define ED_XPOS_YAM 0
335 #define ED_YPOS_YAM 5
336 #define ED_AREA_YAMYAM_CONTENT_XPOS ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_YAM)
337 #define ED_AREA_YAMYAM_CONTENT_YPOS ED_ELEMENT_SETTINGS_YPOS(ED_YPOS_YAM)
338 #define ED_AREA_YAMYAM_CONTENT_XOFF(n) ED_AREA_ELEMENT_CONTENT_XOFF(n)
339 #define ED_AREA_YAMYAM_CONTENT_YOFF(n) ED_AREA_ELEMENT_CONTENT_YOFF(n)
340 #define ED_AREA_YAMYAM_CONTENT_X(n) (ED_ELEMENT_SETTINGS_X(ED_XPOS_YAM) + \
342 #define ED_AREA_YAMYAM_CONTENT_Y(n) (ED_ELEMENT_SETTINGS_Y(ED_YPOS_YAM) + \
343 ED_SETTINGS_YOFF(n) + \
344 ED_AREA_YOFFSET_1(ED_YPOS_YAM) - \
345 ED_AREA_YOFFSET_2(3))
347 // magic ball content
348 #define ED_XPOS_BALL 0
349 #define ED_YPOS_BALL 6
350 #define ED_AREA_MAGIC_BALL_CONTENT_XPOS ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_BALL)
351 #define ED_AREA_MAGIC_BALL_CONTENT_YPOS ED_ELEMENT_SETTINGS_YPOS(ED_YPOS_BALL)
352 #define ED_AREA_MAGIC_BALL_CONTENT_XOFF(n) ED_AREA_ELEMENT_CONTENT_XOFF(n)
353 #define ED_AREA_MAGIC_BALL_CONTENT_YOFF(n) ED_AREA_ELEMENT_CONTENT_YOFF(n)
354 #define ED_AREA_MAGIC_BALL_CONTENT_X(n) (ED_ELEMENT_SETTINGS_X(ED_XPOS_BALL) + \
356 #define ED_AREA_MAGIC_BALL_CONTENT_Y(n) (ED_ELEMENT_SETTINGS_Y(ED_YPOS_BALL) + \
357 ED_SETTINGS_YOFF(n) + \
358 ED_AREA_YOFFSET_1(ED_YPOS_BALL) - \
359 ED_AREA_YOFFSET_2(3))
361 // values for scrolling gadgets for drawing area
362 #define ED_SCROLLBUTTON_XSIZE (graphic_info[IMG_EDITOR_PLAYFIELD_SCROLLBAR].width)
363 #define ED_SCROLLBUTTON_YSIZE (graphic_info[IMG_EDITOR_PLAYFIELD_SCROLLBAR].height)
365 #define ED_SCROLL_UP_XPOS (SXSIZE - ED_SCROLLBUTTON_XSIZE)
366 #define ED_SCROLL_UP_YPOS (0)
367 #define ED_SCROLL_DOWN_XPOS ED_SCROLL_UP_XPOS
368 #define ED_SCROLL_DOWN_YPOS (SYSIZE - 3 * ED_SCROLLBUTTON_YSIZE)
369 #define ED_SCROLL_LEFT_XPOS (0)
370 #define ED_SCROLL_LEFT_YPOS (SYSIZE - 2 * ED_SCROLLBUTTON_YSIZE)
371 #define ED_SCROLL_RIGHT_XPOS (SXSIZE - 2 * ED_SCROLLBUTTON_XSIZE)
372 #define ED_SCROLL_RIGHT_YPOS ED_SCROLL_LEFT_YPOS
373 #define ED_SCROLL_HORIZONTAL_XPOS (ED_SCROLL_LEFT_XPOS + \
374 ED_SCROLLBUTTON_XSIZE)
375 #define ED_SCROLL_HORIZONTAL_YPOS ED_SCROLL_LEFT_YPOS
376 #define ED_SCROLL_HORIZONTAL_XSIZE (SXSIZE - 3 * ED_SCROLLBUTTON_XSIZE)
377 #define ED_SCROLL_HORIZONTAL_YSIZE ED_SCROLLBUTTON_YSIZE
378 #define ED_SCROLL_VERTICAL_XPOS ED_SCROLL_UP_XPOS
379 #define ED_SCROLL_VERTICAL_YPOS (ED_SCROLL_UP_YPOS + \
380 ED_SCROLLBUTTON_YSIZE)
381 #define ED_SCROLL_VERTICAL_XSIZE ED_SCROLLBUTTON_XSIZE
382 #define ED_SCROLL_VERTICAL_YSIZE (SYSIZE - 4 * ED_SCROLLBUTTON_YSIZE)
384 // values for scrolling gadgets for element list
385 #define ED_SCROLLBUTTON2_XSIZE (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].width)
386 #define ED_SCROLLBUTTON2_YSIZE (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].height)
388 #define ED_SCROLL2_UP_XPOS (ED_ELEMENTLIST_XPOS + \
389 ED_ELEMENTLIST_BUTTONS_HORIZ * \
390 ED_ELEMENTLIST_XSIZE)
391 #define ED_SCROLL2_UP_YPOS ED_ELEMENTLIST_YPOS
392 #define ED_SCROLL2_DOWN_XPOS ED_SCROLL2_UP_XPOS
393 #define ED_SCROLL2_DOWN_YPOS (ED_SCROLL2_UP_YPOS + \
394 ED_ELEMENTLIST_BUTTONS_VERT * \
395 ED_ELEMENTLIST_YSIZE - \
396 ED_SCROLLBUTTON2_YSIZE)
397 #define ED_SCROLL2_VERTICAL_XPOS ED_SCROLL2_UP_XPOS
398 #define ED_SCROLL2_VERTICAL_YPOS (ED_SCROLL2_UP_YPOS + \
399 ED_SCROLLBUTTON2_YSIZE)
400 #define ED_SCROLL2_VERTICAL_XSIZE ED_SCROLLBUTTON2_XSIZE
401 #define ED_SCROLL2_VERTICAL_YSIZE (ED_ELEMENTLIST_BUTTONS_VERT * \
402 ED_ELEMENTLIST_YSIZE - \
403 2 * ED_SCROLLBUTTON2_YSIZE)
405 // values for ClearEditorGadgetInfoText() and HandleEditorGadgetInfoText()
406 #define INFOTEXT_FONT FONT_TEXT_2
407 #define INFOTEXT_XSIZE SXSIZE
408 #define INFOTEXT_YSIZE getFontHeight(INFOTEXT_FONT)
409 #define INFOTEXT_YSIZE_FULL (INFOTEXT_YSIZE + ED_GADGET_SMALL_DISTANCE)
410 #define INFOTEXT_X (editor.settings.tooltip.x)
411 #define INFOTEXT_Y (editor.settings.tooltip.y)
412 #define INFOTEXT_XY_REDEFINED (INFOTEXT_X != -1 || INFOTEXT_Y != -1)
413 #define INFOTEXT_XPOS SX + (INFOTEXT_XY_REDEFINED ? INFOTEXT_X : 0)
414 #define INFOTEXT_YPOS SY + (INFOTEXT_XY_REDEFINED ? INFOTEXT_Y : \
415 SYSIZE - INFOTEXT_YSIZE)
418 // ----------------------------------------------------------------------------
419 // editor gadget definitions
420 // ----------------------------------------------------------------------------
426 // drawing toolbox buttons
428 GADGET_ID_SINGLE_ITEMS,
429 GADGET_ID_CONNECTED_ITEMS,
433 GADGET_ID_FILLED_BOX,
436 GADGET_ID_FLOOD_FILL,
439 GADGET_ID_WRAP_RIGHT,
440 GADGET_ID_RANDOM_PLACEMENT,
441 GADGET_ID_GRAB_BRUSH,
443 GADGET_ID_PICK_ELEMENT,
452 GADGET_ID_CUSTOM_COPY_FROM,
453 GADGET_ID_CUSTOM_COPY_TO,
454 GADGET_ID_CUSTOM_EXCHANGE,
455 GADGET_ID_CUSTOM_COPY,
456 GADGET_ID_CUSTOM_PASTE,
458 GADGET_ID_PROPERTIES,
459 GADGET_ID_ELEMENT_LEFT,
460 GADGET_ID_ELEMENT_MIDDLE,
461 GADGET_ID_ELEMENT_RIGHT,
464 // counter gadget identifiers
466 GADGET_ID_SELECT_LEVEL_DOWN,
467 GADGET_ID_SELECT_LEVEL_TEXT,
468 GADGET_ID_SELECT_LEVEL_UP,
469 GADGET_ID_LEVEL_XSIZE_DOWN,
470 GADGET_ID_LEVEL_XSIZE_TEXT,
471 GADGET_ID_LEVEL_XSIZE_UP,
472 GADGET_ID_LEVEL_YSIZE_DOWN,
473 GADGET_ID_LEVEL_YSIZE_TEXT,
474 GADGET_ID_LEVEL_YSIZE_UP,
475 GADGET_ID_LEVEL_RANDOM_DOWN,
476 GADGET_ID_LEVEL_RANDOM_TEXT,
477 GADGET_ID_LEVEL_RANDOM_UP,
478 GADGET_ID_LEVEL_GEMSLIMIT_DOWN,
479 GADGET_ID_LEVEL_GEMSLIMIT_TEXT,
480 GADGET_ID_LEVEL_GEMSLIMIT_UP,
481 GADGET_ID_LEVEL_TIMELIMIT_DOWN,
482 GADGET_ID_LEVEL_TIMELIMIT_TEXT,
483 GADGET_ID_LEVEL_TIMELIMIT_UP,
484 GADGET_ID_LEVEL_TIMESCORE_DOWN,
485 GADGET_ID_LEVEL_TIMESCORE_TEXT,
486 GADGET_ID_LEVEL_TIMESCORE_UP,
487 GADGET_ID_LEVEL_RANDOM_SEED_DOWN,
488 GADGET_ID_LEVEL_RANDOM_SEED_TEXT,
489 GADGET_ID_LEVEL_RANDOM_SEED_UP,
490 GADGET_ID_LEVELSET_NUM_LEVELS_DOWN,
491 GADGET_ID_LEVELSET_NUM_LEVELS_TEXT,
492 GADGET_ID_LEVELSET_NUM_LEVELS_UP,
493 GADGET_ID_BD_CYCLE_DELAY_MS_DOWN,
494 GADGET_ID_BD_CYCLE_DELAY_MS_TEXT,
495 GADGET_ID_BD_CYCLE_DELAY_MS_UP,
496 GADGET_ID_BD_CYCLE_DELAY_C64_DOWN,
497 GADGET_ID_BD_CYCLE_DELAY_C64_TEXT,
498 GADGET_ID_BD_CYCLE_DELAY_C64_UP,
499 GADGET_ID_BD_HATCHING_DELAY_CYCLES_DOWN,
500 GADGET_ID_BD_HATCHING_DELAY_CYCLES_TEXT,
501 GADGET_ID_BD_HATCHING_DELAY_CYCLES_UP,
502 GADGET_ID_BD_HATCHING_DELAY_SECONDS_DOWN,
503 GADGET_ID_BD_HATCHING_DELAY_SECONDS_TEXT,
504 GADGET_ID_BD_HATCHING_DELAY_SECONDS_UP,
505 GADGET_ID_BD_PUSHING_PROB_DOWN,
506 GADGET_ID_BD_PUSHING_PROB_TEXT,
507 GADGET_ID_BD_PUSHING_PROB_UP,
508 GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_DOWN,
509 GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_TEXT,
510 GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_UP,
511 GADGET_ID_ELEMENT_VALUE1_DOWN,
512 GADGET_ID_ELEMENT_VALUE1_TEXT,
513 GADGET_ID_ELEMENT_VALUE1_UP,
514 GADGET_ID_ELEMENT_VALUE2_DOWN,
515 GADGET_ID_ELEMENT_VALUE2_TEXT,
516 GADGET_ID_ELEMENT_VALUE2_UP,
517 GADGET_ID_ELEMENT_VALUE3_DOWN,
518 GADGET_ID_ELEMENT_VALUE3_TEXT,
519 GADGET_ID_ELEMENT_VALUE3_UP,
520 GADGET_ID_ELEMENT_VALUE4_DOWN,
521 GADGET_ID_ELEMENT_VALUE4_TEXT,
522 GADGET_ID_ELEMENT_VALUE4_UP,
523 GADGET_ID_YAMYAM_CONTENT_DOWN,
524 GADGET_ID_YAMYAM_CONTENT_TEXT,
525 GADGET_ID_YAMYAM_CONTENT_UP,
526 GADGET_ID_BALL_CONTENT_DOWN,
527 GADGET_ID_BALL_CONTENT_TEXT,
528 GADGET_ID_BALL_CONTENT_UP,
529 GADGET_ID_ANDROID_CONTENT_DOWN,
530 GADGET_ID_ANDROID_CONTENT_TEXT,
531 GADGET_ID_ANDROID_CONTENT_UP,
532 GADGET_ID_ENVELOPE_XSIZE_DOWN,
533 GADGET_ID_ENVELOPE_XSIZE_TEXT,
534 GADGET_ID_ENVELOPE_XSIZE_UP,
535 GADGET_ID_ENVELOPE_YSIZE_DOWN,
536 GADGET_ID_ENVELOPE_YSIZE_TEXT,
537 GADGET_ID_ENVELOPE_YSIZE_UP,
538 GADGET_ID_INVENTORY_SIZE_DOWN,
539 GADGET_ID_INVENTORY_SIZE_TEXT,
540 GADGET_ID_INVENTORY_SIZE_UP,
541 GADGET_ID_MM_BALL_CONTENT_DOWN,
542 GADGET_ID_MM_BALL_CONTENT_TEXT,
543 GADGET_ID_MM_BALL_CONTENT_UP,
544 GADGET_ID_CUSTOM_SCORE_DOWN,
545 GADGET_ID_CUSTOM_SCORE_TEXT,
546 GADGET_ID_CUSTOM_SCORE_UP,
547 GADGET_ID_CUSTOM_GEMCOUNT_DOWN,
548 GADGET_ID_CUSTOM_GEMCOUNT_TEXT,
549 GADGET_ID_CUSTOM_GEMCOUNT_UP,
550 GADGET_ID_CUSTOM_VALUE_FIX_DOWN,
551 GADGET_ID_CUSTOM_VALUE_FIX_TEXT,
552 GADGET_ID_CUSTOM_VALUE_FIX_UP,
553 GADGET_ID_CUSTOM_VALUE_RND_DOWN,
554 GADGET_ID_CUSTOM_VALUE_RND_TEXT,
555 GADGET_ID_CUSTOM_VALUE_RND_UP,
556 GADGET_ID_PUSH_DELAY_FIX_DOWN,
557 GADGET_ID_PUSH_DELAY_FIX_TEXT,
558 GADGET_ID_PUSH_DELAY_FIX_UP,
559 GADGET_ID_PUSH_DELAY_RND_DOWN,
560 GADGET_ID_PUSH_DELAY_RND_TEXT,
561 GADGET_ID_PUSH_DELAY_RND_UP,
562 GADGET_ID_DROP_DELAY_FIX_DOWN,
563 GADGET_ID_DROP_DELAY_FIX_TEXT,
564 GADGET_ID_DROP_DELAY_FIX_UP,
565 GADGET_ID_DROP_DELAY_RND_DOWN,
566 GADGET_ID_DROP_DELAY_RND_TEXT,
567 GADGET_ID_DROP_DELAY_RND_UP,
568 GADGET_ID_MOVE_DELAY_FIX_DOWN,
569 GADGET_ID_MOVE_DELAY_FIX_TEXT,
570 GADGET_ID_MOVE_DELAY_FIX_UP,
571 GADGET_ID_MOVE_DELAY_RND_DOWN,
572 GADGET_ID_MOVE_DELAY_RND_TEXT,
573 GADGET_ID_MOVE_DELAY_RND_UP,
574 GADGET_ID_STEP_DELAY_FIX_DOWN,
575 GADGET_ID_STEP_DELAY_FIX_TEXT,
576 GADGET_ID_STEP_DELAY_FIX_UP,
577 GADGET_ID_STEP_DELAY_RND_DOWN,
578 GADGET_ID_STEP_DELAY_RND_TEXT,
579 GADGET_ID_STEP_DELAY_RND_UP,
580 GADGET_ID_EXPLOSION_DELAY_DOWN,
581 GADGET_ID_EXPLOSION_DELAY_TEXT,
582 GADGET_ID_EXPLOSION_DELAY_UP,
583 GADGET_ID_IGNITION_DELAY_DOWN,
584 GADGET_ID_IGNITION_DELAY_TEXT,
585 GADGET_ID_IGNITION_DELAY_UP,
586 GADGET_ID_CHANGE_DELAY_FIX_DOWN,
587 GADGET_ID_CHANGE_DELAY_FIX_TEXT,
588 GADGET_ID_CHANGE_DELAY_FIX_UP,
589 GADGET_ID_CHANGE_DELAY_RND_DOWN,
590 GADGET_ID_CHANGE_DELAY_RND_TEXT,
591 GADGET_ID_CHANGE_DELAY_RND_UP,
592 GADGET_ID_CHANGE_CONT_RND_DOWN,
593 GADGET_ID_CHANGE_CONT_RND_TEXT,
594 GADGET_ID_CHANGE_CONT_RND_UP,
595 GADGET_ID_GROUP_CONTENT_DOWN,
596 GADGET_ID_GROUP_CONTENT_TEXT,
597 GADGET_ID_GROUP_CONTENT_UP,
599 // drawing area identifiers
601 GADGET_ID_DRAWING_LEVEL,
602 GADGET_ID_YAMYAM_CONTENT_0,
603 GADGET_ID_YAMYAM_CONTENT_1,
604 GADGET_ID_YAMYAM_CONTENT_2,
605 GADGET_ID_YAMYAM_CONTENT_3,
606 GADGET_ID_YAMYAM_CONTENT_4,
607 GADGET_ID_YAMYAM_CONTENT_5,
608 GADGET_ID_YAMYAM_CONTENT_6,
609 GADGET_ID_YAMYAM_CONTENT_7,
610 GADGET_ID_MAGIC_BALL_CONTENT_0,
611 GADGET_ID_MAGIC_BALL_CONTENT_1,
612 GADGET_ID_MAGIC_BALL_CONTENT_2,
613 GADGET_ID_MAGIC_BALL_CONTENT_3,
614 GADGET_ID_MAGIC_BALL_CONTENT_4,
615 GADGET_ID_MAGIC_BALL_CONTENT_5,
616 GADGET_ID_MAGIC_BALL_CONTENT_6,
617 GADGET_ID_MAGIC_BALL_CONTENT_7,
618 GADGET_ID_ANDROID_CONTENT,
619 GADGET_ID_AMOEBA_CONTENT,
620 GADGET_ID_BD_SNAP_ELEMENT,
621 GADGET_ID_BD_MAGIC_WALL_DIAMOND_TO,
622 GADGET_ID_BD_MAGIC_WALL_ROCK_TO,
623 GADGET_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
624 GADGET_ID_BD_MAGIC_WALL_NUT_TO,
625 GADGET_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
626 GADGET_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
627 GADGET_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
628 GADGET_ID_BD_AMOEBA_CONTENT_TOO_BIG,
629 GADGET_ID_BD_AMOEBA_CONTENT_ENCLOSED,
630 GADGET_ID_BD_AMOEBA_2_CONTENT_TOO_BIG,
631 GADGET_ID_BD_AMOEBA_2_CONTENT_ENCLOSED,
632 GADGET_ID_BD_AMOEBA_2_CONTENT_EXPLODING,
633 GADGET_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE,
634 GADGET_ID_BD_SLIME_EATS_ELEMENT_1,
635 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
636 GADGET_ID_BD_SLIME_EATS_ELEMENT_2,
637 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
638 GADGET_ID_BD_SLIME_EATS_ELEMENT_3,
639 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
640 GADGET_ID_BD_ACID_EATS_ELEMENT,
641 GADGET_ID_BD_ACID_TURNS_TO_ELEMENT,
642 GADGET_ID_BD_BITER_EATS_ELEMENT,
643 GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
644 GADGET_ID_BD_NUT_CONTENT,
645 GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
646 GADGET_ID_BD_SAND_LOOKS_LIKE,
647 GADGET_ID_BD_ROCK_TURNS_TO_ON_FALLING,
648 GADGET_ID_BD_ROCK_TURNS_TO_ON_IMPACT,
649 GADGET_ID_BD_DIAMOND_TURNS_TO_ON_FALLING,
650 GADGET_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT,
651 GADGET_ID_BD_FIREFLY_EXPLODES_TO,
652 GADGET_ID_BD_FIREFLY_2_EXPLODES_TO,
653 GADGET_ID_BD_BUTTERFLY_EXPLODES_TO,
654 GADGET_ID_BD_BUTTERFLY_2_EXPLODES_TO,
655 GADGET_ID_BD_STONEFLY_EXPLODES_TO,
656 GADGET_ID_BD_DRAGONFLY_EXPLODES_TO,
657 GADGET_ID_BD_DIAMOND_BIRTH_TURNS_TO,
658 GADGET_ID_BD_BOMB_EXPLOSION_TURNS_TO,
659 GADGET_ID_BD_NITRO_EXPLOSION_TURNS_TO,
660 GADGET_ID_BD_EXPLOSION_TURNS_TO,
661 GADGET_ID_START_ELEMENT,
662 GADGET_ID_ARTWORK_ELEMENT,
663 GADGET_ID_EXPLOSION_ELEMENT,
664 GADGET_ID_INVENTORY_CONTENT,
665 GADGET_ID_MM_BALL_CONTENT,
666 GADGET_ID_CUSTOM_GRAPHIC,
667 GADGET_ID_CUSTOM_CONTENT,
668 GADGET_ID_CUSTOM_MOVE_ENTER,
669 GADGET_ID_CUSTOM_MOVE_LEAVE,
670 GADGET_ID_CUSTOM_CHANGE_TARGET,
671 GADGET_ID_CUSTOM_CHANGE_CONTENT,
672 GADGET_ID_CUSTOM_CHANGE_TRIGGER,
673 GADGET_ID_CUSTOM_CHANGE_ACTION,
674 GADGET_ID_GROUP_CONTENT,
675 GADGET_ID_RANDOM_BACKGROUND,
677 // text input identifiers
679 GADGET_ID_LEVEL_NAME,
680 GADGET_ID_LEVEL_AUTHOR,
681 GADGET_ID_LEVELSET_NAME,
682 GADGET_ID_LEVELSET_AUTHOR,
683 GADGET_ID_BD_COLOR_TEXT_B,
684 GADGET_ID_BD_COLOR_TEXT_0,
685 GADGET_ID_BD_COLOR_TEXT_1,
686 GADGET_ID_BD_COLOR_TEXT_2,
687 GADGET_ID_BD_COLOR_TEXT_3,
688 GADGET_ID_BD_COLOR_TEXT_4,
689 GADGET_ID_BD_COLOR_TEXT_5,
690 GADGET_ID_ELEMENT_NAME,
692 // text area identifiers
694 GADGET_ID_ENVELOPE_INFO,
696 // selectbox identifiers
698 GADGET_ID_TIME_OR_STEPS,
699 GADGET_ID_TIME_SCORE_BASE,
700 GADGET_ID_GAME_ENGINE_TYPE,
701 GADGET_ID_LEVELSET_SAVE_MODE,
702 GADGET_ID_BD_SCHEDULING_TYPE,
703 GADGET_ID_BD_COLOR_TYPE,
704 GADGET_ID_BD_COLOR_C64_B,
705 GADGET_ID_BD_COLOR_C64_0,
706 GADGET_ID_BD_COLOR_C64_1,
707 GADGET_ID_BD_COLOR_C64_2,
708 GADGET_ID_BD_COLOR_C64_3,
709 GADGET_ID_BD_COLOR_C64_4,
710 GADGET_ID_BD_COLOR_C64_5,
711 GADGET_ID_WIND_DIRECTION,
712 GADGET_ID_PLAYER_SPEED,
713 GADGET_ID_BD_GRAVITY_DIRECTION,
714 GADGET_ID_MM_BALL_CHOICE_MODE,
715 GADGET_ID_CUSTOM_WALK_TO_ACTION,
716 GADGET_ID_CUSTOM_EXPLOSION_TYPE,
717 GADGET_ID_CUSTOM_DEADLINESS,
718 GADGET_ID_CUSTOM_MOVE_PATTERN,
719 GADGET_ID_CUSTOM_MOVE_DIRECTION,
720 GADGET_ID_CUSTOM_MOVE_STEPSIZE,
721 GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,
722 GADGET_ID_CUSTOM_SMASH_TARGETS,
723 GADGET_ID_CUSTOM_SLIPPERY_TYPE,
724 GADGET_ID_CUSTOM_ACCESS_TYPE,
725 GADGET_ID_CUSTOM_ACCESS_LAYER,
726 GADGET_ID_CUSTOM_ACCESS_PROTECTED,
727 GADGET_ID_CUSTOM_ACCESS_DIRECTION,
728 GADGET_ID_CHANGE_TIME_UNITS,
729 GADGET_ID_CHANGE_DIRECT_ACTION,
730 GADGET_ID_CHANGE_OTHER_ACTION,
731 GADGET_ID_CHANGE_SIDE,
732 GADGET_ID_CHANGE_PLAYER,
733 GADGET_ID_CHANGE_PAGE,
734 GADGET_ID_CHANGE_REPLACE_WHEN,
735 GADGET_ID_ACTION_TYPE,
736 GADGET_ID_ACTION_MODE,
737 GADGET_ID_ACTION_ARG,
738 GADGET_ID_SELECT_CHANGE_PAGE,
739 GADGET_ID_GROUP_CHOICE_MODE,
741 // textbutton identifiers
743 GADGET_ID_LEVELCONFIG_LEVEL,
744 GADGET_ID_LEVELCONFIG_LEVELSET,
745 GADGET_ID_LEVELCONFIG_EDITOR,
746 GADGET_ID_LEVELCONFIG_ENGINE,
747 GADGET_ID_ENGINECONFIG_CONFIG,
748 GADGET_ID_ENGINECONFIG_COLORS,
749 GADGET_ID_PROPERTIES_INFO,
750 GADGET_ID_PROPERTIES_CONFIG,
751 GADGET_ID_PROPERTIES_CONFIG_1,
752 GADGET_ID_PROPERTIES_CONFIG_2,
753 GADGET_ID_PROPERTIES_CHANGE,
754 GADGET_ID_SAVE_AS_TEMPLATE_1,
755 GADGET_ID_SAVE_AS_TEMPLATE_2,
756 GADGET_ID_SAVE_LEVELSET,
757 GADGET_ID_ADD_CHANGE_PAGE,
758 GADGET_ID_DEL_CHANGE_PAGE,
759 GADGET_ID_BD_SET_RANDOM_COLORS,
761 // graphicbutton identifiers
763 GADGET_ID_PREV_CHANGE_PAGE,
764 GADGET_ID_NEXT_CHANGE_PAGE,
765 GADGET_ID_COPY_CHANGE_PAGE,
766 GADGET_ID_PASTE_CHANGE_PAGE,
768 // gadgets for scrolling of drawing area
771 GADGET_ID_SCROLL_DOWN,
772 GADGET_ID_SCROLL_LEFT,
773 GADGET_ID_SCROLL_RIGHT,
774 GADGET_ID_SCROLL_HORIZONTAL,
775 GADGET_ID_SCROLL_VERTICAL,
777 // gadgets for scrolling element list
779 GADGET_ID_SCROLL_LIST_UP,
780 GADGET_ID_SCROLL_LIST_DOWN,
781 GADGET_ID_SCROLL_LIST_VERTICAL,
783 // checkbuttons/radiobuttons for level/element properties
785 GADGET_ID_AUTO_COUNT_GEMS,
786 GADGET_ID_RATE_TIME_OVER_SCORE,
787 GADGET_ID_USE_LEVELSET_ARTWORK,
788 GADGET_ID_COPY_LEVEL_TEMPLATE,
789 GADGET_ID_RANDOM_PERCENTAGE,
790 GADGET_ID_RANDOM_QUANTITY,
791 GADGET_ID_RANDOM_RESTRICTED,
792 GADGET_ID_BD_INTERMISSION,
793 GADGET_ID_BD_PAL_TIMING,
794 GADGET_ID_BD_LINE_SHIFTING_BORDERS,
795 GADGET_ID_BD_SCAN_FIRST_AND_LAST_ROW,
796 GADGET_ID_BD_SHORT_EXPLOSIONS,
797 GADGET_ID_STICK_ELEMENT,
798 GADGET_ID_EM_SLIPPERY_GEMS,
799 GADGET_ID_EM_EXPLODES_BY_FIRE,
800 GADGET_ID_USE_SPRING_BUG,
801 GADGET_ID_USE_TIME_ORB_BUG,
802 GADGET_ID_USE_LIFE_BUGS,
803 GADGET_ID_RANDOM_BALL_CONTENT,
804 GADGET_ID_INITIAL_BALL_ACTIVE,
805 GADGET_ID_GROW_INTO_DIGGABLE,
806 GADGET_ID_SB_FIELDS_NEEDED,
807 GADGET_ID_SB_OBJECTS_NEEDED,
808 GADGET_ID_AUTO_EXIT_SOKOBAN,
809 GADGET_ID_SOLVED_BY_ONE_PLAYER,
810 GADGET_ID_FINISH_DIG_COLLECT,
811 GADGET_ID_KEEP_WALKABLE_CE,
812 GADGET_ID_CONTINUOUS_SNAPPING,
813 GADGET_ID_BLOCK_SNAP_FIELD,
814 GADGET_ID_BLOCK_LAST_FIELD,
815 GADGET_ID_SP_BLOCK_LAST_FIELD,
816 GADGET_ID_INSTANT_RELOCATION,
817 GADGET_ID_SHIFTED_RELOCATION,
818 GADGET_ID_LAZY_RELOCATION,
819 GADGET_ID_USE_START_ELEMENT,
820 GADGET_ID_USE_ARTWORK_ELEMENT,
821 GADGET_ID_USE_EXPLOSION_ELEMENT,
822 GADGET_ID_INITIAL_GRAVITY,
823 GADGET_ID_USE_INITIAL_INVENTORY,
824 GADGET_ID_CAN_PASS_TO_WALKABLE,
825 GADGET_ID_CAN_FALL_INTO_ACID,
826 GADGET_ID_CAN_MOVE_INTO_ACID,
827 GADGET_ID_DONT_COLLIDE_WITH,
828 GADGET_ID_BD_DIAGONAL_MOVEMENTS,
829 GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE,
830 GADGET_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
831 GADGET_ID_BD_MAGIC_WALL_ZERO_INFINITE,
832 GADGET_ID_BD_MAGIC_WALL_WAIT_HATCHING,
833 GADGET_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
834 GADGET_ID_BD_MAGIC_WALL_BREAK_SCAN,
835 GADGET_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
836 GADGET_ID_BD_AMOEBA_START_IMMEDIATELY,
837 GADGET_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA,
838 GADGET_ID_BD_VOODOO_COLLECTS_DIAMONDS,
839 GADGET_ID_BD_VOODOO_HURT_KILLS_PLAYER,
840 GADGET_ID_BD_VOODOO_DIES_BY_ROCK,
841 GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
842 GADGET_ID_BD_SLIME_IS_PREDICTABLE,
843 GADGET_ID_BD_CHANGE_EXPANDING_WALL,
844 GADGET_ID_BD_REPLICATORS_ACTIVE,
845 GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE,
846 GADGET_ID_BD_CONVEYOR_BELTS_CHANGED,
847 GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN,
848 GADGET_ID_BD_HAMMER_WALLS_REAPPEAR,
849 GADGET_ID_BD_INFINITE_ROCKETS,
850 GADGET_ID_BD_CREATURES_START_BACKWARDS,
851 GADGET_ID_BD_CREATURES_TURN_ON_HATCHING,
852 GADGET_ID_BD_GRAVITY_SWITCH_ACTIVE,
853 GADGET_ID_BD_GRAVITY_AFFECTS_ALL,
854 GADGET_ID_ENVELOPE_AUTOWRAP,
855 GADGET_ID_ENVELOPE_CENTERED,
856 GADGET_ID_MM_LASER_RED,
857 GADGET_ID_MM_LASER_GREEN,
858 GADGET_ID_MM_LASER_BLUE,
859 GADGET_ID_DF_LASER_RED,
860 GADGET_ID_DF_LASER_GREEN,
861 GADGET_ID_DF_LASER_BLUE,
862 GADGET_ID_ROTATE_MM_BALL_CONTENT,
863 GADGET_ID_EXPLODE_MM_BALL,
864 GADGET_ID_CUSTOM_INDESTRUCTIBLE,
865 GADGET_ID_CUSTOM_CAN_EXPLODE,
866 GADGET_ID_CUSTOM_EXPLODE_FIRE,
867 GADGET_ID_CUSTOM_EXPLODE_SMASH,
868 GADGET_ID_CUSTOM_EXPLODE_IMPACT,
869 GADGET_ID_CUSTOM_WALK_TO_OBJECT,
870 GADGET_ID_CUSTOM_DEADLY,
871 GADGET_ID_CUSTOM_CAN_MOVE,
872 GADGET_ID_CUSTOM_CAN_FALL,
873 GADGET_ID_CUSTOM_CAN_SMASH,
874 GADGET_ID_CUSTOM_SLIPPERY,
875 GADGET_ID_CUSTOM_ACCESSIBLE,
876 GADGET_ID_CUSTOM_GRAV_REACHABLE,
877 GADGET_ID_CUSTOM_USE_LAST_VALUE,
878 GADGET_ID_CUSTOM_USE_GRAPHIC,
879 GADGET_ID_CUSTOM_USE_TEMPLATE_1,
880 GADGET_ID_CUSTOM_USE_TEMPLATE_2,
881 GADGET_ID_CUSTOM_USE_TEMPLATE_3,
882 GADGET_ID_CUSTOM_CAN_CHANGE,
883 GADGET_ID_CHANGE_USE_CONTENT,
884 GADGET_ID_CHANGE_USE_EXPLOSION,
885 GADGET_ID_CHANGE_ONLY_COMPLETE,
886 GADGET_ID_CHANGE_USE_RANDOM,
887 GADGET_ID_CHANGE_HAS_ACTION,
888 GADGET_ID_CHANGE_DELAY,
889 GADGET_ID_CHANGE_BY_DIRECT_ACT,
890 GADGET_ID_CHANGE_BY_OTHER_ACT,
892 NUM_STATIC_GADGET_IDS
895 // gadgets for buttons in element list (dynamic)
896 #define GADGET_ID_ELEMENTLIST_FIRST (NUM_STATIC_GADGET_IDS)
897 #define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
898 ED_NUM_ELEMENTLIST_BUTTONS - 1)
900 #define NUM_EDITOR_GADGETS (GADGET_ID_ELEMENTLIST_LAST + 1)
902 // radio button numbers
906 RADIO_NR_DRAWING_TOOLBOX,
907 RADIO_NR_RANDOM_ELEMENTS
910 // values for counter gadgets
913 ED_COUNTER_ID_SELECT_LEVEL,
914 ED_COUNTER_ID_LEVEL_XSIZE,
915 ED_COUNTER_ID_LEVEL_YSIZE,
916 ED_COUNTER_ID_LEVEL_GEMSLIMIT,
917 ED_COUNTER_ID_LEVEL_TIMELIMIT,
918 ED_COUNTER_ID_LEVEL_TIMESCORE,
919 ED_COUNTER_ID_LEVEL_RANDOM_SEED,
920 ED_COUNTER_ID_LEVELSET_NUM_LEVELS,
921 ED_COUNTER_ID_LEVEL_RANDOM,
922 ED_COUNTER_ID_BD_CYCLE_DELAY_MS,
923 ED_COUNTER_ID_BD_CYCLE_DELAY_C64,
924 ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES,
925 ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS,
926 ED_COUNTER_ID_BD_PUSHING_PROB,
927 ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET,
928 ED_COUNTER_ID_ELEMENT_VALUE1,
929 ED_COUNTER_ID_ELEMENT_VALUE2,
930 ED_COUNTER_ID_ELEMENT_VALUE3,
931 ED_COUNTER_ID_ELEMENT_VALUE4,
932 ED_COUNTER_ID_YAMYAM_CONTENT,
933 ED_COUNTER_ID_BALL_CONTENT,
934 ED_COUNTER_ID_ANDROID_CONTENT,
935 ED_COUNTER_ID_ENVELOPE_XSIZE,
936 ED_COUNTER_ID_ENVELOPE_YSIZE,
937 ED_COUNTER_ID_INVENTORY_SIZE,
938 ED_COUNTER_ID_MM_BALL_CONTENT,
939 ED_COUNTER_ID_CUSTOM_SCORE,
940 ED_COUNTER_ID_CUSTOM_GEMCOUNT,
941 ED_COUNTER_ID_CUSTOM_VALUE_FIX,
942 ED_COUNTER_ID_CUSTOM_VALUE_RND,
943 ED_COUNTER_ID_PUSH_DELAY_FIX,
944 ED_COUNTER_ID_PUSH_DELAY_RND,
945 ED_COUNTER_ID_DROP_DELAY_FIX,
946 ED_COUNTER_ID_DROP_DELAY_RND,
947 ED_COUNTER_ID_MOVE_DELAY_FIX,
948 ED_COUNTER_ID_MOVE_DELAY_RND,
949 ED_COUNTER_ID_STEP_DELAY_FIX,
950 ED_COUNTER_ID_STEP_DELAY_RND,
951 ED_COUNTER_ID_EXPLOSION_DELAY,
952 ED_COUNTER_ID_IGNITION_DELAY,
953 ED_COUNTER_ID_GROUP_CONTENT,
954 ED_COUNTER_ID_CHANGE_DELAY_FIX,
955 ED_COUNTER_ID_CHANGE_DELAY_RND,
956 ED_COUNTER_ID_CHANGE_CONT_RND,
958 ED_NUM_COUNTERBUTTONS
961 #define ED_COUNTER_ID_LEVEL_FIRST ED_COUNTER_ID_LEVEL_XSIZE
962 #define ED_COUNTER_ID_LEVEL_LAST ED_COUNTER_ID_LEVEL_RANDOM_SEED
963 #define ED_COUNTER_ID_LEVELSET_FIRST ED_COUNTER_ID_LEVELSET_NUM_LEVELS
964 #define ED_COUNTER_ID_LEVELSET_LAST ED_COUNTER_ID_LEVELSET_NUM_LEVELS
965 #define ED_COUNTER_ID_EDITOR_FIRST ED_COUNTER_ID_LEVEL_RANDOM
966 #define ED_COUNTER_ID_EDITOR_LAST ED_COUNTER_ID_LEVEL_RANDOM
968 #define ED_COUNTER_ID_CUSTOM1_FIRST ED_COUNTER_ID_CUSTOM_SCORE
969 #define ED_COUNTER_ID_CUSTOM1_LAST ED_COUNTER_ID_DROP_DELAY_RND
970 #define ED_COUNTER_ID_CUSTOM2_FIRST ED_COUNTER_ID_MOVE_DELAY_FIX
971 #define ED_COUNTER_ID_CUSTOM2_LAST ED_COUNTER_ID_IGNITION_DELAY
972 #define ED_COUNTER_ID_CUSTOM_FIRST ED_COUNTER_ID_CUSTOM1_FIRST
973 #define ED_COUNTER_ID_CUSTOM_LAST ED_COUNTER_ID_CUSTOM2_LAST
975 #define ED_COUNTER_ID_CHANGE_FIRST ED_COUNTER_ID_CHANGE_DELAY_FIX
976 #define ED_COUNTER_ID_CHANGE_LAST ED_COUNTER_ID_CHANGE_CONT_RND
978 // values for scrollbutton gadgets
981 ED_SCROLLBUTTON_ID_AREA_UP,
982 ED_SCROLLBUTTON_ID_AREA_DOWN,
983 ED_SCROLLBUTTON_ID_AREA_LEFT,
984 ED_SCROLLBUTTON_ID_AREA_RIGHT,
985 ED_SCROLLBUTTON_ID_LIST_UP,
986 ED_SCROLLBUTTON_ID_LIST_DOWN,
991 #define ED_SCROLLBUTTON_ID_AREA_FIRST ED_SCROLLBUTTON_ID_AREA_UP
992 #define ED_SCROLLBUTTON_ID_AREA_LAST ED_SCROLLBUTTON_ID_AREA_RIGHT
994 // values for scrollbar gadgets
997 ED_SCROLLBAR_ID_AREA_HORIZONTAL,
998 ED_SCROLLBAR_ID_AREA_VERTICAL,
999 ED_SCROLLBAR_ID_LIST_VERTICAL,
1004 #define ED_SCROLLBAR_ID_AREA_FIRST ED_SCROLLBAR_ID_AREA_HORIZONTAL
1005 #define ED_SCROLLBAR_ID_AREA_LAST ED_SCROLLBAR_ID_AREA_VERTICAL
1007 // values for text input gadgets
1010 ED_TEXTINPUT_ID_LEVEL_NAME,
1011 ED_TEXTINPUT_ID_LEVEL_AUTHOR,
1012 ED_TEXTINPUT_ID_LEVELSET_NAME,
1013 ED_TEXTINPUT_ID_LEVELSET_AUTHOR,
1014 ED_TEXTINPUT_ID_BD_COLOR_TEXT_B,
1015 ED_TEXTINPUT_ID_BD_COLOR_TEXT_0,
1016 ED_TEXTINPUT_ID_BD_COLOR_TEXT_1,
1017 ED_TEXTINPUT_ID_BD_COLOR_TEXT_2,
1018 ED_TEXTINPUT_ID_BD_COLOR_TEXT_3,
1019 ED_TEXTINPUT_ID_BD_COLOR_TEXT_4,
1020 ED_TEXTINPUT_ID_BD_COLOR_TEXT_5,
1021 ED_TEXTINPUT_ID_ELEMENT_NAME,
1026 #define ED_TEXTINPUT_ID_LEVEL_FIRST ED_TEXTINPUT_ID_LEVEL_NAME
1027 #define ED_TEXTINPUT_ID_LEVEL_LAST ED_TEXTINPUT_ID_LEVEL_AUTHOR
1029 #define ED_TEXTINPUT_ID_LEVELSET_FIRST ED_TEXTINPUT_ID_LEVELSET_NAME
1030 #define ED_TEXTINPUT_ID_LEVELSET_LAST ED_TEXTINPUT_ID_LEVELSET_AUTHOR
1032 #define ED_TEXTINPUT_ID_COLORS_FIRST ED_TEXTINPUT_ID_BD_COLOR_TEXT_B
1033 #define ED_TEXTINPUT_ID_COLORS_LAST ED_TEXTINPUT_ID_BD_COLOR_TEXT_5
1035 // values for text area gadgets
1038 ED_TEXTAREA_ID_ENVELOPE_INFO,
1043 #define ED_TEXTAREA_ID_LEVEL_FIRST ED_TEXTAREA_ID_ENVELOPE
1044 #define ED_TEXTAREA_ID_LEVEL_LAST ED_TEXTAREA_ID_ENVELOPE
1046 // values for selectbox gadgets
1049 ED_SELECTBOX_ID_TIME_OR_STEPS,
1050 ED_SELECTBOX_ID_TIME_SCORE_BASE,
1051 ED_SELECTBOX_ID_GAME_ENGINE_TYPE,
1052 ED_SELECTBOX_ID_LEVELSET_SAVE_MODE,
1053 ED_SELECTBOX_ID_BD_SCHEDULING_TYPE,
1054 ED_SELECTBOX_ID_BD_COLOR_TYPE,
1055 ED_SELECTBOX_ID_BD_COLOR_C64_B,
1056 ED_SELECTBOX_ID_BD_COLOR_C64_0,
1057 ED_SELECTBOX_ID_BD_COLOR_C64_1,
1058 ED_SELECTBOX_ID_BD_COLOR_C64_2,
1059 ED_SELECTBOX_ID_BD_COLOR_C64_3,
1060 ED_SELECTBOX_ID_BD_COLOR_C64_4,
1061 ED_SELECTBOX_ID_BD_COLOR_C64_5,
1062 ED_SELECTBOX_ID_WIND_DIRECTION,
1063 ED_SELECTBOX_ID_PLAYER_SPEED,
1064 ED_SELECTBOX_ID_BD_GRAVITY_DIRECTION,
1065 ED_SELECTBOX_ID_MM_BALL_CHOICE_MODE,
1066 ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE,
1067 ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER,
1068 ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED,
1069 ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION,
1070 ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION,
1071 ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN,
1072 ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION,
1073 ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE,
1074 ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE,
1075 ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS,
1076 ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE,
1077 ED_SELECTBOX_ID_CUSTOM_DEADLINESS,
1078 ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE,
1079 ED_SELECTBOX_ID_CHANGE_TIME_UNITS,
1080 ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION,
1081 ED_SELECTBOX_ID_CHANGE_OTHER_ACTION,
1082 ED_SELECTBOX_ID_CHANGE_SIDE,
1083 ED_SELECTBOX_ID_CHANGE_PLAYER,
1084 ED_SELECTBOX_ID_CHANGE_PAGE,
1085 ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN,
1086 ED_SELECTBOX_ID_ACTION_TYPE,
1087 ED_SELECTBOX_ID_ACTION_MODE,
1088 ED_SELECTBOX_ID_ACTION_ARG,
1089 ED_SELECTBOX_ID_SELECT_CHANGE_PAGE,
1090 ED_SELECTBOX_ID_GROUP_CHOICE_MODE,
1095 #define ED_SELECTBOX_ID_LEVEL_FIRST ED_SELECTBOX_ID_TIME_OR_STEPS
1096 #define ED_SELECTBOX_ID_LEVEL_LAST ED_SELECTBOX_ID_GAME_ENGINE_TYPE
1098 #define ED_SELECTBOX_ID_LEVELSET_FIRST ED_SELECTBOX_ID_LEVELSET_SAVE_MODE
1099 #define ED_SELECTBOX_ID_LEVELSET_LAST ED_SELECTBOX_ID_LEVELSET_SAVE_MODE
1101 #define ED_SELECTBOX_ID_ENGINE_FIRST ED_SELECTBOX_ID_BD_SCHEDULING_TYPE
1102 #define ED_SELECTBOX_ID_ENGINE_LAST ED_SELECTBOX_ID_BD_SCHEDULING_TYPE
1104 #define ED_SELECTBOX_ID_COLORS_FIRST ED_SELECTBOX_ID_BD_COLOR_C64_B
1105 #define ED_SELECTBOX_ID_COLORS_LAST ED_SELECTBOX_ID_BD_COLOR_C64_5
1107 #define ED_SELECTBOX_ID_CUSTOM1_FIRST ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
1108 #define ED_SELECTBOX_ID_CUSTOM1_LAST ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION
1109 #define ED_SELECTBOX_ID_CUSTOM2_FIRST ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN
1110 #define ED_SELECTBOX_ID_CUSTOM2_LAST ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE
1111 #define ED_SELECTBOX_ID_CUSTOM_FIRST ED_SELECTBOX_ID_CUSTOM1_FIRST
1112 #define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM2_LAST
1114 #define ED_SELECTBOX_ID_CHANGE_FIRST ED_SELECTBOX_ID_CHANGE_TIME_UNITS
1115 #define ED_SELECTBOX_ID_CHANGE_LAST ED_SELECTBOX_ID_SELECT_CHANGE_PAGE
1117 // values for textbutton gadgets
1120 ED_TEXTBUTTON_ID_LEVELCONFIG_LEVEL,
1121 ED_TEXTBUTTON_ID_LEVELCONFIG_LEVELSET,
1122 ED_TEXTBUTTON_ID_LEVELCONFIG_EDITOR,
1123 ED_TEXTBUTTON_ID_LEVELCONFIG_ENGINE,
1124 ED_TEXTBUTTON_ID_ENGINECONFIG_CONFIG,
1125 ED_TEXTBUTTON_ID_ENGINECONFIG_COLORS,
1126 ED_TEXTBUTTON_ID_PROPERTIES_INFO,
1127 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG,
1128 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1,
1129 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2,
1130 ED_TEXTBUTTON_ID_PROPERTIES_CHANGE,
1131 ED_TEXTBUTTON_ID_SAVE_LEVELSET,
1132 ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2,
1133 ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1,
1134 ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE,
1135 ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE,
1136 ED_TEXTBUTTON_ID_BD_SET_RANDOM_COLORS,
1141 #define ED_TAB_BUTTON_ID_LEVELCONFIG_FIRST ED_TEXTBUTTON_ID_LEVELCONFIG_LEVEL
1142 #define ED_TAB_BUTTON_ID_LEVELCONFIG_LAST ED_TEXTBUTTON_ID_LEVELCONFIG_ENGINE
1144 #define ED_TAB_BUTTON_ID_ENGINECONFIG_FIRST ED_TEXTBUTTON_ID_ENGINECONFIG_CONFIG
1145 #define ED_TAB_BUTTON_ID_ENGINECONFIG_LAST ED_TEXTBUTTON_ID_ENGINECONFIG_COLORS
1147 #define ED_TAB_BUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
1148 #define ED_TAB_BUTTON_ID_PROPERTIES_LAST ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
1150 #define ED_TEXTBUTTON_ID_CHANGE_FIRST ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
1151 #define ED_TEXTBUTTON_ID_CHANGE_LAST ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
1153 // values for graphicbutton gadgets
1156 ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE,
1157 ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE,
1158 ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE,
1159 ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE,
1161 ED_NUM_GRAPHICBUTTONS
1164 #define ED_GRAPHICBUTTON_ID_CHANGE_FIRST ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE
1165 #define ED_GRAPHICBUTTON_ID_CHANGE_LAST ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE
1167 // values for checkbutton gadgets
1170 ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS,
1171 ED_CHECKBUTTON_ID_RATE_TIME_OVER_SCORE,
1172 ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK,
1173 ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE,
1174 ED_CHECKBUTTON_ID_RANDOM_RESTRICTED,
1175 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3,
1176 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2,
1177 ED_CHECKBUTTON_ID_BD_INTERMISSION,
1178 ED_CHECKBUTTON_ID_BD_PAL_TIMING,
1179 ED_CHECKBUTTON_ID_BD_LINE_SHIFTING_BORDERS,
1180 ED_CHECKBUTTON_ID_BD_SCAN_FIRST_AND_LAST_ROW,
1181 ED_CHECKBUTTON_ID_BD_SHORT_EXPLOSIONS,
1182 ED_CHECKBUTTON_ID_STICK_ELEMENT,
1183 ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS,
1184 ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE,
1185 ED_CHECKBUTTON_ID_USE_SPRING_BUG,
1186 ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG,
1187 ED_CHECKBUTTON_ID_USE_LIFE_BUGS,
1188 ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT,
1189 ED_CHECKBUTTON_ID_INITIAL_BALL_ACTIVE,
1190 ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE,
1191 ED_CHECKBUTTON_ID_SB_FIELDS_NEEDED,
1192 ED_CHECKBUTTON_ID_SB_OBJECTS_NEEDED,
1193 ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN,
1194 ED_CHECKBUTTON_ID_SOLVED_BY_ONE_PLAYER,
1195 ED_CHECKBUTTON_ID_FINISH_DIG_COLLECT,
1196 ED_CHECKBUTTON_ID_KEEP_WALKABLE_CE,
1197 ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING,
1198 ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD,
1199 ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD,
1200 ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD,
1201 ED_CHECKBUTTON_ID_INSTANT_RELOCATION,
1202 ED_CHECKBUTTON_ID_SHIFTED_RELOCATION,
1203 ED_CHECKBUTTON_ID_LAZY_RELOCATION,
1204 ED_CHECKBUTTON_ID_USE_START_ELEMENT,
1205 ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT,
1206 ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT,
1207 ED_CHECKBUTTON_ID_INITIAL_GRAVITY,
1208 ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY,
1209 ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE,
1210 ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID,
1211 ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID,
1212 ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH,
1213 ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS,
1214 ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
1215 ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
1216 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE,
1217 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
1218 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
1219 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_BREAK_SCAN,
1220 ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
1221 ED_CHECKBUTTON_ID_BD_AMOEBA_START_IMMEDIATELY,
1222 ED_CHECKBUTTON_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA,
1223 ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS,
1224 ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER,
1225 ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK,
1226 ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
1227 ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE,
1228 ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL,
1229 ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE,
1230 ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE,
1231 ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED,
1232 ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN,
1233 ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR,
1234 ED_CHECKBUTTON_ID_BD_INFINITE_ROCKETS,
1235 ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
1236 ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING,
1237 ED_CHECKBUTTON_ID_BD_GRAVITY_SWITCH_ACTIVE,
1238 ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL,
1239 ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
1240 ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
1241 ED_CHECKBUTTON_ID_MM_LASER_RED,
1242 ED_CHECKBUTTON_ID_MM_LASER_GREEN,
1243 ED_CHECKBUTTON_ID_MM_LASER_BLUE,
1244 ED_CHECKBUTTON_ID_DF_LASER_RED,
1245 ED_CHECKBUTTON_ID_DF_LASER_GREEN,
1246 ED_CHECKBUTTON_ID_DF_LASER_BLUE,
1247 ED_CHECKBUTTON_ID_ROTATE_MM_BALL_CONTENT,
1248 ED_CHECKBUTTON_ID_EXPLODE_MM_BALL,
1249 ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC,
1250 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1,
1251 ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE,
1252 ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE,
1253 ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE,
1254 ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT,
1255 ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE,
1256 ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE,
1257 ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL,
1258 ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH,
1259 ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY,
1260 ED_CHECKBUTTON_ID_CUSTOM_DEADLY,
1261 ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE,
1262 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE,
1263 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH,
1264 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT,
1265 ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE,
1266 ED_CHECKBUTTON_ID_CHANGE_DELAY,
1267 ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT,
1268 ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT,
1269 ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION,
1270 ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT,
1271 ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE,
1272 ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM,
1273 ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION,
1278 #define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS
1279 #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RATE_TIME_OVER_SCORE
1281 #define ED_CHECKBUTTON_ID_LEVELSET_FIRST ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK
1282 #define ED_CHECKBUTTON_ID_LEVELSET_LAST ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE
1284 #define ED_CHECKBUTTON_ID_EDITOR_FIRST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
1285 #define ED_CHECKBUTTON_ID_EDITOR_LAST ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2
1287 #define ED_CHECKBUTTON_ID_ENGINE_FIRST ED_CHECKBUTTON_ID_BD_INTERMISSION
1288 #define ED_CHECKBUTTON_ID_ENGINE_LAST ED_CHECKBUTTON_ID_BD_SHORT_EXPLOSIONS
1290 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
1291 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
1292 #define ED_CHECKBUTTON_ID_CUSTOM2_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE
1293 #define ED_CHECKBUTTON_ID_CUSTOM2_LAST ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT
1294 #define ED_CHECKBUTTON_ID_CUSTOM_FIRST ED_CHECKBUTTON_ID_CUSTOM1_FIRST
1295 #define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM2_LAST
1297 #define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
1298 #define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION
1300 // values for radiobutton gadgets
1303 ED_RADIOBUTTON_ID_PERCENTAGE,
1304 ED_RADIOBUTTON_ID_QUANTITY,
1309 #define ED_RADIOBUTTON_ID_EDITOR_FIRST ED_RADIOBUTTON_ID_PERCENTAGE
1310 #define ED_RADIOBUTTON_ID_EDITOR_LAST ED_RADIOBUTTON_ID_QUANTITY
1312 // values for drawing area gadgets
1315 ED_DRAWING_ID_DRAWING_LEVEL,
1316 ED_DRAWING_ID_YAMYAM_CONTENT_0,
1317 ED_DRAWING_ID_YAMYAM_CONTENT_1,
1318 ED_DRAWING_ID_YAMYAM_CONTENT_2,
1319 ED_DRAWING_ID_YAMYAM_CONTENT_3,
1320 ED_DRAWING_ID_YAMYAM_CONTENT_4,
1321 ED_DRAWING_ID_YAMYAM_CONTENT_5,
1322 ED_DRAWING_ID_YAMYAM_CONTENT_6,
1323 ED_DRAWING_ID_YAMYAM_CONTENT_7,
1324 ED_DRAWING_ID_MAGIC_BALL_CONTENT_0,
1325 ED_DRAWING_ID_MAGIC_BALL_CONTENT_1,
1326 ED_DRAWING_ID_MAGIC_BALL_CONTENT_2,
1327 ED_DRAWING_ID_MAGIC_BALL_CONTENT_3,
1328 ED_DRAWING_ID_MAGIC_BALL_CONTENT_4,
1329 ED_DRAWING_ID_MAGIC_BALL_CONTENT_5,
1330 ED_DRAWING_ID_MAGIC_BALL_CONTENT_6,
1331 ED_DRAWING_ID_MAGIC_BALL_CONTENT_7,
1332 ED_DRAWING_ID_ANDROID_CONTENT,
1333 ED_DRAWING_ID_AMOEBA_CONTENT,
1334 ED_DRAWING_ID_BD_SNAP_ELEMENT,
1335 ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO,
1336 ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO,
1337 ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
1338 ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO,
1339 ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
1340 ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
1341 ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
1342 ED_DRAWING_ID_BD_AMOEBA_CONTENT_TOO_BIG,
1343 ED_DRAWING_ID_BD_AMOEBA_CONTENT_ENCLOSED,
1344 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_TOO_BIG,
1345 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_ENCLOSED,
1346 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_EXPLODING,
1347 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE,
1348 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_1,
1349 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
1350 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2,
1351 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
1352 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3,
1353 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
1354 ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
1355 ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT,
1356 ED_DRAWING_ID_BD_BITER_EATS_ELEMENT,
1357 ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
1358 ED_DRAWING_ID_BD_NUT_CONTENT,
1359 ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
1360 ED_DRAWING_ID_BD_SAND_LOOKS_LIKE,
1361 ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING,
1362 ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT,
1363 ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING,
1364 ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT,
1365 ED_DRAWING_ID_BD_FIREFLY_EXPLODES_TO,
1366 ED_DRAWING_ID_BD_FIREFLY_2_EXPLODES_TO,
1367 ED_DRAWING_ID_BD_BUTTERFLY_EXPLODES_TO,
1368 ED_DRAWING_ID_BD_BUTTERFLY_2_EXPLODES_TO,
1369 ED_DRAWING_ID_BD_STONEFLY_EXPLODES_TO,
1370 ED_DRAWING_ID_BD_DRAGONFLY_EXPLODES_TO,
1371 ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO,
1372 ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO,
1373 ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO,
1374 ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO,
1375 ED_DRAWING_ID_START_ELEMENT,
1376 ED_DRAWING_ID_ARTWORK_ELEMENT,
1377 ED_DRAWING_ID_EXPLOSION_ELEMENT,
1378 ED_DRAWING_ID_INVENTORY_CONTENT,
1379 ED_DRAWING_ID_MM_BALL_CONTENT,
1380 ED_DRAWING_ID_CUSTOM_GRAPHIC,
1381 ED_DRAWING_ID_CUSTOM_CONTENT,
1382 ED_DRAWING_ID_CUSTOM_MOVE_ENTER,
1383 ED_DRAWING_ID_CUSTOM_MOVE_LEAVE,
1384 ED_DRAWING_ID_CUSTOM_CHANGE_TARGET,
1385 ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT,
1386 ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER,
1387 ED_DRAWING_ID_CUSTOM_CHANGE_ACTION,
1388 ED_DRAWING_ID_GROUP_CONTENT,
1389 ED_DRAWING_ID_RANDOM_BACKGROUND,
1391 ED_NUM_DRAWING_AREAS
1394 #define ED_DRAWING_ID_EDITOR_FIRST ED_DRAWING_ID_RANDOM_BACKGROUND
1395 #define ED_DRAWING_ID_EDITOR_LAST ED_DRAWING_ID_RANDOM_BACKGROUND
1398 // ----------------------------------------------------------------------------
1399 // some internally used definitions
1400 // ----------------------------------------------------------------------------
1402 // values for CopyLevelToUndoBuffer()
1403 #define UNDO_IMMEDIATE 0
1404 #define UNDO_ACCUMULATE 1
1406 // values for scrollbars
1407 #define ED_SCROLL_NO 0
1408 #define ED_SCROLL_LEFT 1
1409 #define ED_SCROLL_RIGHT 2
1410 #define ED_SCROLL_UP 4
1411 #define ED_SCROLL_DOWN 8
1413 // screens in the level editor
1414 #define ED_MODE_DRAWING 0
1415 #define ED_MODE_LEVELCONFIG 1
1416 #define ED_MODE_PROPERTIES 2
1417 #define ED_MODE_PALETTE 3
1419 // sub-screens in the global settings section
1420 #define ED_MODE_LEVELCONFIG_LEVEL ED_TEXTBUTTON_ID_LEVELCONFIG_LEVEL
1421 #define ED_MODE_LEVELCONFIG_LEVELSET ED_TEXTBUTTON_ID_LEVELCONFIG_LEVELSET
1422 #define ED_MODE_LEVELCONFIG_EDITOR ED_TEXTBUTTON_ID_LEVELCONFIG_EDITOR
1423 #define ED_MODE_LEVELCONFIG_ENGINE ED_TEXTBUTTON_ID_LEVELCONFIG_ENGINE
1425 // sub-screens in the engine settings section
1426 #define ED_MODE_ENGINECONFIG_CONFIG ED_TEXTBUTTON_ID_ENGINECONFIG_CONFIG
1427 #define ED_MODE_ENGINECONFIG_COLORS ED_TEXTBUTTON_ID_ENGINECONFIG_COLORS
1429 // sub-screens in the element properties section
1430 #define ED_MODE_PROPERTIES_INFO ED_TEXTBUTTON_ID_PROPERTIES_INFO
1431 #define ED_MODE_PROPERTIES_CONFIG ED_TEXTBUTTON_ID_PROPERTIES_CONFIG
1432 #define ED_MODE_PROPERTIES_CONFIG_1 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1
1433 #define ED_MODE_PROPERTIES_CONFIG_2 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2
1434 #define ED_MODE_PROPERTIES_CHANGE ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
1436 // how many steps can be cancelled
1437 #define NUM_UNDO_STEPS (64 + 1)
1439 // values for elements with score for certain actions
1441 #define MAX_SCORE 999
1443 // values for elements with count for collecting
1444 #define MIN_COLLECT_COUNT 0
1445 #define MAX_COLLECT_COUNT 999
1447 // values for random placement
1448 #define RANDOM_USE_PERCENTAGE 0
1449 #define RANDOM_USE_QUANTITY 1
1451 // values for level set save mode
1452 #define LEVELSET_SAVE_MODE_UPDATE 0
1453 #define LEVELSET_SAVE_MODE_CREATE 1
1455 // default value for element tile size in drawing area
1456 #define DEFAULT_EDITOR_TILESIZE MINI_TILESIZE
1457 #define DEFAULT_EDITOR_TILESIZE_MM TILESIZE
1460 // ----------------------------------------------------------------------------
1461 // some internally used data structure definitions
1462 // ----------------------------------------------------------------------------
1468 struct XYTileSize *pos;
1472 } controlbutton_info[ED_NUM_CTRL_BUTTONS] =
1474 // note: some additional characters are already reserved for "cheat mode"
1475 // shortcuts (":XYZ" style) -- for details, see "events.c"
1477 // ---------- toolbox control buttons ---------------------------------------
1480 IMG_GFX_EDITOR_BUTTON_DRAW_SINGLE, GADGET_ID_SINGLE_ITEMS,
1481 &editor.button.draw_single, GD_TYPE_RADIO_BUTTON,
1482 "Draw single items", 's'
1485 IMG_GFX_EDITOR_BUTTON_DRAW_CONNECTED, GADGET_ID_CONNECTED_ITEMS,
1486 &editor.button.draw_connected, GD_TYPE_RADIO_BUTTON,
1487 "Draw connected items", 'd'
1490 IMG_GFX_EDITOR_BUTTON_DRAW_LINE, GADGET_ID_LINE,
1491 &editor.button.draw_line, GD_TYPE_RADIO_BUTTON,
1495 IMG_GFX_EDITOR_BUTTON_DRAW_ARC, GADGET_ID_ARC,
1496 &editor.button.draw_arc, GD_TYPE_RADIO_BUTTON,
1500 IMG_GFX_EDITOR_BUTTON_DRAW_RECTANGLE, GADGET_ID_RECTANGLE,
1501 &editor.button.draw_rectangle, GD_TYPE_RADIO_BUTTON,
1502 "Draw outline rectangles", 'r'
1505 IMG_GFX_EDITOR_BUTTON_DRAW_FILLED_BOX, GADGET_ID_FILLED_BOX,
1506 &editor.button.draw_filled_box, GD_TYPE_RADIO_BUTTON,
1507 "Draw filled rectangles", 'R'
1510 IMG_GFX_EDITOR_BUTTON_ROTATE_UP, GADGET_ID_WRAP_UP,
1511 &editor.button.rotate_up, GD_TYPE_NORMAL_BUTTON,
1512 "Wrap (rotate) level up", 0
1515 IMG_GFX_EDITOR_BUTTON_DRAW_TEXT, GADGET_ID_TEXT,
1516 &editor.button.draw_text, GD_TYPE_RADIO_BUTTON,
1517 "Enter text elements", 't'
1520 IMG_GFX_EDITOR_BUTTON_FLOOD_FILL, GADGET_ID_FLOOD_FILL,
1521 &editor.button.flood_fill, GD_TYPE_RADIO_BUTTON,
1525 IMG_GFX_EDITOR_BUTTON_ROTATE_LEFT, GADGET_ID_WRAP_LEFT,
1526 &editor.button.rotate_left, GD_TYPE_NORMAL_BUTTON,
1527 "Wrap (rotate) level left", 0
1530 IMG_GFX_EDITOR_BUTTON_ZOOM_LEVEL, GADGET_ID_ZOOM,
1531 &editor.button.zoom_level, GD_TYPE_NORMAL_BUTTON,
1532 "Zoom level tile size", '+'
1535 IMG_GFX_EDITOR_BUTTON_ROTATE_RIGHT, GADGET_ID_WRAP_RIGHT,
1536 &editor.button.rotate_right, GD_TYPE_NORMAL_BUTTON,
1537 "Wrap (rotate) level right", 0
1540 IMG_GFX_EDITOR_BUTTON_DRAW_RANDOM, GADGET_ID_RANDOM_PLACEMENT,
1541 &editor.button.draw_random, GD_TYPE_NORMAL_BUTTON,
1542 "Random element placement", 0
1545 IMG_GFX_EDITOR_BUTTON_GRAB_BRUSH, GADGET_ID_GRAB_BRUSH,
1546 &editor.button.grab_brush, GD_TYPE_RADIO_BUTTON,
1550 IMG_GFX_EDITOR_BUTTON_ROTATE_DOWN, GADGET_ID_WRAP_DOWN,
1551 &editor.button.rotate_down, GD_TYPE_NORMAL_BUTTON,
1552 "Wrap (rotate) level down", 0
1555 IMG_GFX_EDITOR_BUTTON_PICK_ELEMENT, GADGET_ID_PICK_ELEMENT,
1556 &editor.button.pick_element, GD_TYPE_RADIO_BUTTON,
1557 "Pick drawing element", ','
1560 // ---------- level control buttons -----------------------------------------
1563 IMG_GFX_EDITOR_BUTTON_UNDO, GADGET_ID_UNDO,
1564 &editor.button.undo, GD_TYPE_NORMAL_BUTTON,
1565 "Undo/redo last operation", 'u'
1568 IMG_GFX_EDITOR_BUTTON_CONF, GADGET_ID_CONF,
1569 &editor.button.conf, GD_TYPE_NORMAL_BUTTON,
1570 "Level and editor settings", 'I'
1573 IMG_GFX_EDITOR_BUTTON_SAVE, GADGET_ID_SAVE,
1574 &editor.button.save, GD_TYPE_NORMAL_BUTTON,
1578 IMG_GFX_EDITOR_BUTTON_CLEAR, GADGET_ID_CLEAR,
1579 &editor.button.clear, GD_TYPE_NORMAL_BUTTON,
1583 IMG_GFX_EDITOR_BUTTON_TEST, GADGET_ID_TEST,
1584 &editor.button.test, GD_TYPE_NORMAL_BUTTON,
1588 IMG_GFX_EDITOR_BUTTON_EXIT, GADGET_ID_EXIT,
1589 &editor.button.exit, GD_TYPE_NORMAL_BUTTON,
1590 "Exit level editor", 'E'
1593 // ---------- CE and GE control buttons -------------------------------------
1596 IMG_GFX_EDITOR_BUTTON_CE_COPY_FROM, GADGET_ID_CUSTOM_COPY_FROM,
1597 &editor.button.ce_copy_from, GD_TYPE_RADIO_BUTTON,
1598 "Copy settings from other element", 0
1601 IMG_GFX_EDITOR_BUTTON_CE_COPY_TO, GADGET_ID_CUSTOM_COPY_TO,
1602 &editor.button.ce_copy_to, GD_TYPE_RADIO_BUTTON,
1603 "Copy settings to other element", 0
1606 IMG_GFX_EDITOR_BUTTON_CE_SWAP, GADGET_ID_CUSTOM_EXCHANGE,
1607 &editor.button.ce_swap, GD_TYPE_RADIO_BUTTON,
1608 "Exchange element with other element", 0
1611 IMG_GFX_EDITOR_BUTTON_CE_COPY, GADGET_ID_CUSTOM_COPY,
1612 &editor.button.ce_copy, GD_TYPE_NORMAL_BUTTON,
1613 "Copy settings from this element", 0
1616 IMG_GFX_EDITOR_BUTTON_CE_PASTE, GADGET_ID_CUSTOM_PASTE,
1617 &editor.button.ce_paste, GD_TYPE_NORMAL_BUTTON,
1618 "Paste settings to this element", 0
1621 // ---------- palette control buttons ---------------------------------------
1624 IMG_GFX_EDITOR_BUTTON_PROPERTIES, GADGET_ID_PROPERTIES,
1625 &editor.button.properties, GD_TYPE_NORMAL_BUTTON,
1626 "Properties of drawing element", 'p'
1629 IMG_GFX_EDITOR_BUTTON_ELEMENT_LEFT, GADGET_ID_ELEMENT_LEFT,
1630 &editor.button.element_left, GD_TYPE_NORMAL_BUTTON,
1631 "Properties of drawing element 1", '1'
1634 IMG_GFX_EDITOR_BUTTON_ELEMENT_MIDDLE, GADGET_ID_ELEMENT_MIDDLE,
1635 &editor.button.element_middle, GD_TYPE_NORMAL_BUTTON,
1636 "Properties of drawing element 2", '2'
1639 IMG_GFX_EDITOR_BUTTON_ELEMENT_RIGHT, GADGET_ID_ELEMENT_RIGHT,
1640 &editor.button.element_right, GD_TYPE_NORMAL_BUTTON,
1641 "Properties of drawing element 3", '3'
1644 IMG_GFX_EDITOR_BUTTON_PALETTE, GADGET_ID_PALETTE,
1645 &editor.button.palette, GD_TYPE_NORMAL_BUTTON,
1646 "Show list of elements", 'e'
1650 static int random_placement_value = 10;
1651 static int random_placement_method = RANDOM_USE_QUANTITY;
1652 static int random_placement_background_element = EL_SAND;
1653 static boolean random_placement_background_restricted = FALSE;
1654 static boolean stick_element_properties_window = FALSE;
1655 static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES];
1656 static boolean custom_element_change_events[NUM_CHANGE_EVENTS];
1657 static struct ElementChangeInfo custom_element_change;
1658 static struct ElementGroupInfo group_element_info;
1659 static struct ElementInfo custom_element;
1661 static char levelset_name[MAX_LEVEL_NAME_LEN + 1];
1662 static char levelset_author[MAX_LEVEL_AUTHOR_LEN + 1];
1663 static int levelset_num_levels = 100;
1664 static boolean levelset_use_levelset_artwork = FALSE;
1665 static boolean levelset_copy_level_template = FALSE;
1666 static int levelset_save_mode = LEVELSET_SAVE_MODE_UPDATE;
1668 #define MAX_BD_COLORS 7
1669 #define MAX_BD_COLOR_TEXT_LEN 10
1671 static boolean bd_color_type_changed = FALSE;
1672 static int bd_color_type_default = GD_COLOR_TYPE_RGB;
1673 static int bd_color_c64[MAX_BD_COLORS];
1674 static char bd_color_text[MAX_BD_COLORS][MAX_BD_COLOR_TEXT_LEN + 1];
1675 static int bd_color_default[MAX_BD_COLORS];
1676 static int *bd_color[MAX_BD_COLORS] =
1691 int min_value, max_value;
1692 int gadget_id_down, gadget_id_up;
1694 int gadget_id_align;
1696 char *text_above, *text_left, *text_right;
1697 } counterbutton_info[ED_NUM_COUNTERBUTTONS] =
1699 // ---------- current level number ------------------------------------------
1702 ED_COUNTER_ID_SELECT_LEVEL,
1703 -1, -1, // these values are not constant, but can change at runtime
1705 GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_UP,
1706 GADGET_ID_SELECT_LEVEL_TEXT, GADGET_ID_NONE,
1711 // ---------- level and editor settings -------------------------------------
1714 ED_COUNTER_ID_LEVEL_XSIZE,
1715 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(4),
1716 MIN_LEV_FIELDX, MAX_LEV_FIELDX,
1717 GADGET_ID_LEVEL_XSIZE_DOWN, GADGET_ID_LEVEL_XSIZE_UP,
1718 GADGET_ID_LEVEL_XSIZE_TEXT, GADGET_ID_NONE,
1720 "Playfield size:", NULL, "Width",
1723 ED_COUNTER_ID_LEVEL_YSIZE,
1724 -1, ED_LEVEL_SETTINGS_YPOS(4),
1725 MIN_LEV_FIELDY, MAX_LEV_FIELDY,
1726 GADGET_ID_LEVEL_YSIZE_DOWN, GADGET_ID_LEVEL_YSIZE_UP,
1727 GADGET_ID_LEVEL_YSIZE_TEXT, GADGET_ID_LEVEL_XSIZE_UP,
1729 NULL, " ", "Height",
1732 ED_COUNTER_ID_LEVEL_GEMSLIMIT,
1733 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(5),
1735 GADGET_ID_LEVEL_GEMSLIMIT_DOWN, GADGET_ID_LEVEL_GEMSLIMIT_UP,
1736 GADGET_ID_LEVEL_GEMSLIMIT_TEXT, GADGET_ID_NONE,
1738 NULL, "Number of gems to collect:", NULL
1741 ED_COUNTER_ID_LEVEL_TIMELIMIT,
1742 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(8),
1744 GADGET_ID_LEVEL_TIMELIMIT_DOWN, GADGET_ID_LEVEL_TIMELIMIT_UP,
1745 GADGET_ID_LEVEL_TIMELIMIT_TEXT, GADGET_ID_NONE,
1747 "Time or step limit to solve level:", NULL, NULL
1750 ED_COUNTER_ID_LEVEL_TIMESCORE,
1751 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(10),
1753 GADGET_ID_LEVEL_TIMESCORE_DOWN, GADGET_ID_LEVEL_TIMESCORE_UP,
1754 GADGET_ID_LEVEL_TIMESCORE_TEXT, GADGET_ID_NONE,
1755 &level.score[SC_TIME_BONUS],
1756 "Score for time or steps left:", NULL, NULL
1759 ED_COUNTER_ID_LEVEL_RANDOM_SEED,
1760 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(13),
1762 GADGET_ID_LEVEL_RANDOM_SEED_DOWN, GADGET_ID_LEVEL_RANDOM_SEED_UP,
1763 GADGET_ID_LEVEL_RANDOM_SEED_TEXT, GADGET_ID_NONE,
1765 NULL, "Random seed:", "(0 => random)"
1768 ED_COUNTER_ID_LEVELSET_NUM_LEVELS,
1769 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(4),
1771 GADGET_ID_LEVELSET_NUM_LEVELS_DOWN, GADGET_ID_LEVELSET_NUM_LEVELS_UP,
1772 GADGET_ID_LEVELSET_NUM_LEVELS_TEXT, GADGET_ID_NONE,
1773 &levelset_num_levels,
1774 "Number of levels:", NULL, NULL,
1777 ED_COUNTER_ID_LEVEL_RANDOM,
1778 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(0),
1780 GADGET_ID_LEVEL_RANDOM_DOWN, GADGET_ID_LEVEL_RANDOM_UP,
1781 GADGET_ID_LEVEL_RANDOM_TEXT, GADGET_ID_NONE,
1782 &random_placement_value,
1783 "Random element placement:", NULL, "in"
1786 ED_COUNTER_ID_BD_CYCLE_DELAY_MS,
1787 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(3),
1789 GADGET_ID_BD_CYCLE_DELAY_MS_DOWN, GADGET_ID_BD_CYCLE_DELAY_MS_UP,
1790 GADGET_ID_BD_CYCLE_DELAY_MS_TEXT, GADGET_ID_NONE,
1791 &level.bd_cycle_delay_ms,
1792 NULL, NULL, "Game cycle delay (ms)"
1795 ED_COUNTER_ID_BD_CYCLE_DELAY_C64,
1796 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(3),
1798 GADGET_ID_BD_CYCLE_DELAY_C64_DOWN, GADGET_ID_BD_CYCLE_DELAY_C64_UP,
1799 GADGET_ID_BD_CYCLE_DELAY_C64_TEXT, GADGET_ID_NONE,
1800 &level.bd_cycle_delay_c64,
1801 NULL, NULL, "Game cycle delay (C64-style)"
1804 ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES,
1805 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(4),
1807 GADGET_ID_BD_HATCHING_DELAY_CYCLES_DOWN, GADGET_ID_BD_HATCHING_DELAY_CYCLES_UP,
1808 GADGET_ID_BD_HATCHING_DELAY_CYCLES_TEXT, GADGET_ID_NONE,
1809 &level.bd_hatching_delay_cycles,
1810 NULL, NULL, "Hatching delay (cycles)"
1813 ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS,
1814 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(4),
1816 GADGET_ID_BD_HATCHING_DELAY_SECONDS_DOWN, GADGET_ID_BD_HATCHING_DELAY_SECONDS_UP,
1817 GADGET_ID_BD_HATCHING_DELAY_SECONDS_TEXT, GADGET_ID_NONE,
1818 &level.bd_hatching_delay_seconds,
1819 NULL, NULL, "Hatching delay (seconds)"
1822 // ---------- element settings: configure (various elements) ----------------
1825 ED_COUNTER_ID_BD_PUSHING_PROB,
1826 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
1828 GADGET_ID_BD_PUSHING_PROB_DOWN, GADGET_ID_BD_PUSHING_PROB_UP,
1829 GADGET_ID_BD_PUSHING_PROB_TEXT, GADGET_ID_NONE,
1830 &level.bd_pushing_prob,
1831 NULL, NULL, "Push probability"
1834 ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET,
1835 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
1837 GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_DOWN, GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_UP,
1838 GADGET_ID_BD_PUSHING_PROB_WITH_SWEET_TEXT, GADGET_ID_NONE,
1839 &level.bd_pushing_prob_with_sweet,
1840 NULL, NULL, "Push probability with sweet"
1843 ED_COUNTER_ID_ELEMENT_VALUE1,
1844 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
1845 MIN_SCORE, MAX_SCORE,
1846 GADGET_ID_ELEMENT_VALUE1_DOWN, GADGET_ID_ELEMENT_VALUE1_UP,
1847 GADGET_ID_ELEMENT_VALUE1_TEXT, GADGET_ID_NONE,
1848 NULL, // will be set when used
1852 ED_COUNTER_ID_ELEMENT_VALUE2,
1853 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
1854 MIN_SCORE, MAX_SCORE,
1855 GADGET_ID_ELEMENT_VALUE2_DOWN, GADGET_ID_ELEMENT_VALUE2_UP,
1856 GADGET_ID_ELEMENT_VALUE2_TEXT, GADGET_ID_NONE,
1857 NULL, // will be set when used
1861 ED_COUNTER_ID_ELEMENT_VALUE3,
1862 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
1863 MIN_SCORE, MAX_SCORE,
1864 GADGET_ID_ELEMENT_VALUE3_DOWN, GADGET_ID_ELEMENT_VALUE3_UP,
1865 GADGET_ID_ELEMENT_VALUE3_TEXT, GADGET_ID_NONE,
1866 NULL, // will be set when used
1870 ED_COUNTER_ID_ELEMENT_VALUE4,
1871 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
1872 MIN_SCORE, MAX_SCORE,
1873 GADGET_ID_ELEMENT_VALUE4_DOWN, GADGET_ID_ELEMENT_VALUE4_UP,
1874 GADGET_ID_ELEMENT_VALUE4_TEXT, GADGET_ID_NONE,
1875 NULL, // will be set when used
1879 ED_COUNTER_ID_YAMYAM_CONTENT,
1880 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
1881 MIN_ELEMENT_CONTENTS, MAX_ELEMENT_CONTENTS,
1882 GADGET_ID_YAMYAM_CONTENT_DOWN, GADGET_ID_YAMYAM_CONTENT_UP,
1883 GADGET_ID_YAMYAM_CONTENT_TEXT, GADGET_ID_NONE,
1884 &level.num_yamyam_contents,
1885 NULL, NULL, "Number of content areas"
1888 ED_COUNTER_ID_BALL_CONTENT,
1889 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
1890 MIN_ELEMENT_CONTENTS, MAX_ELEMENT_CONTENTS,
1891 GADGET_ID_BALL_CONTENT_DOWN, GADGET_ID_BALL_CONTENT_UP,
1892 GADGET_ID_BALL_CONTENT_TEXT, GADGET_ID_NONE,
1893 &level.num_ball_contents,
1894 NULL, NULL, "Number of content areas"
1897 ED_COUNTER_ID_ANDROID_CONTENT,
1898 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
1899 MIN_ANDROID_ELEMENTS, MAX_ANDROID_ELEMENTS,
1900 GADGET_ID_ANDROID_CONTENT_DOWN, GADGET_ID_ANDROID_CONTENT_UP,
1901 GADGET_ID_ANDROID_CONTENT_TEXT, GADGET_ID_NONE,
1902 &level.num_android_clone_elements,
1903 NULL, NULL, "Number of clonable elements"
1906 ED_COUNTER_ID_ENVELOPE_XSIZE,
1907 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
1908 MIN_ENVELOPE_XSIZE, MAX_ENVELOPE_XSIZE,
1909 GADGET_ID_ENVELOPE_XSIZE_DOWN, GADGET_ID_ENVELOPE_XSIZE_UP,
1910 GADGET_ID_ENVELOPE_XSIZE_TEXT, GADGET_ID_NONE,
1911 NULL, // will be set when used
1912 NULL, NULL, "Width",
1915 ED_COUNTER_ID_ENVELOPE_YSIZE,
1916 -1, ED_ELEMENT_SETTINGS_YPOS(0),
1917 MIN_ENVELOPE_YSIZE, MAX_ENVELOPE_YSIZE,
1918 GADGET_ID_ENVELOPE_YSIZE_DOWN, GADGET_ID_ENVELOPE_YSIZE_UP,
1919 GADGET_ID_ENVELOPE_YSIZE_TEXT, GADGET_ID_ENVELOPE_XSIZE_UP,
1920 NULL, // will be set when used
1921 NULL, " ", "Height",
1924 ED_COUNTER_ID_INVENTORY_SIZE,
1925 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
1926 MIN_INITIAL_INVENTORY_SIZE, MAX_INITIAL_INVENTORY_SIZE,
1927 GADGET_ID_INVENTORY_SIZE_DOWN, GADGET_ID_INVENTORY_SIZE_UP,
1928 GADGET_ID_INVENTORY_SIZE_TEXT, GADGET_ID_NONE,
1929 &level.initial_inventory_size[0],
1930 NULL, NULL, "Number of inventory elements"
1933 ED_COUNTER_ID_MM_BALL_CONTENT,
1934 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
1935 MIN_ELEMENTS_IN_GROUP, MAX_MM_BALL_CONTENTS,
1936 GADGET_ID_MM_BALL_CONTENT_DOWN, GADGET_ID_MM_BALL_CONTENT_UP,
1937 GADGET_ID_MM_BALL_CONTENT_TEXT, GADGET_ID_NONE,
1938 &level.num_mm_ball_contents,
1939 NULL, NULL, "Number of content elements"
1942 // ---------- element settings: configure 1 (custom elements) ---------------
1945 ED_COUNTER_ID_CUSTOM_SCORE,
1946 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
1947 MIN_SCORE, MAX_SCORE,
1948 GADGET_ID_CUSTOM_SCORE_DOWN, GADGET_ID_CUSTOM_SCORE_UP,
1949 GADGET_ID_CUSTOM_SCORE_TEXT, GADGET_ID_NONE,
1950 &custom_element.collect_score_initial,
1951 NULL, "CE score", " "
1954 ED_COUNTER_ID_CUSTOM_GEMCOUNT,
1955 -1, ED_ELEMENT_SETTINGS_YPOS(5),
1956 MIN_COLLECT_COUNT, MAX_COLLECT_COUNT,
1957 GADGET_ID_CUSTOM_GEMCOUNT_DOWN, GADGET_ID_CUSTOM_GEMCOUNT_UP,
1958 GADGET_ID_CUSTOM_GEMCOUNT_TEXT, GADGET_ID_CUSTOM_SCORE_UP,
1959 &custom_element.collect_count_initial,
1960 NULL, "CE count", NULL
1963 ED_COUNTER_ID_CUSTOM_VALUE_FIX,
1964 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
1966 GADGET_ID_CUSTOM_VALUE_FIX_DOWN, GADGET_ID_CUSTOM_VALUE_FIX_UP,
1967 GADGET_ID_CUSTOM_VALUE_FIX_TEXT, GADGET_ID_NONE,
1968 &custom_element.ce_value_fixed_initial,
1969 NULL, "CE value", NULL
1972 ED_COUNTER_ID_CUSTOM_VALUE_RND,
1973 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
1975 GADGET_ID_CUSTOM_VALUE_RND_DOWN, GADGET_ID_CUSTOM_VALUE_RND_UP,
1976 GADGET_ID_CUSTOM_VALUE_RND_TEXT, GADGET_ID_CUSTOM_VALUE_FIX_UP,
1977 &custom_element.ce_value_random_initial,
1978 NULL, "+random", NULL
1981 ED_COUNTER_ID_PUSH_DELAY_FIX,
1982 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(6),
1984 GADGET_ID_PUSH_DELAY_FIX_DOWN, GADGET_ID_PUSH_DELAY_FIX_UP,
1985 GADGET_ID_PUSH_DELAY_FIX_TEXT, GADGET_ID_NONE,
1986 &custom_element.push_delay_fixed,
1987 NULL, "Push delay", NULL
1990 ED_COUNTER_ID_PUSH_DELAY_RND,
1991 -1, ED_ELEMENT_SETTINGS_YPOS(6),
1993 GADGET_ID_PUSH_DELAY_RND_DOWN, GADGET_ID_PUSH_DELAY_RND_UP,
1994 GADGET_ID_PUSH_DELAY_RND_TEXT, GADGET_ID_PUSH_DELAY_FIX_UP,
1995 &custom_element.push_delay_random,
1996 NULL, "+random", NULL
1999 ED_COUNTER_ID_DROP_DELAY_FIX,
2000 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(7),
2002 GADGET_ID_DROP_DELAY_FIX_DOWN, GADGET_ID_DROP_DELAY_FIX_UP,
2003 GADGET_ID_DROP_DELAY_FIX_TEXT, GADGET_ID_NONE,
2004 &custom_element.drop_delay_fixed,
2005 NULL, "Drop delay", NULL
2008 ED_COUNTER_ID_DROP_DELAY_RND,
2009 -1, ED_ELEMENT_SETTINGS_YPOS(7),
2011 GADGET_ID_DROP_DELAY_RND_DOWN, GADGET_ID_DROP_DELAY_RND_UP,
2012 GADGET_ID_DROP_DELAY_RND_TEXT, GADGET_ID_DROP_DELAY_FIX_UP,
2013 &custom_element.drop_delay_random,
2014 NULL, "+random", NULL
2017 // ---------- element settings: configure 2 (custom elements) ---------------
2020 ED_COUNTER_ID_MOVE_DELAY_FIX,
2021 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
2023 GADGET_ID_MOVE_DELAY_FIX_DOWN, GADGET_ID_MOVE_DELAY_FIX_UP,
2024 GADGET_ID_MOVE_DELAY_FIX_TEXT, GADGET_ID_NONE,
2025 &custom_element.move_delay_fixed,
2026 NULL, "Move delay", NULL
2029 ED_COUNTER_ID_MOVE_DELAY_RND,
2030 -1, ED_ELEMENT_SETTINGS_YPOS(5),
2032 GADGET_ID_MOVE_DELAY_RND_DOWN, GADGET_ID_MOVE_DELAY_RND_UP,
2033 GADGET_ID_MOVE_DELAY_RND_TEXT, GADGET_ID_MOVE_DELAY_FIX_UP,
2034 &custom_element.move_delay_random,
2035 NULL, "+random", NULL
2038 ED_COUNTER_ID_STEP_DELAY_FIX,
2039 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(6),
2041 GADGET_ID_STEP_DELAY_FIX_DOWN, GADGET_ID_STEP_DELAY_FIX_UP,
2042 GADGET_ID_STEP_DELAY_FIX_TEXT, GADGET_ID_NONE,
2043 &custom_element.step_delay_fixed,
2044 NULL, "Step delay", NULL
2047 ED_COUNTER_ID_STEP_DELAY_RND,
2048 -1, ED_ELEMENT_SETTINGS_YPOS(6),
2050 GADGET_ID_STEP_DELAY_RND_DOWN, GADGET_ID_STEP_DELAY_RND_UP,
2051 GADGET_ID_STEP_DELAY_RND_TEXT, GADGET_ID_STEP_DELAY_FIX_UP,
2052 &custom_element.step_delay_random,
2053 NULL, "+random", NULL
2056 ED_COUNTER_ID_EXPLOSION_DELAY,
2057 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(13),
2059 GADGET_ID_EXPLOSION_DELAY_DOWN, GADGET_ID_EXPLOSION_DELAY_UP,
2060 GADGET_ID_EXPLOSION_DELAY_TEXT, GADGET_ID_NONE,
2061 &custom_element.explosion_delay,
2062 NULL, "Explosion delay", NULL
2065 ED_COUNTER_ID_IGNITION_DELAY,
2066 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(14),
2068 GADGET_ID_IGNITION_DELAY_DOWN, GADGET_ID_IGNITION_DELAY_UP,
2069 GADGET_ID_IGNITION_DELAY_TEXT, GADGET_ID_NONE,
2070 &custom_element.ignition_delay,
2071 NULL, "Ignition delay", "(by fire)"
2074 // ---------- element settings: configure (group elements) ------------------
2077 ED_COUNTER_ID_GROUP_CONTENT,
2078 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
2079 MIN_ELEMENTS_IN_GROUP, MAX_ELEMENTS_IN_GROUP,
2080 GADGET_ID_GROUP_CONTENT_DOWN, GADGET_ID_GROUP_CONTENT_UP,
2081 GADGET_ID_GROUP_CONTENT_TEXT, GADGET_ID_NONE,
2082 &group_element_info.num_elements,
2083 NULL, NULL, "Number of elements in group"
2086 // ---------- element settings: advanced (custom elements) ------------------
2089 ED_COUNTER_ID_CHANGE_DELAY_FIX,
2090 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(2),
2092 GADGET_ID_CHANGE_DELAY_FIX_DOWN, GADGET_ID_CHANGE_DELAY_FIX_UP,
2093 GADGET_ID_CHANGE_DELAY_FIX_TEXT, GADGET_ID_NONE,
2094 &custom_element_change.delay_fixed,
2095 NULL, "CE delay", NULL,
2098 ED_COUNTER_ID_CHANGE_DELAY_RND,
2099 -1, ED_ELEMENT_SETTINGS_YPOS(2),
2101 GADGET_ID_CHANGE_DELAY_RND_DOWN, GADGET_ID_CHANGE_DELAY_RND_UP,
2102 GADGET_ID_CHANGE_DELAY_RND_TEXT, GADGET_ID_CHANGE_DELAY_FIX_UP,
2103 &custom_element_change.delay_random,
2104 NULL, "+random", NULL
2107 ED_COUNTER_ID_CHANGE_CONT_RND,
2108 ED_ELEMENT_SETTINGS_XPOS(3), ED_ELEMENT_SETTINGS_YPOS(12),
2110 GADGET_ID_CHANGE_CONT_RND_DOWN, GADGET_ID_CHANGE_CONT_RND_UP,
2111 GADGET_ID_CHANGE_CONT_RND_TEXT, GADGET_ID_NONE,
2112 &custom_element_change.random_percentage,
2113 NULL, "Use random replace:", "%"
2124 char *text_above, *text_left, *text_right, *infotext;
2125 } textinput_info[ED_NUM_TEXTINPUT] =
2127 // ---------- level and editor settings -------------------------------------
2130 ED_TEXTINPUT_ID_LEVEL_NAME,
2131 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(0),
2132 GADGET_ID_LEVEL_NAME,
2135 "Title:", NULL, NULL, "Enter title for this level"
2138 ED_TEXTINPUT_ID_LEVEL_AUTHOR,
2139 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(2),
2140 GADGET_ID_LEVEL_AUTHOR,
2141 MAX_LEVEL_AUTHOR_LEN,
2143 "Author:", NULL, NULL, "Enter author for this level"
2146 ED_TEXTINPUT_ID_LEVELSET_NAME,
2147 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(0),
2148 GADGET_ID_LEVELSET_NAME,
2151 "Title:", NULL, NULL, "Enter title for this or new level set"
2154 ED_TEXTINPUT_ID_LEVELSET_AUTHOR,
2155 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(2),
2156 GADGET_ID_LEVELSET_AUTHOR,
2157 MAX_LEVEL_AUTHOR_LEN,
2159 "Author:", NULL, NULL, "Enter author for this or new level set"
2162 // ---------- engine settings: colors ---------------------------------------
2165 ED_TEXTINPUT_ID_BD_COLOR_TEXT_B,
2166 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(1),
2167 GADGET_ID_BD_COLOR_TEXT_B,
2168 MAX_BD_COLOR_TEXT_LEN,
2170 NULL, "Border color: ", NULL, "Enter border color (not used)"
2173 ED_TEXTINPUT_ID_BD_COLOR_TEXT_0,
2174 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(2),
2175 GADGET_ID_BD_COLOR_TEXT_0,
2176 MAX_BD_COLOR_TEXT_LEN,
2178 NULL, "Background color: ", NULL, "Enter background color (C64 graphics)"
2181 ED_TEXTINPUT_ID_BD_COLOR_TEXT_1,
2182 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(3),
2183 GADGET_ID_BD_COLOR_TEXT_1,
2184 MAX_BD_COLOR_TEXT_LEN,
2186 NULL, "Sand color: ", NULL, "Enter sand color (C64 graphics)"
2189 ED_TEXTINPUT_ID_BD_COLOR_TEXT_2,
2190 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(4),
2191 GADGET_ID_BD_COLOR_TEXT_2,
2192 MAX_BD_COLOR_TEXT_LEN,
2194 NULL, "Steel wall color: ", NULL, "Enter steel wall color (C64 graphics)"
2197 ED_TEXTINPUT_ID_BD_COLOR_TEXT_3,
2198 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(5),
2199 GADGET_ID_BD_COLOR_TEXT_3,
2200 MAX_BD_COLOR_TEXT_LEN,
2202 NULL, "Wall color: ", NULL, "Enter wall color (C64 graphics)"
2205 ED_TEXTINPUT_ID_BD_COLOR_TEXT_4,
2206 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(6),
2207 GADGET_ID_BD_COLOR_TEXT_4,
2208 MAX_BD_COLOR_TEXT_LEN,
2210 NULL, "Amoeba color: ", NULL, "Enter amoeba color (C64 graphics)"
2213 ED_TEXTINPUT_ID_BD_COLOR_TEXT_5,
2214 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(7),
2215 GADGET_ID_BD_COLOR_TEXT_5,
2216 MAX_BD_COLOR_TEXT_LEN,
2218 NULL, "Slime color: ", NULL, "Enter slime color (C64 graphics)"
2221 // ---------- element settings: configure (several elements) ----------------
2224 ED_TEXTINPUT_ID_ELEMENT_NAME,
2225 -1, -1, // these values are not constant, but can change at runtime
2226 GADGET_ID_ELEMENT_NAME,
2227 MAX_ELEMENT_NAME_LEN - 2, // currently 2 chars less editable
2228 custom_element.description,
2229 NULL, NULL, NULL, "Enter element name"
2240 char *text_above, *text_above_cropped, *infotext;
2241 } textarea_info[ED_NUM_TEXTAREAS] =
2244 ED_TEXTAREA_ID_ENVELOPE_INFO,
2245 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
2246 GADGET_ID_ENVELOPE_INFO,
2247 MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
2249 "Envelope Content:", "Envelope Content (cropped):", "Envelope Content"
2253 static struct ValueTextInfo options_time_or_steps[] =
2261 static struct ValueTextInfo options_time_score_base[] =
2263 { 1, "per second/step" },
2264 { 10, "per 10 seconds/steps" },
2269 static struct ValueTextInfo options_game_engine_type[] =
2271 { GAME_ENGINE_TYPE_RND, "Rocks'n'Diamonds" },
2272 { GAME_ENGINE_TYPE_BD, "Boulder Dash" },
2273 { GAME_ENGINE_TYPE_EM, "Emerald Mine" },
2274 { GAME_ENGINE_TYPE_SP, "Supaplex" },
2275 { GAME_ENGINE_TYPE_MM, "Mirror Magic" },
2280 static struct ValueTextInfo options_levelset_save_mode[] =
2282 { LEVELSET_SAVE_MODE_UPDATE, "Update this level set" },
2283 { LEVELSET_SAVE_MODE_CREATE, "Create new level set" },
2288 static struct ValueTextInfo options_bd_gravity_direction[] =
2290 { GD_MV_DOWN, "down" },
2292 { GD_MV_LEFT, "left" },
2293 { GD_MV_RIGHT, "right" },
2298 static struct ValueTextInfo options_wind_direction[] =
2300 { MV_START_NONE, "none" },
2301 { MV_START_LEFT, "left" },
2302 { MV_START_RIGHT, "right" },
2303 { MV_START_UP, "up" },
2304 { MV_START_DOWN, "down" },
2309 static struct ValueTextInfo options_player_speed[] =
2316 { 16, "very fast" },
2317 { 32, "ultrafast" },
2322 static struct ValueTextInfo options_access_type[] =
2324 { EP_WALKABLE, "walkable" },
2325 { EP_PASSABLE, "passable" },
2330 static struct ValueTextInfo options_access_layer[] =
2332 { EP_ACCESSIBLE_OVER, "over" },
2333 { EP_ACCESSIBLE_INSIDE, "inside" },
2334 { EP_ACCESSIBLE_UNDER, "under" },
2339 static struct ValueTextInfo options_access_protected[] =
2341 { 0, "unprotected" },
2347 static struct ValueTextInfo options_access_direction[] =
2349 { MV_NO_DIRECTION, "no direction" },
2350 { MV_LEFT, "left" },
2351 { MV_RIGHT, "right" },
2353 { MV_DOWN, "down" },
2354 { MV_LEFT | MV_UP, "left + up" },
2355 { MV_LEFT | MV_DOWN, "left + down" },
2356 { MV_RIGHT | MV_UP, "right + up" },
2357 { MV_RIGHT | MV_DOWN, "right + down" },
2358 { MV_HORIZONTAL, "horizontal" },
2359 { MV_VERTICAL, "vertical" },
2360 { MV_HORIZONTAL | MV_UP, "horizontal + up" },
2361 { MV_HORIZONTAL | MV_DOWN, "horizontal + down" },
2362 { MV_VERTICAL | MV_LEFT, "vertical + left" },
2363 { MV_VERTICAL | MV_RIGHT, "vertical + right" },
2364 { MV_ALL_DIRECTIONS, "all directions" },
2369 static struct ValueTextInfo options_walk_to_action[] =
2371 { EP_DIGGABLE, "diggable" },
2372 { EP_COLLECTIBLE_ONLY, "collectible" },
2373 { EP_DROPPABLE, "collectible & droppable" },
2374 { EP_THROWABLE, "collectible & throwable" },
2375 { EP_PUSHABLE, "pushable" },
2380 static struct ValueTextInfo options_move_pattern[] =
2382 { MV_LEFT, "left" },
2383 { MV_RIGHT, "right" },
2385 { MV_DOWN, "down" },
2386 { MV_HORIZONTAL, "horizontal" },
2387 { MV_VERTICAL, "vertical" },
2388 { MV_ALL_DIRECTIONS, "all directions" },
2389 { MV_WIND_DIRECTION, "wind direction" },
2390 { MV_TOWARDS_PLAYER, "towards player" },
2391 { MV_AWAY_FROM_PLAYER, "away from player" },
2392 { MV_ALONG_LEFT_SIDE, "along left side" },
2393 { MV_ALONG_RIGHT_SIDE, "along right side" },
2394 { MV_TURNING_LEFT, "turning left" },
2395 { MV_TURNING_RIGHT, "turning right" },
2396 { MV_TURNING_LEFT_RIGHT, "turning left, right" },
2397 { MV_TURNING_RIGHT_LEFT, "turning right, left" },
2398 { MV_TURNING_RANDOM, "turning random" },
2399 { MV_MAZE_RUNNER, "maze runner style" },
2400 { MV_MAZE_HUNTER, "maze hunter style" },
2401 { MV_WHEN_PUSHED, "when pushed" },
2402 { MV_WHEN_DROPPED, "when dropped/thrown" },
2407 static struct ValueTextInfo options_move_direction[] =
2409 { MV_START_AUTOMATIC, "automatic" },
2410 { MV_START_LEFT, "left" },
2411 { MV_START_RIGHT, "right" },
2412 { MV_START_UP, "up" },
2413 { MV_START_DOWN, "down" },
2414 { MV_START_RANDOM, "random" },
2415 { MV_START_PREVIOUS, "previous" },
2420 static struct ValueTextInfo options_move_stepsize[] =
2422 { 0, "not moving" },
2427 { 16, "very fast" },
2428 { 32, "even faster" },
2433 static struct ValueTextInfo options_move_leave_type[] =
2435 { LEAVE_TYPE_UNLIMITED, "leave behind" },
2436 { LEAVE_TYPE_LIMITED, "change it to" },
2441 static struct ValueTextInfo options_smash_targets[] =
2443 { EP_CAN_SMASH_PLAYER, "player" },
2445 { EP_CAN_SMASH_ENEMIES, "enemies" },
2447 { EP_CAN_SMASH_EVERYTHING, "everything" },
2452 static struct ValueTextInfo options_slippery_type[] =
2454 { SLIPPERY_ANY_RANDOM, "random" },
2455 { SLIPPERY_ANY_LEFT_RIGHT, "left, right" },
2456 { SLIPPERY_ANY_RIGHT_LEFT, "right, left" },
2457 { SLIPPERY_ONLY_LEFT, "only left" },
2458 { SLIPPERY_ONLY_RIGHT, "only right" },
2463 static struct ValueTextInfo options_deadliness[] =
2465 { EP_DONT_RUN_INTO, "running into" },
2466 { EP_DONT_COLLIDE_WITH, "colliding with" },
2467 { EP_DONT_GET_HIT_BY, "getting hit by" },
2468 { EP_DONT_TOUCH, "touching" },
2473 static struct ValueTextInfo options_explosion_type[] =
2475 { EXPLODES_3X3, "3x3" },
2476 { EXPLODES_CROSS, "3+3" },
2477 { EXPLODES_1X1, "1x1" },
2482 static struct ValueTextInfo options_time_units[] =
2485 { FRAMES_PER_SECOND, "seconds" },
2490 static struct ValueTextInfo options_change_direct_action[] =
2492 { CE_TOUCHED_BY_PLAYER, "touched by player" },
2493 { CE_PRESSED_BY_PLAYER, "pressed by player" },
2494 { CE_SWITCHED_BY_PLAYER, "switched by player" },
2495 { CE_SNAPPED_BY_PLAYER, "snapped by player" },
2496 { CE_PUSHED_BY_PLAYER, "pushed by player" },
2497 { CE_ENTERED_BY_PLAYER, "entered by player" },
2498 { CE_LEFT_BY_PLAYER, "left by player" },
2499 { CE_DROPPED_BY_PLAYER, "dropped/thrown by player" },
2500 { CE_SWITCHED, "switched" },
2501 { CE_HITTING_SOMETHING, "hitting something" },
2502 { CE_HIT_BY_SOMETHING, "hit by something" },
2504 { CE_BLOCKED, "blocked" },
2506 { CE_IMPACT, "impact (on something)" },
2507 { CE_SMASHED, "smashed (from above)" },
2509 { CE_VALUE_CHANGES, "CE value changes" },
2510 { CE_SCORE_CHANGES, "CE score changes" },
2512 { CE_VALUE_GETS_ZERO, "CE value gets 0" },
2513 { CE_SCORE_GETS_ZERO, "CE score gets 0" },
2514 { CE_UNDEFINED, " " },
2515 { CE_HEADLINE_SPECIAL_EVENTS, "[mouse events]" },
2516 { CE_CLICKED_BY_MOUSE, "clicked by mouse" },
2517 { CE_PRESSED_BY_MOUSE, "pressed by mouse" },
2518 { CE_UNDEFINED, " " },
2519 { CE_HEADLINE_SPECIAL_EVENTS, "[static states]" },
2520 { CE_NEXT_TO_PLAYER, "next to player" },
2525 static struct ValueTextInfo options_change_other_action[] =
2527 { CE_PLAYER_TOUCHES_X, "player touches" },
2528 { CE_PLAYER_PRESSES_X, "player presses" },
2529 { CE_PLAYER_SWITCHES_X, "player switches" },
2530 { CE_PLAYER_SNAPS_X, "player snaps" },
2531 { CE_PLAYER_PUSHES_X, "player pushes" },
2532 { CE_PLAYER_ENTERS_X, "player enters" },
2533 { CE_PLAYER_LEAVES_X, "player leaves" },
2534 { CE_PLAYER_DIGS_X, "player digs" },
2535 { CE_PLAYER_COLLECTS_X, "player collects" },
2536 { CE_PLAYER_DROPS_X, "player drops/throws" },
2537 { CE_TOUCHING_X, "touching" },
2538 { CE_HITTING_X, "hitting" },
2539 { CE_DIGGING_X, "digging" },
2540 { CE_HIT_BY_X, "hit by" },
2541 { CE_SWITCH_OF_X, "switch of" },
2542 { CE_CHANGE_OF_X, "change by page of" },
2543 { CE_EXPLOSION_OF_X, "explosion of" },
2544 { CE_MOVE_OF_X, "move of" },
2545 { CE_CREATION_OF_X, "creation of" },
2546 { CE_VALUE_CHANGES_OF_X, "CE value changes of" },
2547 { CE_SCORE_CHANGES_OF_X, "CE score changes of" },
2548 { CE_VALUE_GETS_ZERO_OF_X, "CE value gets 0 of" },
2549 { CE_SCORE_GETS_ZERO_OF_X, "CE score gets 0 of" },
2550 { CE_UNDEFINED, " " },
2551 { CE_HEADLINE_SPECIAL_EVENTS, "[mouse events]" },
2552 { CE_MOUSE_CLICKED_ON_X, "mouse clicked on" },
2553 { CE_MOUSE_PRESSED_ON_X, "mouse pressed on" },
2554 { CE_UNDEFINED, " " },
2555 { CE_HEADLINE_SPECIAL_EVENTS, "[static states]" },
2556 { CE_PLAYER_NEXT_TO_X, "player next to" },
2557 { CE_NEXT_TO_X, "next to" },
2562 static struct ValueTextInfo options_change_trigger_side[] =
2564 { CH_SIDE_LEFT, "left" },
2565 { CH_SIDE_RIGHT, "right" },
2566 { CH_SIDE_TOP, "top" },
2567 { CH_SIDE_BOTTOM, "bottom" },
2568 { CH_SIDE_LEFT_RIGHT, "left/right" },
2569 { CH_SIDE_TOP_BOTTOM, "top/bottom" },
2570 { CH_SIDE_ANY, "any" },
2575 static struct ValueTextInfo options_change_trigger_player[] =
2577 { CH_PLAYER_1, "1" },
2578 { CH_PLAYER_2, "2" },
2579 { CH_PLAYER_3, "3" },
2580 { CH_PLAYER_4, "4" },
2581 { CH_PLAYER_ANY, "any" },
2586 static struct ValueTextInfo options_change_trigger_page[] =
2597 { (1u << 9), "10" },
2598 { (1u << 10), "11" },
2599 { (1u << 11), "12" },
2600 { (1u << 12), "13" },
2601 { (1u << 13), "14" },
2602 { (1u << 14), "15" },
2603 { (1u << 15), "16" },
2604 { (1u << 16), "17" },
2605 { (1u << 17), "18" },
2606 { (1u << 18), "19" },
2607 { (1u << 19), "20" },
2608 { (1u << 20), "21" },
2609 { (1u << 21), "22" },
2610 { (1u << 22), "23" },
2611 { (1u << 23), "24" },
2612 { (1u << 24), "25" },
2613 { (1u << 25), "26" },
2614 { (1u << 26), "27" },
2615 { (1u << 27), "28" },
2616 { (1u << 28), "29" },
2617 { (1u << 29), "30" },
2618 { (1u << 30), "31" },
2619 { (1u << 31), "32" },
2620 { CH_PAGE_ANY, "any" },
2625 static struct ValueTextInfo options_change_replace_when[] =
2627 { CP_WHEN_EMPTY, "empty" },
2628 { CP_WHEN_WALKABLE, "walkable" },
2629 { CP_WHEN_DIGGABLE, "diggable" },
2630 { CP_WHEN_COLLECTIBLE, "collectible" },
2631 { CP_WHEN_REMOVABLE, "removable" },
2632 { CP_WHEN_DESTRUCTIBLE, "destructible" },
2637 static struct ValueTextInfo options_action_type[] =
2639 { CA_NO_ACTION, "no action" },
2640 { CA_UNDEFINED, " " },
2641 { CA_HEADLINE_LEVEL_ACTIONS, "[level]" },
2642 { CA_RESTART_LEVEL, "restart level" },
2643 { CA_SHOW_ENVELOPE, "show envelope" },
2644 { CA_SET_LEVEL_TIME, "set time" },
2645 { CA_SET_LEVEL_SCORE, "set score" },
2646 { CA_SET_LEVEL_GEMS, "set gems" },
2647 { CA_SET_LEVEL_WIND, "set wind dir." },
2648 { CA_SET_LEVEL_RANDOM_SEED, "set random seed" },
2649 { CA_UNDEFINED, " " },
2650 { CA_HEADLINE_PLAYER_ACTIONS, "[player]" },
2651 { CA_MOVE_PLAYER, "move player" },
2652 { CA_MOVE_PLAYER_NEW, "move player new" },
2653 { CA_EXIT_PLAYER, "exit player" },
2654 { CA_KILL_PLAYER, "kill player" },
2655 { CA_SET_PLAYER_KEYS, "set keys" },
2656 { CA_SET_PLAYER_SPEED, "set speed" },
2657 { CA_SET_PLAYER_SHIELD, "set shield" },
2658 { CA_SET_PLAYER_GRAVITY, "set gravity" },
2659 { CA_SET_PLAYER_ARTWORK, "set artwork" },
2660 { CA_SET_PLAYER_INVENTORY, "set inventory" },
2661 { CA_UNDEFINED, " " },
2662 { CA_HEADLINE_CE_ACTIONS, "[CE]" },
2663 { CA_SET_CE_VALUE, "set CE value" },
2664 { CA_SET_CE_SCORE, "set CE score" },
2665 { CA_SET_CE_ARTWORK, "set CE artwork" },
2666 { CA_UNDEFINED, " " },
2667 { CA_HEADLINE_ENGINE_ACTIONS, "[engine]" },
2668 { CA_SET_ENGINE_SCAN_MODE, "set scan mode" },
2673 static struct ValueTextInfo options_action_mode_none[] =
2675 { CA_MODE_UNDEFINED, " " },
2680 static struct ValueTextInfo options_action_mode_assign[] =
2682 { CA_MODE_SET, "=" },
2687 static struct ValueTextInfo options_action_mode_add_remove[] =
2689 { CA_MODE_ADD, "+" },
2690 { CA_MODE_SUBTRACT, "-" },
2695 static struct ValueTextInfo options_action_mode_calculate[] =
2697 { CA_MODE_SET, "=" },
2698 { CA_MODE_ADD, "+" },
2699 { CA_MODE_SUBTRACT, "-" },
2700 { CA_MODE_MULTIPLY, "*" },
2701 { CA_MODE_DIVIDE, "/" },
2702 { CA_MODE_MODULO, "%" },
2707 static struct ValueTextInfo options_action_arg_none[] =
2709 { CA_ARG_UNDEFINED, " " },
2714 static struct ValueTextInfo options_action_arg_player[] =
2716 { CA_ARG_PLAYER_HEADLINE, "[player]" },
2717 { CA_ARG_PLAYER_1, "1" },
2718 { CA_ARG_PLAYER_2, "2" },
2719 { CA_ARG_PLAYER_3, "3" },
2720 { CA_ARG_PLAYER_4, "4" },
2721 { CA_ARG_PLAYER_ANY, "any" },
2722 { CA_ARG_PLAYER_TRIGGER, "trigger" },
2723 { CA_ARG_PLAYER_ACTION, "action ->" },
2728 static struct ValueTextInfo options_action_arg_number[] =
2730 { CA_ARG_NUMBER_HEADLINE, "[number]" },
2737 { CA_ARG_10, "10" },
2738 { CA_ARG_100, "100" },
2739 { CA_ARG_1000, "1000" },
2740 { CA_ARG_UNDEFINED, " " },
2741 { CA_ARG_NUMBER_MIN, "min" },
2742 { CA_ARG_NUMBER_MAX, "max" },
2743 { CA_ARG_UNDEFINED, " " },
2744 { CA_ARG_NUMBER_RESET, "reset" },
2745 { CA_ARG_UNDEFINED, " " },
2746 { CA_ARG_NUMBER_CE_VALUE, "CE value" },
2747 { CA_ARG_NUMBER_CE_SCORE, "CE score" },
2748 { CA_ARG_NUMBER_CE_DELAY, "CE delay" },
2749 { CA_ARG_UNDEFINED, " " },
2750 { CA_ARG_NUMBER_LEVEL_TIME, "time" },
2751 { CA_ARG_NUMBER_LEVEL_GEMS, "gems" },
2752 { CA_ARG_NUMBER_LEVEL_SCORE, "score" },
2753 { CA_ARG_UNDEFINED, " " },
2754 { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]" },
2755 { CA_ARG_ELEMENT_CV_TARGET, "target" },
2756 { CA_ARG_ELEMENT_CV_TRIGGER, "trigger" },
2757 { CA_ARG_ELEMENT_CV_ACTION, "action ->" },
2758 { CA_ARG_UNDEFINED, " " },
2759 { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]" },
2760 { CA_ARG_ELEMENT_CS_TARGET, "target" },
2761 { CA_ARG_ELEMENT_CS_TRIGGER, "trigger" },
2762 { CA_ARG_ELEMENT_CS_ACTION, "action ->" },
2767 static struct ValueTextInfo options_action_arg_value[] =
2769 { CA_ARG_NUMBER_HEADLINE, "[number]" },
2776 { CA_ARG_10, "10" },
2777 { CA_ARG_100, "100" },
2778 { CA_ARG_1000, "1000" },
2779 { CA_ARG_UNDEFINED, " " },
2780 { CA_ARG_NUMBER_MIN, "min" },
2781 { CA_ARG_NUMBER_MAX, "max" },
2782 { CA_ARG_UNDEFINED, " " },
2783 { CA_ARG_NUMBER_RESET, "reset" },
2784 { CA_ARG_UNDEFINED, " " },
2785 { CA_ARG_NUMBER_CE_VALUE, "CE value" },
2786 { CA_ARG_NUMBER_CE_SCORE, "CE score" },
2787 { CA_ARG_NUMBER_CE_DELAY, "CE delay" },
2788 { CA_ARG_UNDEFINED, " " },
2789 { CA_ARG_NUMBER_LEVEL_TIME, "time" },
2790 { CA_ARG_NUMBER_LEVEL_GEMS, "gems" },
2791 { CA_ARG_NUMBER_LEVEL_SCORE, "score" },
2792 { CA_ARG_UNDEFINED, " " },
2793 { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]" },
2794 { CA_ARG_ELEMENT_CV_TARGET, "target" },
2795 { CA_ARG_ELEMENT_CV_TRIGGER, "trigger" },
2796 { CA_ARG_ELEMENT_CV_ACTION, "action ->" },
2797 { CA_ARG_UNDEFINED, " " },
2798 { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]" },
2799 { CA_ARG_ELEMENT_CS_TARGET, "target" },
2800 { CA_ARG_ELEMENT_CS_TRIGGER, "trigger" },
2801 { CA_ARG_ELEMENT_CS_ACTION, "action ->" },
2802 { CA_ARG_UNDEFINED, " " },
2803 { CA_ARG_ELEMENT_NR_HEADLINE, "[element]" },
2804 { CA_ARG_ELEMENT_NR_TARGET, "target" },
2805 { CA_ARG_ELEMENT_NR_TRIGGER, "trigger" },
2806 { CA_ARG_ELEMENT_NR_ACTION, "action ->" },
2811 static struct ValueTextInfo options_action_arg_envelope[] =
2813 { CA_ARG_NUMBER_HEADLINE, "[number]" },
2818 { CA_ARG_UNDEFINED, " " },
2819 { CA_ARG_ELEMENT_HEADLINE, "[element]" },
2820 { CA_ARG_ELEMENT_TARGET, "target" },
2821 { CA_ARG_ELEMENT_TRIGGER, "trigger" },
2822 { CA_ARG_ELEMENT_ACTION, "action ->" },
2827 static struct ValueTextInfo options_action_arg_key[] =
2829 { CA_ARG_NUMBER_HEADLINE, "[number]" },
2838 { CA_ARG_UNDEFINED, " " },
2839 { CA_ARG_ELEMENT_HEADLINE, "[element]" },
2840 { CA_ARG_ELEMENT_TARGET, "target" },
2841 { CA_ARG_ELEMENT_TRIGGER, "trigger" },
2842 { CA_ARG_ELEMENT_ACTION, "action ->" },
2847 static struct ValueTextInfo options_action_arg_speed[] =
2849 { CA_ARG_SPEED_HEADLINE, "[speed]" },
2850 { CA_ARG_SPEED_NOT_MOVING, "frozen" },
2851 { CA_ARG_SPEED_VERY_SLOW, "very slow" },
2852 { CA_ARG_SPEED_SLOW, "slow" },
2853 { CA_ARG_SPEED_NORMAL, "normal" },
2854 { CA_ARG_SPEED_FAST, "fast" },
2855 { CA_ARG_SPEED_VERY_FAST, "very fast" },
2856 { CA_ARG_SPEED_EVEN_FASTER, "ultrafast" },
2857 { CA_ARG_UNDEFINED, " " },
2858 { CA_ARG_SPEED_SLOWER, "slower" },
2859 { CA_ARG_SPEED_FASTER, "faster" },
2860 { CA_ARG_UNDEFINED, " " },
2861 { CA_ARG_SPEED_RESET, "reset" },
2866 static struct ValueTextInfo options_action_arg_shield[] =
2868 { CA_ARG_SHIELD_HEADLINE, "[shield]" },
2869 { CA_ARG_SHIELD_OFF, "off" },
2870 { CA_ARG_SHIELD_NORMAL, "normal" },
2871 { CA_ARG_SHIELD_DEADLY, "deadly" },
2876 static struct ValueTextInfo options_action_arg_artwork[] =
2878 { CA_ARG_ELEMENT_HEADLINE, "[element]" },
2879 { CA_ARG_ELEMENT_TARGET, "target" },
2880 { CA_ARG_ELEMENT_TRIGGER, "trigger" },
2881 { CA_ARG_ELEMENT_ACTION, "action ->" },
2882 { CA_ARG_UNDEFINED, " " },
2883 { CA_ARG_ELEMENT_RESET, "reset" },
2888 static struct ValueTextInfo options_action_arg_gravity[] =
2890 { CA_ARG_GRAVITY_HEADLINE, "[gravity]" },
2891 { CA_ARG_GRAVITY_ON, "on" },
2892 { CA_ARG_GRAVITY_OFF, "off" },
2893 { CA_ARG_GRAVITY_TOGGLE, "toggle" },
2898 static struct ValueTextInfo options_action_arg_direction[] =
2900 { CA_ARG_DIRECTION_HEADLINE, "[dir.]" },
2901 { CA_ARG_DIRECTION_NONE, "none" },
2902 { CA_ARG_DIRECTION_LEFT, "left" },
2903 { CA_ARG_DIRECTION_RIGHT, "right" },
2904 { CA_ARG_DIRECTION_UP, "up" },
2905 { CA_ARG_DIRECTION_DOWN, "down" },
2906 { CA_ARG_DIRECTION_TRIGGER, "trigger" },
2907 { CA_ARG_DIRECTION_TRIGGER_BACK, "-trigger" },
2912 static struct ValueTextInfo options_action_arg_scan_mode[] =
2914 { CA_ARG_SCAN_MODE_HEADLINE, "[mode]" },
2915 { CA_ARG_SCAN_MODE_NORMAL, "normal" },
2916 { CA_ARG_SCAN_MODE_REVERSE, "reverse" },
2921 static struct ValueTextInfo options_action_arg_inventory[] =
2923 { CA_ARG_INVENTORY_HEADLINE, "[add]" },
2924 { CA_ARG_ELEMENT_TARGET, "+ target" },
2925 { CA_ARG_ELEMENT_TRIGGER, "+ trigger" },
2926 { CA_ARG_ELEMENT_ACTION, "+ action" },
2927 { CA_ARG_UNDEFINED, " " },
2928 { CA_ARG_INVENTORY_RM_HEADLINE, "[remove]" },
2929 { CA_ARG_INVENTORY_RM_TARGET, "- target" },
2930 { CA_ARG_INVENTORY_RM_TRIGGER, "- trigger" },
2931 { CA_ARG_INVENTORY_RM_ACTION, "- action" },
2932 { CA_ARG_INVENTORY_RM_FIRST, "- first" },
2933 { CA_ARG_INVENTORY_RM_LAST, "- last" },
2934 { CA_ARG_INVENTORY_RM_ALL, "- all" },
2935 { CA_ARG_UNDEFINED, " " },
2936 { CA_ARG_INVENTORY_RESET, "reset" },
2941 static char options_change_page_strings[MAX_CHANGE_PAGES][10];
2942 static struct ValueTextInfo options_change_page[MAX_CHANGE_PAGES + 1] =
2947 static struct ValueTextInfo options_group_choice_mode[] =
2949 { ANIM_RANDOM, "random" },
2950 { ANIM_LOOP, "loop" },
2951 { ANIM_LINEAR, "linear" },
2952 { ANIM_PINGPONG, "pingpong" },
2953 { ANIM_PINGPONG2, "pingpong 2" },
2954 { ANIM_LEVEL_NR, "level number" },
2959 static struct ValueTextInfo options_bd_scheduling_type[] =
2961 { GD_SCHEDULING_MILLISECONDS, "Milliseconds" },
2962 { GD_SCHEDULING_BD1, "BD1" },
2963 { GD_SCHEDULING_BD2, "BD2" },
2964 { GD_SCHEDULING_PLCK, "Construction Kit" },
2965 { GD_SCHEDULING_CRDR, "Crazy Dream 7" },
2966 { GD_SCHEDULING_BD1_ATARI, "Atari BD1" },
2967 { GD_SCHEDULING_BD2_PLCK_ATARI, "Atari BD2 / PLCK" },
2972 static struct ValueTextInfo options_bd_color_type[] =
2974 { GD_COLOR_TYPE_RGB, "RGB colors" },
2975 { GD_COLOR_TYPE_C64, "C64 colors" },
2976 { GD_COLOR_TYPE_C64DTV, "C64DTV colors" },
2977 { GD_COLOR_TYPE_ATARI, "Atari colors" },
2982 static struct ValueTextInfo options_bd_color_c64_name[] =
2984 { GD_COLOR_INDEX_BLACK, "Black" },
2985 { GD_COLOR_INDEX_WHITE, "White" },
2986 { GD_COLOR_INDEX_RED, "Red" },
2987 { GD_COLOR_INDEX_CYAN, "Cyan" },
2988 { GD_COLOR_INDEX_PURPLE, "Purple" },
2989 { GD_COLOR_INDEX_GREEN, "Green" },
2990 { GD_COLOR_INDEX_BLUE, "Blue" },
2991 { GD_COLOR_INDEX_YELLOW, "Yellow" },
2992 { GD_COLOR_INDEX_ORANGE, "Orange" },
2993 { GD_COLOR_INDEX_BROWN, "Brown" },
2994 { GD_COLOR_INDEX_LIGHTRED, "Light red" },
2995 { GD_COLOR_INDEX_GRAY1, "Dark gray" },
2996 { GD_COLOR_INDEX_GRAY2, "Gray" },
2997 { GD_COLOR_INDEX_LIGHTGREEN, "Light green" },
2998 { GD_COLOR_INDEX_LIGHTBLUE, "Light blue" },
2999 { GD_COLOR_INDEX_GRAY3, "Light gray" },
3004 static struct ValueTextInfo *action_arg_modes[] =
3006 options_action_mode_none,
3007 options_action_mode_assign,
3008 options_action_mode_add_remove,
3009 options_action_mode_calculate,
3016 struct ValueTextInfo *options;
3018 action_arg_options[] =
3020 { CA_NO_ACTION, 0, options_action_arg_none, },
3021 { CA_EXIT_PLAYER, 0, options_action_arg_player, },
3022 { CA_KILL_PLAYER, 0, options_action_arg_player, },
3023 { CA_MOVE_PLAYER, 0, options_action_arg_direction, },
3024 { CA_MOVE_PLAYER_NEW, 0, options_action_arg_direction, },
3025 { CA_RESTART_LEVEL, 0, options_action_arg_none, },
3026 { CA_SHOW_ENVELOPE, 0, options_action_arg_envelope, },
3027 { CA_SET_LEVEL_TIME, 3, options_action_arg_number, },
3028 { CA_SET_LEVEL_GEMS, 3, options_action_arg_number, },
3029 { CA_SET_LEVEL_SCORE, 3, options_action_arg_number, },
3030 { CA_SET_LEVEL_WIND, 1, options_action_arg_direction, },
3031 { CA_SET_LEVEL_RANDOM_SEED, 1, options_action_arg_number, },
3032 { CA_SET_PLAYER_KEYS, 2, options_action_arg_key, },
3033 { CA_SET_PLAYER_SPEED, 1, options_action_arg_speed, },
3034 { CA_SET_PLAYER_SHIELD, 1, options_action_arg_shield, },
3035 { CA_SET_PLAYER_GRAVITY, 1, options_action_arg_gravity, },
3036 { CA_SET_PLAYER_ARTWORK, 1, options_action_arg_artwork, },
3037 { CA_SET_PLAYER_INVENTORY, 0, options_action_arg_inventory, },
3038 { CA_SET_CE_VALUE, 3, options_action_arg_value, },
3039 { CA_SET_CE_SCORE, 3, options_action_arg_value, },
3040 { CA_SET_CE_ARTWORK, 1, options_action_arg_artwork, },
3041 { CA_SET_ENGINE_SCAN_MODE, 1, options_action_arg_scan_mode, },
3051 int gadget_id_align;
3052 int size; // char size of selectbox or '-1' (dynamically determined)
3053 struct ValueTextInfo *options;
3055 char *text_above, *text_left, *text_right, *infotext;
3056 } selectbox_info[ED_NUM_SELECTBOX] =
3058 // ---------- level and editor settings -------------------------------------
3061 ED_SELECTBOX_ID_TIME_OR_STEPS,
3062 -1, ED_LEVEL_SETTINGS_YPOS(8),
3063 GADGET_ID_TIME_OR_STEPS, GADGET_ID_LEVEL_TIMELIMIT_UP,
3065 options_time_or_steps,
3066 &level.use_step_counter,
3067 NULL, NULL, "(0 => no limit)", "Select time or step limit"
3070 ED_SELECTBOX_ID_TIME_SCORE_BASE,
3071 -1, ED_LEVEL_SETTINGS_YPOS(10),
3072 GADGET_ID_TIME_SCORE_BASE, GADGET_ID_LEVEL_TIMESCORE_UP,
3074 options_time_score_base,
3075 &level.time_score_base,
3076 NULL, NULL, NULL, "Select time score for 1 or 10 seconds/steps"
3079 ED_SELECTBOX_ID_GAME_ENGINE_TYPE,
3080 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(12),
3081 GADGET_ID_GAME_ENGINE_TYPE, GADGET_ID_NONE,
3083 options_game_engine_type,
3084 &level.game_engine_type,
3085 NULL, "Game engine:", NULL, "Select game engine"
3088 ED_SELECTBOX_ID_LEVELSET_SAVE_MODE,
3089 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(10),
3090 GADGET_ID_LEVELSET_SAVE_MODE, GADGET_ID_NONE,
3092 options_levelset_save_mode,
3093 &levelset_save_mode,
3094 "Action:", NULL, NULL, "Select action when saving level set"
3097 // ---------- engine settings: config ---------------------------------------
3100 ED_SELECTBOX_ID_BD_SCHEDULING_TYPE,
3101 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(1),
3102 GADGET_ID_BD_SCHEDULING_TYPE, GADGET_ID_NONE,
3104 options_bd_scheduling_type,
3105 &level.bd_scheduling_type,
3106 NULL, "Scheduling type:", NULL, "Select level timing"
3109 // ---------- engine settings: colors ---------------------------------------
3112 ED_SELECTBOX_ID_BD_COLOR_TYPE,
3113 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(0),
3114 GADGET_ID_BD_COLOR_TYPE, GADGET_ID_NONE,
3116 options_bd_color_type,
3117 &level.bd_color_type,
3118 "Boulder Dash level colors:",
3119 "Color palette type:", NULL, "Select color palette type"
3122 ED_SELECTBOX_ID_BD_COLOR_C64_B,
3123 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(1),
3124 GADGET_ID_BD_COLOR_C64_B, GADGET_ID_NONE,
3126 options_bd_color_c64_name,
3128 NULL, "Border color: ", NULL, "Select border color (not used)"
3131 ED_SELECTBOX_ID_BD_COLOR_C64_0,
3132 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(2),
3133 GADGET_ID_BD_COLOR_C64_0, GADGET_ID_NONE,
3135 options_bd_color_c64_name,
3137 NULL, "Background color: ", NULL, "Select background color (C64 graphics)"
3140 ED_SELECTBOX_ID_BD_COLOR_C64_1,
3141 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(3),
3142 GADGET_ID_BD_COLOR_C64_1, GADGET_ID_NONE,
3144 options_bd_color_c64_name,
3146 NULL, "Sand color: ", NULL, "Select sand color (C64 graphics)"
3149 ED_SELECTBOX_ID_BD_COLOR_C64_2,
3150 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(4),
3151 GADGET_ID_BD_COLOR_C64_2, GADGET_ID_NONE,
3153 options_bd_color_c64_name,
3155 NULL, "Steel wall color: ", NULL, "Select steel wall color (C64 graphics)"
3158 ED_SELECTBOX_ID_BD_COLOR_C64_3,
3159 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(5),
3160 GADGET_ID_BD_COLOR_C64_3, GADGET_ID_NONE,
3162 options_bd_color_c64_name,
3164 NULL, "Wall color: ", NULL, "Select wall color (C64 graphics)"
3167 ED_SELECTBOX_ID_BD_COLOR_C64_4,
3168 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(6),
3169 GADGET_ID_BD_COLOR_C64_4, GADGET_ID_NONE,
3171 options_bd_color_c64_name,
3173 NULL, "Amoeba color: ", NULL, "Select amoeba color (C64 graphics)"
3176 ED_SELECTBOX_ID_BD_COLOR_C64_5,
3177 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(7),
3178 GADGET_ID_BD_COLOR_C64_5, GADGET_ID_NONE,
3180 options_bd_color_c64_name,
3182 NULL, "Slime color: ", NULL, "Select slime color (C64 graphics)"
3185 // ---------- element settings: configure (several elements) ----------------
3188 ED_SELECTBOX_ID_WIND_DIRECTION,
3189 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3190 GADGET_ID_WIND_DIRECTION, GADGET_ID_NONE,
3192 options_wind_direction,
3193 &level.wind_direction_initial,
3194 NULL, "Initial wind direction:", NULL, "Select initial wind direction"
3197 ED_SELECTBOX_ID_PLAYER_SPEED,
3198 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(7),
3199 GADGET_ID_PLAYER_SPEED, GADGET_ID_NONE,
3201 options_player_speed,
3202 &level.initial_player_stepsize[0],
3203 NULL, "Initial player speed:", NULL, "Select initial player speed"
3206 ED_SELECTBOX_ID_BD_GRAVITY_DIRECTION,
3207 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3208 GADGET_ID_BD_GRAVITY_DIRECTION, GADGET_ID_NONE,
3210 options_bd_gravity_direction,
3211 &level.bd_gravity_direction,
3212 NULL, "Gravity direction:", NULL, "Select initial gravity direction"
3215 ED_SELECTBOX_ID_MM_BALL_CHOICE_MODE,
3216 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
3217 GADGET_ID_MM_BALL_CHOICE_MODE, GADGET_ID_NONE,
3219 options_group_choice_mode,
3220 &level.mm_ball_choice_mode,
3221 NULL, "Choice type:", NULL, "Select type of content choice"
3224 // ---------- element settings: configure 1 (custom elements) ---------------
3227 ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE,
3228 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
3229 GADGET_ID_CUSTOM_ACCESS_TYPE, GADGET_ID_NONE,
3231 options_access_type,
3232 &custom_element.access_type,
3233 NULL, NULL, NULL, "Select type of access to this field"
3236 ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER,
3237 -1, ED_ELEMENT_SETTINGS_YPOS(2),
3238 GADGET_ID_CUSTOM_ACCESS_LAYER, GADGET_ID_CUSTOM_ACCESS_TYPE,
3240 options_access_layer,
3241 &custom_element.access_layer,
3242 NULL, NULL, NULL, "Select layer of access for this field"
3245 ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED,
3246 -1, ED_ELEMENT_SETTINGS_YPOS(2),
3247 GADGET_ID_CUSTOM_ACCESS_PROTECTED, GADGET_ID_CUSTOM_ACCESS_LAYER,
3249 options_access_protected,
3250 &custom_element.access_protected,
3251 NULL, NULL, NULL, "Select protected access for this field"
3254 ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION,
3255 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(3),
3256 GADGET_ID_CUSTOM_ACCESS_DIRECTION, GADGET_ID_NONE,
3258 options_access_direction,
3259 &custom_element.access_direction,
3260 NULL, "from", NULL, "Select access direction for this field"
3263 ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION,
3264 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(4),
3265 GADGET_ID_CUSTOM_WALK_TO_ACTION, GADGET_ID_NONE,
3267 options_walk_to_action,
3268 &custom_element.walk_to_action,
3269 NULL, NULL, NULL, "Select diggable/collectible/pushable"
3272 // ---------- element settings: configure 2 (custom elements) ---------------
3275 ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN,
3276 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(1),
3277 GADGET_ID_CUSTOM_MOVE_PATTERN, GADGET_ID_NONE,
3279 options_move_pattern,
3280 &custom_element.move_pattern,
3281 NULL, "Can move", NULL, "Select element move pattern"
3284 ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION,
3285 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
3286 GADGET_ID_CUSTOM_MOVE_DIRECTION, GADGET_ID_NONE,
3288 options_move_direction,
3289 &custom_element.move_direction_initial,
3290 NULL, "Starts moving", NULL, "Select initial element move direction"
3293 ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE,
3294 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(4),
3295 GADGET_ID_CUSTOM_MOVE_STEPSIZE, GADGET_ID_NONE,
3297 options_move_stepsize,
3298 &custom_element.move_stepsize,
3299 NULL, "Move/fall speed", NULL, "Select speed of element movement"
3302 ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE,
3303 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(3),
3304 GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE, GADGET_ID_NONE,
3306 options_move_leave_type,
3307 &custom_element.move_leave_type,
3308 // left text with leading spaces to place gadget next to "can dig" gadget
3309 // (needed because drawing area gadgets created after selectbox gadgets)
3310 // NULL, "can dig: can", ":", "leave behind or change element"
3311 NULL, " Can", ":", "Select leave behind or change element"
3314 ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS,
3315 -1, ED_ELEMENT_SETTINGS_YPOS(8),
3316 GADGET_ID_CUSTOM_SMASH_TARGETS, GADGET_ID_CUSTOM_CAN_SMASH,
3318 options_smash_targets,
3319 &custom_element.smash_targets,
3320 NULL, "Can smash", NULL, "Select elements that can be smashed"
3323 ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE,
3324 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(9),
3325 GADGET_ID_CUSTOM_SLIPPERY_TYPE, GADGET_ID_NONE,
3327 options_slippery_type,
3328 &custom_element.slippery_type,
3329 NULL, "Slippery", NULL, "Select where other elements fall down"
3332 ED_SELECTBOX_ID_CUSTOM_DEADLINESS,
3333 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(10),
3334 GADGET_ID_CUSTOM_DEADLINESS, GADGET_ID_NONE,
3337 &custom_element.deadliness,
3338 NULL, "Deadly when", NULL, "Select deadliness of element"
3341 ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE,
3342 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(11),
3343 GADGET_ID_CUSTOM_EXPLOSION_TYPE, GADGET_ID_NONE,
3345 options_explosion_type,
3346 &custom_element.explosion_type,
3347 NULL, "Can explode", NULL, "Select explosion type"
3350 // ---------- element settings: advanced (custom elements) ------------------
3353 ED_SELECTBOX_ID_CHANGE_TIME_UNITS,
3354 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(3),
3355 GADGET_ID_CHANGE_TIME_UNITS, GADGET_ID_NONE,
3358 &custom_element_change.delay_frames,
3359 NULL, "Delay time given in", NULL, "Select delay time units for change"
3362 ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION,
3363 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(4),
3364 GADGET_ID_CHANGE_DIRECT_ACTION, GADGET_ID_NONE,
3366 options_change_direct_action,
3367 &custom_element_change.direct_action,
3368 NULL, NULL, NULL, "Select type of direct action"
3371 ED_SELECTBOX_ID_CHANGE_OTHER_ACTION,
3372 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(5),
3373 GADGET_ID_CHANGE_OTHER_ACTION, GADGET_ID_NONE,
3375 options_change_other_action,
3376 &custom_element_change.other_action,
3377 NULL, NULL, "element:", "Select type of other element action"
3380 ED_SELECTBOX_ID_CHANGE_SIDE,
3381 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(6),
3382 GADGET_ID_CHANGE_SIDE, GADGET_ID_NONE,
3384 options_change_trigger_side,
3385 &custom_element_change.trigger_side,
3386 NULL, "at", "side", "Select element side triggering change"
3389 ED_SELECTBOX_ID_CHANGE_PLAYER,
3390 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(7),
3391 GADGET_ID_CHANGE_PLAYER, GADGET_ID_NONE,
3393 options_change_trigger_player,
3394 &custom_element_change.trigger_player,
3395 NULL, "Player:", " ", "Select player that causes change"
3398 ED_SELECTBOX_ID_CHANGE_PAGE,
3399 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(7),
3400 GADGET_ID_CHANGE_PAGE, GADGET_ID_CHANGE_PLAYER,
3402 options_change_trigger_page,
3403 &custom_element_change.trigger_page,
3404 NULL, "Page:", NULL, "Select change page that causes change"
3407 ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN,
3408 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(10),
3409 GADGET_ID_CHANGE_REPLACE_WHEN, GADGET_ID_NONE,
3411 options_change_replace_when,
3412 &custom_element_change.replace_when,
3413 NULL, "Replace when", NULL, "Select which elements can be replaced"
3416 ED_SELECTBOX_ID_ACTION_TYPE,
3417 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(13),
3418 GADGET_ID_ACTION_TYPE, GADGET_ID_NONE,
3420 options_action_type,
3421 &custom_element_change.action_type,
3422 NULL, NULL, NULL, "Select action on specified condition"
3425 ED_SELECTBOX_ID_ACTION_MODE,
3426 -1, ED_ELEMENT_SETTINGS_YPOS(13),
3427 GADGET_ID_ACTION_MODE, GADGET_ID_ACTION_TYPE,
3429 options_action_mode_none,
3430 &custom_element_change.action_mode,
3431 NULL, NULL, NULL, "Select action operator"
3434 ED_SELECTBOX_ID_ACTION_ARG,
3435 -1, ED_ELEMENT_SETTINGS_YPOS(13),
3436 GADGET_ID_ACTION_ARG, GADGET_ID_ACTION_MODE,
3438 options_action_arg_none,
3439 &custom_element_change.action_arg,
3440 NULL, NULL, NULL, "Select action parameter"
3443 ED_SELECTBOX_ID_SELECT_CHANGE_PAGE,
3444 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(14),
3445 GADGET_ID_SELECT_CHANGE_PAGE, GADGET_ID_NONE,
3447 options_change_page,
3448 &custom_element.current_change_page,
3449 NULL, NULL, NULL, "Select element change page"
3452 // ---------- element settings: configure (group elements) ------------------
3455 ED_SELECTBOX_ID_GROUP_CHOICE_MODE,
3456 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
3457 GADGET_ID_GROUP_CHOICE_MODE, GADGET_ID_NONE,
3459 options_group_choice_mode,
3460 &group_element_info.choice_mode,
3461 NULL, "Choice type:", NULL, "Select type of group element choice"
3470 int gadget_id_align;
3473 char *text_above, *text_left, *text_right, *infotext;
3474 } textbutton_info[ED_NUM_TEXTBUTTONS] =
3476 // ---------- level and editor settings (tabs) ------------------------------
3479 ED_TEXTBUTTON_ID_LEVELCONFIG_LEVEL,
3480 ED_LEVEL_TABS_XPOS(0), ED_LEVEL_TABS_YPOS(0),
3481 GADGET_ID_LEVELCONFIG_LEVEL, GADGET_ID_NONE,
3483 NULL, NULL, NULL, "Configure level settings"
3486 ED_TEXTBUTTON_ID_LEVELCONFIG_LEVELSET,
3488 GADGET_ID_LEVELCONFIG_LEVELSET, GADGET_ID_LEVELCONFIG_LEVEL,
3490 NULL, NULL, NULL, "Update this or create new level set"
3493 ED_TEXTBUTTON_ID_LEVELCONFIG_EDITOR,
3495 GADGET_ID_LEVELCONFIG_EDITOR, GADGET_ID_LEVELCONFIG_LEVELSET,
3497 NULL, NULL, NULL, "Configure editor settings"
3500 ED_TEXTBUTTON_ID_LEVELCONFIG_ENGINE,
3502 GADGET_ID_LEVELCONFIG_ENGINE, GADGET_ID_LEVELCONFIG_EDITOR,
3504 NULL, NULL, NULL, "Configure game engine settings"
3507 // ---------- engine settings (tabs) ----------------------------------------
3510 ED_TEXTBUTTON_ID_ENGINECONFIG_CONFIG,
3511 ED_ENGINE_TABS_XPOS(0), ED_ENGINE_TABS_YPOS(0),
3512 GADGET_ID_ENGINECONFIG_CONFIG, GADGET_ID_NONE,
3514 NULL, NULL, NULL, "Configure game engine settings"
3517 ED_TEXTBUTTON_ID_ENGINECONFIG_COLORS,
3519 GADGET_ID_ENGINECONFIG_COLORS, GADGET_ID_ENGINECONFIG_CONFIG,
3521 NULL, NULL, NULL, "Configure level colors"
3524 // ---------- element settings (tabs) ---------------------------------------
3527 ED_TEXTBUTTON_ID_PROPERTIES_INFO,
3528 ED_ELEMENT_TABS_XPOS(0), ED_ELEMENT_TABS_YPOS(0),
3529 GADGET_ID_PROPERTIES_INFO, GADGET_ID_NONE,
3531 NULL, NULL, NULL, "Show information about element"
3534 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG,
3536 GADGET_ID_PROPERTIES_CONFIG, GADGET_ID_PROPERTIES_INFO,
3538 NULL, NULL, NULL, "Configure element properties"
3541 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1,
3543 GADGET_ID_PROPERTIES_CONFIG_1, GADGET_ID_PROPERTIES_INFO,
3545 NULL, NULL, NULL, "Configure element properties, part 1"
3548 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2,
3550 GADGET_ID_PROPERTIES_CONFIG_2, GADGET_ID_PROPERTIES_CONFIG_1,
3552 NULL, NULL, NULL, "Configure element properties, part 2"
3555 ED_TEXTBUTTON_ID_PROPERTIES_CHANGE,
3557 GADGET_ID_PROPERTIES_CHANGE, GADGET_ID_PROPERTIES_CONFIG_2,
3559 NULL, NULL, NULL, "Configure custom element change pages"
3562 // ---------- level and editor settings (buttons) ---------------------------
3565 ED_TEXTBUTTON_ID_SAVE_LEVELSET,
3566 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(10),
3567 GADGET_ID_SAVE_LEVELSET, GADGET_ID_LEVELSET_SAVE_MODE,
3569 NULL, NULL, NULL, "Update or create level set"
3572 ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2,
3573 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(6),
3574 GADGET_ID_SAVE_AS_TEMPLATE_2, GADGET_ID_NONE,
3576 NULL, NULL, "this level as level template",
3577 "Save current settings as new template"
3580 // ---------- element settings (buttons) ------------------------------------
3583 ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1,
3585 GADGET_ID_SAVE_AS_TEMPLATE_1, GADGET_ID_CUSTOM_USE_TEMPLATE_1,
3587 NULL, " ", "As Template",
3588 "Save current settings as new template"
3591 ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE,
3593 GADGET_ID_ADD_CHANGE_PAGE, GADGET_ID_PASTE_CHANGE_PAGE,
3595 NULL, NULL, NULL, "Add new change page"
3598 ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE,
3600 GADGET_ID_DEL_CHANGE_PAGE, GADGET_ID_ADD_CHANGE_PAGE,
3602 NULL, NULL, NULL, "Delete current change page"
3605 // ---------- engine settings (buttons) -------------------------------------
3608 ED_TEXTBUTTON_ID_BD_SET_RANDOM_COLORS,
3609 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(8),
3610 GADGET_ID_BD_SET_RANDOM_COLORS, GADGET_ID_NONE,
3611 -1, "Set random colors",
3612 NULL, NULL, NULL, "Create and set random level colors"
3622 int gadget_id_align;
3623 char *text_left, *text_right, *infotext;
3624 } graphicbutton_info[ED_NUM_GRAPHICBUTTONS] =
3627 ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE,
3628 IMG_EDITOR_COUNTER_DOWN,
3629 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(14),
3630 GADGET_ID_PREV_CHANGE_PAGE, GADGET_ID_NONE,
3631 NULL, NULL, "Select previous change page"
3634 ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE,
3635 IMG_EDITOR_COUNTER_UP,
3636 -1, ED_ELEMENT_SETTINGS_YPOS(14),
3637 GADGET_ID_NEXT_CHANGE_PAGE, GADGET_ID_SELECT_CHANGE_PAGE,
3638 NULL, "Change page", "Select next change page"
3641 ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE,
3642 IMG_GFX_EDITOR_BUTTON_CP_COPY,
3643 -1, ED_ELEMENT_SETTINGS_YPOS(14),
3644 GADGET_ID_COPY_CHANGE_PAGE, GADGET_ID_NEXT_CHANGE_PAGE,
3645 " ", NULL, "Copy settings from this change page"
3648 ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE,
3649 IMG_GFX_EDITOR_BUTTON_CP_PASTE,
3650 -1, ED_ELEMENT_SETTINGS_YPOS(14),
3651 GADGET_ID_PASTE_CHANGE_PAGE, GADGET_ID_COPY_CHANGE_PAGE,
3652 NULL, NULL, "Paste settings to this change page"
3659 } scrollbutton_pos[ED_NUM_SCROLLBUTTONS];
3667 } scrollbutton_info[ED_NUM_SCROLLBUTTONS] =
3670 ED_SCROLLBUTTON_ID_AREA_UP,
3671 IMG_EDITOR_PLAYFIELD_SCROLL_UP,
3672 GADGET_ID_SCROLL_UP,
3673 "Scroll level editing area up"
3676 ED_SCROLLBUTTON_ID_AREA_DOWN,
3677 IMG_EDITOR_PLAYFIELD_SCROLL_DOWN,
3678 GADGET_ID_SCROLL_DOWN,
3679 "Scroll level editing area down"
3682 ED_SCROLLBUTTON_ID_AREA_LEFT,
3683 IMG_EDITOR_PLAYFIELD_SCROLL_LEFT,
3684 GADGET_ID_SCROLL_LEFT,
3685 "Scroll level editing area left"
3688 ED_SCROLLBUTTON_ID_AREA_RIGHT,
3689 IMG_EDITOR_PLAYFIELD_SCROLL_RIGHT,
3690 GADGET_ID_SCROLL_RIGHT,
3691 "Scroll level editing area right"
3694 ED_SCROLLBUTTON_ID_LIST_UP,
3695 IMG_EDITOR_PALETTE_SCROLL_UP,
3696 GADGET_ID_SCROLL_LIST_UP,
3697 "Scroll element list up ('Page Up')"
3700 ED_SCROLLBUTTON_ID_LIST_DOWN,
3701 IMG_EDITOR_PALETTE_SCROLL_DOWN,
3702 GADGET_ID_SCROLL_LIST_DOWN,
3703 "Scroll element list down ('Page Down')"
3711 int wheel_x, wheel_y;
3712 int wheel_width, wheel_height;
3713 } scrollbar_pos[ED_NUM_SCROLLBARS];
3722 } scrollbar_info[ED_NUM_SCROLLBARS] =
3725 ED_SCROLLBAR_ID_AREA_HORIZONTAL,
3726 IMG_EDITOR_PLAYFIELD_SCROLLBAR,
3727 GD_TYPE_SCROLLBAR_HORIZONTAL,
3728 GADGET_ID_SCROLL_HORIZONTAL,
3729 "Scroll level editing area horizontally"
3732 ED_SCROLLBAR_ID_AREA_VERTICAL,
3733 IMG_EDITOR_PLAYFIELD_SCROLLBAR,
3734 GD_TYPE_SCROLLBAR_VERTICAL,
3735 GADGET_ID_SCROLL_VERTICAL,
3736 "Scroll level editing area vertically"
3739 ED_SCROLLBAR_ID_LIST_VERTICAL,
3740 IMG_EDITOR_PALETTE_SCROLLBAR,
3741 GD_TYPE_SCROLLBAR_VERTICAL,
3742 GADGET_ID_SCROLL_LIST_VERTICAL,
3743 "Scroll element list vertically"
3753 int gadget_id_align;
3754 int radio_button_nr;
3757 char *text_left, *text_right, *infotext;
3758 } radiobutton_info[ED_NUM_RADIOBUTTONS] =
3761 ED_RADIOBUTTON_ID_PERCENTAGE,
3762 -1, ED_LEVEL_SETTINGS_YPOS(0),
3763 GADGET_ID_RANDOM_PERCENTAGE, GADGET_ID_LEVEL_RANDOM_UP,
3764 RADIO_NR_RANDOM_ELEMENTS,
3765 &random_placement_method, RANDOM_USE_PERCENTAGE,
3766 " ", "percentage", "Use percentage for random elements"
3769 ED_RADIOBUTTON_ID_QUANTITY,
3770 -1, ED_LEVEL_SETTINGS_YPOS(0),
3771 GADGET_ID_RANDOM_QUANTITY, GADGET_ID_RANDOM_PERCENTAGE,
3772 RADIO_NR_RANDOM_ELEMENTS,
3773 &random_placement_method, RANDOM_USE_QUANTITY,
3774 " ", "quantity", "Use quantity for random elements"
3783 int gadget_id_align;
3785 char *text_above, *text_left, *text_right, *infotext;
3786 } checkbutton_info[ED_NUM_CHECKBUTTONS] =
3788 // ---------- level and editor settings -------------------------------------
3791 ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS,
3792 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(6),
3793 GADGET_ID_AUTO_COUNT_GEMS, GADGET_ID_NONE,
3794 &level.auto_count_gems,
3796 "Automatically count gems needed", "Set counter to number of gems"
3799 ED_CHECKBUTTON_ID_RATE_TIME_OVER_SCORE,
3800 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(11),
3801 GADGET_ID_RATE_TIME_OVER_SCORE, GADGET_ID_NONE,
3802 &level.rate_time_over_score,
3804 "Rate time/steps used over score", "Sort high scores by playing time/steps"
3807 ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK,
3808 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(7),
3809 GADGET_ID_USE_LEVELSET_ARTWORK, GADGET_ID_NONE,
3810 &levelset_use_levelset_artwork,
3812 "Use current custom artwork", "Use custom artwork of this level set"
3815 ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE,
3816 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(8),
3817 GADGET_ID_COPY_LEVEL_TEMPLATE, GADGET_ID_NONE,
3818 &levelset_copy_level_template,
3820 "Copy current level template", "Copy level template of this level set"
3823 ED_CHECKBUTTON_ID_RANDOM_RESTRICTED,
3824 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(1),
3825 GADGET_ID_RANDOM_RESTRICTED, GADGET_ID_NONE,
3826 &random_placement_background_restricted,
3828 "Restrict random placement to:", "Set random placement restriction"
3831 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3,
3832 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(4),
3833 GADGET_ID_CUSTOM_USE_TEMPLATE_3, GADGET_ID_NONE,
3834 &setup.editor.use_template_for_new_levels,
3835 "Template for new levels and CE/GE:", NULL,
3836 "Use template for new levels", "Use template for level properties"
3839 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2,
3840 ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(5),
3841 GADGET_ID_CUSTOM_USE_TEMPLATE_2, GADGET_ID_NONE,
3842 &level.use_custom_template,
3844 "Use template for custom elements", "Use template for custom properties"
3847 ED_CHECKBUTTON_ID_BD_INTERMISSION,
3848 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(0),
3849 GADGET_ID_BD_INTERMISSION, GADGET_ID_NONE,
3850 &level.bd_intermission,
3851 "Boulder Dash game engine settings:", NULL,
3852 "Intermission", "Level is an intermission level"
3855 ED_CHECKBUTTON_ID_BD_PAL_TIMING,
3856 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(2),
3857 GADGET_ID_BD_PAL_TIMING, GADGET_ID_NONE,
3858 &level.bd_pal_timing,
3860 "PAL timing", "Use slower timer (like PAL C64)"
3863 ED_CHECKBUTTON_ID_BD_LINE_SHIFTING_BORDERS,
3864 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(6),
3865 GADGET_ID_BD_LINE_SHIFTING_BORDERS, GADGET_ID_NONE,
3866 &level.bd_line_shifting_borders,
3867 "Compatibility settings:", NULL,
3868 "Line-shifting borders", "Use line-shifting wrap-around"
3871 ED_CHECKBUTTON_ID_BD_SCAN_FIRST_AND_LAST_ROW,
3872 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(7),
3873 GADGET_ID_BD_SCAN_FIRST_AND_LAST_ROW, GADGET_ID_NONE,
3874 &level.bd_scan_first_and_last_row,
3876 "Scan first and last row", "Also process top/bottom border rows"
3879 ED_CHECKBUTTON_ID_BD_SHORT_EXPLOSIONS,
3880 ED_ENGINE_SETTINGS_XPOS(0), ED_ENGINE_SETTINGS_YPOS(8),
3881 GADGET_ID_BD_SHORT_EXPLOSIONS, GADGET_ID_NONE,
3882 &level.bd_short_explosions,
3884 "Short explosions", "Use four game cycles for explosions"
3887 // ---------- element settings: configure (various elements) ----------------
3890 ED_CHECKBUTTON_ID_STICK_ELEMENT,
3891 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3892 GADGET_ID_STICK_ELEMENT, GADGET_ID_NONE,
3893 &stick_element_properties_window,
3895 "Stick this screen to edit content", "Stick this screen to edit content"
3898 ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS,
3899 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
3900 GADGET_ID_EM_SLIPPERY_GEMS, GADGET_ID_NONE,
3901 &level.em_slippery_gems,
3903 "Slip down from certain flat walls", "Use EM/DC style slipping behaviour"
3906 ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE,
3907 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
3908 GADGET_ID_EM_EXPLODES_BY_FIRE, GADGET_ID_NONE,
3909 &level.em_explodes_by_fire,
3911 "Explodes with chain reaction", "Use R'n'D style explosion behaviour"
3914 ED_CHECKBUTTON_ID_USE_SPRING_BUG,
3915 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
3916 GADGET_ID_USE_SPRING_BUG, GADGET_ID_NONE,
3917 &level.use_spring_bug,
3919 "Use spring pushing bug", "Use odd spring pushing behaviour"
3922 ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG,
3923 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
3924 GADGET_ID_USE_TIME_ORB_BUG, GADGET_ID_NONE,
3925 &level.use_time_orb_bug,
3927 "Use time orb bug", "Use odd time orb behaviour"
3930 ED_CHECKBUTTON_ID_USE_LIFE_BUGS,
3931 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(5),
3932 GADGET_ID_USE_LIFE_BUGS, GADGET_ID_NONE,
3933 &level.use_life_bugs,
3935 "Use buggy element behaviour", "Use odd (historic) element behaviour"
3938 ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT,
3939 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
3940 GADGET_ID_RANDOM_BALL_CONTENT, GADGET_ID_NONE,
3943 "Create single random element", "Only create one element from content"
3946 ED_CHECKBUTTON_ID_INITIAL_BALL_ACTIVE,
3947 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
3948 GADGET_ID_INITIAL_BALL_ACTIVE, GADGET_ID_NONE,
3949 &level.ball_active_initial,
3951 "Magic ball initially activated", "Activate magic ball after level start"
3954 ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE,
3955 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3956 GADGET_ID_GROW_INTO_DIGGABLE, GADGET_ID_NONE,
3957 &level.grow_into_diggable,
3959 "Can grow into anything diggable", "Grow into more than just sand"
3962 ED_CHECKBUTTON_ID_SB_FIELDS_NEEDED,
3963 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3964 GADGET_ID_SB_FIELDS_NEEDED, GADGET_ID_NONE,
3965 &level.sb_fields_needed,
3967 "All fields need to be filled", "Require all SB fields to be solved"
3970 ED_CHECKBUTTON_ID_SB_OBJECTS_NEEDED,
3971 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
3972 GADGET_ID_SB_OBJECTS_NEEDED, GADGET_ID_NONE,
3973 &level.sb_objects_needed,
3975 "All objects need to be placed", "Require all SB objects to be solved"
3978 ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN,
3979 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
3980 GADGET_ID_AUTO_EXIT_SOKOBAN, GADGET_ID_NONE,
3981 &level.auto_exit_sokoban,
3983 "Exit level if all tasks solved", "Automatically finish Sokoban levels"
3986 ED_CHECKBUTTON_ID_SOLVED_BY_ONE_PLAYER,
3987 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(14),
3988 GADGET_ID_SOLVED_BY_ONE_PLAYER, GADGET_ID_NONE,
3989 &level.solved_by_one_player,
3991 "Only one player must enter exit", "Level solved by first player in exit"
3994 ED_CHECKBUTTON_ID_FINISH_DIG_COLLECT,
3995 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
3996 GADGET_ID_FINISH_DIG_COLLECT, GADGET_ID_NONE,
3997 &level.finish_dig_collect,
3999 "CE action on finished dig/collect", "Only finished dig/collect triggers CE"
4002 ED_CHECKBUTTON_ID_KEEP_WALKABLE_CE,
4003 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
4004 GADGET_ID_KEEP_WALKABLE_CE, GADGET_ID_NONE,
4005 &level.keep_walkable_ce,
4007 "Keep walkable CE changed to player", "Keep CE changing to player if walkable"
4010 ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING,
4011 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
4012 GADGET_ID_CONTINUOUS_SNAPPING, GADGET_ID_NONE,
4013 &level.continuous_snapping,
4015 "Continuous snapping", "Use snapping without releasing key"
4018 ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD,
4019 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(8),
4020 GADGET_ID_BLOCK_SNAP_FIELD, GADGET_ID_NONE,
4021 &level.block_snap_field,
4023 "Block snapped field when snapping", "Use snapping delay to show animation"
4026 ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD,
4027 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4028 GADGET_ID_BLOCK_LAST_FIELD, GADGET_ID_NONE,
4029 &level.block_last_field,
4031 "Block last field when moving", "Player blocks last field when moving"
4034 ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD,
4035 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4036 GADGET_ID_SP_BLOCK_LAST_FIELD, GADGET_ID_NONE,
4037 &level.sp_block_last_field,
4039 "Block last field when moving", "Player blocks last field when moving"
4042 ED_CHECKBUTTON_ID_INSTANT_RELOCATION,
4043 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4044 GADGET_ID_INSTANT_RELOCATION, GADGET_ID_NONE,
4045 &level.instant_relocation,
4047 "No scrolling when relocating", "Player gets relocated without delay"
4050 ED_CHECKBUTTON_ID_SHIFTED_RELOCATION,
4051 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
4052 GADGET_ID_SHIFTED_RELOCATION, GADGET_ID_NONE,
4053 &level.shifted_relocation,
4055 "No centering when relocating", "Level not centered after relocation"
4058 ED_CHECKBUTTON_ID_LAZY_RELOCATION,
4059 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(5),
4060 GADGET_ID_LAZY_RELOCATION, GADGET_ID_NONE,
4061 &level.lazy_relocation,
4063 "Only redraw off-screen relocation", "No redraw if relocation target visible"
4066 ED_CHECKBUTTON_ID_USE_START_ELEMENT,
4067 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
4068 GADGET_ID_USE_START_ELEMENT, GADGET_ID_NONE,
4069 &level.use_start_element[0],
4071 "Use level start element:", "Start level at this element's position"
4074 ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT,
4075 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(11),
4076 GADGET_ID_USE_ARTWORK_ELEMENT, GADGET_ID_NONE,
4077 &level.use_artwork_element[0],
4079 "Use artwork from element:", "Use player artwork from other element"
4082 ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT,
4083 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(12),
4084 GADGET_ID_USE_EXPLOSION_ELEMENT, GADGET_ID_NONE,
4085 &level.use_explosion_element[0],
4087 "Use explosion from element:", "Use explosion properties from element"
4090 ED_CHECKBUTTON_ID_INITIAL_GRAVITY,
4091 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(13),
4092 GADGET_ID_INITIAL_GRAVITY, GADGET_ID_NONE,
4093 &level.initial_player_gravity[0],
4095 "Use initial gravity", "Set initial player gravity"
4098 ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY,
4099 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4100 GADGET_ID_USE_INITIAL_INVENTORY, GADGET_ID_NONE,
4101 &level.use_initial_inventory[0],
4103 "Use initial inventory:", "Use collected elements on level start"
4106 ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE,
4107 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(6),
4108 GADGET_ID_CAN_PASS_TO_WALKABLE, GADGET_ID_NONE,
4109 &level.can_pass_to_walkable,
4111 "Can pass to walkable element", "Player can pass to empty or walkable"
4114 ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID,
4115 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4116 GADGET_ID_CAN_FALL_INTO_ACID, GADGET_ID_NONE,
4117 &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
4119 "Can fall into acid (with gravity)", "Player can fall into acid pool"
4122 ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID,
4123 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4124 GADGET_ID_CAN_MOVE_INTO_ACID, GADGET_ID_NONE,
4125 &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
4127 "Can move into acid", "Element can move into acid pool"
4130 ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH,
4131 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4132 GADGET_ID_DONT_COLLIDE_WITH, GADGET_ID_NONE,
4133 &custom_element_properties[EP_DONT_COLLIDE_WITH],
4135 "Deadly when colliding with", "Element is deadly when hitting player"
4138 ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS,
4139 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4140 GADGET_ID_BD_DIAGONAL_MOVEMENTS, GADGET_ID_NONE,
4141 &level.bd_diagonal_movements,
4143 "Can move diagonally", "Player can move diagonally"
4146 ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
4147 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4148 GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE, GADGET_ID_NONE,
4149 &level.bd_topmost_player_active,
4151 "Topmost player is active", "Use first player found on playfield"
4154 ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
4155 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
4156 GADGET_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET, GADGET_ID_NONE,
4157 &level.bd_push_mega_rock_with_sweet,
4159 "Mega rocks pushable with sweet", "Push mega rocks after eating sweet"
4162 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE,
4163 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4164 GADGET_ID_BD_MAGIC_WALL_ZERO_INFINITE, GADGET_ID_NONE,
4165 &level.bd_magic_wall_zero_infinite,
4167 "Run forever if duration is zero", "Run infinitely if timer is zero"
4170 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
4171 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4172 GADGET_ID_BD_MAGIC_WALL_WAIT_HATCHING, GADGET_ID_NONE,
4173 &level.bd_magic_wall_wait_hatching,
4175 "Wait for player's birth", "Timer start waits for player's birth"
4178 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
4179 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
4180 GADGET_ID_BD_MAGIC_WALL_STOPS_AMOEBA, GADGET_ID_NONE,
4181 &level.bd_magic_wall_stops_amoeba,
4183 "Stop amoeba and turn to diamonds", "Activation changes amoeba to diamonds"
4186 ED_CHECKBUTTON_ID_BD_MAGIC_WALL_BREAK_SCAN,
4187 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(5),
4188 GADGET_ID_BD_MAGIC_WALL_BREAK_SCAN, GADGET_ID_NONE,
4189 &level.bd_magic_wall_break_scan,
4191 "Emulate amoeba bug in BD1", "Use buggy BD1 behavior"
4194 ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
4195 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4196 GADGET_ID_BD_AMOEBA_WAIT_FOR_HATCHING, GADGET_ID_NONE,
4197 &level.bd_amoeba_wait_for_hatching,
4199 "Wait for player's birth", "Timer start waits for player's birth"
4202 ED_CHECKBUTTON_ID_BD_AMOEBA_START_IMMEDIATELY,
4203 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4204 GADGET_ID_BD_AMOEBA_START_IMMEDIATELY, GADGET_ID_NONE,
4205 &level.bd_amoeba_start_immediately,
4207 "Start growing immediately", "Start slow growth time immediately"
4210 ED_CHECKBUTTON_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA,
4211 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
4212 GADGET_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA, GADGET_ID_NONE,
4213 &level.bd_amoeba_2_explode_by_amoeba,
4215 "Explodes if touched by amoeba", "Amoeba 2 explodes if touched by amoeba"
4218 ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS,
4219 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4220 GADGET_ID_BD_VOODOO_COLLECTS_DIAMONDS, GADGET_ID_NONE,
4221 &level.bd_voodoo_collects_diamonds,
4223 "Can collect diamonds", "Can collect diamonds for the player"
4226 ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER,
4227 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4228 GADGET_ID_BD_VOODOO_HURT_KILLS_PLAYER, GADGET_ID_NONE,
4229 &level.bd_voodoo_hurt_kills_player,
4231 "Player is killed if hurt", "If hurt in any way, player is killed"
4234 ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK,
4235 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4236 GADGET_ID_BD_VOODOO_DIES_BY_ROCK, GADGET_ID_NONE,
4237 &level.bd_voodoo_dies_by_rock,
4239 "Killed by falling rock", "Can be killed by a falling rock"
4242 ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
4243 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4244 GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION, GADGET_ID_NONE,
4245 &level.bd_voodoo_vanish_by_explosion,
4247 "Disappears in explosions", "Can be destroyed by explosions"
4250 ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE,
4251 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4252 GADGET_ID_BD_SLIME_IS_PREDICTABLE, GADGET_ID_NONE,
4253 &level.bd_slime_is_predictable,
4255 "Slime is predictable", "Use predictable random numbers"
4258 ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL,
4259 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4260 GADGET_ID_BD_CHANGE_EXPANDING_WALL, GADGET_ID_NONE,
4261 &level.bd_change_expanding_wall,
4263 "Change direction", "Switch horizontal/vertical direction"
4266 ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE,
4267 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4268 GADGET_ID_BD_REPLICATORS_ACTIVE, GADGET_ID_NONE,
4269 &level.bd_replicators_active,
4271 "Active at start", "Replicators start in active state"
4274 ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE,
4275 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4276 GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE, GADGET_ID_NONE,
4277 &level.bd_conveyor_belts_active,
4279 "Active at start", "Conveyor belts start in active state"
4282 ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED,
4283 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4284 GADGET_ID_BD_CONVEYOR_BELTS_CHANGED, GADGET_ID_NONE,
4285 &level.bd_conveyor_belts_changed,
4287 "Change direction", "Switch conveyor belt direction"
4290 ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN,
4291 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4292 GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN, GADGET_ID_NONE,
4293 &level.bd_water_cannot_flow_down,
4295 "Does not flow downwards", "Water can only flow up, left and right"
4298 ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR,
4299 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4300 GADGET_ID_BD_HAMMER_WALLS_REAPPEAR, GADGET_ID_NONE,
4301 &level.bd_hammer_walls_reappear,
4303 "Hammered walls reappear", "Hammered walls reappear after delay"
4306 ED_CHECKBUTTON_ID_BD_INFINITE_ROCKETS,
4307 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4308 GADGET_ID_BD_INFINITE_ROCKETS, GADGET_ID_NONE,
4309 &level.bd_infinite_rockets,
4311 "Infinite rockets", "Rocket launcher has infinite rockets"
4314 ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
4315 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
4316 GADGET_ID_BD_CREATURES_START_BACKWARDS, GADGET_ID_NONE,
4317 &level.bd_creatures_start_backwards,
4319 "Creatures start moving backwards", "Creatures start in opposite direction"
4322 ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING,
4323 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4324 GADGET_ID_BD_CREATURES_TURN_ON_HATCHING, GADGET_ID_NONE,
4325 &level.bd_creatures_turn_on_hatching,
4327 "Creatures auto turn on hatching", "Creatures change direction on hatching"
4330 ED_CHECKBUTTON_ID_BD_GRAVITY_SWITCH_ACTIVE,
4331 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4332 GADGET_ID_BD_GRAVITY_SWITCH_ACTIVE, GADGET_ID_NONE,
4333 &level.bd_gravity_switch_active,
4335 "Gravity switch active at start", "Gravity switch starts in active state"
4338 ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL,
4339 ED_LEVEL_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4340 GADGET_ID_BD_GRAVITY_AFFECTS_ALL, GADGET_ID_NONE,
4341 &level.bd_gravity_affects_all,
4343 "Gravity change affects everything", "Gravity affects all falling objects"
4346 ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
4347 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4348 GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_NONE,
4349 &level.envelope[0].autowrap,
4351 "Auto-wrap", "Automatically wrap envelope text"
4354 ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
4355 -1, ED_ELEMENT_SETTINGS_YPOS(1),
4356 GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_ENVELOPE_AUTOWRAP,
4357 &level.envelope[0].centered,
4359 "Centered", "Automatically center envelope text"
4362 ED_CHECKBUTTON_ID_MM_LASER_RED,
4363 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4364 GADGET_ID_MM_LASER_RED, GADGET_ID_NONE,
4365 &level.mm_laser_red,
4366 "Choose color components for laser:", NULL,
4367 "Red", "Use red color components in laser"
4370 ED_CHECKBUTTON_ID_MM_LASER_GREEN,
4371 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4372 GADGET_ID_MM_LASER_GREEN, GADGET_ID_NONE,
4373 &level.mm_laser_green,
4375 "Green", "Use green color components in laser"
4378 ED_CHECKBUTTON_ID_MM_LASER_BLUE,
4379 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4380 GADGET_ID_MM_LASER_BLUE, GADGET_ID_NONE,
4381 &level.mm_laser_blue,
4383 "Blue", "Use blue color components in laser"
4386 ED_CHECKBUTTON_ID_DF_LASER_RED,
4387 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4388 GADGET_ID_DF_LASER_RED, GADGET_ID_NONE,
4389 &level.df_laser_red,
4390 "Choose color components for laser:", NULL,
4391 "Red", "Use red color components in laser"
4394 ED_CHECKBUTTON_ID_DF_LASER_GREEN,
4395 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4396 GADGET_ID_DF_LASER_GREEN, GADGET_ID_NONE,
4397 &level.df_laser_green,
4399 "Green", "Use green color components in laser"
4402 ED_CHECKBUTTON_ID_DF_LASER_BLUE,
4403 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
4404 GADGET_ID_DF_LASER_BLUE, GADGET_ID_NONE,
4405 &level.df_laser_blue,
4407 "Blue", "Use blue color components in laser"
4410 ED_CHECKBUTTON_ID_ROTATE_MM_BALL_CONTENT,
4411 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(5),
4412 GADGET_ID_ROTATE_MM_BALL_CONTENT, GADGET_ID_NONE,
4413 &level.rotate_mm_ball_content,
4415 "Randomly rotate created content", "Randomly rotate newly created content"
4418 ED_CHECKBUTTON_ID_EXPLODE_MM_BALL,
4419 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(6),
4420 GADGET_ID_EXPLODE_MM_BALL, GADGET_ID_NONE,
4421 &level.explode_mm_ball,
4423 "Explode ball instead of melting", "Use explosion to release ball content"
4426 // ---------- element settings: configure 1 (custom elements) ---------------
4429 ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC,
4430 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4431 GADGET_ID_CUSTOM_USE_GRAPHIC, GADGET_ID_NONE,
4432 &custom_element.use_gfx_element,
4434 "Use graphic of element:", "Use existing element graphic"
4437 ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1,
4438 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(14),
4439 GADGET_ID_CUSTOM_USE_TEMPLATE_1, GADGET_ID_NONE,
4440 &level.use_custom_template,
4442 "Use template", "Use template for custom properties"
4445 ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE,
4446 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(2),
4447 GADGET_ID_CUSTOM_ACCESSIBLE, GADGET_ID_NONE,
4448 &custom_element_properties[EP_ACCESSIBLE],
4450 NULL, "Player can walk to or pass this field"
4453 ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE,
4454 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
4455 GADGET_ID_CUSTOM_GRAV_REACHABLE, GADGET_ID_NONE,
4456 &custom_element_properties[EP_GRAVITY_REACHABLE],
4458 "Reachable despite gravity", "Player can walk/dig despite gravity"
4461 ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE,
4462 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(11),
4463 GADGET_ID_CUSTOM_USE_LAST_VALUE, GADGET_ID_NONE,
4464 &custom_element.use_last_ce_value,
4466 "Use last CE value after change", "Use last CE value after change"
4469 ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT,
4470 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
4471 GADGET_ID_CUSTOM_WALK_TO_OBJECT, GADGET_ID_NONE,
4472 &custom_element_properties[EP_WALK_TO_OBJECT],
4474 NULL, "Player can dig/collect/push element"
4477 ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE,
4478 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(8),
4479 GADGET_ID_CUSTOM_INDESTRUCTIBLE, GADGET_ID_NONE,
4480 &custom_element_properties[EP_INDESTRUCTIBLE],
4482 "Indestructible", "Element is indestructible"
4485 // ---------- element settings: configure 2 (custom elements) ---------------
4488 ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE,
4489 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4490 GADGET_ID_CUSTOM_CAN_MOVE, GADGET_ID_NONE,
4491 &custom_element_properties[EP_CAN_MOVE],
4493 NULL, "Element can move with some pattern"
4496 ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL,
4497 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(8),
4498 GADGET_ID_CUSTOM_CAN_FALL, GADGET_ID_NONE,
4499 &custom_element_properties[EP_CAN_FALL],
4501 "Can fall", "Element can fall down"
4504 ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH,
4505 -1, ED_ELEMENT_SETTINGS_YPOS(8),
4506 GADGET_ID_CUSTOM_CAN_SMASH, GADGET_ID_CUSTOM_CAN_FALL,
4507 &custom_element_properties[EP_CAN_SMASH],
4509 NULL, "Element can smash other elements"
4512 ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY,
4513 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(9),
4514 GADGET_ID_CUSTOM_SLIPPERY, GADGET_ID_NONE,
4515 &custom_element_properties[EP_SLIPPERY],
4517 NULL, "Other elements can fall down from it"
4520 ED_CHECKBUTTON_ID_CUSTOM_DEADLY,
4521 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(10),
4522 GADGET_ID_CUSTOM_DEADLY, GADGET_ID_NONE,
4523 &custom_element_properties[EP_DEADLY],
4525 NULL, "Element can kill the player"
4528 ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE,
4529 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(11),
4530 GADGET_ID_CUSTOM_CAN_EXPLODE, GADGET_ID_NONE,
4531 &custom_element_properties[EP_CAN_EXPLODE],
4533 NULL, "Element can explode"
4536 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE,
4537 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(12),
4538 GADGET_ID_CUSTOM_EXPLODE_FIRE, GADGET_ID_NONE,
4539 &custom_element_properties[EP_EXPLODES_BY_FIRE],
4541 "By fire", "Element can explode by fire/explosion"
4544 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH,
4545 -1, ED_ELEMENT_SETTINGS_YPOS(12),
4546 GADGET_ID_CUSTOM_EXPLODE_SMASH, GADGET_ID_CUSTOM_EXPLODE_FIRE,
4547 &custom_element_properties[EP_EXPLODES_SMASHED],
4549 "Smashed", "Element can explode when smashed"
4552 ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT,
4553 -1, ED_ELEMENT_SETTINGS_YPOS(12),
4554 GADGET_ID_CUSTOM_EXPLODE_IMPACT, GADGET_ID_CUSTOM_EXPLODE_SMASH,
4555 &custom_element_properties[EP_EXPLODES_IMPACT],
4557 "Impact", "Element can explode on impact"
4560 // ---------- element settings: advanced (custom elements) ------------------
4563 ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE,
4564 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
4565 GADGET_ID_CUSTOM_CAN_CHANGE, GADGET_ID_NONE,
4566 &custom_element_change.can_change,
4568 "Element changes to:", "Change element on specified condition"
4571 ED_CHECKBUTTON_ID_CHANGE_DELAY,
4572 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
4573 GADGET_ID_CHANGE_DELAY, GADGET_ID_NONE,
4574 &custom_element_change_events[CE_DELAY],
4576 NULL, "Element changes after delay"
4579 ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT,
4580 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(4),
4581 GADGET_ID_CHANGE_BY_DIRECT_ACT, GADGET_ID_NONE,
4582 &custom_element_change_events[CE_BY_DIRECT_ACTION],
4584 NULL, "Element changes by direct action"
4587 ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT,
4588 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
4589 GADGET_ID_CHANGE_BY_OTHER_ACT, GADGET_ID_NONE,
4590 &custom_element_change_events[CE_BY_OTHER_ACTION],
4592 NULL, "Element changes by other element"
4595 ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION,
4596 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(8),
4597 GADGET_ID_CHANGE_USE_EXPLOSION, GADGET_ID_NONE,
4598 &custom_element_change.explode,
4600 "Explode instead of change", "Element explodes instead of change"
4603 ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT,
4604 ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(9),
4605 GADGET_ID_CHANGE_USE_CONTENT, GADGET_ID_NONE,
4606 &custom_element_change.use_target_content,
4608 "Use extended change target:", "Element changes to more elements"
4611 ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE,
4612 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(11),
4613 GADGET_ID_CHANGE_ONLY_COMPLETE, GADGET_ID_NONE,
4614 &custom_element_change.only_if_complete,
4616 "Replace all or nothing", "Only replace when all can be changed"
4619 ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM,
4620 ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(12),
4621 GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE,
4622 &custom_element_change.use_random_replace,
4624 NULL, "Use percentage for random replace"
4627 ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION,
4628 ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(13),
4629 GADGET_ID_CHANGE_HAS_ACTION, GADGET_ID_NONE,
4630 &custom_element_change.has_action,
4632 NULL, "Execute action on specified condition"
4640 int xoffset, yoffset;
4642 int gadget_id_align;
4644 int area_xsize, area_ysize;
4645 char *text_left, *text_right, *text_above, *text_below, *infotext;
4646 } drawingarea_info[ED_NUM_DRAWING_AREAS] =
4648 // ---------- level playfield content ---------------------------------------
4651 ED_DRAWING_ID_DRAWING_LEVEL,
4654 GADGET_ID_DRAWING_LEVEL, GADGET_ID_NONE,
4656 -1, -1, // these values are not constant, but can change at runtime
4657 NULL, NULL, NULL, NULL, NULL
4660 // ---------- yam yam content -----------------------------------------------
4663 ED_DRAWING_ID_YAMYAM_CONTENT_0,
4664 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4665 ED_AREA_YAMYAM_CONTENT_XOFF(0), ED_AREA_YAMYAM_CONTENT_YOFF(0),
4666 GADGET_ID_YAMYAM_CONTENT_0, GADGET_ID_NONE,
4667 &level.yamyam_content[0].e[0][0], 3, 3,
4668 NULL, NULL, NULL, "1", NULL
4671 ED_DRAWING_ID_YAMYAM_CONTENT_1,
4672 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4673 ED_AREA_YAMYAM_CONTENT_XOFF(1), ED_AREA_YAMYAM_CONTENT_YOFF(1),
4674 GADGET_ID_YAMYAM_CONTENT_1, GADGET_ID_NONE,
4675 &level.yamyam_content[1].e[0][0], 3, 3,
4676 NULL, NULL, NULL, "2", NULL
4679 ED_DRAWING_ID_YAMYAM_CONTENT_2,
4680 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4681 ED_AREA_YAMYAM_CONTENT_XOFF(2), ED_AREA_YAMYAM_CONTENT_YOFF(2),
4682 GADGET_ID_YAMYAM_CONTENT_2, GADGET_ID_NONE,
4683 &level.yamyam_content[2].e[0][0], 3, 3,
4684 NULL, NULL, NULL, "3", NULL
4687 ED_DRAWING_ID_YAMYAM_CONTENT_3,
4688 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4689 ED_AREA_YAMYAM_CONTENT_XOFF(3), ED_AREA_YAMYAM_CONTENT_YOFF(3),
4690 GADGET_ID_YAMYAM_CONTENT_3, GADGET_ID_NONE,
4691 &level.yamyam_content[3].e[0][0], 3, 3,
4692 NULL, NULL, NULL, "4", NULL
4695 ED_DRAWING_ID_YAMYAM_CONTENT_4,
4696 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4697 ED_AREA_YAMYAM_CONTENT_XOFF(4), ED_AREA_YAMYAM_CONTENT_YOFF(4),
4698 GADGET_ID_YAMYAM_CONTENT_4, GADGET_ID_NONE,
4699 &level.yamyam_content[4].e[0][0], 3, 3,
4700 NULL, NULL, NULL, "5", NULL
4703 ED_DRAWING_ID_YAMYAM_CONTENT_5,
4704 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4705 ED_AREA_YAMYAM_CONTENT_XOFF(5), ED_AREA_YAMYAM_CONTENT_YOFF(5),
4706 GADGET_ID_YAMYAM_CONTENT_5, GADGET_ID_NONE,
4707 &level.yamyam_content[5].e[0][0], 3, 3,
4708 NULL, NULL, NULL, "6", NULL
4711 ED_DRAWING_ID_YAMYAM_CONTENT_6,
4712 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4713 ED_AREA_YAMYAM_CONTENT_XOFF(6), ED_AREA_YAMYAM_CONTENT_YOFF(6),
4714 GADGET_ID_YAMYAM_CONTENT_6, GADGET_ID_NONE,
4715 &level.yamyam_content[6].e[0][0], 3, 3,
4716 NULL, NULL, NULL, "7", NULL
4719 ED_DRAWING_ID_YAMYAM_CONTENT_7,
4720 ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
4721 ED_AREA_YAMYAM_CONTENT_XOFF(7), ED_AREA_YAMYAM_CONTENT_YOFF(7),
4722 GADGET_ID_YAMYAM_CONTENT_7, GADGET_ID_NONE,
4723 &level.yamyam_content[7].e[0][0], 3, 3,
4724 NULL, NULL, NULL, "8", NULL
4727 // ---------- magic ball content --------------------------------------------
4730 ED_DRAWING_ID_MAGIC_BALL_CONTENT_0,
4731 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4732 ED_AREA_MAGIC_BALL_CONTENT_XOFF(0), ED_AREA_MAGIC_BALL_CONTENT_YOFF(0),
4733 GADGET_ID_MAGIC_BALL_CONTENT_0, GADGET_ID_NONE,
4734 &level.ball_content[0].e[0][0], 3, 3,
4735 NULL, NULL, NULL, "1", NULL
4738 ED_DRAWING_ID_MAGIC_BALL_CONTENT_1,
4739 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4740 ED_AREA_MAGIC_BALL_CONTENT_XOFF(1), ED_AREA_MAGIC_BALL_CONTENT_YOFF(1),
4741 GADGET_ID_MAGIC_BALL_CONTENT_1, GADGET_ID_NONE,
4742 &level.ball_content[1].e[0][0], 3, 3,
4743 NULL, NULL, NULL, "2", NULL
4746 ED_DRAWING_ID_MAGIC_BALL_CONTENT_2,
4747 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4748 ED_AREA_MAGIC_BALL_CONTENT_XOFF(2), ED_AREA_MAGIC_BALL_CONTENT_YOFF(2),
4749 GADGET_ID_MAGIC_BALL_CONTENT_2, GADGET_ID_NONE,
4750 &level.ball_content[2].e[0][0], 3, 3,
4751 NULL, NULL, NULL, "3", NULL
4754 ED_DRAWING_ID_MAGIC_BALL_CONTENT_3,
4755 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4756 ED_AREA_MAGIC_BALL_CONTENT_XOFF(3), ED_AREA_MAGIC_BALL_CONTENT_YOFF(3),
4757 GADGET_ID_MAGIC_BALL_CONTENT_3, GADGET_ID_NONE,
4758 &level.ball_content[3].e[0][0], 3, 3,
4759 NULL, NULL, NULL, "4", NULL
4762 ED_DRAWING_ID_MAGIC_BALL_CONTENT_4,
4763 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4764 ED_AREA_MAGIC_BALL_CONTENT_XOFF(4), ED_AREA_MAGIC_BALL_CONTENT_YOFF(4),
4765 GADGET_ID_MAGIC_BALL_CONTENT_4, GADGET_ID_NONE,
4766 &level.ball_content[4].e[0][0], 3, 3,
4767 NULL, NULL, NULL, "5", NULL
4770 ED_DRAWING_ID_MAGIC_BALL_CONTENT_5,
4771 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4772 ED_AREA_MAGIC_BALL_CONTENT_XOFF(5), ED_AREA_MAGIC_BALL_CONTENT_YOFF(5),
4773 GADGET_ID_MAGIC_BALL_CONTENT_5, GADGET_ID_NONE,
4774 &level.ball_content[5].e[0][0], 3, 3,
4775 NULL, NULL, NULL, "6", NULL
4778 ED_DRAWING_ID_MAGIC_BALL_CONTENT_6,
4779 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4780 ED_AREA_MAGIC_BALL_CONTENT_XOFF(6), ED_AREA_MAGIC_BALL_CONTENT_YOFF(6),
4781 GADGET_ID_MAGIC_BALL_CONTENT_6, GADGET_ID_NONE,
4782 &level.ball_content[6].e[0][0], 3, 3,
4783 NULL, NULL, NULL, "7", NULL
4786 ED_DRAWING_ID_MAGIC_BALL_CONTENT_7,
4787 ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
4788 ED_AREA_MAGIC_BALL_CONTENT_XOFF(7), ED_AREA_MAGIC_BALL_CONTENT_YOFF(7),
4789 GADGET_ID_MAGIC_BALL_CONTENT_7, GADGET_ID_NONE,
4790 &level.ball_content[7].e[0][0], 3, 3,
4791 NULL, NULL, NULL, "8", NULL
4794 // ---------- android content -----------------------------------------------
4797 ED_DRAWING_ID_ANDROID_CONTENT,
4798 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(6),
4799 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4800 GADGET_ID_ANDROID_CONTENT, GADGET_ID_NONE,
4801 &level.android_clone_element[0], MAX_ANDROID_ELEMENTS, 1,
4802 NULL, NULL, "Elements:", NULL, "Elements android can clone"
4805 // ---------- amoeba content ------------------------------------------------
4808 ED_DRAWING_ID_AMOEBA_CONTENT,
4809 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3),
4810 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4811 GADGET_ID_AMOEBA_CONTENT, GADGET_ID_NONE,
4812 &level.amoeba_content, 1, 1,
4813 "Content:", NULL, NULL, NULL, "Amoeba content"
4816 // ---------- BD snap element -----------------------------------------------
4819 ED_DRAWING_ID_BD_SNAP_ELEMENT,
4820 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(5),
4821 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4822 GADGET_ID_BD_SNAP_ELEMENT, GADGET_ID_NONE,
4823 &level.bd_snap_element, 1, 1,
4824 "Snap element:", NULL, NULL, NULL, "Element created when snapping"
4827 // ---------- BD magic wall elements ----------------------------------------
4830 ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO,
4831 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(6),
4832 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4833 GADGET_ID_BD_MAGIC_WALL_DIAMOND_TO, GADGET_ID_NONE,
4834 &level.bd_magic_wall_diamond_to, 1, 1,
4835 "Changes diamonds to:", NULL, NULL, NULL, "Element to turn diamonds to"
4838 ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO,
4839 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(7),
4840 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4841 GADGET_ID_BD_MAGIC_WALL_ROCK_TO, GADGET_ID_NONE,
4842 &level.bd_magic_wall_rock_to, 1, 1,
4843 "Changes rocks to:", NULL, NULL, NULL, "Element to turn rocks to"
4846 ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
4847 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(8),
4848 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4849 GADGET_ID_BD_MAGIC_WALL_MEGA_ROCK_TO, GADGET_ID_NONE,
4850 &level.bd_magic_wall_mega_rock_to, 1, 1,
4851 "Changes mega rocks to:", NULL, NULL, NULL, "Element to turn mega rocks to"
4854 ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO,
4855 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(9),
4856 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4857 GADGET_ID_BD_MAGIC_WALL_NUT_TO, GADGET_ID_NONE,
4858 &level.bd_magic_wall_nut_to, 1, 1,
4859 "Changes nuts to:", NULL, NULL, NULL, "Element to turn nuts to"
4862 ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
4863 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(10),
4864 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4865 GADGET_ID_BD_MAGIC_WALL_NITRO_PACK_TO, GADGET_ID_NONE,
4866 &level.bd_magic_wall_nitro_pack_to, 1, 1,
4867 "Changes nitro packs to:", NULL, NULL, NULL, "Element to turn nitro packs to"
4870 ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
4871 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(11),
4872 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4873 GADGET_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO, GADGET_ID_NONE,
4874 &level.bd_magic_wall_flying_diamond_to, 1, 1,
4875 "Changes flying diamonds to:", NULL, NULL, NULL, "Element to turn flying diamonds to"
4878 ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
4879 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(12),
4880 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4881 GADGET_ID_BD_MAGIC_WALL_FLYING_ROCK_TO, GADGET_ID_NONE,
4882 &level.bd_magic_wall_flying_rock_to, 1, 1,
4883 "Changes flying rocks to:", NULL, NULL, NULL, "Element to turn flying rocks to"
4886 // ---------- BD amoeba content ---------------------------------------------
4889 ED_DRAWING_ID_BD_AMOEBA_CONTENT_TOO_BIG,
4890 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(7),
4891 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4892 GADGET_ID_BD_AMOEBA_CONTENT_TOO_BIG, GADGET_ID_NONE,
4893 &level.bd_amoeba_content_too_big, 1, 1,
4894 "If too big, changes to:", NULL, NULL, NULL, "BD amoeba content if too big"
4897 ED_DRAWING_ID_BD_AMOEBA_CONTENT_ENCLOSED,
4898 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(8),
4899 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4900 GADGET_ID_BD_AMOEBA_CONTENT_ENCLOSED, GADGET_ID_NONE,
4901 &level.bd_amoeba_content_enclosed, 1, 1,
4902 "If enclosed, changes to:", NULL, NULL, NULL, "BD amoeba content if enclosed"
4905 // ---------- BD amoeba 2 content -------------------------------------------
4908 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_TOO_BIG,
4909 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(7),
4910 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4911 GADGET_ID_BD_AMOEBA_2_CONTENT_TOO_BIG, GADGET_ID_NONE,
4912 &level.bd_amoeba_2_content_too_big, 1, 1,
4913 "If too big, changes to:", NULL, NULL, NULL, "BD amoeba 2 content if too big"
4916 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_ENCLOSED,
4917 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(8),
4918 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4919 GADGET_ID_BD_AMOEBA_2_CONTENT_ENCLOSED, GADGET_ID_NONE,
4920 &level.bd_amoeba_2_content_enclosed, 1, 1,
4921 "If enclosed, changes to:", NULL, NULL, NULL, "BD amoeba 2 content if enclosed"
4924 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_EXPLODING,
4925 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(10),
4926 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4927 GADGET_ID_BD_AMOEBA_2_CONTENT_EXPLODING, GADGET_ID_NONE,
4928 &level.bd_amoeba_2_content_exploding, 1, 1,
4929 "If exploding, changes to:", NULL, NULL, NULL, "BD amoeba 2 content if exploding"
4932 ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE,
4933 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(11),
4934 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4935 GADGET_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE, GADGET_ID_NONE,
4936 &level.bd_amoeba_2_content_looks_like, 1, 1,
4937 "Use graphic of element:", NULL, NULL, NULL, "BD amoeba 2 looks like this element"
4940 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_1,
4941 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(5),
4942 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4943 GADGET_ID_BD_SLIME_EATS_ELEMENT_1, GADGET_ID_NONE,
4944 &level.bd_slime_eats_element_1, 1, 1,
4945 "Can eat:", NULL, NULL, NULL, "Element that can be eaten"
4948 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
4949 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(5),
4950 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4951 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1, GADGET_ID_BD_SLIME_EATS_ELEMENT_1,
4952 &level.bd_slime_converts_to_element_1, 1, 1,
4953 " and convert to:", NULL, NULL, NULL, "Eaten element is converted to"
4956 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2,
4957 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(6),
4958 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4959 GADGET_ID_BD_SLIME_EATS_ELEMENT_2, GADGET_ID_NONE,
4960 &level.bd_slime_eats_element_2, 1, 1,
4961 "Can eat:", NULL, NULL, NULL, "Element that can be eaten"
4964 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
4965 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(6),
4966 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4967 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2, GADGET_ID_BD_SLIME_EATS_ELEMENT_2,
4968 &level.bd_slime_converts_to_element_2, 1, 1,
4969 " and convert to:", NULL, NULL, NULL, "Eaten element is converted to"
4972 ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3,
4973 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(7),
4974 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4975 GADGET_ID_BD_SLIME_EATS_ELEMENT_3, GADGET_ID_NONE,
4976 &level.bd_slime_eats_element_3, 1, 1,
4977 "Can eat:", NULL, NULL, NULL, "Element that can be eaten"
4980 ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
4981 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(7),
4982 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4983 GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3, GADGET_ID_BD_SLIME_EATS_ELEMENT_3,
4984 &level.bd_slime_converts_to_element_3, 1, 1,
4985 " and convert to:", NULL, NULL, NULL, "Eaten element is converted to"
4988 ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
4989 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
4990 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4991 GADGET_ID_BD_ACID_EATS_ELEMENT, GADGET_ID_NONE,
4992 &level.bd_acid_eats_element, 1, 1,
4993 "Can eat:", NULL, NULL, NULL, "Eats this element when spreading"
4996 ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT,
4997 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3),
4998 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
4999 GADGET_ID_BD_ACID_TURNS_TO_ELEMENT, GADGET_ID_NONE,
5000 &level.bd_acid_turns_to_element, 1, 1,
5001 "Can leave behind:", NULL, NULL, NULL, "Turns to this element after spreading"
5004 ED_DRAWING_ID_BD_BITER_EATS_ELEMENT,
5005 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
5006 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5007 GADGET_ID_BD_BITER_EATS_ELEMENT, GADGET_ID_NONE,
5008 &level.bd_biter_eats_element, 1, 1,
5009 "Can eat:", NULL, NULL, NULL, "Eats this element when moving"
5012 ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
5013 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
5014 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5015 GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT, GADGET_ID_NONE,
5016 &level.bd_bladder_converts_by_element, 1, 1,
5017 "Turns to clock by touching:", NULL, NULL, NULL, "Turns to clock by touching element"
5020 ED_DRAWING_ID_BD_NUT_CONTENT,
5021 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
5022 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5023 GADGET_ID_BD_NUT_CONTENT, GADGET_ID_NONE,
5024 &level.bd_nut_content, 1, 1,
5025 "When breaking, changes to:", NULL, NULL, NULL, "Element created when breaking nut"
5028 ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
5029 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
5030 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5031 GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE, GADGET_ID_NONE,
5032 &level.bd_expanding_wall_looks_like, 1, 1,
5033 "Use graphic of element:", NULL, NULL, NULL, "Expanding wall looks like this element"
5036 ED_DRAWING_ID_BD_SAND_LOOKS_LIKE,
5037 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5038 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5039 GADGET_ID_BD_SAND_LOOKS_LIKE, GADGET_ID_NONE,
5040 &level.bd_sand_looks_like, 1, 1,
5041 "Use graphic of element:", NULL, NULL, NULL, "Sand looks like this element"
5044 ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING,
5045 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
5046 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5047 GADGET_ID_BD_ROCK_TURNS_TO_ON_FALLING, GADGET_ID_NONE,
5048 &level.bd_rock_turns_to_on_falling, 1, 1,
5049 "Turns to when falling:", NULL, NULL, NULL, "Changes to this when falling starts"
5052 ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT,
5053 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3),
5054 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5055 GADGET_ID_BD_ROCK_TURNS_TO_ON_IMPACT, GADGET_ID_NONE,
5056 &level.bd_rock_turns_to_on_impact, 1, 1,
5057 "Turns to on impact:", NULL, NULL, NULL, "Changes to this when falling stops"
5060 ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING,
5061 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
5062 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5063 GADGET_ID_BD_DIAMOND_TURNS_TO_ON_FALLING, GADGET_ID_NONE,
5064 &level.bd_diamond_turns_to_on_falling, 1, 1,
5065 "Turns to when falling:", NULL, NULL, NULL, "Changes to this when falling starts"
5068 ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT,
5069 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3),
5070 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5071 GADGET_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT, GADGET_ID_NONE,
5072 &level.bd_diamond_turns_to_on_impact, 1, 1,
5073 "Turns to on impact:", NULL, NULL, NULL, "Changes to this when falling stops"
5076 ED_DRAWING_ID_BD_FIREFLY_EXPLODES_TO,
5077 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5078 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5079 GADGET_ID_BD_FIREFLY_EXPLODES_TO, GADGET_ID_NONE,
5080 &level.bd_firefly_explodes_to, 1, 1,
5081 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5084 ED_DRAWING_ID_BD_FIREFLY_2_EXPLODES_TO,
5085 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5086 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5087 GADGET_ID_BD_FIREFLY_2_EXPLODES_TO, GADGET_ID_NONE,
5088 &level.bd_firefly_2_explodes_to, 1, 1,
5089 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5092 ED_DRAWING_ID_BD_BUTTERFLY_EXPLODES_TO,
5093 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5094 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5095 GADGET_ID_BD_BUTTERFLY_EXPLODES_TO, GADGET_ID_NONE,
5096 &level.bd_butterfly_explodes_to, 1, 1,
5097 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5100 ED_DRAWING_ID_BD_BUTTERFLY_2_EXPLODES_TO,
5101 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5102 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5103 GADGET_ID_BD_BUTTERFLY_2_EXPLODES_TO, GADGET_ID_NONE,
5104 &level.bd_butterfly_2_explodes_to, 1, 1,
5105 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5108 ED_DRAWING_ID_BD_STONEFLY_EXPLODES_TO,
5109 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5110 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5111 GADGET_ID_BD_STONEFLY_EXPLODES_TO, GADGET_ID_NONE,
5112 &level.bd_stonefly_explodes_to, 1, 1,
5113 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5116 ED_DRAWING_ID_BD_DRAGONFLY_EXPLODES_TO,
5117 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5118 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5119 GADGET_ID_BD_DRAGONFLY_EXPLODES_TO, GADGET_ID_NONE,
5120 &level.bd_dragonfly_explodes_to, 1, 1,
5121 "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding"
5124 ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO,
5125 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
5126 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5127 GADGET_ID_BD_DIAMOND_BIRTH_TURNS_TO, GADGET_ID_NONE,
5128 &level.bd_diamond_birth_turns_to, 1, 1,
5129 "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion"
5132 ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO,
5133 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5134 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5135 GADGET_ID_BD_BOMB_EXPLOSION_TURNS_TO, GADGET_ID_NONE,
5136 &level.bd_bomb_explosion_turns_to, 1, 1,
5137 "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion"
5140 ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO,
5141 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0),
5142 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5143 GADGET_ID_BD_NITRO_EXPLOSION_TURNS_TO, GADGET_ID_NONE,
5144 &level.bd_nitro_explosion_turns_to, 1, 1,
5145 "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion"
5148 ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO,
5149 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1),
5150 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5151 GADGET_ID_BD_EXPLOSION_TURNS_TO, GADGET_ID_NONE,
5152 &level.bd_explosion_turns_to, 1, 1,
5153 "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion"
5156 // ---------- level start element -------------------------------------------
5159 ED_DRAWING_ID_START_ELEMENT,
5160 -1, ED_AREA_1X1_SETTINGS_YPOS(10),
5161 0, ED_AREA_1X1_SETTINGS_YOFF,
5162 GADGET_ID_START_ELEMENT, GADGET_ID_USE_START_ELEMENT,
5163 &level.start_element[0], 1, 1,
5164 NULL, NULL, NULL, NULL, "Level start element"
5167 // ---------- player artwork element ----------------------------------------
5170 ED_DRAWING_ID_ARTWORK_ELEMENT,
5171 -1, ED_AREA_1X1_SETTINGS_YPOS(11),
5172 0, ED_AREA_1X1_SETTINGS_YOFF,
5173 GADGET_ID_ARTWORK_ELEMENT, GADGET_ID_USE_ARTWORK_ELEMENT,
5174 &level.artwork_element[0], 1, 1,
5175 NULL, NULL, NULL, NULL, "Element for player artwork"
5178 // ---------- player explosion element --------------------------------------
5181 ED_DRAWING_ID_EXPLOSION_ELEMENT,
5182 -1, ED_AREA_1X1_SETTINGS_YPOS(12),
5183 0, ED_AREA_1X1_SETTINGS_YOFF,
5184 GADGET_ID_EXPLOSION_ELEMENT, GADGET_ID_USE_EXPLOSION_ELEMENT,
5185 &level.explosion_element[0], 1, 1,
5186 NULL, NULL, NULL, NULL, "Element for player explosion"
5189 // ---------- player initial inventory --------------------------------------
5192 ED_DRAWING_ID_INVENTORY_CONTENT,
5193 -1, ED_AREA_1X1_SETTINGS_YPOS(1),
5194 0, ED_AREA_1X1_SETTINGS_YOFF,
5195 GADGET_ID_INVENTORY_CONTENT, GADGET_ID_USE_INITIAL_INVENTORY,
5196 &level.initial_inventory_content[0][0], MAX_INITIAL_INVENTORY_SIZE, 1,
5197 NULL, NULL, NULL, NULL, "Content for initial inventory"
5200 // ---------- gray ball content -----------------------------------------
5203 ED_DRAWING_ID_MM_BALL_CONTENT,
5204 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
5205 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5206 GADGET_ID_MM_BALL_CONTENT, GADGET_ID_NONE,
5207 &level.mm_ball_content[0], MAX_MM_BALL_CONTENTS, 1,
5208 "Content:", NULL, NULL, NULL, "Content for gray ball"
5211 // ---------- element settings: configure 1 (custom elements) ---------------
5213 // ---------- custom graphic ------------------------------------------------
5216 ED_DRAWING_ID_CUSTOM_GRAPHIC,
5217 -1, ED_AREA_1X1_SETTINGS_YPOS(1),
5218 0, ED_AREA_1X1_SETTINGS_YOFF,
5219 GADGET_ID_CUSTOM_GRAPHIC, GADGET_ID_CUSTOM_USE_GRAPHIC,
5220 &custom_element.gfx_element_initial, 1, 1,
5221 NULL, NULL, NULL, NULL, "Custom graphic element"
5224 // ---------- element settings: configure 2 (custom elements) ---------------
5226 // ---------- custom content (when exploding) -------------------------------
5229 ED_DRAWING_ID_CUSTOM_CONTENT,
5230 -1, ED_AREA_3X3_SETTINGS_YPOS(11),
5231 0, ED_AREA_3X3_SETTINGS_YOFF,
5232 GADGET_ID_CUSTOM_CONTENT, GADGET_ID_NONE, // align three rows
5233 &custom_element.content.e[0][0], 3, 3,
5234 "Content:", NULL, NULL, NULL, NULL
5237 // ---------- custom enter and leave element (when moving) ------------------
5240 ED_DRAWING_ID_CUSTOM_MOVE_ENTER,
5241 ED_AREA_1X1_SETTINGS_XPOS(1), ED_AREA_1X1_SETTINGS_YPOS(3),
5242 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5243 GADGET_ID_CUSTOM_MOVE_ENTER, GADGET_ID_NONE,
5244 &custom_element.move_enter_element, 1, 1,
5245 "Can dig:", " ", NULL, NULL, "Element that can be digged/collected"
5248 ED_DRAWING_ID_CUSTOM_MOVE_LEAVE,
5249 -1, ED_AREA_1X1_SETTINGS_YPOS(3),
5250 0, ED_AREA_1X1_SETTINGS_YOFF,
5251 GADGET_ID_CUSTOM_MOVE_LEAVE, GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,
5252 &custom_element.move_leave_element, 1, 1,
5253 NULL, NULL, NULL, NULL, "Element that will be left behind"
5256 // ---------- element settings: advanced (custom elements) ------------------
5258 // ---------- custom change target ------------------------------------------
5261 ED_DRAWING_ID_CUSTOM_CHANGE_TARGET,
5262 -1, ED_AREA_1X1_SETTINGS_YPOS(1),
5263 0, ED_AREA_1X1_SETTINGS_YOFF,
5264 GADGET_ID_CUSTOM_CHANGE_TARGET, GADGET_ID_CUSTOM_CAN_CHANGE,
5265 &custom_element_change.target_element, 1, 1,
5266 NULL, "after/when:", NULL, NULL, "New target element after change"
5269 // ---------- custom change content (extended change target) ----------------
5272 ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT,
5273 -1, ED_AREA_3X3_SETTINGS_YPOS(9),
5274 0, ED_AREA_3X3_SETTINGS_YOFF,
5275 GADGET_ID_CUSTOM_CHANGE_CONTENT, GADGET_ID_NONE, // align three rows
5276 &custom_element_change.target_content.e[0][0], 3, 3,
5277 NULL, NULL, NULL, NULL, "New extended elements after change"
5280 // ---------- custom change trigger (element causing change) ----------------
5283 ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER,
5284 -1, ED_AREA_1X1_SETTINGS_YPOS(5),
5285 0, ED_AREA_1X1_SETTINGS_YOFF,
5286 GADGET_ID_CUSTOM_CHANGE_TRIGGER, GADGET_ID_CHANGE_OTHER_ACTION,
5287 &custom_element_change.initial_trigger_element, 1, 1,
5288 NULL, NULL, NULL, NULL, "Other element triggering change"
5291 // ---------- custom change action (element used for action) ----------------
5294 ED_DRAWING_ID_CUSTOM_CHANGE_ACTION,
5295 -1, ED_AREA_1X1_SETTINGS_YPOS(13),
5296 0, ED_AREA_1X1_SETTINGS_YOFF,
5297 GADGET_ID_CUSTOM_CHANGE_ACTION, GADGET_ID_ACTION_ARG,
5298 &custom_element_change.action_element, 1, 1,
5299 NULL, NULL, NULL, NULL, "Element used as action parameter"
5302 // ---------- group element content -----------------------------------------
5305 ED_DRAWING_ID_GROUP_CONTENT,
5306 ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
5307 ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF,
5308 GADGET_ID_GROUP_CONTENT, GADGET_ID_NONE,
5309 &group_element_info.element[0], MAX_ELEMENTS_IN_GROUP, 1,
5310 "Content:", NULL, NULL, NULL, NULL
5313 // ---------- random background (for random painting) -----------------------
5316 ED_DRAWING_ID_RANDOM_BACKGROUND,
5317 -1, ED_AREA_1X1_LSETTINGS_YPOS(1),
5318 0, ED_AREA_1X1_LSETTINGS_YOFF,
5319 GADGET_ID_RANDOM_BACKGROUND, GADGET_ID_RANDOM_RESTRICTED,
5320 &random_placement_background_element, 1, 1,
5321 NULL, NULL, NULL, NULL, "Random placement background"
5326 // ----------------------------------------------------------------------------
5327 // some internally used variables
5328 // ----------------------------------------------------------------------------
5330 // maximal size of level editor drawing area
5331 static int MAX_ED_FIELDX, MAX_ED_FIELDY;
5333 // actual size of level editor drawing area
5334 static int ed_fieldx, ed_fieldy;
5336 // actual position of level editor drawing area in level playfield
5337 static int level_xpos = -1, level_ypos = -1;
5339 // actual tile size used to display playfield drawing area
5340 static int ed_tilesize = DEFAULT_EDITOR_TILESIZE;
5341 static int ed_tilesize_default = DEFAULT_EDITOR_TILESIZE;
5343 #define IN_ED_FIELD(x, y) IN_FIELD(x, y, ed_fieldx, ed_fieldy)
5345 // drawing elements on the three mouse buttons
5346 static int new_element1 = EL_WALL;
5347 static int new_element2 = EL_EMPTY;
5348 static int new_element3 = EL_SAND;
5350 #define IS_VALID_BUTTON(button) (button >= 1 && button <= 3)
5351 #define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
5352 (button) == 2 ? new_element2 : \
5353 (button) == 3 ? new_element3 : EL_EMPTY)
5355 #define BUTTON_TILE_SIZE(x) ((x) >= TILESIZE ? TILESIZE : MINI_TILESIZE)
5357 static int use_permanent_palette = TRUE;
5359 #define PX (use_permanent_palette ? DX : SX)
5360 #define PY (use_permanent_palette ? DY : SY)
5361 #define PXSIZE (use_permanent_palette ? DXSIZE : SXSIZE)
5362 #define PYSIZE (use_permanent_palette ? DYSIZE : SYSIZE)
5364 // forward declaration for internal use
5365 static void CopyBrushToCursor(int, int);
5366 static void DeleteBrushFromCursor(void);
5367 static void ModifyEditorCounterValue(int, int);
5368 static void ModifyEditorCounterLimits(int, int, int);
5369 static void ModifyEditorSelectboxValue(int, int);
5370 static void ModifyEditorSelectboxOptions(int, struct ValueTextInfo *);
5371 static void ModifyEditorDrawingArea(int, int, int);
5372 static void ModifyEditorElementList(void);
5373 static void AdjustElementListScrollbar(void);
5374 static void RedrawDrawingElements(void);
5375 static void DrawDrawingWindowExt(boolean);
5376 static void DrawDrawingWindow(void);
5377 static void DrawLevelConfigWindow(void);
5378 static void DrawPropertiesWindow(void);
5379 static void DrawPaletteWindow(void);
5380 static void UpdateCustomElementGraphicGadgets(void);
5381 static boolean checkPropertiesConfig(int);
5382 static void SetAutomaticNumberOfGemsNeeded(void);
5383 static void ClearEditorGadgetInfoText(void);
5384 static void CopyLevelToUndoBuffer(int);
5385 static void HandleDrawingAreas(struct GadgetInfo *);
5386 static void HandleCounterButtons(struct GadgetInfo *);
5387 static void HandleTextInputGadgets(struct GadgetInfo *);
5388 static void HandleTextAreaGadgets(struct GadgetInfo *);
5389 static void HandleSelectboxGadgets(struct GadgetInfo *);
5390 static void HandleTextbuttonGadgets(struct GadgetInfo *);
5391 static void HandleGraphicbuttonGadgets(struct GadgetInfo *);
5392 static void HandleRadiobuttons(struct GadgetInfo *);
5393 static void HandleCheckbuttons(struct GadgetInfo *);
5394 static void HandleControlButtons(struct GadgetInfo *);
5395 static void HandleDrawingAreaInfo(struct GadgetInfo *);
5396 static void PrintEditorGadgetInfoText(struct GadgetInfo *);
5397 static boolean AskToCopyAndModifyLevelTemplate(void);
5398 static boolean getDrawModeHiRes(void);
5399 static int getTabulatorBarWidth(void);
5400 static int getTabulatorBarHeight(void);
5401 static Pixel getTabulatorBarColor(void);
5402 static void getEditorGraphicAndFrame(int, int *, int *, boolean);
5403 static int numHiresTiles(int);
5405 static int num_editor_gadgets = 0; // dynamically determined
5407 static struct GadgetInfo **level_editor_gadget = NULL;
5408 static int *right_gadget_border = NULL;
5410 static int drawing_function = GADGET_ID_SINGLE_ITEMS;
5411 static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
5412 static boolean draw_with_brush = FALSE;
5413 static int properties_element = 0;
5415 static short TileBackup[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
5416 static short UndoBuffer[NUM_UNDO_STEPS][MAX_LEV_FIELDX][MAX_LEV_FIELDY];
5417 static short IntelliDrawBuffer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
5418 static int undo_buffer_position = 0;
5419 static int undo_buffer_steps = 0;
5420 static int redo_buffer_steps = 0;
5422 static int edit_mode;
5423 static int edit_mode_levelconfig;
5424 static int edit_mode_engineconfig;
5425 static int edit_mode_properties;
5427 static int element_shift = 0;
5429 static int editor_el_players[] =
5436 static int *editor_el_players_ptr = editor_el_players;
5437 static int num_editor_el_players = ARRAY_SIZE(editor_el_players);
5439 static int editor_hl_boulderdash[] =
5441 EL_INTERNAL_CASCADE_BD_ACTIVE,
5447 static int editor_el_boulderdash[] =
5456 EL_BD_EXPANDABLE_WALL,
5464 EL_BD_BUTTERFLY_LEFT,
5466 EL_BD_BUTTERFLY_RIGHT,
5467 EL_BD_FIREFLY_RIGHT,
5470 EL_BD_BUTTERFLY_DOWN,
5474 static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash;
5475 static int *editor_el_boulderdash_ptr = editor_el_boulderdash;
5476 static int num_editor_hl_boulderdash = ARRAY_SIZE(editor_hl_boulderdash);
5477 static int num_editor_el_boulderdash = ARRAY_SIZE(editor_el_boulderdash);
5479 static int editor_hl_boulderdash_native[] =
5481 EL_INTERNAL_CASCADE_BD_NATIVE_ACTIVE,
5487 static int editor_el_boulderdash_native[] =
5504 EL_BD_BUTTERFLY_LEFT,
5506 EL_BD_BUTTERFLY_RIGHT,
5507 EL_BD_FIREFLY_RIGHT,
5510 EL_BD_BUTTERFLY_DOWN,
5515 EL_BD_BUTTERFLY_2_UP,
5519 EL_BD_BUTTERFLY_2_LEFT,
5520 EL_BD_FIREFLY_2_LEFT,
5521 EL_BD_BUTTERFLY_2_RIGHT,
5522 EL_BD_FIREFLY_2_RIGHT,
5525 EL_BD_BUTTERFLY_2_DOWN,
5526 EL_BD_FIREFLY_2_DOWN,
5527 EL_BD_FLYING_DIAMOND,
5532 EL_BD_DIAMOND_GLUED,
5534 EL_BD_DRAGONFLY_LEFT,
5535 EL_BD_STONEFLY_LEFT,
5536 EL_BD_DRAGONFLY_RIGHT,
5537 EL_BD_STONEFLY_RIGHT,
5540 EL_BD_DRAGONFLY_DOWN,
5541 EL_BD_STONEFLY_DOWN,
5544 EL_BD_BITER_SWITCH_1,
5562 EL_BD_WALL_NON_SLOPED,
5564 EL_BD_SAND_SLOPED_UP_LEFT,
5565 EL_BD_SAND_SLOPED_UP_RIGHT,
5566 EL_BD_WALL_SLOPED_UP_LEFT,
5567 EL_BD_WALL_SLOPED_UP_RIGHT,
5569 EL_BD_SAND_SLOPED_DOWN_LEFT,
5570 EL_BD_SAND_SLOPED_DOWN_RIGHT,
5571 EL_BD_WALL_SLOPED_DOWN_LEFT,
5572 EL_BD_WALL_SLOPED_DOWN_RIGHT,
5576 EL_BD_STEELWALL_SLOPED_UP_LEFT,
5577 EL_BD_STEELWALL_SLOPED_UP_RIGHT,
5581 EL_BD_STEELWALL_SLOPED_DOWN_LEFT,
5582 EL_BD_STEELWALL_SLOPED_DOWN_RIGHT,
5586 EL_BD_INVISIBLE_EXIT_CLOSED,
5587 EL_BD_INVISIBLE_EXIT_OPEN,
5589 EL_BD_STEELWALL_EXPLODABLE,
5590 EL_BD_STEELWALL_DIGGABLE,
5591 EL_BD_WALL_DIGGABLE,
5594 EL_BD_EXPANDABLE_WALL_HORIZONTAL,
5595 EL_BD_EXPANDABLE_WALL_VERTICAL,
5596 EL_BD_EXPANDABLE_WALL_ANY,
5597 EL_BD_EXPANDABLE_WALL_SWITCH,
5599 EL_BD_EXPANDABLE_STEELWALL_HORIZONTAL,
5600 EL_BD_EXPANDABLE_STEELWALL_VERTICAL,
5601 EL_BD_EXPANDABLE_STEELWALL_ANY,
5602 EL_BD_CREATURE_SWITCH,
5605 EL_BD_BLADDER_SPENDER,
5607 EL_BD_REPLICATOR_SWITCH,
5609 EL_BD_CONVEYOR_LEFT,
5610 EL_BD_CONVEYOR_RIGHT,
5611 EL_BD_CONVEYOR_SWITCH,
5612 EL_BD_CONVEYOR_DIR_SWITCH,
5627 EL_BD_TRAPPED_DIAMOND,
5640 EL_BD_GRAVITY_SWITCH,
5641 EL_BD_PNEUMATIC_HAMMER,
5645 EL_BD_PLAYER_WITH_BOMB,
5646 EL_BD_PLAYER_WITH_ROCKET_LAUNCHER,
5647 EL_BD_ROCKET_LAUNCHER,
5650 EL_BD_PLAYER_STIRRING,
5654 static int *editor_hl_boulderdash_native_ptr = editor_hl_boulderdash_native;
5655 static int *editor_el_boulderdash_native_ptr = editor_el_boulderdash_native;
5656 static int num_editor_hl_boulderdash_native = ARRAY_SIZE(editor_hl_boulderdash_native);
5657 static int num_editor_el_boulderdash_native = ARRAY_SIZE(editor_el_boulderdash_native);
5659 static int editor_hl_boulderdash_effects[] =
5661 EL_INTERNAL_CASCADE_BD_EFFECTS_ACTIVE,
5667 static int editor_el_boulderdash_effects[] =
5669 EL_BD_DIAMOND_FALLING,
5671 EL_BD_MEGA_ROCK_FALLING,
5672 EL_BD_FLYING_DIAMOND_FLYING,
5674 EL_BD_FALLING_WALL_FALLING,
5675 EL_BD_NITRO_PACK_FALLING,
5677 EL_BD_FLYING_ROCK_FLYING,
5679 EL_BD_PLAYER_GROWING_1,
5680 EL_BD_PLAYER_GROWING_2,
5681 EL_BD_PLAYER_GROWING_3,
5684 EL_BD_PLAYER_WITH_BOMB,
5685 EL_BD_PLAYER_STIRRING,
5687 EL_BD_INVISIBLE_EXIT_OPEN,
5700 EL_BD_COW_ENCLOSED_1,
5701 EL_BD_COW_ENCLOSED_2,
5702 EL_BD_COW_ENCLOSED_3,
5704 EL_BD_COW_ENCLOSED_4,
5705 EL_BD_COW_ENCLOSED_5,
5706 EL_BD_COW_ENCLOSED_6,
5707 EL_BD_COW_ENCLOSED_7,
5729 EL_BD_BOMB_TICKING_1,
5730 EL_BD_BOMB_TICKING_2,
5731 EL_BD_BOMB_TICKING_3,
5732 EL_BD_BOMB_TICKING_4,
5734 EL_BD_BOMB_TICKING_5,
5735 EL_BD_BOMB_TICKING_6,
5736 EL_BD_BOMB_TICKING_7,
5739 EL_BD_BOMB_EXPLODING_1,
5740 EL_BD_BOMB_EXPLODING_2,
5741 EL_BD_BOMB_EXPLODING_3,
5742 EL_BD_BOMB_EXPLODING_4,
5744 EL_BD_NUT_BREAKING_1,
5745 EL_BD_NUT_BREAKING_2,
5746 EL_BD_NUT_BREAKING_3,
5747 EL_BD_NUT_BREAKING_4,
5756 EL_BD_DIAMOND_GROWING_1,
5757 EL_BD_DIAMOND_GROWING_2,
5759 EL_BD_DIAMOND_GROWING_3,
5760 EL_BD_DIAMOND_GROWING_4,
5761 EL_BD_DIAMOND_GROWING_5,
5762 EL_BD_NITRO_PACK_EXPLODING,
5764 EL_BD_NITRO_PACK_EXPLODING_1,
5765 EL_BD_NITRO_PACK_EXPLODING_2,
5766 EL_BD_NITRO_PACK_EXPLODING_3,
5767 EL_BD_NITRO_PACK_EXPLODING_4,
5769 EL_BD_ROCK_GROWING_1,
5770 EL_BD_ROCK_GROWING_2,
5771 EL_BD_ROCK_GROWING_3,
5772 EL_BD_ROCK_GROWING_4,
5774 EL_BD_STEELWALL_GROWING_1,
5775 EL_BD_STEELWALL_GROWING_2,
5776 EL_BD_STEELWALL_GROWING_3,
5777 EL_BD_STEELWALL_GROWING_4,
5779 EL_BD_CLOCK_GROWING_1,
5780 EL_BD_CLOCK_GROWING_2,
5781 EL_BD_CLOCK_GROWING_3,
5782 EL_BD_CLOCK_GROWING_4,
5784 EL_BD_GHOST_EXPLODING_1,
5785 EL_BD_GHOST_EXPLODING_2,
5786 EL_BD_GHOST_EXPLODING_3,
5787 EL_BD_GHOST_EXPLODING_4,
5789 static int *editor_hl_boulderdash_effects_ptr = editor_hl_boulderdash_effects;
5790 static int *editor_el_boulderdash_effects_ptr = editor_el_boulderdash_effects;
5791 static int num_editor_hl_boulderdash_effects = ARRAY_SIZE(editor_hl_boulderdash_effects);
5792 static int num_editor_el_boulderdash_effects = ARRAY_SIZE(editor_el_boulderdash_effects);
5794 static int editor_hl_emerald_mine[] =
5796 EL_INTERNAL_CASCADE_EM_ACTIVE,
5802 static int editor_el_emerald_mine[] =
5820 EL_EM_DYNAMITE_ACTIVE,
5839 EL_ACID_POOL_TOPLEFT,
5841 EL_ACID_POOL_TOPRIGHT,
5844 EL_ACID_POOL_BOTTOMLEFT,
5845 EL_ACID_POOL_BOTTOM,
5846 EL_ACID_POOL_BOTTOMRIGHT,
5864 static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine;
5865 static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine;
5866 static int num_editor_hl_emerald_mine = ARRAY_SIZE(editor_hl_emerald_mine);
5867 static int num_editor_el_emerald_mine = ARRAY_SIZE(editor_el_emerald_mine);
5869 static int editor_hl_emerald_mine_club[] =
5871 EL_INTERNAL_CASCADE_EMC_ACTIVE,
5877 static int editor_el_emerald_mine_club[] =
5904 EL_EMC_WALL_SLIPPERY_1,
5905 EL_EMC_WALL_SLIPPERY_2,
5906 EL_EMC_WALL_SLIPPERY_3,
5907 EL_EMC_WALL_SLIPPERY_4,
5930 EL_EMC_MAGIC_BALL_SWITCH,
5937 EL_EMC_SPRING_BUMPER,
5941 EL_BALLOON_SWITCH_UP,
5942 EL_BALLOON_SWITCH_ANY,
5945 EL_BALLOON_SWITCH_LEFT,
5947 EL_BALLOON_SWITCH_RIGHT,
5951 EL_BALLOON_SWITCH_DOWN,
5952 EL_BALLOON_SWITCH_NONE,
5954 static int *editor_hl_emerald_mine_club_ptr = editor_hl_emerald_mine_club;
5955 static int *editor_el_emerald_mine_club_ptr = editor_el_emerald_mine_club;
5956 static int num_editor_hl_emerald_mine_club = ARRAY_SIZE(editor_hl_emerald_mine_club);
5957 static int num_editor_el_emerald_mine_club = ARRAY_SIZE(editor_el_emerald_mine_club);
5959 static int editor_hl_rnd[] =
5961 EL_INTERNAL_CASCADE_RND_ACTIVE,
5967 static int editor_el_rnd[] =
5970 EL_DYNAMITE_ACTIVE, // RND
6004 EL_WALL_EMERALD_YELLOW,
6005 EL_WALL_EMERALD_RED,
6006 EL_WALL_EMERALD_PURPLE,
6024 EL_DYNABOMB_INCREASE_NUMBER,
6025 EL_DYNABOMB_INCREASE_SIZE,
6026 EL_DYNABOMB_INCREASE_POWER,
6046 EL_INVISIBLE_STEELWALL,
6050 EL_EXPANDABLE_WALL_HORIZONTAL,
6051 EL_EXPANDABLE_WALL_VERTICAL,
6052 EL_EXPANDABLE_WALL_ANY,
6054 static int *editor_hl_rnd_ptr = editor_hl_rnd;
6055 static int *editor_el_rnd_ptr = editor_el_rnd;
6056 static int num_editor_hl_rnd = ARRAY_SIZE(editor_hl_rnd);
6057 static int num_editor_el_rnd = ARRAY_SIZE(editor_el_rnd);
6059 static int editor_hl_sokoban[] =
6061 EL_INTERNAL_CASCADE_SB_ACTIVE,
6067 static int editor_el_sokoban[] =
6070 EL_SOKOBAN_FIELD_EMPTY,
6071 EL_SOKOBAN_FIELD_FULL,
6072 EL_SOKOBAN_FIELD_PLAYER,
6074 static int *editor_hl_sokoban_ptr = editor_hl_sokoban;
6075 static int *editor_el_sokoban_ptr = editor_el_sokoban;
6076 static int num_editor_hl_sokoban = ARRAY_SIZE(editor_hl_sokoban);
6077 static int num_editor_el_sokoban = ARRAY_SIZE(editor_el_sokoban);
6079 static int editor_hl_supaplex[] =
6081 EL_INTERNAL_CASCADE_SP_ACTIVE,
6087 static int editor_el_supaplex[] =
6105 EL_SP_PORT_HORIZONTAL,
6106 EL_SP_PORT_VERTICAL,
6114 EL_SP_GRAVITY_PORT_LEFT,
6115 EL_SP_GRAVITY_PORT_RIGHT,
6116 EL_SP_GRAVITY_PORT_UP,
6117 EL_SP_GRAVITY_PORT_DOWN,
6119 EL_SP_GRAVITY_ON_PORT_LEFT,
6120 EL_SP_GRAVITY_ON_PORT_RIGHT,
6121 EL_SP_GRAVITY_ON_PORT_UP,
6122 EL_SP_GRAVITY_ON_PORT_DOWN,
6124 EL_SP_GRAVITY_OFF_PORT_LEFT,
6125 EL_SP_GRAVITY_OFF_PORT_RIGHT,
6126 EL_SP_GRAVITY_OFF_PORT_UP,
6127 EL_SP_GRAVITY_OFF_PORT_DOWN,
6129 EL_SP_HARDWARE_GRAY,
6130 EL_SP_HARDWARE_GREEN,
6131 EL_SP_HARDWARE_BLUE,
6134 EL_SP_HARDWARE_BASE_1,
6135 EL_SP_HARDWARE_BASE_2,
6136 EL_SP_HARDWARE_BASE_3,
6137 EL_SP_HARDWARE_BASE_4,
6139 EL_SP_HARDWARE_BASE_5,
6140 EL_SP_HARDWARE_BASE_6,
6141 EL_SP_HARDWARE_YELLOW,
6149 static int *editor_hl_supaplex_ptr = editor_hl_supaplex;
6150 static int *editor_el_supaplex_ptr = editor_el_supaplex;
6151 static int num_editor_hl_supaplex = ARRAY_SIZE(editor_hl_supaplex);
6152 static int num_editor_el_supaplex = ARRAY_SIZE(editor_el_supaplex);
6154 static int editor_hl_diamond_caves[] =
6156 EL_INTERNAL_CASCADE_DC_ACTIVE,
6162 static int editor_el_diamond_caves[] =
6164 EL_EM_STEEL_EXIT_CLOSED, // DC2
6165 EL_EM_STEEL_EXIT_OPEN, // DC2
6166 EL_WALL_EMERALD, // DC2
6167 EL_WALL_DIAMOND, // DC2
6174 EL_CONVEYOR_BELT_1_LEFT,
6175 EL_CONVEYOR_BELT_1_MIDDLE,
6176 EL_CONVEYOR_BELT_1_RIGHT,
6177 EL_CONVEYOR_BELT_1_SWITCH_MIDDLE,
6179 EL_CONVEYOR_BELT_2_LEFT,
6180 EL_CONVEYOR_BELT_2_MIDDLE,
6181 EL_CONVEYOR_BELT_2_RIGHT,
6182 EL_CONVEYOR_BELT_2_SWITCH_MIDDLE,
6184 EL_CONVEYOR_BELT_3_LEFT,
6185 EL_CONVEYOR_BELT_3_MIDDLE,
6186 EL_CONVEYOR_BELT_3_RIGHT,
6187 EL_CONVEYOR_BELT_3_SWITCH_MIDDLE,
6189 EL_CONVEYOR_BELT_4_LEFT,
6190 EL_CONVEYOR_BELT_4_MIDDLE,
6191 EL_CONVEYOR_BELT_4_RIGHT,
6192 EL_CONVEYOR_BELT_4_SWITCH_MIDDLE,
6194 EL_CONVEYOR_BELT_1_SWITCH_LEFT,
6195 EL_CONVEYOR_BELT_2_SWITCH_LEFT,
6196 EL_CONVEYOR_BELT_3_SWITCH_LEFT,
6197 EL_CONVEYOR_BELT_4_SWITCH_LEFT,
6199 EL_CONVEYOR_BELT_1_SWITCH_RIGHT,
6200 EL_CONVEYOR_BELT_2_SWITCH_RIGHT,
6201 EL_CONVEYOR_BELT_3_SWITCH_RIGHT,
6202 EL_CONVEYOR_BELT_4_SWITCH_RIGHT,
6207 EL_DC_TIMEGATE_SWITCH,
6209 EL_SWITCHGATE_CLOSED,
6211 EL_SWITCHGATE_SWITCH_UP,
6212 EL_SWITCHGATE_SWITCH_DOWN,
6215 EL_LIGHT_SWITCH_ACTIVE,
6216 EL_DC_SWITCHGATE_SWITCH_UP,
6217 EL_DC_SWITCHGATE_SWITCH_DOWN,
6219 EL_STEEL_EXIT_CLOSED,
6221 EL_STEELWALL_SLIPPERY,
6224 EL_QUICKSAND_FAST_EMPTY,
6225 EL_QUICKSAND_FAST_FULL,
6239 EL_SIGN_RADIOACTIVITY,
6245 EL_SIGN_ENTRY_FORBIDDEN,
6246 EL_SIGN_EMERGENCY_EXIT,
6271 EL_DC_STEELWALL_2_SINGLE,
6272 EL_DC_STEELWALL_2_TOP,
6273 EL_SIGN_EXCLAMATION,
6276 EL_DC_STEELWALL_2_LEFT,
6277 EL_DC_STEELWALL_2_MIDDLE,
6278 EL_DC_STEELWALL_2_HORIZONTAL,
6279 EL_DC_STEELWALL_2_RIGHT,
6281 EL_DC_STEELWALL_1_TOPLEFT,
6282 EL_DC_STEELWALL_2_VERTICAL,
6283 EL_DC_STEELWALL_1_TOPRIGHT,
6286 EL_DC_STEELWALL_1_VERTICAL,
6287 EL_DC_STEELWALL_2_BOTTOM,
6289 EL_DC_GATE_WHITE_GRAY,
6291 EL_DC_STEELWALL_1_BOTTOMLEFT,
6292 EL_DC_STEELWALL_1_HORIZONTAL,
6293 EL_DC_STEELWALL_1_BOTTOMRIGHT,
6294 EL_DC_GATE_FAKE_GRAY,
6296 EL_DC_STEELWALL_1_BOTTOMRIGHT_2,
6297 EL_DC_STEELWALL_1_BOTTOM,
6298 EL_DC_STEELWALL_1_BOTTOMLEFT_2,
6299 EL_EXPANDABLE_STEELWALL_HORIZONTAL,
6301 EL_DC_STEELWALL_1_RIGHT,
6303 EL_DC_STEELWALL_1_LEFT,
6304 EL_EXPANDABLE_STEELWALL_VERTICAL,
6306 EL_DC_STEELWALL_1_TOPRIGHT_2,
6307 EL_DC_STEELWALL_1_TOP,
6308 EL_DC_STEELWALL_1_TOPLEFT_2,
6309 EL_EXPANDABLE_STEELWALL_ANY,
6311 static int *editor_hl_diamond_caves_ptr = editor_hl_diamond_caves;
6312 static int *editor_el_diamond_caves_ptr = editor_el_diamond_caves;
6313 static int num_editor_hl_diamond_caves = ARRAY_SIZE(editor_hl_diamond_caves);
6314 static int num_editor_el_diamond_caves = ARRAY_SIZE(editor_el_diamond_caves);
6316 static int editor_hl_dx_boulderdash[] =
6318 EL_INTERNAL_CASCADE_DX_ACTIVE,
6324 static int editor_el_dx_boulderdash[] =
6328 EL_TUBE_HORIZONTAL_DOWN,
6332 EL_TUBE_VERTICAL_RIGHT,
6334 EL_TUBE_VERTICAL_LEFT,
6338 EL_TUBE_HORIZONTAL_UP,
6346 static int *editor_hl_dx_boulderdash_ptr = editor_hl_dx_boulderdash;
6347 static int *editor_el_dx_boulderdash_ptr = editor_el_dx_boulderdash;
6348 static int num_editor_hl_dx_boulderdash = ARRAY_SIZE(editor_hl_dx_boulderdash);
6349 static int num_editor_el_dx_boulderdash = ARRAY_SIZE(editor_el_dx_boulderdash);
6351 static int editor_hl_mirror_magic[] =
6353 EL_INTERNAL_CASCADE_MM_ACTIVE,
6359 static int editor_el_mirror_magic[] =
6361 EL_MM_MCDUFFIN_RIGHT,
6363 EL_MM_MCDUFFIN_LEFT,
6364 EL_MM_MCDUFFIN_DOWN,
6367 EL_MM_MIRROR_FIXED_START,
6368 EL_MM_POLARIZER_START,
6369 EL_MM_POLARIZER_CROSS_START,
6371 EL_MM_TELEPORTER_RED_START,
6372 EL_MM_TELEPORTER_YELLOW_START,
6373 EL_MM_TELEPORTER_GREEN_START,
6374 EL_MM_TELEPORTER_BLUE_START,
6387 EL_MM_LIGHTBULB_ACTIVE,
6401 EL_MM_STEEL_GRID_FIXED_1,
6402 EL_MM_STEEL_GRID_FIXED_2,
6403 EL_MM_STEEL_GRID_FIXED_3,
6404 EL_MM_STEEL_GRID_FIXED_4,
6406 EL_MM_WOODEN_GRID_FIXED_1,
6407 EL_MM_WOODEN_GRID_FIXED_2,
6408 EL_MM_WOODEN_GRID_FIXED_3,
6409 EL_MM_WOODEN_GRID_FIXED_4,
6416 static int *editor_hl_mirror_magic_ptr = editor_hl_mirror_magic;
6417 static int *editor_el_mirror_magic_ptr = editor_el_mirror_magic;
6418 static int num_editor_hl_mirror_magic = ARRAY_SIZE(editor_hl_mirror_magic);
6419 static int num_editor_el_mirror_magic = ARRAY_SIZE(editor_el_mirror_magic);
6421 static int editor_hl_deflektor[] =
6423 EL_INTERNAL_CASCADE_DF_ACTIVE,
6429 static int editor_el_deflektor[] =
6436 EL_DF_RECEIVER_RIGHT,
6438 EL_DF_RECEIVER_LEFT,
6439 EL_DF_RECEIVER_DOWN,
6442 EL_DF_MIRROR_ROTATING_START,
6443 EL_DF_MIRROR_FIXED_START,
6446 EL_DF_FIBRE_OPTIC_RED_1,
6447 EL_DF_FIBRE_OPTIC_YELLOW_1,
6448 EL_DF_FIBRE_OPTIC_GREEN_1,
6449 EL_DF_FIBRE_OPTIC_BLUE_1,
6451 EL_DF_STEEL_GRID_FIXED_START,
6452 EL_DF_STEEL_GRID_ROTATING_START,
6453 EL_DF_WOODEN_GRID_FIXED_START,
6454 EL_DF_WOODEN_GRID_ROTATING_START,
6466 static int *editor_hl_deflektor_ptr = editor_hl_deflektor;
6467 static int *editor_el_deflektor_ptr = editor_el_deflektor;
6468 static int num_editor_hl_deflektor = ARRAY_SIZE(editor_hl_deflektor);
6469 static int num_editor_el_deflektor = ARRAY_SIZE(editor_el_deflektor);
6471 static int editor_hl_chars[] =
6473 EL_INTERNAL_CASCADE_CHARS_ACTIVE,
6479 static int editor_el_chars[] =
6561 EL_CHAR(CHAR_BYTE_COPYRIGHT),
6562 EL_CHAR(CHAR_BYTE_UMLAUT_A),
6563 EL_CHAR(CHAR_BYTE_UMLAUT_O),
6564 EL_CHAR(CHAR_BYTE_UMLAUT_U),
6566 EL_CHAR(CHAR_BYTE_DEGREE),
6567 EL_CHAR(CHAR_BYTE_REGISTERED),
6568 EL_CHAR(FONT_ASCII_CURSOR),
6569 EL_CHAR(FONT_ASCII_BUTTON),
6571 EL_CHAR(FONT_ASCII_UP),
6572 EL_CHAR(FONT_ASCII_DOWN),
6576 static int *editor_hl_chars_ptr = editor_hl_chars;
6577 static int *editor_el_chars_ptr = editor_el_chars;
6578 static int num_editor_hl_chars = ARRAY_SIZE(editor_hl_chars);
6579 static int num_editor_el_chars = ARRAY_SIZE(editor_el_chars);
6581 static int editor_hl_steel_chars[] =
6583 EL_INTERNAL_CASCADE_STEEL_CHARS_ACTIVE,
6589 static int editor_el_steel_chars[] =
6599 EL_STEEL_CHAR('\''),
6666 EL_STEEL_CHAR('\\'),
6671 EL_STEEL_CHAR(CHAR_BYTE_COPYRIGHT),
6672 EL_STEEL_CHAR(CHAR_BYTE_UMLAUT_A),
6673 EL_STEEL_CHAR(CHAR_BYTE_UMLAUT_O),
6674 EL_STEEL_CHAR(CHAR_BYTE_UMLAUT_U),
6676 EL_STEEL_CHAR(CHAR_BYTE_DEGREE),
6677 EL_STEEL_CHAR(CHAR_BYTE_REGISTERED),
6678 EL_STEEL_CHAR(FONT_ASCII_CURSOR),
6679 EL_STEEL_CHAR(FONT_ASCII_BUTTON),
6681 EL_STEEL_CHAR(FONT_ASCII_UP),
6682 EL_STEEL_CHAR(FONT_ASCII_DOWN),
6686 static int *editor_hl_steel_chars_ptr = editor_hl_steel_chars;
6687 static int *editor_el_steel_chars_ptr = editor_el_steel_chars;
6688 static int num_editor_hl_steel_chars = ARRAY_SIZE(editor_hl_steel_chars);
6689 static int num_editor_el_steel_chars = ARRAY_SIZE(editor_el_steel_chars);
6691 static int editor_hl_custom[] =
6693 EL_INTERNAL_CASCADE_CE_ACTIVE,
6699 static int editor_el_custom[] =
6701 EL_CUSTOM_START + 0,
6702 EL_CUSTOM_START + 1,
6703 EL_CUSTOM_START + 2,
6704 EL_CUSTOM_START + 3,
6706 EL_CUSTOM_START + 4,
6707 EL_CUSTOM_START + 5,
6708 EL_CUSTOM_START + 6,
6709 EL_CUSTOM_START + 7,
6711 EL_CUSTOM_START + 8,
6712 EL_CUSTOM_START + 9,
6713 EL_CUSTOM_START + 10,
6714 EL_CUSTOM_START + 11,
6716 EL_CUSTOM_START + 12,
6717 EL_CUSTOM_START + 13,
6718 EL_CUSTOM_START + 14,
6719 EL_CUSTOM_START + 15,
6721 EL_CUSTOM_START + 16,
6722 EL_CUSTOM_START + 17,
6723 EL_CUSTOM_START + 18,
6724 EL_CUSTOM_START + 19,
6726 EL_CUSTOM_START + 20,
6727 EL_CUSTOM_START + 21,
6728 EL_CUSTOM_START + 22,
6729 EL_CUSTOM_START + 23,
6731 EL_CUSTOM_START + 24,
6732 EL_CUSTOM_START + 25,
6733 EL_CUSTOM_START + 26,
6734 EL_CUSTOM_START + 27,
6736 EL_CUSTOM_START + 28,
6737 EL_CUSTOM_START + 29,
6738 EL_CUSTOM_START + 30,
6739 EL_CUSTOM_START + 31,
6741 EL_CUSTOM_START + 32,
6742 EL_CUSTOM_START + 33,
6743 EL_CUSTOM_START + 34,
6744 EL_CUSTOM_START + 35,
6746 EL_CUSTOM_START + 36,
6747 EL_CUSTOM_START + 37,
6748 EL_CUSTOM_START + 38,
6749 EL_CUSTOM_START + 39,
6751 EL_CUSTOM_START + 40,
6752 EL_CUSTOM_START + 41,
6753 EL_CUSTOM_START + 42,
6754 EL_CUSTOM_START + 43,
6756 EL_CUSTOM_START + 44,
6757 EL_CUSTOM_START + 45,
6758 EL_CUSTOM_START + 46,
6759 EL_CUSTOM_START + 47,
6761 EL_CUSTOM_START + 48,
6762 EL_CUSTOM_START + 49,
6763 EL_CUSTOM_START + 50,
6764 EL_CUSTOM_START + 51,
6766 EL_CUSTOM_START + 52,
6767 EL_CUSTOM_START + 53,
6768 EL_CUSTOM_START + 54,
6769 EL_CUSTOM_START + 55,
6771 EL_CUSTOM_START + 56,
6772 EL_CUSTOM_START + 57,
6773 EL_CUSTOM_START + 58,
6774 EL_CUSTOM_START + 59,
6776 EL_CUSTOM_START + 60,
6777 EL_CUSTOM_START + 61,
6778 EL_CUSTOM_START + 62,
6779 EL_CUSTOM_START + 63,
6781 EL_CUSTOM_START + 64,
6782 EL_CUSTOM_START + 65,
6783 EL_CUSTOM_START + 66,
6784 EL_CUSTOM_START + 67,
6786 EL_CUSTOM_START + 68,
6787 EL_CUSTOM_START + 69,
6788 EL_CUSTOM_START + 70,
6789 EL_CUSTOM_START + 71,
6791 EL_CUSTOM_START + 72,
6792 EL_CUSTOM_START + 73,
6793 EL_CUSTOM_START + 74,
6794 EL_CUSTOM_START + 75,
6796 EL_CUSTOM_START + 76,
6797 EL_CUSTOM_START + 77,
6798 EL_CUSTOM_START + 78,
6799 EL_CUSTOM_START + 79,
6801 EL_CUSTOM_START + 80,
6802 EL_CUSTOM_START + 81,
6803 EL_CUSTOM_START + 82,
6804 EL_CUSTOM_START + 83,
6806 EL_CUSTOM_START + 84,
6807 EL_CUSTOM_START + 85,
6808 EL_CUSTOM_START + 86,
6809 EL_CUSTOM_START + 87,
6811 EL_CUSTOM_START + 88,
6812 EL_CUSTOM_START + 89,
6813 EL_CUSTOM_START + 90,
6814 EL_CUSTOM_START + 91,
6816 EL_CUSTOM_START + 92,
6817 EL_CUSTOM_START + 93,
6818 EL_CUSTOM_START + 94,
6819 EL_CUSTOM_START + 95,
6821 EL_CUSTOM_START + 96,
6822 EL_CUSTOM_START + 97,
6823 EL_CUSTOM_START + 98,
6824 EL_CUSTOM_START + 99,
6826 EL_CUSTOM_START + 100,
6827 EL_CUSTOM_START + 101,
6828 EL_CUSTOM_START + 102,
6829 EL_CUSTOM_START + 103,
6831 EL_CUSTOM_START + 104,
6832 EL_CUSTOM_START + 105,
6833 EL_CUSTOM_START + 106,
6834 EL_CUSTOM_START + 107,
6836 EL_CUSTOM_START + 108,
6837 EL_CUSTOM_START + 109,
6838 EL_CUSTOM_START + 110,
6839 EL_CUSTOM_START + 111,
6841 EL_CUSTOM_START + 112,
6842 EL_CUSTOM_START + 113,
6843 EL_CUSTOM_START + 114,
6844 EL_CUSTOM_START + 115,
6846 EL_CUSTOM_START + 116,
6847 EL_CUSTOM_START + 117,
6848 EL_CUSTOM_START + 118,
6849 EL_CUSTOM_START + 119,
6851 EL_CUSTOM_START + 120,
6852 EL_CUSTOM_START + 121,
6853 EL_CUSTOM_START + 122,
6854 EL_CUSTOM_START + 123,
6856 EL_CUSTOM_START + 124,
6857 EL_CUSTOM_START + 125,
6858 EL_CUSTOM_START + 126,
6859 EL_CUSTOM_START + 127,
6861 EL_CUSTOM_START + 128,
6862 EL_CUSTOM_START + 129,
6863 EL_CUSTOM_START + 130,
6864 EL_CUSTOM_START + 131,
6866 EL_CUSTOM_START + 132,
6867 EL_CUSTOM_START + 133,
6868 EL_CUSTOM_START + 134,
6869 EL_CUSTOM_START + 135,
6871 EL_CUSTOM_START + 136,
6872 EL_CUSTOM_START + 137,
6873 EL_CUSTOM_START + 138,
6874 EL_CUSTOM_START + 139,
6876 EL_CUSTOM_START + 140,
6877 EL_CUSTOM_START + 141,
6878 EL_CUSTOM_START + 142,
6879 EL_CUSTOM_START + 143,
6881 EL_CUSTOM_START + 144,
6882 EL_CUSTOM_START + 145,
6883 EL_CUSTOM_START + 146,
6884 EL_CUSTOM_START + 147,
6886 EL_CUSTOM_START + 148,
6887 EL_CUSTOM_START + 149,
6888 EL_CUSTOM_START + 150,
6889 EL_CUSTOM_START + 151,
6891 EL_CUSTOM_START + 152,
6892 EL_CUSTOM_START + 153,
6893 EL_CUSTOM_START + 154,
6894 EL_CUSTOM_START + 155,
6896 EL_CUSTOM_START + 156,
6897 EL_CUSTOM_START + 157,
6898 EL_CUSTOM_START + 158,
6899 EL_CUSTOM_START + 159,
6901 EL_CUSTOM_START + 160,
6902 EL_CUSTOM_START + 161,
6903 EL_CUSTOM_START + 162,
6904 EL_CUSTOM_START + 163,
6906 EL_CUSTOM_START + 164,
6907 EL_CUSTOM_START + 165,
6908 EL_CUSTOM_START + 166,
6909 EL_CUSTOM_START + 167,
6911 EL_CUSTOM_START + 168,
6912 EL_CUSTOM_START + 169,
6913 EL_CUSTOM_START + 170,
6914 EL_CUSTOM_START + 171,
6916 EL_CUSTOM_START + 172,
6917 EL_CUSTOM_START + 173,
6918 EL_CUSTOM_START + 174,
6919 EL_CUSTOM_START + 175,
6921 EL_CUSTOM_START + 176,
6922 EL_CUSTOM_START + 177,
6923 EL_CUSTOM_START + 178,
6924 EL_CUSTOM_START + 179,
6926 EL_CUSTOM_START + 180,
6927 EL_CUSTOM_START + 181,
6928 EL_CUSTOM_START + 182,
6929 EL_CUSTOM_START + 183,
6931 EL_CUSTOM_START + 184,
6932 EL_CUSTOM_START + 185,
6933 EL_CUSTOM_START + 186,
6934 EL_CUSTOM_START + 187,
6936 EL_CUSTOM_START + 188,
6937 EL_CUSTOM_START + 189,
6938 EL_CUSTOM_START + 190,
6939 EL_CUSTOM_START + 191,
6941 EL_CUSTOM_START + 192,
6942 EL_CUSTOM_START + 193,
6943 EL_CUSTOM_START + 194,
6944 EL_CUSTOM_START + 195,
6946 EL_CUSTOM_START + 196,
6947 EL_CUSTOM_START + 197,
6948 EL_CUSTOM_START + 198,
6949 EL_CUSTOM_START + 199,
6951 EL_CUSTOM_START + 200,
6952 EL_CUSTOM_START + 201,
6953 EL_CUSTOM_START + 202,
6954 EL_CUSTOM_START + 203,
6956 EL_CUSTOM_START + 204,
6957 EL_CUSTOM_START + 205,
6958 EL_CUSTOM_START + 206,
6959 EL_CUSTOM_START + 207,
6961 EL_CUSTOM_START + 208,
6962 EL_CUSTOM_START + 209,
6963 EL_CUSTOM_START + 210,
6964 EL_CUSTOM_START + 211,
6966 EL_CUSTOM_START + 212,
6967 EL_CUSTOM_START + 213,
6968 EL_CUSTOM_START + 214,
6969 EL_CUSTOM_START + 215,
6971 EL_CUSTOM_START + 216,
6972 EL_CUSTOM_START + 217,
6973 EL_CUSTOM_START + 218,
6974 EL_CUSTOM_START + 219,
6976 EL_CUSTOM_START + 220,
6977 EL_CUSTOM_START + 221,
6978 EL_CUSTOM_START + 222,
6979 EL_CUSTOM_START + 223,
6981 EL_CUSTOM_START + 224,
6982 EL_CUSTOM_START + 225,
6983 EL_CUSTOM_START + 226,
6984 EL_CUSTOM_START + 227,
6986 EL_CUSTOM_START + 228,
6987 EL_CUSTOM_START + 229,
6988 EL_CUSTOM_START + 230,
6989 EL_CUSTOM_START + 231,
6991 EL_CUSTOM_START + 232,
6992 EL_CUSTOM_START + 233,
6993 EL_CUSTOM_START + 234,
6994 EL_CUSTOM_START + 235,
6996 EL_CUSTOM_START + 236,
6997 EL_CUSTOM_START + 237,
6998 EL_CUSTOM_START + 238,
6999 EL_CUSTOM_START + 239,
7001 EL_CUSTOM_START + 240,
7002 EL_CUSTOM_START + 241,
7003 EL_CUSTOM_START + 242,
7004 EL_CUSTOM_START + 243,
7006 EL_CUSTOM_START + 244,
7007 EL_CUSTOM_START + 245,
7008 EL_CUSTOM_START + 246,
7009 EL_CUSTOM_START + 247,
7011 EL_CUSTOM_START + 248,
7012 EL_CUSTOM_START + 249,
7013 EL_CUSTOM_START + 250,
7014 EL_CUSTOM_START + 251,
7016 EL_CUSTOM_START + 252,
7017 EL_CUSTOM_START + 253,
7018 EL_CUSTOM_START + 254,
7019 EL_CUSTOM_START + 255
7021 static int *editor_hl_custom_ptr = editor_hl_custom;
7022 static int *editor_el_custom_ptr = editor_el_custom;
7023 static int num_editor_hl_custom = ARRAY_SIZE(editor_hl_custom);
7024 static int num_editor_el_custom = ARRAY_SIZE(editor_el_custom);
7026 static int editor_hl_group[] =
7028 EL_INTERNAL_CASCADE_GE_ACTIVE,
7034 static int editor_el_group[] =
7048 EL_GROUP_START + 10,
7049 EL_GROUP_START + 11,
7051 EL_GROUP_START + 12,
7052 EL_GROUP_START + 13,
7053 EL_GROUP_START + 14,
7054 EL_GROUP_START + 15,
7056 EL_GROUP_START + 16,
7057 EL_GROUP_START + 17,
7058 EL_GROUP_START + 18,
7059 EL_GROUP_START + 19,
7061 EL_GROUP_START + 20,
7062 EL_GROUP_START + 21,
7063 EL_GROUP_START + 22,
7064 EL_GROUP_START + 23,
7066 EL_GROUP_START + 24,
7067 EL_GROUP_START + 25,
7068 EL_GROUP_START + 26,
7069 EL_GROUP_START + 27,
7071 EL_GROUP_START + 28,
7072 EL_GROUP_START + 29,
7073 EL_GROUP_START + 30,
7076 static int *editor_hl_group_ptr = editor_hl_group;
7077 static int *editor_el_group_ptr = editor_el_group;
7078 static int num_editor_hl_group = ARRAY_SIZE(editor_hl_group);
7079 static int num_editor_el_group = ARRAY_SIZE(editor_el_group);
7081 static int editor_hl_empty_space[] =
7083 EL_INTERNAL_CASCADE_ES_ACTIVE,
7089 static int editor_el_empty_space[] =
7111 static int *editor_hl_empty_space_ptr = editor_hl_empty_space;
7112 static int *editor_el_empty_space_ptr = editor_el_empty_space;
7113 static int num_editor_hl_empty_space = ARRAY_SIZE(editor_hl_empty_space);
7114 static int num_editor_el_empty_space = ARRAY_SIZE(editor_el_empty_space);
7116 static int editor_hl_reference[] =
7118 EL_INTERNAL_CASCADE_REF_ACTIVE,
7124 static int editor_el_reference[] =
7128 EL_TRIGGER_CE_VALUE,
7129 EL_TRIGGER_CE_SCORE,
7133 EL_CURRENT_CE_VALUE,
7134 EL_CURRENT_CE_SCORE,
7156 static int *editor_hl_reference_ptr = editor_hl_reference;
7157 static int *editor_el_reference_ptr = editor_el_reference;
7158 static int num_editor_hl_reference = ARRAY_SIZE(editor_hl_reference);
7159 static int num_editor_el_reference = ARRAY_SIZE(editor_el_reference);
7161 static int editor_hl_user_defined[] =
7163 EL_INTERNAL_CASCADE_USER_ACTIVE,
7169 static int *editor_hl_user_defined_ptr = editor_hl_user_defined;
7170 static int *editor_el_user_defined_ptr = NULL;
7171 static int num_editor_hl_user_defined = ARRAY_SIZE(editor_hl_user_defined);
7172 static int num_editor_el_user_defined = 0;
7174 static int editor_hl_dynamic[] =
7176 EL_INTERNAL_CASCADE_DYNAMIC_ACTIVE,
7182 static int *editor_hl_dynamic_ptr = editor_hl_dynamic;
7183 static int *editor_el_dynamic_ptr = NULL;
7184 static int num_editor_hl_dynamic = ARRAY_SIZE(editor_hl_dynamic);
7185 static int num_editor_el_dynamic = 0;
7187 static int editor_hl_empty[] = { EL_EMPTY };
7188 static int *editor_el_empty = NULL; // dynamically allocated
7190 static int *editor_hl_empty_ptr = editor_hl_empty;
7191 static int *editor_el_empty_ptr = NULL;
7192 static int num_editor_hl_empty = 0;
7193 static int num_editor_el_empty = 0; // dynamically determined, if needed
7195 static boolean use_el_empty = FALSE;
7197 static int *editor_elements = NULL; // dynamically allocated
7198 static int num_editor_elements = 0; // dynamically determined
7200 static boolean setup_editor_cascade_never = FALSE;
7202 static boolean setup_editor_el_players = TRUE;
7203 static boolean setup_editor_el_boulderdash = TRUE;
7204 static boolean setup_editor_el_boulderdash_native = TRUE;
7205 static boolean setup_editor_el_boulderdash_effects = TRUE;
7206 static boolean setup_editor_el_emerald_mine = TRUE;
7207 static boolean setup_editor_el_emerald_mine_club = TRUE;
7208 static boolean setup_editor_el_more = TRUE;
7209 static boolean setup_editor_el_sokoban = TRUE;
7210 static boolean setup_editor_el_supaplex = TRUE;
7211 static boolean setup_editor_el_diamond_caves = TRUE;
7212 static boolean setup_editor_el_dx_boulderdash = TRUE;
7213 static boolean setup_editor_el_mirror_magic = TRUE;
7214 static boolean setup_editor_el_deflektor = TRUE;
7215 static boolean setup_editor_el_chars = TRUE;
7216 static boolean setup_editor_el_steel_chars = TRUE;
7217 static boolean setup_editor_el_custom = TRUE;
7218 static boolean setup_editor_el_user_defined = TRUE;
7219 static boolean setup_editor_el_dynamic = TRUE;
7221 static int editor_hl_unused[] = { EL_EMPTY };
7222 static int *editor_hl_unused_ptr = editor_hl_unused;
7223 static int num_editor_hl_unused = 0;
7227 boolean *setup_value;
7228 boolean *setup_cascade_value;
7230 int **headline_list;
7231 int *headline_list_size;
7234 int *element_list_size;
7236 boolean last_setup_value;
7238 editor_elements_info[] =
7241 &setup_editor_el_players,
7242 &setup_editor_cascade_never,
7243 &editor_hl_unused_ptr, &num_editor_hl_unused,
7244 &editor_el_players_ptr, &num_editor_el_players
7247 &setup_editor_el_boulderdash,
7248 &setup.editor_cascade.el_bd,
7249 &editor_hl_boulderdash_ptr, &num_editor_hl_boulderdash,
7250 &editor_el_boulderdash_ptr, &num_editor_el_boulderdash
7253 &setup_editor_el_boulderdash_native,
7254 &setup.editor_cascade.el_bd_native,
7255 &editor_hl_boulderdash_native_ptr, &num_editor_hl_boulderdash_native,
7256 &editor_el_boulderdash_native_ptr, &num_editor_el_boulderdash_native
7259 &setup_editor_el_boulderdash_effects,
7260 &setup.editor_cascade.el_bd_effects,
7261 &editor_hl_boulderdash_effects_ptr, &num_editor_hl_boulderdash_effects,
7262 &editor_el_boulderdash_effects_ptr, &num_editor_el_boulderdash_effects
7265 &setup_editor_el_emerald_mine,
7266 &setup.editor_cascade.el_em,
7267 &editor_hl_emerald_mine_ptr, &num_editor_hl_emerald_mine,
7268 &editor_el_emerald_mine_ptr, &num_editor_el_emerald_mine
7271 &setup_editor_el_emerald_mine_club,
7272 &setup.editor_cascade.el_emc,
7273 &editor_hl_emerald_mine_club_ptr, &num_editor_hl_emerald_mine_club,
7274 &editor_el_emerald_mine_club_ptr, &num_editor_el_emerald_mine_club
7277 &setup_editor_el_more,
7278 &setup.editor_cascade.el_rnd,
7279 &editor_hl_rnd_ptr, &num_editor_hl_rnd,
7280 &editor_el_rnd_ptr, &num_editor_el_rnd
7283 &setup_editor_el_sokoban,
7284 &setup.editor_cascade.el_sb,
7285 &editor_hl_sokoban_ptr, &num_editor_hl_sokoban,
7286 &editor_el_sokoban_ptr, &num_editor_el_sokoban
7289 &setup_editor_el_supaplex,
7290 &setup.editor_cascade.el_sp,
7291 &editor_hl_supaplex_ptr, &num_editor_hl_supaplex,
7292 &editor_el_supaplex_ptr, &num_editor_el_supaplex
7295 &setup_editor_el_diamond_caves,
7296 &setup.editor_cascade.el_dc,
7297 &editor_hl_diamond_caves_ptr, &num_editor_hl_diamond_caves,
7298 &editor_el_diamond_caves_ptr, &num_editor_el_diamond_caves
7301 &setup_editor_el_dx_boulderdash,
7302 &setup.editor_cascade.el_dx,
7303 &editor_hl_dx_boulderdash_ptr, &num_editor_hl_dx_boulderdash,
7304 &editor_el_dx_boulderdash_ptr, &num_editor_el_dx_boulderdash
7307 &setup_editor_el_mirror_magic,
7308 &setup.editor_cascade.el_mm,
7309 &editor_hl_mirror_magic_ptr, &num_editor_hl_mirror_magic,
7310 &editor_el_mirror_magic_ptr, &num_editor_el_mirror_magic
7313 &setup_editor_el_deflektor,
7314 &setup.editor_cascade.el_df,
7315 &editor_hl_deflektor_ptr, &num_editor_hl_deflektor,
7316 &editor_el_deflektor_ptr, &num_editor_el_deflektor
7319 &setup_editor_el_chars,
7320 &setup.editor_cascade.el_chars,
7321 &editor_hl_chars_ptr, &num_editor_hl_chars,
7322 &editor_el_chars_ptr, &num_editor_el_chars
7325 &setup_editor_el_steel_chars,
7326 &setup.editor_cascade.el_steel_chars,
7327 &editor_hl_steel_chars_ptr, &num_editor_hl_steel_chars,
7328 &editor_el_steel_chars_ptr, &num_editor_el_steel_chars
7331 &setup_editor_el_custom,
7332 &setup.editor_cascade.el_ce,
7333 &editor_hl_custom_ptr, &num_editor_hl_custom,
7334 &editor_el_custom_ptr, &num_editor_el_custom
7337 &setup_editor_el_custom,
7338 &setup.editor_cascade.el_ge,
7339 &editor_hl_group_ptr, &num_editor_hl_group,
7340 &editor_el_group_ptr, &num_editor_el_group
7343 &setup_editor_el_custom,
7344 &setup.editor_cascade.el_es,
7345 &editor_hl_empty_space_ptr, &num_editor_hl_empty_space,
7346 &editor_el_empty_space_ptr, &num_editor_el_empty_space
7349 &setup_editor_el_custom,
7350 &setup.editor_cascade.el_ref,
7351 &editor_hl_reference_ptr, &num_editor_hl_reference,
7352 &editor_el_reference_ptr, &num_editor_el_reference
7355 &setup_editor_el_user_defined,
7356 &setup.editor_cascade.el_user,
7357 &editor_hl_user_defined_ptr, &num_editor_hl_user_defined,
7358 &editor_el_user_defined_ptr, &num_editor_el_user_defined
7361 &setup_editor_el_dynamic,
7362 &setup.editor_cascade.el_dynamic,
7363 &editor_hl_dynamic_ptr, &num_editor_hl_dynamic,
7364 &editor_el_dynamic_ptr, &num_editor_el_dynamic,
7369 &editor_hl_empty_ptr, &num_editor_hl_empty,
7370 &editor_el_empty_ptr, &num_editor_el_empty,
7380 static struct XY xy_directions[] =
7389 // ----------------------------------------------------------------------------
7391 // ----------------------------------------------------------------------------
7393 static int getMaxInfoTextLength(void)
7395 return (SXSIZE / getFontWidth(INFOTEXT_FONT));
7398 static int getTextWidthForGadget(char *text)
7403 return (getTextWidth(text, FONT_TEXT_1) + ED_GADGET_TEXT_DISTANCE);
7406 static int getTextWidthForDrawingArea(char *text)
7411 return (getTextWidth(text, FONT_TEXT_1) + ED_DRAWINGAREA_BORDER_SIZE);
7414 static int getRightGadgetBorder(struct GadgetInfo *gi, char *text)
7416 return (gi->x + gi->width + getTextWidthForGadget(text));
7419 static char *getElementInfoText(int element)
7421 char *info_text = NULL;
7423 if (element < MAX_NUM_ELEMENTS)
7425 if (strlen(element_info[element].description) > 0)
7426 info_text = element_info[element].description;
7427 else if (element_info[element].custom_description != NULL)
7428 info_text = element_info[element].custom_description;
7429 else if (element_info[element].editor_description != NULL)
7430 info_text = element_info[element].editor_description;
7433 if (info_text == NULL)
7434 info_text = INFOTEXT_UNKNOWN_ELEMENT;
7439 static char *getElementDescriptionFilenameExt(char *basename)
7441 char *elements_subdir = ELEMENTS_DIRECTORY;
7442 static char *elements_subdir2 = NULL;
7443 static char *filename = NULL;
7445 if (elements_subdir2 == NULL)
7446 elements_subdir2 = getPath2(DOCS_DIRECTORY, elements_subdir);
7448 checked_free(filename);
7450 // 1st try: look for element description in current level set directory
7451 filename = getPath3(getCurrentLevelDir(), elements_subdir2, basename);
7452 if (fileExists(filename))
7457 // 2nd try: look for element description in the game's base directory
7458 filename = getPath3(options.docs_directory, elements_subdir, basename);
7459 if (fileExists(filename))
7465 static char *getElementDescriptionFilename(int element)
7467 char basename[MAX_FILENAME_LEN];
7470 // 1st try: look for element description file for exactly this element
7471 sprintf(basename, "%s.txt", element_info[element].token_name);
7472 filename = getElementDescriptionFilenameExt(basename);
7473 if (filename != NULL)
7476 // 2nd try: look for element description file for this element's class
7477 sprintf(basename, "%s.txt", element_info[element].class_name);
7478 filename = getElementDescriptionFilenameExt(basename);
7479 if (filename != NULL)
7482 // 3rd try: look for generic fallback text file for any element
7483 filename = getElementDescriptionFilenameExt(FALLBACK_TEXT_FILENAME);
7484 if (filename != NULL)
7490 static boolean suppressBorderElement(void)
7492 return (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
7493 lev_fieldx <= MAX_ED_FIELDX &&
7494 lev_fieldy <= MAX_ED_FIELDY);
7497 static void InitDynamicEditorElementList(int **elements, int *num_elements)
7499 boolean element_found[NUM_FILE_ELEMENTS];
7502 // initialize list of used elements to "not used"
7503 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
7504 element_found[i] = FALSE;
7506 // find all elements used in current level
7507 for (y = 0; y < lev_fieldy; y++)
7509 for (x = 0; x < lev_fieldx; x++)
7511 if (Tile[x][y] >= NUM_FILE_ELEMENTS) // should never happen
7514 if (IS_MM_WALL(Tile[x][y]))
7515 element_found[map_mm_wall_element(Tile[x][y])] = TRUE;
7517 element_found[Tile[x][y]] = TRUE;
7523 // count number of elements used in current level
7524 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
7525 if (element_found[i])
7528 // add space for up to 3 more elements for padding that may be needed
7531 // free memory for old list of elements, if needed
7532 checked_free(*elements);
7534 // allocate memory for new list of elements
7535 *elements = checked_malloc(*num_elements * sizeof(int));
7539 // add all elements used in current level (non-custom/group/empty elements)
7540 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
7541 if (element_found[i] && !(IS_CUSTOM_ELEMENT(i) ||
7542 IS_GROUP_ELEMENT(i) ||
7543 IS_EMPTY_ELEMENT(i)))
7544 (*elements)[(*num_elements)++] = i;
7546 // add all elements used in current level (custom/group/empty elements)
7547 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
7548 if (element_found[i] && (IS_CUSTOM_ELEMENT(i) ||
7549 IS_GROUP_ELEMENT(i) ||
7550 IS_EMPTY_ELEMENT(i)))
7551 (*elements)[(*num_elements)++] = i;
7553 while (*num_elements % 4) // pad with empty elements, if needed
7554 (*elements)[(*num_elements)++] = EL_EMPTY;
7557 static void ReinitializeElementList_EnableSections(void)
7559 // default: enable all element sections
7561 setup_editor_el_players = TRUE;
7562 setup_editor_el_boulderdash = TRUE;
7563 setup_editor_el_boulderdash_native = TRUE;
7564 setup_editor_el_boulderdash_effects = TRUE;
7565 setup_editor_el_emerald_mine = TRUE;
7566 setup_editor_el_emerald_mine_club = TRUE;
7567 setup_editor_el_more = TRUE;
7568 setup_editor_el_sokoban = TRUE;
7569 setup_editor_el_supaplex = TRUE;
7570 setup_editor_el_diamond_caves = TRUE;
7571 setup_editor_el_dx_boulderdash = TRUE;
7572 setup_editor_el_mirror_magic = TRUE;
7573 setup_editor_el_deflektor = TRUE;
7574 setup_editor_el_chars = TRUE;
7575 setup_editor_el_steel_chars = TRUE;
7577 setup_editor_el_custom = TRUE;
7578 setup_editor_el_user_defined = TRUE;
7579 setup_editor_el_dynamic = TRUE;
7581 // now disable all element sections not to be displayed
7583 if (!setup.editor.el_classic)
7585 setup_editor_el_players = FALSE;
7586 setup_editor_el_boulderdash = FALSE;
7587 setup_editor_el_boulderdash_native = FALSE;
7588 setup_editor_el_boulderdash_effects = FALSE;
7589 setup_editor_el_emerald_mine = FALSE;
7590 setup_editor_el_emerald_mine_club = FALSE;
7591 setup_editor_el_more = FALSE;
7592 setup_editor_el_sokoban = FALSE;
7593 setup_editor_el_supaplex = FALSE;
7594 setup_editor_el_diamond_caves = FALSE;
7595 setup_editor_el_dx_boulderdash = FALSE;
7596 setup_editor_el_mirror_magic = FALSE;
7597 setup_editor_el_deflektor = FALSE;
7598 setup_editor_el_chars = FALSE;
7599 setup_editor_el_steel_chars = FALSE;
7602 if (!setup.editor.el_custom)
7604 setup_editor_el_custom = FALSE;
7607 if (!setup.editor.el_user_defined)
7609 setup_editor_el_user_defined = FALSE;
7612 if (!setup.editor.el_dynamic)
7614 setup_editor_el_dynamic = FALSE;
7617 if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
7619 setup_editor_el_boulderdash_native = FALSE;
7620 setup_editor_el_boulderdash_effects = FALSE;
7621 setup_editor_el_mirror_magic = FALSE;
7622 setup_editor_el_deflektor = FALSE;
7624 else if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
7626 setup_editor_el_players = FALSE;
7627 setup_editor_el_boulderdash = FALSE;
7628 setup_editor_el_emerald_mine = FALSE;
7629 setup_editor_el_emerald_mine_club = FALSE;
7630 setup_editor_el_more = FALSE;
7631 setup_editor_el_sokoban = FALSE;
7632 setup_editor_el_supaplex = FALSE;
7633 setup_editor_el_diamond_caves = FALSE;
7634 setup_editor_el_dx_boulderdash = FALSE;
7635 setup_editor_el_mirror_magic = FALSE;
7636 setup_editor_el_deflektor = FALSE;
7637 setup_editor_el_chars = FALSE;
7638 setup_editor_el_steel_chars = FALSE;
7640 setup_editor_el_custom = FALSE;
7642 else if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
7644 setup_editor_el_boulderdash = FALSE;
7645 setup_editor_el_boulderdash_native = FALSE;
7646 setup_editor_el_boulderdash_effects = FALSE;
7647 setup_editor_el_more = FALSE;
7648 setup_editor_el_sokoban = FALSE;
7649 setup_editor_el_supaplex = FALSE;
7650 setup_editor_el_diamond_caves = FALSE;
7651 setup_editor_el_dx_boulderdash = FALSE;
7652 setup_editor_el_mirror_magic = FALSE;
7653 setup_editor_el_deflektor = FALSE;
7654 setup_editor_el_steel_chars = FALSE;
7656 setup_editor_el_custom = FALSE;
7658 else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
7660 setup_editor_el_players = FALSE;
7661 setup_editor_el_boulderdash = FALSE;
7662 setup_editor_el_boulderdash_native = FALSE;
7663 setup_editor_el_boulderdash_effects = FALSE;
7664 setup_editor_el_emerald_mine = FALSE;
7665 setup_editor_el_emerald_mine_club = FALSE;
7666 setup_editor_el_more = FALSE;
7667 setup_editor_el_sokoban = FALSE;
7668 setup_editor_el_diamond_caves = FALSE;
7669 setup_editor_el_dx_boulderdash = FALSE;
7670 setup_editor_el_mirror_magic = FALSE;
7671 setup_editor_el_deflektor = FALSE;
7672 setup_editor_el_chars = FALSE;
7673 setup_editor_el_steel_chars = FALSE;
7675 setup_editor_el_custom = FALSE;
7677 else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
7679 setup_editor_el_players = FALSE;
7680 setup_editor_el_boulderdash = FALSE;
7681 setup_editor_el_boulderdash_native = FALSE;
7682 setup_editor_el_boulderdash_effects = FALSE;
7683 setup_editor_el_emerald_mine = FALSE;
7684 setup_editor_el_emerald_mine_club = FALSE;
7685 setup_editor_el_more = FALSE;
7686 setup_editor_el_sokoban = FALSE;
7687 setup_editor_el_supaplex = FALSE;
7688 setup_editor_el_diamond_caves = FALSE;
7689 setup_editor_el_dx_boulderdash = FALSE;
7690 setup_editor_el_steel_chars = FALSE;
7692 setup_editor_el_custom = FALSE;
7696 static void ReinitializeElementList(void)
7698 static boolean initialization_needed = TRUE;
7702 ReinitializeElementList_EnableSections();
7704 if (initialization_needed)
7706 LoadSetup_EditorCascade(); // load last editor cascade state
7708 // initialize editor cascade element from saved cascade state
7709 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7711 int *cascade_element = &(*editor_elements_info[i].headline_list)[0];
7712 boolean cascade_value = *editor_elements_info[i].setup_cascade_value;
7714 if (IS_EDITOR_CASCADE(*cascade_element))
7716 (cascade_value ? EL_CASCADE_ACTIVE(*cascade_element) :
7717 EL_CASCADE_INACTIVE(*cascade_element));
7720 initialization_needed = FALSE;
7723 checked_free(editor_elements);
7725 // reload optional user defined element list for each invocation of editor
7726 LoadUserDefinedEditorElementList(&editor_el_user_defined_ptr,
7727 &num_editor_el_user_defined);
7729 // initialize dynamic level element list for each invocation of editor
7730 InitDynamicEditorElementList(&editor_el_dynamic_ptr,
7731 &num_editor_el_dynamic);
7733 // initialize list of empty elements (used for padding, if needed)
7734 for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
7735 editor_el_empty[i] = EL_EMPTY;
7737 // do some sanity checks for each element from element list
7738 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7740 for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
7742 int element = (*editor_elements_info[i].element_list)[j];
7744 if (element >= NUM_FILE_ELEMENTS)
7745 Warn("editor element %d is runtime element", element);
7747 if (strEqual(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT))
7748 Warn("no element description text for element %d", element);
7752 num_editor_elements = 0;
7753 use_el_empty = FALSE;
7755 // determine size of element list
7756 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7758 if (*editor_elements_info[i].setup_value)
7760 boolean found_inactive_cascade = FALSE;
7762 if (setup.editor.el_headlines)
7764 // required for correct padding of palette headline buttons
7765 if (*editor_elements_info[i].headline_list_size > 0)
7766 num_editor_elements += ED_ELEMENTLIST_COLS;
7768 for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
7770 int element = (*editor_elements_info[i].headline_list)[j];
7772 if (IS_EDITOR_CASCADE_INACTIVE(element))
7773 found_inactive_cascade = TRUE;
7777 if (found_inactive_cascade)
7780 // required for correct padding of palette element buttons
7781 int element_list_size = *editor_elements_info[i].element_list_size;
7783 (element_list_size + ED_ELEMENTLIST_COLS - 1) / ED_ELEMENTLIST_COLS;
7784 int element_buttons = ED_ELEMENTLIST_COLS * element_rows;
7786 num_editor_elements += element_buttons;
7790 if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
7792 // offer at least as many elements as element buttons exist
7793 use_el_empty = TRUE;
7794 num_editor_el_empty = ED_NUM_ELEMENTLIST_BUTTONS - num_editor_elements;
7796 num_editor_elements += num_editor_el_empty;
7800 num_editor_el_empty = 0;
7803 editor_elements = checked_malloc(num_editor_elements * sizeof(int));
7805 // fill element list
7806 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7808 boolean found_inactive_cascade = FALSE;
7810 if (*editor_elements_info[i].setup_value)
7812 if (setup.editor.el_headlines)
7814 // required for correct padding of palette headline buttons
7815 int headline_size = (*editor_elements_info[i].headline_list_size > 0 ?
7816 ED_ELEMENTLIST_COLS : 0);
7818 for (j = 0; j < headline_size; j++)
7820 // use empty elements for padding of palette headline buttons
7821 int element = (j < *editor_elements_info[i].headline_list_size ?
7822 (*editor_elements_info[i].headline_list)[j] :
7823 editor_el_empty[0]);
7825 editor_elements[pos++] = element;
7827 if (IS_EDITOR_CASCADE_INACTIVE(element))
7828 found_inactive_cascade = TRUE;
7832 if (found_inactive_cascade)
7835 // required for correct padding of palette element buttons
7836 int element_list_size = *editor_elements_info[i].element_list_size;
7838 (element_list_size + ED_ELEMENTLIST_COLS - 1) / ED_ELEMENTLIST_COLS;
7839 int element_buttons = ED_ELEMENTLIST_COLS * element_rows;
7841 // copy all elements from element list
7842 for (j = 0; j < element_list_size; j++)
7843 editor_elements[pos++] = (*editor_elements_info[i].element_list)[j];
7845 // use empty elements for padding of palette element buttons
7846 for (j = 0; j < element_buttons - element_list_size; j++)
7847 editor_elements[pos++] = editor_el_empty[0];
7851 // (this function is also called before editor gadgets are initialized!)
7852 AdjustElementListScrollbar();
7855 void PrintEditorElementList(void)
7857 boolean *stop = &setup_editor_el_user_defined;
7860 for (i = 0; editor_elements_info[i].setup_value != stop; i++)
7862 int cascade_element = (*editor_elements_info[i].headline_list)[0];
7864 if (IS_EDITOR_CASCADE(cascade_element))
7866 int cascade_element_show = EL_CASCADE_INACTIVE(cascade_element);
7867 char *headline = element_info[cascade_element_show].editor_description;
7869 PrintLineWithPrefix("# ", "-", 77);
7870 Print("# %s\n", headline);
7871 PrintLineWithPrefix("# ", "-", 77);
7874 for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
7876 int element = (*editor_elements_info[i].headline_list)[j];
7878 if (IS_EDITOR_CASCADE(element))
7879 element = EL_CHAR_MINUS;
7881 Print("# %s\n", element_info[element].token_name);
7887 for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
7889 int element = (*editor_elements_info[i].element_list)[j];
7891 Print("# %s\n", element_info[element].token_name);
7899 static void ReinitializeElementListButtons(void)
7901 static boolean last_setup_value_headlines = FALSE;
7902 static boolean initialization_needed = TRUE;
7905 if (!initialization_needed) // check if editor element setup has changed
7907 if (last_setup_value_headlines != setup.editor.el_headlines)
7908 initialization_needed = TRUE;
7910 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7911 if (editor_elements_info[i].last_setup_value !=
7912 *editor_elements_info[i].setup_value)
7913 initialization_needed = TRUE;
7916 if (!initialization_needed)
7919 FreeLevelEditorGadgets();
7920 CreateLevelEditorGadgets();
7922 // store current setup values for next invocation of this function
7923 last_setup_value_headlines = setup.editor.el_headlines;
7924 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
7925 editor_elements_info[i].last_setup_value =
7926 *editor_elements_info[i].setup_value;
7928 initialization_needed = FALSE;
7931 static void DrawElementBorder(int dest_x, int dest_y, int width, int height,
7934 int border_graphic =
7935 (input ? IMG_EDITOR_ELEMENT_BORDER_INPUT : IMG_EDITOR_ELEMENT_BORDER);
7936 struct GraphicInfo *g = &graphic_info[border_graphic];
7937 Bitmap *src_bitmap = g->bitmap;
7938 int src_x = g->src_x;
7939 int src_y = g->src_y;
7940 int border_size = g->border_size;
7941 int border_xpos = g->width - border_size;
7942 int border_ypos = g->height - border_size;
7943 int tilesize = ED_DRAWINGAREA_TILE_SIZE;
7946 BlitBitmap(src_bitmap, drawto, src_x, src_y,
7947 border_size, border_size,
7948 dest_x - border_size, dest_y - border_size);
7949 BlitBitmap(src_bitmap, drawto, src_x + border_xpos, src_y,
7950 border_size, border_size,
7951 dest_x + width, dest_y - border_size);
7952 BlitBitmap(src_bitmap, drawto, src_x, src_y + border_ypos,
7953 border_size, border_size,
7954 dest_x - border_size, dest_y + height);
7955 BlitBitmap(src_bitmap, drawto, src_x + border_xpos, src_y + border_ypos,
7956 border_size, border_size,
7957 dest_x + width, dest_y + height);
7959 for (i = 0; i < width / tilesize; i++)
7961 BlitBitmap(src_bitmap, drawto, src_x + border_size, src_y,
7962 tilesize, border_size,
7963 dest_x + i * tilesize, dest_y - border_size);
7964 BlitBitmap(src_bitmap, drawto, src_x + border_size, src_y + border_ypos,
7965 tilesize, border_size,
7966 dest_x + i * tilesize, dest_y + height);
7969 for (i = 0; i < height / tilesize; i++)
7971 BlitBitmap(src_bitmap, drawto, src_x, src_y + border_size,
7972 border_size, tilesize,
7973 dest_x - border_size, dest_y + i * tilesize);
7974 BlitBitmap(src_bitmap, drawto, src_x + border_xpos, src_y + border_size,
7975 border_size, tilesize,
7976 dest_x + width, dest_y + i * tilesize);
7979 ClearRectangle(drawto, dest_x - 1, dest_y - 1, width + 2, height + 2);
7982 static void DrawEditorLevelBorderLine(int x, int y, int xsize, int ysize)
7984 int xsize_tile = MAX(ed_tilesize, xsize);
7985 int ysize_tile = MAX(ed_tilesize, ysize);
7986 int xsize_full = xsize + 1;
7987 int ysize_full = ysize + 1;
7988 int xsize_thin = (xsize < ed_tilesize ? 1 : xsize);
7989 int ysize_thin = (ysize < ed_tilesize ? 1 : ysize);
7990 Pixel line_color = getTabulatorBarColor();
7992 if (line_color == BLACK_PIXEL) // black => transparent
7995 FillRectangle(drawto, SX + x, SY + y, xsize_tile, ysize_tile, BLACK_PIXEL);
7996 FillRectangle(drawto, SX + x, SY + y, xsize_full, ysize_full, line_color);
7997 FillRectangle(drawto, SX + x, SY + y, xsize_thin, ysize_thin, BLACK_PIXEL);
8000 static void DrawEditorLevelBorderLinesIfNeeded(void)
8002 int xsize = lev_fieldx * ed_tilesize;
8003 int ysize = lev_fieldy * ed_tilesize;
8004 int line_size = getTabulatorBarHeight();
8006 if (!suppressBorderElement())
8009 // draw little border line around editable level playfield
8012 DrawEditorLevelBorderLine(xsize, 0, line_size, ysize);
8015 DrawEditorLevelBorderLine(0, ysize, xsize, line_size);
8017 if (xsize < SXSIZE && ysize < SYSIZE)
8018 DrawEditorLevelBorderLine(xsize, ysize, line_size, line_size);
8021 static void DrawEditorElement(int x, int y, int element)
8023 DrawSizedElement(x, y, element, ed_tilesize);
8026 static void DrawEditorElementThruMask(int x, int y, int element)
8028 DrawSizedElementThruMask(x, y, element, ed_tilesize);
8031 static void DrawEditorElementOrWall(int x, int y, int scroll_x, int scroll_y)
8033 DrawSizedElementOrWall(x, y, scroll_x, scroll_y, ed_tilesize);
8036 static void DrawEditorLevel(int size_x, int size_y, int scroll_x, int scroll_y)
8038 DrawSizedLevel(size_x, size_y, scroll_x, scroll_y, ed_tilesize);
8039 DrawEditorLevelBorderLinesIfNeeded();
8042 static void DrawDrawingArea(int id)
8044 struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
8047 int *value = drawingarea_info[id].value;
8048 int area_xsize = drawingarea_info[id].area_xsize;
8049 int area_ysize = drawingarea_info[id].area_ysize;
8050 int tilesize = ED_DRAWINGAREA_TILE_SIZE;
8052 for (x = 0; x < area_xsize; x++)
8054 for (y = 0; y < area_ysize; y++)
8056 int element = value[x * area_ysize + y];
8060 getEditorGraphicAndFrame(element, &graphic, &frame, TRUE);
8062 DrawSizedGraphicExt(drawto,
8063 gi->x + x * tilesize,
8064 gi->y + y * tilesize,
8065 graphic, frame, tilesize);
8070 static void ScrollEditorLevel(int from_x, int from_y, int scroll)
8073 int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
8074 int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0);
8076 BlitBitmap(drawto, drawto,
8077 SX + (dx == -1 ? ed_tilesize : 0),
8078 SY + (dy == -1 ? ed_tilesize : 0),
8079 (ed_fieldx * ed_tilesize) - (dx != 0 ? ed_tilesize : 0),
8080 (ed_fieldy * ed_tilesize) - (dy != 0 ? ed_tilesize : 0),
8081 SX + (dx == +1 ? ed_tilesize : 0),
8082 SY + (dy == +1 ? ed_tilesize : 0));
8086 x = (dx == 1 ? 0 : ed_fieldx - 1);
8087 for (y = 0; y < ed_fieldy; y++)
8088 DrawEditorElementOrWall(x, y, from_x, from_y);
8092 y = (dy == 1 ? 0 : ed_fieldy - 1);
8093 for (x = 0; x < ed_fieldx; x++)
8094 DrawEditorElementOrWall(x, y, from_x, from_y);
8097 redraw_mask |= REDRAW_FIELD;
8101 static void getEditorGraphicAndFrame(int element, int *graphic, int *frame, boolean use_editor_gfx)
8105 *graphic = el2edimg(element);
8110 *graphic = el2img(element);
8111 *frame = (ANIM_MODE(*graphic) == ANIM_CE_VALUE ?
8112 custom_element.ce_value_fixed_initial :
8113 ANIM_MODE(*graphic) == ANIM_CE_SCORE ?
8114 custom_element.collect_score_initial : FrameCounter);
8117 if (*graphic == IMG_UNKNOWN)
8119 // no graphic defined -- if BD style, try to get runtime ("effect") element graphics
8120 // (normal BD style elements have graphics, but runtime ("effects") elements do not)
8121 int element_bd = map_element_RND_to_BD_cave(element);
8123 if (element_bd != O_UNKNOWN)
8125 struct GraphicInfo_BD *g_bd = &graphic_info_bd_object[element_bd][0];
8127 *graphic = g_bd->graphic;
8128 *frame = g_bd->frame;
8133 static void getEditorGraphicSource(int element, int tile_size, Bitmap **bitmap,
8139 getEditorGraphicAndFrame(element, &graphic, &frame, TRUE);
8141 getSizedGraphicSource(graphic, frame, tile_size, bitmap, x, y);
8144 static void CreateControlButtons(void)
8146 struct GadgetInfo *gi;
8149 // create toolbox buttons
8150 for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
8152 int type_id = controlbutton_info[i].gadget_id; // same as gadget ID here
8153 int id = controlbutton_info[i].gadget_id;
8154 int type = controlbutton_info[i].gadget_type;
8155 int graphic = controlbutton_info[i].graphic;
8156 struct XYTileSize *pos = controlbutton_info[i].pos;
8157 struct GraphicInfo *gd = &graphic_info[graphic];
8158 Bitmap *deco_bitmap = NULL;
8159 int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0;
8160 int tile_size = 0, deco_shift = 0;
8161 boolean deco_masked = FALSE;
8162 int gd_x1 = gd->src_x;
8163 int gd_y1 = gd->src_y;
8164 int gd_x2 = gd->src_x + gd->pressed_xoffset;
8165 int gd_y2 = gd->src_y + gd->pressed_yoffset;
8166 int gd_x1a = gd->src_x + gd->active_xoffset;
8167 int gd_y1a = gd->src_y + gd->active_yoffset;
8168 int gd_x2a = gd->src_x + gd->active_xoffset + gd->pressed_xoffset;
8169 int gd_y2a = gd->src_y + gd->active_yoffset + gd->pressed_yoffset;
8172 unsigned int event_mask;
8173 int radio_button_nr = RADIO_NR_NONE;
8174 boolean checked = FALSE;
8177 Fail("'controlbutton_info' structure corrupted at index %d -- please fix", i);
8179 if (type == GD_TYPE_RADIO_BUTTON)
8181 event_mask = GD_EVENT_PRESSED;
8182 radio_button_nr = RADIO_NR_DRAWING_TOOLBOX;
8184 if (id == drawing_function)
8189 if (id == GADGET_ID_WRAP_LEFT ||
8190 id == GADGET_ID_WRAP_RIGHT ||
8191 id == GADGET_ID_WRAP_UP ||
8192 id == GADGET_ID_WRAP_DOWN)
8193 event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
8195 event_mask = GD_EVENT_RELEASED;
8198 if (id == GADGET_ID_PROPERTIES ||
8199 id == GADGET_ID_PALETTE)
8204 else if (id == GADGET_ID_ELEMENT_LEFT ||
8205 id == GADGET_ID_ELEMENT_MIDDLE ||
8206 id == GADGET_ID_ELEMENT_RIGHT)
8211 int element = (id == GADGET_ID_ELEMENT_LEFT ? new_element1 :
8212 id == GADGET_ID_ELEMENT_MIDDLE ? new_element2 :
8213 id == GADGET_ID_ELEMENT_RIGHT ? new_element3 : EL_EMPTY);
8215 tile_size = BUTTON_TILE_SIZE(id == GADGET_ID_ELEMENT_LEFT ?
8216 editor.button.element_left.tile_size :
8217 id == GADGET_ID_ELEMENT_MIDDLE ?
8218 editor.button.element_middle.tile_size :
8219 id == GADGET_ID_ELEMENT_RIGHT ?
8220 editor.button.element_right.tile_size : 0);
8222 // make sure that decoration does not overlap gadget border
8223 tile_size = MIN(tile_size, MIN(gd->width, gd->height));
8225 getEditorGraphicSource(element, tile_size, &deco_bitmap, &deco_x,&deco_y);
8227 deco_xpos = (gd->width - tile_size) / 2;
8228 deco_ypos = (gd->height - tile_size) / 2;
8230 deco_masked = gd->draw_masked;
8238 gi = CreateGadget(GDI_CUSTOM_ID, id,
8239 GDI_CUSTOM_TYPE_ID, type_id,
8240 GDI_IMAGE_ID, graphic,
8241 GDI_INFO_TEXT, controlbutton_info[i].infotext,
8244 GDI_WIDTH, gd->width,
8245 GDI_HEIGHT, gd->height,
8247 GDI_STATE, GD_BUTTON_UNPRESSED,
8248 GDI_RADIO_NR, radio_button_nr,
8249 GDI_CHECKED, checked,
8250 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8251 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8252 GDI_ALT_DESIGN_UNPRESSED, gd->bitmap, gd_x1a, gd_y1a,
8253 GDI_ALT_DESIGN_PRESSED, gd->bitmap, gd_x2a, gd_y2a,
8254 GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
8255 GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
8256 GDI_DECORATION_SIZE, tile_size, tile_size,
8257 GDI_DECORATION_SHIFTING, deco_shift, deco_shift,
8258 GDI_DECORATION_MASKED, deco_masked,
8259 GDI_EVENT_MASK, event_mask,
8260 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8261 GDI_CALLBACK_ACTION, HandleControlButtons,
8265 Fail("cannot create gadget");
8267 level_editor_gadget[id] = gi;
8270 // these values are not constant, but can change at runtime
8271 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_UP].x = ED_SCROLL_UP_XPOS;
8272 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_UP].y = ED_SCROLL_UP_YPOS;
8273 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_DOWN].x = ED_SCROLL_DOWN_XPOS;
8274 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_DOWN].y = ED_SCROLL_DOWN_YPOS;
8275 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_LEFT].x = ED_SCROLL_LEFT_XPOS;
8276 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_LEFT].y = ED_SCROLL_LEFT_YPOS;
8277 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_RIGHT].x = ED_SCROLL_RIGHT_XPOS;
8278 scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_RIGHT].y = ED_SCROLL_RIGHT_YPOS;
8279 scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_UP].x = ED_SCROLL2_UP_XPOS;
8280 scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_UP].y = ED_SCROLL2_UP_YPOS;
8281 scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_DOWN].x = ED_SCROLL2_DOWN_XPOS;
8282 scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_DOWN].y = ED_SCROLL2_DOWN_YPOS;
8284 // create buttons for scrolling of drawing area and element list
8285 for (i = 0; i < ED_NUM_SCROLLBUTTONS; i++)
8287 int id = scrollbutton_info[i].gadget_id;
8288 int type_id = scrollbutton_info[i].gadget_type_id;
8289 int graphic = scrollbutton_info[i].graphic;
8290 struct GraphicInfo *gd = &graphic_info[graphic];
8291 Bitmap *gd_bitmap = gd->bitmap;
8292 int gd_x1 = gd->src_x;
8293 int gd_y1 = gd->src_y;
8294 int gd_x2 = gd->src_x + gd->pressed_xoffset;
8295 int gd_y2 = gd->src_y + gd->pressed_yoffset;
8296 int width = gd->width;
8297 int height = gd->height;
8298 int x = scrollbutton_pos[i].x;
8299 int y = scrollbutton_pos[i].y;
8300 unsigned int event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
8303 Fail("'scrollbutton_info' structure corrupted at index %d -- please fix", i);
8305 if (id == GADGET_ID_SCROLL_LIST_UP ||
8306 id == GADGET_ID_SCROLL_LIST_DOWN)
8317 gi = CreateGadget(GDI_CUSTOM_ID, id,
8318 GDI_CUSTOM_TYPE_ID, type_id,
8319 GDI_IMAGE_ID, graphic,
8320 GDI_INFO_TEXT, scrollbutton_info[i].infotext,
8325 GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
8326 GDI_STATE, GD_BUTTON_UNPRESSED,
8327 GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
8328 GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
8329 GDI_EVENT_MASK, event_mask,
8330 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8331 GDI_CALLBACK_ACTION, HandleControlButtons,
8335 Fail("cannot create gadget");
8337 level_editor_gadget[id] = gi;
8340 // create buttons for element list
8341 for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
8344 int id = GADGET_ID_ELEMENTLIST_FIRST + i;
8345 int graphic = IMG_EDITOR_PALETTE_BUTTON;
8346 struct GraphicInfo *gd = &graphic_info[graphic];
8347 Bitmap *gd_bitmap = gd->bitmap;
8348 Bitmap *deco_bitmap;
8349 int deco_x, deco_y, deco_xpos, deco_ypos;
8350 int gd_x1 = gd->src_x;
8351 int gd_y1 = gd->src_y;
8352 int gd_x2 = gd->src_x + gd->pressed_xoffset;
8353 int gd_y2 = gd->src_y + gd->pressed_yoffset;
8354 int xx = i % ED_ELEMENTLIST_BUTTONS_HORIZ;
8355 int yy = i / ED_ELEMENTLIST_BUTTONS_HORIZ;
8356 int x = PX + ED_ELEMENTLIST_XPOS + xx * gd->width;
8357 int y = PY + ED_ELEMENTLIST_YPOS + yy * gd->height;
8358 int element = editor_elements[i];
8359 int tile_size = BUTTON_TILE_SIZE(editor.palette.tile_size);
8360 unsigned int event_mask = GD_EVENT_RELEASED;
8362 getEditorGraphicSource(element, tile_size, &deco_bitmap, &deco_x, &deco_y);
8364 deco_xpos = (gd->width - tile_size) / 2;
8365 deco_ypos = (gd->height - tile_size) / 2;
8367 gi = CreateGadget(GDI_CUSTOM_ID, id,
8368 GDI_CUSTOM_TYPE_ID, type_id,
8369 GDI_IMAGE_ID, graphic,
8370 GDI_INFO_TEXT, getElementInfoText(element),
8373 GDI_WIDTH, gd->width,
8374 GDI_HEIGHT, gd->height,
8375 GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
8376 GDI_STATE, GD_BUTTON_UNPRESSED,
8377 GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
8378 GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
8379 GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
8380 GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
8381 GDI_DECORATION_SIZE, tile_size, tile_size,
8382 GDI_DECORATION_SHIFTING, 1, 1,
8383 GDI_EVENT_MASK, event_mask,
8384 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8385 GDI_CALLBACK_ACTION, HandleControlButtons,
8389 Fail("cannot create gadget");
8391 level_editor_gadget[id] = gi;
8395 static void CreateCounterButtons(void)
8397 int max_infotext_len = getMaxInfoTextLength();
8400 for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++)
8402 int type_id = counterbutton_info[i].gadget_type_id;
8403 int x = SX + ED_SETTINGS_X(counterbutton_info[i].x); // down count button
8404 int y = SY + ED_SETTINGS_Y(counterbutton_info[i].y);
8408 Fail("'counterbutton_info' structure corrupted at index %d -- please fix", i);
8410 // determine horizontal position to the right of specified gadget
8411 if (counterbutton_info[i].gadget_id_align != GADGET_ID_NONE)
8412 x = (right_gadget_border[counterbutton_info[i].gadget_id_align] +
8413 ED_GADGET_TEXT_DISTANCE);
8415 // determine horizontal offset for leading text
8416 if (counterbutton_info[i].text_left != NULL)
8417 x += getTextWidthForGadget(counterbutton_info[i].text_left);
8419 for (j = 0; j < 2; j++)
8421 struct GadgetInfo *gi;
8423 counterbutton_info[i].gadget_id_down :
8424 counterbutton_info[i].gadget_id_up);
8426 struct GraphicInfo *gd;
8427 int gd_x1, gd_x2, gd_y1, gd_y2;
8428 unsigned int event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
8429 char infotext[max_infotext_len + 1];
8431 if (i == ED_COUNTER_ID_SELECT_LEVEL)
8434 IMG_GFX_EDITOR_BUTTON_PREV_LEVEL :
8435 IMG_GFX_EDITOR_BUTTON_NEXT_LEVEL);
8437 event_mask |= GD_EVENT_RELEASED;
8441 x = DX + editor.button.prev_level.x;
8442 y = DY + editor.button.prev_level.y;
8446 x = DX + editor.button.next_level.x;
8447 y = DY + editor.button.next_level.y;
8453 IMG_EDITOR_COUNTER_DOWN :
8454 IMG_EDITOR_COUNTER_UP);
8457 gd = &graphic_info[graphic];
8461 gd_x2 = gd->src_x + gd->pressed_xoffset;
8462 gd_y2 = gd->src_y + gd->pressed_yoffset;
8464 sprintf(infotext, "%s counter value by 1, 5 or 10",
8465 (j == 0 ? "Decrease" : "Increase"));
8467 gi = CreateGadget(GDI_CUSTOM_ID, id,
8468 GDI_CUSTOM_TYPE_ID, type_id,
8469 GDI_IMAGE_ID, graphic,
8470 GDI_INFO_TEXT, infotext,
8473 GDI_WIDTH, gd->width,
8474 GDI_HEIGHT, gd->height,
8475 GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
8476 GDI_STATE, GD_BUTTON_UNPRESSED,
8477 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8478 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8479 GDI_EVENT_MASK, event_mask,
8480 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8481 GDI_CALLBACK_ACTION, HandleCounterButtons,
8485 Fail("cannot create gadget");
8487 level_editor_gadget[id] = gi;
8488 right_gadget_border[id] =
8489 getRightGadgetBorder(gi, counterbutton_info[i].text_right);
8491 x += gi->width + ED_GADGET_SMALL_DISTANCE; // text count button
8495 int font_type = FONT_INPUT_1;
8496 int font_type_active = FONT_INPUT_1_ACTIVE;
8498 id = counterbutton_info[i].gadget_id_text;
8500 event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
8502 if (i == ED_COUNTER_ID_SELECT_LEVEL)
8504 graphic = IMG_GFX_EDITOR_INPUT_LEVEL_NUMBER;
8506 font_type = FONT_LEVEL_NUMBER;
8507 font_type_active = FONT_LEVEL_NUMBER_ACTIVE;
8509 x = DX + editor.input.level_number.x;
8510 y = DY + editor.input.level_number.y;
8514 graphic = IMG_EDITOR_COUNTER_INPUT;
8517 gd = &graphic_info[graphic];
8521 gd_x2 = gd->src_x + gd->active_xoffset;
8522 gd_y2 = gd->src_y + gd->active_yoffset;
8524 gi = CreateGadget(GDI_CUSTOM_ID, id,
8525 GDI_CUSTOM_TYPE_ID, type_id,
8526 GDI_IMAGE_ID, graphic,
8527 GDI_INFO_TEXT, "Enter counter value",
8530 GDI_TYPE, GD_TYPE_TEXT_INPUT_NUMERIC,
8531 GDI_NUMBER_VALUE, 0,
8532 GDI_NUMBER_MIN, counterbutton_info[i].min_value,
8533 GDI_NUMBER_MAX, counterbutton_info[i].max_value,
8534 GDI_TEXT_SIZE, 3, // minimal counter text size
8535 GDI_TEXT_FONT, font_type,
8536 GDI_TEXT_FONT_ACTIVE, font_type_active,
8537 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8538 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8539 GDI_BORDER_SIZE, gd->border_size, gd->border_size,
8540 GDI_DESIGN_WIDTH, gd->width,
8541 GDI_EVENT_MASK, event_mask,
8542 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8543 GDI_CALLBACK_ACTION, HandleCounterButtons,
8547 Fail("cannot create gadget");
8549 level_editor_gadget[id] = gi;
8550 right_gadget_border[id] =
8551 getRightGadgetBorder(gi, counterbutton_info[i].text_right);
8553 x += gi->width + ED_GADGET_SMALL_DISTANCE; // up count button
8559 static void CreateDrawingAreas(void)
8563 // these values are not constant, but can change at runtime
8564 drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_xsize = MAX_ED_FIELDX;
8565 drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_ysize = MAX_ED_FIELDY;
8567 for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
8569 struct GadgetInfo *gi;
8570 int id = drawingarea_info[i].gadget_id;
8571 int type_id = drawingarea_info[i].gadget_type_id;
8572 int x = SX + ED_AREA_SETTINGS_X(drawingarea_info[i]);
8573 int y = SY + ED_AREA_SETTINGS_Y(drawingarea_info[i]);
8574 int area_xsize = drawingarea_info[i].area_xsize;
8575 int area_ysize = drawingarea_info[i].area_ysize;
8576 int item_size = (id == GADGET_ID_DRAWING_LEVEL ?
8577 ed_tilesize : ED_DRAWINGAREA_TILE_SIZE);
8578 unsigned int event_mask =
8579 GD_EVENT_PRESSED | GD_EVENT_RELEASED | GD_EVENT_MOVING |
8580 GD_EVENT_OFF_BORDERS | GD_EVENT_PIXEL_PRECISE;
8583 Fail("'drawingarea_info' structure corrupted at index %d -- please fix", i);
8585 // determine horizontal position to the right of specified gadget
8586 if (drawingarea_info[i].gadget_id_align != GADGET_ID_NONE)
8587 x = (right_gadget_border[drawingarea_info[i].gadget_id_align] +
8588 ED_DRAWINGAREA_TEXT_DISTANCE);
8590 // determine horizontal offset for leading text
8591 if (drawingarea_info[i].text_left != NULL)
8592 x += getTextWidthForDrawingArea(drawingarea_info[i].text_left);
8594 gi = CreateGadget(GDI_CUSTOM_ID, id,
8595 GDI_CUSTOM_TYPE_ID, type_id,
8598 GDI_TYPE, GD_TYPE_DRAWING_AREA,
8599 GDI_AREA_SIZE, area_xsize, area_ysize,
8600 GDI_ITEM_SIZE, item_size, item_size,
8601 GDI_EVENT_MASK, event_mask,
8602 GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
8603 GDI_CALLBACK_ACTION, HandleDrawingAreas,
8607 Fail("cannot create gadget");
8609 level_editor_gadget[id] = gi;
8610 right_gadget_border[id] =
8611 getRightGadgetBorder(gi, drawingarea_info[i].text_right);
8615 static void CreateTextInputGadgets(void)
8617 struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_INPUT_TEXT];
8618 int max_infotext_len = getMaxInfoTextLength();
8621 for (i = 0; i < ED_NUM_TEXTINPUT; i++)
8623 int gd_x1 = gd->src_x;
8624 int gd_y1 = gd->src_y;
8625 int gd_x2 = gd->src_x + gd->active_xoffset;
8626 int gd_y2 = gd->src_y + gd->active_yoffset;
8627 struct GadgetInfo *gi;
8628 unsigned int event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
8629 char infotext[MAX_OUTPUT_LINESIZE + 1];
8630 int id = textinput_info[i].gadget_id;
8631 int type_id = textinput_info[i].gadget_type_id;
8635 Fail("'textinput_info' structure corrupted at index %d -- please fix", i);
8637 if (i == ED_TEXTINPUT_ID_ELEMENT_NAME)
8639 int element_border = graphic_info[IMG_EDITOR_ELEMENT_BORDER].border_size;
8640 int border_size = gd->border_size;
8641 int font_nr = FONT_INPUT_1;
8642 int font_height = getFontHeight(font_nr);
8643 int xoffset = element_border + TILEX + element_border + 3 * border_size;
8644 int yoffset = element_border + (TILEY - font_height) / 2;
8646 x = (editor.settings.element_name.x != -1 ?
8647 editor.settings.element_name.x :
8648 editor.settings.element_graphic.x + xoffset) - border_size;
8649 y = (editor.settings.element_name.y != -1 ?
8650 editor.settings.element_name.y :
8651 editor.settings.element_graphic.y + yoffset) - border_size;
8655 x = ED_SETTINGS_X(textinput_info[i].x);
8656 y = ED_SETTINGS_Y(textinput_info[i].y);
8659 // determine horizontal offset for leading text
8660 if (textinput_info[i].text_left != NULL)
8661 x += getTextWidthForGadget(textinput_info[i].text_left);
8663 sprintf(infotext, "%s", textinput_info[i].infotext);
8664 infotext[max_infotext_len] = '\0';
8666 gi = CreateGadget(GDI_CUSTOM_ID, id,
8667 GDI_CUSTOM_TYPE_ID, type_id,
8668 GDI_INFO_TEXT, infotext,
8671 GDI_TYPE, GD_TYPE_TEXT_INPUT_ALPHANUMERIC,
8672 GDI_TEXT_VALUE, textinput_info[i].value,
8673 GDI_TEXT_SIZE, textinput_info[i].size,
8674 GDI_TEXT_FONT, FONT_INPUT_1,
8675 GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
8676 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8677 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8678 GDI_BORDER_SIZE, gd->border_size, gd->border_size,
8679 GDI_DESIGN_WIDTH, gd->width,
8680 GDI_EVENT_MASK, event_mask,
8681 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8682 GDI_CALLBACK_ACTION, HandleTextInputGadgets,
8686 Fail("cannot create gadget");
8688 level_editor_gadget[id] = gi;
8692 static void CreateTextAreaGadgets(void)
8694 int max_infotext_len = getMaxInfoTextLength();
8697 for (i = 0; i < ED_NUM_TEXTAREAS; i++)
8699 struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_INPUT_TEXTAREA];
8700 int gd_x1 = gd->src_x;
8701 int gd_y1 = gd->src_y;
8702 int gd_x2 = gd->src_x + gd->active_xoffset;
8703 int gd_y2 = gd->src_y + gd->active_yoffset;
8704 struct GadgetInfo *gi;
8705 unsigned int event_mask = GD_EVENT_TEXT_LEAVING;
8706 char infotext[MAX_OUTPUT_LINESIZE + 1];
8707 int id = textarea_info[i].gadget_id;
8708 int type_id = textarea_info[i].gadget_type_id;
8709 int area_xsize = textarea_info[i].xsize;
8710 int area_ysize = textarea_info[i].ysize;
8713 Fail("'textarea_info' structure corrupted at index %d -- please fix", i);
8715 sprintf(infotext, "Enter %s", textarea_info[i].infotext);
8716 infotext[max_infotext_len] = '\0';
8718 gi = CreateGadget(GDI_CUSTOM_ID, id,
8719 GDI_CUSTOM_TYPE_ID, type_id,
8720 GDI_INFO_TEXT, infotext,
8721 GDI_X, SX + ED_SETTINGS_X(textarea_info[i].x),
8722 GDI_Y, SY + ED_SETTINGS_Y(textarea_info[i].y),
8723 GDI_TYPE, GD_TYPE_TEXT_AREA,
8724 GDI_AREA_SIZE, area_xsize, area_ysize,
8725 GDI_TEXT_FONT, FONT_INPUT_1,
8726 GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
8727 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8728 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8729 GDI_BORDER_SIZE, gd->border_size, gd->border_size,
8730 GDI_DESIGN_WIDTH, gd->width,
8731 GDI_EVENT_MASK, event_mask,
8732 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8733 GDI_CALLBACK_ACTION, HandleTextAreaGadgets,
8737 Fail("cannot create gadget");
8739 level_editor_gadget[id] = gi;
8743 static void CreateSelectboxGadgets(void)
8745 int max_infotext_len = getMaxInfoTextLength();
8749 for (i = 0; i < ED_NUM_SELECTBOX; i++)
8751 struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_SELECTBOX_INPUT];
8752 struct GraphicInfo *gd2 = &graphic_info[IMG_EDITOR_SELECTBOX_BUTTON];
8753 int gd_x1 = gd->src_x;
8754 int gd_y1 = gd->src_y;
8755 int gd_x2 = gd->src_x + gd->active_xoffset;
8756 int gd_y2 = gd->src_y + gd->active_yoffset;
8757 int selectbox_button_xsize = gd2->width;
8758 struct GadgetInfo *gi;
8759 char infotext[MAX_OUTPUT_LINESIZE + 1];
8760 int id = selectbox_info[i].gadget_id;
8761 int type_id = selectbox_info[i].gadget_type_id;
8762 int x = SX + ED_SETTINGS_X(selectbox_info[i].x);
8763 int y = SY + ED_SETTINGS_Y(selectbox_info[i].y);
8764 unsigned int event_mask =
8765 GD_EVENT_RELEASED | GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
8768 Fail("'selectbox_info' structure corrupted at index %d -- please fix", i);
8770 if (selectbox_info[i].size == -1) // dynamically determine size
8772 // (we cannot use -1 for uninitialized values if we directly compare
8773 // with results from strlen(), because the '<' and '>' operation will
8774 // implicitely cast -1 to an unsigned integer value!)
8775 selectbox_info[i].size = 0;
8777 for (j = 0; selectbox_info[i].options[j].text != NULL; j++)
8778 if (strlen(selectbox_info[i].options[j].text) > selectbox_info[i].size)
8779 selectbox_info[i].size = strlen(selectbox_info[i].options[j].text);
8781 selectbox_info[i].size++; // add one character empty space
8784 // determine horizontal position to the right of specified gadget
8785 if (selectbox_info[i].gadget_id_align != GADGET_ID_NONE)
8786 x = (right_gadget_border[selectbox_info[i].gadget_id_align] +
8787 ED_GADGET_TEXT_DISTANCE);
8789 // determine horizontal offset for leading text
8790 if (selectbox_info[i].text_left != NULL)
8791 x += getTextWidthForGadget(selectbox_info[i].text_left);
8793 sprintf(infotext, "%s", selectbox_info[i].infotext);
8794 infotext[max_infotext_len] = '\0';
8796 gi = CreateGadget(GDI_CUSTOM_ID, id,
8797 GDI_CUSTOM_TYPE_ID, type_id,
8798 GDI_INFO_TEXT, infotext,
8801 GDI_TYPE, GD_TYPE_SELECTBOX,
8802 GDI_SELECTBOX_OPTIONS, selectbox_info[i].options,
8803 GDI_SELECTBOX_CHAR_UNSELECTABLE, '[',
8804 GDI_TEXT_SIZE, selectbox_info[i].size,
8805 GDI_TEXT_FONT, FONT_INPUT_1,
8806 GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
8807 GDI_TEXT_FONT_UNSELECTABLE, FONT_TEXT_1,
8808 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8809 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8810 GDI_BORDER_SIZE, gd->border_size, gd->border_size,
8811 GDI_BORDER_SIZE_SELECTBUTTON, selectbox_button_xsize,
8812 GDI_DESIGN_WIDTH, gd->width,
8813 GDI_EVENT_MASK, event_mask,
8814 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8815 GDI_CALLBACK_ACTION, HandleSelectboxGadgets,
8819 Fail("cannot create gadget");
8821 level_editor_gadget[id] = gi;
8822 right_gadget_border[id] =
8823 getRightGadgetBorder(gi, selectbox_info[i].text_right);
8827 static void CreateTextbuttonGadgets(void)
8829 int max_infotext_len = getMaxInfoTextLength();
8832 for (i = 0; i < ED_NUM_TEXTBUTTONS; i++)
8834 int id = textbutton_info[i].gadget_id;
8835 int type_id = textbutton_info[i].gadget_type_id;
8837 ((id >= GADGET_ID_LEVELCONFIG_LEVEL && id <= GADGET_ID_LEVELCONFIG_ENGINE) ||
8838 (id >= GADGET_ID_ENGINECONFIG_CONFIG && id <= GADGET_ID_ENGINECONFIG_COLORS) ||
8839 (id >= GADGET_ID_PROPERTIES_INFO && id <= GADGET_ID_PROPERTIES_CHANGE));
8841 (is_tab_button ? IMG_EDITOR_TABBUTTON : IMG_EDITOR_TEXTBUTTON);
8842 int gadget_distance =
8843 (is_tab_button ? ED_GADGET_SMALL_DISTANCE : ED_GADGET_TEXT_DISTANCE);
8844 struct GraphicInfo *gd = &graphic_info[graphic];
8845 int gd_x1 = gd->src_x;
8846 int gd_y1 = gd->src_y;
8847 int gd_x2 = gd->src_x + gd->pressed_xoffset;
8848 int gd_y2 = gd->src_y + gd->pressed_yoffset;
8849 int gd_x1a = gd->src_x + gd->active_xoffset;
8850 int gd_y1a = gd->src_y + gd->active_yoffset;
8851 int border_xsize = gd->border_size + gd->draw_xoffset;
8852 int border_ysize = gd->border_size;
8853 struct GadgetInfo *gi;
8854 unsigned int event_mask = GD_EVENT_RELEASED;
8855 char infotext[MAX_OUTPUT_LINESIZE + 1];
8856 int x = SX + ED_SETTINGS_X(textbutton_info[i].x);
8857 int y = SY + ED_SETTINGS_Y(textbutton_info[i].y);
8860 Fail("'textbutton_info' structure corrupted at index %d -- please fix", i);
8862 if (textbutton_info[i].size == -1) // dynamically determine size
8863 textbutton_info[i].size = strlen(textbutton_info[i].text);
8865 sprintf(infotext, "%s", textbutton_info[i].infotext);
8866 infotext[max_infotext_len] = '\0';
8868 // determine horizontal position to the right of specified gadget
8869 if (textbutton_info[i].gadget_id_align != GADGET_ID_NONE)
8871 int gadget_id_align = textbutton_info[i].gadget_id_align;
8873 x = right_gadget_border[gadget_id_align] + gadget_distance;
8875 if (textbutton_info[i].y == -1)
8876 y = level_editor_gadget[gadget_id_align]->y;
8879 // determine horizontal offset for leading text
8880 if (textbutton_info[i].text_left != NULL)
8881 x += getTextWidthForGadget(textbutton_info[i].text_left);
8883 gi = CreateGadget(GDI_CUSTOM_ID, id,
8884 GDI_CUSTOM_TYPE_ID, type_id,
8885 GDI_IMAGE_ID, graphic,
8886 GDI_INFO_TEXT, infotext,
8889 GDI_TYPE, GD_TYPE_TEXT_BUTTON,
8890 GDI_TEXT_VALUE, textbutton_info[i].text,
8891 GDI_TEXT_SIZE, textbutton_info[i].size,
8892 GDI_TEXT_FONT, FONT_INPUT_2,
8893 GDI_TEXT_FONT_ACTIVE, FONT_INPUT_2_ACTIVE,
8894 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8895 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8896 GDI_ALT_DESIGN_UNPRESSED, gd->bitmap, gd_x1a, gd_y1a,
8897 GDI_BORDER_SIZE, border_xsize, border_ysize,
8898 GDI_DESIGN_WIDTH, gd->width,
8899 GDI_DECORATION_SHIFTING, 1, 1,
8900 GDI_EVENT_MASK, event_mask,
8901 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8902 GDI_CALLBACK_ACTION, HandleTextbuttonGadgets,
8906 Fail("cannot create gadget");
8908 level_editor_gadget[id] = gi;
8909 right_gadget_border[id] =
8910 getRightGadgetBorder(gi, textbutton_info[i].text_right);
8914 static void CreateGraphicbuttonGadgets(void)
8916 struct GadgetInfo *gi;
8919 // create buttons for scrolling of drawing area and element list
8920 for (i = 0; i < ED_NUM_GRAPHICBUTTONS; i++)
8922 int id = graphicbutton_info[i].gadget_id;
8923 int type_id = graphicbutton_info[i].gadget_type_id;
8924 int x = SX + ED_SETTINGS_X(graphicbutton_info[i].x);
8925 int y = SY + ED_SETTINGS_Y(graphicbutton_info[i].y);
8926 int graphic = graphicbutton_info[i].graphic;
8927 struct GraphicInfo *gd = &graphic_info[graphic];
8928 int gd_x1 = gd->src_x;
8929 int gd_y1 = gd->src_y;
8930 int gd_x2 = gd->src_x + gd->pressed_xoffset;
8931 int gd_y2 = gd->src_y + gd->pressed_yoffset;
8932 unsigned int event_mask = GD_EVENT_RELEASED;
8935 Fail("'graphicbutton_info' structure corrupted at index %d -- please fix", i);
8937 // determine horizontal position to the right of specified gadget
8938 if (graphicbutton_info[i].gadget_id_align != GADGET_ID_NONE)
8939 x = (right_gadget_border[graphicbutton_info[i].gadget_id_align] +
8940 ED_GADGET_TEXT_DISTANCE);
8942 // determine horizontal offset for leading text
8943 if (graphicbutton_info[i].text_left != NULL)
8944 x += getTextWidthForGadget(graphicbutton_info[i].text_left);
8946 gi = CreateGadget(GDI_CUSTOM_ID, id,
8947 GDI_CUSTOM_TYPE_ID, type_id,
8948 GDI_IMAGE_ID, graphic,
8949 GDI_INFO_TEXT, graphicbutton_info[i].infotext,
8952 GDI_WIDTH, gd->width,
8953 GDI_HEIGHT, gd->height,
8954 GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
8955 GDI_STATE, GD_BUTTON_UNPRESSED,
8956 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
8957 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
8958 GDI_EVENT_MASK, event_mask,
8959 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
8960 GDI_CALLBACK_ACTION, HandleGraphicbuttonGadgets,
8964 Fail("cannot create gadget");
8966 level_editor_gadget[id] = gi;
8967 right_gadget_border[id] =
8968 getRightGadgetBorder(gi, graphicbutton_info[i].text_right);
8972 static void CreateScrollbarGadgets(void)
8976 // these values are not constant, but can change at runtime
8977 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].x =
8978 SX + ED_SCROLL_HORIZONTAL_XPOS;
8979 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].y =
8980 SY + ED_SCROLL_HORIZONTAL_YPOS;
8981 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].width =
8982 ED_SCROLL_HORIZONTAL_XSIZE;
8983 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].height =
8984 ED_SCROLL_HORIZONTAL_YSIZE;
8985 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_x = SX;
8986 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_y = SY;
8987 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_width = SXSIZE;
8988 scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_height = SYSIZE;
8990 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].x =
8991 SX + ED_SCROLL_VERTICAL_XPOS;
8992 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].y =
8993 SY + ED_SCROLL_VERTICAL_YPOS;
8994 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].width =
8995 ED_SCROLL_VERTICAL_XSIZE;
8996 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].height =
8997 ED_SCROLL_VERTICAL_YSIZE;
8998 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_x = SX;
8999 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_y = SY;
9000 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_width = SXSIZE;
9001 scrollbar_pos[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_height = SYSIZE;
9003 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].x =
9004 PX + ED_SCROLL2_VERTICAL_XPOS;
9005 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].y =
9006 PY + ED_SCROLL2_VERTICAL_YPOS;
9007 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].width =
9008 ED_SCROLL2_VERTICAL_XSIZE;
9009 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].height =
9010 ED_SCROLL2_VERTICAL_YSIZE;
9011 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_x = PX;
9012 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_y = PY;
9013 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_width = PXSIZE;
9014 scrollbar_pos[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_height = PYSIZE;
9016 for (i = 0; i < ED_NUM_SCROLLBARS; i++)
9018 int id = scrollbar_info[i].gadget_id;
9019 int type_id = scrollbar_info[i].gadget_type_id;
9020 int graphic = scrollbar_info[i].graphic;
9021 struct GraphicInfo *gd = &graphic_info[graphic];
9022 int gd_x1 = gd->src_x;
9023 int gd_y1 = gd->src_y;
9024 int gd_x2 = gd->src_x + gd->pressed_xoffset;
9025 int gd_y2 = gd->src_y + gd->pressed_yoffset;
9026 struct GadgetInfo *gi;
9027 int items_max, items_visible, item_position;
9028 unsigned int event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
9031 Fail("'scrollbar_info' structure corrupted at index %d -- please fix", i);
9033 if (i == ED_SCROLLBAR_ID_LIST_VERTICAL)
9035 items_max = num_editor_elements / ED_ELEMENTLIST_BUTTONS_HORIZ;
9036 items_visible = ED_ELEMENTLIST_BUTTONS_VERT;
9037 item_position = element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ;
9039 else // drawing area scrollbars
9041 if (scrollbar_info[i].type == GD_TYPE_SCROLLBAR_HORIZONTAL)
9043 items_max = MAX(lev_fieldx + 2, ed_fieldx);
9044 items_visible = ed_fieldx;
9049 items_max = MAX(lev_fieldy + 2, ed_fieldy);
9050 items_visible = ed_fieldy;
9055 gi = CreateGadget(GDI_CUSTOM_ID, id,
9056 GDI_CUSTOM_TYPE_ID, type_id,
9057 GDI_IMAGE_ID, graphic,
9058 GDI_INFO_TEXT, scrollbar_info[i].infotext,
9059 GDI_X, scrollbar_pos[i].x,
9060 GDI_Y, scrollbar_pos[i].y,
9061 GDI_WIDTH, scrollbar_pos[i].width,
9062 GDI_HEIGHT, scrollbar_pos[i].height,
9063 GDI_TYPE, scrollbar_info[i].type,
9064 GDI_SCROLLBAR_ITEMS_MAX, items_max,
9065 GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
9066 GDI_SCROLLBAR_ITEM_POSITION, item_position,
9067 GDI_WHEEL_AREA_X, scrollbar_pos[i].wheel_x,
9068 GDI_WHEEL_AREA_Y, scrollbar_pos[i].wheel_y,
9069 GDI_WHEEL_AREA_WIDTH, scrollbar_pos[i].wheel_width,
9070 GDI_WHEEL_AREA_HEIGHT, scrollbar_pos[i].wheel_height,
9071 GDI_STATE, GD_BUTTON_UNPRESSED,
9072 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
9073 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
9074 GDI_BORDER_SIZE, gd->border_size, gd->border_size,
9075 GDI_EVENT_MASK, event_mask,
9076 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
9077 GDI_CALLBACK_ACTION, HandleControlButtons,
9081 Fail("cannot create gadget");
9083 level_editor_gadget[id] = gi;
9087 static void CreateCheckbuttonGadgets(void)
9089 struct GadgetInfo *gi;
9092 for (i = 0; i < ED_NUM_CHECKBUTTONS; i++)
9094 int id = checkbutton_info[i].gadget_id;
9095 int type_id = checkbutton_info[i].gadget_type_id;
9096 int graphic = (id == GADGET_ID_STICK_ELEMENT ? IMG_EDITOR_STICKYBUTTON :
9097 IMG_EDITOR_CHECKBOX);
9098 struct GraphicInfo *gd = &graphic_info[graphic];
9099 int gd_x1 = gd->src_x;
9100 int gd_y1 = gd->src_y;
9101 int gd_x2 = gd->src_x + gd->pressed_xoffset;
9102 int gd_y2 = gd->src_y + gd->pressed_yoffset;
9103 int gd_x1a = gd->src_x + gd->active_xoffset;
9104 int gd_y1a = gd->src_y + gd->active_yoffset;
9105 int gd_x2a = gd->src_x + gd->active_xoffset + gd->pressed_xoffset;
9106 int gd_y2a = gd->src_y + gd->active_yoffset + gd->pressed_yoffset;
9107 int x = SX + ED_SETTINGS_X(checkbutton_info[i].x);
9108 int y = SY + ED_SETTINGS_Y(checkbutton_info[i].y);
9109 unsigned int event_mask = GD_EVENT_PRESSED;
9112 Fail("'checkbutton_info' structure corrupted at index %d -- please fix", i);
9114 // determine horizontal position to the right of specified gadget
9115 if (checkbutton_info[i].gadget_id_align != GADGET_ID_NONE)
9116 x = (right_gadget_border[checkbutton_info[i].gadget_id_align] +
9117 ED_GADGET_TEXT_DISTANCE);
9119 // determine horizontal offset for leading text
9120 if (checkbutton_info[i].text_left != NULL)
9121 x += getTextWidthForGadget(checkbutton_info[i].text_left);
9123 gi = CreateGadget(GDI_CUSTOM_ID, id,
9124 GDI_CUSTOM_TYPE_ID, type_id,
9125 GDI_IMAGE_ID, graphic,
9126 GDI_INFO_TEXT, checkbutton_info[i].infotext,
9129 GDI_WIDTH, gd->width,
9130 GDI_HEIGHT, gd->height,
9131 GDI_TYPE, GD_TYPE_CHECK_BUTTON,
9132 GDI_CHECKED, *checkbutton_info[i].value,
9133 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
9134 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
9135 GDI_ALT_DESIGN_UNPRESSED, gd->bitmap, gd_x1a, gd_y1a,
9136 GDI_ALT_DESIGN_PRESSED, gd->bitmap, gd_x2a, gd_y2a,
9137 GDI_EVENT_MASK, event_mask,
9138 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
9139 GDI_CALLBACK_ACTION, HandleCheckbuttons,
9143 Fail("cannot create gadget");
9145 level_editor_gadget[id] = gi;
9146 right_gadget_border[id] =
9147 getRightGadgetBorder(gi, checkbutton_info[i].text_right);
9151 static void CreateRadiobuttonGadgets(void)
9153 int graphic = IMG_EDITOR_RADIOBUTTON;
9154 struct GraphicInfo *gd = &graphic_info[graphic];
9155 int gd_x1 = gd->src_x;
9156 int gd_y1 = gd->src_y;
9157 int gd_x2 = gd->src_x + gd->pressed_xoffset;
9158 int gd_y2 = gd->src_y + gd->pressed_yoffset;
9159 int gd_x1a = gd->src_x + gd->active_xoffset;
9160 int gd_y1a = gd->src_y + gd->active_yoffset;
9161 int gd_x2a = gd->src_x + gd->active_xoffset + gd->pressed_xoffset;
9162 int gd_y2a = gd->src_y + gd->active_yoffset + gd->pressed_yoffset;
9163 struct GadgetInfo *gi;
9166 for (i = 0; i < ED_NUM_RADIOBUTTONS; i++)
9168 int id = radiobutton_info[i].gadget_id;
9169 int type_id = radiobutton_info[i].gadget_type_id;
9170 int x = SX + ED_SETTINGS_X(radiobutton_info[i].x);
9171 int y = SY + ED_SETTINGS_Y(radiobutton_info[i].y);
9172 unsigned int event_mask = GD_EVENT_PRESSED;
9175 Fail("'radiobutton_info' structure corrupted at index %d -- please fix", i);
9178 (*radiobutton_info[i].value == radiobutton_info[i].checked_value);
9180 // determine horizontal position to the right of specified gadget
9181 if (radiobutton_info[i].gadget_id_align != GADGET_ID_NONE)
9182 x = (right_gadget_border[radiobutton_info[i].gadget_id_align] +
9183 ED_GADGET_TEXT_DISTANCE);
9185 // determine horizontal offset for leading text
9186 if (radiobutton_info[i].text_left != NULL)
9187 x += getTextWidthForGadget(radiobutton_info[i].text_left);
9189 gi = CreateGadget(GDI_CUSTOM_ID, id,
9190 GDI_CUSTOM_TYPE_ID, type_id,
9191 GDI_IMAGE_ID, graphic,
9192 GDI_INFO_TEXT, radiobutton_info[i].infotext,
9195 GDI_WIDTH, gd->width,
9196 GDI_HEIGHT, gd->height,
9197 GDI_TYPE, GD_TYPE_RADIO_BUTTON,
9198 GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
9199 GDI_CHECKED, checked,
9200 GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
9201 GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y2,
9202 GDI_ALT_DESIGN_UNPRESSED, gd->bitmap, gd_x1a, gd_y1a,
9203 GDI_ALT_DESIGN_PRESSED, gd->bitmap, gd_x2a, gd_y2a,
9204 GDI_EVENT_MASK, event_mask,
9205 GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
9206 GDI_CALLBACK_ACTION, HandleRadiobuttons,
9210 Fail("cannot create gadget");
9212 level_editor_gadget[id] = gi;
9213 right_gadget_border[id] =
9214 getRightGadgetBorder(gi, radiobutton_info[i].text_right);
9218 void CreateLevelEditorGadgets(void)
9220 // force EDITOR font inside level editor
9221 SetFontStatus(GAME_MODE_EDITOR);
9223 // these values are not constant, but can change at runtime
9224 ed_fieldx = MAX_ED_FIELDX - 1;
9225 ed_fieldy = MAX_ED_FIELDY - 1;
9227 num_editor_gadgets = NUM_EDITOR_GADGETS;
9229 // Debug("editor", "allocating %d gadgets ...\n", num_editor_gadgets);
9231 level_editor_gadget =
9232 checked_calloc(num_editor_gadgets * sizeof(struct GadgetInfo *));
9233 right_gadget_border =
9234 checked_calloc(num_editor_gadgets * sizeof(int));
9236 // set number of empty (padding) element buttons to maximum number of buttons
9237 num_editor_el_empty = ED_NUM_ELEMENTLIST_BUTTONS;
9239 editor_el_empty = checked_calloc(num_editor_el_empty * sizeof(int));
9240 editor_el_empty_ptr = editor_el_empty;
9242 use_permanent_palette = !editor.palette.show_as_separate_screen;
9244 InitGadgetScreenBorders(-1, INFOTEXT_YPOS);
9246 ReinitializeElementList();
9248 CreateControlButtons();
9249 CreateScrollbarGadgets();
9251 // order of function calls is important because of cross-references
9252 CreateCheckbuttonGadgets();
9253 CreateCounterButtons();
9254 CreateRadiobuttonGadgets();
9255 CreateTextInputGadgets();
9256 CreateTextAreaGadgets();
9257 CreateSelectboxGadgets();
9258 CreateGraphicbuttonGadgets();
9259 CreateTextbuttonGadgets();
9260 CreateDrawingAreas();
9265 void FreeLevelEditorGadgets(void)
9269 // Debug("editor", "freeing %d gadgets ...\n", num_editor_gadgets);
9271 for (i = 0; i < num_editor_gadgets; i++)
9273 FreeGadget(level_editor_gadget[i]);
9275 level_editor_gadget[i] = NULL;
9278 checked_free(level_editor_gadget);
9279 checked_free(right_gadget_border);
9281 checked_free(editor_el_empty);
9284 static void MapCounterButtons(int id)
9286 int font_nr = FONT_TEXT_1;
9287 int font_height = getFontHeight(font_nr);
9288 int gadget_id_down = counterbutton_info[id].gadget_id_down;
9289 int gadget_id_text = counterbutton_info[id].gadget_id_text;
9290 int gadget_id_up = counterbutton_info[id].gadget_id_up;
9291 struct GadgetInfo *gi_down = level_editor_gadget[gadget_id_down];
9292 struct GadgetInfo *gi_text = level_editor_gadget[gadget_id_text];
9293 struct GadgetInfo *gi_up = level_editor_gadget[gadget_id_up];
9294 int xoffset_left = getTextWidthForGadget(counterbutton_info[id].text_left);
9295 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9296 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9297 int yoffset = (gi_down->height - font_height) / 2;
9298 int x_left = gi_down->x - xoffset_left;
9299 int x_right; // set after gadget position was modified
9300 int y_above = gi_down->y - yoffset_above;
9302 int y; // set after gadget position was modified
9304 // counter limits must be changed first to prevent value truncation
9305 ModifyEditorCounterLimits(id, counterbutton_info[id].min_value,
9306 counterbutton_info[id].max_value);
9308 // right text position might have changed after setting position above
9309 x_right = gi_up->x + gi_up->width + xoffset_right;
9311 ModifyEditorCounterValue(id, *counterbutton_info[id].value);
9313 // set position for counter gadgets with dynamically determined position
9314 if (id != ED_COUNTER_ID_SELECT_LEVEL)
9316 ModifyGadget(gi_down, GDI_Y, SY + ED_SETTINGS_Y(counterbutton_info[id].y), GDI_END);
9317 ModifyGadget(gi_text, GDI_Y, SY + ED_SETTINGS_Y(counterbutton_info[id].y), GDI_END);
9318 ModifyGadget(gi_up, GDI_Y, SY + ED_SETTINGS_Y(counterbutton_info[id].y), GDI_END);
9321 // vertical position might have changed after setting position above
9322 y = gi_up->y + yoffset;
9324 if (counterbutton_info[id].text_above)
9325 DrawText(x, y_above, counterbutton_info[id].text_above, font_nr);
9327 if (counterbutton_info[id].text_left)
9328 DrawText(x_left, y, counterbutton_info[id].text_left, font_nr);
9330 if (counterbutton_info[id].text_right)
9331 DrawText(x_right, y, counterbutton_info[id].text_right, font_nr);
9338 static void MapControlButtons(void)
9343 // map toolbox buttons (excluding special CE toolbox buttons)
9344 for (i = 0; i < ED_NUM_CTRL1_2_BUTTONS; i++)
9345 MapGadget(level_editor_gadget[i]);
9347 // map toolbox buttons (element properties buttons)
9348 for (i = ED_NUM_CTRL1_4_BUTTONS; i < ED_NUM_CTRL1_7_BUTTONS; i++)
9349 MapGadget(level_editor_gadget[i]);
9351 if (use_permanent_palette)
9353 // map buttons to select elements
9354 for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
9355 MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
9356 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
9357 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_UP]);
9358 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_DOWN]);
9361 // map buttons to select level
9362 counter_id = ED_COUNTER_ID_SELECT_LEVEL;
9363 counterbutton_info[counter_id].min_value = leveldir_current->first_level;
9364 counterbutton_info[counter_id].max_value = leveldir_current->last_level;
9365 MapCounterButtons(counter_id);
9368 static void MapDrawingArea(int id)
9370 int font_nr = FONT_TEXT_1;
9371 int font_height = getFontHeight(font_nr);
9372 struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
9373 int area_xsize = gi->drawing.area_xsize;
9374 int area_ysize = gi->drawing.area_ysize;
9375 int xoffset_left = getTextWidthForDrawingArea(drawingarea_info[id].text_left);
9376 int xoffset_below = getTextWidth(drawingarea_info[id].text_below, font_nr);
9377 int x_left = gi->x - xoffset_left - ED_DRAWINGAREA_BORDER_SIZE;
9378 int x_right = gi->x + gi->width + ED_DRAWINGAREA_TEXT_DISTANCE;
9379 int x_above = gi->x - ED_DRAWINGAREA_BORDER_SIZE;
9380 int x_below = gi->x + (gi->width - xoffset_below) / 2;
9381 int y_side = gi->y + (gi->height - font_height) / 2;
9382 int y_above = gi->y - font_height - ED_DRAWINGAREA_TEXT_DISTANCE;
9383 int y_below = gi->y + gi->height + ED_DRAWINGAREA_TEXT_DISTANCE;
9385 if (drawingarea_info[id].text_left)
9386 DrawText(x_left, y_side, drawingarea_info[id].text_left, font_nr);
9388 if (drawingarea_info[id].text_right)
9389 DrawText(x_right, y_side, drawingarea_info[id].text_right, font_nr);
9391 if (drawingarea_info[id].text_above)
9392 DrawText(x_above, y_above, drawingarea_info[id].text_above, font_nr);
9394 if (drawingarea_info[id].text_below)
9395 DrawText(x_below, y_below, drawingarea_info[id].text_below, font_nr);
9397 if (id != ED_DRAWING_ID_DRAWING_LEVEL)
9399 DrawElementBorder(gi->x, gi->y,
9400 area_xsize * ED_DRAWINGAREA_TILE_SIZE,
9401 area_ysize * ED_DRAWINGAREA_TILE_SIZE, TRUE);
9403 DrawDrawingArea(id);
9409 static void MapTextInputGadget(int id)
9411 int font_nr = FONT_TEXT_1;
9412 int font_height = getFontHeight(font_nr);
9413 struct GadgetInfo *gi = level_editor_gadget[textinput_info[id].gadget_id];
9414 int xoffset_left = getTextWidthForGadget(textinput_info[id].text_left);
9415 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9416 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9417 int yoffset = (gi->height - font_height) / 2;
9418 int x_left = gi->x - xoffset_left;
9419 int x_right = gi->x + gi->width + xoffset_right;
9420 int y_above = gi->y - yoffset_above;
9421 int y = gi->y + yoffset;
9423 if (textinput_info[id].text_above)
9424 DrawText(x_left, y_above, textinput_info[id].text_above, font_nr);
9426 if (textinput_info[id].text_left)
9427 DrawText(x_left, y, textinput_info[id].text_left, font_nr);
9429 if (textinput_info[id].text_right)
9430 DrawText(x_right, y, textinput_info[id].text_right, font_nr);
9432 ModifyGadget(gi, GDI_TEXT_VALUE, textinput_info[id].value, GDI_END);
9437 static void MapTextAreaGadget(int id)
9439 int font_nr = FONT_TEXT_1;
9440 int font_height = getFontHeight(font_nr);
9441 struct GadgetInfo *gi = level_editor_gadget[textarea_info[id].gadget_id];
9442 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9443 int x_above = ED_SETTINGS_X(textarea_info[id].x);
9444 int y_above = ED_SETTINGS_Y(textarea_info[id].y) - yoffset_above;
9445 char *text_above = textarea_info[id].text_above;
9447 if (gi->textarea.cropped && textarea_info[id].text_above_cropped)
9448 text_above = textarea_info[id].text_above_cropped;
9451 DrawTextS(x_above, y_above, font_nr, text_above);
9453 ModifyGadget(gi, GDI_TEXT_VALUE, textarea_info[id].value, GDI_END);
9458 static void MapSelectboxGadget(int id)
9460 int font_nr = FONT_TEXT_1;
9461 int font_height = getFontHeight(font_nr);
9462 struct GadgetInfo *gi = level_editor_gadget[selectbox_info[id].gadget_id];
9463 int xoffset_left = getTextWidthForGadget(selectbox_info[id].text_left);
9464 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9465 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9466 int yoffset = (gi->height - font_height) / 2;
9467 int x_left = gi->x - xoffset_left;
9468 int x_right = gi->x + gi->width + xoffset_right;
9469 int y_above = gi->y - yoffset_above;
9470 int y = gi->y + yoffset;
9472 if (selectbox_info[id].text_above)
9473 DrawText(x_left, y_above, selectbox_info[id].text_above, font_nr);
9475 if (selectbox_info[id].text_left)
9476 DrawText(x_left, y, selectbox_info[id].text_left, font_nr);
9478 if (selectbox_info[id].text_right)
9479 DrawText(x_right, y, selectbox_info[id].text_right, font_nr);
9481 ModifyEditorSelectboxValue(id, *selectbox_info[id].value);
9486 static void MapTextbuttonGadget(int id)
9488 int font_nr = FONT_TEXT_1;
9489 int font_height = getFontHeight(font_nr);
9490 struct GadgetInfo *gi = level_editor_gadget[textbutton_info[id].gadget_id];
9491 int xoffset_left = getTextWidthForGadget(textbutton_info[id].text_left);
9492 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9493 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9494 int yoffset = (gi->height - font_height) / 2;
9495 int x_left = gi->x - xoffset_left;
9496 int x_right = gi->x + gi->width + xoffset_right;
9497 int y_above = gi->y - yoffset_above;
9499 int y = gi->y + yoffset;
9501 // only show button to delete change pages when more than minimum pages
9502 if (id == ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE &&
9503 custom_element.num_change_pages == MIN_CHANGE_PAGES)
9506 if (textbutton_info[id].text_above)
9507 DrawText(x, y_above, textbutton_info[id].text_above, font_nr);
9509 if (textbutton_info[id].text_left)
9510 DrawText(x_left, y, textbutton_info[id].text_left, font_nr);
9512 if (textbutton_info[id].text_right)
9513 DrawText(x_right, y, textbutton_info[id].text_right, font_nr);
9518 static void MapGraphicbuttonGadget(int id)
9520 int font_nr = FONT_TEXT_1;
9521 int font_height = getFontHeight(font_nr);
9522 struct GadgetInfo *gi = level_editor_gadget[graphicbutton_info[id].gadget_id];
9523 int xoffset_left = getTextWidthForGadget(graphicbutton_info[id].text_left);
9524 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9525 int yoffset = (gi->height - font_height) / 2;
9526 int x_left = gi->x - xoffset_left;
9527 int x_right = gi->x + gi->width + xoffset_right;
9528 int y = gi->y + yoffset;
9530 if (graphicbutton_info[id].text_left)
9531 DrawText(x_left, y, graphicbutton_info[id].text_left, font_nr);
9533 if (graphicbutton_info[id].text_right)
9534 DrawText(x_right, y, graphicbutton_info[id].text_right, font_nr);
9539 static void MapRadiobuttonGadget(int id)
9541 int font_nr = FONT_TEXT_1;
9542 int font_height = getFontHeight(font_nr);
9543 struct GadgetInfo *gi = level_editor_gadget[radiobutton_info[id].gadget_id];
9544 int xoffset_left = getTextWidthForGadget(checkbutton_info[id].text_left);
9545 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9546 int yoffset = (gi->height - font_height) / 2;
9547 int x_left = gi->x - xoffset_left;
9548 int x_right = gi->x + gi->width + xoffset_right;
9549 int y = gi->y + yoffset;
9551 (*radiobutton_info[id].value == radiobutton_info[id].checked_value);
9553 if (radiobutton_info[id].text_left)
9554 DrawText(x_left, y, radiobutton_info[id].text_left, font_nr);
9556 if (radiobutton_info[id].text_right)
9557 DrawText(x_right, y, radiobutton_info[id].text_right, font_nr);
9559 ModifyGadget(gi, GDI_CHECKED, checked, GDI_END);
9564 static void MapCheckbuttonGadget(int id)
9566 int font_nr = FONT_TEXT_1;
9567 int font_height = getFontHeight(font_nr);
9568 struct GadgetInfo *gi = level_editor_gadget[checkbutton_info[id].gadget_id];
9569 int xoffset_left = getTextWidthForGadget(checkbutton_info[id].text_left);
9570 int xoffset_right = ED_GADGET_TEXT_DISTANCE;
9571 int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
9572 int yoffset = (gi->height - font_height) / 2;
9573 int y_above = gi->y - yoffset_above;
9575 int x_left, x_right, y; // set after gadget position was modified
9577 // set position for gadgets with dynamically determined position
9578 if (checkbutton_info[id].x != -1) // do not change dynamic positions
9579 ModifyGadget(gi, GDI_X, SX + ED_SETTINGS_X(checkbutton_info[id].x), GDI_END);
9580 ModifyGadget(gi, GDI_Y, SY + ED_SETTINGS_Y(checkbutton_info[id].y), GDI_END);
9582 x_left = gi->x - xoffset_left;
9583 x_right = gi->x + gi->width + xoffset_right;
9584 y = gi->y + yoffset;
9586 if (checkbutton_info[id].text_above)
9587 DrawText(x, y_above, checkbutton_info[id].text_above, font_nr);
9589 if (checkbutton_info[id].text_left)
9590 DrawText(x_left, y, checkbutton_info[id].text_left, font_nr);
9592 if (checkbutton_info[id].text_right)
9593 DrawText(x_right, y, checkbutton_info[id].text_right, font_nr);
9595 ModifyGadget(gi, GDI_CHECKED, *checkbutton_info[id].value, GDI_END);
9600 static void MapMainDrawingArea(void)
9602 boolean no_horizontal_scrollbar = (lev_fieldx + 2 <= ed_fieldx);
9603 boolean no_vertical_scrollbar = (lev_fieldy + 2 <= ed_fieldy);
9606 if (suppressBorderElement())
9608 no_horizontal_scrollbar = (lev_fieldx <= ed_fieldx);
9609 no_vertical_scrollbar = (lev_fieldy <= ed_fieldy);
9612 for (i = ED_SCROLLBUTTON_ID_AREA_FIRST; i <= ED_SCROLLBUTTON_ID_AREA_LAST; i++)
9614 if (((i == ED_SCROLLBUTTON_ID_AREA_LEFT ||
9615 i == ED_SCROLLBUTTON_ID_AREA_RIGHT) &&
9616 no_horizontal_scrollbar) ||
9617 ((i == ED_SCROLLBUTTON_ID_AREA_UP ||
9618 i == ED_SCROLLBUTTON_ID_AREA_DOWN) &&
9619 no_vertical_scrollbar))
9622 MapGadget(level_editor_gadget[scrollbutton_info[i].gadget_id]);
9625 for (i = ED_SCROLLBAR_ID_AREA_FIRST; i <= ED_SCROLLBAR_ID_AREA_LAST; i++)
9627 if ((i == ED_SCROLLBAR_ID_AREA_HORIZONTAL && no_horizontal_scrollbar) ||
9628 (i == ED_SCROLLBAR_ID_AREA_VERTICAL && no_vertical_scrollbar))
9631 MapGadget(level_editor_gadget[scrollbar_info[i].gadget_id]);
9634 MapDrawingArea(ED_DRAWING_ID_DRAWING_LEVEL);
9637 static void MapOrUnmapLevelEditorToolboxCustomGadgets(boolean map)
9641 for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
9643 if (i == GADGET_ID_CUSTOM_COPY_FROM ||
9644 i == GADGET_ID_CUSTOM_COPY_TO ||
9645 i == GADGET_ID_CUSTOM_EXCHANGE ||
9646 i == GADGET_ID_CUSTOM_COPY ||
9647 i == GADGET_ID_CUSTOM_PASTE)
9650 MapGadget(level_editor_gadget[i]);
9652 UnmapGadget(level_editor_gadget[i]);
9657 static void MapLevelEditorToolboxCustomGadgets(void)
9659 MapOrUnmapLevelEditorToolboxCustomGadgets(TRUE);
9662 static void MapLevelEditorToolboxCustomGadgetsIfNeeded(void)
9664 if (IS_CUSTOM_ELEMENT(properties_element) ||
9665 IS_GROUP_ELEMENT(properties_element) ||
9666 IS_EMPTY_ELEMENT(properties_element))
9667 MapLevelEditorToolboxCustomGadgets();
9670 static void UnmapLevelEditorToolboxCustomGadgets(void)
9672 MapOrUnmapLevelEditorToolboxCustomGadgets(FALSE);
9675 static void MapOrUnmapLevelEditorToolboxDrawingGadgets(boolean map)
9679 for (i = 0; i < ED_NUM_CTRL1_BUTTONS; i++)
9681 if (i != GADGET_ID_SINGLE_ITEMS &&
9682 i != GADGET_ID_PICK_ELEMENT)
9684 struct GadgetInfo *gi = level_editor_gadget[i];
9692 int graphic = IMG_EDITOR_NO_TOOLBOX_BUTTON;
9693 struct GraphicInfo *gd = &graphic_info[graphic];
9697 BlitBitmap(gd->bitmap, drawto, gd->src_x, gd->src_y,
9698 gi->width, gi->height, gi->x, gi->y);
9700 redraw_mask |= REDRAW_DOOR_3;
9706 static void MapLevelEditorToolboxDrawingGadgets(void)
9708 MapOrUnmapLevelEditorToolboxDrawingGadgets(TRUE);
9711 static void UnmapLevelEditorToolboxDrawingGadgets(void)
9713 MapOrUnmapLevelEditorToolboxDrawingGadgets(FALSE);
9716 static void UnmapDrawingArea(int id)
9718 UnmapGadget(level_editor_gadget[drawingarea_info[id].gadget_id]);
9721 static void UnmapLevelEditorFieldGadgets(void)
9725 for (i = 0; i < num_editor_gadgets; i++)
9726 if (IN_GFX_FIELD_FULL(level_editor_gadget[i]->x,
9727 level_editor_gadget[i]->y))
9728 UnmapGadget(level_editor_gadget[i]);
9731 void UnmapLevelEditorGadgets(void)
9735 for (i = 0; i < num_editor_gadgets; i++)
9736 UnmapGadget(level_editor_gadget[i]);
9739 static void ResetUndoBuffer(void)
9741 undo_buffer_position = -1;
9742 undo_buffer_steps = -1;
9743 redo_buffer_steps = 0;
9745 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
9747 level.changed = FALSE;
9750 static void DrawEditModeWindowExt(boolean remap_toolbox_gadgets)
9752 if (remap_toolbox_gadgets)
9754 ModifyEditorElementList();
9755 RedrawDrawingElements();
9758 if (edit_mode == ED_MODE_LEVELCONFIG)
9759 DrawLevelConfigWindow();
9760 else if (edit_mode == ED_MODE_PROPERTIES)
9761 DrawPropertiesWindow();
9762 else if (edit_mode == ED_MODE_PALETTE)
9763 DrawPaletteWindow();
9764 else // edit_mode == ED_MODE_DRAWING
9765 DrawDrawingWindowExt(remap_toolbox_gadgets);
9768 static void DrawEditModeWindow(void)
9770 DrawEditModeWindowExt(TRUE);
9773 static void DrawEditModeWindow_PlayfieldOnly(void)
9775 DrawEditModeWindowExt(FALSE);
9778 static void ChangeEditModeWindow(int new_edit_mode)
9780 edit_mode = (new_edit_mode != edit_mode ? new_edit_mode : ED_MODE_DRAWING);
9782 DrawEditModeWindow();
9785 static boolean LevelChanged(void)
9787 boolean field_changed = FALSE;
9790 for (y = 0; y < lev_fieldy; y++)
9791 for (x = 0; x < lev_fieldx; x++)
9792 if (Tile[x][y] != level.field[x][y])
9793 field_changed = TRUE;
9795 return (level.changed || field_changed);
9798 static boolean PrepareSavingIntoPersonalLevelSet(void)
9800 static LevelDirTree *last_copied_leveldir = NULL;
9801 static LevelDirTree *last_written_leveldir = NULL;
9802 static int last_copied_level_nr = -1;
9803 static int last_written_level_nr = -1;
9804 LevelDirTree *leveldir_former = leveldir_current;
9805 int level_nr_former = level_nr;
9808 // remember last mod/save so that for current session, we write
9809 // back to the same personal copy, asking only about overwrite.
9810 if (leveldir_current == last_copied_leveldir &&
9811 level_nr == last_copied_level_nr)
9813 // "cd" to personal level set dir (as used when writing last copy)
9814 leveldir_current = last_written_leveldir;
9815 level_nr = last_written_level_nr;
9820 if (!Request("This level is read-only! "
9821 "Save into personal level set?", REQ_ASK))
9824 // "cd" to personal level set dir (for writing copy the first time)
9826 getTreeInfoFromIdentifier(leveldir_first, getLoginName());
9828 // this may happen if "setup.internal.create_user_levelset" is FALSE
9829 // or if file "levelinfo.conf" is missing in personal user level set
9830 if (leveldir_current == NULL)
9832 Request("Cannot find personal level set?!", REQ_CONFIRM);
9834 leveldir_current = leveldir_former;
9839 // find unused level number
9840 for (new_level_nr = leveldir_current->first_level; ; new_level_nr++)
9842 static char *level_filename = NULL;
9844 setString(&level_filename, getDefaultLevelFilename(new_level_nr));
9846 if (!fileExists(level_filename))
9850 last_copied_leveldir = leveldir_former;
9851 last_copied_level_nr = level_nr_former;
9853 last_written_leveldir = leveldir_current;
9854 last_written_level_nr = level_nr = new_level_nr;
9859 static void ModifyLevelConfigForSavingIntoPersonalLevelSet(char *former_name)
9861 static char *filename_levelinfo = NULL, *mod_name = NULL;
9864 // annotate this copy-and-mod in personal levelinfo.conf
9865 setString(&filename_levelinfo,
9866 getPath2(getCurrentLevelDir(), LEVELINFO_FILENAME));
9868 if ((file = fopen(filename_levelinfo, MODE_APPEND)))
9870 fprintf(file, "\n");
9871 fprintf(file, "# level %d was modified from:\n", level_nr);
9872 fprintf(file, "# - previous level set name: %s\n",
9874 fprintf(file, "# - level within previous set: %d \"%s\"\n",
9875 level.file_info.nr, level.name);
9876 fprintf(file, "# - previous author: %s\n",
9878 fprintf(file, "# - previous save date: ");
9880 if (level.creation_date.src == DATE_SRC_LEVELFILE)
9882 fprintf(file, "%04d-%02d-%02d\n",
9883 level.creation_date.year,
9884 level.creation_date.month,
9885 level.creation_date.day);
9889 fprintf(file, "not recorded\n");
9895 if (level_nr > leveldir_current->last_level)
9896 UpdateUserLevelSet(getLoginName(), NULL, NULL, level_nr + 9);
9898 // else: allow the save even if annotation failed
9900 // now... spray graffiti on the old level vital statistics
9901 // user can change these; just trying to set a good baseline
9903 // don't truncate names for fear of making offensive or silly:
9904 // long-named original author only recorded in levelinfo.conf.
9905 // try to fit "Joe after Bob", "Joe (ed.)", then just "Joe"
9906 if (!strEqual(level.author, leveldir_current->author))
9908 setString(&mod_name, getStringCat3(leveldir_current->author,
9909 " after ", level.author));
9911 if (strlen(mod_name) > MAX_LEVEL_AUTHOR_LEN)
9912 setString(&mod_name,
9913 getStringCat2(leveldir_current->author, " (ed.)"));
9915 if (strlen(mod_name) > MAX_LEVEL_AUTHOR_LEN)
9916 setString(&mod_name, leveldir_current->author);
9918 strncpy(level.author, mod_name, MAX_LEVEL_AUTHOR_LEN);
9920 // less worried about truncation here
9921 setString(&mod_name, getStringCat2("Mod: ", level.name));
9922 strncpy(level.name, mod_name, MAX_LEVEL_NAME_LEN);
9926 static void CopyPlayfield(short src[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
9927 short dst[MAX_LEV_FIELDX][MAX_LEV_FIELDY])
9931 for (x = 0; x < lev_fieldx; x++)
9932 for (y = 0; y < lev_fieldy; y++)
9933 dst[x][y] = src[x][y];
9936 static int setSelectboxValue(int selectbox_id, int new_value)
9938 int new_index_value = 0;
9941 for (i = 0; selectbox_info[selectbox_id].options[i].text != NULL; i++)
9942 if (selectbox_info[selectbox_id].options[i].value == new_value)
9943 new_index_value = i;
9945 *selectbox_info[selectbox_id].value =
9946 selectbox_info[selectbox_id].options[new_index_value].value;
9948 return new_index_value;
9951 static void setSelectboxSpecialActionVariablesIfNeeded(void)
9955 // change action mode and arg variables according to action type variable
9956 for (i = 0; action_arg_options[i].value != -1; i++)
9958 if (action_arg_options[i].value == custom_element_change.action_type)
9960 int mode = action_arg_options[i].mode;
9962 // only change if corresponding selectbox has changed
9963 if (selectbox_info[ED_SELECTBOX_ID_ACTION_MODE].options !=
9964 action_arg_modes[mode])
9965 custom_element_change.action_mode = -1;
9967 // only change if corresponding selectbox has changed
9968 if (selectbox_info[ED_SELECTBOX_ID_ACTION_ARG].options !=
9969 action_arg_options[i].options)
9970 custom_element_change.action_arg = -1;
9977 static void setSelectboxSpecialActionOptions(void)
9981 // change action mode and arg selectbox according to action type selectbox
9982 for (i = 0; action_arg_options[i].value != -1; i++)
9984 if (action_arg_options[i].value == custom_element_change.action_type)
9986 int mode = action_arg_options[i].mode;
9988 ModifyEditorSelectboxOptions(ED_SELECTBOX_ID_ACTION_MODE,
9989 action_arg_modes[mode]);
9990 ModifyEditorSelectboxValue(ED_SELECTBOX_ID_ACTION_MODE,
9991 custom_element_change.action_mode);
9993 ModifyEditorSelectboxOptions(ED_SELECTBOX_ID_ACTION_ARG,
9994 action_arg_options[i].options);
9995 ModifyEditorSelectboxValue(ED_SELECTBOX_ID_ACTION_ARG,
9996 custom_element_change.action_arg);
10002 static void copy_custom_element_settings(int element_from, int element_to)
10004 struct ElementInfo *ei_from = &element_info[element_from];
10005 struct ElementInfo *ei_to = &element_info[element_to];
10007 copyElementInfo(ei_from, ei_to);
10010 static void replace_custom_element_in_settings(int element_from,
10015 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
10017 struct ElementInfo *ei = &element_info[i];
10019 for (y = 0; y < 3; y++)
10020 for (x = 0; x < 3; x++)
10021 if (ei->content.e[x][y] == element_from)
10022 ei->content.e[x][y] = element_to;
10024 for (j = 0; j < ei->num_change_pages; j++)
10026 struct ElementChangeInfo *change = &ei->change_page[j];
10028 if (change->target_element == element_from)
10029 change->target_element = element_to;
10031 if (change->initial_trigger_element == element_from)
10032 change->initial_trigger_element = element_to;
10034 if (change->action_element == element_from)
10035 change->action_element = element_to;
10037 for (y = 0; y < 3; y++)
10038 for (x = 0; x < 3; x++)
10039 if (change->target_content.e[x][y] == element_from)
10040 change->target_content.e[x][y] = element_to;
10043 if (ei->group != NULL) // group or internal
10044 for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
10045 if (ei->group->element[j] == element_from)
10046 ei->group->element[j] = element_to;
10050 static void replace_custom_element_in_playfield(int element_from,
10055 for (x = 0; x < lev_fieldx; x++)
10056 for (y = 0; y < lev_fieldy; y++)
10057 if (Tile[x][y] == element_from)
10058 Tile[x][y] = element_to;
10061 static boolean CopyCustomElement(int element_old, int element_new,
10064 int copy_mode_orig = copy_mode;
10066 if (copy_mode == GADGET_ID_CUSTOM_COPY)
10068 element_new = (IS_CUSTOM_ELEMENT(element_old) ?
10069 EL_INTERNAL_CLIPBOARD_CUSTOM : EL_INTERNAL_CLIPBOARD_GROUP);
10070 copy_mode = GADGET_ID_CUSTOM_COPY_TO;
10072 else if (copy_mode == GADGET_ID_CUSTOM_PASTE)
10074 element_old = (IS_CUSTOM_ELEMENT(element_new) ?
10075 EL_INTERNAL_CLIPBOARD_CUSTOM : EL_INTERNAL_CLIPBOARD_GROUP);
10076 copy_mode = GADGET_ID_CUSTOM_COPY_TO;
10078 level.changed = TRUE;
10080 else if (IS_CUSTOM_ELEMENT(element_old) && !IS_CUSTOM_ELEMENT(element_new))
10082 Request("Please choose custom element!", REQ_CONFIRM);
10086 else if (IS_GROUP_ELEMENT(element_old) && !IS_GROUP_ELEMENT(element_new))
10088 Request("Please choose group element!", REQ_CONFIRM);
10092 else if (IS_EMPTY_ELEMENT(element_old) && !IS_EMPTY_ELEMENT(element_new))
10094 Request("Please choose empty element!", REQ_CONFIRM);
10100 level.changed = TRUE;
10103 // when modifying custom/group element, ask for copying level template
10104 if (copy_mode_orig != GADGET_ID_CUSTOM_COPY && level.use_custom_template)
10106 if (!AskToCopyAndModifyLevelTemplate())
10110 if (copy_mode == GADGET_ID_CUSTOM_COPY_FROM)
10112 copy_custom_element_settings(element_new, element_old);
10114 else if (copy_mode == GADGET_ID_CUSTOM_COPY_TO)
10116 copy_custom_element_settings(element_old, element_new);
10118 else if (copy_mode == GADGET_ID_CUSTOM_EXCHANGE)
10120 copy_custom_element_settings(element_old, EL_INTERNAL_DUMMY);
10121 copy_custom_element_settings(element_new, element_old);
10122 copy_custom_element_settings(EL_INTERNAL_DUMMY, element_new);
10124 replace_custom_element_in_settings(element_old, EL_INTERNAL_DUMMY);
10125 replace_custom_element_in_settings(element_new, element_old);
10126 replace_custom_element_in_settings(EL_INTERNAL_DUMMY, element_new);
10128 replace_custom_element_in_playfield(element_old, EL_INTERNAL_DUMMY);
10129 replace_custom_element_in_playfield(element_new, element_old);
10130 replace_custom_element_in_playfield(EL_INTERNAL_DUMMY, element_new);
10133 UpdateCustomElementGraphicGadgets();
10134 DrawPropertiesWindow();
10139 static void CopyCustomElementPropertiesToEditor(int element)
10142 int current_change_page = element_info[element].current_change_page;
10144 // dynamically (re)build selectbox for selecting change page
10145 for (i = 0; i < element_info[element].num_change_pages; i++)
10147 sprintf(options_change_page_strings[i], "%d", i + 1);
10149 options_change_page[i].value = i;
10150 options_change_page[i].text = options_change_page_strings[i];
10153 options_change_page[i].value = -1;
10154 options_change_page[i].text = NULL;
10156 // needed here to initialize combined element properties
10157 InitElementPropertiesEngine(level.game_version);
10159 element_info[element].change =
10160 &element_info[element].change_page[current_change_page];
10162 custom_element = element_info[element];
10163 custom_element_change = *element_info[element].change;
10165 // needed to initially set selectbox options for special action options
10166 setSelectboxSpecialActionOptions();
10168 // needed to initially set selectbox value variables to reliable defaults
10169 for (i = 0; i < ED_NUM_SELECTBOX; i++)
10170 setSelectboxValue(i, *selectbox_info[i].value);
10172 for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
10173 custom_element_properties[i] = HAS_PROPERTY(element, i);
10175 for (i = 0; i < NUM_CHANGE_EVENTS; i++)
10176 custom_element_change_events[i] = HAS_CHANGE_EVENT(element, i);
10178 // ---------- element settings: configure (custom elements) -----------------
10180 // set accessible layer selectbox help value
10181 custom_element.access_type =
10182 (IS_WALKABLE(element) ? EP_WALKABLE :
10183 IS_PASSABLE(element) ? EP_PASSABLE :
10184 custom_element.access_type);
10185 custom_element.access_layer =
10186 (IS_ACCESSIBLE_OVER(element) ? EP_ACCESSIBLE_OVER :
10187 IS_ACCESSIBLE_INSIDE(element) ? EP_ACCESSIBLE_INSIDE :
10188 IS_ACCESSIBLE_UNDER(element) ? EP_ACCESSIBLE_UNDER :
10189 custom_element.access_layer);
10190 custom_element.access_protected =
10191 (IS_PROTECTED(element) ? 1 : 0);
10192 custom_element_properties[EP_ACCESSIBLE] =
10193 (IS_ACCESSIBLE_OVER(element) ||
10194 IS_ACCESSIBLE_INSIDE(element) ||
10195 IS_ACCESSIBLE_UNDER(element));
10197 // set walk-to-object action selectbox help value
10198 custom_element.walk_to_action =
10199 (IS_DIGGABLE(element) ? EP_DIGGABLE :
10200 IS_COLLECTIBLE_ONLY(element) ? EP_COLLECTIBLE_ONLY :
10201 IS_DROPPABLE(element) ? EP_DROPPABLE :
10202 IS_THROWABLE(element) ? EP_THROWABLE :
10203 IS_PUSHABLE(element) ? EP_PUSHABLE :
10204 custom_element.walk_to_action);
10205 custom_element_properties[EP_WALK_TO_OBJECT] =
10206 (IS_DIGGABLE(element) ||
10207 IS_COLLECTIBLE_ONLY(element) ||
10208 IS_DROPPABLE(element) ||
10209 IS_THROWABLE(element) ||
10210 IS_PUSHABLE(element));
10212 // set smash targets selectbox help value
10213 custom_element.smash_targets =
10214 (CAN_SMASH_EVERYTHING(element) ? EP_CAN_SMASH_EVERYTHING :
10215 CAN_SMASH_ENEMIES(element) ? EP_CAN_SMASH_ENEMIES :
10216 CAN_SMASH_PLAYER(element) ? EP_CAN_SMASH_PLAYER :
10217 custom_element.smash_targets);
10218 custom_element_properties[EP_CAN_SMASH] =
10219 (CAN_SMASH_EVERYTHING(element) ||
10220 CAN_SMASH_ENEMIES(element) ||
10221 CAN_SMASH_PLAYER(element));
10223 // set deadliness selectbox help value
10224 custom_element.deadliness =
10225 (DONT_TOUCH(element) ? EP_DONT_TOUCH :
10226 DONT_GET_HIT_BY(element) ? EP_DONT_GET_HIT_BY :
10227 DONT_COLLIDE_WITH(element) ? EP_DONT_COLLIDE_WITH :
10228 DONT_RUN_INTO(element) ? EP_DONT_RUN_INTO :
10229 custom_element.deadliness);
10230 custom_element_properties[EP_DEADLY] =
10231 (DONT_TOUCH(element) ||
10232 DONT_GET_HIT_BY(element) ||
10233 DONT_COLLIDE_WITH(element) ||
10234 DONT_RUN_INTO(element));
10236 // ---------- element settings: advanced (custom elements) ------------------
10238 // set "change by direct action" selectbox help value
10239 custom_element_change.direct_action =
10240 (HAS_CHANGE_EVENT(element, CE_NEXT_TO_PLAYER) ? CE_NEXT_TO_PLAYER :
10241 HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
10242 HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
10243 HAS_CHANGE_EVENT(element, CE_SWITCHED_BY_PLAYER) ? CE_SWITCHED_BY_PLAYER :
10244 HAS_CHANGE_EVENT(element, CE_SNAPPED_BY_PLAYER) ? CE_SNAPPED_BY_PLAYER :
10245 HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
10246 HAS_CHANGE_EVENT(element, CE_ENTERED_BY_PLAYER) ? CE_ENTERED_BY_PLAYER :
10247 HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER :
10248 HAS_CHANGE_EVENT(element, CE_DROPPED_BY_PLAYER) ? CE_DROPPED_BY_PLAYER :
10249 HAS_CHANGE_EVENT(element, CE_SWITCHED) ? CE_SWITCHED :
10250 HAS_CHANGE_EVENT(element, CE_HITTING_SOMETHING) ? CE_HITTING_SOMETHING :
10251 HAS_CHANGE_EVENT(element, CE_HIT_BY_SOMETHING) ? CE_HIT_BY_SOMETHING :
10252 HAS_CHANGE_EVENT(element, CE_BLOCKED) ? CE_BLOCKED :
10253 HAS_CHANGE_EVENT(element, CE_IMPACT) ? CE_IMPACT :
10254 HAS_CHANGE_EVENT(element, CE_SMASHED) ? CE_SMASHED :
10255 HAS_CHANGE_EVENT(element, CE_VALUE_CHANGES) ? CE_VALUE_CHANGES :
10256 HAS_CHANGE_EVENT(element, CE_SCORE_CHANGES) ? CE_SCORE_CHANGES :
10257 HAS_CHANGE_EVENT(element, CE_VALUE_GETS_ZERO) ? CE_VALUE_GETS_ZERO :
10258 HAS_CHANGE_EVENT(element, CE_SCORE_GETS_ZERO) ? CE_SCORE_GETS_ZERO :
10259 HAS_CHANGE_EVENT(element, CE_CLICKED_BY_MOUSE) ? CE_CLICKED_BY_MOUSE :
10260 HAS_CHANGE_EVENT(element, CE_PRESSED_BY_MOUSE) ? CE_PRESSED_BY_MOUSE :
10261 custom_element_change.direct_action);
10263 // set "change by other element action" selectbox help value
10264 custom_element_change.other_action =
10265 (HAS_CHANGE_EVENT(element, CE_PLAYER_NEXT_TO_X) ? CE_PLAYER_NEXT_TO_X :
10266 HAS_CHANGE_EVENT(element, CE_PLAYER_TOUCHES_X) ? CE_PLAYER_TOUCHES_X :
10267 HAS_CHANGE_EVENT(element, CE_PLAYER_PRESSES_X) ? CE_PLAYER_PRESSES_X :
10268 HAS_CHANGE_EVENT(element, CE_PLAYER_SWITCHES_X) ? CE_PLAYER_SWITCHES_X :
10269 HAS_CHANGE_EVENT(element, CE_PLAYER_SNAPS_X) ? CE_PLAYER_SNAPS_X :
10270 HAS_CHANGE_EVENT(element, CE_PLAYER_PUSHES_X) ? CE_PLAYER_PUSHES_X :
10271 HAS_CHANGE_EVENT(element, CE_PLAYER_ENTERS_X) ? CE_PLAYER_ENTERS_X :
10272 HAS_CHANGE_EVENT(element, CE_PLAYER_LEAVES_X) ? CE_PLAYER_LEAVES_X :
10273 HAS_CHANGE_EVENT(element, CE_PLAYER_DIGS_X) ? CE_PLAYER_DIGS_X :
10274 HAS_CHANGE_EVENT(element, CE_PLAYER_COLLECTS_X) ? CE_PLAYER_COLLECTS_X :
10275 HAS_CHANGE_EVENT(element, CE_PLAYER_DROPS_X) ? CE_PLAYER_DROPS_X :
10276 HAS_CHANGE_EVENT(element, CE_NEXT_TO_X) ? CE_NEXT_TO_X :
10277 HAS_CHANGE_EVENT(element, CE_TOUCHING_X) ? CE_TOUCHING_X :
10278 HAS_CHANGE_EVENT(element, CE_HITTING_X) ? CE_HITTING_X :
10279 HAS_CHANGE_EVENT(element, CE_DIGGING_X) ? CE_DIGGING_X :
10280 HAS_CHANGE_EVENT(element, CE_HIT_BY_X) ? CE_HIT_BY_X :
10281 HAS_CHANGE_EVENT(element, CE_SWITCH_OF_X) ? CE_SWITCH_OF_X :
10282 HAS_CHANGE_EVENT(element, CE_CHANGE_OF_X) ? CE_CHANGE_OF_X :
10283 HAS_CHANGE_EVENT(element, CE_EXPLOSION_OF_X) ? CE_EXPLOSION_OF_X :
10284 HAS_CHANGE_EVENT(element, CE_MOVE_OF_X) ? CE_MOVE_OF_X :
10285 HAS_CHANGE_EVENT(element, CE_CREATION_OF_X) ? CE_CREATION_OF_X :
10286 HAS_CHANGE_EVENT(element, CE_VALUE_CHANGES_OF_X) ? CE_VALUE_CHANGES_OF_X :
10287 HAS_CHANGE_EVENT(element, CE_SCORE_CHANGES_OF_X) ? CE_SCORE_CHANGES_OF_X :
10288 HAS_CHANGE_EVENT(element, CE_VALUE_GETS_ZERO_OF_X) ? CE_VALUE_GETS_ZERO_OF_X :
10289 HAS_CHANGE_EVENT(element, CE_SCORE_GETS_ZERO_OF_X) ? CE_SCORE_GETS_ZERO_OF_X :
10290 HAS_CHANGE_EVENT(element, CE_MOUSE_CLICKED_ON_X) ? CE_MOUSE_CLICKED_ON_X :
10291 HAS_CHANGE_EVENT(element, CE_MOUSE_PRESSED_ON_X) ? CE_MOUSE_PRESSED_ON_X :
10292 custom_element_change.other_action);
10295 static void CopyGroupElementPropertiesToEditor(int element)
10297 group_element_info = *element_info[element].group;
10298 custom_element = element_info[element]; // needed for description
10301 static void CopyEmptyElementPropertiesToEditor(int element)
10303 custom_element = element_info[element];
10306 static void CopyClassicElementPropertiesToEditor(int element)
10308 if (IS_PLAYER_ELEMENT(element) || COULD_MOVE_INTO_ACID(element))
10309 custom_element_properties[EP_CAN_MOVE_INTO_ACID] =
10310 getMoveIntoAcidProperty(&level, element);
10312 if (MAYBE_DONT_COLLIDE_WITH(element))
10313 custom_element_properties[EP_DONT_COLLIDE_WITH] =
10314 getDontCollideWithProperty(&level, element);
10317 static void CopyElementPropertiesToEditor(int element)
10319 if (IS_CUSTOM_ELEMENT(element))
10320 CopyCustomElementPropertiesToEditor(element);
10321 else if (IS_GROUP_ELEMENT(element))
10322 CopyGroupElementPropertiesToEditor(element);
10323 else if (IS_EMPTY_ELEMENT(element))
10324 CopyEmptyElementPropertiesToEditor(element);
10326 CopyClassicElementPropertiesToEditor(element);
10329 static boolean AskToCopyAndModifyLevelTemplate(void)
10331 if (Request("Copy and modify settings from level template?", REQ_ASK))
10333 level.use_custom_template = FALSE;
10335 ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE_1],
10336 GDI_CHECKED, FALSE, GDI_END);
10337 ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE_2],
10338 GDI_CHECKED, FALSE, GDI_END);
10344 LoadLevelTemplate(-1); // this resets all element modifications ...
10346 DrawEditModeWindow(); // ... and copies them to 'custom_element'
10352 static void CopyCustomElementPropertiesToGame(int element)
10355 int access_type_and_layer;
10357 // mark that this custom element has been modified
10358 custom_element.modified_settings = TRUE;
10359 level.changed = TRUE;
10361 if (level.use_custom_template)
10362 AskToCopyAndModifyLevelTemplate();
10364 element_info[element] = custom_element;
10365 *element_info[element].change = custom_element_change;
10367 // ---------- element settings: configure (custom elements) -----------------
10369 // set accessible property from checkbox and selectbox
10370 custom_element_properties[EP_WALKABLE_OVER] = FALSE;
10371 custom_element_properties[EP_WALKABLE_INSIDE] = FALSE;
10372 custom_element_properties[EP_WALKABLE_UNDER] = FALSE;
10373 custom_element_properties[EP_PASSABLE_OVER] = FALSE;
10374 custom_element_properties[EP_PASSABLE_INSIDE] = FALSE;
10375 custom_element_properties[EP_PASSABLE_UNDER] = FALSE;
10376 access_type_and_layer = ((custom_element.access_type == EP_WALKABLE ?
10377 EP_WALKABLE_OVER : EP_PASSABLE_OVER) +
10378 (custom_element.access_layer - EP_ACCESSIBLE_OVER));
10379 custom_element_properties[access_type_and_layer] =
10380 custom_element_properties[EP_ACCESSIBLE];
10381 custom_element_properties[EP_PROTECTED] =
10382 (custom_element.access_protected != 0 &&
10383 custom_element_properties[EP_ACCESSIBLE]);
10385 // set walk-to-object property from checkbox and selectbox
10386 custom_element_properties[EP_DIGGABLE] = FALSE;
10387 custom_element_properties[EP_COLLECTIBLE_ONLY] = FALSE;
10388 custom_element_properties[EP_DROPPABLE] = FALSE;
10389 custom_element_properties[EP_THROWABLE] = FALSE;
10390 custom_element_properties[EP_PUSHABLE] = FALSE;
10391 custom_element_properties[custom_element.walk_to_action] =
10392 custom_element_properties[EP_WALK_TO_OBJECT];
10394 // set smash property from checkbox and selectbox
10395 custom_element_properties[EP_CAN_SMASH_PLAYER] = FALSE;
10396 custom_element_properties[EP_CAN_SMASH_ENEMIES] = FALSE;
10397 custom_element_properties[EP_CAN_SMASH_EVERYTHING] = FALSE;
10398 custom_element_properties[custom_element.smash_targets] =
10399 custom_element_properties[EP_CAN_SMASH];
10401 // set deadliness property from checkbox and selectbox
10402 custom_element_properties[EP_DONT_RUN_INTO] = FALSE;
10403 custom_element_properties[EP_DONT_COLLIDE_WITH] = FALSE;
10404 custom_element_properties[EP_DONT_GET_HIT_BY] = FALSE;
10405 custom_element_properties[EP_DONT_TOUCH] = FALSE;
10406 custom_element_properties[custom_element.deadliness] =
10407 custom_element_properties[EP_DEADLY];
10409 // ---------- element settings: advanced (custom elements) ------------------
10411 // set player change event from checkbox and selectbox
10412 custom_element_change_events[CE_NEXT_TO_PLAYER] = FALSE;
10413 custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE;
10414 custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE;
10415 custom_element_change_events[CE_SWITCHED_BY_PLAYER] = FALSE;
10416 custom_element_change_events[CE_SNAPPED_BY_PLAYER] = FALSE;
10417 custom_element_change_events[CE_PUSHED_BY_PLAYER] = FALSE;
10418 custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE;
10419 custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
10420 custom_element_change_events[CE_DROPPED_BY_PLAYER] = FALSE;
10421 custom_element_change_events[CE_SWITCHED] = FALSE;
10422 custom_element_change_events[CE_HITTING_SOMETHING] = FALSE;
10423 custom_element_change_events[CE_HIT_BY_SOMETHING] = FALSE;
10424 custom_element_change_events[CE_BLOCKED] = FALSE;
10425 custom_element_change_events[CE_IMPACT] = FALSE;
10426 custom_element_change_events[CE_SMASHED] = FALSE;
10427 custom_element_change_events[CE_VALUE_CHANGES] = FALSE;
10428 custom_element_change_events[CE_SCORE_CHANGES] = FALSE;
10429 custom_element_change_events[CE_VALUE_GETS_ZERO] = FALSE;
10430 custom_element_change_events[CE_SCORE_GETS_ZERO] = FALSE;
10431 custom_element_change_events[CE_CLICKED_BY_MOUSE] = FALSE;
10432 custom_element_change_events[CE_PRESSED_BY_MOUSE] = FALSE;
10433 custom_element_change_events[custom_element_change.direct_action] =
10434 custom_element_change_events[CE_BY_DIRECT_ACTION];
10436 // set other element action change event from checkbox and selectbox
10437 custom_element_change_events[CE_PLAYER_NEXT_TO_X] = FALSE;
10438 custom_element_change_events[CE_PLAYER_TOUCHES_X] = FALSE;
10439 custom_element_change_events[CE_PLAYER_PRESSES_X] = FALSE;
10440 custom_element_change_events[CE_PLAYER_SWITCHES_X] = FALSE;
10441 custom_element_change_events[CE_PLAYER_SNAPS_X] = FALSE;
10442 custom_element_change_events[CE_PLAYER_PUSHES_X] = FALSE;
10443 custom_element_change_events[CE_PLAYER_ENTERS_X] = FALSE;
10444 custom_element_change_events[CE_PLAYER_LEAVES_X] = FALSE;
10445 custom_element_change_events[CE_PLAYER_DIGS_X] = FALSE;
10446 custom_element_change_events[CE_PLAYER_COLLECTS_X] = FALSE;
10447 custom_element_change_events[CE_PLAYER_DROPS_X] = FALSE;
10448 custom_element_change_events[CE_NEXT_TO_X] = FALSE;
10449 custom_element_change_events[CE_TOUCHING_X] = FALSE;
10450 custom_element_change_events[CE_HITTING_X] = FALSE;
10451 custom_element_change_events[CE_DIGGING_X] = FALSE;
10452 custom_element_change_events[CE_HIT_BY_X] = FALSE;
10453 custom_element_change_events[CE_SWITCH_OF_X] = FALSE;
10454 custom_element_change_events[CE_CHANGE_OF_X] = FALSE;
10455 custom_element_change_events[CE_EXPLOSION_OF_X] = FALSE;
10456 custom_element_change_events[CE_MOVE_OF_X] = FALSE;
10457 custom_element_change_events[CE_CREATION_OF_X] = FALSE;
10458 custom_element_change_events[CE_VALUE_CHANGES_OF_X] = FALSE;
10459 custom_element_change_events[CE_SCORE_CHANGES_OF_X] = FALSE;
10460 custom_element_change_events[CE_VALUE_GETS_ZERO_OF_X] = FALSE;
10461 custom_element_change_events[CE_SCORE_GETS_ZERO_OF_X] = FALSE;
10462 custom_element_change_events[CE_MOUSE_CLICKED_ON_X] = FALSE;
10463 custom_element_change_events[CE_MOUSE_PRESSED_ON_X] = FALSE;
10464 custom_element_change_events[custom_element_change.other_action] =
10465 custom_element_change_events[CE_BY_OTHER_ACTION];
10467 for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
10468 SET_PROPERTY(element, i, custom_element_properties[i]);
10470 for (i = 0; i < NUM_CHANGE_EVENTS; i++)
10471 SET_CHANGE_EVENT(element, i, custom_element_change_events[i]);
10473 // copy change events also to special level editor variable
10474 custom_element = element_info[element];
10475 custom_element_change = *element_info[element].change;
10477 // needed here to restore runtime value "element_info[element].gfx_element"
10478 InitElementPropertiesGfxElement();
10481 static void CopyGroupElementPropertiesToGame(int element)
10483 // mark that this group element has been modified
10484 custom_element.modified_settings = TRUE;
10485 level.changed = TRUE;
10487 if (level.use_custom_template)
10488 AskToCopyAndModifyLevelTemplate();
10490 element_info[element] = custom_element;
10491 *element_info[element].group = group_element_info;
10493 // needed here to restore runtime value "element_info[element].gfx_element"
10494 InitElementPropertiesGfxElement();
10497 static void CopyEmptyElementPropertiesToGame(int element)
10499 // mark that this empty element has been modified
10500 custom_element.modified_settings = TRUE;
10501 level.changed = TRUE;
10503 if (level.use_custom_template)
10504 AskToCopyAndModifyLevelTemplate();
10506 element_info[element] = custom_element;
10508 // needed here to restore runtime value "element_info[element].gfx_element"
10509 InitElementPropertiesGfxElement();
10512 static void CopyClassicElementPropertiesToGame(int element)
10514 if (IS_PLAYER_ELEMENT(element) || COULD_MOVE_INTO_ACID(element))
10515 setMoveIntoAcidProperty(&level, element,
10516 custom_element_properties[EP_CAN_MOVE_INTO_ACID]);
10518 if (MAYBE_DONT_COLLIDE_WITH(element))
10519 setDontCollideWithProperty(&level, element,
10520 custom_element_properties[EP_DONT_COLLIDE_WITH]);
10523 static void CopyElementPropertiesToGame(int element)
10525 if (IS_CUSTOM_ELEMENT(element))
10526 CopyCustomElementPropertiesToGame(element);
10527 else if (IS_GROUP_ELEMENT(element))
10528 CopyGroupElementPropertiesToGame(element);
10529 else if (IS_EMPTY_ELEMENT(element))
10530 CopyEmptyElementPropertiesToGame(element);
10532 CopyClassicElementPropertiesToGame(element);
10536 static void CheckElementDescriptions(void)
10540 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
10541 if (getElementDescriptionFilename(i) == NULL && !IS_OBSOLETE(i))
10542 Warn("no element description file for element '%s'", EL_NAME(i));
10546 static int getMaxEdFieldX(boolean has_scrollbar)
10548 int scrollbar_width = (has_scrollbar ? ED_SCROLLBUTTON_XSIZE : 0);
10549 int sxsize = SXSIZE - scrollbar_width;
10550 int max_ed_fieldx = sxsize / ed_tilesize;
10552 return max_ed_fieldx;
10555 static int getMaxEdFieldY(boolean has_scrollbar)
10557 int infotext_height = (IN_PIX_FIELD(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY) ?
10558 INFOTEXT_YSIZE_FULL : 0);
10559 int scrollbar_height = (has_scrollbar ? ED_SCROLLBUTTON_YSIZE : 0);
10560 int sysize = SYSIZE - scrollbar_height - infotext_height;
10561 int max_ed_fieldy = sysize / ed_tilesize;
10563 return max_ed_fieldy;
10566 static void InitZoomLevelSettings(int zoom_tilesize)
10568 static int last_game_engine_type = GAME_ENGINE_TYPE_UNKNOWN;
10570 if (zoom_tilesize == -1 && level.game_engine_type != last_game_engine_type)
10572 ed_tilesize = setup.auto_setup.editor_zoom_tilesize;
10573 ed_tilesize_default = DEFAULT_EDITOR_TILESIZE;
10575 // make sure that tile size is always a power of 2
10576 ed_tilesize = (1 << log_2(ed_tilesize));
10578 if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
10580 ed_tilesize = DEFAULT_EDITOR_TILESIZE_MM;
10581 ed_tilesize_default = DEFAULT_EDITOR_TILESIZE_MM;
10585 last_game_engine_type = level.game_engine_type;
10587 // limit zoom tilesize by upper and lower bound
10588 ed_tilesize = MIN(MAX(MICRO_TILESIZE, ed_tilesize), TILESIZE);
10590 // store zoom tilesize in auto setup file only if it was manually changed
10591 if (zoom_tilesize != -1)
10592 setup.auto_setup.editor_zoom_tilesize = ed_tilesize;
10594 MAX_ED_FIELDX = getMaxEdFieldX(FALSE);
10595 MAX_ED_FIELDY = getMaxEdFieldY(FALSE);
10598 static void InitDrawingElements(void)
10600 static int game_engine_type_last = GAME_ENGINE_TYPE_UNKNOWN;
10602 if (level.game_engine_type == game_engine_type_last)
10605 if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
10607 new_element1 = EL_BD_WALL;
10608 new_element2 = EL_EMPTY;
10609 new_element3 = EL_BD_SAND;
10611 else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
10613 new_element1 = EL_SP_CHIP_SINGLE;
10614 new_element2 = EL_EMPTY;
10615 new_element3 = EL_SP_BASE;
10617 else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
10619 new_element1 = EL_MM_MIRROR_START;
10620 new_element2 = EL_EMPTY;
10621 new_element3 = EL_MM_WOODEN_WALL;
10625 new_element1 = EL_WALL;
10626 new_element2 = EL_EMPTY;
10627 new_element3 = EL_SAND;
10630 game_engine_type_last = level.game_engine_type;
10633 static void InitLevelSetInfo(void)
10635 snprintf(levelset_name, MAX_LEVEL_NAME_LEN + 1,
10636 "%s", leveldir_current->name);
10637 snprintf(levelset_author, MAX_LEVEL_AUTHOR_LEN + 1,
10638 "%s", leveldir_current->author);
10640 levelset_num_levels = leveldir_current->levels;
10642 levelset_use_levelset_artwork = FALSE;
10643 levelset_copy_level_template = FALSE;
10645 levelset_save_mode = LEVELSET_SAVE_MODE_UPDATE;
10648 static void ChangeEditorToLevelSet(char *levelset_subdir)
10650 leveldir_current = getTreeInfoFromIdentifier(leveldir_first, levelset_subdir);
10652 // the previous level set might have used custom artwork
10653 ReloadCustomArtwork(0);
10655 LoadLevelSetup_SeriesInfo();
10657 SaveLevelSetup_LastSeries();
10658 SaveLevelSetup_SeriesInfo();
10662 LoadLevel(level_nr);
10663 LoadScore(level_nr);
10668 static boolean useEditorDoorAnimation(void)
10670 struct RectWithBorder *vp_door_1 = &viewport.door_1[GAME_MODE_MAIN];
10671 boolean door_1_viewport_unchanged =
10672 (vp_door_1->x == DX &&
10673 vp_door_1->y == DY &&
10674 vp_door_1->width == DXSIZE &&
10675 vp_door_1->height == DYSIZE);
10676 boolean door_1_contains_toolbox =
10679 EX + EXSIZE <= DX + DXSIZE &&
10680 EY + EYSIZE <= DY + DYSIZE);
10682 return (door_1_viewport_unchanged && door_1_contains_toolbox);
10685 static void DrawEditorDoorBackground(int graphic, int x, int y,
10686 int width, int height)
10688 struct GraphicInfo *g = &graphic_info[graphic];
10690 if (g->bitmap != NULL)
10691 BlitBitmap(g->bitmap, drawto, g->src_x, g->src_y,
10692 MIN(width, g->width), MIN(height, g->height), x, y);
10694 ClearRectangle(drawto, x, y, width, height);
10697 static void DrawEditorDoorContent(void)
10699 // needed for gadgets drawn on background (like palette scrollbar)
10700 SetDoorBackgroundImage(IMG_UNDEFINED);
10702 // copy default editor door content to main double buffer
10703 DrawEditorDoorBackground(IMG_BACKGROUND_PALETTE, DX, DY, DXSIZE, DYSIZE);
10705 // draw bigger door
10706 DrawSpecialEditorDoor();
10708 // draw new control window
10709 DrawEditorDoorBackground(IMG_BACKGROUND_TOOLBOX, EX, EY, EXSIZE, EYSIZE);
10711 // draw all toolbox gadgets to editor doors
10712 MapControlButtons();
10714 // when returning from test game to properties page, redraw toolbox gadgets
10715 if (edit_mode == ED_MODE_PROPERTIES)
10717 UnmapLevelEditorToolboxDrawingGadgets();
10718 UnmapLevelEditorToolboxCustomGadgets();
10720 MapLevelEditorToolboxCustomGadgetsIfNeeded();
10723 // draw all palette gadgets to editor doors
10724 ModifyEditorElementList();
10725 RedrawDrawingElements();
10727 // copy actual editor door content to door double buffer for OpenDoor()
10728 BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
10731 void DrawLevelEd(void)
10733 int fade_mask = REDRAW_FIELD;
10735 FadeSoundsAndMusic();
10737 if (CheckFadeAll())
10738 fade_mask = REDRAW_ALL;
10740 FadeOut(fade_mask);
10742 // needed if different viewport properties defined for editor
10743 ChangeViewportPropertiesIfNeeded();
10747 InitZoomLevelSettings(-1);
10748 InitDrawingElements();
10749 InitLevelSetInfo();
10752 CheckElementDescriptions();
10755 if (level_editor_test_game)
10757 CopyPlayfield(level.field, Tile);
10758 CopyPlayfield(TileBackup, level.field);
10760 level_editor_test_game = FALSE;
10764 edit_mode = ED_MODE_DRAWING;
10765 edit_mode_levelconfig = ED_MODE_LEVELCONFIG_LEVEL;
10766 edit_mode_engineconfig = ED_MODE_ENGINECONFIG_CONFIG;
10767 edit_mode_properties = ED_MODE_PROPERTIES_INFO;
10775 // redraw_mask |= REDRAW_ALL;
10777 FreeLevelEditorGadgets();
10778 CreateLevelEditorGadgets();
10780 ReinitializeElementList(); // update dynamic level element list
10781 ReinitializeElementListButtons(); // custom element may look different
10783 InitElementPropertiesGfxElement();
10787 DrawEditModeWindow_PlayfieldOnly();
10789 DrawMaskedBorder(fade_mask);
10791 // use door animation if door 1 viewport is unchanged and contains toolbox
10792 if (useEditorDoorAnimation())
10796 DrawEditorDoorContent();
10798 OpenDoor(DOOR_OPEN_1 | DOOR_FORCE_ANIM);
10802 DrawEditorDoorContent();
10807 SetDoorState(DOOR_OPEN_1 | DOOR_OPEN_2);
10810 static void AdjustDrawingAreaGadgets(void)
10812 int ed_xsize = lev_fieldx + 2;
10813 int ed_ysize = lev_fieldy + 2;
10814 int max_ed_fieldx = MAX_ED_FIELDX;
10815 int max_ed_fieldy = MAX_ED_FIELDY;
10816 boolean horizontal_scrollbar_needed;
10817 boolean vertical_scrollbar_needed;
10818 int x, y, width, height;
10820 if (suppressBorderElement())
10822 ed_xsize = lev_fieldx;
10823 ed_ysize = lev_fieldy;
10826 // check if we need any scrollbars
10827 horizontal_scrollbar_needed = (ed_xsize > max_ed_fieldx);
10828 vertical_scrollbar_needed = (ed_ysize > max_ed_fieldy);
10830 // check if we have a smaller editor field because of scrollbars
10831 max_ed_fieldx = getMaxEdFieldX(vertical_scrollbar_needed);
10832 max_ed_fieldy = getMaxEdFieldY(horizontal_scrollbar_needed);
10834 // check again if we now need more scrollbars because of less space
10835 horizontal_scrollbar_needed = (ed_xsize > max_ed_fieldx);
10836 vertical_scrollbar_needed = (ed_ysize > max_ed_fieldy);
10838 // check if editor field gets even smaller after adding new scrollbars
10839 max_ed_fieldx = getMaxEdFieldX(vertical_scrollbar_needed);
10840 max_ed_fieldy = getMaxEdFieldY(horizontal_scrollbar_needed);
10842 ed_fieldx = (ed_xsize > max_ed_fieldx ? max_ed_fieldx : ed_xsize);
10843 ed_fieldy = (ed_ysize > max_ed_fieldy ? max_ed_fieldy : ed_ysize);
10845 x = SX + ed_fieldx * ed_tilesize;
10846 y = SY + ed_fieldy * ed_tilesize;
10848 width = ed_fieldx * ed_tilesize - 2 * ED_SCROLLBUTTON_XSIZE;
10849 height = ed_fieldy * ed_tilesize - 2 * ED_SCROLLBUTTON_YSIZE;
10851 // adjust drawing area gadget
10852 ModifyGadget(level_editor_gadget[GADGET_ID_DRAWING_LEVEL],
10853 GDI_AREA_SIZE, ed_fieldx, ed_fieldy,
10854 GDI_ITEM_SIZE, ed_tilesize, ed_tilesize,
10857 // adjust horizontal scrollbar gadgets
10858 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LEFT],
10861 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_RIGHT],
10862 GDI_X, x - ED_SCROLLBUTTON_XSIZE,
10865 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL],
10868 GDI_SCROLLBAR_ITEMS_VISIBLE, ed_fieldx,
10871 // adjust vertical scrollbar gadgets
10872 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_UP],
10875 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_DOWN],
10877 GDI_Y, y - ED_SCROLLBUTTON_YSIZE,
10879 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL],
10881 GDI_HEIGHT, height,
10882 GDI_SCROLLBAR_ITEMS_VISIBLE, ed_fieldy,
10886 static void AdjustLevelScrollPosition(void)
10888 if (level_xpos < -1)
10890 if (level_xpos > lev_fieldx - ed_fieldx + 1)
10891 level_xpos = lev_fieldx - ed_fieldx + 1;
10892 if (lev_fieldx < ed_fieldx - 2)
10895 if (level_ypos < -1)
10897 if (level_ypos > lev_fieldy - ed_fieldy + 1)
10898 level_ypos = lev_fieldy - ed_fieldy + 1;
10899 if (lev_fieldy < ed_fieldy - 2)
10902 if (suppressBorderElement())
10909 static void AdjustEditorScrollbar(int id)
10911 struct GadgetInfo *gi = level_editor_gadget[id];
10912 int items_max, items_visible, item_position;
10914 if (id == GADGET_ID_SCROLL_HORIZONTAL)
10916 items_max = MAX(lev_fieldx + 2, ed_fieldx);
10917 items_visible = ed_fieldx;
10918 item_position = level_xpos + 1;
10922 items_max = MAX(lev_fieldy + 2, ed_fieldy);
10923 items_visible = ed_fieldy;
10924 item_position = level_ypos + 1;
10927 if (item_position > items_max - items_visible)
10928 item_position = items_max - items_visible;
10930 ModifyGadget(gi, GDI_SCROLLBAR_ITEMS_MAX, items_max,
10931 GDI_SCROLLBAR_ITEM_POSITION, item_position, GDI_END);
10934 static void AdjustElementListScrollbar(void)
10936 struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL];
10937 int items_max, items_visible, item_position;
10939 // correct position of element list scrollbar
10940 if (element_shift < 0)
10942 if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
10943 element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
10945 items_max = num_editor_elements / ED_ELEMENTLIST_BUTTONS_HORIZ;
10946 items_visible = ED_ELEMENTLIST_BUTTONS_VERT;
10947 item_position = element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ;
10949 ModifyGadget(gi, GDI_SCROLLBAR_ITEMS_MAX, items_max,
10950 GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
10951 GDI_SCROLLBAR_ITEM_POSITION, item_position, GDI_END);
10954 static void ModifyEditorCounterValue(int counter_id, int new_value)
10956 int *counter_value = counterbutton_info[counter_id].value;
10957 int gadget_id = counterbutton_info[counter_id].gadget_id_text;
10958 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
10960 ModifyGadget(gi, GDI_NUMBER_VALUE, new_value, GDI_END);
10962 if (counter_value != NULL)
10963 *counter_value = gi->textinput.number_value;
10966 static void ModifyEditorCounterLimits(int counter_id, int min, int max)
10968 int gadget_id = counterbutton_info[counter_id].gadget_id_text;
10969 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
10971 ModifyGadget(gi, GDI_NUMBER_MIN, min, GDI_NUMBER_MAX, max, GDI_END);
10973 if (counter_id >= ED_COUNTER_ID_ELEMENT_VALUE1 &&
10974 counter_id <= ED_COUNTER_ID_ELEMENT_VALUE4)
10976 int gadget_id_up = counterbutton_info[counter_id].gadget_id_up;
10977 struct GadgetInfo *gi_up = level_editor_gadget[gadget_id_up];
10979 ModifyGadget(gi, GDI_TEXT_SIZE, (max < 10 ? 1 : 3), GDI_END);
10980 ModifyGadget(gi_up, GDI_X, gi->x + gi->width + ED_GADGET_SMALL_DISTANCE,
10985 static void ModifyEditorSelectboxValue(int selectbox_id, int new_value)
10987 int gadget_id = selectbox_info[selectbox_id].gadget_id;
10988 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
10989 int new_index_value = setSelectboxValue(selectbox_id, new_value);
10991 ModifyGadget(gi, GDI_SELECTBOX_INDEX, new_index_value, GDI_END);
10994 static void ModifyEditorSelectboxOptions(int selectbox_id,
10995 struct ValueTextInfo *options)
10997 int gadget_id = selectbox_info[selectbox_id].gadget_id;
10998 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11000 selectbox_info[selectbox_id].options = options;
11002 // set index to zero -- list may be shorter now (correct later, if needed)
11003 ModifyGadget(gi, GDI_SELECTBOX_INDEX, 0,
11004 GDI_SELECTBOX_OPTIONS, options, GDI_END);
11007 static void ModifyEditorDrawingArea(int drawingarea_id, int xsize, int ysize)
11009 int gadget_id = drawingarea_info[drawingarea_id].gadget_id;
11010 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11012 drawingarea_info[drawingarea_id].area_xsize = xsize;
11013 drawingarea_info[drawingarea_id].area_ysize = ysize;
11015 ModifyGadget(gi, GDI_AREA_SIZE, xsize, ysize, GDI_END);
11018 static void ModifyEditorElementList(void)
11022 if (!use_permanent_palette && edit_mode != ED_MODE_PALETTE)
11025 for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
11027 int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
11028 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11029 struct GadgetDesign *gd = &gi->deco.design;
11030 int element = editor_elements[element_shift + i];
11031 int tile_size = BUTTON_TILE_SIZE(editor.palette.tile_size);
11035 getEditorGraphicSource(element, tile_size, &gd->bitmap, &gd->x, &gd->y);
11037 ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
11043 static void DrawDrawingElementGraphic(int element, struct XYTileSize *pos)
11045 int graphic = el2edimg(element);
11046 int tile_size = BUTTON_TILE_SIZE(pos->tile_size);
11048 if (pos->x == -1 &&
11052 DrawSizedGraphicExt(drawto, DX + pos->x, DY + pos->y, graphic, 0, tile_size);
11055 static void ModifyDrawingElementButton(int element, int id)
11057 struct GadgetInfo *gi = level_editor_gadget[id];
11058 Bitmap *deco_bitmap;
11059 int deco_x, deco_y;
11060 int tile_size = gi->deco.width;
11062 getEditorGraphicSource(element, tile_size, &deco_bitmap, &deco_x, &deco_y);
11064 ModifyGadget(gi, GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y, GDI_END);
11067 static void PickDrawingElement(int button, int element)
11072 struct XYTileSize *pos;
11074 } de, drawing_elements[] =
11076 { &new_element1, &editor.palette.element_left, GADGET_ID_ELEMENT_LEFT },
11077 { &new_element2, &editor.palette.element_middle, GADGET_ID_ELEMENT_MIDDLE },
11078 { &new_element3, &editor.palette.element_right, GADGET_ID_ELEMENT_RIGHT },
11081 if (button < 1 || button > 3)
11084 if (IS_MM_WALL(element))
11085 element = map_mm_wall_element(element);
11087 de = drawing_elements[button - 1];
11089 *de.new_element = element; // update global drawing element variable
11091 DrawDrawingElementGraphic(element, de.pos);
11092 ModifyDrawingElementButton(element, de.id);
11094 redraw_mask |= REDRAW_DOOR_1;
11097 static void RedrawDrawingElements(void)
11099 PickDrawingElement(1, new_element1);
11100 PickDrawingElement(2, new_element2);
11101 PickDrawingElement(3, new_element3);
11104 static void DrawDrawingWindowExt(boolean remap_toolbox_gadgets)
11106 stick_element_properties_window = FALSE;
11108 SetMainBackgroundImage(IMG_UNDEFINED);
11111 UnmapLevelEditorFieldGadgets();
11113 AdjustDrawingAreaGadgets();
11114 AdjustLevelScrollPosition();
11115 AdjustEditorScrollbar(GADGET_ID_SCROLL_HORIZONTAL);
11116 AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL);
11118 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
11120 MapMainDrawingArea();
11122 if (remap_toolbox_gadgets)
11124 UnmapLevelEditorToolboxCustomGadgets();
11125 MapLevelEditorToolboxDrawingGadgets();
11129 static void DrawDrawingWindow(void)
11131 DrawDrawingWindowExt(TRUE);
11134 static int getTabulatorBarWidth(void)
11136 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
11137 struct GadgetInfo *gd_gi4 = level_editor_gadget[GADGET_ID_PROPERTIES_CHANGE];
11139 return gd_gi4->x - gd_gi1->x + gd_gi4->width;
11142 static int getTabulatorBarHeight(void)
11144 return ED_TAB_BAR_HEIGHT;
11147 static Pixel getTabulatorBarColor(void)
11149 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_LEVELCONFIG_LEVEL];
11150 struct GadgetDesign *gd = &gd_gi1->alt_design[GD_BUTTON_UNPRESSED];
11151 int gd_x = gd->x + gd_gi1->border.width / 2;
11152 int gd_y = gd->y + gd_gi1->height - 1;
11154 return GetPixel(gd->bitmap, gd_x, gd_y);
11157 static void DrawEngineConfigTabulatorGadgets(void)
11159 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_ENGINECONFIG_CONFIG];
11160 Pixel tab_color = getTabulatorBarColor();
11161 int id_first = ED_TEXTBUTTON_ID_ENGINECONFIG_CONFIG;
11162 int id_last = ED_TEXTBUTTON_ID_ENGINECONFIG_COLORS;
11165 for (i = id_first; i <= id_last; i++)
11167 int gadget_id = textbutton_info[i].gadget_id;
11168 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11169 boolean active = (i != edit_mode_engineconfig);
11171 // draw background line below tabulator button
11172 ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width, 1);
11174 // draw solid line below inactive tabulator buttons
11175 if (!active && tab_color != BLACK_PIXEL) // black => transparent
11176 FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,
11177 ED_GADGET_TINY_DISTANCE, tab_color);
11179 ModifyGadget(gi, GDI_ACTIVE, active, GDI_END);
11180 MapTextbuttonGadget(i);
11183 // draw little border line below tabulator buttons
11184 if (tab_color != BLACK_PIXEL) // black => transparent
11185 FillRectangle(drawto, gd_gi1->x, gd_gi1->y + gd_gi1->height +
11186 ED_GADGET_TINY_DISTANCE,
11187 getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
11190 static void DrawLevelConfigTabulatorGadgets(void)
11192 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_LEVELCONFIG_LEVEL];
11193 Pixel tab_color = getTabulatorBarColor();
11194 int id_first = ED_TEXTBUTTON_ID_LEVELCONFIG_LEVEL;
11195 int id_last = ED_TEXTBUTTON_ID_LEVELCONFIG_EDITOR;
11198 // draw additional "engine" tabulator when using native BD engine
11199 if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
11200 id_last = ED_TEXTBUTTON_ID_LEVELCONFIG_ENGINE;
11202 for (i = id_first; i <= id_last; i++)
11204 int gadget_id = textbutton_info[i].gadget_id;
11205 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11206 boolean active = (i != edit_mode_levelconfig);
11208 // draw background line below tabulator button
11209 ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width, 1);
11211 // draw solid line below inactive tabulator buttons
11212 if (!active && tab_color != BLACK_PIXEL) // black => transparent
11213 FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,
11214 ED_GADGET_TINY_DISTANCE, tab_color);
11216 ModifyGadget(gi, GDI_ACTIVE, active, GDI_END);
11217 MapTextbuttonGadget(i);
11220 // draw little border line below tabulator buttons
11221 if (tab_color != BLACK_PIXEL) // black => transparent
11222 FillRectangle(drawto, gd_gi1->x, gd_gi1->y + gd_gi1->height +
11223 ED_GADGET_TINY_DISTANCE,
11224 getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
11226 // draw second row of engine related tabulators when using native BD engine
11227 if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_ENGINE)
11228 DrawEngineConfigTabulatorGadgets();
11231 static void DrawPropertiesTabulatorGadgets(void)
11233 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
11234 struct GadgetDesign *gd = &gd_gi1->alt_design[GD_BUTTON_UNPRESSED];
11235 int gd_x = gd->x + gd_gi1->border.width / 2;
11236 int gd_y = gd->y + gd_gi1->height - 1;
11237 Pixel tab_color = GetPixel(gd->bitmap, gd_x, gd_y);
11238 int id_first = ED_TEXTBUTTON_ID_PROPERTIES_INFO;
11239 int id_last = ED_TEXTBUTTON_ID_PROPERTIES_CONFIG;
11242 // draw two config tabulators for player elements
11243 if (IS_PLAYER_ELEMENT(properties_element))
11244 id_last = ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2;
11246 // draw two config and one "change" tabulator for custom elements
11247 if (IS_CUSTOM_ELEMENT(properties_element))
11248 id_last = ED_TEXTBUTTON_ID_PROPERTIES_CHANGE;
11250 for (i = id_first; i <= id_last; i++)
11252 int gadget_id = textbutton_info[i].gadget_id;
11253 struct GadgetInfo *gi = level_editor_gadget[gadget_id];
11254 boolean active = (i != edit_mode_properties);
11256 // use "config 1" and "config 2" instead of "config" for players and CEs
11257 if (i == ED_TEXTBUTTON_ID_PROPERTIES_CONFIG &&
11258 (IS_PLAYER_ELEMENT(properties_element) ||
11259 IS_CUSTOM_ELEMENT(properties_element)))
11262 // draw background line below tabulator button
11263 ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width, 1);
11265 // draw solid line below inactive tabulator buttons
11266 if (!active && tab_color != BLACK_PIXEL) // black => transparent
11267 FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,
11268 ED_GADGET_TINY_DISTANCE, tab_color);
11270 ModifyGadget(gi, GDI_ACTIVE, active, GDI_END);
11271 MapTextbuttonGadget(i);
11274 // draw little border line below tabulator buttons
11275 if (tab_color != BLACK_PIXEL) // black => transparent
11276 FillRectangle(drawto, gd_gi1->x, gd_gi1->y + gd_gi1->height +
11277 ED_GADGET_TINY_DISTANCE,
11278 getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
11281 static void PrintInfoText(char *text, int font_nr, int xpos, int ypos)
11283 DrawText(SX + xpos, SY + ypos, text, font_nr);
11286 static int PrintElementDescriptionFromFile(char *filename, int font_nr,
11287 int xpos, int ypos)
11289 int font_width = getFontWidth(font_nr);
11290 int font_height = getFontHeight(font_nr);
11291 int max_chars_per_line = (SXSIZE - 2 * xpos) / font_width;
11292 int max_lines_drawable = (SYSIZE - ypos) / font_height - 1;
11294 return DrawTextFile(SX + xpos, SY + ypos, filename, font_nr,
11295 max_chars_per_line, -1, max_lines_drawable, 0, -1,
11296 TRUE, FALSE, FALSE);
11299 static void DrawLevelConfigLevel(void)
11303 // draw counter gadgets
11304 for (i = ED_COUNTER_ID_LEVEL_FIRST; i <= ED_COUNTER_ID_LEVEL_LAST; i++)
11305 MapCounterButtons(i);
11307 // draw checkbutton gadgets
11308 for (i = ED_CHECKBUTTON_ID_LEVEL_FIRST; i<= ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
11309 MapCheckbuttonGadget(i);
11311 // draw selectbox gadgets
11312 for (i = ED_SELECTBOX_ID_LEVEL_FIRST; i <= ED_SELECTBOX_ID_LEVEL_LAST; i++)
11313 MapSelectboxGadget(i);
11315 // draw text input gadgets
11316 for (i = ED_TEXTINPUT_ID_LEVEL_FIRST; i <= ED_TEXTINPUT_ID_LEVEL_LAST; i++)
11317 MapTextInputGadget(i);
11320 static char *getLevelSubdirFromSaveMode(int save_mode)
11322 if (save_mode == LEVELSET_SAVE_MODE_CREATE)
11323 return getNewUserLevelSubdir();
11325 return leveldir_current->subdir;
11328 static void DrawLevelConfigLevelSet_DirectoryInfo(void)
11330 char *directory_text = "Level set directory:";
11331 char *directory_name = getLevelSubdirFromSaveMode(levelset_save_mode);
11332 int font1_nr = FONT_TEXT_1;
11333 int font2_nr = FONT_TEXT_2;
11334 int font1_height = getFontHeight(font1_nr);
11335 int yoffset_above = font1_height + ED_GADGET_LINE_DISTANCE;
11336 int x = ED_LEVEL_SETTINGS_X(0);
11337 int y = ED_LEVEL_SETTINGS_Y(6);
11339 PrintInfoText(directory_text, font1_nr, x, y - yoffset_above);
11340 PrintInfoText(directory_name, font2_nr, x, y);
11343 static void DrawLevelConfigLevelSet(void)
11345 boolean artwork_exists = checkIfCustomArtworkExistsForCurrentLevelSet();
11346 boolean template_exists = fileExists(getLocalLevelTemplateFilename());
11349 // draw counter gadgets
11350 for (i = ED_COUNTER_ID_LEVELSET_FIRST; i <= ED_COUNTER_ID_LEVELSET_LAST; i++)
11351 MapCounterButtons(i);
11353 // draw checkbutton gadgets
11354 for (i = ED_CHECKBUTTON_ID_LEVELSET_FIRST; i <= ED_CHECKBUTTON_ID_LEVELSET_LAST; i++)
11356 if (levelset_save_mode == LEVELSET_SAVE_MODE_UPDATE ||
11357 (i == ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK && !artwork_exists) ||
11358 (i == ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE && !template_exists))
11361 MapCheckbuttonGadget(i);
11364 // draw selectbox gadgets
11365 for (i = ED_SELECTBOX_ID_LEVELSET_FIRST; i <= ED_SELECTBOX_ID_LEVELSET_LAST; i++)
11366 MapSelectboxGadget(i);
11368 // draw text input gadgets
11369 for (i = ED_TEXTINPUT_ID_LEVELSET_FIRST; i <= ED_TEXTINPUT_ID_LEVELSET_LAST; i++)
11370 MapTextInputGadget(i);
11372 // draw textbutton gadgets
11373 MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_LEVELSET);
11376 DrawLevelConfigLevelSet_DirectoryInfo();
11379 static void DrawLevelConfigEditor(void)
11383 // draw counter gadgets
11384 for (i = ED_COUNTER_ID_EDITOR_FIRST; i <= ED_COUNTER_ID_EDITOR_LAST; i++)
11385 MapCounterButtons(i);
11387 // draw checkbutton gadgets
11388 for (i = ED_CHECKBUTTON_ID_EDITOR_FIRST; i <= ED_CHECKBUTTON_ID_EDITOR_LAST; i++)
11389 MapCheckbuttonGadget(i);
11391 // draw radiobutton gadgets
11392 for (i = ED_RADIOBUTTON_ID_EDITOR_FIRST; i <= ED_RADIOBUTTON_ID_EDITOR_LAST; i++)
11393 MapRadiobuttonGadget(i);
11395 // draw drawing area
11396 MapDrawingArea(ED_DRAWING_ID_RANDOM_BACKGROUND);
11398 // draw textbutton gadgets
11399 MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2);
11402 static void DrawEngineConfigConfig(void)
11406 // draw counter gadgets
11407 if (level.bd_scheduling_type == GD_SCHEDULING_MILLISECONDS)
11409 MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_MS);
11410 MapCounterButtons(ED_COUNTER_ID_BD_HATCHING_DELAY_CYCLES);
11414 MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_C64);
11415 MapCounterButtons(ED_COUNTER_ID_BD_HATCHING_DELAY_SECONDS);
11418 // draw checkbutton gadgets
11419 for (i = ED_CHECKBUTTON_ID_ENGINE_FIRST; i <= ED_CHECKBUTTON_ID_ENGINE_LAST; i++)
11420 MapCheckbuttonGadget(i);
11422 // draw selectbox gadgets
11423 for (i = ED_SELECTBOX_ID_ENGINE_FIRST; i <= ED_SELECTBOX_ID_ENGINE_LAST; i++)
11424 MapSelectboxGadget(i);
11427 static int GetCommonColorType_BD(void)
11429 int bd_color_type = *bd_color[0] >> 24;
11432 // check if all colors have the same color type
11433 for (i = 1; i < MAX_BD_COLORS; i++)
11434 if ((*bd_color[i] >> 24) != bd_color_type)
11435 return GD_COLOR_TYPE_RGB;
11437 return bd_color_type;
11440 void SetDefaultLevelColorType_BD(void)
11442 bd_color_type_default = GetCommonColorType_BD();
11444 level.bd_color_type = bd_color_type_default;
11447 void SetDefaultLevelColors_BD(void)
11451 for (i = 0; i < MAX_BD_COLORS; i++)
11452 bd_color_default[i] = *bd_color[i];
11455 static void SetRandomLevelColors_BD(void)
11457 struct LevelInfo_BD *level_bd = level.native_bd_level;
11458 GdCave *cave = level_bd->cave;
11460 // create random cave colors
11461 gd_cave_set_random_colors(cave, level.bd_color_type);
11463 // copy colors to level editor
11464 level.bd_color_b = cave->colorb;
11465 level.bd_color_0 = cave->color0;
11466 level.bd_color_1 = cave->color1;
11467 level.bd_color_2 = cave->color2;
11468 level.bd_color_3 = cave->color3;
11469 level.bd_color_4 = cave->color4;
11470 level.bd_color_5 = cave->color5;
11473 static void DrawColorBox_BD(int nr)
11475 int id = ED_SELECTBOX_ID_COLORS_FIRST + nr;
11476 struct GadgetInfo *gi = level_editor_gadget[selectbox_info[id].gadget_id];
11477 int graphic = IMG_EDITOR_CHECKBOX;
11478 struct GraphicInfo *gd = &graphic_info[graphic];
11479 int offset = ED_GADGET_TEXT_DISTANCE;
11480 int x1 = gi->x - offset - gd->width;
11482 int x2 = x1 + offset;
11483 int y2 = y1 + offset;
11484 int xsize1 = gd->width;
11485 int ysize1 = gd->height;
11486 int xsize2 = xsize1 - 2 * offset;
11487 int ysize2 = ysize1 - 2 * offset;
11488 int bd_color_x = *bd_color[nr];
11489 int r = gd_color_get_r(bd_color_x);
11490 int g = gd_color_get_g(bd_color_x);
11491 int b = gd_color_get_b(bd_color_x);
11492 Pixel color = SDL_MapRGB(drawto->surface->format, r, g, b);
11494 BlitBitmap(gd->bitmap, drawto, gd->src_x, gd->src_y, xsize1, ysize1, x1, y1);
11495 FillRectangle(drawto, x2, y2, xsize2, ysize2, color);
11498 static void DrawEngineConfigColors(void)
11502 if (bd_color_type_changed)
11504 if (level.bd_color_type != GD_COLOR_TYPE_RGB && level.bd_color_type != GetCommonColorType_BD())
11506 // color type switched to non-RGB colors, but using different color type => reset colors
11508 if (level.bd_color_type == bd_color_type_default)
11510 // color type switched to same color type as default colors => reset to defaults
11511 for (i = 0; i < MAX_BD_COLORS; i++)
11512 *bd_color[i] = bd_color_default[i];
11516 // color type switched to different color type as default colors => use random colors
11517 SetRandomLevelColors_BD();
11521 bd_color_type_changed = FALSE;
11524 // copy level colors to either C64-style color index or color text
11525 for (i = 0; i < MAX_BD_COLORS; i++)
11527 int bd_color_x = (level.bd_color_type == GD_COLOR_TYPE_C64 ? *bd_color[i] & 0x0f :
11528 level.bd_color_type == GD_COLOR_TYPE_RGB ? gd_color_get_rgb(*bd_color[i]) :
11531 if (level.bd_color_type == GD_COLOR_TYPE_C64)
11532 bd_color_c64[i] = bd_color_x;
11534 snprintf(bd_color_text[i], sizeof(bd_color_text[i]), "%s", gd_color_get_string(bd_color_x));
11537 MapSelectboxGadget(ED_SELECTBOX_ID_BD_COLOR_TYPE);
11539 if (level.bd_color_type == GD_COLOR_TYPE_C64)
11541 // draw selectbox gadgets
11542 for (i = ED_SELECTBOX_ID_COLORS_FIRST; i <= ED_SELECTBOX_ID_COLORS_LAST; i++)
11543 MapSelectboxGadget(i);
11547 // draw text input gadgets
11548 for (i = ED_TEXTINPUT_ID_COLORS_FIRST; i <= ED_TEXTINPUT_ID_COLORS_LAST; i++)
11549 MapTextInputGadget(i);
11552 for (i = 0; i < MAX_BD_COLORS; i++)
11553 DrawColorBox_BD(i);
11555 MapTextbuttonGadget(ED_TEXTBUTTON_ID_BD_SET_RANDOM_COLORS);
11558 static void DrawLevelConfigEngine(void)
11560 if (edit_mode_engineconfig == ED_MODE_ENGINECONFIG_CONFIG)
11561 DrawEngineConfigConfig();
11562 else if (edit_mode_engineconfig == ED_MODE_ENGINECONFIG_COLORS)
11563 DrawEngineConfigColors();
11566 static void DrawLevelConfigWindow(void)
11568 char *text = "Global Settings";
11569 int font_nr = FONT_TITLE_1;
11570 struct MenuPosInfo *pos = &editor.settings.headline;
11571 int sx = SX + ALIGNED_XPOS(pos->x, getTextWidth(text, font_nr), pos->align);
11572 int sy = SY + pos->y;
11574 stick_element_properties_window = FALSE;
11576 SetAutomaticNumberOfGemsNeeded();
11578 UnmapLevelEditorFieldGadgets();
11580 SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
11583 DrawText(sx, sy, text, font_nr);
11585 DrawLevelConfigTabulatorGadgets();
11587 if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_LEVEL)
11588 DrawLevelConfigLevel();
11589 else if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_LEVELSET)
11590 DrawLevelConfigLevelSet();
11591 else if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_EDITOR)
11592 DrawLevelConfigEditor();
11593 else if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_ENGINE)
11594 DrawLevelConfigEngine();
11597 static void DrawCustomContentArea(void)
11599 int id = ED_DRAWING_ID_CUSTOM_CONTENT;
11600 struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
11601 int x1 = right_gadget_border[GADGET_ID_CUSTOM_DEADLINESS];
11602 int x2 = right_gadget_border[GADGET_ID_CUSTOM_EXPLOSION_TYPE];
11603 int x3 = right_gadget_border[GADGET_ID_CUSTOM_EXPLODE_IMPACT];
11604 int xoffset = ED_GADGET_SPACE_DISTANCE;
11606 // add distance for potential left text (without drawing area border)
11607 x2 += getTextWidthForGadget(drawingarea_info[id].text_left);
11609 ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
11611 MapDrawingArea(ED_DRAWING_ID_CUSTOM_CONTENT);
11614 static void DrawCustomChangeContentArea(void)
11616 int id = ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT;
11617 struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
11618 int x1 = right_gadget_border[GADGET_ID_CHANGE_USE_CONTENT];
11619 int x2 = right_gadget_border[GADGET_ID_CHANGE_REPLACE_WHEN];
11620 int x3 = right_gadget_border[GADGET_ID_CHANGE_ONLY_COMPLETE];
11621 int xoffset = ED_GADGET_SPACE_DISTANCE;
11623 ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
11625 MapDrawingArea(id);
11628 static void RemoveElementContentArea(int id, int font_height)
11630 int border_size = ED_DRAWINGAREA_BORDER_SIZE;
11632 DrawBackground(SX + ED_AREA_SETTINGS_X(drawingarea_info[id]) - border_size,
11633 SY + ED_AREA_SETTINGS_Y(drawingarea_info[id]) - border_size,
11634 3 * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
11635 3 * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size +
11636 ED_GADGET_TEXT_DISTANCE + font_height);
11639 static void DrawYamYamContentAreas(void)
11641 int font_nr = FONT_TEXT_1;
11642 int font_height = getFontHeight(font_nr);
11643 int tilesize = ED_DRAWINGAREA_TILE_SIZE;
11644 int yoffset = (tilesize - font_height) / 2;
11645 int x = SX + ED_AREA_YAMYAM_CONTENT_X(3) + 4 * tilesize;
11646 int y = SY + ED_AREA_YAMYAM_CONTENT_Y(3) + yoffset;
11649 // display counter to choose number of element content areas
11650 MapCounterButtons(ED_COUNTER_ID_YAMYAM_CONTENT);
11652 for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
11654 int id = ED_DRAWING_ID_YAMYAM_CONTENT_0 + i;
11656 if (i < level.num_yamyam_contents)
11658 MapDrawingArea(id);
11662 UnmapDrawingArea(id);
11664 // delete content areas in case of reducing number of them
11665 RemoveElementContentArea(id, font_height);
11669 DrawText(x, y + 0 * tilesize, "content", font_nr);
11670 DrawText(x, y + 1 * tilesize, "when", font_nr);
11671 DrawText(x, y + 2 * tilesize, "smashed", font_nr);
11674 static void DrawMagicBallContentAreas(void)
11676 int font_nr = FONT_TEXT_1;
11677 int font_height = getFontHeight(font_nr);
11678 int tilesize = ED_DRAWINGAREA_TILE_SIZE;
11679 int yoffset = (tilesize - font_height) / 2;
11680 int x = SX + ED_AREA_MAGIC_BALL_CONTENT_X(3) + 4 * tilesize;
11681 int y = SY + ED_AREA_MAGIC_BALL_CONTENT_Y(3) + yoffset;
11684 // display counter to choose number of element content areas
11685 MapCounterButtons(ED_COUNTER_ID_BALL_CONTENT);
11687 for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
11689 int id = ED_DRAWING_ID_MAGIC_BALL_CONTENT_0 + i;
11691 if (i < level.num_ball_contents)
11693 MapDrawingArea(id);
11697 UnmapDrawingArea(id);
11699 // delete content areas in case of reducing number of them
11700 RemoveElementContentArea(id, font_height);
11704 DrawText(x, y + 0 * tilesize, "generated", font_nr);
11705 DrawText(x, y + 1 * tilesize, "when", font_nr);
11706 DrawText(x, y + 2 * tilesize, "active", font_nr);
11709 static void DrawAndroidElementArea(void)
11711 int id = ED_DRAWING_ID_ANDROID_CONTENT;
11712 int num_elements = level.num_android_clone_elements;
11713 int border_size = ED_DRAWINGAREA_BORDER_SIZE;
11714 int sx = SX + ED_AREA_SETTINGS_X(drawingarea_info[id]) - border_size;
11715 int sy = SY + ED_AREA_SETTINGS_Y(drawingarea_info[id]) - border_size;
11716 int xsize = MAX_ANDROID_ELEMENTS;
11719 // display counter to choose number of element areas
11720 MapCounterButtons(ED_COUNTER_ID_ANDROID_CONTENT);
11722 if (drawingarea_info[id].text_left != NULL)
11723 sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
11725 UnmapDrawingArea(id);
11727 ModifyEditorDrawingArea(id, num_elements, 1);
11729 // delete content areas in case of reducing number of them
11730 DrawBackground(sx, sy,
11731 xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
11732 ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
11734 MapDrawingArea(id);
11737 static void DrawGroupElementArea(void)
11739 int id = ED_DRAWING_ID_GROUP_CONTENT;
11740 int num_elements = group_element_info.num_elements;
11741 int border_size = ED_DRAWINGAREA_BORDER_SIZE;
11742 int sx = SX + ED_AREA_SETTINGS_X(drawingarea_info[id]) - border_size;
11743 int sy = SY + ED_AREA_SETTINGS_Y(drawingarea_info[id]) - border_size;
11744 int xsize = MAX_ELEMENTS_IN_GROUP;
11747 if (drawingarea_info[id].text_left != NULL)
11748 sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
11750 UnmapDrawingArea(id);
11752 ModifyEditorDrawingArea(id, num_elements, 1);
11754 // delete content areas in case of reducing number of them
11755 DrawBackground(sx, sy,
11756 xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
11757 ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
11759 MapDrawingArea(id);
11762 static void DrawPlayerInitialInventoryArea(int element)
11764 int id = ED_DRAWING_ID_INVENTORY_CONTENT;
11765 int player_nr = GET_PLAYER_NR(element);
11766 int num_elements = level.initial_inventory_size[player_nr];
11767 int border_size = ED_DRAWINGAREA_BORDER_SIZE;
11768 int sx = SX + ED_AREA_SETTINGS_X(drawingarea_info[id]) - border_size;
11769 int sy = SY + ED_AREA_SETTINGS_Y(drawingarea_info[id]) - border_size;
11770 int xsize = MAX_INITIAL_INVENTORY_SIZE;
11773 // determine horizontal position to the right of specified gadget
11774 if (drawingarea_info[id].gadget_id_align != GADGET_ID_NONE)
11775 sx = (right_gadget_border[drawingarea_info[id].gadget_id_align] +
11776 ED_DRAWINGAREA_TEXT_DISTANCE);
11778 // determine horizontal offset for leading text
11779 if (drawingarea_info[id].text_left != NULL)
11780 sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
11782 UnmapDrawingArea(id);
11784 ModifyEditorDrawingArea(id, num_elements, 1);
11786 // delete content areas in case of reducing number of them
11787 DrawBackground(sx, sy,
11788 xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
11789 ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
11791 MapDrawingArea(id);
11794 static void DrawMMBallContentArea(void)
11796 int id = ED_DRAWING_ID_MM_BALL_CONTENT;
11797 int num_elements = level.num_mm_ball_contents;
11798 int border_size = ED_DRAWINGAREA_BORDER_SIZE;
11799 int sx = SX + ED_AREA_SETTINGS_X(drawingarea_info[id]) - border_size;
11800 int sy = SY + ED_AREA_SETTINGS_Y(drawingarea_info[id]) - border_size;
11801 int xsize = MAX_MM_BALL_CONTENTS;
11804 if (drawingarea_info[id].text_left != NULL)
11805 sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
11807 UnmapDrawingArea(id);
11809 ModifyEditorDrawingArea(id, num_elements, 1);
11811 // delete content areas in case of reducing number of them
11812 DrawBackground(sx, sy,
11813 xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
11814 ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
11816 MapDrawingArea(id);
11819 static void DrawEnvelopeTextArea(int envelope_nr)
11821 int id = ED_TEXTAREA_ID_ENVELOPE_INFO;
11822 struct GadgetInfo *gi = level_editor_gadget[textarea_info[id].gadget_id];
11826 DrawBackground(gi->x, gi->y,
11827 gi->textarea.crop_width, gi->textarea.crop_height);
11829 if (envelope_nr != -1)
11830 textarea_info[id].value = level.envelope[envelope_nr].text;
11832 ModifyGadget(gi, GDI_AREA_SIZE,
11833 *counterbutton_info[ED_COUNTER_ID_ENVELOPE_XSIZE].value,
11834 *counterbutton_info[ED_COUNTER_ID_ENVELOPE_YSIZE].value,
11837 MapTextAreaGadget(ED_TEXTAREA_ID_ENVELOPE_INFO);
11840 static void DrawPropertiesInfo(void)
11849 // configurable properties
11851 { EP_WALKABLE_OVER, "- player can walk over it" },
11852 { EP_WALKABLE_INSIDE, "- player can walk inside it" },
11853 { EP_WALKABLE_UNDER, "- player can walk under it" },
11854 { EP_PASSABLE_OVER, "- player can pass over it" },
11855 { EP_PASSABLE_INSIDE, "- player can pass through it" },
11856 { EP_PASSABLE_UNDER, "- player can pass under it" },
11857 { EP_PROTECTED, "- player is protected by it" },
11859 { EP_DIGGABLE, "- can be digged away" },
11860 { EP_COLLECTIBLE, "- can be collected" },
11861 { EP_DROPPABLE, "- can be dropped after collecting" },
11862 { EP_THROWABLE, "- can be thrown after collecting" },
11863 { EP_PUSHABLE, "- can be pushed" },
11865 { EP_CAN_FALL, "- can fall" },
11866 { EP_CAN_MOVE, "- can move" },
11868 { EP_CAN_SMASH_PLAYER, "- can smash player" },
11870 { EP_CAN_SMASH_ENEMIES, "- can smash good and bad guys" },
11872 { EP_CAN_SMASH_EVERYTHING, "- can smash everything smashable" },
11874 { EP_SLIPPERY, "- slippery for falling elements" },
11875 { EP_EM_SLIPPERY_WALL, "- slippery for some gems (EM style)" },
11877 { EP_DONT_RUN_INTO, "- deadly when running into" },
11878 { EP_DONT_COLLIDE_WITH, "- deadly when colliding with" },
11879 { EP_DONT_GET_HIT_BY, "- deadly when getting hit by" },
11880 { EP_DONT_TOUCH, "- deadly when touching" },
11882 { EP_INDESTRUCTIBLE, "- indestructible" },
11884 { EP_CAN_EXPLODE_BY_FIRE, "- can explode by fire or explosions" },
11885 { EP_CAN_EXPLODE_SMASHED, "- can explode when smashed" },
11886 { EP_CAN_EXPLODE_IMPACT, "- can explode on impact" },
11888 { EP_CAN_CHANGE, "- can change to other element" },
11890 // pre-defined properties
11891 { EP_CAN_PASS_MAGIC_WALL, "- can pass magic walls" },
11892 { EP_CAN_PASS_DC_MAGIC_WALL,"- can pass magic walls (DC style)" },
11893 { EP_SWITCHABLE, "- can be switched" },
11895 { EP_HAS_EDITOR_CONTENT, "- can contain other elements" },
11900 char *filename = getElementDescriptionFilename(properties_element);
11901 char *num_elements_text = "In this level: ";
11902 char *num_similar_text = "Similar tiles: ";
11903 char *properties_text = "Standard properties: ";
11904 char *description_text = "Description:";
11905 char *no_description_text = "No description available.";
11906 char *none_text = "None";
11908 int num_elements_in_level = 0;
11909 int num_similar_in_level = 0;
11910 int num_hires_tiles_in_level = 0;
11911 int num_standard_properties = 0;
11912 int font1_nr = FONT_TEXT_1;
11913 int font2_nr = FONT_TEXT_2;
11914 int font1_width = getFontWidth(font1_nr);
11915 int font1_height = getFontHeight(font1_nr);
11916 int font2_height = getFontHeight(font2_nr);
11917 int line1_height = font1_height + ED_GADGET_LINE_DISTANCE;
11918 int font2_yoffset = (font1_height - font2_height) / 2;
11919 int num_elements_text_len = strlen(num_elements_text) * font1_width;
11920 int num_similar_text_len = strlen(num_similar_text) * font1_width;
11921 int properties_text_len = strlen(properties_text) * font1_width;
11922 int xpos = ED_ELEMENT_SETTINGS_X(0);
11923 int ypos = ED_ELEMENT_SETTINGS_Y(0) + ED_GADGET_SMALL_DISTANCE;
11926 if (setup.editor.show_element_token)
11928 int font3_nr = FONT_TEXT_3;
11929 int font3_height = getFontHeight(font3_nr);
11931 DrawTextF(xpos, ypos, font3_nr,
11932 "[%s]", element_info[properties_element].token_name);
11934 ypos += 2 * font3_height;
11937 // ----- print number of elements / percentage of this element in level
11939 for (y = 0; y < lev_fieldy; y++)
11941 for (x = 0; x < lev_fieldx; x++)
11943 if (Tile[x][y] == properties_element)
11945 num_elements_in_level++;
11947 else if (IS_MM_WALL(Tile[x][y]) &&
11948 map_mm_wall_element(Tile[x][y]) == properties_element)
11950 num_hires_tiles_in_level += numHiresTiles(Tile[x][y]);
11955 percentage = num_elements_in_level * 100.0 / (lev_fieldx * lev_fieldy);
11957 DrawTextS(xpos, ypos, font1_nr, num_elements_text);
11959 if (num_hires_tiles_in_level > 0)
11960 DrawTextF(xpos + num_elements_text_len, ypos + font2_yoffset, font2_nr,
11961 "%d wall tiles", num_hires_tiles_in_level);
11962 else if (num_elements_in_level > 0)
11963 DrawTextF(xpos + num_elements_text_len, ypos + font2_yoffset, font2_nr,
11964 "%d (%.2f %%)", num_elements_in_level, percentage);
11966 DrawTextF(xpos + num_elements_text_len, ypos + font2_yoffset, font2_nr,
11969 // ----- print number of similar elements / percentage of them in level
11971 for (y = 0; y < lev_fieldy; y++)
11973 for (x = 0; x < lev_fieldx; x++)
11975 if (strEqual(element_info[Tile[x][y]].class_name,
11976 element_info[properties_element].class_name))
11978 num_similar_in_level++;
11983 if (num_similar_in_level != num_elements_in_level)
11985 ypos += 1 * MAX(font1_height, font2_height);
11987 percentage = num_similar_in_level * 100.0 / (lev_fieldx * lev_fieldy);
11989 DrawTextS(xpos, ypos, font1_nr, num_similar_text);
11991 if (num_similar_in_level > 0)
11992 DrawTextF(xpos + num_similar_text_len, ypos + font2_yoffset, font2_nr,
11993 "%d (%.2f %%)", num_similar_in_level, percentage);
11995 DrawTextF(xpos + num_similar_text_len, ypos + font2_yoffset, font2_nr,
11999 ypos += 2 * MAX(font1_height, font2_height);
12001 // ----- print standard properties of this element
12003 DrawTextS(xpos, ypos, font1_nr, properties_text);
12005 ypos += line1_height;
12007 for (i = 0; properties[i].value != -1; i++)
12009 if (!HAS_PROPERTY(properties_element, properties[i].value))
12012 DrawTextS(xpos, ypos, font2_nr, properties[i].text);
12014 ypos += font2_height;
12016 num_standard_properties++;
12019 if (num_standard_properties == 0)
12021 DrawTextS(xpos + properties_text_len, ypos - line1_height + font2_yoffset,
12022 font2_nr, none_text);
12024 ypos -= (line1_height - font1_height);
12027 ypos += MAX(font1_height, font2_height);
12029 // ----- print special description of this element
12031 PrintInfoText(description_text, font1_nr, xpos, ypos);
12033 ypos += line1_height;
12035 if (PrintElementDescriptionFromFile(filename, font2_nr, xpos, ypos) == 0)
12036 PrintInfoText(no_description_text, font1_nr, xpos, ypos - line1_height);
12039 #define TEXT_COLLECTING "Score for collecting"
12040 #define TEXT_COLLECTING_EXTRA "Score for extra diamonds"
12041 #define TEXT_SMASHING "Score for smashing"
12042 #define TEXT_SLURPING "Score for slurping robot"
12043 #define TEXT_CRACKING "Score for cracking"
12044 #define TEXT_AMOEBA_SPEED "Speed of amoeba growth"
12045 #define TEXT_AMOEBA_THRESHOED "Size for turning to rocks"
12046 #define TEXT_AMOEBA_SLOW_TIME "Slow growth time (seconds)"
12047 #define TEXT_AMOEBA_SLOW_RATE "Slow growth rate (percent)"
12048 #define TEXT_AMOEBA_FAST_RATE "Fast growth rate (percent)"
12049 #define TEXT_DURATION "Duration when activated"
12050 #define TEXT_DELAY_ON "Delay before activating"
12051 #define TEXT_DELAY_OFF "Delay before deactivating"
12052 #define TEXT_DELAY_CHANGING "Delay before changing"
12053 #define TEXT_DELAY_EXPLODING "Delay before exploding"
12054 #define TEXT_DELAY_MOVING "Delay before moving"
12055 #define TEXT_BALL_DELAY "Element generation delay"
12056 #define TEXT_MOVE_SPEED "Speed of android moving"
12057 #define TEXT_CLONE_SPEED "Speed of android cloning"
12058 #define TEXT_GAME_OF_LIFE_1 "Min neighbours to survive"
12059 #define TEXT_GAME_OF_LIFE_2 "Max neighbours to survive"
12060 #define TEXT_GAME_OF_LIFE_3 "Min neighbours to create"
12061 #define TEXT_GAME_OF_LIFE_4 "Max neighbours to create"
12062 #define TEXT_TIME_BONUS "Extra time to solve level"
12063 #define TEXT_TIME_PENALTY "Time penalty if destroyed"
12064 #define TEXT_PERMEABILITY_RATE "slime permeability rate"
12065 #define TEXT_PERMEABILITY_BITS "slime permeability bits"
12066 #define TEXT_RANDOM_SEED "slime random number seed"
12067 #define TEXT_ACID_SPREAD_RATE "Spread rate (percent)"
12068 #define TEXT_BITER_MOVE_DELAY "Move delay (BD frames)"
12069 #define TEXT_REPLICATION_DELAY "Create delay (BD frames)"
12070 #define TEXT_HAMMER_BREAK_DELAY "Delay for breaking walls"
12071 #define TEXT_HAMMER_REAPPEAR_DELAY "Delay for reappearing walls"
12072 #define TEXT_SKELETONS_NEEDED "Skeletons needed to use pot"
12073 #define TEXT_SKELETONS_WORTH "Counts as this many diamonds"
12074 #define TEXT_AUTO_TURN_DELAY "Creatures auto turn delay"
12075 #define TEXT_GRAVITY_DELAY "Gravity switch change delay"
12084 } elements_with_counter[] =
12086 { EL_EMERALD, &level.score[SC_EMERALD], TEXT_COLLECTING },
12087 { EL_BD_DIAMOND, &level.score[SC_EMERALD], TEXT_COLLECTING },
12088 { EL_BD_DIAMOND, &level.score[SC_DIAMOND_EXTRA], TEXT_COLLECTING_EXTRA },
12089 { EL_EMERALD_YELLOW, &level.score[SC_EMERALD], TEXT_COLLECTING },
12090 { EL_EMERALD_RED, &level.score[SC_EMERALD], TEXT_COLLECTING },
12091 { EL_EMERALD_PURPLE, &level.score[SC_EMERALD], TEXT_COLLECTING },
12092 { EL_SP_INFOTRON, &level.score[SC_EMERALD], TEXT_COLLECTING },
12093 { EL_DIAMOND, &level.score[SC_DIAMOND], TEXT_COLLECTING },
12094 { EL_CRYSTAL, &level.score[SC_CRYSTAL], TEXT_COLLECTING },
12095 { EL_PEARL, &level.score[SC_PEARL], TEXT_COLLECTING },
12096 { EL_BUG, &level.score[SC_BUG], TEXT_SMASHING },
12097 { EL_BUG_RIGHT, &level.score[SC_BUG], TEXT_SMASHING },
12098 { EL_BUG_UP, &level.score[SC_BUG], TEXT_SMASHING },
12099 { EL_BUG_LEFT, &level.score[SC_BUG], TEXT_SMASHING },
12100 { EL_BUG_DOWN, &level.score[SC_BUG], TEXT_SMASHING },
12101 { EL_BD_BUTTERFLY, &level.score[SC_BUG], TEXT_SMASHING },
12102 { EL_BD_BUTTERFLY_RIGHT, &level.score[SC_BUG], TEXT_SMASHING },
12103 { EL_BD_BUTTERFLY_UP, &level.score[SC_BUG], TEXT_SMASHING },
12104 { EL_BD_BUTTERFLY_LEFT, &level.score[SC_BUG], TEXT_SMASHING },
12105 { EL_BD_BUTTERFLY_DOWN, &level.score[SC_BUG], TEXT_SMASHING },
12106 { EL_SP_ELECTRON, &level.score[SC_BUG], TEXT_SMASHING },
12107 { EL_SPACESHIP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12108 { EL_SPACESHIP_RIGHT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12109 { EL_SPACESHIP_UP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12110 { EL_SPACESHIP_LEFT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12111 { EL_SPACESHIP_DOWN, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12112 { EL_BD_FIREFLY, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12113 { EL_BD_FIREFLY_RIGHT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12114 { EL_BD_FIREFLY_UP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12115 { EL_BD_FIREFLY_LEFT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12116 { EL_BD_FIREFLY_DOWN, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12117 { EL_SP_SNIKSNAK, &level.score[SC_SPACESHIP], TEXT_SMASHING },
12118 { EL_YAMYAM, &level.score[SC_YAMYAM], TEXT_SMASHING },
12119 { EL_YAMYAM_LEFT, &level.score[SC_YAMYAM], TEXT_SMASHING },
12120 { EL_YAMYAM_RIGHT, &level.score[SC_YAMYAM], TEXT_SMASHING },
12121 { EL_YAMYAM_UP, &level.score[SC_YAMYAM], TEXT_SMASHING },
12122 { EL_YAMYAM_DOWN, &level.score[SC_YAMYAM], TEXT_SMASHING },
12123 { EL_DARK_YAMYAM, &level.score[SC_YAMYAM], TEXT_SMASHING },
12124 { EL_ROBOT, &level.score[SC_ROBOT], TEXT_SMASHING },
12125 { EL_PACMAN, &level.score[SC_PACMAN], TEXT_SMASHING },
12126 { EL_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING },
12127 { EL_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING },
12128 { EL_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING },
12129 { EL_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING },
12130 { EL_NUT, &level.score[SC_NUT], TEXT_CRACKING },
12131 { EL_DYNAMITE, &level.score[SC_DYNAMITE], TEXT_COLLECTING },
12132 { EL_EM_DYNAMITE, &level.score[SC_DYNAMITE], TEXT_COLLECTING },
12133 { EL_DYNABOMB_INCREASE_NUMBER,&level.score[SC_DYNAMITE], TEXT_COLLECTING },
12134 { EL_DYNABOMB_INCREASE_SIZE, &level.score[SC_DYNAMITE], TEXT_COLLECTING },
12135 { EL_DYNABOMB_INCREASE_POWER, &level.score[SC_DYNAMITE], TEXT_COLLECTING },
12136 { EL_SHIELD_NORMAL, &level.score[SC_SHIELD], TEXT_COLLECTING },
12137 { EL_SHIELD_DEADLY, &level.score[SC_SHIELD], TEXT_COLLECTING },
12138 { EL_EXTRA_TIME, &level.extra_time_score, TEXT_COLLECTING },
12139 { EL_KEY_1, &level.score[SC_KEY], TEXT_COLLECTING },
12140 { EL_KEY_2, &level.score[SC_KEY], TEXT_COLLECTING },
12141 { EL_KEY_3, &level.score[SC_KEY], TEXT_COLLECTING },
12142 { EL_KEY_4, &level.score[SC_KEY], TEXT_COLLECTING },
12143 { EL_EM_KEY_1, &level.score[SC_KEY], TEXT_COLLECTING },
12144 { EL_EM_KEY_2, &level.score[SC_KEY], TEXT_COLLECTING },
12145 { EL_EM_KEY_3, &level.score[SC_KEY], TEXT_COLLECTING },
12146 { EL_EM_KEY_4, &level.score[SC_KEY], TEXT_COLLECTING },
12147 { EL_EMC_KEY_5, &level.score[SC_KEY], TEXT_COLLECTING },
12148 { EL_EMC_KEY_6, &level.score[SC_KEY], TEXT_COLLECTING },
12149 { EL_EMC_KEY_7, &level.score[SC_KEY], TEXT_COLLECTING },
12150 { EL_EMC_KEY_8, &level.score[SC_KEY], TEXT_COLLECTING },
12151 { EL_DC_KEY_WHITE, &level.score[SC_KEY], TEXT_COLLECTING },
12152 { EL_MM_KETTLE, &level.score[SC_EMERALD], TEXT_COLLECTING },
12153 { EL_DF_CELL, &level.score[SC_EMERALD], TEXT_COLLECTING },
12154 { EL_MM_KEY, &level.score[SC_KEY], TEXT_COLLECTING },
12155 { EL_MM_LIGHTBALL, &level.score[SC_ELEM_BONUS], TEXT_COLLECTING },
12156 { EL_MM_PACMAN, &level.score[SC_PACMAN], TEXT_SMASHING },
12157 { EL_MM_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING },
12158 { EL_MM_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING },
12159 { EL_MM_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING },
12160 { EL_MM_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING },
12161 { EL_AMOEBA_WET, &level.amoeba_speed, TEXT_AMOEBA_SPEED },
12162 { EL_AMOEBA_DRY, &level.amoeba_speed, TEXT_AMOEBA_SPEED },
12163 { EL_AMOEBA_FULL, &level.amoeba_speed, TEXT_AMOEBA_SPEED },
12164 { EL_BD_AMOEBA, &level.amoeba_speed, TEXT_AMOEBA_SPEED },
12165 { EL_EMC_DRIPPER, &level.amoeba_speed, TEXT_AMOEBA_SPEED },
12166 { EL_BD_AMOEBA, &level.bd_amoeba_threshold_too_big, TEXT_AMOEBA_THRESHOED },
12167 { EL_BD_AMOEBA, &level.bd_amoeba_slow_growth_time, TEXT_AMOEBA_SLOW_TIME },
12168 { EL_BD_AMOEBA, &level.bd_amoeba_slow_growth_rate, TEXT_AMOEBA_SLOW_RATE,
12170 { EL_BD_AMOEBA, &level.bd_amoeba_fast_growth_rate, TEXT_AMOEBA_FAST_RATE,
12172 { EL_BD_AMOEBA_2, &level.bd_amoeba_2_threshold_too_big, TEXT_AMOEBA_THRESHOED },
12173 { EL_BD_AMOEBA_2, &level.bd_amoeba_2_slow_growth_time, TEXT_AMOEBA_SLOW_TIME },
12174 { EL_BD_AMOEBA_2, &level.bd_amoeba_2_slow_growth_rate, TEXT_AMOEBA_SLOW_RATE,
12176 { EL_BD_AMOEBA_2, &level.bd_amoeba_2_fast_growth_rate, TEXT_AMOEBA_FAST_RATE,
12178 { EL_MAGIC_WALL, &level.time_magic_wall, TEXT_DURATION },
12179 { EL_BD_MAGIC_WALL, &level.time_magic_wall, TEXT_DURATION },
12180 { EL_DC_MAGIC_WALL, &level.time_magic_wall, TEXT_DURATION },
12181 { EL_ROBOT_WHEEL, &level.time_wheel, TEXT_DURATION },
12182 { EL_TIMEGATE_SWITCH, &level.time_timegate, TEXT_DURATION },
12183 { EL_DC_TIMEGATE_SWITCH, &level.time_timegate, TEXT_DURATION },
12184 { EL_LIGHT_SWITCH, &level.time_light, TEXT_DURATION },
12185 { EL_LIGHT_SWITCH_ACTIVE, &level.time_light, TEXT_DURATION },
12186 { EL_SHIELD_NORMAL, &level.shield_normal_time, TEXT_DURATION },
12187 { EL_SHIELD_DEADLY, &level.shield_deadly_time, TEXT_DURATION },
12188 { EL_BD_CLOCK, &level.bd_clock_extra_time, TEXT_TIME_BONUS,
12190 { EL_BD_VOODOO_DOLL, &level.bd_voodoo_penalty_time, TEXT_TIME_PENALTY,
12192 { EL_BD_SLIME, &level.bd_slime_permeability_rate, TEXT_PERMEABILITY_RATE,
12194 { EL_BD_SLIME, &level.bd_slime_permeability_bits_c64, TEXT_PERMEABILITY_BITS,
12196 { EL_BD_SLIME, &level.bd_slime_random_seed_c64, TEXT_RANDOM_SEED,
12198 { EL_BD_ACID, &level.bd_acid_spread_rate, TEXT_ACID_SPREAD_RATE,
12200 { EL_BD_BITER, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY,
12202 { EL_BD_BITER_RIGHT, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY,
12204 { EL_BD_BITER_UP, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY,
12206 { EL_BD_BITER_LEFT, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY,
12208 { EL_BD_BITER_DOWN, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY,
12210 { EL_BD_REPLICATOR, &level.bd_replicator_create_delay, TEXT_REPLICATION_DELAY,
12212 { EL_BD_PNEUMATIC_HAMMER, &level.bd_hammer_walls_break_delay, TEXT_HAMMER_BREAK_DELAY,
12214 { EL_BD_PNEUMATIC_HAMMER, &level.bd_hammer_walls_reappear_delay, TEXT_HAMMER_REAPPEAR_DELAY,
12216 { EL_BD_POT, &level.bd_num_skeletons_needed_for_pot, TEXT_SKELETONS_NEEDED,
12218 { EL_BD_SKELETON, &level.bd_num_skeletons_needed_for_pot, TEXT_SKELETONS_NEEDED,
12220 { EL_BD_SKELETON, &level.bd_skeleton_worth_num_diamonds, TEXT_SKELETONS_WORTH,
12222 { EL_BD_CREATURE_SWITCH, &level.bd_creatures_auto_turn_delay, TEXT_AUTO_TURN_DELAY },
12223 { EL_BD_GRAVITY_SWITCH, &level.bd_gravity_switch_delay, TEXT_GRAVITY_DELAY,
12225 { EL_EXTRA_TIME, &level.extra_time, TEXT_TIME_BONUS },
12226 { EL_TIME_ORB_FULL, &level.time_orb_time, TEXT_TIME_BONUS },
12227 { EL_GAME_OF_LIFE, &level.game_of_life[0], TEXT_GAME_OF_LIFE_1,0,8 },
12228 { EL_GAME_OF_LIFE, &level.game_of_life[1], TEXT_GAME_OF_LIFE_2,0,8 },
12229 { EL_GAME_OF_LIFE, &level.game_of_life[2], TEXT_GAME_OF_LIFE_3,0,8 },
12230 { EL_GAME_OF_LIFE, &level.game_of_life[3], TEXT_GAME_OF_LIFE_4,0,8 },
12231 { EL_BIOMAZE, &level.biomaze[0], TEXT_GAME_OF_LIFE_1,0,8 },
12232 { EL_BIOMAZE, &level.biomaze[1], TEXT_GAME_OF_LIFE_2,0,8 },
12233 { EL_BIOMAZE, &level.biomaze[2], TEXT_GAME_OF_LIFE_3,0,8 },
12234 { EL_BIOMAZE, &level.biomaze[3], TEXT_GAME_OF_LIFE_4,0,8 },
12235 { EL_EMC_ANDROID, &level.android_move_time, TEXT_MOVE_SPEED },
12236 { EL_EMC_ANDROID, &level.android_clone_time, TEXT_CLONE_SPEED },
12237 { EL_EMC_MAGIC_BALL, &level.ball_time, TEXT_BALL_DELAY },
12238 { EL_EMC_LENSES, &level.lenses_score, TEXT_COLLECTING },
12239 { EL_EMC_MAGNIFIER, &level.magnify_score, TEXT_COLLECTING },
12240 { EL_SPRING, &level.slurp_score, TEXT_SLURPING },
12241 { EL_SPRING_LEFT, &level.slurp_score, TEXT_SLURPING },
12242 { EL_SPRING_RIGHT, &level.slurp_score, TEXT_SLURPING },
12243 { EL_EMC_LENSES, &level.lenses_time, TEXT_DURATION },
12244 { EL_EMC_MAGNIFIER, &level.magnify_time, TEXT_DURATION },
12245 { EL_MM_FUSE_ACTIVE, &level.mm_time_fuse, TEXT_DELAY_OFF },
12246 { EL_MM_BOMB, &level.mm_time_bomb, TEXT_DELAY_EXPLODING },
12247 { EL_MM_GRAY_BALL, &level.mm_time_ball, TEXT_DELAY_CHANGING },
12248 { EL_MM_STEEL_BLOCK, &level.mm_time_block, TEXT_DELAY_MOVING },
12249 { EL_MM_WOODEN_BLOCK, &level.mm_time_block, TEXT_DELAY_MOVING },
12254 static boolean checkPropertiesConfig(int element)
12258 // special case: empty space customization only available in R'n'D game engine
12259 if (element == EL_EMPTY_SPACE && level.game_engine_type != GAME_ENGINE_TYPE_RND)
12262 // special case: BD style rock customization only available in BD game engine
12263 if (element == EL_BD_ROCK && level.game_engine_type != GAME_ENGINE_TYPE_BD)
12266 if (IS_GEM(element) ||
12267 IS_CUSTOM_ELEMENT(element) ||
12268 IS_GROUP_ELEMENT(element) ||
12269 IS_EMPTY_ELEMENT(element) ||
12270 IS_BALLOON_ELEMENT(element) ||
12271 IS_ENVELOPE(element) ||
12272 IS_MM_ENVELOPE(element) ||
12273 IS_MM_MCDUFFIN(element) ||
12274 IS_DF_LASER(element) ||
12275 IS_PLAYER_ELEMENT(element) ||
12276 IS_BD_PLAYER_ELEMENT(element) ||
12277 IS_BD_FIREFLY(properties_element) ||
12278 IS_BD_FIREFLY_2(properties_element) ||
12279 IS_BD_BUTTERFLY(properties_element) ||
12280 IS_BD_BUTTERFLY_2(properties_element) ||
12281 IS_BD_STONEFLY(properties_element) ||
12282 IS_BD_DRAGONFLY(properties_element) ||
12283 IS_BD_EXPANDABLE_WALL(properties_element) ||
12284 IS_BD_EXPANDABLE_STEELWALL(properties_element) ||
12285 IS_BD_CONVEYOR_BELT(properties_element) ||
12286 IS_BD_CONVEYOR_BELT_SWITCH(properties_element) ||
12287 IS_SOKOBAN_OBJECT_OR_FIELD(element) ||
12288 HAS_EDITOR_CONTENT(element) ||
12289 CAN_GROW(element) ||
12290 COULD_MOVE_INTO_ACID(element) ||
12291 MAYBE_DONT_COLLIDE_WITH(element) ||
12292 element == EL_BD_SAND ||
12293 element == EL_BD_ROCK ||
12294 element == EL_BD_MEGA_ROCK ||
12295 element == EL_BD_BOMB ||
12296 element == EL_BD_ROCKET_LAUNCHER ||
12297 element == EL_BD_NITRO_PACK ||
12298 element == EL_BD_SWEET ||
12299 element == EL_BD_VOODOO_DOLL ||
12300 element == EL_BD_WATER ||
12301 element == EL_BD_GRAVITY_SWITCH)
12307 for (i = 0; elements_with_counter[i].element != -1; i++)
12308 if (elements_with_counter[i].element == element)
12315 static void SetAutomaticNumberOfGemsNeeded(void)
12319 if (!level.auto_count_gems)
12322 level.gems_needed = 0;
12324 for (x = 0; x < lev_fieldx; x++)
12326 for (y = 0; y < lev_fieldy; y++)
12328 int element = Tile[x][y];
12333 case EL_EMERALD_YELLOW:
12334 case EL_EMERALD_RED:
12335 case EL_EMERALD_PURPLE:
12336 case EL_BD_DIAMOND:
12337 case EL_WALL_EMERALD:
12338 case EL_WALL_EMERALD_YELLOW:
12339 case EL_WALL_EMERALD_RED:
12340 case EL_WALL_EMERALD_PURPLE:
12341 case EL_WALL_BD_DIAMOND:
12343 case EL_SP_INFOTRON:
12346 level.gems_needed++;
12350 case EL_WALL_DIAMOND:
12351 level.gems_needed += 3;
12355 case EL_WALL_PEARL:
12356 level.gems_needed += 5;
12360 case EL_WALL_CRYSTAL:
12361 level.gems_needed += 8;
12370 ModifyEditorCounterValue(ED_COUNTER_ID_LEVEL_GEMSLIMIT, level.gems_needed);
12373 static void DrawPropertiesConfig(void)
12375 boolean draw_footer_line = FALSE;
12376 int max_num_element_counters = 4;
12377 int num_element_counters = 0;
12380 if (!checkPropertiesConfig(properties_element))
12382 int xpos = ED_ELEMENT_SETTINGS_X(0);
12383 int ypos = ED_ELEMENT_SETTINGS_Y(0) + ED_GADGET_SMALL_DISTANCE;
12385 PrintInfoText("No configuration options available.", FONT_TEXT_1, xpos, ypos);
12390 // check if there are elements where a value can be chosen for
12391 for (i = 0; elements_with_counter[i].element != -1; i++)
12393 if (elements_with_counter[i].element != properties_element)
12396 // special case: score for extra diamonds only available in BD game engine
12397 if (elements_with_counter[i].element == EL_BD_DIAMOND &&
12398 elements_with_counter[i].value == &level.score[SC_DIAMOND_EXTRA] &&
12399 level.game_engine_type != GAME_ENGINE_TYPE_BD)
12402 // special case: some amoeba counters only available in BD game engine
12403 if (elements_with_counter[i].element == EL_BD_AMOEBA &&
12404 elements_with_counter[i].value != &level.amoeba_speed &&
12405 level.game_engine_type != GAME_ENGINE_TYPE_BD)
12408 // special case: score for smashing only available in R'n'D game engine
12409 if ((IS_BD_FIREFLY(elements_with_counter[i].element) ||
12410 IS_BD_BUTTERFLY(elements_with_counter[i].element)) &&
12411 (elements_with_counter[i].value == &level.score[SC_BUG] ||
12412 elements_with_counter[i].value == &level.score[SC_SPACESHIP]) &&
12413 level.game_engine_type == GAME_ENGINE_TYPE_BD)
12416 // special case: some amoeba counters only available in R'n'D game engine
12417 if (elements_with_counter[i].element == EL_BD_AMOEBA &&
12418 elements_with_counter[i].value == &level.amoeba_speed &&
12419 level.game_engine_type == GAME_ENGINE_TYPE_BD)
12422 int counter_id = ED_COUNTER_ID_ELEMENT_VALUE1 + num_element_counters;
12424 counterbutton_info[counter_id].y =
12425 ED_ELEMENT_SETTINGS_YPOS((HAS_EDITOR_CONTENT(properties_element) ? 1 : 0) +
12426 (CAN_GROW(properties_element) ? 1 : 0) +
12427 (COULD_MOVE_INTO_ACID(properties_element) ? 1 : 0) +
12428 (MAYBE_DONT_COLLIDE_WITH(properties_element) ? 1 : 0) +
12429 (properties_element == EL_BD_VOODOO_DOLL ? 4 : 0) +
12430 (properties_element == EL_BD_SLIME ? 1 : 0) +
12431 (properties_element == EL_BD_ACID ? 1 : 0) +
12432 (properties_element == EL_BD_REPLICATOR ? 1 : 0) +
12433 (properties_element == EL_BD_CREATURE_SWITCH ? 1 : 0) +
12434 (properties_element == EL_BD_GRAVITY_SWITCH ? 2 : 0) +
12435 (properties_element == EL_EMC_MAGIC_BALL ? 2 : 0) +
12436 num_element_counters);
12438 // special case: set magic wall counter for BD game engine separately
12439 if (properties_element == EL_BD_MAGIC_WALL && level.game_engine_type == GAME_ENGINE_TYPE_BD)
12440 counterbutton_info[counter_id].y = ED_ELEMENT_SETTINGS_YPOS(1);
12442 // special case: set amoeba counters for BD game engine separately
12443 if ((properties_element == EL_BD_AMOEBA && level.game_engine_type == GAME_ENGINE_TYPE_BD) ||
12444 (properties_element == EL_BD_AMOEBA_2))
12445 counterbutton_info[counter_id].y = ED_ELEMENT_SETTINGS_YPOS(3 + num_element_counters);
12447 // special case: set position for delay counter for reappearing hammered walls
12448 if (properties_element == EL_BD_PNEUMATIC_HAMMER && num_element_counters > 0)
12449 counterbutton_info[counter_id].y += 1;
12451 counterbutton_info[counter_id].value = elements_with_counter[i].value;
12452 counterbutton_info[counter_id].text_right = elements_with_counter[i].text;
12453 counterbutton_info[counter_id].min_value = elements_with_counter[i].min_value;
12454 counterbutton_info[counter_id].max_value = elements_with_counter[i].max_value;
12456 // default: counter values between 0 and 999
12457 if (counterbutton_info[counter_id].max_value == 0)
12458 counterbutton_info[counter_id].max_value = 999;
12460 MapCounterButtons(counter_id);
12462 num_element_counters++;
12463 if (num_element_counters >= max_num_element_counters)
12467 if (properties_element == EL_BD_MAGIC_WALL && level.game_engine_type == GAME_ENGINE_TYPE_BD)
12469 // draw stickybutton gadget
12470 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
12472 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE);
12473 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING);
12474 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA);
12475 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_BREAK_SCAN);
12477 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO);
12478 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO);
12479 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO);
12480 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO);
12481 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO);
12482 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO);
12483 MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO);
12486 if (HAS_EDITOR_CONTENT(properties_element))
12488 // draw stickybutton gadget
12489 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
12491 if (properties_element == EL_BD_AMOEBA && level.game_engine_type == GAME_ENGINE_TYPE_BD)
12493 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING);
12494 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_AMOEBA_START_IMMEDIATELY);
12496 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_CONTENT_TOO_BIG);
12497 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_CONTENT_ENCLOSED);
12499 else if (properties_element == EL_BD_AMOEBA_2)
12501 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING);
12502 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_AMOEBA_START_IMMEDIATELY);
12503 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_AMOEBA_2_EXPLODE_BY_AMOEBA);
12505 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_TOO_BIG);
12506 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_ENCLOSED);
12507 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_EXPLODING);
12508 MapDrawingArea(ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE);
12510 else if (IS_AMOEBOID(properties_element))
12512 MapDrawingArea(ED_DRAWING_ID_AMOEBA_CONTENT);
12514 else if (properties_element == EL_BD_ACID)
12516 MapDrawingArea(ED_DRAWING_ID_BD_ACID_EATS_ELEMENT);
12517 MapDrawingArea(ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT);
12519 else if (IS_BD_BITER(properties_element))
12521 MapDrawingArea(ED_DRAWING_ID_BD_BITER_EATS_ELEMENT);
12523 else if (properties_element == EL_BD_BLADDER)
12525 MapDrawingArea(ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT);
12527 else if (properties_element == EL_YAMYAM ||
12528 properties_element == EL_YAMYAM_LEFT ||
12529 properties_element == EL_YAMYAM_RIGHT ||
12530 properties_element == EL_YAMYAM_UP ||
12531 properties_element == EL_YAMYAM_DOWN)
12533 DrawYamYamContentAreas();
12535 else if (properties_element == EL_EMC_MAGIC_BALL)
12537 DrawMagicBallContentAreas();
12539 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT);
12540 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_INITIAL_BALL_ACTIVE);
12542 else if (properties_element == EL_EMC_ANDROID)
12544 DrawAndroidElementArea();
12546 else if (properties_element == EL_MM_GRAY_BALL)
12548 MapCounterButtons(ED_COUNTER_ID_MM_BALL_CONTENT);
12549 MapSelectboxGadget(ED_SELECTBOX_ID_MM_BALL_CHOICE_MODE);
12550 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_ROTATE_MM_BALL_CONTENT);
12551 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EXPLODE_MM_BALL);
12553 DrawMMBallContentArea();
12557 if (IS_PLAYER_ELEMENT(properties_element))
12559 int player_nr = GET_PLAYER_NR(properties_element);
12561 // these properties can be set for every player individually
12563 if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_1)
12565 drawingarea_info[ED_DRAWING_ID_START_ELEMENT].value =
12566 &level.start_element[player_nr];
12567 drawingarea_info[ED_DRAWING_ID_ARTWORK_ELEMENT].value =
12568 &level.artwork_element[player_nr];
12569 drawingarea_info[ED_DRAWING_ID_EXPLOSION_ELEMENT].value =
12570 &level.explosion_element[player_nr];
12572 checkbutton_info[ED_CHECKBUTTON_ID_USE_START_ELEMENT].value =
12573 &level.use_start_element[player_nr];
12574 checkbutton_info[ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT].value =
12575 &level.use_artwork_element[player_nr];
12576 checkbutton_info[ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT].value =
12577 &level.use_explosion_element[player_nr];
12578 checkbutton_info[ED_CHECKBUTTON_ID_INITIAL_GRAVITY].value =
12579 &level.initial_player_gravity[player_nr];
12581 selectbox_info[ED_SELECTBOX_ID_PLAYER_SPEED].value =
12582 &level.initial_player_stepsize[player_nr];
12584 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID);
12585 MapCheckbuttonGadget(properties_element == EL_SP_MURPHY ?
12586 ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD :
12587 ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD);
12588 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD);
12589 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING);
12590 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_INSTANT_RELOCATION);
12591 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SHIFTED_RELOCATION);
12592 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_LAZY_RELOCATION);
12593 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_START_ELEMENT);
12594 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT);
12595 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT);
12596 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_INITIAL_GRAVITY);
12597 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE);
12598 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SOLVED_BY_ONE_PLAYER);
12600 MapDrawingArea(ED_DRAWING_ID_START_ELEMENT);
12601 MapDrawingArea(ED_DRAWING_ID_ARTWORK_ELEMENT);
12602 MapDrawingArea(ED_DRAWING_ID_EXPLOSION_ELEMENT);
12604 MapSelectboxGadget(ED_SELECTBOX_ID_PLAYER_SPEED);
12606 else if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2)
12608 drawingarea_info[ED_DRAWING_ID_INVENTORY_CONTENT].value =
12609 &level.initial_inventory_content[player_nr][0];
12611 counterbutton_info[ED_COUNTER_ID_INVENTORY_SIZE].value =
12612 &level.initial_inventory_size[player_nr];
12614 checkbutton_info[ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY].value =
12615 &level.use_initial_inventory[player_nr];
12617 // draw checkbutton gadgets
12618 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY);
12619 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_FINISH_DIG_COLLECT);
12620 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_KEEP_WALKABLE_CE);
12622 // draw counter gadgets
12623 MapCounterButtons(ED_COUNTER_ID_INVENTORY_SIZE);
12625 // draw drawing area gadgets
12626 DrawPlayerInitialInventoryArea(properties_element);
12630 if (IS_BD_PLAYER_ELEMENT(properties_element))
12632 counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB].y =
12633 ED_ELEMENT_SETTINGS_YPOS(2);
12634 counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET].y =
12635 ED_ELEMENT_SETTINGS_YPOS(3);
12636 checkbutton_info[ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET].y =
12637 ED_ELEMENT_SETTINGS_YPOS(4);
12639 // draw checkbutton gadgets
12640 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS);
12641 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE);
12642 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET);
12644 // draw counter gadgets
12645 MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB);
12646 MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET);
12648 // draw drawing area gadgets
12649 MapDrawingArea(ED_DRAWING_ID_BD_SNAP_ELEMENT);
12652 if (properties_element == EL_BD_SAND)
12654 MapDrawingArea(ED_DRAWING_ID_BD_SAND_LOOKS_LIKE);
12657 if (properties_element == EL_BD_ROCK && level.game_engine_type == GAME_ENGINE_TYPE_BD)
12659 counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB].y =
12660 ED_ELEMENT_SETTINGS_YPOS(0);
12661 counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET].y =
12662 ED_ELEMENT_SETTINGS_YPOS(1);
12664 MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB);
12665 MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET);
12667 MapDrawingArea(ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING);
12668 MapDrawingArea(ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT);
12671 if (properties_element == EL_BD_DIAMOND && level.game_engine_type == GAME_ENGINE_TYPE_BD)
12673 MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING);
12674 MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT);
12677 if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
12679 if (IS_BD_FIREFLY(properties_element))
12681 MapDrawingArea(ED_DRAWING_ID_BD_FIREFLY_EXPLODES_TO);
12682 MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO);
12684 else if (IS_BD_FIREFLY_2(properties_element))
12686 MapDrawingArea(ED_DRAWING_ID_BD_FIREFLY_2_EXPLODES_TO);
12687 MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO);
12689 else if (IS_BD_BUTTERFLY(properties_element))
12691 MapDrawingArea(ED_DRAWING_ID_BD_BUTTERFLY_EXPLODES_TO);
12692 MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO);
12694 else if (IS_BD_BUTTERFLY_2(properties_element))
12696 MapDrawingArea(ED_DRAWING_ID_BD_BUTTERFLY_2_EXPLODES_TO);
12697 MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO);
12699 else if (IS_BD_STONEFLY(properties_element))
12701 MapDrawingArea(ED_DRAWING_ID_BD_STONEFLY_EXPLODES_TO);
12703 else if (IS_BD_DRAGONFLY(properties_element))
12705 MapDrawingArea(ED_DRAWING_ID_BD_DRAGONFLY_EXPLODES_TO);
12706 MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO);
12708 else if (properties_element == EL_BD_BOMB)
12710 MapDrawingArea(ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO);
12712 else if (properties_element == EL_BD_NITRO_PACK)
12714 MapDrawingArea(ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO);
12718 if (properties_element == EL_BD_MEGA_ROCK ||
12719 properties_element == EL_BD_SWEET)
12721 counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET].y =
12722 ED_ELEMENT_SETTINGS_YPOS(0);
12723 checkbutton_info[ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET].y =
12724 ED_ELEMENT_SETTINGS_YPOS(1);
12726 MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET);
12727 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET);
12730 if (properties_element == EL_BD_VOODOO_DOLL)
12732 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_COLLECTS_DIAMONDS);
12733 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_HURT_KILLS_PLAYER);
12734 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK);
12735 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION);
12738 if (properties_element == EL_BD_SLIME)
12740 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE);
12742 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_1);
12743 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1);
12744 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2);
12745 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2);
12746 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3);
12747 MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3);
12750 if (IS_BD_EXPANDABLE_WALL(properties_element) ||
12751 IS_BD_EXPANDABLE_STEELWALL(properties_element))
12753 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL);
12755 if (IS_BD_EXPANDABLE_WALL(properties_element))
12756 MapDrawingArea(ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE);
12759 if (properties_element == EL_BD_REPLICATOR)
12761 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE);
12764 if (IS_BD_CONVEYOR_BELT(properties_element) ||
12765 IS_BD_CONVEYOR_BELT_SWITCH(properties_element))
12767 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE);
12768 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED);
12771 if (properties_element == EL_BD_WATER)
12773 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN);
12776 if (properties_element == EL_BD_PNEUMATIC_HAMMER)
12778 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR);
12781 if (properties_element == EL_BD_ROCKET_LAUNCHER)
12783 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_INFINITE_ROCKETS);
12786 if (properties_element == EL_BD_CREATURE_SWITCH)
12788 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS);
12789 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING);
12792 if (properties_element == EL_BD_GRAVITY_SWITCH)
12794 MapSelectboxGadget(ED_SELECTBOX_ID_BD_GRAVITY_DIRECTION);
12796 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_GRAVITY_SWITCH_ACTIVE);
12797 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_GRAVITY_AFFECTS_ALL);
12800 if (properties_element == EL_BD_NUT)
12802 MapDrawingArea(ED_DRAWING_ID_BD_NUT_CONTENT);
12805 // special case: slippery walls option for gems only available in R'n'D game engine
12806 if (IS_GEM(properties_element) && level.game_engine_type == GAME_ENGINE_TYPE_RND)
12807 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
12809 if (properties_element == EL_EM_DYNAMITE)
12810 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE);
12812 if (level.game_engine_type == GAME_ENGINE_TYPE_RND &&
12813 COULD_MOVE_INTO_ACID(properties_element) &&
12814 !IS_PLAYER_ELEMENT(properties_element) &&
12815 (!IS_CUSTOM_ELEMENT(properties_element) ||
12816 edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2))
12818 // set position for checkbutton for "can move into acid"
12819 checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].x =
12820 ED_ELEMENT_SETTINGS_XPOS(IS_CUSTOM_ELEMENT(properties_element) ? 1 : 0);
12821 checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
12822 ED_ELEMENT_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 7 :
12823 IS_BALLOON_ELEMENT(properties_element) ||
12824 HAS_EDITOR_CONTENT(properties_element) ? 1 : 0);
12826 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID);
12829 if (MAYBE_DONT_COLLIDE_WITH(properties_element))
12830 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH);
12832 if (properties_element == EL_SPRING ||
12833 properties_element == EL_SPRING_LEFT ||
12834 properties_element == EL_SPRING_RIGHT)
12835 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_SPRING_BUG);
12837 if (properties_element == EL_TIME_ORB_FULL)
12838 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG);
12840 if (properties_element == EL_GAME_OF_LIFE ||
12841 properties_element == EL_BIOMAZE)
12842 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_LIFE_BUGS);
12844 if (CAN_GROW(properties_element) && level.game_engine_type != GAME_ENGINE_TYPE_BD)
12846 checkbutton_info[ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE].y =
12847 ED_ELEMENT_SETTINGS_YPOS(HAS_EDITOR_CONTENT(properties_element) ? 1 : 0);
12849 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE);
12852 if (properties_element == EL_SOKOBAN_FIELD_EMPTY)
12853 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SB_FIELDS_NEEDED);
12855 if (properties_element == EL_SOKOBAN_OBJECT)
12856 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SB_OBJECTS_NEEDED);
12858 if (properties_element == EL_SOKOBAN_OBJECT ||
12859 properties_element == EL_SOKOBAN_FIELD_EMPTY ||
12860 properties_element == EL_SOKOBAN_FIELD_FULL)
12862 checkbutton_info[ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN].y =
12863 ED_ELEMENT_SETTINGS_XPOS(properties_element == EL_SOKOBAN_FIELD_FULL ?
12866 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN);
12869 if (IS_BALLOON_ELEMENT(properties_element))
12870 MapSelectboxGadget(ED_SELECTBOX_ID_WIND_DIRECTION);
12872 if (IS_ENVELOPE(properties_element) ||
12873 IS_MM_ENVELOPE(properties_element))
12875 int counter1_id = ED_COUNTER_ID_ENVELOPE_XSIZE;
12876 int counter2_id = ED_COUNTER_ID_ENVELOPE_YSIZE;
12877 int button1_id = ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP;
12878 int button2_id = ED_CHECKBUTTON_ID_ENVELOPE_CENTERED;
12879 int envelope_nr = ENVELOPE_NR(properties_element);
12881 counterbutton_info[counter1_id].value = &level.envelope[envelope_nr].xsize;
12882 counterbutton_info[counter2_id].value = &level.envelope[envelope_nr].ysize;
12884 checkbutton_info[button1_id].value = &level.envelope[envelope_nr].autowrap;
12885 checkbutton_info[button2_id].value = &level.envelope[envelope_nr].centered;
12887 // display counter to choose size of envelope text area
12888 MapCounterButtons(counter1_id);
12889 MapCounterButtons(counter2_id);
12891 // display checkbuttons to choose auto-wrap and alignment properties
12892 MapCheckbuttonGadget(button1_id);
12893 MapCheckbuttonGadget(button2_id);
12895 DrawEnvelopeTextArea(envelope_nr);
12898 if (IS_MM_MCDUFFIN(properties_element))
12900 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_MM_LASER_RED);
12901 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_MM_LASER_GREEN);
12902 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_MM_LASER_BLUE);
12905 if (IS_DF_LASER(properties_element))
12907 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DF_LASER_RED);
12908 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DF_LASER_GREEN);
12909 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DF_LASER_BLUE);
12912 if (IS_CUSTOM_ELEMENT(properties_element))
12914 // draw stickybutton gadget
12915 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
12917 if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_1)
12919 // draw checkbutton gadgets
12920 for (i = ED_CHECKBUTTON_ID_CUSTOM1_FIRST;
12921 i <= ED_CHECKBUTTON_ID_CUSTOM1_LAST; i++)
12922 MapCheckbuttonGadget(i);
12924 // draw counter gadgets
12925 for (i = ED_COUNTER_ID_CUSTOM1_FIRST;
12926 i <= ED_COUNTER_ID_CUSTOM1_LAST; i++)
12927 MapCounterButtons(i);
12929 // draw selectbox gadgets
12930 for (i = ED_SELECTBOX_ID_CUSTOM1_FIRST;
12931 i <= ED_SELECTBOX_ID_CUSTOM1_LAST; i++)
12932 MapSelectboxGadget(i);
12934 // draw textbutton gadgets
12935 MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1);
12937 // draw text input gadgets
12938 MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
12940 // draw drawing area gadgets
12941 MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
12943 draw_footer_line = TRUE;
12945 else if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2)
12947 // draw checkbutton gadgets
12948 for (i = ED_CHECKBUTTON_ID_CUSTOM2_FIRST;
12949 i <= ED_CHECKBUTTON_ID_CUSTOM2_LAST; i++)
12950 MapCheckbuttonGadget(i);
12952 // draw counter gadgets
12953 for (i = ED_COUNTER_ID_CUSTOM2_FIRST;
12954 i <= ED_COUNTER_ID_CUSTOM2_LAST; i++)
12955 MapCounterButtons(i);
12957 // draw selectbox gadgets
12958 for (i = ED_SELECTBOX_ID_CUSTOM2_FIRST;
12959 i <= ED_SELECTBOX_ID_CUSTOM2_LAST; i++)
12960 MapSelectboxGadget(i);
12962 // draw drawing area gadgets
12963 MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_ENTER);
12964 MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_LEAVE);
12965 DrawCustomContentArea();
12968 else if (IS_GROUP_ELEMENT(properties_element))
12970 // draw stickybutton gadget
12971 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
12973 // draw checkbutton gadgets
12974 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC);
12975 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1);
12977 // draw counter gadgets
12978 MapCounterButtons(ED_COUNTER_ID_GROUP_CONTENT);
12980 // draw selectbox gadgets
12981 MapSelectboxGadget(ED_SELECTBOX_ID_GROUP_CHOICE_MODE);
12983 // draw textbutton gadgets
12984 MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1);
12986 // draw drawing area gadgets
12987 DrawGroupElementArea();
12989 // draw text input gadgets
12990 MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
12992 // draw drawing area gadgets
12993 MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
12995 draw_footer_line = TRUE;
12997 else if (IS_EMPTY_ELEMENT(properties_element))
12999 // draw stickybutton gadget
13000 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
13002 // draw checkbutton gadgets
13003 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC);
13004 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1);
13006 // draw textbutton gadgets
13007 MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1);
13009 // draw drawing area gadgets
13010 MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
13012 draw_footer_line = TRUE;
13015 // draw little footer border line above CE/GE use/save template gadgets
13016 if (draw_footer_line)
13018 struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
13019 struct GadgetDesign *gd = &gd_gi1->alt_design[GD_BUTTON_UNPRESSED];
13020 int gd_x = gd->x + gd_gi1->border.width / 2;
13021 int gd_y = gd->y + gd_gi1->height - 1;
13022 Pixel tab_color = GetPixel(gd->bitmap, gd_x, gd_y);
13024 if (tab_color != BLACK_PIXEL) // black => transparent
13025 FillRectangle(drawto,
13026 SX + ED_ELEMENT_SETTINGS_X(0),
13027 SY + ED_ELEMENT_SETTINGS_Y(14) - ED_SETTINGS_TABS_YOFFSET -
13029 getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
13033 static void DrawPropertiesChangeDrawingAreas(void)
13035 if (IS_CUSTOM_ELEMENT(properties_element))
13037 MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
13038 MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
13039 MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_ACTION);
13041 DrawCustomChangeContentArea();
13044 redraw_mask |= REDRAW_FIELD;
13047 static void DrawPropertiesChange(void)
13051 // needed to initially set selectbox options for special action options
13052 setSelectboxSpecialActionOptions();
13054 // draw stickybutton gadget
13055 MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
13057 // draw checkbutton gadgets
13058 for (i = ED_CHECKBUTTON_ID_CHANGE_FIRST;
13059 i <= ED_CHECKBUTTON_ID_CHANGE_LAST; i++)
13060 MapCheckbuttonGadget(i);
13062 // draw counter gadgets
13063 for (i = ED_COUNTER_ID_CHANGE_FIRST;
13064 i <= ED_COUNTER_ID_CHANGE_LAST; i++)
13065 MapCounterButtons(i);
13067 // draw selectbox gadgets
13068 for (i = ED_SELECTBOX_ID_CHANGE_FIRST;
13069 i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
13070 MapSelectboxGadget(i);
13072 // draw textbutton gadgets
13073 for (i = ED_TEXTBUTTON_ID_CHANGE_FIRST;
13074 i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
13075 MapTextbuttonGadget(i);
13077 // draw graphicbutton gadgets
13078 for (i = ED_GRAPHICBUTTON_ID_CHANGE_FIRST;
13079 i <= ED_GRAPHICBUTTON_ID_CHANGE_LAST; i++)
13080 MapGraphicbuttonGadget(i);
13082 // draw drawing area gadgets
13083 DrawPropertiesChangeDrawingAreas();
13086 static void DrawEditorElementAnimation(int x, int y)
13091 getEditorGraphicAndFrame(properties_element, &graphic, &frame, FALSE);
13093 DrawFixedGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
13096 static void DrawEditorElementName(int x, int y, int font_nr)
13098 char *element_name = getElementInfoText(properties_element);
13099 int font_width = getFontWidth(font_nr);
13100 int font_height = getFontHeight(font_nr);
13101 int max_text_width = SXSIZE - x - ED_ELEMENT_SETTINGS_X(0);
13102 int max_chars_per_line = max_text_width / font_width;
13104 if (strlen(element_name) <= max_chars_per_line)
13105 DrawTextS(x, y, font_nr, element_name);
13108 char buffer[max_chars_per_line + 1];
13109 int next_pos = max_chars_per_line;
13111 strncpy(buffer, element_name, max_chars_per_line);
13112 buffer[max_chars_per_line] = '\0';
13114 if (element_name[max_chars_per_line] == ' ')
13120 for (i = max_chars_per_line - 1; i >= 0; i--)
13121 if (buffer[i] == ' ')
13124 if (strlen(&element_name[i + 1]) <= max_chars_per_line)
13131 DrawTextS(x, y - font_height / 2, font_nr, buffer);
13133 strncpy(buffer, &element_name[next_pos], max_chars_per_line);
13134 buffer[max_chars_per_line] = '\0';
13136 DrawTextS(x, y + font_height / 2, font_nr, buffer);
13140 static void DrawPropertiesWindow(void)
13142 struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_INPUT_TEXT];
13143 int element_border = graphic_info[IMG_EDITOR_ELEMENT_BORDER].border_size;
13144 int border_size = gd->border_size;
13145 int font_nr = FONT_TEXT_1;
13146 int font_height = getFontHeight(font_nr);
13147 int xoffset = TILEX + element_border + 3 * border_size;
13148 int yoffset = (TILEY - font_height) / 2;
13149 int x1 = editor.settings.element_graphic.x + element_border;
13150 int y1 = editor.settings.element_graphic.y + element_border;
13151 int x2 = (editor.settings.element_name.x == -1 ? x1 + xoffset :
13152 editor.settings.element_name.x);
13153 int y2 = (editor.settings.element_name.y == -1 ? y1 + yoffset :
13154 editor.settings.element_name.y);
13155 char *text = "Element Settings";
13156 int font2_nr = FONT_TITLE_1;
13157 struct MenuPosInfo *pos = &editor.settings.headline;
13158 int sx = SX + ALIGNED_XPOS(pos->x, getTextWidth(text, font2_nr), pos->align);
13159 int sy = SY + pos->y;
13161 stick_element_properties_window = FALSE;
13163 // make sure that previous properties edit mode exists for this element
13164 if (edit_mode_properties > ED_MODE_PROPERTIES_CONFIG_2 &&
13165 !IS_CUSTOM_ELEMENT(properties_element))
13166 edit_mode_properties = ED_MODE_PROPERTIES_CONFIG_2;
13168 if (edit_mode_properties > ED_MODE_PROPERTIES_CONFIG &&
13169 !IS_PLAYER_ELEMENT(properties_element) &&
13170 !IS_CUSTOM_ELEMENT(properties_element))
13171 edit_mode_properties = ED_MODE_PROPERTIES_CONFIG;
13173 if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG &&
13174 (IS_PLAYER_ELEMENT(properties_element) ||
13175 IS_CUSTOM_ELEMENT(properties_element)))
13176 edit_mode_properties = ED_MODE_PROPERTIES_CONFIG_1;
13178 CopyElementPropertiesToEditor(properties_element);
13180 UnmapLevelEditorFieldGadgets();
13181 UnmapLevelEditorToolboxDrawingGadgets();
13182 UnmapLevelEditorToolboxCustomGadgets();
13184 MapLevelEditorToolboxCustomGadgetsIfNeeded();
13186 SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
13189 DrawText(sx, sy, text, font2_nr);
13191 FrameCounter = 0; // restart animation frame counter
13193 DrawElementBorder(SX + x1, SY + y1, TILEX, TILEY, FALSE);
13194 DrawEditorElementAnimation(SX + x1, SY + y1);
13195 DrawEditorElementName(x2, y2, font_nr);
13197 DrawPropertiesTabulatorGadgets();
13199 if (edit_mode_properties == ED_MODE_PROPERTIES_INFO)
13200 DrawPropertiesInfo();
13201 else if (edit_mode_properties == ED_MODE_PROPERTIES_CHANGE)
13202 DrawPropertiesChange();
13203 else // (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG[_1|_2])
13204 DrawPropertiesConfig();
13207 static void DrawPaletteWindow(void)
13211 UnmapLevelEditorFieldGadgets();
13213 SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
13216 // map buttons to select elements
13217 for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
13218 MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
13219 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
13220 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_UP]);
13221 MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_DOWN]);
13224 static void UpdateCustomElementGraphicGadgets(void)
13228 InitElementPropertiesGfxElement();
13230 ModifyEditorElementList();
13231 RedrawDrawingElements();
13233 // force redraw of all mapped drawing area gadgets
13234 for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
13236 struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[i].gadget_id];
13243 static int getOpenDirectionFromTube(int element)
13247 case EL_TUBE_LEFT_UP: return (MV_LEFT | MV_UP);
13248 case EL_TUBE_LEFT_DOWN: return (MV_LEFT | MV_DOWN);
13249 case EL_TUBE_RIGHT_UP: return (MV_RIGHT | MV_UP);
13250 case EL_TUBE_RIGHT_DOWN: return (MV_RIGHT | MV_DOWN);
13251 case EL_TUBE_HORIZONTAL: return (MV_HORIZONTAL);
13252 case EL_TUBE_HORIZONTAL_UP: return (MV_HORIZONTAL | MV_UP);
13253 case EL_TUBE_HORIZONTAL_DOWN: return (MV_HORIZONTAL | MV_DOWN);
13254 case EL_TUBE_VERTICAL: return (MV_VERTICAL);
13255 case EL_TUBE_VERTICAL_LEFT: return (MV_VERTICAL | MV_LEFT);
13256 case EL_TUBE_VERTICAL_RIGHT: return (MV_VERTICAL | MV_RIGHT);
13257 case EL_TUBE_ANY: return (MV_ANY_DIRECTION);
13263 static int getTubeFromOpenDirection(int direction)
13267 case (MV_LEFT | MV_UP): return EL_TUBE_LEFT_UP;
13268 case (MV_LEFT | MV_DOWN): return EL_TUBE_LEFT_DOWN;
13269 case (MV_RIGHT | MV_UP): return EL_TUBE_RIGHT_UP;
13270 case (MV_RIGHT | MV_DOWN): return EL_TUBE_RIGHT_DOWN;
13271 case (MV_HORIZONTAL): return EL_TUBE_HORIZONTAL;
13272 case (MV_HORIZONTAL | MV_UP): return EL_TUBE_HORIZONTAL_UP;
13273 case (MV_HORIZONTAL | MV_DOWN): return EL_TUBE_HORIZONTAL_DOWN;
13274 case (MV_VERTICAL): return EL_TUBE_VERTICAL;
13275 case (MV_VERTICAL | MV_LEFT): return EL_TUBE_VERTICAL_LEFT;
13276 case (MV_VERTICAL | MV_RIGHT): return EL_TUBE_VERTICAL_RIGHT;
13277 case (MV_ANY_DIRECTION): return EL_TUBE_ANY;
13279 // if only one direction, fall back to simple tube with that direction
13280 case (MV_LEFT): return EL_TUBE_HORIZONTAL;
13281 case (MV_RIGHT): return EL_TUBE_HORIZONTAL;
13282 case (MV_UP): return EL_TUBE_VERTICAL;
13283 case (MV_DOWN): return EL_TUBE_VERTICAL;
13289 static int getTubeFromOpenDirectionNotEmpty(int direction, int element_old)
13291 int element_new = getTubeFromOpenDirection(direction);
13293 return (element_new != EL_EMPTY ? element_new : element_old);
13296 static int getOpenDirectionFromBelt(int element)
13298 int belt_dir = getBeltDirFromBeltElement(element);
13300 return (belt_dir == MV_LEFT ? MV_RIGHT :
13301 belt_dir == MV_RIGHT ? MV_LEFT :
13302 belt_dir == MV_NONE ? MV_HORIZONTAL : belt_dir);
13305 static int getBeltFromNrAndOpenDirection(int nr, int direction)
13307 int belt_dir = (direction == MV_LEFT ? MV_RIGHT :
13308 direction == MV_RIGHT ? MV_LEFT :
13309 direction == MV_HORIZONTAL ? MV_NONE : direction);
13311 if (direction == MV_NONE)
13314 return getBeltElementFromBeltNrAndBeltDir(nr, belt_dir);
13317 static int getBeltFromNrAndOpenDirectionNotEmpty(int nr, int direction,
13320 int element_new = getBeltFromNrAndOpenDirection(nr, direction);
13322 return (element_new != EL_EMPTY ? element_new : element_old);
13325 static int getOpenDirectionFromPool(int element)
13329 case EL_ACID_POOL_TOPLEFT: return (MV_DOWN | MV_RIGHT);
13330 case EL_ACID_POOL_TOPRIGHT: return (MV_DOWN | MV_LEFT);
13331 case EL_ACID_POOL_BOTTOMLEFT: return (MV_UP | MV_RIGHT);
13332 case EL_ACID_POOL_BOTTOMRIGHT: return (MV_UP | MV_LEFT);
13333 case EL_ACID_POOL_BOTTOM: return (MV_HORIZONTAL | MV_UP);
13334 case EL_ACID: return (MV_HORIZONTAL | MV_DOWN);
13340 static int getPoolFromOpenDirection(int direction)
13344 case (MV_DOWN | MV_RIGHT): return EL_ACID_POOL_TOPLEFT;
13345 case (MV_DOWN | MV_LEFT): return EL_ACID_POOL_TOPRIGHT;
13346 case (MV_UP | MV_RIGHT): return EL_ACID_POOL_BOTTOMLEFT;
13347 case (MV_UP | MV_LEFT): return EL_ACID_POOL_BOTTOMRIGHT;
13348 case (MV_HORIZONTAL | MV_UP): return EL_ACID_POOL_BOTTOM;
13349 case (MV_HORIZONTAL | MV_DOWN): return EL_ACID;
13355 static int getPoolFromOpenDirectionExt(int direction, int help_element)
13357 int element = getPoolFromOpenDirection(direction);
13358 int help_direction = getOpenDirectionFromPool(help_element);
13360 if (element == EL_EMPTY)
13362 int help_direction_vertical = help_direction & MV_VERTICAL;
13364 element = getPoolFromOpenDirection(direction | help_direction_vertical);
13367 if (element == EL_EMPTY)
13369 int help_direction_horizontal = help_direction & MV_HORIZONTAL;
13371 element = getPoolFromOpenDirection(direction | help_direction_horizontal);
13377 static int getPoolFromOpenDirectionNotEmpty(int direction, int element_old)
13379 int element_new = getPoolFromOpenDirectionExt(direction, element_old);
13381 return (element_new != EL_EMPTY ? element_new : element_old);
13384 static int getOpenDirectionFromPillar(int element)
13388 case EL_EMC_WALL_1: return (MV_DOWN);
13389 case EL_EMC_WALL_2: return (MV_VERTICAL);
13390 case EL_EMC_WALL_3: return (MV_UP);
13396 static int getPillarFromOpenDirection(int direction)
13400 case (MV_DOWN): return EL_EMC_WALL_1;
13401 case (MV_VERTICAL): return EL_EMC_WALL_2;
13402 case (MV_UP): return EL_EMC_WALL_3;
13408 static int getPillarFromOpenDirectionNotEmpty(int direction, int element_old)
13410 int element_new = getPillarFromOpenDirection(direction);
13412 return (element_new != EL_EMPTY ? element_new : element_old);
13415 static int getOpenDirectionFromSteel2(int element)
13419 case EL_DC_STEELWALL_2_LEFT: return (MV_RIGHT);
13420 case EL_DC_STEELWALL_2_RIGHT: return (MV_LEFT);
13421 case EL_DC_STEELWALL_2_TOP: return (MV_DOWN);
13422 case EL_DC_STEELWALL_2_BOTTOM: return (MV_UP);
13423 case EL_DC_STEELWALL_2_HORIZONTAL: return (MV_HORIZONTAL);
13424 case EL_DC_STEELWALL_2_VERTICAL: return (MV_VERTICAL);
13425 case EL_DC_STEELWALL_2_MIDDLE: return (MV_ANY_DIRECTION);
13426 case EL_DC_STEELWALL_2_SINGLE: return (MV_NONE);
13432 static int getSteel2FromOpenDirection(int direction)
13436 case (MV_RIGHT): return EL_DC_STEELWALL_2_LEFT;
13437 case (MV_LEFT): return EL_DC_STEELWALL_2_RIGHT;
13438 case (MV_DOWN): return EL_DC_STEELWALL_2_TOP;
13439 case (MV_UP): return EL_DC_STEELWALL_2_BOTTOM;
13440 case (MV_HORIZONTAL): return EL_DC_STEELWALL_2_HORIZONTAL;
13441 case (MV_VERTICAL): return EL_DC_STEELWALL_2_VERTICAL;
13442 case (MV_ANY_DIRECTION): return EL_DC_STEELWALL_2_MIDDLE;
13443 case (MV_NONE): return EL_DC_STEELWALL_2_SINGLE;
13449 static int getSteel2FromOpenDirectionNotEmpty(int direction, int element_old)
13451 int element_new = getSteel2FromOpenDirection(direction);
13453 return (element_new != EL_EMPTY ? element_new : element_old);
13456 static int getOpenDirectionFromChip(int element)
13460 case EL_SP_CHIP_SINGLE: return (MV_NONE);
13461 case EL_SP_CHIP_LEFT: return (MV_RIGHT);
13462 case EL_SP_CHIP_RIGHT: return (MV_LEFT);
13463 case EL_SP_CHIP_TOP: return (MV_DOWN);
13464 case EL_SP_CHIP_BOTTOM: return (MV_UP);
13470 static int getChipFromOpenDirection(int direction)
13474 case (MV_NONE): return EL_SP_CHIP_SINGLE;
13475 case (MV_LEFT): return EL_SP_CHIP_RIGHT;
13476 case (MV_RIGHT): return EL_SP_CHIP_LEFT;
13477 case (MV_UP): return EL_SP_CHIP_BOTTOM;
13478 case (MV_DOWN): return EL_SP_CHIP_TOP;
13484 static int getChipFromOpenDirectionNotEmpty(int direction, int element_old)
13486 int element_new = getChipFromOpenDirection(direction);
13488 return (element_new != EL_EMPTY ? element_new : element_old);
13491 static int getClosedTube(int x, int y)
13493 struct XY *xy = xy_directions;
13494 int element_old = IntelliDrawBuffer[x][y];
13495 int direction_old = getOpenDirectionFromTube(element_old);
13496 int direction_new = MV_NONE;
13499 for (i = 0; i < NUM_DIRECTIONS; i++)
13501 int xx = x + xy[i].x;
13502 int yy = y + xy[i].y;
13503 int dir = MV_DIR_FROM_BIT(i);
13504 int dir_opposite = MV_DIR_OPPOSITE(dir);
13506 if (IN_LEV_FIELD(xx, yy) && IS_TUBE(IntelliDrawBuffer[xx][yy]) &&
13507 (direction_old & dir) &&
13508 (getOpenDirectionFromTube(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13509 direction_new |= dir;
13512 return getTubeFromOpenDirectionNotEmpty(direction_new, element_old);
13515 static int getClosedBelt(int x, int y)
13517 struct XY *xy = xy_directions;
13518 int element_old = IntelliDrawBuffer[x][y];
13519 int nr = getBeltNrFromBeltElement(element_old);
13520 int direction_old = getOpenDirectionFromBelt(element_old);
13521 int direction_new = MV_NONE;
13524 for (i = MV_BIT_LEFT; i <= MV_BIT_RIGHT; i++)
13526 int xx = x + xy[i].x;
13527 int yy = y + xy[i].y;
13528 int dir = MV_DIR_FROM_BIT(i);
13529 int dir_opposite = MV_DIR_OPPOSITE(dir);
13531 if (IN_LEV_FIELD(xx, yy) && IS_BELT(IntelliDrawBuffer[xx][yy]) &&
13532 (direction_old & dir) &&
13533 (getOpenDirectionFromBelt(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13534 direction_new |= dir;
13537 return getBeltFromNrAndOpenDirection(nr, direction_new);
13540 static int getClosedPool(int x, int y)
13542 struct XY *xy = xy_directions;
13543 int element_old = IntelliDrawBuffer[x][y];
13544 int direction_old = getOpenDirectionFromPool(element_old);
13545 int direction_new = MV_NONE;
13548 for (i = 0; i < NUM_DIRECTIONS; i++)
13550 int xx = x + xy[i].x;
13551 int yy = y + xy[i].y;
13552 int dir = MV_DIR_FROM_BIT(i);
13553 int dir_opposite = MV_DIR_OPPOSITE(dir);
13555 if (IN_LEV_FIELD(xx, yy) &&
13556 IS_ACID_POOL_OR_ACID(IntelliDrawBuffer[xx][yy]) &&
13557 (direction_old & dir) &&
13558 (getOpenDirectionFromPool(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13559 direction_new |= dir;
13562 return getPoolFromOpenDirectionNotEmpty(direction_new, element_old);
13565 static int getClosedPillar(int x, int y)
13567 struct XY *xy = xy_directions;
13568 int element_old = IntelliDrawBuffer[x][y];
13569 int direction_old = getOpenDirectionFromPillar(element_old);
13570 int direction_new = MV_NONE;
13573 for (i = MV_BIT_UP; i <= MV_BIT_DOWN; i++)
13575 int xx = x + xy[i].x;
13576 int yy = y + xy[i].y;
13577 int dir = MV_DIR_FROM_BIT(i);
13578 int dir_opposite = MV_DIR_OPPOSITE(dir);
13580 if (IN_LEV_FIELD(xx, yy) && IS_EMC_PILLAR(IntelliDrawBuffer[xx][yy]) &&
13581 (direction_old & dir) &&
13582 (getOpenDirectionFromPillar(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13583 direction_new |= dir;
13586 return getPillarFromOpenDirectionNotEmpty(direction_new, element_old);
13589 static int getClosedSteel2(int x, int y)
13591 struct XY *xy = xy_directions;
13592 int element_old = IntelliDrawBuffer[x][y];
13593 int direction_old = getOpenDirectionFromSteel2(element_old);
13594 int direction_new = MV_NONE;
13597 for (i = 0; i < NUM_DIRECTIONS; i++)
13599 int xx = x + xy[i].x;
13600 int yy = y + xy[i].y;
13601 int dir = MV_DIR_FROM_BIT(i);
13602 int dir_opposite = MV_DIR_OPPOSITE(dir);
13604 if (IN_LEV_FIELD(xx, yy) && IS_DC_STEELWALL_2(IntelliDrawBuffer[xx][yy]) &&
13605 (direction_old & dir) &&
13606 (getOpenDirectionFromSteel2(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13607 direction_new |= dir;
13610 return getSteel2FromOpenDirectionNotEmpty(direction_new, element_old);
13613 static int getClosedChip(int x, int y)
13615 struct XY *xy = xy_directions;
13616 int element_old = IntelliDrawBuffer[x][y];
13617 int direction_old = getOpenDirectionFromChip(element_old);
13618 int direction_new = MV_NONE;
13621 for (i = 0; i < NUM_DIRECTIONS; i++)
13623 int xx = x + xy[i].x;
13624 int yy = y + xy[i].y;
13625 int dir = MV_DIR_FROM_BIT(i);
13626 int dir_opposite = MV_DIR_OPPOSITE(dir);
13628 if (IN_LEV_FIELD(xx, yy) && IS_SP_CHIP(IntelliDrawBuffer[xx][yy]) &&
13629 (direction_old & dir) &&
13630 (getOpenDirectionFromChip(IntelliDrawBuffer[xx][yy]) & dir_opposite))
13631 direction_new |= dir;
13634 return getChipFromOpenDirectionNotEmpty(direction_new, element_old);
13637 static void SetElementSimpleExt(int x, int y, int dx, int dy, int element,
13638 boolean change_level)
13640 int sx = x - level_xpos;
13641 int sy = y - level_ypos;
13642 int old_element = Tile[x][y];
13643 int new_element = element;
13644 unsigned int new_bitmask = (getDrawModeHiRes() ? (dx + 1) << (dy * 2) : 0x0f);
13645 boolean draw_masked = FALSE;
13647 if (IS_MM_WALL_EDITOR(element))
13649 element = map_mm_wall_element_editor(element) | new_bitmask;
13651 if (IS_MM_WALL(old_element))
13652 element |= MM_WALL_BITS(old_element);
13655 draw_masked = TRUE;
13657 else if (IS_MM_WALL(old_element) && element == EL_EMPTY)
13659 int element_changed = old_element & ~new_bitmask;
13661 if (MM_WALL_BITS(element_changed) != 0)
13662 element = element_changed;
13665 IntelliDrawBuffer[x][y] = element;
13668 Tile[x][y] = element;
13670 if (IN_ED_FIELD(sx, sy))
13672 if (IS_MM_WALL(old_element) && new_element == EL_EMPTY)
13673 DrawSizedWallParts_MM(sx, sy, EL_EMPTY, ed_tilesize, FALSE, new_bitmask);
13674 else if (draw_masked)
13675 DrawEditorElementThruMask(sx, sy, element);
13677 DrawEditorElement(sx, sy, element);
13681 static void SetElementSimple(int x, int y, int element, boolean change_level)
13683 SetElementSimpleExt(x, y, 0, 0, element, change_level);
13686 static void MergeAndCloseNeighbourElements(int x1, int y1, int *element1,
13687 int x2, int y2, int *element2,
13688 int (*close_function)(int, int),
13689 boolean change_level)
13691 // set neighbour elements to newly determined connections
13692 SetElementSimple(x1, y1, *element1, change_level);
13693 SetElementSimple(x2, y2, *element2, change_level);
13695 // remove all open connections of neighbour elements
13696 *element1 = close_function(x1, y1);
13697 *element2 = close_function(x2, y2);
13699 // set neighbour elements to new, minimized connections
13700 SetElementSimple(x1, y1, *element1, change_level);
13701 SetElementSimple(x2, y2, *element2, change_level);
13704 static void SetElementIntelliDraw(int x, int y, int dx, int dy, int new_element,
13705 boolean change_level, int button)
13707 struct XY *xy = xy_directions;
13708 static int last_x = -1;
13709 static int last_y = -1;
13711 if (new_element == EL_UNDEFINED)
13719 int old_element = IntelliDrawBuffer[x][y];
13721 if (IS_TUBE(new_element))
13723 int last_element_new = EL_UNDEFINED;
13724 int direction = MV_NONE;
13727 // if old element is of same kind, keep all existing directions
13728 if (IS_TUBE(old_element))
13729 direction |= getOpenDirectionFromTube(old_element);
13731 for (i = 0; i < NUM_DIRECTIONS; i++)
13733 int xx = x + xy[i].x;
13734 int yy = y + xy[i].y;
13736 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13737 IS_TUBE(IntelliDrawBuffer[last_x][last_y]))
13739 int dir = MV_DIR_FROM_BIT(i);
13740 int dir_opposite = MV_DIR_OPPOSITE(dir);
13741 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13742 int last_direction_old = getOpenDirectionFromTube(last_element_old);
13743 int last_direction_new = last_direction_old | dir_opposite;
13745 last_element_new = getTubeFromOpenDirection(last_direction_new);
13751 new_element = getTubeFromOpenDirectionNotEmpty(direction, new_element);
13753 if (last_element_new != EL_UNDEFINED)
13754 MergeAndCloseNeighbourElements(x, y, &new_element,
13755 last_x, last_y, &last_element_new,
13756 getClosedTube, change_level);
13758 else if (IS_BELT(new_element))
13760 int belt_nr = getBeltNrFromBeltElement(new_element);
13761 int last_element_new = EL_UNDEFINED;
13762 int direction = MV_NONE;
13765 // if old element is of same kind, keep all existing directions
13766 if (IS_BELT(old_element))
13767 direction |= getOpenDirectionFromBelt(old_element);
13769 for (i = MV_BIT_LEFT; i <= MV_BIT_RIGHT; i++)
13771 int xx = x + xy[i].x;
13772 int yy = y + xy[i].y;
13774 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13775 IS_BELT(IntelliDrawBuffer[last_x][last_y]))
13777 int dir = MV_DIR_FROM_BIT(i);
13778 int dir_opposite = MV_DIR_OPPOSITE(dir);
13779 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13780 int last_belt_nr = getBeltNrFromBeltElement(last_element_old);
13781 int last_direction_old = getOpenDirectionFromBelt(last_element_old);
13782 int last_direction_new = last_direction_old | dir_opposite;
13784 last_element_new = getBeltFromNrAndOpenDirection(last_belt_nr,
13785 last_direction_new);
13790 new_element = getBeltFromNrAndOpenDirectionNotEmpty(belt_nr, direction,
13792 if (last_element_new != EL_UNDEFINED)
13793 MergeAndCloseNeighbourElements(x, y, &new_element,
13794 last_x, last_y, &last_element_new,
13795 getClosedBelt, change_level);
13797 else if (IS_ACID_POOL_OR_ACID(new_element))
13799 int last_element_new = EL_UNDEFINED;
13800 int direction = MV_NONE;
13803 // if old element is of same kind, keep all existing directions
13804 if (IS_ACID_POOL_OR_ACID(old_element))
13805 direction |= getOpenDirectionFromPool(old_element);
13807 for (i = 0; i < NUM_DIRECTIONS; i++)
13809 int xx = x + xy[i].x;
13810 int yy = y + xy[i].y;
13812 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13813 IS_ACID_POOL_OR_ACID(IntelliDrawBuffer[last_x][last_y]))
13815 int dir = MV_DIR_FROM_BIT(i);
13816 int dir_opposite = MV_DIR_OPPOSITE(dir);
13817 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13818 int last_direction_old = getOpenDirectionFromPool(last_element_old);
13819 int last_direction_new = last_direction_old | dir_opposite;
13821 last_element_new = getPoolFromOpenDirection(last_direction_new);
13827 // special corrections needed for intuitively correct acid pool drawing
13828 if (last_element_new == EL_EMPTY)
13829 last_element_new = new_element;
13830 else if (last_element_new != EL_UNDEFINED)
13831 new_element = last_element_new;
13833 new_element = getPoolFromOpenDirectionNotEmpty(direction, new_element);
13835 if (last_element_new != EL_UNDEFINED)
13836 MergeAndCloseNeighbourElements(x, y, &new_element,
13837 last_x, last_y, &last_element_new,
13838 getClosedPool, change_level);
13840 else if (IS_EMC_PILLAR(new_element))
13842 int last_element_new = EL_UNDEFINED;
13843 int direction = MV_NONE;
13846 // if old element is of same kind, keep all existing directions
13847 if (IS_EMC_PILLAR(old_element))
13848 direction |= getOpenDirectionFromPillar(old_element);
13850 for (i = MV_BIT_UP; i <= MV_BIT_DOWN; i++)
13852 int xx = x + xy[i].x;
13853 int yy = y + xy[i].y;
13855 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13856 IS_EMC_PILLAR(IntelliDrawBuffer[last_x][last_y]))
13858 int dir = MV_DIR_FROM_BIT(i);
13859 int dir_opposite = MV_DIR_OPPOSITE(dir);
13860 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13861 int last_direction_old = getOpenDirectionFromPillar(last_element_old);
13862 int last_direction_new = last_direction_old | dir_opposite;
13864 last_element_new = getPillarFromOpenDirection(last_direction_new);
13870 new_element = getPillarFromOpenDirectionNotEmpty(direction, new_element);
13872 if (last_element_new != EL_UNDEFINED)
13873 MergeAndCloseNeighbourElements(x, y, &new_element,
13874 last_x, last_y, &last_element_new,
13875 getClosedPillar, change_level);
13877 else if (IS_DC_STEELWALL_2(new_element))
13879 int last_element_new = EL_UNDEFINED;
13880 int direction = MV_NONE;
13883 // if old element is of same kind, keep all existing directions
13884 if (IS_DC_STEELWALL_2(old_element))
13885 direction |= getOpenDirectionFromSteel2(old_element);
13887 for (i = 0; i < NUM_DIRECTIONS; i++)
13889 int xx = x + xy[i].x;
13890 int yy = y + xy[i].y;
13892 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13893 IS_DC_STEELWALL_2(IntelliDrawBuffer[last_x][last_y]))
13895 int dir = MV_DIR_FROM_BIT(i);
13896 int dir_opposite = MV_DIR_OPPOSITE(dir);
13897 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13898 int last_direction_old = getOpenDirectionFromSteel2(last_element_old);
13899 int last_direction_new = last_direction_old | dir_opposite;
13901 last_element_new = getSteel2FromOpenDirection(last_direction_new);
13907 new_element = getSteel2FromOpenDirectionNotEmpty(direction, new_element);
13909 if (last_element_new != EL_UNDEFINED)
13910 MergeAndCloseNeighbourElements(x, y, &new_element,
13911 last_x, last_y, &last_element_new,
13912 getClosedSteel2, change_level);
13914 else if (IS_SP_CHIP(new_element))
13916 int last_element_new = EL_UNDEFINED;
13917 int direction = MV_NONE;
13920 // (do not keep existing directions, regardless of kind of old element)
13922 for (i = 0; i < NUM_DIRECTIONS; i++)
13924 int xx = x + xy[i].x;
13925 int yy = y + xy[i].y;
13927 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13928 IS_SP_CHIP(IntelliDrawBuffer[last_x][last_y]))
13930 int dir = MV_DIR_FROM_BIT(i);
13931 int dir_opposite = MV_DIR_OPPOSITE(dir);
13932 int last_element_old = IntelliDrawBuffer[last_x][last_y];
13933 int last_direction_old = getOpenDirectionFromChip(last_element_old);
13934 int last_direction_new = last_direction_old | dir_opposite;
13936 if (last_direction_old == MV_NONE)
13938 last_element_new = getChipFromOpenDirection(last_direction_new);
13941 else if (last_direction_old & (dir | dir_opposite))
13943 direction |= MV_DIR_OPPOSITE(last_direction_old);
13947 direction |= MV_DIR_OPPOSITE(dir);
13952 new_element = getChipFromOpenDirectionNotEmpty(direction, new_element);
13954 if (last_element_new != EL_UNDEFINED)
13955 MergeAndCloseNeighbourElements(x, y, &new_element,
13956 last_x, last_y, &last_element_new,
13957 getClosedChip, change_level);
13959 else if (IS_SP_HARDWARE_BASE(new_element))
13961 int nr = GetSimpleRandom(6);
13963 new_element = (nr == 0 ? EL_SP_HARDWARE_BASE_1 :
13964 nr == 1 ? EL_SP_HARDWARE_BASE_2 :
13965 nr == 2 ? EL_SP_HARDWARE_BASE_3 :
13966 nr == 3 ? EL_SP_HARDWARE_BASE_4 :
13967 nr == 4 ? EL_SP_HARDWARE_BASE_5 : EL_SP_HARDWARE_BASE_6);
13969 else if (new_element == EL_SP_HARDWARE_GREEN ||
13970 new_element == EL_SP_HARDWARE_BLUE ||
13971 new_element == EL_SP_HARDWARE_RED)
13973 int nr = GetSimpleRandom(3);
13975 new_element = (nr == 0 ? EL_SP_HARDWARE_GREEN :
13976 nr == 1 ? EL_SP_HARDWARE_BLUE : EL_SP_HARDWARE_RED);
13978 else if (IS_GROUP_ELEMENT(new_element))
13980 boolean connected_drawing = FALSE;
13983 for (i = 0; i < NUM_DIRECTIONS; i++)
13985 int xx = x + xy[i].x;
13986 int yy = y + xy[i].y;
13988 if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
13989 IS_IN_GROUP_EL(IntelliDrawBuffer[last_x][last_y], new_element))
13990 connected_drawing = TRUE;
13993 if (!connected_drawing)
13994 ResolveGroupElement(new_element);
13996 new_element = GetElementFromGroupElement(new_element);
13998 else if (IS_BELT_SWITCH(old_element))
14000 int belt_nr = getBeltNrFromBeltSwitchElement(old_element);
14001 int belt_dir = getBeltDirFromBeltSwitchElement(old_element);
14003 belt_dir = (belt_dir == MV_LEFT ? MV_NONE :
14004 belt_dir == MV_NONE ? MV_RIGHT : MV_LEFT);
14006 new_element = getBeltSwitchElementFromBeltNrAndBeltDir(belt_nr, belt_dir);
14010 static int swappable_elements[][2] =
14012 { EL_EXIT_CLOSED, EL_EXIT_OPEN },
14013 { EL_DYNAMITE, EL_DYNAMITE_ACTIVE },
14014 { EL_EM_DYNAMITE, EL_EM_DYNAMITE_ACTIVE },
14015 { EL_QUICKSAND_EMPTY, EL_QUICKSAND_FULL },
14016 { EL_EMERALD, EL_WALL_EMERALD },
14017 { EL_EMERALD_YELLOW, EL_WALL_EMERALD_YELLOW },
14018 { EL_EMERALD_RED, EL_WALL_EMERALD_RED },
14019 { EL_EMERALD_PURPLE, EL_WALL_EMERALD_PURPLE },
14020 { EL_DIAMOND, EL_WALL_DIAMOND },
14021 { EL_BD_DIAMOND, EL_WALL_BD_DIAMOND },
14022 { EL_GATE_1, EL_GATE_1_GRAY },
14023 { EL_GATE_2, EL_GATE_2_GRAY },
14024 { EL_GATE_3, EL_GATE_3_GRAY },
14025 { EL_GATE_4, EL_GATE_4_GRAY },
14026 { EL_EM_GATE_1, EL_EM_GATE_1_GRAY },
14027 { EL_EM_GATE_2, EL_EM_GATE_2_GRAY },
14028 { EL_EM_GATE_3, EL_EM_GATE_3_GRAY },
14029 { EL_EM_GATE_4, EL_EM_GATE_4_GRAY },
14030 { EL_EMC_GATE_5, EL_EMC_GATE_5_GRAY },
14031 { EL_EMC_GATE_6, EL_EMC_GATE_6_GRAY },
14032 { EL_EMC_GATE_7, EL_EMC_GATE_7_GRAY },
14033 { EL_EMC_GATE_8, EL_EMC_GATE_8_GRAY },
14034 { EL_DC_GATE_WHITE, EL_DC_GATE_WHITE_GRAY },
14035 { EL_TIME_ORB_EMPTY, EL_TIME_ORB_FULL },
14036 { EL_LAMP, EL_LAMP_ACTIVE },
14037 { EL_SOKOBAN_FIELD_EMPTY, EL_SOKOBAN_FIELD_FULL },
14038 { EL_SP_BASE, EL_SP_BUGGY_BASE },
14039 { EL_PEARL, EL_WALL_PEARL },
14040 { EL_CRYSTAL, EL_WALL_CRYSTAL },
14041 { EL_TIMEGATE_CLOSED, EL_TIMEGATE_OPEN },
14042 { EL_SWITCHGATE_CLOSED, EL_SWITCHGATE_OPEN },
14043 { EL_SWITCHGATE_SWITCH_UP, EL_SWITCHGATE_SWITCH_DOWN },
14044 { EL_DC_SWITCHGATE_SWITCH_UP, EL_DC_SWITCHGATE_SWITCH_DOWN },
14045 { EL_LIGHT_SWITCH, EL_LIGHT_SWITCH_ACTIVE },
14046 { EL_LANDMINE, EL_DC_LANDMINE },
14047 { EL_SHIELD_NORMAL, EL_SHIELD_DEADLY },
14048 { EL_STEEL_EXIT_CLOSED, EL_STEEL_EXIT_OPEN },
14049 { EL_EM_EXIT_CLOSED, EL_EM_EXIT_OPEN },
14050 { EL_EM_STEEL_EXIT_CLOSED, EL_EM_STEEL_EXIT_OPEN },
14051 { EL_QUICKSAND_FAST_EMPTY, EL_QUICKSAND_FAST_FULL },
14052 { EL_MM_EXIT_CLOSED, EL_MM_EXIT_OPEN },
14053 { EL_MM_FUSE, EL_MM_FUSE_ACTIVE },
14054 { EL_MM_LIGHTBULB, EL_MM_LIGHTBULB_ACTIVE },
14055 { EL_MM_FUEL_EMPTY, EL_MM_FUEL_FULL },
14059 static int rotatable_elements_4[][4] =
14069 EL_SPACESHIP_RIGHT,
14074 EL_BD_BUTTERFLY_UP,
14075 EL_BD_BUTTERFLY_RIGHT,
14076 EL_BD_BUTTERFLY_DOWN,
14077 EL_BD_BUTTERFLY_LEFT
14081 EL_BD_FIREFLY_RIGHT,
14082 EL_BD_FIREFLY_DOWN,
14110 EL_SP_GRAVITY_PORT_UP,
14111 EL_SP_GRAVITY_PORT_RIGHT,
14112 EL_SP_GRAVITY_PORT_DOWN,
14113 EL_SP_GRAVITY_PORT_LEFT
14116 EL_SP_GRAVITY_ON_PORT_UP,
14117 EL_SP_GRAVITY_ON_PORT_RIGHT,
14118 EL_SP_GRAVITY_ON_PORT_DOWN,
14119 EL_SP_GRAVITY_ON_PORT_LEFT
14122 EL_SP_GRAVITY_OFF_PORT_UP,
14123 EL_SP_GRAVITY_OFF_PORT_RIGHT,
14124 EL_SP_GRAVITY_OFF_PORT_DOWN,
14125 EL_SP_GRAVITY_OFF_PORT_LEFT
14134 EL_BALLOON_SWITCH_UP,
14135 EL_BALLOON_SWITCH_RIGHT,
14136 EL_BALLOON_SWITCH_DOWN,
14137 EL_BALLOON_SWITCH_LEFT
14141 EL_MM_MCDUFFIN_RIGHT,
14142 EL_MM_MCDUFFIN_DOWN,
14143 EL_MM_MCDUFFIN_LEFT
14146 EL_MM_MIRROR_FIXED_1,
14147 EL_MM_MIRROR_FIXED_4,
14148 EL_MM_MIRROR_FIXED_3,
14149 EL_MM_MIRROR_FIXED_2
14152 EL_MM_STEEL_GRID_FIXED_1,
14153 EL_MM_STEEL_GRID_FIXED_4,
14154 EL_MM_STEEL_GRID_FIXED_2,
14155 EL_MM_STEEL_GRID_FIXED_3
14158 EL_MM_WOODEN_GRID_FIXED_1,
14159 EL_MM_WOODEN_GRID_FIXED_4,
14160 EL_MM_WOODEN_GRID_FIXED_2,
14161 EL_MM_WOODEN_GRID_FIXED_3
14164 EL_MM_POLARIZER_CROSS_1,
14165 EL_MM_POLARIZER_CROSS_4,
14166 EL_MM_POLARIZER_CROSS_3,
14167 EL_MM_POLARIZER_CROSS_2
14171 EL_MM_PACMAN_RIGHT,
14183 EL_DF_RECEIVER_RIGHT,
14184 EL_DF_RECEIVER_DOWN,
14185 EL_DF_RECEIVER_LEFT
14198 static int rotatable_elements_8[][8] =
14201 EL_DF_STEEL_GRID_FIXED_1,
14202 EL_DF_STEEL_GRID_FIXED_8,
14203 EL_DF_STEEL_GRID_FIXED_7,
14204 EL_DF_STEEL_GRID_FIXED_6,
14205 EL_DF_STEEL_GRID_FIXED_5,
14206 EL_DF_STEEL_GRID_FIXED_4,
14207 EL_DF_STEEL_GRID_FIXED_3,
14208 EL_DF_STEEL_GRID_FIXED_2
14211 EL_DF_WOODEN_GRID_FIXED_1,
14212 EL_DF_WOODEN_GRID_FIXED_8,
14213 EL_DF_WOODEN_GRID_FIXED_7,
14214 EL_DF_WOODEN_GRID_FIXED_6,
14215 EL_DF_WOODEN_GRID_FIXED_5,
14216 EL_DF_WOODEN_GRID_FIXED_4,
14217 EL_DF_WOODEN_GRID_FIXED_3,
14218 EL_DF_WOODEN_GRID_FIXED_2
14221 EL_DF_STEEL_GRID_ROTATING_1,
14222 EL_DF_STEEL_GRID_ROTATING_8,
14223 EL_DF_STEEL_GRID_ROTATING_7,
14224 EL_DF_STEEL_GRID_ROTATING_6,
14225 EL_DF_STEEL_GRID_ROTATING_5,
14226 EL_DF_STEEL_GRID_ROTATING_4,
14227 EL_DF_STEEL_GRID_ROTATING_3,
14228 EL_DF_STEEL_GRID_ROTATING_2
14231 EL_DF_WOODEN_GRID_ROTATING_1,
14232 EL_DF_WOODEN_GRID_ROTATING_8,
14233 EL_DF_WOODEN_GRID_ROTATING_7,
14234 EL_DF_WOODEN_GRID_ROTATING_6,
14235 EL_DF_WOODEN_GRID_ROTATING_5,
14236 EL_DF_WOODEN_GRID_ROTATING_4,
14237 EL_DF_WOODEN_GRID_ROTATING_3,
14238 EL_DF_WOODEN_GRID_ROTATING_2
14245 static int rotatable_elements_16[][16] =
14266 EL_MM_TELEPORTER_5,
14267 EL_MM_TELEPORTER_4,
14268 EL_MM_TELEPORTER_3,
14269 EL_MM_TELEPORTER_2,
14270 EL_MM_TELEPORTER_1,
14271 EL_MM_TELEPORTER_16,
14272 EL_MM_TELEPORTER_15,
14273 EL_MM_TELEPORTER_14,
14274 EL_MM_TELEPORTER_13,
14275 EL_MM_TELEPORTER_12,
14276 EL_MM_TELEPORTER_11,
14277 EL_MM_TELEPORTER_10,
14278 EL_MM_TELEPORTER_9,
14279 EL_MM_TELEPORTER_8,
14280 EL_MM_TELEPORTER_7,
14284 EL_MM_TELEPORTER_RED_5,
14285 EL_MM_TELEPORTER_RED_4,
14286 EL_MM_TELEPORTER_RED_3,
14287 EL_MM_TELEPORTER_RED_2,
14288 EL_MM_TELEPORTER_RED_1,
14289 EL_MM_TELEPORTER_RED_16,
14290 EL_MM_TELEPORTER_RED_15,
14291 EL_MM_TELEPORTER_RED_14,
14292 EL_MM_TELEPORTER_RED_13,
14293 EL_MM_TELEPORTER_RED_12,
14294 EL_MM_TELEPORTER_RED_11,
14295 EL_MM_TELEPORTER_RED_10,
14296 EL_MM_TELEPORTER_RED_9,
14297 EL_MM_TELEPORTER_RED_8,
14298 EL_MM_TELEPORTER_RED_7,
14299 EL_MM_TELEPORTER_RED_6
14302 EL_MM_TELEPORTER_YELLOW_5,
14303 EL_MM_TELEPORTER_YELLOW_4,
14304 EL_MM_TELEPORTER_YELLOW_3,
14305 EL_MM_TELEPORTER_YELLOW_2,
14306 EL_MM_TELEPORTER_YELLOW_1,
14307 EL_MM_TELEPORTER_YELLOW_16,
14308 EL_MM_TELEPORTER_YELLOW_15,
14309 EL_MM_TELEPORTER_YELLOW_14,
14310 EL_MM_TELEPORTER_YELLOW_13,
14311 EL_MM_TELEPORTER_YELLOW_12,
14312 EL_MM_TELEPORTER_YELLOW_11,
14313 EL_MM_TELEPORTER_YELLOW_10,
14314 EL_MM_TELEPORTER_YELLOW_9,
14315 EL_MM_TELEPORTER_YELLOW_8,
14316 EL_MM_TELEPORTER_YELLOW_7,
14317 EL_MM_TELEPORTER_YELLOW_6
14320 EL_MM_TELEPORTER_GREEN_5,
14321 EL_MM_TELEPORTER_GREEN_4,
14322 EL_MM_TELEPORTER_GREEN_3,
14323 EL_MM_TELEPORTER_GREEN_2,
14324 EL_MM_TELEPORTER_GREEN_1,
14325 EL_MM_TELEPORTER_GREEN_16,
14326 EL_MM_TELEPORTER_GREEN_15,
14327 EL_MM_TELEPORTER_GREEN_14,
14328 EL_MM_TELEPORTER_GREEN_13,
14329 EL_MM_TELEPORTER_GREEN_12,
14330 EL_MM_TELEPORTER_GREEN_11,
14331 EL_MM_TELEPORTER_GREEN_10,
14332 EL_MM_TELEPORTER_GREEN_9,
14333 EL_MM_TELEPORTER_GREEN_8,
14334 EL_MM_TELEPORTER_GREEN_7,
14335 EL_MM_TELEPORTER_GREEN_6
14338 EL_MM_TELEPORTER_BLUE_5,
14339 EL_MM_TELEPORTER_BLUE_4,
14340 EL_MM_TELEPORTER_BLUE_3,
14341 EL_MM_TELEPORTER_BLUE_2,
14342 EL_MM_TELEPORTER_BLUE_1,
14343 EL_MM_TELEPORTER_BLUE_16,
14344 EL_MM_TELEPORTER_BLUE_15,
14345 EL_MM_TELEPORTER_BLUE_14,
14346 EL_MM_TELEPORTER_BLUE_13,
14347 EL_MM_TELEPORTER_BLUE_12,
14348 EL_MM_TELEPORTER_BLUE_11,
14349 EL_MM_TELEPORTER_BLUE_10,
14350 EL_MM_TELEPORTER_BLUE_9,
14351 EL_MM_TELEPORTER_BLUE_8,
14352 EL_MM_TELEPORTER_BLUE_7,
14353 EL_MM_TELEPORTER_BLUE_6
14357 EL_MM_POLARIZER_16,
14358 EL_MM_POLARIZER_15,
14359 EL_MM_POLARIZER_14,
14360 EL_MM_POLARIZER_13,
14361 EL_MM_POLARIZER_12,
14362 EL_MM_POLARIZER_11,
14363 EL_MM_POLARIZER_10,
14392 EL_DF_MIRROR_ROTATING_1,
14393 EL_DF_MIRROR_ROTATING_16,
14394 EL_DF_MIRROR_ROTATING_15,
14395 EL_DF_MIRROR_ROTATING_14,
14396 EL_DF_MIRROR_ROTATING_13,
14397 EL_DF_MIRROR_ROTATING_12,
14398 EL_DF_MIRROR_ROTATING_11,
14399 EL_DF_MIRROR_ROTATING_10,
14400 EL_DF_MIRROR_ROTATING_9,
14401 EL_DF_MIRROR_ROTATING_8,
14402 EL_DF_MIRROR_ROTATING_7,
14403 EL_DF_MIRROR_ROTATING_6,
14404 EL_DF_MIRROR_ROTATING_5,
14405 EL_DF_MIRROR_ROTATING_4,
14406 EL_DF_MIRROR_ROTATING_3,
14407 EL_DF_MIRROR_ROTATING_2
14410 EL_DF_MIRROR_FIXED_1,
14411 EL_DF_MIRROR_FIXED_16,
14412 EL_DF_MIRROR_FIXED_15,
14413 EL_DF_MIRROR_FIXED_14,
14414 EL_DF_MIRROR_FIXED_13,
14415 EL_DF_MIRROR_FIXED_12,
14416 EL_DF_MIRROR_FIXED_11,
14417 EL_DF_MIRROR_FIXED_10,
14418 EL_DF_MIRROR_FIXED_9,
14419 EL_DF_MIRROR_FIXED_8,
14420 EL_DF_MIRROR_FIXED_7,
14421 EL_DF_MIRROR_FIXED_6,
14422 EL_DF_MIRROR_FIXED_5,
14423 EL_DF_MIRROR_FIXED_4,
14424 EL_DF_MIRROR_FIXED_3,
14425 EL_DF_MIRROR_FIXED_2
14434 for (i = 0; swappable_elements[i][0] != -1; i++)
14436 int element1 = swappable_elements[i][0];
14437 int element2 = swappable_elements[i][1];
14439 if (old_element == element1 || old_element == element2)
14440 new_element = (old_element == element1 ? element2 : element1);
14443 for (i = 0; rotatable_elements_4[i][0] != -1; i++)
14445 for (j = 0; j < 4; j++)
14447 int element = rotatable_elements_4[i][j];
14449 if (old_element == element)
14450 new_element = (button == 1 ? rotatable_elements_4[i][(j + 3) % 4] :
14451 button == 2 ? rotatable_elements_4[i][0] :
14452 button == 3 ? rotatable_elements_4[i][(j + 1) % 4] :
14457 for (i = 0; rotatable_elements_8[i][0] != -1; i++)
14459 for (j = 0; j < 8; j++)
14461 int element = rotatable_elements_8[i][j];
14463 if (old_element == element)
14464 new_element = (button == 1 ? rotatable_elements_8[i][(j + 7) % 8] :
14465 button == 2 ? rotatable_elements_8[i][0] :
14466 button == 3 ? rotatable_elements_8[i][(j + 1) % 8] :
14471 for (i = 0; rotatable_elements_16[i][0] != -1; i++)
14473 for (j = 0; j < 16; j++)
14475 int element = rotatable_elements_16[i][j];
14477 if (old_element == element)
14478 new_element = (button == 1 ? rotatable_elements_16[i][(j + 15) % 16] :
14479 button == 2 ? rotatable_elements_16[i][0] :
14480 button == 3 ? rotatable_elements_16[i][(j + 1) % 16] :
14485 if (old_element != new_element)
14487 int max_infotext_len = getMaxInfoTextLength();
14488 char infotext[MAX_OUTPUT_LINESIZE + 1];
14490 strncpy(infotext, getElementInfoText(new_element), max_infotext_len);
14491 infotext[max_infotext_len] = '\0';
14493 ClearEditorGadgetInfoText();
14495 DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, INFOTEXT_FONT,
14500 if (IS_MM_WALL_EDITOR(new_element))
14501 SetElementSimpleExt(x, y, dx, dy, new_element, change_level);
14503 SetElementSimple(x, y, new_element, change_level);
14509 static void ResetIntelliDraw(void)
14513 for (x = 0; x < lev_fieldx; x++)
14514 for (y = 0; y < lev_fieldy; y++)
14515 IntelliDrawBuffer[x][y] = Tile[x][y];
14517 SetElementIntelliDraw(-1, -1, -1, -1, EL_UNDEFINED, FALSE, -1);
14520 static boolean draw_mode_hires = FALSE;
14522 static boolean isHiresTileElement(int element)
14524 return (IS_MM_WALL(element) || element == EL_EMPTY);
14527 static boolean isHiresDrawElement(int element)
14529 return (IS_MM_WALL_EDITOR(element) || element == EL_EMPTY);
14532 static int numHiresTiles(int element)
14534 if (IS_MM_WALL(element))
14535 return get_number_of_bits(MM_WALL_BITS(element));
14540 static void SetDrawModeHiRes(int element)
14543 (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
14544 isHiresDrawElement(element));
14547 static boolean getDrawModeHiRes(void)
14549 return draw_mode_hires;
14552 static int getLoResScreenPos(int pos)
14554 return (getDrawModeHiRes() ? pos / 2 : pos);
14557 static int getLoResScreenMod(int pos)
14559 return (getDrawModeHiRes() ? pos % 2 : 0);
14562 static void SetElementExt(int x, int y, int dx, int dy, int element,
14563 boolean change_level, int button)
14566 SetElementSimple(x, y, Tile[x][y], change_level);
14567 else if (GetKeyModState() & KMOD_Shift)
14568 SetElementIntelliDraw(x, y, dx, dy, element, change_level, button);
14570 SetElementSimpleExt(x, y, dx, dy, element, change_level);
14573 static void SetElement(int x, int y, int element)
14575 SetElementExt(x, y, 0, 0, element, TRUE, -1);
14578 static void SetElementButton(int x, int y, int dx, int dy, int element,
14581 SetElementExt(x, y, dx, dy, element, TRUE, button);
14584 static void SetElementHiRes(int sx2, int sy2, int element, boolean change_level)
14586 int lx = getLoResScreenPos(sx2) + level_xpos;
14587 int ly = getLoResScreenPos(sy2) + level_ypos;
14588 int dx = getLoResScreenMod(sx2);
14589 int dy = getLoResScreenMod(sy2);
14591 SetElementExt(lx, ly, dx, dy, element, change_level, -1);
14594 static void SetLevelElementHiRes(int lx2, int ly2, int element)
14601 SetElementExt(lx, ly, dx, dy, element, TRUE, -1);
14604 static int getLevelElementHiRes(int lx2, int ly2)
14610 int element = Tile[lx][ly];
14611 unsigned int bitmask = (dx + 1) << (dy * 2);
14613 if (IS_MM_WALL(element))
14615 if (element & bitmask)
14616 return map_mm_wall_element(element);
14624 static void DrawLineElement(int x, int y, int element, boolean change_level)
14626 SetElementHiRes(x, y, element, change_level);
14629 static void DrawLine(int from_x, int from_y, int to_x, int to_y,
14630 int element, boolean change_level)
14632 int xsize = ABS(to_x - from_x);
14633 int ysize = ABS(to_y - from_y);
14634 int dx = (to_x < from_x ? -1 : +1);
14635 int dy = (to_y < from_y ? -1 : +1);
14638 if (from_y == to_y) // horizontal line
14640 for (i = 0; i <= xsize; i++)
14641 DrawLineElement(from_x + i * dx, from_y, element, change_level);
14643 else if (from_x == to_x) // vertical line
14645 for (i = 0; i <= ysize; i++)
14646 DrawLineElement(from_x, from_y + i * dy, element, change_level);
14648 else // diagonal line
14650 if (ysize < xsize) // a < 1
14652 float a = (float)ysize / (float)xsize;
14654 for (i = 0; i <= xsize; i++)
14657 int y = dy * (int)(a * i + 0.5);
14659 DrawLineElement(from_x + x, from_y + y, element, change_level);
14664 float a = (float)xsize / (float)ysize;
14666 for (i = 0; i <= ysize; i++)
14668 int x = dx * (int)(a * i + 0.5);
14671 DrawLineElement(from_x + x, from_y + y, element, change_level);
14677 static void DrawBox(int from_x, int from_y, int to_x, int to_y,
14678 int element, boolean change_level)
14680 DrawLine(from_x, from_y, from_x, to_y, element, change_level);
14681 DrawLine(from_x, to_y, to_x, to_y, element, change_level);
14682 DrawLine(to_x, to_y, to_x, from_y, element, change_level);
14683 DrawLine(to_x, from_y, from_x, from_y, element, change_level);
14686 static void DrawFilledBox(int from_x, int from_y, int to_x, int to_y,
14687 int element, boolean change_level)
14692 swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
14694 for (y = from_y; y <= to_y; y++)
14695 DrawLine(from_x, y, to_x, y, element, change_level);
14698 static void DrawArcExt(int from_x, int from_y, int to_x2, int to_y2,
14699 int element, boolean change_level)
14701 int to_x = to_x2 - (to_x2 > from_x ? +1 : -1);
14702 int to_y = to_y2 - (to_y2 > from_y ? +1 : -1);
14703 int len_x = ABS(to_x - from_x);
14704 int len_y = ABS(to_y - from_y);
14707 radius = (int)(sqrt((float)(len_x * len_x + len_y * len_y)) + 0.5);
14709 // not optimal (some points get drawn twice) but simple,
14710 // and fast enough for the few points we are drawing
14712 for (x = 0; x <= radius; x++)
14714 int sx, sy, sx2, sy2, lx, ly;
14716 y = (int)(sqrt((float)(radius * radius - x * x)) + 0.5);
14718 sx2 = from_x + x * (from_x < to_x2 ? +1 : -1);
14719 sy2 = from_y + y * (from_y < to_y2 ? +1 : -1);
14720 sx = getLoResScreenPos(sx2);
14721 sy = getLoResScreenPos(sy2);
14722 lx = sx + level_xpos;
14723 ly = sy + level_ypos;
14725 if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
14726 DrawLineElement(sx2, sy2, element, change_level);
14729 for (y = 0; y <= radius; y++)
14731 int sx, sy, sx2, sy2, lx, ly;
14733 x = (int)(sqrt((float)(radius * radius - y * y)) + 0.5);
14735 sx2 = from_x + x * (from_x < to_x2 ? +1 : -1);
14736 sy2 = from_y + y * (from_y < to_y2 ? +1 : -1);
14737 sx = getLoResScreenPos(sx2);
14738 sy = getLoResScreenPos(sy2);
14739 lx = sx + level_xpos;
14740 ly = sy + level_ypos;
14742 if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
14743 DrawLineElement(sx2, sy2, element, change_level);
14747 static void DrawArc(int from_x, int from_y, int to_x, int to_y,
14748 int element, boolean change_level)
14750 int to_x2 = to_x + (to_x < from_x ? -1 : +1);
14751 int to_y2 = to_y + (to_y > from_y ? +1 : -1);
14753 DrawArcExt(from_x, from_y, to_x2, to_y2, element, change_level);
14756 #define DRAW_CIRCLES_BUTTON_AVAILABLE 0
14758 #if DRAW_CIRCLES_BUTTON_AVAILABLE
14759 static void DrawCircle(int from_x, int from_y, int to_x, int to_y,
14760 int element, boolean change_level)
14762 int to_x2 = to_x + (to_x < from_x ? -1 : +1);
14763 int to_y2 = to_y + (to_y > from_y ? +1 : -1);
14764 int mirror_to_x2 = from_x - (to_x2 - from_x);
14765 int mirror_to_y2 = from_y - (to_y2 - from_y);
14767 DrawArcExt(from_x, from_y, to_x2, to_y2, element, change_level);
14768 DrawArcExt(from_x, from_y, mirror_to_x2, to_y2, element, change_level);
14769 DrawArcExt(from_x, from_y, to_x2, mirror_to_y2, element, change_level);
14770 DrawArcExt(from_x, from_y, mirror_to_x2, mirror_to_y2, element, change_level);
14774 static void DrawAreaBorder(int from_x, int from_y, int to_x, int to_y)
14776 int from_sx, from_sy;
14780 swap_numbers(&from_x, &to_x);
14783 swap_numbers(&from_y, &to_y);
14785 from_sx = SX + from_x * ed_tilesize;
14786 from_sy = SY + from_y * ed_tilesize;
14787 to_sx = SX + (to_x + 1) * ed_tilesize - 1;
14788 to_sy = SY + (to_y + 1) * ed_tilesize - 1;
14790 DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
14791 DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
14792 DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
14793 DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
14795 if (from_x == to_x && from_y == to_y)
14796 MarkTileDirty(from_x/2, from_y/2);
14798 redraw_mask |= REDRAW_FIELD;
14801 static void DrawAreaBox(int from_x, int from_y, int to_x, int to_y,
14802 int element, boolean change_level)
14804 DrawBox(from_x, from_y, to_x, to_y, element, change_level);
14807 static void SelectArea(int from_x, int from_y, int to_x, int to_y,
14808 int element, boolean change_level)
14810 if (element == -1 || change_level)
14811 DrawAreaBox(from_x, from_y, to_x, to_y, -1, FALSE);
14813 DrawAreaBorder(from_x, from_y, to_x, to_y);
14816 // values for CopyBrushExt()
14817 #define CB_AREA_TO_BRUSH 0
14818 #define CB_BRUSH_TO_CURSOR 1
14819 #define CB_BRUSH_TO_LEVEL 2
14820 #define CB_DELETE_OLD_CURSOR 3
14821 #define CB_DUMP_BRUSH 4
14822 #define CB_DUMP_BRUSH_SMALL 5
14823 #define CB_CLIPBOARD_TO_BRUSH 6
14824 #define CB_BRUSH_TO_CLIPBOARD 7
14825 #define CB_BRUSH_TO_CLIPBOARD_SMALL 8
14826 #define CB_UPDATE_BRUSH_POSITION 9
14827 #define CB_FLIP_BRUSH_X 10
14828 #define CB_FLIP_BRUSH_Y 11
14829 #define CB_FLIP_BRUSH_XY 12
14831 #define MAX_CB_PART_SIZE 10
14832 #define MAX_CB_LINE_SIZE (MAX_LEV_FIELDX + 1) // text plus newline
14833 #define MAX_CB_NUM_LINES (MAX_LEV_FIELDY)
14834 #define MAX_CB_TEXT_SIZE (MAX_CB_LINE_SIZE * \
14835 MAX_CB_NUM_LINES * \
14838 static int getFlippedTileExt(int map[], int element)
14842 for (i = 0; map[i] != -1; i++)
14843 if (map[i] == element)
14844 return map[i ^ 1]; // get flipped element by flipping LSB of index
14849 static int getFlippedTileX(int element)
14853 EL_BD_BUTTERFLY_LEFT, EL_BD_BUTTERFLY_RIGHT,
14854 EL_BD_FIREFLY_LEFT, EL_BD_FIREFLY_RIGHT,
14855 EL_BUG_LEFT, EL_BUG_RIGHT,
14856 EL_SPACESHIP_LEFT, EL_SPACESHIP_RIGHT,
14857 EL_PACMAN_LEFT, EL_PACMAN_RIGHT,
14858 EL_ARROW_LEFT, EL_ARROW_RIGHT,
14859 EL_MOLE_LEFT, EL_MOLE_RIGHT,
14860 EL_BALLOON_SWITCH_LEFT, EL_BALLOON_SWITCH_RIGHT,
14861 EL_YAMYAM_LEFT, EL_YAMYAM_RIGHT,
14862 EL_SP_PORT_LEFT, EL_SP_PORT_RIGHT,
14863 EL_SP_GRAVITY_PORT_LEFT, EL_SP_GRAVITY_PORT_RIGHT,
14864 EL_SP_GRAVITY_ON_PORT_LEFT, EL_SP_GRAVITY_ON_PORT_RIGHT,
14865 EL_SP_GRAVITY_OFF_PORT_LEFT, EL_SP_GRAVITY_OFF_PORT_RIGHT,
14866 EL_CONVEYOR_BELT_1_LEFT, EL_CONVEYOR_BELT_1_RIGHT,
14867 EL_CONVEYOR_BELT_2_LEFT, EL_CONVEYOR_BELT_2_RIGHT,
14868 EL_CONVEYOR_BELT_3_LEFT, EL_CONVEYOR_BELT_3_RIGHT,
14869 EL_CONVEYOR_BELT_4_LEFT, EL_CONVEYOR_BELT_4_RIGHT,
14870 EL_SPRING_LEFT, EL_SPRING_RIGHT,
14871 EL_SP_CHIP_LEFT, EL_SP_CHIP_RIGHT,
14872 EL_TUBE_VERTICAL_LEFT, EL_TUBE_VERTICAL_RIGHT,
14873 EL_TUBE_LEFT_UP, EL_TUBE_RIGHT_UP,
14874 EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_DOWN,
14875 EL_DC_STEELWALL_1_LEFT, EL_DC_STEELWALL_1_RIGHT,
14876 EL_DC_STEELWALL_1_TOPLEFT, EL_DC_STEELWALL_1_TOPRIGHT,
14877 EL_DC_STEELWALL_1_BOTTOMLEFT, EL_DC_STEELWALL_1_BOTTOMRIGHT,
14878 EL_DC_STEELWALL_1_TOPLEFT_2, EL_DC_STEELWALL_1_TOPRIGHT_2,
14879 EL_DC_STEELWALL_1_BOTTOMLEFT_2, EL_DC_STEELWALL_1_BOTTOMRIGHT_2,
14880 EL_DC_STEELWALL_2_LEFT, EL_DC_STEELWALL_2_RIGHT,
14881 EL_ACID_POOL_TOPLEFT, EL_ACID_POOL_TOPRIGHT,
14882 EL_ACID_POOL_BOTTOMLEFT, EL_ACID_POOL_BOTTOMRIGHT,
14887 return getFlippedTileExt(map, element);
14890 static int getFlippedTileY(int element)
14894 EL_BD_BUTTERFLY_UP, EL_BD_BUTTERFLY_DOWN,
14895 EL_BD_FIREFLY_UP, EL_BD_FIREFLY_DOWN,
14896 EL_BUG_UP, EL_BUG_DOWN,
14897 EL_SPACESHIP_UP, EL_SPACESHIP_DOWN,
14898 EL_PACMAN_UP, EL_PACMAN_DOWN,
14899 EL_ARROW_UP, EL_ARROW_DOWN,
14900 EL_MOLE_UP, EL_MOLE_DOWN,
14901 EL_BALLOON_SWITCH_UP, EL_BALLOON_SWITCH_DOWN,
14902 EL_YAMYAM_UP, EL_YAMYAM_DOWN,
14903 EL_SP_PORT_UP, EL_SP_PORT_DOWN,
14904 EL_SP_GRAVITY_PORT_UP, EL_SP_GRAVITY_PORT_DOWN,
14905 EL_SP_GRAVITY_ON_PORT_UP, EL_SP_GRAVITY_ON_PORT_DOWN,
14906 EL_SP_GRAVITY_OFF_PORT_UP, EL_SP_GRAVITY_OFF_PORT_DOWN,
14907 EL_SP_CHIP_TOP, EL_SP_CHIP_BOTTOM,
14908 EL_TUBE_HORIZONTAL_UP, EL_TUBE_HORIZONTAL_DOWN,
14909 EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN,
14910 EL_TUBE_RIGHT_UP, EL_TUBE_RIGHT_DOWN,
14911 EL_DC_STEELWALL_1_TOP, EL_DC_STEELWALL_1_BOTTOM,
14912 EL_DC_STEELWALL_1_TOPLEFT, EL_DC_STEELWALL_1_BOTTOMLEFT,
14913 EL_DC_STEELWALL_1_TOPRIGHT, EL_DC_STEELWALL_1_BOTTOMRIGHT,
14914 EL_DC_STEELWALL_1_TOPLEFT_2, EL_DC_STEELWALL_1_BOTTOMLEFT_2,
14915 EL_DC_STEELWALL_1_TOPRIGHT_2, EL_DC_STEELWALL_1_BOTTOMRIGHT_2,
14916 EL_DC_STEELWALL_2_TOP, EL_DC_STEELWALL_2_BOTTOM,
14917 EL_EMC_WALL_1, EL_EMC_WALL_3,
14922 return getFlippedTileExt(map, element);
14925 static int getFlippedTileXY(int element)
14929 EL_BD_BUTTERFLY_LEFT, EL_BD_BUTTERFLY_UP,
14930 EL_BD_BUTTERFLY_RIGHT, EL_BD_BUTTERFLY_DOWN,
14931 EL_BD_FIREFLY_LEFT, EL_BD_FIREFLY_UP,
14932 EL_BD_FIREFLY_RIGHT, EL_BD_FIREFLY_DOWN,
14933 EL_BUG_LEFT, EL_BUG_UP,
14934 EL_BUG_RIGHT, EL_BUG_DOWN,
14935 EL_SPACESHIP_LEFT, EL_SPACESHIP_UP,
14936 EL_SPACESHIP_RIGHT, EL_SPACESHIP_DOWN,
14937 EL_PACMAN_LEFT, EL_PACMAN_UP,
14938 EL_PACMAN_RIGHT, EL_PACMAN_DOWN,
14939 EL_ARROW_LEFT, EL_ARROW_UP,
14940 EL_ARROW_RIGHT, EL_ARROW_DOWN,
14941 EL_MOLE_LEFT, EL_MOLE_UP,
14942 EL_MOLE_RIGHT, EL_MOLE_DOWN,
14943 EL_BALLOON_SWITCH_LEFT, EL_BALLOON_SWITCH_UP,
14944 EL_BALLOON_SWITCH_RIGHT, EL_BALLOON_SWITCH_DOWN,
14945 EL_YAMYAM_LEFT, EL_YAMYAM_UP,
14946 EL_YAMYAM_RIGHT, EL_YAMYAM_DOWN,
14947 EL_SP_PORT_LEFT, EL_SP_PORT_UP,
14948 EL_SP_PORT_RIGHT, EL_SP_PORT_DOWN,
14949 EL_SP_GRAVITY_PORT_LEFT, EL_SP_GRAVITY_PORT_UP,
14950 EL_SP_GRAVITY_PORT_RIGHT, EL_SP_GRAVITY_PORT_DOWN,
14951 EL_SP_GRAVITY_ON_PORT_LEFT, EL_SP_GRAVITY_ON_PORT_UP,
14952 EL_SP_GRAVITY_ON_PORT_RIGHT, EL_SP_GRAVITY_ON_PORT_DOWN,
14953 EL_SP_GRAVITY_OFF_PORT_LEFT, EL_SP_GRAVITY_OFF_PORT_UP,
14954 EL_SP_GRAVITY_OFF_PORT_RIGHT, EL_SP_GRAVITY_OFF_PORT_DOWN,
14955 EL_SP_CHIP_LEFT, EL_SP_CHIP_TOP,
14956 EL_SP_CHIP_RIGHT, EL_SP_CHIP_BOTTOM,
14957 EL_TUBE_VERTICAL, EL_TUBE_HORIZONTAL,
14958 EL_TUBE_VERTICAL_LEFT, EL_TUBE_HORIZONTAL_UP,
14959 EL_TUBE_VERTICAL_RIGHT, EL_TUBE_HORIZONTAL_DOWN,
14960 EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP,
14961 EL_DC_STEELWALL_1_LEFT, EL_DC_STEELWALL_1_TOP,
14962 EL_DC_STEELWALL_1_RIGHT, EL_DC_STEELWALL_1_BOTTOM,
14963 EL_DC_STEELWALL_1_HORIZONTAL, EL_DC_STEELWALL_1_VERTICAL,
14964 EL_DC_STEELWALL_1_TOPRIGHT, EL_DC_STEELWALL_1_BOTTOMLEFT,
14965 EL_DC_STEELWALL_1_TOPRIGHT_2, EL_DC_STEELWALL_1_BOTTOMLEFT_2,
14966 EL_DC_STEELWALL_2_LEFT, EL_DC_STEELWALL_2_TOP,
14967 EL_DC_STEELWALL_2_RIGHT, EL_DC_STEELWALL_2_BOTTOM,
14968 EL_DC_STEELWALL_2_HORIZONTAL, EL_DC_STEELWALL_2_VERTICAL,
14969 EL_EXPANDABLE_WALL_HORIZONTAL, EL_EXPANDABLE_WALL_VERTICAL,
14970 EL_EXPANDABLE_STEELWALL_HORIZONTAL, EL_EXPANDABLE_STEELWALL_VERTICAL,
14975 return getFlippedTileExt(map, element);
14978 static int getFlippedTile(int element, int mode)
14980 if (IS_MM_ELEMENT(element))
14982 // get MM game element
14983 element = map_element_RND_to_MM(element);
14985 // get flipped game element
14986 element = (mode == CB_FLIP_BRUSH_X ? getFlippedTileX_MM(element) :
14987 mode == CB_FLIP_BRUSH_Y ? getFlippedTileY_MM(element) :
14988 mode == CB_FLIP_BRUSH_XY ? getFlippedTileXY_MM(element) :
14991 // get RND game element again
14992 element = map_element_MM_to_RND(element);
14996 // get flipped game element
14997 element = (mode == CB_FLIP_BRUSH_X ? getFlippedTileX(element) :
14998 mode == CB_FLIP_BRUSH_Y ? getFlippedTileY(element) :
14999 mode == CB_FLIP_BRUSH_XY ? getFlippedTileXY(element) :
15006 static void SwapFlippedTiles(short *tile1, short *tile2, int mode)
15009 short tile1_flipped = getFlippedTile(*tile1, mode);
15010 short tile2_flipped = getFlippedTile(*tile2, mode);
15013 *tile1 = tile2_flipped;
15014 *tile2 = tile1_flipped;
15017 static void DrawBrushElement(int sx, int sy, int element, boolean change_level)
15019 DrawLineElement(sx, sy, element, change_level);
15022 static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y,
15023 int button, int mode)
15025 static short brush_buffer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
15026 static int brush_width, brush_height;
15027 static int last_cursor_x = -1, last_cursor_y = -1;
15028 static boolean delete_old_brush = FALSE;
15029 int new_element = BUTTON_ELEMENT(button);
15032 if (mode == CB_DUMP_BRUSH ||
15033 mode == CB_DUMP_BRUSH_SMALL ||
15034 mode == CB_BRUSH_TO_CLIPBOARD ||
15035 mode == CB_BRUSH_TO_CLIPBOARD_SMALL)
15037 if (edit_mode != ED_MODE_DRAWING)
15040 char part[MAX_CB_PART_SIZE + 1] = "";
15041 char text[MAX_CB_TEXT_SIZE + 1] = "";
15042 int width = (draw_with_brush ? brush_width : lev_fieldx);
15043 int height = (draw_with_brush ? brush_height : lev_fieldy);
15044 char *format = "%s%03d";
15046 for (y = 0; y < height; y++)
15047 for (x = 0; x < width; x++)
15048 if ((draw_with_brush ? brush_buffer[x][y] : Tile[x][y]) > 999)
15051 for (y = 0; y < height; y++)
15053 for (x = 0; x < width; x++)
15055 int element = (draw_with_brush ? brush_buffer[x][y] : Tile[x][y]);
15056 char *prefix = (mode == CB_DUMP_BRUSH ||
15057 mode == CB_BRUSH_TO_CLIPBOARD ? "`" : "¸");
15059 if (element >= NUM_FILE_ELEMENTS)
15060 element = EL_UNKNOWN;
15062 // copy brush to level sketch text buffer for the R'n'D forum:
15063 // - large tiles: `xxx or `xxxx (0x60 ASCII)
15064 // - small tiles: ¸xxx or ¸xxxx (0xb8 ISO-8859-1, 0xc2b8 UTF-8)
15065 snprintf(part, MAX_CB_PART_SIZE + 1, format, prefix, element);
15066 strcat(text, part);
15069 strcat(text, "\n");
15072 if (mode == CB_BRUSH_TO_CLIPBOARD ||
15073 mode == CB_BRUSH_TO_CLIPBOARD_SMALL)
15074 SDL_SetClipboardText(text);
15076 Print("%s", text); // print brush data to console and log file
15081 if (mode == CB_CLIPBOARD_TO_BRUSH)
15083 if (edit_mode != ED_MODE_DRAWING)
15086 if (!SDL_HasClipboardText())
15088 Request("Clipboard is empty!", REQ_CONFIRM);
15093 boolean copy_to_brush = (draw_with_brush ||
15094 drawing_function == GADGET_ID_GRAB_BRUSH);
15096 // this will delete the old brush, if already drawing with a brush
15098 ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], MB_LEFTBUTTON);
15100 // initialization is required for "odd" (incomplete) clipboard content
15101 for (x = 0; x < MAX_LEV_FIELDX; x++)
15102 for (y = 0; y < MAX_LEV_FIELDY; y++)
15103 brush_buffer[x][y] = EL_EMPTY;
15110 char *clipboard_text = SDL_GetClipboardText();
15111 char *ptr = clipboard_text;
15112 boolean allow_new_row = FALSE;
15113 boolean stop = FALSE;
15115 while (*ptr && !stop)
15117 boolean prefix_found = FALSE;
15118 boolean start_new_row = FALSE;
15120 // level sketch element number prefixes (may be multi-byte characters)
15121 char *prefix_list[] = { "`", "¸" };
15124 for (i = 0; i < ARRAY_SIZE(prefix_list); i++)
15126 char *prefix = prefix_list[i];
15128 // check if string is large enough for prefix
15129 if (strlen(ptr) < strlen(prefix))
15136 // check if string starts with prefix
15137 if (strPrefix(ptr, prefix))
15139 ptr += strlen(prefix);
15141 prefix_found = TRUE;
15147 // check if prefix found and followed by (at least) three digits
15148 if (prefix_found &&
15149 strlen(ptr) >= 3 &&
15150 ptr[0] >= '0' && ptr[0] <= '9' &&
15151 ptr[1] >= '0' && ptr[1] <= '9' &&
15152 ptr[2] >= '0' && ptr[2] <= '9')
15154 int element = ((ptr[0] - '0') * 100 +
15155 (ptr[1] - '0') * 10 +
15160 // level sketch element number might consist of four digits
15161 if (ptr[0] >= '0' && ptr[0] <= '9')
15163 element = element * 10 + (ptr[0] - '0');
15167 // remap some (historic, now obsolete) elements
15168 element = getMappedElement(element);
15170 if (element >= NUM_FILE_ELEMENTS)
15171 element = EL_UNKNOWN;
15173 brush_buffer[x][y] = element;
15175 brush_width = MAX(x + 1, brush_width);
15176 brush_height = MAX(y + 1, brush_height);
15180 if (x >= MAX_LEV_FIELDX)
15181 start_new_row = TRUE;
15183 allow_new_row = TRUE;
15187 if ((*ptr == '\n' || *ptr == '\r') && allow_new_row)
15188 start_new_row = TRUE;
15190 ptr++; // !!! FIX THIS for real UTF-8 handling !!!
15198 if (y >= MAX_LEV_FIELDY)
15201 allow_new_row = FALSE;
15205 SDL_free(clipboard_text);
15207 if (brush_width == 0 || brush_height == 0)
15209 Request("No level sketch found in clipboard!", REQ_CONFIRM);
15216 struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_DRAWING_LEVEL];
15219 SDL_GetMouseState(&mx, &my);
15221 // if inside drawing area, activate and draw brush at last mouse position
15222 if (mx >= gi->x && mx < gi->x + gi->width &&
15223 my >= gi->y && my < gi->y + gi->height)
15224 CopyBrushToCursor(last_cursor_x, last_cursor_y);
15226 draw_with_brush = TRUE;
15232 sprintf(request, "Replace level with %dx%d level sketch from clipboard?",
15233 brush_width, brush_height);
15235 if (!Request(request, REQ_ASK))
15238 for (x = 0; x < MAX_LEV_FIELDX; x++)
15239 for (y = 0; y < MAX_LEV_FIELDY; y++)
15240 Tile[x][y] = brush_buffer[x][y];
15242 lev_fieldx = level.fieldx = brush_width;
15243 lev_fieldy = level.fieldy = brush_height;
15245 boolean use_bd_engine = TRUE;
15246 boolean use_em_engine = TRUE;
15247 boolean use_sp_engine = TRUE;
15248 boolean use_mm_engine = TRUE;
15250 for (x = 0; x < MAX_LEV_FIELDX; x++)
15252 for (y = 0; y < MAX_LEV_FIELDY; y++)
15254 int element = Tile[x][y];
15256 if (!IS_BD_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
15257 use_bd_engine = FALSE;
15259 if (!IS_EM_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
15260 use_em_engine = FALSE;
15262 if (!IS_SP_ELEMENT(element))
15263 use_sp_engine = FALSE;
15265 if (!IS_MM_ELEMENT(element) && element != EL_EMPTY)
15266 use_mm_engine = FALSE;
15270 level.game_engine_type = (use_bd_engine ? GAME_ENGINE_TYPE_BD :
15271 use_em_engine ? GAME_ENGINE_TYPE_EM :
15272 use_sp_engine ? GAME_ENGINE_TYPE_SP :
15273 use_mm_engine ? GAME_ENGINE_TYPE_MM :
15274 GAME_ENGINE_TYPE_RND);
15276 // update element selection list
15277 ReinitializeElementList();
15278 ModifyEditorElementList();
15280 SetBorderElement();
15282 DrawEditModeWindow();
15283 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
15289 if (mode == CB_DELETE_OLD_CURSOR && !delete_old_brush)
15292 if (mode == CB_AREA_TO_BRUSH)
15294 int from_lx, from_ly;
15297 swap_numbers(&from_x, &to_x);
15300 swap_numbers(&from_y, &to_y);
15302 brush_width = to_x - from_x + 1;
15303 brush_height = to_y - from_y + 1;
15305 from_lx = from_x + level_xpos;
15306 from_ly = from_y + level_ypos;
15308 for (y = 0; y < brush_height; y++)
15310 for (x = 0; x < brush_width; x++)
15312 brush_buffer[x][y] = Tile[from_lx + x][from_ly + y];
15315 DrawBrushElement(from_x + x, from_y + y, new_element, TRUE);
15320 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
15322 delete_old_brush = FALSE;
15324 else if (mode == CB_BRUSH_TO_CURSOR || mode == CB_DELETE_OLD_CURSOR ||
15325 mode == CB_BRUSH_TO_LEVEL)
15327 int cursor_x = (mode == CB_DELETE_OLD_CURSOR ? last_cursor_x : from_x);
15328 int cursor_y = (mode == CB_DELETE_OLD_CURSOR ? last_cursor_y : from_y);
15329 int cursor_from_x = cursor_x - brush_width / 2;
15330 int cursor_from_y = cursor_y - brush_height / 2;
15331 int border_from_x = cursor_x, border_from_y = cursor_y;
15332 int border_to_x = cursor_x, border_to_y = cursor_y;
15334 if (mode != CB_DELETE_OLD_CURSOR && delete_old_brush)
15335 CopyBrushExt(0, 0, 0, 0, 0, CB_DELETE_OLD_CURSOR);
15337 if (!IN_ED_FIELD(cursor_x, cursor_y) ||
15338 !IN_LEV_FIELD(cursor_x + level_xpos, cursor_y + level_ypos))
15340 delete_old_brush = FALSE;
15345 for (y = 0; y < brush_height; y++)
15347 for (x = 0; x < brush_width; x++)
15349 int sx = cursor_from_x + x;
15350 int sy = cursor_from_y + y;
15351 int lx = sx + level_xpos;
15352 int ly = sy + level_ypos;
15353 boolean change_level = (mode == CB_BRUSH_TO_LEVEL);
15354 int element = (mode == CB_DELETE_OLD_CURSOR ? -1 :
15355 mode == CB_BRUSH_TO_CURSOR || button == 1 ?
15356 brush_buffer[x][y] : new_element);
15358 if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
15360 if (sx < border_from_x)
15361 border_from_x = sx;
15362 else if (sx > border_to_x)
15364 if (sy < border_from_y)
15365 border_from_y = sy;
15366 else if (sy > border_to_y)
15369 DrawBrushElement(sx, sy, element, change_level);
15374 if (mode != CB_DELETE_OLD_CURSOR)
15375 DrawAreaBorder(border_from_x, border_from_y, border_to_x, border_to_y);
15377 last_cursor_x = cursor_x;
15378 last_cursor_y = cursor_y;
15380 delete_old_brush = TRUE;
15382 else if (mode == CB_FLIP_BRUSH_X)
15384 for (y = 0; y < brush_height; y++)
15385 for (x = 0; x < (brush_width + 1) / 2; x++)
15386 SwapFlippedTiles(&brush_buffer[x][y],
15387 &brush_buffer[brush_width - x - 1][y], mode);
15389 CopyBrushExt(last_cursor_x, last_cursor_y, 0, 0, 0, CB_BRUSH_TO_CURSOR);
15391 else if (mode == CB_FLIP_BRUSH_Y)
15393 for (y = 0; y < (brush_height + 1) / 2; y++)
15394 for (x = 0; x < brush_width; x++)
15395 SwapFlippedTiles(&brush_buffer[x][y],
15396 &brush_buffer[x][brush_height - y - 1], mode);
15398 CopyBrushExt(last_cursor_x, last_cursor_y, 0, 0, 0, CB_BRUSH_TO_CURSOR);
15400 else if (mode == CB_FLIP_BRUSH_XY)
15402 CopyBrushExt(0, 0, 0, 0, 0, CB_DELETE_OLD_CURSOR);
15404 for (y = 0; y < MAX(brush_width, brush_height); y++)
15405 for (x = 0; x <= y; x++)
15406 SwapFlippedTiles(&brush_buffer[x][y],
15407 &brush_buffer[y][x], mode);
15409 swap_numbers(&brush_width, &brush_height);
15411 CopyBrushExt(last_cursor_x, last_cursor_y, 0, 0, 0, CB_BRUSH_TO_CURSOR);
15414 if (mode == CB_UPDATE_BRUSH_POSITION)
15416 last_cursor_x = from_x;
15417 last_cursor_y = from_y;
15421 static void CopyAreaToBrush(int from_x, int from_y, int to_x, int to_y,
15424 CopyBrushExt(from_x, from_y, to_x, to_y, button, CB_AREA_TO_BRUSH);
15427 static void CopyBrushToLevel(int x, int y, int button)
15429 CopyBrushExt(x, y, 0, 0, button, CB_BRUSH_TO_LEVEL);
15432 static void CopyBrushToCursor(int x, int y)
15434 CopyBrushExt(x, y, 0, 0, 0, CB_BRUSH_TO_CURSOR);
15437 static void UpdateBrushPosition(int x, int y)
15439 CopyBrushExt(x, y, 0, 0, 0, CB_UPDATE_BRUSH_POSITION);
15442 static void DeleteBrushFromCursor(void)
15444 CopyBrushExt(0, 0, 0, 0, 0, CB_DELETE_OLD_CURSOR);
15447 static void FlipBrushX(void)
15449 CopyBrushExt(0, 0, 0, 0, 0, CB_FLIP_BRUSH_X);
15452 static void FlipBrushY(void)
15454 CopyBrushExt(0, 0, 0, 0, 0, CB_FLIP_BRUSH_Y);
15457 static void RotateBrush(void)
15459 CopyBrushExt(0, 0, 0, 0, 0, CB_FLIP_BRUSH_XY);
15460 CopyBrushExt(0, 0, 0, 0, 0, CB_FLIP_BRUSH_X);
15463 void DumpBrush(void)
15465 CopyBrushExt(0, 0, 0, 0, 0, CB_DUMP_BRUSH);
15468 void DumpBrush_Small(void)
15470 CopyBrushExt(0, 0, 0, 0, 0, CB_DUMP_BRUSH_SMALL);
15473 void CopyClipboardToBrush(void)
15475 CopyBrushExt(0, 0, 0, 0, 0, CB_CLIPBOARD_TO_BRUSH);
15478 void CopyBrushToClipboard(void)
15480 CopyBrushExt(0, 0, 0, 0, 0, CB_BRUSH_TO_CLIPBOARD);
15483 void CopyBrushToClipboard_Small(void)
15485 CopyBrushExt(0, 0, 0, 0, 0, CB_BRUSH_TO_CLIPBOARD_SMALL);
15488 void UndoLevelEditorOperation(void)
15490 ClickOnGadget(level_editor_gadget[GADGET_ID_UNDO], -1);
15493 void RedoLevelEditorOperation(void)
15495 ClickOnGadget(level_editor_gadget[GADGET_ID_UNDO], 3);
15498 static void FloodFill(int from_x, int from_y, int fill_element)
15500 FloodFillLevel(from_x, from_y, fill_element, Tile, lev_fieldx, lev_fieldy);
15503 static void FloodFillWall_MM(int from_sx2, int from_sy2, int fill_element)
15505 int from_x = from_sx2 + 2 * level_xpos;
15506 int from_y = from_sy2 + 2 * level_ypos;
15507 int max_fillx = lev_fieldx * 2;
15508 int max_filly = lev_fieldy * 2;
15509 short Fill[max_fillx][max_filly];
15512 for (x = 0; x < max_fillx; x++)
15513 for (y = 0; y < max_filly; y++)
15514 Fill[x][y] = getLevelElementHiRes(x, y);
15516 FloodFillLevelExt(from_x, from_y, fill_element, max_fillx, max_filly,
15517 Fill, max_fillx, max_filly);
15519 for (x = 0; x < max_fillx; x++)
15520 for (y = 0; y < max_filly; y++)
15521 if (Fill[x][y] == fill_element)
15522 SetLevelElementHiRes(x, y, Fill[x][y]);
15525 // values for DrawLevelText() modes
15526 #define TEXT_INIT 0
15527 #define TEXT_SETCURSOR 1
15528 #define TEXT_WRITECHAR 2
15529 #define TEXT_BACKSPACE 3
15530 #define TEXT_NEWLINE 4
15532 #define TEXT_QUERY_TYPING 6
15534 static int DrawLevelText(int sx, int sy, char letter, int mode)
15536 static short delete_buffer[MAX_LEV_FIELDX];
15537 static int start_sx;
15538 static int last_sx, last_sy;
15539 static boolean typing = FALSE;
15540 int letter_element;
15541 int lx = 0, ly = 0;
15543 // map lower case letters to upper case and convert special characters
15544 if (letter >= 'a' && letter <= 'z')
15545 letter_element = EL_CHAR_ASCII0 + letter + (int)('A' - 'a');
15546 else if (letter == CHAR_BYTE_UMLAUT_a || letter == CHAR_BYTE_UMLAUT_A)
15547 letter_element = EL_CHAR_AUMLAUT;
15548 else if (letter == CHAR_BYTE_UMLAUT_o || letter == CHAR_BYTE_UMLAUT_O)
15549 letter_element = EL_CHAR_OUMLAUT;
15550 else if (letter == CHAR_BYTE_UMLAUT_u || letter == CHAR_BYTE_UMLAUT_U)
15551 letter_element = EL_CHAR_UUMLAUT;
15552 else if (letter == '^')
15553 letter_element = EL_CHAR_COPYRIGHT;
15555 letter_element = EL_CHAR_ASCII0 + letter;
15557 if (mode != TEXT_INIT)
15562 if (mode != TEXT_SETCURSOR)
15568 lx = last_sx + level_xpos;
15569 ly = last_sy + level_ypos;
15576 DrawLevelText(0, 0, 0, TEXT_END);
15582 DrawLevelText(sx, sy, 0, TEXT_SETCURSOR);
15585 case TEXT_SETCURSOR:
15586 DrawEditorElement(last_sx, last_sy, Tile[lx][ly]);
15587 DrawAreaBorder(sx, sy, sx, sy);
15588 StartTextInput(SX + sx * ed_tilesize, SY + sy * ed_tilesize,
15589 ed_tilesize, ed_tilesize);
15594 case TEXT_WRITECHAR:
15595 if (letter_element >= EL_CHAR_START && letter_element <= EL_CHAR_END)
15597 if (new_element1 >= EL_STEEL_CHAR_START &&
15598 new_element1 <= EL_STEEL_CHAR_END)
15599 letter_element = letter_element - EL_CHAR_START + EL_STEEL_CHAR_START;
15601 delete_buffer[sx - start_sx] = Tile[lx][ly];
15602 Tile[lx][ly] = letter_element;
15604 if (sx + 1 < ed_fieldx && lx + 1 < lev_fieldx)
15605 DrawLevelText(sx + 1, sy, 0, TEXT_SETCURSOR);
15606 else if (sy + 1 < ed_fieldy && ly + 1 < lev_fieldy)
15607 DrawLevelText(start_sx, sy + 1, 0, TEXT_SETCURSOR);
15609 DrawLevelText(0, 0, 0, TEXT_END);
15611 level.changed = TRUE;
15615 case TEXT_BACKSPACE:
15618 Tile[lx - 1][ly] = delete_buffer[sx - start_sx - 1];
15619 DrawEditorElement(sx - 1, sy, Tile[lx - 1][ly]);
15620 DrawLevelText(sx - 1, sy, 0, TEXT_SETCURSOR);
15625 if (sy + 1 < ed_fieldy && ly + 1 < lev_fieldy)
15626 DrawLevelText(start_sx, sy + 1, 0, TEXT_SETCURSOR);
15628 DrawLevelText(0, 0, 0, TEXT_END);
15632 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
15633 DrawEditorElement(sx, sy, Tile[lx][ly]);
15638 case TEXT_QUERY_TYPING:
15648 static void SetTextCursor(int unused_sx, int unused_sy, int sx, int sy,
15649 int element, boolean change_level)
15651 int lx = sx + level_xpos;
15652 int ly = sy + level_ypos;
15655 DrawEditorElement(sx, sy, Tile[lx][ly]);
15657 DrawAreaBorder(sx, sy, sx, sy);
15660 static void CheckLevelBorderElement(boolean redraw_playfield)
15662 int last_border_element = BorderElement;
15664 SetBorderElement();
15666 if (redraw_playfield && BorderElement != last_border_element)
15667 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
15670 static void CopyLevelToUndoBuffer(int mode)
15672 static boolean accumulated_undo = FALSE;
15673 boolean new_undo_buffer_position = TRUE;
15676 if (undo_buffer_steps == 0)
15677 accumulated_undo = FALSE;
15681 case UNDO_IMMEDIATE:
15682 accumulated_undo = FALSE;
15685 case UNDO_ACCUMULATE:
15686 if (accumulated_undo)
15687 new_undo_buffer_position = FALSE;
15688 accumulated_undo = TRUE;
15695 if (new_undo_buffer_position)
15697 // advance position in undo buffer ring
15698 undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
15700 if (undo_buffer_steps < NUM_UNDO_STEPS - 1)
15701 undo_buffer_steps++;
15704 // always reset redo buffer when storing level change into undo buffer
15705 redo_buffer_steps = 0;
15707 for (x = 0; x < lev_fieldx; x++)
15708 for (y = 0; y < lev_fieldy; y++)
15709 UndoBuffer[undo_buffer_position][x][y] = Tile[x][y];
15711 // check if drawing operation forces change of border style
15712 CheckLevelBorderElement(TRUE);
15714 level.changed = TRUE;
15717 static void RandomPlacement(int new_element)
15719 static boolean free_position[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
15720 int num_free_positions = 0;
15721 int num_percentage, num_elements;
15724 ResetIntelliDraw();
15726 // determine number of free positions for randomly placing the new element
15727 for (x = 0; x < lev_fieldx; x++) for (y = 0; y < lev_fieldy; y++)
15729 free_position[x][y] =
15730 (random_placement_background_restricted ?
15731 Tile[x][y] == random_placement_background_element :
15732 Tile[x][y] != new_element);
15734 if (free_position[x][y])
15735 num_free_positions++;
15738 // determine number of new elements to place there
15739 num_percentage = num_free_positions * random_placement_value / 100;
15740 num_elements = (random_placement_method == RANDOM_USE_PERCENTAGE ?
15741 num_percentage : random_placement_value);
15743 // if less free positions than elements to place, fill all these positions
15744 if (num_free_positions < num_elements)
15746 for (x = 0; x < lev_fieldx; x++)
15747 for (y = 0; y < lev_fieldy; y++)
15748 if (free_position[x][y])
15749 SetElement(x, y, new_element);
15753 while (num_elements > 0)
15755 x = GetSimpleRandom(lev_fieldx);
15756 y = GetSimpleRandom(lev_fieldy);
15758 // don't place element at the same position twice
15759 if (free_position[x][y])
15761 free_position[x][y] = FALSE;
15762 SetElement(x, y, new_element);
15768 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
15769 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
15772 static void WrapLevel(int dx, int dy)
15774 int wrap_dx = lev_fieldx - dx;
15775 int wrap_dy = lev_fieldy - dy;
15778 for (x = 0; x < lev_fieldx; x++)
15779 for (y = 0; y < lev_fieldy; y++)
15780 TileBackup[x][y] = Tile[x][y];
15782 for (x = 0; x < lev_fieldx; x++)
15783 for (y = 0; y < lev_fieldy; y++)
15785 TileBackup[(x + wrap_dx) % lev_fieldx][(y + wrap_dy) % lev_fieldy];
15787 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
15788 CopyLevelToUndoBuffer(UNDO_ACCUMULATE);
15791 static void DrawAreaElementHighlight(boolean highlighted,
15792 boolean highlighted_similar)
15794 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
15801 for (x = 0; x < ed_fieldx; x++)
15803 for (y = 0; y < ed_fieldy; y++)
15805 boolean highlight = FALSE;
15806 int lx = x + level_xpos;
15807 int ly = y + level_ypos;
15809 if (!IN_LEV_FIELD(lx, ly))
15812 // check if element is the same
15813 if (Tile[lx][ly] == new_element1)
15816 // check if element is similar
15817 if (highlighted_similar &&
15818 strEqual(element_info[Tile[lx][ly]].class_name,
15819 element_info[new_element1].class_name))
15822 // check if element is matching MM style wall
15823 if (IS_MM_WALL(Tile[lx][ly]) &&
15824 map_mm_wall_element(Tile[lx][ly]) == new_element1)
15830 if (IS_MM_WALL(Tile[lx][ly]) && !highlighted_similar)
15834 for (i = 0; i < 4; i++)
15836 if (!(MM_WALL_BITS(Tile[lx][ly]) & (1 << i)))
15839 int xx = x * 2 + (i % 2);
15840 int yy = y * 2 + (i / 2);
15841 int sx = SX + xx * ed_tilesize / 2;
15842 int sy = SY + yy * ed_tilesize / 2;
15845 int to_sx = sx + ed_tilesize / 2 - 1;
15846 int to_sy = sy + ed_tilesize / 2 - 1;
15848 DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
15849 DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
15850 DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
15851 DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
15856 int sx = SX + x * ed_tilesize;
15857 int sy = SY + y * ed_tilesize;
15860 int to_sx = sx + ed_tilesize - 1;
15861 int to_sy = sy + ed_tilesize - 1;
15863 DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
15864 DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
15865 DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
15866 DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
15872 static void CopyLevelTemplateToUserLevelSet(char *levelset_subdir)
15874 char *template_filename_old = getLocalLevelTemplateFilename();
15875 char *template_filename_new =
15876 getPath2(getUserLevelDir(levelset_subdir), LEVELTEMPLATE_FILENAME);
15878 if (copyFile(template_filename_old, template_filename_new) != 0)
15879 Request("Cannot copy level template!", REQ_CONFIRM);
15881 free(template_filename_new);
15884 static void HandleDrawingAreas(struct GadgetInfo *gi)
15886 static boolean started_inside_drawing_area = FALSE;
15887 static int last_sx = -1;
15888 static int last_sy = -1;
15889 static int last_sx2 = -1;
15890 static int last_sy2 = -1;
15891 int id = gi->custom_id;
15892 int type_id = gi->custom_type_id;
15893 boolean button_press_event;
15894 boolean button_release_event;
15895 boolean inside_drawing_area = !gi->event.off_borders;
15896 boolean draw_level = (id == GADGET_ID_DRAWING_LEVEL);
15897 int actual_drawing_function;
15898 int button = gi->event.button;
15899 int new_element = BUTTON_ELEMENT(button);
15900 int sx = gi->event.x, sy = gi->event.y;
15901 int min_sx = 0, min_sy = 0;
15902 int max_sx = gi->drawing.area_xsize - 1, max_sy = gi->drawing.area_ysize - 1;
15903 int item_xsize = gi->drawing.item_xsize, item_ysize = gi->drawing.item_ysize;
15904 int mini_item_xsize = item_xsize / 2, mini_item_ysize = item_ysize / 2;
15905 int sx2 = gi->event.mx / mini_item_xsize;
15906 int sy2 = gi->event.my / mini_item_ysize;
15909 int lx = 0, ly = 0;
15912 button_press_event = (gi->event.type == GD_EVENT_PRESSED);
15913 button_release_event = (gi->event.type == GD_EVENT_RELEASED);
15915 // make sure to stay inside drawing area boundaries
15916 sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
15917 sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);
15921 int min_lx = 0, min_ly = 0;
15922 int max_lx = lev_fieldx - 1, max_ly = lev_fieldy - 1;
15924 // get positions inside level field
15925 lx = sx + level_xpos;
15926 ly = sy + level_ypos;
15928 if (!IN_LEV_FIELD(lx, ly))
15929 inside_drawing_area = FALSE;
15931 // make sure to stay inside level field boundaries
15932 lx = (lx < min_lx ? min_lx : lx > max_lx ? max_lx : lx);
15933 ly = (ly < min_ly ? min_ly : ly > max_ly ? max_ly : ly);
15935 // correct drawing area positions accordingly
15936 sx = lx - level_xpos;
15937 sy = ly - level_ypos;
15940 // also correct MM wall-sized (double) drawing area positions accordingly
15941 if (sx2 / 2 < sx || sx2 / 2 > sx)
15943 dx = (sx2 / 2 < sx ? 0 : 1);
15946 if (sy2 / 2 < sy || sy2 / 2 > sy)
15948 dy = (sy2 / 2 < sy ? 0 : 1);
15952 if (!button_press_event && !button_release_event)
15954 int old_element = (IN_LEV_FIELD(lx, ly) ? Tile[lx][ly] : EL_UNDEFINED);
15955 boolean hires_drawing = (level.game_engine_type == GAME_ENGINE_TYPE_MM &&
15956 isHiresTileElement(old_element) &&
15957 isHiresDrawElement(new_element));
15959 // prevent handling events for every pixel position when moving mouse
15960 if ((sx == last_sx && sy == last_sy && !hires_drawing) ||
15961 (sx2 == last_sx2 && sy2 == last_sy2))
15970 if (button_press_event)
15971 started_inside_drawing_area = inside_drawing_area;
15973 if (!started_inside_drawing_area)
15976 if (!IS_VALID_BUTTON(button))
15979 // handle info callback for each invocation of action callback
15980 gi->callback_info(gi);
15982 // automatically switch to 'single item' drawing mode, if needed
15983 actual_drawing_function =
15984 (draw_level || drawing_function == GADGET_ID_PICK_ELEMENT ?
15985 drawing_function : GADGET_ID_SINGLE_ITEMS);
15987 // clicking into drawing area with pressed Control key picks element
15988 if (GetKeyModState() & KMOD_Control)
15990 last_drawing_function = drawing_function;
15991 actual_drawing_function = GADGET_ID_PICK_ELEMENT;
15994 if (GetKeyModState() & KMOD_Shift)
15996 if (button_press_event || button_release_event)
15997 ResetIntelliDraw();
16000 SetDrawModeHiRes(-1); // reset to normal draw mode
16002 switch (actual_drawing_function)
16004 case GADGET_ID_SINGLE_ITEMS:
16007 if (button_release_event)
16009 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
16011 if (edit_mode == ED_MODE_DRAWING && draw_with_brush &&
16012 !inside_drawing_area)
16013 DeleteBrushFromCursor();
16018 if (draw_with_brush)
16020 CopyBrushToLevel(sx, sy, button);
16024 SetDrawModeHiRes(new_element);
16026 if (IS_PLAYER_ELEMENT(new_element) || IS_MM_MCDUFFIN(new_element))
16028 // remove player at old position
16029 for (y = 0; y < lev_fieldy; y++)
16031 for (x = 0; x < lev_fieldx; x++)
16033 int old_element = Tile[x][y];
16035 if (IS_PLAYER_ELEMENT(old_element) &&
16036 IS_PLAYER_ELEMENT(new_element))
16038 int replaced_with_element =
16039 (old_element == EL_SOKOBAN_FIELD_PLAYER &&
16040 new_element == EL_PLAYER_1 ? EL_SOKOBAN_FIELD_EMPTY :
16042 old_element == EL_SOKOBAN_FIELD_PLAYER &&
16043 new_element == old_element ? EL_SOKOBAN_FIELD_EMPTY :
16045 new_element == EL_SOKOBAN_FIELD_PLAYER &&
16046 old_element == EL_PLAYER_1 ? EL_EMPTY :
16048 new_element >= EL_PLAYER_1 &&
16049 new_element <= EL_PLAYER_4 &&
16050 new_element == old_element ? EL_EMPTY :
16054 SetElement(x, y, replaced_with_element);
16056 else if (IS_MM_MCDUFFIN(old_element) &&
16057 IS_MM_MCDUFFIN(new_element))
16059 // remove McDuffin at old position
16060 SetElement(x, y, EL_EMPTY);
16066 SetElementButton(lx, ly, dx, dy, new_element, button);
16069 else if (!button_release_event)
16071 int pos = sx * drawingarea_info[type_id].area_ysize + sy;
16073 if (item_xsize == MINI_TILEX && item_ysize == MINI_TILEY)
16074 DrawMiniGraphicExt(drawto,
16075 gi->x + sx * MINI_TILEX,
16076 gi->y + sy * MINI_TILEY,
16077 el2edimg(new_element));
16079 DrawFixedGraphicExt(drawto,
16080 gi->x + sx * TILEX,
16081 gi->y + sy * TILEY,
16082 el2edimg(new_element), 0);
16084 if (id == GADGET_ID_CUSTOM_GRAPHIC)
16085 new_element = GFX_ELEMENT(new_element);
16087 drawingarea_info[type_id].value[pos] = new_element;
16089 CopyElementPropertiesToGame(properties_element);
16091 if (id == GADGET_ID_CUSTOM_GRAPHIC)
16093 UpdateCustomElementGraphicGadgets();
16095 FrameCounter = 0; // restart animation frame counter
16100 case GADGET_ID_CONNECTED_ITEMS:
16102 static int last_sx = -1;
16103 static int last_sy = -1;
16105 if (button_release_event)
16106 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
16108 SetDrawModeHiRes(new_element);
16110 if (getDrawModeHiRes())
16116 if (!button_press_event)
16117 DrawLine(last_sx, last_sy, sx, sy, new_element, TRUE);
16124 case GADGET_ID_LINE:
16125 case GADGET_ID_ARC:
16126 case GADGET_ID_RECTANGLE:
16127 case GADGET_ID_FILLED_BOX:
16128 SetDrawModeHiRes(new_element);
16130 if (getDrawModeHiRes())
16136 case GADGET_ID_GRAB_BRUSH:
16137 case GADGET_ID_TEXT:
16139 static int last_sx = -1;
16140 static int last_sy = -1;
16141 static int start_sx = -1;
16142 static int start_sy = -1;
16143 void (*draw_func)(int, int, int, int, int, boolean);
16145 if (drawing_function == GADGET_ID_LINE)
16146 draw_func = DrawLine;
16147 else if (drawing_function == GADGET_ID_ARC)
16148 draw_func = DrawArc;
16149 else if (drawing_function == GADGET_ID_RECTANGLE)
16150 draw_func = DrawBox;
16151 else if (drawing_function == GADGET_ID_FILLED_BOX)
16152 draw_func = DrawFilledBox;
16153 else if (drawing_function == GADGET_ID_GRAB_BRUSH)
16154 draw_func = SelectArea;
16155 else // (drawing_function == GADGET_ID_TEXT)
16156 draw_func = SetTextCursor;
16158 if (button_press_event)
16160 draw_func(sx, sy, sx, sy, new_element, FALSE);
16161 start_sx = last_sx = sx;
16162 start_sy = last_sy = sy;
16164 if (drawing_function == GADGET_ID_TEXT)
16165 DrawLevelText(0, 0, 0, TEXT_END);
16167 else if (button_release_event)
16169 draw_func(start_sx, start_sy, sx, sy, new_element, TRUE);
16170 if (drawing_function == GADGET_ID_GRAB_BRUSH)
16172 CopyAreaToBrush(start_sx, start_sy, sx, sy, button);
16173 CopyBrushToCursor(sx, sy);
16174 ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS],
16176 draw_with_brush = TRUE;
16178 else if (drawing_function == GADGET_ID_TEXT)
16179 DrawLevelText(sx, sy, 0, TEXT_INIT);
16181 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
16183 else if (last_sx != sx || last_sy != sy)
16185 draw_func(start_sx, start_sy, last_sx, last_sy, -1, FALSE);
16186 if (IS_MM_WALL_EDITOR(new_element)) // clear wall background
16187 draw_func(start_sx, start_sy, sx, sy, EL_EMPTY, FALSE);
16188 draw_func(start_sx, start_sy, sx, sy, new_element, FALSE);
16195 case GADGET_ID_FLOOD_FILL:
16196 if (button_press_event && Tile[lx][ly] != new_element)
16198 if (IS_MM_WALL_EDITOR(new_element))
16199 FloodFillWall_MM(sx2, sy2, new_element);
16201 FloodFill(lx, ly, new_element);
16203 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16204 CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
16208 case GADGET_ID_PICK_ELEMENT:
16209 if (button_release_event)
16210 ClickOnGadget(level_editor_gadget[last_drawing_function],
16212 else if (draw_level)
16213 PickDrawingElement(button, Tile[lx][ly]);
16216 int pos = sx * drawingarea_info[type_id].area_ysize + sy;
16218 PickDrawingElement(button, drawingarea_info[type_id].value[pos]);
16225 // do not mark level as modified for certain non-level-changing gadgets
16226 if ((type_id >= ED_DRAWING_ID_EDITOR_FIRST &&
16227 type_id <= ED_DRAWING_ID_EDITOR_LAST) ||
16228 actual_drawing_function == GADGET_ID_GRAB_BRUSH ||
16229 actual_drawing_function == GADGET_ID_PICK_ELEMENT)
16232 level.changed = TRUE;
16235 static void HandleCounterButtons(struct GadgetInfo *gi)
16237 int gadget_id = gi->custom_id;
16238 int counter_id = gi->custom_type_id;
16239 int button = gi->event.button;
16240 int *counter_value = counterbutton_info[counter_id].value;
16241 int step = BUTTON_STEPSIZE(button) *
16242 (gadget_id == counterbutton_info[counter_id].gadget_id_down ? -1 : +1);
16244 if (counter_id == ED_COUNTER_ID_SELECT_LEVEL)
16246 boolean pressed = (gi->event.type == GD_EVENT_PRESSED);
16247 boolean released = (gi->event.type == GD_EVENT_RELEASED);
16248 boolean level_changed = LevelChanged();
16250 if ((level_changed && pressed) || (!level_changed && released))
16253 if (level_changed && !Request("Level has changed! Discard changes?",
16256 if (gadget_id == counterbutton_info[counter_id].gadget_id_text)
16257 ModifyEditorCounterValue(counter_id, *counter_value);
16263 if (gadget_id == counterbutton_info[counter_id].gadget_id_text)
16264 *counter_value = gi->textinput.number_value;
16266 ModifyEditorCounterValue(counter_id, *counter_value + step);
16268 if (counter_id == ED_COUNTER_ID_SELECT_LEVEL)
16270 int last_game_engine_type = level.game_engine_type;
16272 LoadLevel(level_nr);
16273 LoadScore(level_nr);
16275 SaveLevelSetup_SeriesInfo();
16280 DrawEditModeWindow();
16282 if (level.game_engine_type != last_game_engine_type)
16284 // update element selection list
16285 ReinitializeElementList();
16286 ModifyEditorElementList();
16292 switch (counter_id)
16294 case ED_COUNTER_ID_YAMYAM_CONTENT:
16295 DrawYamYamContentAreas();
16298 case ED_COUNTER_ID_BALL_CONTENT:
16299 DrawMagicBallContentAreas();
16302 case ED_COUNTER_ID_ANDROID_CONTENT:
16303 DrawAndroidElementArea();
16306 case ED_COUNTER_ID_GROUP_CONTENT:
16307 DrawGroupElementArea();
16308 CopyGroupElementPropertiesToGame(properties_element);
16311 case ED_COUNTER_ID_INVENTORY_SIZE:
16312 DrawPlayerInitialInventoryArea(properties_element);
16315 case ED_COUNTER_ID_MM_BALL_CONTENT:
16316 DrawMMBallContentArea();
16319 case ED_COUNTER_ID_ENVELOPE_XSIZE:
16320 case ED_COUNTER_ID_ENVELOPE_YSIZE:
16321 DrawEnvelopeTextArea(-1);
16324 case ED_COUNTER_ID_LEVEL_XSIZE:
16325 case ED_COUNTER_ID_LEVEL_YSIZE:
16326 lev_fieldx = level.fieldx;
16327 lev_fieldy = level.fieldy;
16329 // check if resizing of level results in change of border border
16330 SetBorderElement();
16338 if ((counter_id >= ED_COUNTER_ID_CUSTOM_FIRST &&
16339 counter_id <= ED_COUNTER_ID_CUSTOM_LAST) ||
16340 (counter_id >= ED_COUNTER_ID_CHANGE_FIRST &&
16341 counter_id <= ED_COUNTER_ID_CHANGE_LAST))
16342 CopyElementPropertiesToGame(properties_element);
16344 // do not mark level as modified for certain non-level-changing gadgets
16345 if ((counter_id >= ED_COUNTER_ID_LEVELSET_FIRST &&
16346 counter_id <= ED_COUNTER_ID_LEVELSET_LAST) ||
16347 (counter_id >= ED_COUNTER_ID_EDITOR_FIRST &&
16348 counter_id <= ED_COUNTER_ID_EDITOR_LAST))
16351 level.changed = TRUE;
16354 static void HandleTextInputGadgets(struct GadgetInfo *gi)
16356 int type_id = gi->custom_type_id;
16358 strcpy(textinput_info[type_id].value, gi->textinput.value);
16360 if (type_id == ED_TEXTINPUT_ID_ELEMENT_NAME)
16362 CopyElementPropertiesToGame(properties_element);
16364 ModifyEditorElementList(); // update changed button info text
16366 else if (type_id >= ED_TEXTINPUT_ID_COLORS_FIRST &&
16367 type_id <= ED_TEXTINPUT_ID_COLORS_LAST)
16369 int pos = type_id - ED_TEXTINPUT_ID_COLORS_FIRST;
16371 *bd_color[pos] = gd_color_get_from_string(bd_color_text[pos]);
16373 DrawColorBox_BD(pos);
16376 // do not mark level as modified for certain non-level-changing gadgets
16377 if (type_id >= ED_TEXTINPUT_ID_LEVELSET_FIRST &&
16378 type_id <= ED_TEXTINPUT_ID_LEVELSET_LAST)
16381 level.changed = TRUE;
16384 static void HandleTextAreaGadgets(struct GadgetInfo *gi)
16386 int type_id = gi->custom_type_id;
16388 strncpy(textarea_info[type_id].value, gi->textarea.value,
16389 MAX_ENVELOPE_TEXT_LEN);
16390 textarea_info[type_id].value[MAX_ENVELOPE_TEXT_LEN] = '\0';
16392 level.changed = TRUE;
16395 static void HandleSelectboxGadgets(struct GadgetInfo *gi)
16397 int type_id = gi->custom_type_id;
16398 int value_old = *selectbox_info[type_id].value;
16399 int value_new = selectbox_info[type_id].options[gi->selectbox.index].value;
16401 *selectbox_info[type_id].value = value_new;
16403 if (type_id == ED_SELECTBOX_ID_LEVELSET_SAVE_MODE)
16405 DrawLevelConfigWindow();
16407 else if (type_id == ED_SELECTBOX_ID_SELECT_CHANGE_PAGE)
16409 element_info[properties_element].current_change_page = gi->selectbox.index;
16411 DrawPropertiesWindow();
16413 else if ((type_id >= ED_SELECTBOX_ID_CUSTOM_FIRST &&
16414 type_id <= ED_SELECTBOX_ID_CUSTOM_LAST) ||
16415 (type_id >= ED_SELECTBOX_ID_CHANGE_FIRST &&
16416 type_id <= ED_SELECTBOX_ID_CHANGE_LAST) ||
16417 (type_id == ED_SELECTBOX_ID_GROUP_CHOICE_MODE))
16419 if (type_id == ED_SELECTBOX_ID_ACTION_TYPE)
16421 // when changing action type, also check action mode and action arg
16422 if (value_old != value_new)
16423 setSelectboxSpecialActionVariablesIfNeeded();
16425 DrawPropertiesChange();
16428 CopyElementPropertiesToGame(properties_element);
16430 else if (type_id == ED_SELECTBOX_ID_GAME_ENGINE_TYPE)
16432 // show or hide "engine" tabulator depending on game engine type
16433 DrawLevelConfigWindow();
16435 // update element selection list depending on game engine type
16436 ReinitializeElementList();
16437 ModifyEditorElementList();
16439 else if (type_id == ED_SELECTBOX_ID_BD_SCHEDULING_TYPE)
16441 // update BD cycle delay counter gadgets depending on BD scheduling type
16442 DrawLevelConfigWindow();
16444 else if (type_id == ED_SELECTBOX_ID_BD_COLOR_TYPE)
16446 bd_color_type_changed = TRUE;
16448 if (level.bd_color_type != GD_COLOR_TYPE_RGB && level.bd_color_type != GetCommonColorType_BD())
16450 // color type switched to non-RGB colors, but using different color type => reset colors
16451 char *message = (level.bd_color_type == bd_color_type_default ?
16452 "This will reset colors to defaults! Continue?" :
16453 "This will reset colors to random colors! Continue?");
16455 if (!Request(message, REQ_ASK))
16457 // keep current RGB colors
16458 level.bd_color_type = GD_COLOR_TYPE_RGB;
16459 bd_color_type_changed = FALSE;
16463 // update BD color palette gadgets depending on BD color type
16464 DrawLevelConfigWindow();
16466 else if (type_id >= ED_SELECTBOX_ID_COLORS_FIRST &&
16467 type_id <= ED_SELECTBOX_ID_COLORS_LAST)
16469 int pos = type_id - ED_SELECTBOX_ID_COLORS_FIRST;
16471 *bd_color[pos] = gd_c64_color(bd_color_c64[pos]);
16473 DrawColorBox_BD(pos);
16476 // do not mark level as modified for certain non-level-changing gadgets
16477 if (type_id == ED_SELECTBOX_ID_LEVELSET_SAVE_MODE ||
16478 type_id == ED_SELECTBOX_ID_SELECT_CHANGE_PAGE)
16481 level.changed = TRUE;
16484 static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
16486 int type_id = gi->custom_type_id;
16489 if (type_id >= ED_TAB_BUTTON_ID_LEVELCONFIG_FIRST &&
16490 type_id <= ED_TAB_BUTTON_ID_LEVELCONFIG_LAST)
16492 edit_mode_levelconfig = gi->custom_type_id;
16494 DrawLevelConfigWindow();
16496 else if (type_id >= ED_TAB_BUTTON_ID_ENGINECONFIG_FIRST &&
16497 type_id <= ED_TAB_BUTTON_ID_ENGINECONFIG_LAST)
16499 edit_mode_engineconfig = gi->custom_type_id;
16501 DrawLevelConfigWindow();
16503 else if (type_id >= ED_TAB_BUTTON_ID_PROPERTIES_FIRST &&
16504 type_id <= ED_TAB_BUTTON_ID_PROPERTIES_LAST)
16506 edit_mode_properties = gi->custom_type_id;
16508 DrawPropertiesWindow();
16510 else if (type_id == ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1 ||
16511 type_id == ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2)
16513 boolean new_template = !fileExists(getLocalLevelTemplateFilename());
16515 // backup original "level.field" (needed to track playfield changes)
16516 CopyPlayfield(level.field, TileBackup);
16518 // "SaveLevelTemplate()" uses "level.field", so copy editor playfield
16519 CopyPlayfield(Tile, level.field);
16521 if (new_template ||
16522 Request("Save this template and kill the old?", REQ_ASK))
16523 SaveLevelTemplate();
16526 Request("Template saved!", REQ_CONFIRM);
16528 // restore original "level.field" (needed to track playfield changes)
16529 CopyPlayfield(TileBackup, level.field);
16531 else if (type_id == ED_TEXTBUTTON_ID_SAVE_LEVELSET)
16533 char *levelset_subdir = getLevelSubdirFromSaveMode(levelset_save_mode);
16535 if (levelset_save_mode == LEVELSET_SAVE_MODE_UPDATE &&
16536 leveldir_current->readonly)
16538 Request("This level set is read-only!", REQ_CONFIRM);
16543 if (strEqual(levelset_name, ""))
16545 Request("Please enter level set title!", REQ_CONFIRM);
16550 if (strEqual(levelset_author, ""))
16552 Request("Please enter level set author!", REQ_CONFIRM);
16557 if (levelset_save_mode == LEVELSET_SAVE_MODE_UPDATE)
16559 if (UpdateUserLevelSet(levelset_subdir,
16562 levelset_num_levels))
16564 Request("Level set updated!", REQ_CONFIRM);
16568 Request("Updating level set failed!", REQ_CONFIRM);
16571 else if (levelset_save_mode == LEVELSET_SAVE_MODE_CREATE)
16573 if (level.changed && !Request("Level has changed! Discard changes?",
16577 if (CreateUserLevelSet(levelset_subdir,
16580 levelset_num_levels,
16581 levelset_use_levelset_artwork))
16583 if (levelset_copy_level_template)
16584 CopyLevelTemplateToUserLevelSet(levelset_subdir);
16586 Request("New level set created!", REQ_CONFIRM);
16588 AddUserLevelSetToLevelInfo(levelset_subdir);
16589 ChangeEditorToLevelSet(levelset_subdir);
16593 Request("Creating new level set failed!", REQ_CONFIRM);
16597 else if (type_id == ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE &&
16598 custom_element.num_change_pages < MAX_CHANGE_PAGES)
16600 struct ElementInfo *ei = &element_info[properties_element];
16602 // when modifying custom element, ask for copying level template
16603 if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
16606 setElementChangePages(ei, ei->num_change_pages + 1);
16608 // set new change page to be new current change page
16609 ei->current_change_page = ei->num_change_pages - 1;
16610 ei->change = &ei->change_page[ei->current_change_page];
16612 setElementChangeInfoToDefaults(ei->change);
16614 DrawPropertiesWindow();
16616 level.changed = TRUE;
16618 else if (type_id == ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE &&
16619 custom_element.num_change_pages > MIN_CHANGE_PAGES)
16621 struct ElementInfo *ei = &element_info[properties_element];
16623 // when modifying custom element, ask for copying level template
16624 if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
16627 // copy all change pages after change page to be deleted
16628 for (i = ei->current_change_page; i < ei->num_change_pages - 1; i++)
16629 ei->change_page[i] = ei->change_page[i + 1];
16631 setElementChangePages(ei, ei->num_change_pages - 1);
16633 DrawPropertiesWindow();
16635 level.changed = TRUE;
16637 else if (type_id == ED_TEXTBUTTON_ID_BD_SET_RANDOM_COLORS)
16639 SetRandomLevelColors_BD();
16641 // update BD color palette gadgets after setting random colors
16642 DrawLevelConfigWindow();
16646 static void HandleGraphicbuttonGadgets(struct GadgetInfo *gi)
16648 int type_id = gi->custom_type_id;
16650 if (type_id == ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE ||
16651 type_id == ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE)
16653 struct ElementInfo *ei = &element_info[properties_element];
16654 int step = BUTTON_STEPSIZE(gi->event.button);
16656 step *= (type_id == ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE ? -1 : +1);
16657 ei->current_change_page += step;
16659 if (ei->current_change_page < 0)
16660 ei->current_change_page = 0;
16661 else if (ei->current_change_page >= ei->num_change_pages)
16662 ei->current_change_page = ei->num_change_pages - 1;
16664 DrawPropertiesWindow();
16666 else if (type_id == ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE ||
16667 type_id == ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE)
16669 struct ElementInfo *ei = &element_info[properties_element];
16670 int current_change_page = ei->current_change_page;
16672 if (type_id == ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE)
16674 element_info[EL_INTERNAL_CLIPBOARD_CHANGE].change_page[0] =
16675 ei->change_page[current_change_page];
16677 else if (type_id == ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE)
16679 // when modifying custom element, ask for copying level template
16680 if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
16683 ei->change_page[current_change_page] =
16684 element_info[EL_INTERNAL_CLIPBOARD_CHANGE].change_page[0];
16686 level.changed = TRUE;
16689 DrawPropertiesWindow();
16693 static void HandleRadiobuttons(struct GadgetInfo *gi)
16695 int type_id = gi->custom_type_id;
16697 *radiobutton_info[type_id].value =
16698 radiobutton_info[type_id].checked_value;
16700 // do not mark level as modified for certain non-level-changing gadgets
16701 if (type_id >= ED_RADIOBUTTON_ID_EDITOR_FIRST &&
16702 type_id <= ED_RADIOBUTTON_ID_EDITOR_LAST)
16705 level.changed = TRUE;
16708 static void HandleCheckbuttons(struct GadgetInfo *gi)
16710 int type_id = gi->custom_type_id;
16712 *checkbutton_info[type_id].value ^= TRUE;
16714 if (type_id == ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID ||
16715 type_id == ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID ||
16716 type_id == ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH ||
16717 (((type_id >= ED_CHECKBUTTON_ID_CUSTOM_FIRST &&
16718 type_id <= ED_CHECKBUTTON_ID_CUSTOM_LAST) ||
16719 (type_id >= ED_CHECKBUTTON_ID_CHANGE_FIRST &&
16720 type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST)) &&
16721 type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1))
16723 CopyElementPropertiesToGame(properties_element);
16726 if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC)
16728 UpdateCustomElementGraphicGadgets();
16730 else if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1 ||
16731 type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2)
16733 boolean template_related_changes_found = FALSE;
16736 // check if any custom, group or empty elements have been changed
16737 for (i = 0; i < NUM_FILE_ELEMENTS; i++)
16738 if ((IS_CUSTOM_ELEMENT(i) ||
16739 IS_GROUP_ELEMENT(i) ||
16740 IS_EMPTY_ELEMENT(i)) &&
16741 element_info[i].modified_settings)
16742 template_related_changes_found = TRUE;
16744 if (level.use_custom_template &&
16745 !fileExists(getGlobalLevelTemplateFilename()))
16747 Request("No level template found!", REQ_CONFIRM);
16749 level.use_custom_template = FALSE;
16751 ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END);
16756 if (level.use_custom_template &&
16757 template_related_changes_found &&
16758 !Request("Discard changes and use level template?", REQ_ASK))
16760 level.use_custom_template = FALSE;
16762 ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END);
16767 if (!level.use_custom_template &&
16768 Request("Copy settings from level template?", REQ_ASK))
16773 LoadLevelTemplate(level.use_custom_template ? -1 : level_nr);
16775 DrawEditModeWindow();
16777 else if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3)
16779 if (setup.editor.use_template_for_new_levels &&
16780 !fileExists(getGlobalLevelTemplateFilename()))
16782 Request("No level template found!", REQ_CONFIRM);
16787 if (setup.editor.use_template_for_new_levels &&
16789 !Request("Discard level and load template?", REQ_ASK))
16794 if (!setup.editor.use_template_for_new_levels &&
16796 !Request("Discard level and use empty level?", REQ_ASK))
16801 LoadLevel(level_nr);
16802 LoadScore(level_nr);
16807 DrawEditModeWindow();
16809 else if (type_id == ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS)
16811 SetAutomaticNumberOfGemsNeeded();
16814 // do not mark level as modified for certain non-level-changing gadgets
16815 if ((type_id >= ED_CHECKBUTTON_ID_LEVELSET_FIRST &&
16816 type_id <= ED_CHECKBUTTON_ID_LEVELSET_LAST) ||
16817 (type_id >= ED_CHECKBUTTON_ID_EDITOR_FIRST &&
16818 type_id <= ED_CHECKBUTTON_ID_EDITOR_LAST &&
16819 type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2) ||
16820 type_id == ED_CHECKBUTTON_ID_STICK_ELEMENT)
16823 level.changed = TRUE;
16826 static void HandleControlButtons(struct GadgetInfo *gi)
16828 static int last_level_drawing_function = GADGET_ID_SINGLE_ITEMS;
16829 static int last_edit_mode = ED_MODE_DRAWING;
16830 static int last_custom_copy_mode = -1;
16831 static int last_button = 0;
16832 int id = gi->custom_id;
16833 int button = gi->event.button;
16834 int step = BUTTON_STEPSIZE(button);
16835 int new_element = BUTTON_ELEMENT(button);
16836 int last_properties_element = properties_element;
16839 if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT)
16840 DrawLevelText(0, 0, 0, TEXT_END);
16842 if (id < ED_NUM_CTRL1_BUTTONS &&
16843 id != GADGET_ID_SINGLE_ITEMS &&
16844 id != GADGET_ID_PICK_ELEMENT &&
16845 edit_mode != ED_MODE_DRAWING &&
16846 drawing_function != GADGET_ID_PICK_ELEMENT &&
16847 !(GetKeyModState() & KMOD_Control))
16848 ChangeEditModeWindow(ED_MODE_DRAWING);
16850 // element copy mode active, but no element button pressed => deactivate
16851 if (last_custom_copy_mode != -1 && id < ED_NUM_CTRL_BUTTONS)
16852 last_custom_copy_mode = -1;
16854 // when showing palette on element buttons, change element of button used
16855 if (editor.palette.show_on_element_buttons &&
16856 id >= GADGET_ID_ELEMENT_LEFT && id <= GADGET_ID_ELEMENT_RIGHT)
16858 last_button = id - GADGET_ID_ELEMENT_LEFT + 1;
16860 id = GADGET_ID_PALETTE;
16865 case GADGET_ID_SCROLL_LEFT:
16866 if (level_xpos >= 0)
16868 if (lev_fieldx < ed_fieldx - 2)
16871 level_xpos -= step;
16872 if (level_xpos < -1)
16875 ScrollEditorLevel(level_xpos, level_ypos, ED_SCROLL_RIGHT);
16877 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16879 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL],
16880 GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END);
16884 case GADGET_ID_SCROLL_RIGHT:
16885 if (level_xpos <= lev_fieldx - ed_fieldx)
16887 if (lev_fieldx < ed_fieldx - 2)
16890 level_xpos += step;
16891 if (level_xpos > lev_fieldx - ed_fieldx + 1)
16892 level_xpos = lev_fieldx - ed_fieldx + 1;
16894 ScrollEditorLevel(level_xpos, level_ypos, ED_SCROLL_LEFT);
16896 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16898 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL],
16899 GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END);
16903 case GADGET_ID_SCROLL_UP:
16904 if (level_ypos >= 0)
16906 if (lev_fieldy < ed_fieldy - 2)
16909 level_ypos -= step;
16910 if (level_ypos < -1)
16913 ScrollEditorLevel(level_xpos, level_ypos, ED_SCROLL_DOWN);
16915 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16917 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL],
16918 GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END);
16922 case GADGET_ID_SCROLL_DOWN:
16923 if (level_ypos <= lev_fieldy - ed_fieldy)
16925 if (lev_fieldy < ed_fieldy - 2)
16928 level_ypos += step;
16929 if (level_ypos > lev_fieldy - ed_fieldy + 1)
16930 level_ypos = lev_fieldy - ed_fieldy + 1;
16932 ScrollEditorLevel(level_xpos, level_ypos, ED_SCROLL_UP);
16934 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16936 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL],
16937 GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END);
16941 case GADGET_ID_SCROLL_HORIZONTAL:
16942 level_xpos = gi->event.item_position - 1;
16944 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16949 case GADGET_ID_SCROLL_VERTICAL:
16950 level_ypos = gi->event.item_position - 1;
16952 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
16957 case GADGET_ID_SCROLL_LIST_UP:
16958 case GADGET_ID_SCROLL_LIST_DOWN:
16959 case GADGET_ID_SCROLL_LIST_VERTICAL:
16960 if (id == GADGET_ID_SCROLL_LIST_VERTICAL)
16961 element_shift = gi->event.item_position * ED_ELEMENTLIST_BUTTONS_HORIZ;
16964 step *= (id == GADGET_ID_SCROLL_LIST_UP ? -1 : +1);
16965 element_shift += step * ED_ELEMENTLIST_BUTTONS_HORIZ;
16967 if (element_shift < 0)
16969 if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
16970 element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
16972 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
16973 GDI_SCROLLBAR_ITEM_POSITION,
16974 element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
16977 ModifyEditorElementList();
16981 case GADGET_ID_PROPERTIES:
16982 // always switch off element properties when they are already displayed
16983 last_properties_element = new_element;
16984 case GADGET_ID_ELEMENT_LEFT:
16985 case GADGET_ID_ELEMENT_MIDDLE:
16986 case GADGET_ID_ELEMENT_RIGHT:
16987 properties_element = (id == GADGET_ID_ELEMENT_LEFT ? new_element1 :
16988 id == GADGET_ID_ELEMENT_MIDDLE ? new_element2 :
16989 id == GADGET_ID_ELEMENT_RIGHT ? new_element3 :
16992 if (edit_mode != ED_MODE_PROPERTIES)
16994 last_edit_mode = edit_mode;
16996 ChangeEditModeWindow(ED_MODE_PROPERTIES);
16998 last_level_drawing_function = drawing_function;
16999 ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS],
17002 else if (properties_element != last_properties_element)
17004 DrawEditModeWindow();
17008 ChangeEditModeWindow(ED_MODE_DRAWING);
17010 ClickOnGadget(level_editor_gadget[last_level_drawing_function],
17015 case GADGET_ID_PALETTE:
17016 if (edit_mode != ED_MODE_PALETTE)
17018 last_edit_mode = edit_mode;
17020 ChangeEditModeWindow(ED_MODE_PALETTE);
17024 ChangeEditModeWindow(last_edit_mode);
17028 case GADGET_ID_WRAP_LEFT:
17029 WrapLevel(-step, 0);
17032 case GADGET_ID_WRAP_RIGHT:
17033 WrapLevel(step, 0);
17036 case GADGET_ID_WRAP_UP:
17037 WrapLevel(0, -step);
17040 case GADGET_ID_WRAP_DOWN:
17041 WrapLevel(0, step);
17044 case GADGET_ID_SINGLE_ITEMS:
17045 case GADGET_ID_CONNECTED_ITEMS:
17046 case GADGET_ID_LINE:
17047 case GADGET_ID_ARC:
17048 case GADGET_ID_TEXT:
17049 case GADGET_ID_RECTANGLE:
17050 case GADGET_ID_FILLED_BOX:
17051 case GADGET_ID_FLOOD_FILL:
17052 case GADGET_ID_GRAB_BRUSH:
17053 case GADGET_ID_PICK_ELEMENT:
17054 if (drawing_function != GADGET_ID_PICK_ELEMENT)
17055 last_drawing_function = drawing_function;
17056 drawing_function = id;
17057 draw_with_brush = FALSE;
17060 case GADGET_ID_RANDOM_PLACEMENT:
17061 RandomPlacement(new_element);
17064 case GADGET_ID_ZOOM:
17065 // zoom level editor tile size in or out (or reset to default size)
17066 ed_tilesize = (button == 1 ? ed_tilesize * 2 :
17067 button == 2 ? ed_tilesize_default :
17068 button == 3 ? ed_tilesize / 2 : ed_tilesize);
17070 // when using touch device, cycle through all zoom tilesizes
17071 if (runtime.uses_touch_device && ed_tilesize > TILESIZE)
17072 ed_tilesize = MICRO_TILESIZE;
17074 // limit zoom level by upper and lower bound
17075 ed_tilesize = MIN(MAX(MICRO_TILESIZE, ed_tilesize), TILESIZE);
17077 InitZoomLevelSettings(ed_tilesize);
17079 if (edit_mode == ED_MODE_DRAWING)
17081 DrawDrawingWindow();
17083 // redraw zoom gadget info text
17084 PrintEditorGadgetInfoText(level_editor_gadget[id]);
17087 // save current editor zoom tilesize
17088 SaveSetup_AutoSetup();
17092 case GADGET_ID_CUSTOM_COPY_FROM:
17093 case GADGET_ID_CUSTOM_COPY_TO:
17094 case GADGET_ID_CUSTOM_EXCHANGE:
17095 last_custom_copy_mode = id;
17096 last_drawing_function = drawing_function;
17099 case GADGET_ID_CUSTOM_COPY:
17100 CopyCustomElement(properties_element, -1, id);
17103 case GADGET_ID_CUSTOM_PASTE:
17104 CopyCustomElement(-1, properties_element, id);
17107 case GADGET_ID_UNDO:
17108 if (button < 0) // keep button value (even if modifier keys are pressed)
17110 else if (button == 1 && GetKeyModState() & (KMOD_Shift | KMOD_Control))
17113 if (button == 1 && undo_buffer_steps == 0)
17115 Request("Undo buffer empty!", REQ_CONFIRM);
17119 else if (button == 2)
17123 else if (button == 3 && redo_buffer_steps == 0)
17125 Request("Redo buffer empty!", REQ_CONFIRM);
17130 if (edit_mode != ED_MODE_DRAWING)
17131 ChangeEditModeWindow(ED_MODE_DRAWING);
17137 undo_buffer_position =
17138 (undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS;
17140 undo_buffer_steps--;
17141 redo_buffer_steps++;
17147 undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
17149 undo_buffer_steps++;
17150 redo_buffer_steps--;
17153 for (x = 0; x < lev_fieldx; x++)
17154 for (y = 0; y < lev_fieldy; y++)
17155 Tile[x][y] = UndoBuffer[undo_buffer_position][x][y];
17157 // check if undo operation forces change of border style
17158 CheckLevelBorderElement(FALSE);
17160 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
17164 case GADGET_ID_CONF:
17165 if (edit_mode != ED_MODE_LEVELCONFIG)
17167 last_edit_mode = edit_mode;
17169 ChangeEditModeWindow(ED_MODE_LEVELCONFIG);
17173 ChangeEditModeWindow(ED_MODE_DRAWING);
17177 case GADGET_ID_CLEAR:
17178 if (edit_mode != ED_MODE_DRAWING)
17179 ChangeEditModeWindow(ED_MODE_DRAWING);
17181 for (x = 0; x < MAX_LEV_FIELDX; x++)
17182 for (y = 0; y < MAX_LEV_FIELDY; y++)
17183 Tile[x][y] = (button == 1 ? EL_EMPTY : new_element);
17185 CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
17187 DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
17190 case GADGET_ID_SAVE:
17192 // saving read-only levels into personal level set modifies global vars
17193 // "leveldir_current" and "level_nr"; restore them after saving level
17194 LevelDirTree *leveldir_former = leveldir_current;
17195 int level_nr_former = level_nr;
17196 char *level_filename;
17199 if (leveldir_current->readonly &&
17200 !PrepareSavingIntoPersonalLevelSet())
17203 level_filename = getDefaultLevelFilename(level_nr);
17204 new_level = !fileExists(level_filename);
17207 Request("Save this level and kill the old?", REQ_ASK))
17209 if (leveldir_former->readonly)
17210 ModifyLevelConfigForSavingIntoPersonalLevelSet(leveldir_former->name);
17212 SetAutomaticNumberOfGemsNeeded();
17214 CopyPlayfield(Tile, level.field);
17215 SaveLevel(level_nr);
17217 level.changed = FALSE;
17221 char level_saved_msg[64];
17223 if (leveldir_former->readonly)
17224 sprintf(level_saved_msg,
17225 "Level saved as level %d into personal level set!",
17228 strcpy(level_saved_msg, "Level saved!");
17230 Request(level_saved_msg, REQ_CONFIRM);
17234 // "cd" back to copied-from levelset (in case of saved read-only level)
17235 leveldir_current = leveldir_former;
17236 level_nr = level_nr_former;
17241 case GADGET_ID_TEST:
17242 if (LevelChanged())
17243 level.game_version = GAME_VERSION_ACTUAL;
17245 CopyPlayfield(level.field, TileBackup);
17246 CopyPlayfield(Tile, level.field);
17248 CopyNativeLevel_RND_to_Native(&level);
17250 UnmapLevelEditorGadgets();
17251 UndrawSpecialEditorDoor();
17253 CloseDoor(DOOR_CLOSE_ALL);
17255 // needed before playing if editor playfield area has different size
17256 ClearRectangle(drawto, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
17258 // redraw_mask = REDRAW_ALL;
17260 level_editor_test_game = TRUE;
17262 StartGameActions(FALSE, setup.autorecord, level.random_seed);
17266 case GADGET_ID_EXIT:
17267 RequestExitLevelEditor(TRUE, FALSE); // if level has changed, ask user
17271 if (id >= GADGET_ID_ELEMENTLIST_FIRST &&
17272 id <= GADGET_ID_ELEMENTLIST_LAST)
17274 int element_position = id - GADGET_ID_ELEMENTLIST_FIRST;
17276 new_element = editor_elements[element_position + element_shift];
17278 if (IS_EDITOR_CASCADE(new_element))
17282 for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
17284 int *cascade_element = &(*editor_elements_info[i].headline_list)[0];
17285 boolean *cascade_value = editor_elements_info[i].setup_cascade_value;
17287 if (*cascade_element == new_element)
17289 *cascade_element = EL_CASCADE_TOGGLE(*cascade_element);
17290 *cascade_value = IS_EDITOR_CASCADE_ACTIVE(*cascade_element);
17292 // update element selection list
17293 ReinitializeElementList();
17294 ModifyEditorElementList();
17296 // update cascading gadget info text
17297 PrintEditorGadgetInfoText(level_editor_gadget[id]);
17299 // save current editor cascading state
17300 SaveSetup_EditorCascade();
17309 if (last_custom_copy_mode != -1)
17311 if (CopyCustomElement(properties_element, new_element,
17312 last_custom_copy_mode))
17314 ClickOnGadget(level_editor_gadget[last_drawing_function],
17317 last_custom_copy_mode = -1;
17323 // change element of button used to show palette
17324 if (editor.palette.show_on_element_buttons)
17325 button = last_button;
17327 PickDrawingElement(button, new_element);
17329 if (!stick_element_properties_window &&
17330 drawing_function != GADGET_ID_PICK_ELEMENT &&
17331 !(GetKeyModState() & KMOD_Control))
17333 properties_element = new_element;
17334 if (edit_mode == ED_MODE_PROPERTIES)
17335 DrawPropertiesWindow();
17338 if (drawing_function == GADGET_ID_PICK_ELEMENT)
17339 ClickOnGadget(level_editor_gadget[last_drawing_function],
17342 if (!use_permanent_palette)
17343 ChangeEditModeWindow(last_edit_mode);
17346 else if (gi->event.type == GD_EVENT_PRESSED)
17347 Debug("editor", "default: HandleControlButtons: GD_EVENT_PRESSED(%d)", id);
17348 else if (gi->event.type == GD_EVENT_RELEASED)
17349 Debug("editor", "default: HandleControlButtons: GD_EVENT_RELEASED(%d)", id);
17350 else if (gi->event.type == GD_EVENT_MOVING)
17351 Debug("editor", "default: HandleControlButtons: GD_EVENT_MOVING(%d)", id);
17353 Debug("editor", "default: HandleControlButtons: ? (id == %d)", id);
17359 void HandleLevelEditorKeyInput(Key key)
17361 char letter = getCharFromKey(key);
17363 if (drawing_function == GADGET_ID_TEXT &&
17364 DrawLevelText(0, 0, 0, TEXT_QUERY_TYPING) == TRUE)
17367 DrawLevelText(0, 0, letter, TEXT_WRITECHAR);
17368 else if (key == KSYM_Delete || key == KSYM_BackSpace)
17369 DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
17370 else if (key == KSYM_Return)
17371 DrawLevelText(0, 0, 0, TEXT_NEWLINE);
17372 else if (key == KSYM_Escape)
17373 DrawLevelText(0, 0, 0, TEXT_END);
17378 int id = GADGET_ID_NONE;
17379 int new_element_shift = element_shift;
17380 int step = ED_ELEMENTLIST_BUTTONS_VERT - 1;
17381 int button = MB_LEFTBUTTON;
17387 id = GADGET_ID_SCROLL_LEFT;
17390 id = GADGET_ID_SCROLL_RIGHT;
17393 id = GADGET_ID_SCROLL_UP;
17396 id = GADGET_ID_SCROLL_DOWN;
17400 case KSYM_Page_Down:
17401 step *= (key == KSYM_Page_Up ? -1 : +1);
17402 element_shift += step * ED_ELEMENTLIST_BUTTONS_HORIZ;
17404 if (element_shift < 0)
17406 if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
17407 element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
17409 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
17410 GDI_SCROLLBAR_ITEM_POSITION,
17411 element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
17413 ModifyEditorElementList();
17419 element_shift = (key == KSYM_Home ? 0 :
17420 num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS);
17422 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
17423 GDI_SCROLLBAR_ITEM_POSITION,
17424 element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
17426 ModifyEditorElementList();
17433 // this is needed to prevent interference with running "True X-Mouse"
17434 if (GetKeyModStateFromEvents() & KMOD_Control)
17437 // check for last or next editor cascade block in element list
17438 for (i = 0; i < num_editor_elements; i++)
17440 if ((key == KSYM_Insert && i == element_shift) ||
17441 (key == KSYM_Delete && new_element_shift > element_shift))
17444 // jump to next cascade block (or to start of element list)
17445 if (i == 0 || IS_EDITOR_CASCADE(editor_elements[i]))
17446 new_element_shift = i;
17449 if (i < num_editor_elements)
17450 element_shift = new_element_shift;
17452 if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
17453 element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
17455 ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
17456 GDI_SCROLLBAR_ITEM_POSITION,
17457 element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
17459 ModifyEditorElementList();
17464 if (edit_mode == ED_MODE_DRAWING)
17465 RequestExitLevelEditor(setup.ask_on_escape_editor, TRUE);
17466 else if (edit_mode == ED_MODE_LEVELCONFIG)
17467 HandleControlButtons(level_editor_gadget[GADGET_ID_CONF]);
17468 else if (edit_mode == ED_MODE_PROPERTIES)
17469 HandleControlButtons(level_editor_gadget[GADGET_ID_PROPERTIES]);
17470 else if (edit_mode == ED_MODE_PALETTE)
17471 HandleControlButtons(level_editor_gadget[GADGET_ID_PALETTE]);
17472 else // should never happen
17473 ChangeEditModeWindow(ED_MODE_DRAWING);
17481 if (id != GADGET_ID_NONE)
17482 ClickOnGadget(level_editor_gadget[id], button);
17483 else if (letter == '1' || letter == '?')
17484 ClickOnGadget(level_editor_gadget[GADGET_ID_ELEMENT_LEFT], button);
17485 else if (letter == '2')
17486 ClickOnGadget(level_editor_gadget[GADGET_ID_ELEMENT_MIDDLE], button);
17487 else if (letter == '3')
17488 ClickOnGadget(level_editor_gadget[GADGET_ID_ELEMENT_RIGHT], button);
17489 else if (letter == '.')
17490 ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], button);
17491 else if (letter == 'U')
17492 ClickOnGadget(level_editor_gadget[GADGET_ID_UNDO], 3);
17493 else if (letter == '-' || key == KSYM_KP_Subtract)
17494 ClickOnGadget(level_editor_gadget[GADGET_ID_ZOOM], 3);
17495 else if (letter == '0' || key == KSYM_KP_0)
17496 ClickOnGadget(level_editor_gadget[GADGET_ID_ZOOM], 2);
17497 else if (letter == '+' || key == KSYM_KP_Add ||
17498 letter == '=') // ("Shift-=" is "+" on US keyboards)
17499 ClickOnGadget(level_editor_gadget[GADGET_ID_ZOOM], 1);
17500 else if (key == KSYM_Return ||
17501 key == KSYM_space ||
17502 key == setup.shortcut.toggle_pause)
17503 ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
17505 for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
17506 if (letter && letter == controlbutton_info[i].shortcut)
17507 if (!anyTextGadgetActive())
17508 ClickOnGadget(level_editor_gadget[i], button);
17510 if (draw_with_brush)
17514 else if (letter == 'y')
17516 else if (letter == 'z')
17521 static void HandleLevelEditorIdle_Properties(void)
17523 int element_border = graphic_info[IMG_EDITOR_ELEMENT_BORDER].border_size;
17524 int x = editor.settings.element_graphic.x + element_border;
17525 int y = editor.settings.element_graphic.y + element_border;
17526 static DelayCounter action_delay = { 0 };
17529 action_delay.value = GameFrameDelay;
17531 if (!DelayReached(&action_delay))
17534 for (i = 0; i < ED_NUM_SELECTBOX; i++)
17536 struct GadgetInfo *gi = level_editor_gadget[selectbox_info[i].gadget_id];
17538 if (gi->mapped && gi->active && gi->selectbox.open)
17542 DrawEditorElementAnimation(SX + x, SY + y);
17544 redraw_mask |= REDRAW_FIELD;
17546 FrameCounter++; // increase animation frame counter
17549 static void HandleLevelEditorIdle_Drawing(void)
17551 static boolean last_highlighted = FALSE;
17552 static boolean last_highlighted_similar = FALSE;
17553 boolean highlighted = (GetKeyModState() & KMOD_Alt);
17554 boolean highlighted_similar = (GetKeyModState() & KMOD_Shift);
17556 if (highlighted != last_highlighted ||
17557 (highlighted && highlighted_similar != last_highlighted_similar))
17559 DrawAreaElementHighlight(highlighted, highlighted_similar);
17561 redraw_mask |= REDRAW_FIELD;
17564 last_highlighted = highlighted;
17565 last_highlighted_similar = highlighted_similar;
17568 void HandleLevelEditorIdle(void)
17570 if (edit_mode == ED_MODE_PROPERTIES)
17571 HandleLevelEditorIdle_Properties();
17572 else if (edit_mode == ED_MODE_DRAWING)
17573 HandleLevelEditorIdle_Drawing();
17576 static void ClearEditorGadgetInfoText(void)
17578 DrawBackground(INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
17581 void PrintEditorGadgetInfoText(struct GadgetInfo *gi)
17583 char infotext[MAX_OUTPUT_LINESIZE + 1];
17584 int max_infotext_len = getMaxInfoTextLength();
17586 if (gi == NULL || strlen(gi->info_text) == 0)
17589 strncpy(infotext, gi->info_text, max_infotext_len);
17590 infotext[max_infotext_len] = '\0';
17592 if (gi->custom_id < ED_NUM_CTRL_BUTTONS)
17594 int key = controlbutton_info[gi->custom_id].shortcut;
17598 char shortcut[MAX_OUTPUT_LINESIZE + 1];
17600 if (gi->custom_id == GADGET_ID_SINGLE_ITEMS)
17601 sprintf(shortcut, " ('.' or '%c')", key);
17602 else if (gi->custom_id == GADGET_ID_PICK_ELEMENT)
17603 sprintf(shortcut, " ('%c' or 'Ctrl')", key);
17604 else if (gi->custom_id == GADGET_ID_TEST)
17605 sprintf(shortcut, " ('Enter' or 'Shift-%c')", key);
17606 else if (gi->custom_id == GADGET_ID_UNDO)
17607 sprintf(shortcut, " ('%c/Shift-U')", key);
17608 else if (gi->custom_id == GADGET_ID_ZOOM)
17609 sprintf(shortcut, " ('%c', '0', '-')", key);
17611 sprintf(shortcut, " ('%s%c')",
17612 (key >= 'A' && key <= 'Z' ? "Shift-" : ""), key);
17614 if (strlen(infotext) + strlen(shortcut) <= max_infotext_len)
17615 strcat(infotext, shortcut);
17619 DrawText(INFOTEXT_XPOS, INFOTEXT_YPOS, infotext, INFOTEXT_FONT);
17622 void HandleEditorGadgetInfoText(void *ptr)
17624 struct GadgetInfo *gi = (struct GadgetInfo *)ptr;
17626 if (game_status != GAME_MODE_EDITOR)
17629 ClearEditorGadgetInfoText();
17631 if (gi == NULL || gi->event.type == GD_EVENT_INFO_LEAVING)
17634 // misuse this function to delete brush cursor, if needed
17635 if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
17636 DeleteBrushFromCursor();
17638 PrintEditorGadgetInfoText(gi);
17641 static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
17643 int id = gi->custom_id;
17644 int type_id = gi->custom_type_id;
17645 int sx = gi->event.x;
17646 int sy = gi->event.y;
17647 int lx = sx + level_xpos;
17648 int ly = sy + level_ypos;
17649 int min_sx = 0, min_sy = 0;
17650 int max_sx = gi->drawing.area_xsize - 1;
17651 int max_sy = gi->drawing.area_ysize - 1;
17652 int actual_drawing_function = drawing_function;
17653 int max_infotext_len = getMaxInfoTextLength();
17654 char infotext[MAX_OUTPUT_LINESIZE + 1];
17656 infotext[0] = '\0'; // start with empty info text
17658 // pressed Control key: simulate picking element
17659 if (GetKeyModState() & KMOD_Control)
17660 actual_drawing_function = GADGET_ID_PICK_ELEMENT;
17662 ClearEditorGadgetInfoText();
17664 if (gi->event.type == GD_EVENT_INFO_LEAVING)
17667 // make sure to stay inside drawing area boundaries
17668 sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
17669 sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);
17671 if (id == GADGET_ID_DRAWING_LEVEL)
17675 int min_lx = 0, min_ly = 0;
17676 int max_lx = lev_fieldx - 1, max_ly = lev_fieldy - 1;
17678 // get positions inside level field
17679 lx = sx + level_xpos;
17680 ly = sy + level_ypos;
17682 // make sure to stay inside level field boundaries
17683 lx = (lx < min_lx ? min_lx : lx > max_lx ? max_lx : lx);
17684 ly = (ly < min_ly ? min_ly : ly > max_ly ? max_ly : ly);
17686 // correct drawing area positions accordingly
17687 sx = lx - level_xpos;
17688 sy = ly - level_ypos;
17691 if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
17693 if (button_status) // if (gi->state == GD_BUTTON_PRESSED)
17695 static int start_lx = 0;
17696 static int start_ly = 0;
17699 if (gi->event.type == GD_EVENT_PRESSED)
17705 switch (actual_drawing_function)
17707 case GADGET_ID_SINGLE_ITEMS:
17708 text = "Drawing single items";
17710 case GADGET_ID_CONNECTED_ITEMS:
17711 text = "Drawing connected items";
17713 case GADGET_ID_LINE:
17714 text = "Drawing line";
17716 case GADGET_ID_ARC:
17717 text = "Drawing arc";
17719 case GADGET_ID_TEXT:
17720 text = "Setting text cursor";
17722 case GADGET_ID_RECTANGLE:
17723 text = "Drawing rectangle";
17725 case GADGET_ID_FILLED_BOX:
17726 text = "Drawing filled box";
17728 case GADGET_ID_FLOOD_FILL:
17729 text = "Flood fill";
17731 case GADGET_ID_GRAB_BRUSH:
17732 text = "Grabbing brush";
17734 case GADGET_ID_PICK_ELEMENT:
17735 text = "Picking element";
17739 text = "Drawing position";
17743 if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
17744 sprintf(infotext, "%s: %d, %d", text, lx, ly);
17746 sprintf(infotext, "%s: %d, %d", text,
17747 ABS(lx - start_lx) + 1, ABS(ly - start_ly) + 1);
17749 else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
17750 strncpy(infotext, getElementInfoText(Tile[lx][ly]), max_infotext_len);
17752 sprintf(infotext, "Level position: %d, %d", lx, ly);
17755 // misuse this function to draw brush cursor, if needed
17756 if (edit_mode == ED_MODE_DRAWING && draw_with_brush && !button_status)
17758 if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
17759 CopyBrushToCursor(sx, sy);
17761 DeleteBrushFromCursor();
17764 if (!draw_with_brush)
17765 UpdateBrushPosition(sx, sy);
17767 else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
17769 int pos = sx * drawingarea_info[type_id].area_ysize + sy;
17770 int element = drawingarea_info[type_id].value[pos];
17772 strncpy(infotext, getElementInfoText(element), max_infotext_len);
17776 if (id == GADGET_ID_CUSTOM_CONTENT)
17777 sprintf(infotext, "custom element content position: %d, %d", sx, sy);
17778 else if (id == GADGET_ID_GROUP_CONTENT)
17779 sprintf(infotext, "group element position: %d", sx + 1);
17780 else if (id >= GADGET_ID_YAMYAM_CONTENT_0 &&
17781 id <= GADGET_ID_YAMYAM_CONTENT_7)
17782 sprintf(infotext, "content area %d position: %d, %d",
17783 id - GADGET_ID_YAMYAM_CONTENT_0 + 1, sx, sy);
17784 else if (id >= GADGET_ID_MAGIC_BALL_CONTENT_0 &&
17785 id <= GADGET_ID_MAGIC_BALL_CONTENT_7)
17786 sprintf(infotext, "content area %d position: %d, %d",
17787 id - GADGET_ID_MAGIC_BALL_CONTENT_0 + 1, sx, sy);
17788 else if (id == GADGET_ID_ANDROID_CONTENT)
17789 sprintf(infotext, "android element position: %d", sx + 1);
17790 else if (drawingarea_info[type_id].infotext != NULL)
17791 strcpy(infotext, drawingarea_info[type_id].infotext);
17794 infotext[max_infotext_len] = '\0';
17796 if (strlen(infotext) > 0)
17797 DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, INFOTEXT_FONT, infotext);
17800 void RequestExitLevelEditor(boolean ask_if_level_has_changed,
17801 boolean quick_quit)
17803 if (!ask_if_level_has_changed ||
17805 Request("Level has changed! Exit without saving?",
17806 REQ_ASK | REQ_STAY_OPEN))
17808 struct RectWithBorder *vp_door_1 = &viewport.door_1[GAME_MODE_MAIN];
17809 struct RectWithBorder *vp_door_2 = &viewport.door_2[GAME_MODE_MAIN];
17811 // draw normal door
17812 UndrawSpecialEditorDoor();
17814 // use door animation if door 1 viewport is unchanged and contains toolbox
17815 if (useEditorDoorAnimation())
17816 CloseDoor(DOOR_CLOSE_1 | DOOR_FORCE_ANIM);
17818 // close editor doors if viewport definition is the same as in main menu
17819 if (vp_door_1->x == DX &&
17820 vp_door_1->y == DY &&
17821 vp_door_1->width == DXSIZE &&
17822 vp_door_1->height == DYSIZE &&
17823 vp_door_2->x == VX &&
17824 vp_door_2->y == VY &&
17825 vp_door_2->width == VXSIZE &&
17826 vp_door_2->height == VYSIZE)
17827 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
17829 SetDoorState(DOOR_CLOSE_ALL);
17834 FadeSkipNextFadeIn();
17836 SetGameStatus(GAME_MODE_MAIN);
17842 if (!global.use_envelope_request)
17844 CloseDoor(DOOR_CLOSE_1);
17845 OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);