/***********************************************************
-* Rocks'n'Diamonds -- McDuffin Strikes Back! *
+* Rocks'n'Diamonds -- McDuffin Strikes Back! *
*----------------------------------------------------------*
-* (c) 1995-98 Artsoft Entertainment *
-* Holger Schemel *
-* Oststrasse 11a *
-* 33604 Bielefeld *
-* phone: ++49 +521 290471 *
-* email: aeglos@valinor.owl.de *
+* (c) 1995-2002 Artsoft Entertainment *
+* Holger Schemel *
+* Detmolder Strasse 189 *
+* 33604 Bielefeld *
+* Germany *
+* e-mail: info@artsoft.org *
*----------------------------------------------------------*
-* editor.c *
+* editor.c *
***********************************************************/
#include <math.h>
#include "tools.h"
#include "files.h"
#include "game.h"
+#include "init.h"
#include "tape.h"
+
+#define INFOTEXT_UNKNOWN_ELEMENT "unknown"
+
+
+/*
+ -----------------------------------------------------------------------------
+ screen and artwork graphic pixel position definitions
+ -----------------------------------------------------------------------------
+*/
+
/* positions in the level editor */
#define ED_WIN_MB_LEFT_XPOS 6
#define ED_WIN_MB_LEFT_YPOS 258
#define ED_WIN_MB_RIGHT_XPOS 78
#define ED_WIN_MB_RIGHT_YPOS ED_WIN_MB_LEFT_YPOS
-/* other constants for the editor */
-#define ED_SCROLL_NO 0
-#define ED_SCROLL_LEFT 1
-#define ED_SCROLL_RIGHT 2
-#define ED_SCROLL_UP 4
-#define ED_SCROLL_DOWN 8
-
-/* screens in the level editor */
-#define ED_MODE_DRAWING 0
-#define ED_MODE_INFO 1
-#define ED_MODE_PROPERTIES 2
-
-/* how many steps can be cancelled */
-#define NUM_UNDO_STEPS (10 + 1)
-
-/* values for elements with score */
-#define MIN_SCORE 0
-#define MAX_SCORE 255
-
/* values for the control window */
-#define ED_CTRL_BUTTONS_GFX_YPOS 236
-#define ED_CTRL_BUTTONS_ALT_GFX_YPOS 142
+#define ED_CTRL_NO_BUTTONS_GFX_XPOS 6
+#define ED_CTRL_NO_BUTTONS_GFX_YPOS 286
+#define ED_CTRL1_BUTTONS_GFX_YPOS 236
+#define ED_CTRL2_BUTTONS_GFX_YPOS 236
+#define ED_CTRL3_BUTTONS_GFX_YPOS 324
+#define ED_CTRL1_BUTTONS_ALT_GFX_YPOS 142
+#define ED_CTRL3_BUTTONS_ALT_GFX_YPOS 302
-#define ED_CTRL1_BUTTONS_HORIZ 4
-#define ED_CTRL1_BUTTONS_VERT 4
#define ED_CTRL1_BUTTON_XSIZE 22
#define ED_CTRL1_BUTTON_YSIZE 22
#define ED_CTRL1_BUTTONS_XPOS 6
#define ED_CTRL1_BUTTONS_YPOS 6
-#define ED_CTRL2_BUTTONS_HORIZ 3
-#define ED_CTRL2_BUTTONS_VERT 2
#define ED_CTRL2_BUTTON_XSIZE 30
#define ED_CTRL2_BUTTON_YSIZE 20
#define ED_CTRL2_BUTTONS_XPOS 5
#define ED_CTRL2_BUTTONS_YPOS 99
+#define ED_CTRL3_BUTTON_XSIZE 22
+#define ED_CTRL3_BUTTON_YSIZE 22
+#define ED_CTRL3_BUTTONS_XPOS 6
+#define ED_CTRL3_BUTTONS_YPOS 6
+
+#define ED_CTRL1_BUTTONS_HORIZ 4
+#define ED_CTRL1_BUTTONS_VERT 4
+#define ED_CTRL2_BUTTONS_HORIZ 3
+#define ED_CTRL2_BUTTONS_VERT 2
+#define ED_CTRL3_BUTTONS_HORIZ 3
+#define ED_CTRL3_BUTTONS_VERT 1
+
#define ED_NUM_CTRL1_BUTTONS (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
#define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
-#define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS)
+#define ED_NUM_CTRL3_BUTTONS (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT)
+#define ED_NUM_CTRL1_2_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS)
+#define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + \
+ ED_NUM_CTRL2_BUTTONS + \
+ ED_NUM_CTRL3_BUTTONS)
/* values for the element list */
#define ED_ELEMENTLIST_XPOS 5
#define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \
ED_ELEMENTLIST_BUTTONS_VERT)
+/* standard distances */
+#define ED_BORDER_SIZE 3
+#define ED_BORDER_TEXT_XSIZE 5
+#define ED_BORDER_AREA_YSIZE 1
+
+#define ED_GADGET_DISTANCE 2
+#define ED_GADGET_TEXT_DISTANCE (2 * ED_GADGET_DISTANCE)
+#define ED_DRAWINGAREA_TEXT_DISTANCE (ED_GADGET_TEXT_DISTANCE + \
+ MINI_TILEX / 2)
+
/* values for the setting windows */
-#define ED_SETTINGS_XPOS (MINI_TILEX + 8)
+#define ED_SETTINGS_XSTART (3 * MINI_TILEX / 2)
+#define ED_SETTINGS_YSTART (MINI_TILEY * 10)
+
+#define ED_XOFFSET_CHECKBOX (ED_CHECKBUTTON_XSIZE + \
+ 2 * ED_GADGET_DISTANCE)
+
+#define ED_SETTINGS_XOFFSET ED_XOFFSET_CHECKBOX
+#define ED_SETTINGS_YOFFSET (3 * MINI_TILEY / 2)
+
+#define ED_SETTINGS_XPOS(n) (ED_SETTINGS_XSTART + \
+ (n) * ED_SETTINGS_XOFFSET)
+#define ED_SETTINGS_YPOS(n) (ED_SETTINGS_YSTART + \
+ (n) * ED_SETTINGS_YOFFSET)
+
+#define ED_SETTINGS1_YPOS MINI_TILEY
#define ED_SETTINGS2_XPOS MINI_TILEX
-#define ED_SETTINGS_YPOS MINI_TILEY
-#define ED_SETTINGS2_YPOS (ED_SETTINGS_YPOS + 12 * TILEY - 2)
+#define ED_SETTINGS2_YPOS (ED_SETTINGS1_YPOS + 12 * TILEY - 2)
/* values for counter gadgets */
-#define ED_COUNT_ELEM_SCORE_XPOS ED_SETTINGS_XPOS
-#define ED_COUNT_ELEM_SCORE_YPOS (14 * MINI_TILEY)
-#define ED_COUNT_ELEM_CONTENT_XPOS ED_SETTINGS_XPOS
-#define ED_COUNT_ELEM_CONTENT_YPOS (19 * MINI_TILEY)
-
-#define ED_COUNTER_YSTART (ED_SETTINGS_YPOS + 2 * TILEY)
+#define ED_COUNTER_YSTART (ED_SETTINGS1_YPOS + 2 * TILEY)
#define ED_COUNTER_YDISTANCE (3 * MINI_TILEY)
#define ED_COUNTER_YPOS(n) (ED_COUNTER_YSTART + \
- n * ED_COUNTER_YDISTANCE)
+ (n) * ED_COUNTER_YDISTANCE)
#define ED_COUNTER2_YPOS(n) (ED_COUNTER_YSTART + \
- n * ED_COUNTER_YDISTANCE - 2)
-/* standard distances */
-#define ED_BORDER_SIZE 3
-#define ED_GADGET_DISTANCE 2
+ (n) * ED_COUNTER_YDISTANCE - 2)
/* values for element content drawing areas */
-#define ED_AREA_ELEM_CONTENT_XPOS ( 2 * MINI_TILEX)
-#define ED_AREA_ELEM_CONTENT_YPOS (22 * MINI_TILEY)
+/* amoeba content */
+#define ED_AREA_AMOEBA_CONTENT_XPOS ED_SETTINGS_XPOS(0)
+#define ED_AREA_AMOEBA_CONTENT_YPOS (ED_SETTINGS_YPOS(2) + \
+ ED_GADGET_DISTANCE)
+
+/* yamyam content */
+#define ED_AREA_YAMYAM_CONTENT_XPOS(n) (2 * MINI_TILEX + \
+ 5 * ((n) % 4) * MINI_TILEX)
+#define ED_AREA_YAMYAM_CONTENT_YPOS(n) (17 * MINI_TILEY + \
+ 6 * ((n) / 4) * MINI_TILEY)
+
+/* custom change target */
+#define ED_AREA_ELEM_CONTENT2_YPOS (ED_SETTINGS_YPOS(1) + \
+ ED_GADGET_DISTANCE)
+/* optional custom graphic */
+#define ED_AREA_ELEM_CONTENT3_YPOS (ED_SETTINGS_YPOS(1) + \
+ ED_GADGET_DISTANCE)
+/* custom element content */
+#define ED_AREA_ELEM_CONTENT4_XPOS (29 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT4_YPOS (ED_SETTINGS_YPOS(2) + \
+ ED_GADGET_DISTANCE - MINI_TILEY)
+/* movement enter/leave element */
+#define ED_AREA_ELEM_CONTENT4a_XPOS (29 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT4a_YPOS (ED_SETTINGS_YPOS(10) + \
+ ED_GADGET_DISTANCE)
+#define ED_AREA_ELEM_CONTENT4b_XPOS (29 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT4b_YPOS (ED_SETTINGS_YPOS(10) + \
+ ED_GADGET_DISTANCE)
+/* custom change trigger element */
+#define ED_AREA_ELEM_CONTENT5_YPOS (ED_SETTINGS_YPOS(5) + \
+ ED_GADGET_DISTANCE)
+/* extended custom change target */
+#define ED_AREA_ELEM_CONTENT6_XPOS (29 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT6_YPOS (ED_SETTINGS_YPOS(9) + \
+ ED_GADGET_DISTANCE - MINI_TILEY)
+/* group element content */
+#define ED_AREA_GROUP_CONTENT_XPOS ED_SETTINGS_XPOS(0)
+#if 1
+#define ED_AREA_GROUP_CONTENT_YPOS (ED_SETTINGS_YPOS(4) + \
+ ED_GADGET_DISTANCE)
+#else
+#define ED_AREA_GROUP_CONTENT_YPOS (22 * MINI_TILEY)
+#endif
/* values for random placement background drawing area */
-#define ED_AREA_RANDOM_BACKGROUND_XPOS (29 * MINI_TILEX)
#define ED_AREA_RANDOM_BACKGROUND_YPOS (31 * MINI_TILEY)
/* values for scrolling gadgets for drawing area */
#define ED_STICKYBUTTON_YPOS (ED_BUTTON_MINUS_YPOS + 66)
/* some positions in the editor control window */
-#define ED_BUTTON_ELEM_XPOS 6
-#define ED_BUTTON_ELEM_YPOS 30
-#define ED_BUTTON_ELEM_XSIZE 22
-#define ED_BUTTON_ELEM_YSIZE 22
-
-/* some values for text input and counter gadgets */
-#define ED_BUTTON_COUNT_YPOS 60
-#define ED_BUTTON_COUNT_XSIZE 20
-#define ED_BUTTON_COUNT_YSIZE 20
-#define ED_WIN_COUNT_XPOS (2 + ED_BUTTON_COUNT_XSIZE + 2)
-#define ED_WIN_COUNT_YPOS ED_BUTTON_COUNT_YPOS
-#define ED_WIN_COUNT_XSIZE 52
-#define ED_WIN_COUNT_YSIZE ED_BUTTON_COUNT_YSIZE
-#define ED_WIN_COUNT2_XPOS 27
-#define ED_WIN_COUNT2_YPOS 3
-#define ED_WIN_COUNT2_XSIZE 46
-#define ED_WIN_COUNT2_YSIZE ED_BUTTON_COUNT_YSIZE
-
-#define ED_BUTTON_MINUS_XPOS 2
-#define ED_BUTTON_MINUS_YPOS ED_BUTTON_COUNT_YPOS
-#define ED_BUTTON_MINUS_XSIZE ED_BUTTON_COUNT_XSIZE
-#define ED_BUTTON_MINUS_YSIZE ED_BUTTON_COUNT_YSIZE
-#define ED_BUTTON_PLUS_XPOS (ED_WIN_COUNT_XPOS + ED_WIN_COUNT_XSIZE + 2)
-#define ED_BUTTON_PLUS_YPOS ED_BUTTON_COUNT_YPOS
-#define ED_BUTTON_PLUS_XSIZE ED_BUTTON_COUNT_XSIZE
-#define ED_BUTTON_PLUS_YSIZE ED_BUTTON_COUNT_YSIZE
-
-/* editor gadget identifiers */
+#define ED_BUTTON_ELEM_XPOS 6
+#define ED_BUTTON_ELEM_YPOS 30
+#define ED_BUTTON_ELEM_XSIZE 22
+#define ED_BUTTON_ELEM_YSIZE 22
+
+/* some values for text input, selectbox and counter gadgets */
+#define ED_BUTTON_COUNT_YPOS 60
+#define ED_BUTTON_COUNT_XSIZE 20
+#define ED_BUTTON_COUNT_YSIZE 20
+#define ED_WIN_COUNT_XPOS (2 + ED_BUTTON_COUNT_XSIZE + 2)
+#define ED_WIN_COUNT_YPOS ED_BUTTON_COUNT_YPOS
+#define ED_WIN_COUNT_XSIZE 52
+#define ED_WIN_COUNT_YSIZE ED_BUTTON_COUNT_YSIZE
+#define ED_WIN_COUNT2_XPOS 27
+#define ED_WIN_COUNT2_YPOS 3
+#define ED_WIN_COUNT2_XSIZE 46
+#define ED_WIN_COUNT2_YSIZE ED_BUTTON_COUNT_YSIZE
+
+#define ED_BUTTON_MINUS_XPOS 2
+#define ED_BUTTON_MINUS_YPOS ED_BUTTON_COUNT_YPOS
+#define ED_BUTTON_MINUS_XSIZE ED_BUTTON_COUNT_XSIZE
+#define ED_BUTTON_MINUS_YSIZE ED_BUTTON_COUNT_YSIZE
+#define ED_BUTTON_PLUS_XPOS (ED_WIN_COUNT_XPOS + \
+ ED_WIN_COUNT_XSIZE + 2)
+#define ED_BUTTON_PLUS_YPOS ED_BUTTON_COUNT_YPOS
+#define ED_BUTTON_PLUS_XSIZE ED_BUTTON_COUNT_XSIZE
+#define ED_BUTTON_PLUS_YSIZE ED_BUTTON_COUNT_YSIZE
+
+#define ED_SELECTBOX_XPOS ED_WIN_COUNT_XPOS
+#define ED_SELECTBOX_YPOS (ED_WIN_COUNT_YPOS + \
+ 2 + ED_WIN_COUNT_YSIZE)
+#define ED_SELECTBOX_XSIZE ED_WIN_COUNT_XSIZE
+#define ED_SELECTBOX_YSIZE ED_WIN_COUNT_YSIZE
+
+#define ED_SELECTBOX_BUTTON_XSIZE 14
+
+#define ED_TEXTBUTTON_XPOS ED_WIN_COUNT_XPOS
+#define ED_TEXTBUTTON_YPOS (ED_WIN_COUNT_YPOS + \
+ 4 * (2 + ED_WIN_COUNT_YSIZE))
+#define ED_TEXTBUTTON_INACTIVE_YPOS ED_TEXTBUTTON_YPOS
+
+#define ED_TEXTBUTTON_TAB_XPOS ED_WIN_COUNT_XPOS
+#define ED_TEXTBUTTON_TAB_YPOS (ED_WIN_COUNT_YPOS + \
+ 2 * (2 + ED_WIN_COUNT_YSIZE))
+#define ED_TEXTBUTTON_TAB_INACTIVE_YPOS (ED_WIN_COUNT_YPOS + \
+ 3 * (2 + ED_WIN_COUNT_YSIZE))
+
+#define ED_TEXTBUTTON_XSIZE ED_WIN_COUNT_XSIZE
+#define ED_TEXTBUTTON_YSIZE ED_WIN_COUNT_YSIZE
+
+/* values for ClearEditorGadgetInfoText() and HandleGadgetInfoText() */
+#define INFOTEXT_XPOS SX
+#define INFOTEXT_YPOS (SY + SYSIZE - MINI_TILEX + 2)
+#define INFOTEXT_XSIZE SXSIZE
+#define INFOTEXT_YSIZE MINI_TILEX
+
+
+/*
+ -----------------------------------------------------------------------------
+ editor gadget definitions
+ -----------------------------------------------------------------------------
+*/
/* drawing toolbox buttons */
#define GADGET_ID_NONE -1
-#define GADGET_ID_SINGLE_ITEMS 0
-#define GADGET_ID_CONNECTED_ITEMS 1
-#define GADGET_ID_LINE 2
-#define GADGET_ID_ARC 3
-#define GADGET_ID_RECTANGLE 4
-#define GADGET_ID_FILLED_BOX 5
-#define GADGET_ID_WRAP_UP 6
-#define GADGET_ID_TEXT 7
-#define GADGET_ID_FLOOD_FILL 8
-#define GADGET_ID_WRAP_LEFT 9
-#define GADGET_ID_PROPERTIES 10
-#define GADGET_ID_WRAP_RIGHT 11
-#define GADGET_ID_RANDOM_PLACEMENT 12
-#define GADGET_ID_GRAB_BRUSH 13
-#define GADGET_ID_WRAP_DOWN 14
-#define GADGET_ID_PICK_ELEMENT 15
-#define GADGET_ID_UNDO 16
-#define GADGET_ID_INFO 17
-#define GADGET_ID_SAVE 18
-#define GADGET_ID_CLEAR 19
-#define GADGET_ID_TEST 20
-#define GADGET_ID_EXIT 21
+#define GADGET_ID_TOOLBOX_FIRST 0
+
+#define GADGET_ID_SINGLE_ITEMS (GADGET_ID_TOOLBOX_FIRST + 0)
+#define GADGET_ID_CONNECTED_ITEMS (GADGET_ID_TOOLBOX_FIRST + 1)
+#define GADGET_ID_LINE (GADGET_ID_TOOLBOX_FIRST + 2)
+#define GADGET_ID_ARC (GADGET_ID_TOOLBOX_FIRST + 3)
+#define GADGET_ID_RECTANGLE (GADGET_ID_TOOLBOX_FIRST + 4)
+#define GADGET_ID_FILLED_BOX (GADGET_ID_TOOLBOX_FIRST + 5)
+#define GADGET_ID_WRAP_UP (GADGET_ID_TOOLBOX_FIRST + 6)
+#define GADGET_ID_TEXT (GADGET_ID_TOOLBOX_FIRST + 7)
+#define GADGET_ID_FLOOD_FILL (GADGET_ID_TOOLBOX_FIRST + 8)
+#define GADGET_ID_WRAP_LEFT (GADGET_ID_TOOLBOX_FIRST + 9)
+#define GADGET_ID_PROPERTIES (GADGET_ID_TOOLBOX_FIRST + 10)
+#define GADGET_ID_WRAP_RIGHT (GADGET_ID_TOOLBOX_FIRST + 11)
+#define GADGET_ID_RANDOM_PLACEMENT (GADGET_ID_TOOLBOX_FIRST + 12)
+#define GADGET_ID_GRAB_BRUSH (GADGET_ID_TOOLBOX_FIRST + 13)
+#define GADGET_ID_WRAP_DOWN (GADGET_ID_TOOLBOX_FIRST + 14)
+#define GADGET_ID_PICK_ELEMENT (GADGET_ID_TOOLBOX_FIRST + 15)
+
+#define GADGET_ID_UNDO (GADGET_ID_TOOLBOX_FIRST + 16)
+#define GADGET_ID_INFO (GADGET_ID_TOOLBOX_FIRST + 17)
+#define GADGET_ID_SAVE (GADGET_ID_TOOLBOX_FIRST + 18)
+#define GADGET_ID_CLEAR (GADGET_ID_TOOLBOX_FIRST + 19)
+#define GADGET_ID_TEST (GADGET_ID_TOOLBOX_FIRST + 20)
+#define GADGET_ID_EXIT (GADGET_ID_TOOLBOX_FIRST + 21)
+
+#define GADGET_ID_CUSTOM_COPY_FROM (GADGET_ID_TOOLBOX_FIRST + 22)
+#define GADGET_ID_CUSTOM_COPY_TO (GADGET_ID_TOOLBOX_FIRST + 23)
+#define GADGET_ID_CUSTOM_EXCHANGE (GADGET_ID_TOOLBOX_FIRST + 24)
/* counter button identifiers */
-#define GADGET_ID_ELEM_SCORE_DOWN 22
-#define GADGET_ID_ELEM_SCORE_TEXT 23
-#define GADGET_ID_ELEM_SCORE_UP 24
-#define GADGET_ID_ELEM_CONTENT_DOWN 25
-#define GADGET_ID_ELEM_CONTENT_TEXT 26
-#define GADGET_ID_ELEM_CONTENT_UP 27
-#define GADGET_ID_LEVEL_XSIZE_DOWN 28
-#define GADGET_ID_LEVEL_XSIZE_TEXT 29
-#define GADGET_ID_LEVEL_XSIZE_UP 30
-#define GADGET_ID_LEVEL_YSIZE_DOWN 31
-#define GADGET_ID_LEVEL_YSIZE_TEXT 32
-#define GADGET_ID_LEVEL_YSIZE_UP 33
-#define GADGET_ID_LEVEL_RANDOM_DOWN 34
-#define GADGET_ID_LEVEL_RANDOM_TEXT 35
-#define GADGET_ID_LEVEL_RANDOM_UP 36
-#define GADGET_ID_LEVEL_COLLECT_DOWN 37
-#define GADGET_ID_LEVEL_COLLECT_TEXT 38
-#define GADGET_ID_LEVEL_COLLECT_UP 39
-#define GADGET_ID_LEVEL_TIMELIMIT_DOWN 40
-#define GADGET_ID_LEVEL_TIMELIMIT_TEXT 41
-#define GADGET_ID_LEVEL_TIMELIMIT_UP 42
-#define GADGET_ID_LEVEL_TIMESCORE_DOWN 43
-#define GADGET_ID_LEVEL_TIMESCORE_TEXT 44
-#define GADGET_ID_LEVEL_TIMESCORE_UP 45
-#define GADGET_ID_SELECT_LEVEL_DOWN 46
-#define GADGET_ID_SELECT_LEVEL_TEXT 47
-#define GADGET_ID_SELECT_LEVEL_UP 48
+#define GADGET_ID_COUNTER_FIRST (GADGET_ID_TOOLBOX_FIRST + 25)
+
+#define GADGET_ID_SELECT_LEVEL_DOWN (GADGET_ID_COUNTER_FIRST + 0)
+#define GADGET_ID_SELECT_LEVEL_TEXT (GADGET_ID_COUNTER_FIRST + 1)
+#define GADGET_ID_SELECT_LEVEL_UP (GADGET_ID_COUNTER_FIRST + 2)
+#define GADGET_ID_LEVEL_XSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 3)
+#define GADGET_ID_LEVEL_XSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 4)
+#define GADGET_ID_LEVEL_XSIZE_UP (GADGET_ID_COUNTER_FIRST + 5)
+#define GADGET_ID_LEVEL_YSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 6)
+#define GADGET_ID_LEVEL_YSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 7)
+#define GADGET_ID_LEVEL_YSIZE_UP (GADGET_ID_COUNTER_FIRST + 8)
+#define GADGET_ID_LEVEL_RANDOM_DOWN (GADGET_ID_COUNTER_FIRST + 9)
+#define GADGET_ID_LEVEL_RANDOM_TEXT (GADGET_ID_COUNTER_FIRST + 10)
+#define GADGET_ID_LEVEL_RANDOM_UP (GADGET_ID_COUNTER_FIRST + 11)
+#define GADGET_ID_LEVEL_GEMSLIMIT_DOWN (GADGET_ID_COUNTER_FIRST + 12)
+#define GADGET_ID_LEVEL_GEMSLIMIT_TEXT (GADGET_ID_COUNTER_FIRST + 13)
+#define GADGET_ID_LEVEL_GEMSLIMIT_UP (GADGET_ID_COUNTER_FIRST + 14)
+#define GADGET_ID_LEVEL_TIMELIMIT_DOWN (GADGET_ID_COUNTER_FIRST + 15)
+#define GADGET_ID_LEVEL_TIMELIMIT_TEXT (GADGET_ID_COUNTER_FIRST + 16)
+#define GADGET_ID_LEVEL_TIMELIMIT_UP (GADGET_ID_COUNTER_FIRST + 17)
+#define GADGET_ID_LEVEL_TIMESCORE_DOWN (GADGET_ID_COUNTER_FIRST + 18)
+#define GADGET_ID_LEVEL_TIMESCORE_TEXT (GADGET_ID_COUNTER_FIRST + 19)
+#define GADGET_ID_LEVEL_TIMESCORE_UP (GADGET_ID_COUNTER_FIRST + 20)
+#define GADGET_ID_ELEMENT_SCORE_DOWN (GADGET_ID_COUNTER_FIRST + 21)
+#define GADGET_ID_ELEMENT_SCORE_TEXT (GADGET_ID_COUNTER_FIRST + 22)
+#define GADGET_ID_ELEMENT_SCORE_UP (GADGET_ID_COUNTER_FIRST + 23)
+#define GADGET_ID_ELEMENT_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 24)
+#define GADGET_ID_ELEMENT_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 25)
+#define GADGET_ID_ELEMENT_CONTENT_UP (GADGET_ID_COUNTER_FIRST + 26)
+#define GADGET_ID_ENVELOPE_XSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 27)
+#define GADGET_ID_ENVELOPE_XSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 28)
+#define GADGET_ID_ENVELOPE_XSIZE_UP (GADGET_ID_COUNTER_FIRST + 29)
+#define GADGET_ID_ENVELOPE_YSIZE_DOWN (GADGET_ID_COUNTER_FIRST + 30)
+#define GADGET_ID_ENVELOPE_YSIZE_TEXT (GADGET_ID_COUNTER_FIRST + 31)
+#define GADGET_ID_ENVELOPE_YSIZE_UP (GADGET_ID_COUNTER_FIRST + 32)
+#define GADGET_ID_CUSTOM_SCORE_DOWN (GADGET_ID_COUNTER_FIRST + 33)
+#define GADGET_ID_CUSTOM_SCORE_TEXT (GADGET_ID_COUNTER_FIRST + 34)
+#define GADGET_ID_CUSTOM_SCORE_UP (GADGET_ID_COUNTER_FIRST + 35)
+#define GADGET_ID_CUSTOM_GEMCOUNT_DOWN (GADGET_ID_COUNTER_FIRST + 36)
+#define GADGET_ID_CUSTOM_GEMCOUNT_TEXT (GADGET_ID_COUNTER_FIRST + 37)
+#define GADGET_ID_CUSTOM_GEMCOUNT_UP (GADGET_ID_COUNTER_FIRST + 38)
+#define GADGET_ID_PUSH_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 39)
+#define GADGET_ID_PUSH_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 40)
+#define GADGET_ID_PUSH_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 41)
+#define GADGET_ID_PUSH_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 42)
+#define GADGET_ID_PUSH_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 43)
+#define GADGET_ID_PUSH_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 44)
+#define GADGET_ID_MOVE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 45)
+#define GADGET_ID_MOVE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 46)
+#define GADGET_ID_MOVE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 47)
+#define GADGET_ID_MOVE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 48)
+#define GADGET_ID_MOVE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 49)
+#define GADGET_ID_MOVE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 50)
+#define GADGET_ID_EXPLOSION_DELAY_DOWN (GADGET_ID_COUNTER_FIRST + 51)
+#define GADGET_ID_EXPLOSION_DELAY_TEXT (GADGET_ID_COUNTER_FIRST + 52)
+#define GADGET_ID_EXPLOSION_DELAY_UP (GADGET_ID_COUNTER_FIRST + 53)
+#define GADGET_ID_IGNITION_DELAY_DOWN (GADGET_ID_COUNTER_FIRST + 54)
+#define GADGET_ID_IGNITION_DELAY_TEXT (GADGET_ID_COUNTER_FIRST + 55)
+#define GADGET_ID_IGNITION_DELAY_UP (GADGET_ID_COUNTER_FIRST + 56)
+#define GADGET_ID_CHANGE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 57)
+#define GADGET_ID_CHANGE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 58)
+#define GADGET_ID_CHANGE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 59)
+#define GADGET_ID_CHANGE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 60)
+#define GADGET_ID_CHANGE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 61)
+#define GADGET_ID_CHANGE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 62)
+#define GADGET_ID_CHANGE_CONT_RND_DOWN (GADGET_ID_COUNTER_FIRST + 63)
+#define GADGET_ID_CHANGE_CONT_RND_TEXT (GADGET_ID_COUNTER_FIRST + 64)
+#define GADGET_ID_CHANGE_CONT_RND_UP (GADGET_ID_COUNTER_FIRST + 65)
+#define GADGET_ID_GROUP_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 66)
+#define GADGET_ID_GROUP_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 67)
+#define GADGET_ID_GROUP_CONTENT_UP (GADGET_ID_COUNTER_FIRST + 68)
/* drawing area identifiers */
-#define GADGET_ID_DRAWING_LEVEL 49
-#define GADGET_ID_ELEM_CONTENT_0 50
-#define GADGET_ID_ELEM_CONTENT_1 51
-#define GADGET_ID_ELEM_CONTENT_2 52
-#define GADGET_ID_ELEM_CONTENT_3 53
-#define GADGET_ID_ELEM_CONTENT_4 54
-#define GADGET_ID_ELEM_CONTENT_5 55
-#define GADGET_ID_ELEM_CONTENT_6 56
-#define GADGET_ID_ELEM_CONTENT_7 57
-#define GADGET_ID_AMOEBA_CONTENT 58
+#define GADGET_ID_DRAWING_AREA_FIRST (GADGET_ID_COUNTER_FIRST + 69)
+
+#define GADGET_ID_DRAWING_LEVEL (GADGET_ID_DRAWING_AREA_FIRST + 0)
+#define GADGET_ID_ELEMENT_CONTENT_0 (GADGET_ID_DRAWING_AREA_FIRST + 1)
+#define GADGET_ID_ELEMENT_CONTENT_1 (GADGET_ID_DRAWING_AREA_FIRST + 2)
+#define GADGET_ID_ELEMENT_CONTENT_2 (GADGET_ID_DRAWING_AREA_FIRST + 3)
+#define GADGET_ID_ELEMENT_CONTENT_3 (GADGET_ID_DRAWING_AREA_FIRST + 4)
+#define GADGET_ID_ELEMENT_CONTENT_4 (GADGET_ID_DRAWING_AREA_FIRST + 5)
+#define GADGET_ID_ELEMENT_CONTENT_5 (GADGET_ID_DRAWING_AREA_FIRST + 6)
+#define GADGET_ID_ELEMENT_CONTENT_6 (GADGET_ID_DRAWING_AREA_FIRST + 7)
+#define GADGET_ID_ELEMENT_CONTENT_7 (GADGET_ID_DRAWING_AREA_FIRST + 8)
+#define GADGET_ID_AMOEBA_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 9)
+#define GADGET_ID_CUSTOM_GRAPHIC (GADGET_ID_DRAWING_AREA_FIRST + 10)
+#define GADGET_ID_CUSTOM_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 11)
+#define GADGET_ID_CUSTOM_MOVE_ENTER (GADGET_ID_DRAWING_AREA_FIRST + 12)
+#define GADGET_ID_CUSTOM_MOVE_LEAVE (GADGET_ID_DRAWING_AREA_FIRST + 13)
+#define GADGET_ID_CUSTOM_CHANGE_TARGET (GADGET_ID_DRAWING_AREA_FIRST + 14)
+#define GADGET_ID_CUSTOM_CHANGE_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 15)
+#define GADGET_ID_CUSTOM_CHANGE_TRIGGER (GADGET_ID_DRAWING_AREA_FIRST + 16)
+#define GADGET_ID_GROUP_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 17)
+#define GADGET_ID_RANDOM_BACKGROUND (GADGET_ID_DRAWING_AREA_FIRST + 18)
/* text input identifiers */
-#define GADGET_ID_LEVEL_NAME 59
-#define GADGET_ID_LEVEL_AUTHOR 60
+#define GADGET_ID_TEXT_INPUT_FIRST (GADGET_ID_DRAWING_AREA_FIRST + 19)
+
+#define GADGET_ID_LEVEL_NAME (GADGET_ID_TEXT_INPUT_FIRST + 0)
+#define GADGET_ID_LEVEL_AUTHOR (GADGET_ID_TEXT_INPUT_FIRST + 1)
+#define GADGET_ID_ELEMENT_NAME (GADGET_ID_TEXT_INPUT_FIRST + 2)
+
+/* text area identifiers */
+#define GADGET_ID_TEXT_AREA_FIRST (GADGET_ID_TEXT_INPUT_FIRST + 3)
+
+#define GADGET_ID_ENVELOPE_INFO (GADGET_ID_TEXT_AREA_FIRST + 0)
+
+/* selectbox identifiers */
+#define GADGET_ID_SELECTBOX_FIRST (GADGET_ID_TEXT_AREA_FIRST + 1)
+
+#define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 0)
+#define GADGET_ID_CUSTOM_CONSISTENCY (GADGET_ID_SELECTBOX_FIRST + 1)
+#define GADGET_ID_CUSTOM_DEADLINESS (GADGET_ID_SELECTBOX_FIRST + 2)
+#define GADGET_ID_CUSTOM_MOVE_PATTERN (GADGET_ID_SELECTBOX_FIRST + 3)
+#define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 4)
+#define GADGET_ID_CUSTOM_MOVE_STEPSIZE (GADGET_ID_SELECTBOX_FIRST + 5)
+#define GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE (GADGET_ID_SELECTBOX_FIRST + 6)
+#define GADGET_ID_CUSTOM_SMASH_TARGETS (GADGET_ID_SELECTBOX_FIRST + 7)
+#define GADGET_ID_CUSTOM_SLIPPERY_TYPE (GADGET_ID_SELECTBOX_FIRST + 8)
+#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 9)
+#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 10)
+#define GADGET_ID_CUSTOM_ACCESS_PROTECTED (GADGET_ID_SELECTBOX_FIRST + 11)
+#define GADGET_ID_CUSTOM_ACCESS_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 12)
+#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 13)
+#define GADGET_ID_CHANGE_DIRECT_ACTION (GADGET_ID_SELECTBOX_FIRST + 14)
+#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 15)
+#define GADGET_ID_CHANGE_SIDES (GADGET_ID_SELECTBOX_FIRST + 16)
+#define GADGET_ID_CHANGE_POWER (GADGET_ID_SELECTBOX_FIRST + 17)
+#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 18)
+#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 19)
+
+/* textbutton identifiers */
+#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 20)
+
+#define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0)
+#define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1)
+#define GADGET_ID_PROPERTIES_CONFIG_1 (GADGET_ID_TEXTBUTTON_FIRST + 2)
+#define GADGET_ID_PROPERTIES_CONFIG_2 (GADGET_ID_TEXTBUTTON_FIRST + 3)
+#define GADGET_ID_PROPERTIES_CHANGE (GADGET_ID_TEXTBUTTON_FIRST + 4)
+#define GADGET_ID_SAVE_AS_TEMPLATE (GADGET_ID_TEXTBUTTON_FIRST + 5)
+#define GADGET_ID_ADD_CHANGE_PAGE (GADGET_ID_TEXTBUTTON_FIRST + 6)
+#define GADGET_ID_DEL_CHANGE_PAGE (GADGET_ID_TEXTBUTTON_FIRST + 7)
+
+/* graphicbutton identifiers */
+#define GADGET_ID_GRAPHICBUTTON_FIRST (GADGET_ID_TEXTBUTTON_FIRST + 8)
+
+#define GADGET_ID_PREV_CHANGE_PAGE (GADGET_ID_GRAPHICBUTTON_FIRST + 0)
+#define GADGET_ID_NEXT_CHANGE_PAGE (GADGET_ID_GRAPHICBUTTON_FIRST + 1)
/* gadgets for scrolling of drawing area */
-#define GADGET_ID_SCROLL_UP 61
-#define GADGET_ID_SCROLL_DOWN 62
-#define GADGET_ID_SCROLL_LEFT 63
-#define GADGET_ID_SCROLL_RIGHT 64
-#define GADGET_ID_SCROLL_HORIZONTAL 65
-#define GADGET_ID_SCROLL_VERTICAL 66
-
-/* gadgets for scrolling element list */
-#define GADGET_ID_SCROLL_LIST_UP 67
-#define GADGET_ID_SCROLL_LIST_DOWN 68
-#define GADGET_ID_SCROLL_LIST_VERTICAL 69
+#define GADGET_ID_SCROLLING_FIRST (GADGET_ID_GRAPHICBUTTON_FIRST + 2)
-/* buttons for level settings */
-#define GADGET_ID_RANDOM_PERCENTAGE 70
-#define GADGET_ID_RANDOM_QUANTITY 71
-#define GADGET_ID_RANDOM_RESTRICTED 72
-#define GADGET_ID_DOUBLE_SPEED 73
-#define GADGET_ID_GRAVITY 74
-#define GADGET_ID_STICK_ELEMENT 75
+#define GADGET_ID_SCROLL_UP (GADGET_ID_SCROLLING_FIRST + 0)
+#define GADGET_ID_SCROLL_DOWN (GADGET_ID_SCROLLING_FIRST + 1)
+#define GADGET_ID_SCROLL_LEFT (GADGET_ID_SCROLLING_FIRST + 2)
+#define GADGET_ID_SCROLL_RIGHT (GADGET_ID_SCROLLING_FIRST + 3)
+#define GADGET_ID_SCROLL_HORIZONTAL (GADGET_ID_SCROLLING_FIRST + 4)
+#define GADGET_ID_SCROLL_VERTICAL (GADGET_ID_SCROLLING_FIRST + 5)
-/* another drawing area for random placement */
-#define GADGET_ID_RANDOM_BACKGROUND 76
+/* gadgets for scrolling element list */
+#define GADGET_ID_SCROLLING_LIST_FIRST (GADGET_ID_SCROLLING_FIRST + 6)
+
+#define GADGET_ID_SCROLL_LIST_UP (GADGET_ID_SCROLLING_LIST_FIRST + 0)
+#define GADGET_ID_SCROLL_LIST_DOWN (GADGET_ID_SCROLLING_LIST_FIRST + 1)
+#define GADGET_ID_SCROLL_LIST_VERTICAL (GADGET_ID_SCROLLING_LIST_FIRST + 2)
+
+/* checkbuttons/radiobuttons for level/element properties */
+#define GADGET_ID_CHECKBUTTON_FIRST (GADGET_ID_SCROLLING_LIST_FIRST + 3)
+
+#define GADGET_ID_RANDOM_PERCENTAGE (GADGET_ID_CHECKBUTTON_FIRST + 0)
+#define GADGET_ID_RANDOM_QUANTITY (GADGET_ID_CHECKBUTTON_FIRST + 1)
+#define GADGET_ID_RANDOM_RESTRICTED (GADGET_ID_CHECKBUTTON_FIRST + 2)
+#define GADGET_ID_DOUBLE_SPEED (GADGET_ID_CHECKBUTTON_FIRST + 3)
+#define GADGET_ID_GRAVITY (GADGET_ID_CHECKBUTTON_FIRST + 4)
+#define GADGET_ID_STICK_ELEMENT (GADGET_ID_CHECKBUTTON_FIRST + 5)
+#define GADGET_ID_EM_SLIPPERY_GEMS (GADGET_ID_CHECKBUTTON_FIRST + 6)
+#define GADGET_ID_USE_SPRING_BUG (GADGET_ID_CHECKBUTTON_FIRST + 7)
+#define GADGET_ID_BLOCK_LAST_FIELD (GADGET_ID_CHECKBUTTON_FIRST + 8)
+#define GADGET_ID_SP_BLOCK_LAST_FIELD (GADGET_ID_CHECKBUTTON_FIRST + 9)
+#define GADGET_ID_CAN_MOVE_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 10)
+#define GADGET_ID_CUSTOM_EXPLODE_RESULT (GADGET_ID_CHECKBUTTON_FIRST + 11)
+#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 12)
+#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 13)
+#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 14)
+#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 15)
+#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 16)
+#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 17)
+#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 18)
+#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 19)
+#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 20)
+#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 21)
+#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 22)
+#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 23)
+#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 24)
+#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 25)
+#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 26)
+#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 27)
+#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 28)
+#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 29)
+#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 30)
+#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 31)
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST 77
-#define GADGET_ID_ELEMENTLIST_LAST (77 + ED_NUM_ELEMENTLIST_BUTTONS - 1)
+#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 32)
+#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
+ ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define NUM_EDITOR_GADGETS (GADGET_ID_ELEMENTLIST_LAST + 1)
#define RADIO_NR_RANDOM_ELEMENTS 2
/* values for counter gadgets */
-#define ED_COUNTER_ID_ELEM_SCORE 0
-#define ED_COUNTER_ID_ELEM_CONTENT 1
-#define ED_COUNTER_ID_LEVEL_XSIZE 2
-#define ED_COUNTER_ID_LEVEL_YSIZE 3
-#define ED_COUNTER_ID_LEVEL_COLLECT 4
-#define ED_COUNTER_ID_LEVEL_TIMELIMIT 5
-#define ED_COUNTER_ID_LEVEL_TIMESCORE 6
-#define ED_COUNTER_ID_LEVEL_RANDOM 7
-#define ED_COUNTER_ID_SELECT_LEVEL 8
-
-#define ED_NUM_COUNTERBUTTONS 9
+#define ED_COUNTER_ID_SELECT_LEVEL 0
+#define ED_COUNTER_ID_LEVEL_XSIZE 1
+#define ED_COUNTER_ID_LEVEL_YSIZE 2
+#define ED_COUNTER_ID_LEVEL_GEMSLIMIT 3
+#define ED_COUNTER_ID_LEVEL_TIMELIMIT 4
+#define ED_COUNTER_ID_LEVEL_TIMESCORE 5
+#define ED_COUNTER_ID_LEVEL_RANDOM 6
+#define ED_COUNTER_ID_ELEMENT_SCORE 7
+#define ED_COUNTER_ID_ELEMENT_CONTENT 8
+#define ED_COUNTER_ID_ENVELOPE_XSIZE 9
+#define ED_COUNTER_ID_ENVELOPE_YSIZE 10
+#define ED_COUNTER_ID_CUSTOM_SCORE 11
+#define ED_COUNTER_ID_CUSTOM_GEMCOUNT 12
+#define ED_COUNTER_ID_PUSH_DELAY_FIX 13
+#define ED_COUNTER_ID_PUSH_DELAY_RND 14
+#define ED_COUNTER_ID_MOVE_DELAY_FIX 15
+#define ED_COUNTER_ID_MOVE_DELAY_RND 16
+#define ED_COUNTER_ID_EXPLOSION_DELAY 17
+#define ED_COUNTER_ID_IGNITION_DELAY 18
+#define ED_COUNTER_ID_GROUP_CONTENT 19
+#define ED_COUNTER_ID_CHANGE_DELAY_FIX 20
+#define ED_COUNTER_ID_CHANGE_DELAY_RND 21
+#define ED_COUNTER_ID_CHANGE_CONT_RND 22
+
+#define ED_NUM_COUNTERBUTTONS 23
#define ED_COUNTER_ID_LEVEL_FIRST ED_COUNTER_ID_LEVEL_XSIZE
#define ED_COUNTER_ID_LEVEL_LAST ED_COUNTER_ID_LEVEL_RANDOM
+#define ED_COUNTER_ID_CUSTOM1_FIRST ED_COUNTER_ID_CUSTOM_SCORE
+#define ED_COUNTER_ID_CUSTOM1_LAST ED_COUNTER_ID_MOVE_DELAY_RND
+#define ED_COUNTER_ID_CUSTOM2_FIRST ED_COUNTER_ID_EXPLOSION_DELAY
+#define ED_COUNTER_ID_CUSTOM2_LAST ED_COUNTER_ID_IGNITION_DELAY
+#define ED_COUNTER_ID_CUSTOM_FIRST ED_COUNTER_ID_CUSTOM1_FIRST
+#define ED_COUNTER_ID_CUSTOM_LAST ED_COUNTER_ID_CUSTOM2_LAST
+
+#define ED_COUNTER_ID_CHANGE_FIRST ED_COUNTER_ID_CHANGE_DELAY_FIX
+#define ED_COUNTER_ID_CHANGE_LAST ED_COUNTER_ID_CHANGE_CONT_RND
+
/* values for scrollbutton gadgets */
#define ED_SCROLLBUTTON_ID_AREA_UP 0
#define ED_SCROLLBUTTON_ID_AREA_DOWN 1
/* values for text input gadgets */
#define ED_TEXTINPUT_ID_LEVEL_NAME 0
#define ED_TEXTINPUT_ID_LEVEL_AUTHOR 1
+#define ED_TEXTINPUT_ID_ELEMENT_NAME 2
-#define ED_NUM_TEXTINPUT 2
+#define ED_NUM_TEXTINPUT 3
#define ED_TEXTINPUT_ID_LEVEL_FIRST ED_TEXTINPUT_ID_LEVEL_NAME
#define ED_TEXTINPUT_ID_LEVEL_LAST ED_TEXTINPUT_ID_LEVEL_AUTHOR
+/* values for text area gadgets */
+#define ED_TEXTAREA_ID_ENVELOPE_INFO 0
+
+#define ED_NUM_TEXTAREAS 1
+
+#define ED_TEXTAREA_ID_LEVEL_FIRST ED_TEXTAREA_ID_ENVELOPE
+#define ED_TEXTAREA_ID_LEVEL_LAST ED_TEXTAREA_ID_ENVELOPE
+
+/* values for selectbox gadgets */
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 0
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 1
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED 2
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION 3
+#define ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION 4
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN 5
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION 6
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE 7
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE 8
+#define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 9
+#define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE 10
+#define ED_SELECTBOX_ID_CUSTOM_DEADLINESS 11
+#define ED_SELECTBOX_ID_CUSTOM_CONSISTENCY 12
+#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 13
+#define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION 14
+#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 15
+#define ED_SELECTBOX_ID_CHANGE_SIDES 16
+#define ED_SELECTBOX_ID_CHANGE_POWER 17
+#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 18
+#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 19
+
+#define ED_NUM_SELECTBOX 20
+
+#define ED_SELECTBOX_ID_CUSTOM1_FIRST ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
+#define ED_SELECTBOX_ID_CUSTOM1_LAST ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE
+#define ED_SELECTBOX_ID_CUSTOM2_FIRST ED_SELECTBOX_ID_CUSTOM_DEADLINESS
+#define ED_SELECTBOX_ID_CUSTOM2_LAST ED_SELECTBOX_ID_CUSTOM_CONSISTENCY
+#define ED_SELECTBOX_ID_CUSTOM_FIRST ED_SELECTBOX_ID_CUSTOM1_FIRST
+#define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM2_LAST
+
+#define ED_SELECTBOX_ID_CHANGE_FIRST ED_SELECTBOX_ID_CHANGE_TIME_UNITS
+#define ED_SELECTBOX_ID_CHANGE_LAST ED_SELECTBOX_ID_SELECT_CHANGE_PAGE
+
+/* values for textbutton gadgets */
+#define ED_TEXTBUTTON_ID_PROPERTIES_INFO 0
+#define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG 1
+#define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1 2
+#define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2 3
+#define ED_TEXTBUTTON_ID_PROPERTIES_CHANGE 4
+#define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE 5
+#define ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE 6
+#define ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE 7
+
+#define ED_NUM_TEXTBUTTONS 8
+
+#define ED_TEXTBUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
+#define ED_TEXTBUTTON_ID_PROPERTIES_LAST ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
+
+#define ED_TEXTBUTTON_ID_CHANGE_FIRST ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
+#define ED_TEXTBUTTON_ID_CHANGE_LAST ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
+
+/* values for graphicbutton gadgets */
+#define ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE 0
+#define ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE 1
+
+#define ED_NUM_GRAPHICBUTTONS 2
+
+#define ED_GRAPHICBUTTON_ID_CHANGE_FIRST ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE
+#define ED_GRAPHICBUTTON_ID_CHANGE_LAST ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE
+
/* values for checkbutton gadgets */
#define ED_CHECKBUTTON_ID_DOUBLE_SPEED 0
#define ED_CHECKBUTTON_ID_GRAVITY 1
#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED 2
#define ED_CHECKBUTTON_ID_STICK_ELEMENT 3
-
-#define ED_NUM_CHECKBUTTONS 4
+#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS 4
+#define ED_CHECKBUTTON_ID_USE_SPRING_BUG 5
+#define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD 6
+#define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD 7
+#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID 8
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 9
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 10
+#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 11
+#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 12
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 13
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 14
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 15
+#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 16
+#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 17
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_RESULT 18
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 19
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 20
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 21
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 22
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY 23
+#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 24
+#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 25
+#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 26
+#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 27
+#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 28
+#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 29
+
+#define ED_NUM_CHECKBUTTONS 30
#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED
#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
+#define ED_CHECKBUTTON_ID_CUSTOM1_FIRST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
+#define ED_CHECKBUTTON_ID_CUSTOM1_LAST ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY
+#define ED_CHECKBUTTON_ID_CUSTOM2_FIRST ED_CHECKBUTTON_ID_CUSTOM_DEADLY
+#define ED_CHECKBUTTON_ID_CUSTOM2_LAST ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT
+#define ED_CHECKBUTTON_ID_CUSTOM_FIRST ED_CHECKBUTTON_ID_CUSTOM1_FIRST
+#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM2_LAST
+
+#define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
+#define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM
+
/* values for radiobutton gadgets */
#define ED_RADIOBUTTON_ID_PERCENTAGE 0
#define ED_RADIOBUTTON_ID_QUANTITY 1
#define ED_RADIOBUTTON_ID_LEVEL_FIRST ED_RADIOBUTTON_ID_PERCENTAGE
#define ED_RADIOBUTTON_ID_LEVEL_LAST ED_RADIOBUTTON_ID_QUANTITY
+/* values for drawing area gadgets */
+#define ED_DRAWING_ID_DRAWING_LEVEL 0
+#define ED_DRAWING_ID_ELEMENT_CONTENT_0 1
+#define ED_DRAWING_ID_ELEMENT_CONTENT_1 2
+#define ED_DRAWING_ID_ELEMENT_CONTENT_2 3
+#define ED_DRAWING_ID_ELEMENT_CONTENT_3 4
+#define ED_DRAWING_ID_ELEMENT_CONTENT_4 5
+#define ED_DRAWING_ID_ELEMENT_CONTENT_5 6
+#define ED_DRAWING_ID_ELEMENT_CONTENT_6 7
+#define ED_DRAWING_ID_ELEMENT_CONTENT_7 8
+#define ED_DRAWING_ID_AMOEBA_CONTENT 9
+#define ED_DRAWING_ID_CUSTOM_GRAPHIC 10
+#define ED_DRAWING_ID_CUSTOM_CONTENT 11
+#define ED_DRAWING_ID_CUSTOM_MOVE_ENTER 12
+#define ED_DRAWING_ID_CUSTOM_MOVE_LEAVE 13
+#define ED_DRAWING_ID_CUSTOM_CHANGE_TARGET 14
+#define ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT 15
+#define ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER 16
+#define ED_DRAWING_ID_GROUP_CONTENT 17
+#define ED_DRAWING_ID_RANDOM_BACKGROUND 18
+
+#define ED_NUM_DRAWING_AREAS 19
+
+
+/*
+ -----------------------------------------------------------------------------
+ some internally used definitions
+ -----------------------------------------------------------------------------
+*/
+
/* values for CopyLevelToUndoBuffer() */
#define UNDO_IMMEDIATE 0
#define UNDO_ACCUMULATE 1
-/* values for ClearEditorGadgetInfoText() and HandleGadgetInfoText() */
-#define INFOTEXT_XPOS SX
-#define INFOTEXT_YPOS (SY + SYSIZE - MINI_TILEX + 2)
-#define INFOTEXT_XSIZE SXSIZE
-#define INFOTEXT_YSIZE MINI_TILEX
-#define MAX_INFOTEXT_LEN (SXSIZE / FONT2_XSIZE)
+/* values for scrollbars */
+#define ED_SCROLL_NO 0
+#define ED_SCROLL_LEFT 1
+#define ED_SCROLL_RIGHT 2
+#define ED_SCROLL_UP 4
+#define ED_SCROLL_DOWN 8
+
+/* screens in the level editor */
+#define ED_MODE_DRAWING 0
+#define ED_MODE_INFO 1
+#define ED_MODE_PROPERTIES 2
+
+/* sub-screens in the element properties section */
+#define ED_MODE_PROPERTIES_INFO ED_TEXTBUTTON_ID_PROPERTIES_INFO
+#define ED_MODE_PROPERTIES_CONFIG ED_TEXTBUTTON_ID_PROPERTIES_CONFIG
+#define ED_MODE_PROPERTIES_CONFIG_1 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1
+#define ED_MODE_PROPERTIES_CONFIG_2 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2
+#define ED_MODE_PROPERTIES_CHANGE ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
+
+/* how many steps can be cancelled */
+#define NUM_UNDO_STEPS (10 + 1)
+
+/* values for elements with score for certain actions */
+#define MIN_SCORE 0
+#define MAX_SCORE 255
+
+/* values for elements with count for collecting */
+#define MIN_COLLECT_COUNT 0
+#define MAX_COLLECT_COUNT 100
+
+/* values for random placement */
+#define RANDOM_USE_PERCENTAGE 0
+#define RANDOM_USE_QUANTITY 1
+
+/* maximal size of level editor drawing area */
+#define MAX_ED_FIELDX (2 * SCR_FIELDX)
+#define MAX_ED_FIELDY (2 * SCR_FIELDY - 1)
+
+
+/*
+ -----------------------------------------------------------------------------
+ some internally used data structure definitions
+ -----------------------------------------------------------------------------
+*/
static struct
{
char *text;
} control_info[ED_NUM_CTRL_BUTTONS] =
{
- { 's', "draw single items" },
- { 'd', "draw connected items" },
- { 'l', "draw lines" },
- { 'a', "draw arcs" },
- { 'r', "draw outline rectangles" },
- { 'R', "draw filled rectangles" },
- { '\0', "wrap (rotate) level up" },
- { 't', "enter text elements" },
- { 'f', "flood fill" },
- { '\0', "wrap (rotate) level left" },
- { '?', "properties of drawing element" },
- { '\0', "wrap (rotate) level right" },
- { '\0', "random element placement" },
- { 'b', "grab brush" },
- { '\0', "wrap (rotate) level down" },
- { ',', "pick drawing element" },
- { 'U', "undo last operation" },
- { 'I', "level properties" },
- { 'S', "save level" },
- { 'C', "clear level" },
- { 'T', "test level" },
- { 'E', "exit level editor" }
+ { 's', "draw single items" },
+ { 'd', "draw connected items" },
+ { 'l', "draw lines" },
+ { 'a', "draw arcs" },
+ { 'r', "draw outline rectangles" },
+ { 'R', "draw filled rectangles" },
+ { '\0', "wrap (rotate) level up" },
+ { 't', "enter text elements" },
+ { 'f', "flood fill" },
+ { '\0', "wrap (rotate) level left" },
+ { '?', "properties of drawing element" },
+ { '\0', "wrap (rotate) level right" },
+ { '\0', "random element placement" },
+ { 'b', "grab brush" },
+ { '\0', "wrap (rotate) level down" },
+ { ',', "pick drawing element" },
+
+ { 'U', "undo last operation" },
+ { 'I', "level properties" },
+ { 'S', "save level" },
+ { 'C', "clear level" },
+ { 'T', "test level" },
+ { 'E', "exit level editor" },
+
+ { '\0', "copy settings from other element" },
+ { '\0', "copy settings to other element" },
+ { '\0', "exchange settings with other element" },
};
-/* values for random placement */
-#define RANDOM_USE_PERCENTAGE 0
-#define RANDOM_USE_QUANTITY 1
-
static int random_placement_value = 10;
static int random_placement_method = RANDOM_USE_QUANTITY;
-static int random_placement_background_element = EL_ERDREICH;
+static int random_placement_background_element = EL_SAND;
static boolean random_placement_background_restricted = FALSE;
static boolean stick_element_properties_window = FALSE;
+static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES];
+static boolean custom_element_change_events[NUM_CHANGE_EVENTS];
+static struct ElementChangeInfo custom_element_change;
+static struct ElementGroupInfo group_element_info;
+static struct ElementInfo custom_element;
static struct
{
int min_value, max_value;
int gadget_id_down, gadget_id_up;
int gadget_id_text;
+ int gadget_id_align;
int *value;
- char *infotext_above, *infotext_right;
+ char *text_above, *text_left, *text_right;
} counterbutton_info[ED_NUM_COUNTERBUTTONS] =
{
+ /* ---------- level and editor settings ---------------------------------- */
+
{
- ED_COUNT_ELEM_SCORE_XPOS, ED_COUNT_ELEM_SCORE_YPOS,
- MIN_SCORE, MAX_SCORE,
- GADGET_ID_ELEM_SCORE_DOWN, GADGET_ID_ELEM_SCORE_UP,
- GADGET_ID_ELEM_SCORE_TEXT,
- NULL, /* will be set when used */
- "element score", NULL
- },
- {
- ED_COUNT_ELEM_CONTENT_XPOS, ED_COUNT_ELEM_CONTENT_YPOS,
- MIN_ELEMENT_CONTENTS, MAX_ELEMENT_CONTENTS,
- GADGET_ID_ELEM_CONTENT_DOWN, GADGET_ID_ELEM_CONTENT_UP,
- GADGET_ID_ELEM_CONTENT_TEXT,
- &level.num_yam_contents,
- "element content", NULL
+ DX + 5 - SX, DY + 3 - SY,
+ 1, 100,
+ GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_UP,
+ GADGET_ID_SELECT_LEVEL_TEXT, GADGET_ID_NONE,
+ &level_nr,
+ NULL, NULL, NULL
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(2),
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(2),
MIN_LEV_FIELDX, MAX_LEV_FIELDX,
GADGET_ID_LEVEL_XSIZE_DOWN, GADGET_ID_LEVEL_XSIZE_UP,
- GADGET_ID_LEVEL_XSIZE_TEXT,
+ GADGET_ID_LEVEL_XSIZE_TEXT, GADGET_ID_NONE,
&level.fieldx,
- "playfield size", "width",
+ "playfield size:", NULL, "width",
},
{
- ED_SETTINGS_XPOS + 2 * DXSIZE, ED_COUNTER_YPOS(2),
+ -1, ED_COUNTER_YPOS(2),
MIN_LEV_FIELDY, MAX_LEV_FIELDY,
GADGET_ID_LEVEL_YSIZE_DOWN, GADGET_ID_LEVEL_YSIZE_UP,
- GADGET_ID_LEVEL_YSIZE_TEXT,
+ GADGET_ID_LEVEL_YSIZE_TEXT, GADGET_ID_LEVEL_XSIZE_UP,
&level.fieldy,
- NULL, "height",
+ NULL, " ", "height",
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(3),
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(3),
0, 999,
- GADGET_ID_LEVEL_COLLECT_DOWN, GADGET_ID_LEVEL_COLLECT_UP,
- GADGET_ID_LEVEL_COLLECT_TEXT,
+ GADGET_ID_LEVEL_GEMSLIMIT_DOWN, GADGET_ID_LEVEL_GEMSLIMIT_UP,
+ GADGET_ID_LEVEL_GEMSLIMIT_TEXT, GADGET_ID_NONE,
&level.gems_needed,
- "number of emeralds to collect", NULL
+ "number of emeralds to collect:", NULL, NULL
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(4),
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(4),
0, 999,
GADGET_ID_LEVEL_TIMELIMIT_DOWN, GADGET_ID_LEVEL_TIMELIMIT_UP,
- GADGET_ID_LEVEL_TIMELIMIT_TEXT,
+ GADGET_ID_LEVEL_TIMELIMIT_TEXT, GADGET_ID_NONE,
&level.time,
- "time available to solve level", "(0 => no time limit)"
+ "time available to solve level:", NULL, "(0 => no time limit)"
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(5),
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(5),
0, 255,
GADGET_ID_LEVEL_TIMESCORE_DOWN, GADGET_ID_LEVEL_TIMESCORE_UP,
- GADGET_ID_LEVEL_TIMESCORE_TEXT,
- &level.score[SC_ZEITBONUS],
- "score for each 10 seconds left", NULL
+ GADGET_ID_LEVEL_TIMESCORE_TEXT, GADGET_ID_NONE,
+ &level.score[SC_TIME_BONUS],
+ "score for each 10 seconds left:", NULL, NULL
},
{
- ED_SETTINGS_XPOS, ED_COUNTER2_YPOS(8),
+ ED_SETTINGS_XPOS(0), ED_COUNTER2_YPOS(8),
1, 100,
GADGET_ID_LEVEL_RANDOM_DOWN, GADGET_ID_LEVEL_RANDOM_UP,
- GADGET_ID_LEVEL_RANDOM_TEXT,
+ GADGET_ID_LEVEL_RANDOM_TEXT, GADGET_ID_NONE,
&random_placement_value,
- "random element placement", "in"
+ "random element placement:", NULL, "in"
+ },
+
+ /* ---------- element settings: configure (various elements) ------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ MIN_SCORE, MAX_SCORE,
+ GADGET_ID_ELEMENT_SCORE_DOWN, GADGET_ID_ELEMENT_SCORE_UP,
+ GADGET_ID_ELEMENT_SCORE_TEXT, GADGET_ID_NONE,
+ NULL, /* will be set when used */
+ NULL, NULL, NULL
},
{
- DX + 5 - SX, DY + 3 - SY,
- 1, 100,
- GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_UP,
- GADGET_ID_SELECT_LEVEL_TEXT,
- &level_nr,
- NULL, NULL
- }
-};
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(3),
+ MIN_ELEMENT_CONTENTS, MAX_ELEMENT_CONTENTS,
+ GADGET_ID_ELEMENT_CONTENT_DOWN, GADGET_ID_ELEMENT_CONTENT_UP,
+ GADGET_ID_ELEMENT_CONTENT_TEXT, GADGET_ID_NONE,
+ &level.num_yamyam_contents,
+ NULL, NULL, "number of content areas"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ MIN_ENVELOPE_XSIZE, MAX_ENVELOPE_XSIZE,
+ GADGET_ID_ENVELOPE_XSIZE_DOWN, GADGET_ID_ENVELOPE_XSIZE_UP,
+ GADGET_ID_ENVELOPE_XSIZE_TEXT, GADGET_ID_NONE,
+ NULL,
+ NULL, NULL, "width",
+ },
+ {
+ -1, ED_SETTINGS_YPOS(0),
+ MIN_ENVELOPE_YSIZE, MAX_ENVELOPE_YSIZE,
+ GADGET_ID_ENVELOPE_YSIZE_DOWN, GADGET_ID_ENVELOPE_YSIZE_UP,
+ GADGET_ID_ENVELOPE_YSIZE_TEXT, GADGET_ID_ENVELOPE_XSIZE_UP,
+ NULL,
+ NULL, " ", "height",
+ },
+
+ /* ---------- element settings: configure 1 (custom elements) ------------ */
-static struct
-{
- int x, y;
- int gadget_id;
- int size;
- char *value;
- char *infotext;
-} textinput_info[ED_NUM_TEXTINPUT] =
-{
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(0),
- GADGET_ID_LEVEL_NAME,
- MAX_LEVEL_NAME_LEN,
- level.name,
- "Title"
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(6),
+ MIN_SCORE, MAX_SCORE,
+ GADGET_ID_CUSTOM_SCORE_DOWN, GADGET_ID_CUSTOM_SCORE_UP,
+ GADGET_ID_CUSTOM_SCORE_TEXT, GADGET_ID_NONE,
+ &custom_element.collect_score,
+ NULL, "score", " "
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(1),
- GADGET_ID_LEVEL_AUTHOR,
- MAX_LEVEL_AUTHOR_LEN,
- level.author,
- "Author"
- }
-};
+ -1, ED_SETTINGS_YPOS(6),
+ MIN_COLLECT_COUNT, MAX_COLLECT_COUNT,
+ GADGET_ID_CUSTOM_GEMCOUNT_DOWN, GADGET_ID_CUSTOM_GEMCOUNT_UP,
+ GADGET_ID_CUSTOM_GEMCOUNT_TEXT, GADGET_ID_CUSTOM_SCORE_UP,
+ &custom_element.collect_count,
+ NULL, "count", NULL
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(7),
+ 0, 999,
+ GADGET_ID_PUSH_DELAY_FIX_DOWN, GADGET_ID_PUSH_DELAY_FIX_UP,
+ GADGET_ID_PUSH_DELAY_FIX_TEXT, GADGET_ID_NONE,
+ &custom_element.push_delay_fixed,
+ NULL, "push delay", NULL
+ },
+ {
+ -1, ED_SETTINGS_YPOS(7),
+ 0, 999,
+ GADGET_ID_PUSH_DELAY_RND_DOWN, GADGET_ID_PUSH_DELAY_RND_UP,
+ GADGET_ID_PUSH_DELAY_RND_TEXT, GADGET_ID_PUSH_DELAY_FIX_UP,
+ &custom_element.push_delay_random,
+ NULL, "+random", NULL
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(12),
+ 0, 999,
+ GADGET_ID_MOVE_DELAY_FIX_DOWN, GADGET_ID_MOVE_DELAY_FIX_UP,
+ GADGET_ID_MOVE_DELAY_FIX_TEXT, GADGET_ID_NONE,
+ &custom_element.move_delay_fixed,
+ NULL, "move delay", NULL
+ },
+ {
+ -1, ED_SETTINGS_YPOS(12),
+ 0, 999,
+ GADGET_ID_MOVE_DELAY_RND_DOWN, GADGET_ID_MOVE_DELAY_RND_UP,
+ GADGET_ID_MOVE_DELAY_RND_TEXT, GADGET_ID_MOVE_DELAY_FIX_UP,
+ &custom_element.move_delay_random,
+ NULL, "+random", NULL
+ },
+
+ /* ---------- element settings: configure 2 (custom elements) ------------ */
-static struct
-{
- int xpos, ypos;
- int x, y;
- int gadget_id;
- char *infotext;
-} scrollbutton_info[ED_NUM_SCROLLBUTTONS] =
-{
{
- ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 0 * ED_SCROLLBUTTON_YSIZE,
- ED_SCROLL_UP_XPOS, ED_SCROLL_UP_YPOS,
- GADGET_ID_SCROLL_UP,
- "scroll level editing area up"
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4),
+ 0, 255,
+ GADGET_ID_EXPLOSION_DELAY_DOWN, GADGET_ID_EXPLOSION_DELAY_UP,
+ GADGET_ID_EXPLOSION_DELAY_TEXT, GADGET_ID_NONE,
+ &custom_element.explosion_delay,
+ NULL, "explosion delay", NULL
},
{
- ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 1 * ED_SCROLLBUTTON_YSIZE,
- ED_SCROLL_DOWN_XPOS, ED_SCROLL_DOWN_YPOS,
- GADGET_ID_SCROLL_DOWN,
- "scroll level editing area down"
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(5),
+ 0, 255,
+ GADGET_ID_IGNITION_DELAY_DOWN, GADGET_ID_IGNITION_DELAY_UP,
+ GADGET_ID_IGNITION_DELAY_TEXT, GADGET_ID_NONE,
+ &custom_element.ignition_delay,
+ NULL, "ignition delay", "(by fire)"
},
+
+ /* ---------- element settings: configure (group elements) --------------- */
+
{
- ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 2 * ED_SCROLLBUTTON_YSIZE,
- ED_SCROLL_LEFT_XPOS, ED_SCROLL_LEFT_YPOS,
- GADGET_ID_SCROLL_LEFT,
- "scroll level editing area left"
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(5),
+ MIN_ELEMENTS_IN_GROUP, MAX_ELEMENTS_IN_GROUP,
+ GADGET_ID_GROUP_CONTENT_DOWN, GADGET_ID_GROUP_CONTENT_UP,
+ GADGET_ID_GROUP_CONTENT_TEXT, GADGET_ID_NONE,
+ &group_element_info.num_elements,
+ NULL, NULL, "number of elements in group"
},
+
+ /* ---------- element settings: advanced (custom elements) --------------- */
+
{
- ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 3 * ED_SCROLLBUTTON_YSIZE,
- ED_SCROLL_RIGHT_XPOS, ED_SCROLL_RIGHT_YPOS,
- GADGET_ID_SCROLL_RIGHT,
- "scroll level editing area right"
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(2),
+ 0, 999,
+ GADGET_ID_CHANGE_DELAY_FIX_DOWN, GADGET_ID_CHANGE_DELAY_FIX_UP,
+ GADGET_ID_CHANGE_DELAY_FIX_TEXT, GADGET_ID_NONE,
+ &custom_element_change.delay_fixed,
+ NULL, "delay", NULL,
},
{
- ED_SCROLLBUTTON2_XPOS, ED_SCROLLBUTTON2_YPOS + 0 * ED_SCROLLBUTTON2_YSIZE,
- ED_SCROLL2_UP_XPOS, ED_SCROLL2_UP_YPOS,
- GADGET_ID_SCROLL_LIST_UP,
- "scroll element list up ('Page Up')"
+ -1, ED_SETTINGS_YPOS(2),
+ 0, 999,
+ GADGET_ID_CHANGE_DELAY_RND_DOWN, GADGET_ID_CHANGE_DELAY_RND_UP,
+ GADGET_ID_CHANGE_DELAY_RND_TEXT, GADGET_ID_CHANGE_DELAY_FIX_UP,
+ &custom_element_change.delay_random,
+ NULL, "+random", NULL
},
{
- ED_SCROLLBUTTON2_XPOS, ED_SCROLLBUTTON2_YPOS + 1 * ED_SCROLLBUTTON2_YSIZE,
- ED_SCROLL2_DOWN_XPOS, ED_SCROLL2_DOWN_YPOS,
- GADGET_ID_SCROLL_LIST_DOWN,
- "scroll element list down ('Page Down')"
- }
+ ED_SETTINGS_XPOS(3), ED_SETTINGS_YPOS(11),
+ 0, 100,
+ GADGET_ID_CHANGE_CONT_RND_DOWN, GADGET_ID_CHANGE_CONT_RND_UP,
+ GADGET_ID_CHANGE_CONT_RND_TEXT, GADGET_ID_NONE,
+ &custom_element_change.random,
+ NULL, "use random replace:", "%"
+ },
};
static struct
{
- int xpos, ypos;
int x, y;
- int width, height;
- int type;
int gadget_id;
- char *infotext;
-} scrollbar_info[ED_NUM_SCROLLBARS] =
+ int size;
+ char *value;
+ char *text_above, *infotext;
+} textinput_info[ED_NUM_TEXTINPUT] =
{
{
- ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS,
- SX + ED_SCROLL_HORIZONTAL_XPOS, SY + ED_SCROLL_HORIZONTAL_YPOS,
- ED_SCROLL_HORIZONTAL_XSIZE, ED_SCROLL_HORIZONTAL_YSIZE,
- GD_TYPE_SCROLLBAR_HORIZONTAL,
- GADGET_ID_SCROLL_HORIZONTAL,
- "scroll level editing area horizontally"
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(0),
+ GADGET_ID_LEVEL_NAME,
+ MAX_LEVEL_NAME_LEN,
+ level.name,
+ "Title:", "Title"
},
{
- ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS,
- SX + ED_SCROLL_VERTICAL_XPOS, SY + ED_SCROLL_VERTICAL_YPOS,
- ED_SCROLL_VERTICAL_XSIZE, ED_SCROLL_VERTICAL_YSIZE,
- GD_TYPE_SCROLLBAR_VERTICAL,
- GADGET_ID_SCROLL_VERTICAL,
- "scroll level editing area vertically"
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(1),
+ GADGET_ID_LEVEL_AUTHOR,
+ MAX_LEVEL_AUTHOR_LEN,
+ level.author,
+ "Author:", "Author"
},
{
- ED_SCROLLBAR2_XPOS, ED_SCROLLBAR2_YPOS,
- DX + ED_SCROLL2_VERTICAL_XPOS, DY + ED_SCROLL2_VERTICAL_YPOS,
- ED_SCROLL2_VERTICAL_XSIZE, ED_SCROLL2_VERTICAL_YSIZE,
- GD_TYPE_SCROLLBAR_VERTICAL,
- GADGET_ID_SCROLL_LIST_VERTICAL,
- "scroll element list vertically"
+ 5 * MINI_TILEX - 2, 5 * MINI_TILEY - ED_BORDER_SIZE + 1,
+ GADGET_ID_ELEMENT_NAME,
+ MAX_ELEMENT_NAME_LEN - 2, /* currently 2 chars less editable */
+ custom_element.description,
+ NULL, "Element name"
}
};
{
int x, y;
int gadget_id;
- int radio_button_nr;
- int *value;
- int checked_value;
- char *text, *infotext;
-} radiobutton_info[ED_NUM_RADIOBUTTONS] =
+ int xsize, ysize;
+ char *value;
+ char *text_above, *infotext;
+} textarea_info[ED_NUM_TEXTAREAS] =
{
{
- ED_SETTINGS_XPOS + 160, ED_COUNTER2_YPOS(8),
- GADGET_ID_RANDOM_PERCENTAGE,
- RADIO_NR_RANDOM_ELEMENTS,
- &random_placement_method, RANDOM_USE_PERCENTAGE,
- "percentage", "use percentage for random elements"
- },
- {
- ED_SETTINGS_XPOS + 340, ED_COUNTER2_YPOS(8),
- GADGET_ID_RANDOM_QUANTITY,
- RADIO_NR_RANDOM_ELEMENTS,
- &random_placement_method, RANDOM_USE_QUANTITY,
- "quantity", "use quantity for random elements"
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2),
+ GADGET_ID_ENVELOPE_INFO,
+ MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
+ NULL,
+ "Envelope Info:", "Envelope Info"
}
};
-static struct
+static struct ValueTextInfo options_access_type[] =
{
- int x, y;
- int gadget_id;
- boolean *value;
- char *text, *infotext;
-} checkbutton_info[ED_NUM_CHECKBUTTONS] =
+ { EP_WALKABLE, "walkable" },
+ { EP_PASSABLE, "passable" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_access_layer[] =
{
+ { EP_ACCESSIBLE_OVER, "over" },
+ { EP_ACCESSIBLE_INSIDE, "inside" },
+ { EP_ACCESSIBLE_UNDER, "under" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_access_protected[] =
+{
+ { 0, "unprotected" },
+ { 1, "protected" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_access_direction[] =
+{
+ { MV_LEFT, "left" },
+ { MV_RIGHT, "right" },
+ { MV_UP, "up" },
+ { MV_DOWN, "down" },
+ { MV_LEFT | MV_UP, "left + up" },
+ { MV_LEFT | MV_DOWN, "left + down" },
+ { MV_RIGHT | MV_UP, "right + up" },
+ { MV_RIGHT | MV_DOWN, "right + down" },
+ { MV_HORIZONTAL, "horizontal" },
+ { MV_VERTICAL, "vertical" },
+ { MV_HORIZONTAL | MV_UP, "horizontal + up" },
+ { MV_HORIZONTAL | MV_DOWN, "horizontal + down" },
+ { MV_VERTICAL | MV_LEFT, "vertical + left" },
+ { MV_VERTICAL | MV_RIGHT, "vertical + right" },
+ { MV_ALL_DIRECTIONS, "all directions" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_walk_to_action[] =
+{
+ { EP_DIGGABLE, "diggable" },
+ { EP_COLLECTIBLE_ONLY, "collectible" },
+ { EP_DROPPABLE, "collectible & droppable" },
+ { EP_PUSHABLE, "pushable" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_move_pattern[] =
+{
+ { MV_LEFT, "left" },
+ { MV_RIGHT, "right" },
+ { MV_UP, "up" },
+ { MV_DOWN, "down" },
+ { MV_HORIZONTAL, "horizontal" },
+ { MV_VERTICAL, "vertical" },
+ { MV_ALL_DIRECTIONS, "all directions" },
+ { MV_TOWARDS_PLAYER, "towards player" },
+ { MV_AWAY_FROM_PLAYER, "away from player" },
+ { MV_ALONG_LEFT_SIDE, "along left side" },
+ { MV_ALONG_RIGHT_SIDE, "along right side" },
+ { MV_TURNING_LEFT, "turning left" },
+ { MV_TURNING_RIGHT, "turning right" },
+ { MV_TURNING_LEFT_RIGHT, "turning left, right" },
+ { MV_TURNING_RIGHT_LEFT, "turning right, left" },
+ { MV_TURNING_RANDOM, "turning random" },
+ { MV_WHEN_PUSHED, "when pushed" },
+ { MV_WHEN_DROPPED, "when dropped" },
+ { MV_MAZE_RUNNER, "maze runner style" },
+ { MV_MAZE_HUNTER, "maze hunter style" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_move_direction[] =
+{
+ { MV_START_AUTOMATIC, "automatic" },
+ { MV_START_LEFT, "left" },
+ { MV_START_RIGHT, "right" },
+ { MV_START_UP, "up" },
+ { MV_START_DOWN, "down" },
+ { MV_START_RANDOM, "random" },
+ { MV_START_PREVIOUS, "previous" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_move_stepsize[] =
+{
+ { 1, "very slow" },
+ { 2, "slow" },
+ { 4, "normal" },
+ { 8, "fast" },
+ { 16, "very fast" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_move_leave_type[] =
+{
+ { LEAVE_TYPE_UNLIMITED, "leave behind" },
+ { LEAVE_TYPE_LIMITED, "change it to" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_smash_targets[] =
+{
+ { EP_CAN_SMASH_PLAYER, "player" },
+#if 0
+ { EP_CAN_SMASH_ENEMIES, "enemies" },
+#endif
+ { EP_CAN_SMASH_EVERYTHING, "everything" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_slippery_type[] =
+{
+ { SLIPPERY_ANY_RANDOM, "random" },
+ { SLIPPERY_ANY_LEFT_RIGHT, "left, right" },
+ { SLIPPERY_ANY_RIGHT_LEFT, "right, left" },
+ { SLIPPERY_ONLY_LEFT, "only left" },
+ { SLIPPERY_ONLY_RIGHT, "only right" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_deadliness[] =
+{
+ { EP_DONT_RUN_INTO, "running into" },
+ { EP_DONT_COLLIDE_WITH, "colliding with" },
+ { EP_DONT_TOUCH, "touching" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_consistency[] =
+{
+ { EP_CAN_EXPLODE_3X3, "can explode 3x3" },
+ { EP_CAN_EXPLODE_DYNA, "can explode 3+3" },
+ { EP_CAN_EXPLODE_1X1, "can explode 1x1" },
+ { EP_INDESTRUCTIBLE, "indestructible" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_time_units[] =
+{
+ { 1, "frames" },
+ { FRAMES_PER_SECOND, "seconds" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_direct_action[] =
+{
+ { CE_TOUCHED_BY_PLAYER, "touched by player ..." },
+ { CE_PRESSED_BY_PLAYER, "pressed by player ..." },
+ { CE_PUSHED_BY_PLAYER, "pushed by player ..." },
+ { CE_ENTERED_BY_PLAYER, "entered by player ..." },
+ { CE_LEFT_BY_PLAYER, "left by player ..." },
+ { CE_DROPPED_BY_PLAYER, "dropped by player" },
+ { CE_SWITCHED, "switched ..." },
+#if 1
+ { CE_HITTING_SOMETHING, "hitting something ..." },
+ { CE_HIT_BY_SOMETHING, "hit by something ..." },
+#else
+ { CE_HITTING_SOMETHING, "collision ..." },
+#endif
+ { CE_IMPACT, "impact (on something)" },
+ { CE_SMASHED, "smashed (from above)" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_other_action[] =
+{
+ { CE_OTHER_GETS_TOUCHED, "player touches ..." },
+ { CE_OTHER_GETS_PRESSED, "player presses ..." },
+ { CE_OTHER_GETS_PUSHED, "player pushes ..." },
+ { CE_OTHER_GETS_ENTERED, "player enters ..." },
+ { CE_OTHER_GETS_LEFT, "player leaves ..." },
+ { CE_OTHER_GETS_DIGGED, "player digs" },
+ { CE_OTHER_GETS_COLLECTED, "player collects" },
+ { CE_OTHER_GETS_DROPPED, "player drops" },
+ { CE_OTHER_IS_TOUCHING, "touching ..." },
+#if 1
+ { CE_OTHER_IS_HITTING, "hitting ..." },
+ { CE_OTHER_GETS_HIT, "hit by ..." },
+#endif
+ { CE_OTHER_IS_SWITCHING, "switch of ..." },
+ { CE_OTHER_IS_CHANGING, "change of" },
+ { CE_OTHER_IS_EXPLODING, "explosion of" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_sides[] =
+{
+ { CH_SIDE_LEFT, "left side" },
+ { CH_SIDE_RIGHT, "right side" },
+ { CH_SIDE_TOP, "top side" },
+ { CH_SIDE_BOTTOM, "bottom side" },
+ { CH_SIDE_LEFT_RIGHT, "left/right side" },
+ { CH_SIDE_TOP_BOTTOM, "top/bottom side" },
+ { CH_SIDE_ANY, "any side" },
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_power[] =
+{
+ { CP_NON_DESTRUCTIVE, "empty" },
+ { CP_HALF_DESTRUCTIVE, "diggable" },
+ { CP_FULL_DESTRUCTIVE, "destructible" },
+ { -1, NULL }
+};
+
+static char options_change_page_strings[MAX_CHANGE_PAGES][10];
+static struct ValueTextInfo options_change_page[MAX_CHANGE_PAGES + 1] =
+{
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_group_choice_mode[] =
+{
+ { ANIM_RANDOM, "random" },
+ { ANIM_LOOP, "loop" },
+ { ANIM_LINEAR, "linear" },
+ { ANIM_PINGPONG, "pingpong" },
+ { ANIM_PINGPONG2, "pingpong 2" },
+ { -1, NULL }
+};
+
+static struct
+{
+ int x, y;
+ int gadget_id;
+ int gadget_id_align;
+ int size; /* char size of selectbox or '-1' (dynamically determined) */
+ struct ValueTextInfo *options;
+ int *value;
+ char *text_left, *text_right, *infotext;
+} selectbox_info[ED_NUM_SELECTBOX] =
+{
+ /* ---------- element settings: configure 1 (custom elements) ----------- */
+
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(6) - MINI_TILEY,
- GADGET_ID_DOUBLE_SPEED,
- &level.double_speed,
- "double speed movement", "set movement speed of player"
- },
- {
- ED_SETTINGS_XPOS + 340, ED_COUNTER_YPOS(6) - MINI_TILEY,
- GADGET_ID_GRAVITY,
- &level.gravity,
- "gravity", "set level gravity"
- },
- {
- ED_SETTINGS_XPOS, ED_COUNTER2_YPOS(9) - MINI_TILEY,
- GADGET_ID_RANDOM_RESTRICTED,
- &random_placement_background_restricted,
- "restrict random placement to", "set random placement restriction"
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_ACCESS_TYPE, GADGET_ID_NONE,
+ -1,
+ options_access_type,
+ &custom_element.access_type,
+ NULL, NULL, "type of access to this field"
},
{
- ED_SETTINGS_XPOS, ED_COUNTER_YPOS(4),
- GADGET_ID_STICK_ELEMENT,
- &stick_element_properties_window,
- "stick window to edit content", "stick window to edit content"
+ -1, ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_ACCESS_LAYER, GADGET_ID_CUSTOM_ACCESS_TYPE,
+ -1,
+ options_access_layer,
+ &custom_element.access_layer,
+ NULL, NULL, "layer of access for this field"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_ACCESS_PROTECTED, GADGET_ID_CUSTOM_ACCESS_LAYER,
+ -1,
+ options_access_protected,
+ &custom_element.access_protected,
+ NULL, NULL, "protected access for this field"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4),
+ GADGET_ID_CUSTOM_ACCESS_DIRECTION, GADGET_ID_NONE,
+ -1,
+ options_access_direction,
+ &custom_element.access_direction,
+ "from", NULL, "access direction for this field"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(5),
+ GADGET_ID_CUSTOM_WALK_TO_ACTION, GADGET_ID_NONE,
+ -1,
+ options_walk_to_action,
+ &custom_element.walk_to_action,
+ NULL, NULL, "diggable/collectible/pushable"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8),
+ GADGET_ID_CUSTOM_MOVE_PATTERN, GADGET_ID_NONE,
+ -1,
+ options_move_pattern,
+ &custom_element.move_pattern,
+ "can move", NULL, "element move direction"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(9),
+ GADGET_ID_CUSTOM_MOVE_DIRECTION, GADGET_ID_NONE,
+ -1,
+ options_move_direction,
+ &custom_element.move_direction_initial,
+ "starts moving", NULL, "initial element move direction"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(11),
+ GADGET_ID_CUSTOM_MOVE_STEPSIZE, GADGET_ID_NONE,
+ -1,
+ options_move_stepsize,
+ &custom_element.move_stepsize,
+ "move/fall speed", NULL, "speed of element movement"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(10),
+ GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE, GADGET_ID_NONE,
+ -1,
+ options_move_leave_type,
+ &custom_element.move_leave_type,
+ "can dig: can", ":", "leave behind or change element"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(13),
+ GADGET_ID_CUSTOM_SMASH_TARGETS, GADGET_ID_CUSTOM_CAN_SMASH,
+ -1,
+ options_smash_targets,
+ &custom_element.smash_targets,
+ "can smash", NULL, "elements that can be smashed"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(14),
+ GADGET_ID_CUSTOM_SLIPPERY_TYPE, GADGET_ID_NONE,
+ -1,
+ options_slippery_type,
+ &custom_element.slippery_type,
+ "slippery", NULL, "where other elements fall down"
+ },
+
+ /* ---------- element settings: configure 2 (custom elements) ----------- */
+
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(1),
+ GADGET_ID_CUSTOM_DEADLINESS, GADGET_ID_NONE,
+ -1,
+ options_deadliness,
+ &custom_element.deadliness,
+ "deadly when", NULL, "deadliness of element"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(2),
+ GADGET_ID_CUSTOM_CONSISTENCY, GADGET_ID_NONE,
+ -1,
+ options_consistency,
+ &custom_element.consistency,
+ NULL, NULL, "consistency/destructibility"
+ },
+
+ /* ---------- element settings: advanced (custom elements) --------------- */
+
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(3),
+ GADGET_ID_CHANGE_TIME_UNITS, GADGET_ID_NONE,
+ -1,
+ options_time_units,
+ &custom_element_change.delay_frames,
+ "delay time given in", NULL, "delay time units for change"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(4),
+ GADGET_ID_CHANGE_DIRECT_ACTION, GADGET_ID_NONE,
+ -1,
+ options_change_direct_action,
+ &custom_element_change.direct_action,
+ NULL, NULL, "type of direct action"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(5),
+ GADGET_ID_CHANGE_OTHER_ACTION, GADGET_ID_NONE,
+ -1,
+ options_change_other_action,
+ &custom_element_change.other_action,
+ NULL, "element:", "type of other element action"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(6),
+ GADGET_ID_CHANGE_SIDES, GADGET_ID_NONE,
+ -1,
+ options_change_sides,
+ &custom_element_change.sides,
+ "... at", NULL, "element side that causes change"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(9),
+ GADGET_ID_CHANGE_POWER, GADGET_ID_NONE,
+ -1,
+ options_change_power,
+ &custom_element_change.power,
+ "replace when", NULL, "which elements can be replaced"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(13),
+ GADGET_ID_SELECT_CHANGE_PAGE, GADGET_ID_NONE,
+ 3,
+ options_change_page,
+ &custom_element.current_change_page,
+ NULL, NULL, "element change page"
+ },
+
+ /* ---------- element settings: configure (group elements) --------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(6),
+ GADGET_ID_GROUP_CHOICE_MODE, GADGET_ID_NONE,
+ -1,
+ options_group_choice_mode,
+ &group_element_info.choice_mode,
+ "choice type:", NULL, "type of group element choice"
+ },
+};
+
+static struct
+{
+ int x, y;
+ int gadget_id;
+ int gadget_id_align;
+ int size;
+ char *text;
+ char *text_left, *text_right, *infotext;
+} textbutton_info[ED_NUM_TEXTBUTTONS] =
+{
+#if 1
+ {
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_INFO, GADGET_ID_NONE,
+ 8, "Info",
+ NULL, NULL, "Show information about element"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 124, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CONFIG, GADGET_ID_NONE,
+ 8, "Config",
+ NULL, NULL, "Configure element properties"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 124, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CONFIG_1, GADGET_ID_NONE,
+ 8, "Config 1",
+ NULL, NULL, "Configure custom element properties"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 248, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CONFIG_2, GADGET_ID_NONE,
+ 8, "Config 2",
+ NULL, NULL, "Configure custom element properties"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 372, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CHANGE, GADGET_ID_NONE,
+ 8, "Change",
+ NULL, NULL, "Custom element change configuration"
+ },
+#else
+ {
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_INFO, GADGET_ID_NONE,
+ 11, "Information",
+ NULL, NULL, "Show information about element"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 166, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CONFIG, GADGET_ID_NONE,
+ 11, "Configure",
+ NULL, NULL, "Configure element properties"
+ },
+ {
+ ED_SETTINGS_XPOS(0) + 332, ED_COUNTER_YPOS(1),
+ GADGET_ID_PROPERTIES_CHANGE, GADGET_ID_NONE,
+ 11, "Advanced",
+ NULL, NULL, "Advanced element configuration"
+ },
+#endif
+ {
+ -1, ED_SETTINGS_YPOS(2),
+ GADGET_ID_SAVE_AS_TEMPLATE, GADGET_ID_CUSTOM_USE_TEMPLATE,
+ -1, "Save",
+ " ", "As Template", "Save current settings as new template"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(13),
+ GADGET_ID_ADD_CHANGE_PAGE, GADGET_ID_NEXT_CHANGE_PAGE,
+ -1, "New",
+ " ", NULL, "Add new change page"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(13),
+ GADGET_ID_DEL_CHANGE_PAGE, GADGET_ID_ADD_CHANGE_PAGE,
+ -1, "Delete",
+ NULL, NULL, "Delete current change page"
+ },
+};
+
+static struct
+{
+ int gd_x, gd_y;
+ int x, y;
+ int width, height;
+ int gadget_id;
+ int gadget_id_align;
+ char *text_left, *text_right, *infotext;
+} graphicbutton_info[ED_NUM_GRAPHICBUTTONS] =
+{
+ {
+ ED_BUTTON_MINUS_XPOS, ED_BUTTON_COUNT_YPOS,
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(13),
+ ED_BUTTON_COUNT_XSIZE, ED_BUTTON_COUNT_YSIZE,
+ GADGET_ID_PREV_CHANGE_PAGE, GADGET_ID_NONE,
+ NULL, NULL, "select previous change page"
+ },
+ {
+ ED_BUTTON_PLUS_XPOS, ED_BUTTON_COUNT_YPOS,
+ -1, ED_SETTINGS_YPOS(13),
+ ED_BUTTON_COUNT_XSIZE, ED_BUTTON_COUNT_YSIZE,
+ GADGET_ID_NEXT_CHANGE_PAGE, GADGET_ID_SELECT_CHANGE_PAGE,
+ NULL, "change page", "select next change page"
+ },
+};
+
+static struct
+{
+ int gd_x, gd_y;
+ int x, y;
+ int gadget_id;
+ char *infotext;
+} scrollbutton_info[ED_NUM_SCROLLBUTTONS] =
+{
+ {
+ ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 0 * ED_SCROLLBUTTON_YSIZE,
+ ED_SCROLL_UP_XPOS, ED_SCROLL_UP_YPOS,
+ GADGET_ID_SCROLL_UP,
+ "scroll level editing area up"
+ },
+ {
+ ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 1 * ED_SCROLLBUTTON_YSIZE,
+ ED_SCROLL_DOWN_XPOS, ED_SCROLL_DOWN_YPOS,
+ GADGET_ID_SCROLL_DOWN,
+ "scroll level editing area down"
+ },
+ {
+ ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 2 * ED_SCROLLBUTTON_YSIZE,
+ ED_SCROLL_LEFT_XPOS, ED_SCROLL_LEFT_YPOS,
+ GADGET_ID_SCROLL_LEFT,
+ "scroll level editing area left"
+ },
+ {
+ ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 3 * ED_SCROLLBUTTON_YSIZE,
+ ED_SCROLL_RIGHT_XPOS, ED_SCROLL_RIGHT_YPOS,
+ GADGET_ID_SCROLL_RIGHT,
+ "scroll level editing area right"
+ },
+ {
+ ED_SCROLLBUTTON2_XPOS, ED_SCROLLBUTTON2_YPOS + 0 * ED_SCROLLBUTTON2_YSIZE,
+ ED_SCROLL2_UP_XPOS, ED_SCROLL2_UP_YPOS,
+ GADGET_ID_SCROLL_LIST_UP,
+ "scroll element list up ('Page Up')"
+ },
+ {
+ ED_SCROLLBUTTON2_XPOS, ED_SCROLLBUTTON2_YPOS + 1 * ED_SCROLLBUTTON2_YSIZE,
+ ED_SCROLL2_DOWN_XPOS, ED_SCROLL2_DOWN_YPOS,
+ GADGET_ID_SCROLL_LIST_DOWN,
+ "scroll element list down ('Page Down')"
+ },
+};
+
+static struct
+{
+ int gd_x, gd_y;
+ int x, y;
+ int width, height;
+ int type;
+ int gadget_id;
+ char *infotext;
+} scrollbar_info[ED_NUM_SCROLLBARS] =
+{
+ {
+ ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS,
+ SX + ED_SCROLL_HORIZONTAL_XPOS, SY + ED_SCROLL_HORIZONTAL_YPOS,
+ ED_SCROLL_HORIZONTAL_XSIZE, ED_SCROLL_HORIZONTAL_YSIZE,
+ GD_TYPE_SCROLLBAR_HORIZONTAL,
+ GADGET_ID_SCROLL_HORIZONTAL,
+ "scroll level editing area horizontally"
+ },
+ {
+ ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS,
+ SX + ED_SCROLL_VERTICAL_XPOS, SY + ED_SCROLL_VERTICAL_YPOS,
+ ED_SCROLL_VERTICAL_XSIZE, ED_SCROLL_VERTICAL_YSIZE,
+ GD_TYPE_SCROLLBAR_VERTICAL,
+ GADGET_ID_SCROLL_VERTICAL,
+ "scroll level editing area vertically"
+ },
+ {
+ ED_SCROLLBAR2_XPOS, ED_SCROLLBAR2_YPOS,
+ DX + ED_SCROLL2_VERTICAL_XPOS, DY + ED_SCROLL2_VERTICAL_YPOS,
+ ED_SCROLL2_VERTICAL_XSIZE, ED_SCROLL2_VERTICAL_YSIZE,
+ GD_TYPE_SCROLLBAR_VERTICAL,
+ GADGET_ID_SCROLL_LIST_VERTICAL,
+ "scroll element list vertically"
+ }
+};
+
+static struct
+{
+ int x, y;
+ int gadget_id;
+ int gadget_id_align;
+ int radio_button_nr;
+ int *value;
+ int checked_value;
+ char *text_left, *text_right, *infotext;
+} radiobutton_info[ED_NUM_RADIOBUTTONS] =
+{
+ {
+ -1, ED_COUNTER2_YPOS(8),
+ GADGET_ID_RANDOM_PERCENTAGE, GADGET_ID_LEVEL_RANDOM_UP,
+ RADIO_NR_RANDOM_ELEMENTS,
+ &random_placement_method, RANDOM_USE_PERCENTAGE,
+ " ", "percentage", "use percentage for random elements"
+ },
+ {
+ -1, ED_COUNTER2_YPOS(8),
+ GADGET_ID_RANDOM_QUANTITY, GADGET_ID_RANDOM_PERCENTAGE,
+ RADIO_NR_RANDOM_ELEMENTS,
+ &random_placement_method, RANDOM_USE_QUANTITY,
+ " ", "quantity", "use quantity for random elements"
}
};
-/* maximal size of level editor drawing area */
-#define MAX_ED_FIELDX (2 * SCR_FIELDX)
-#define MAX_ED_FIELDY (2 * SCR_FIELDY - 1)
+static struct
+{
+ int x, y;
+ int gadget_id;
+ int gadget_id_align;
+ boolean *value;
+ char *text_left, *text_right, *infotext;
+} checkbutton_info[ED_NUM_CHECKBUTTONS] =
+{
+ /* ---------- level and editor settings ---------------------------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(6) - MINI_TILEY,
+ GADGET_ID_DOUBLE_SPEED, GADGET_ID_NONE,
+ &level.double_speed,
+ NULL, "double speed movement", "set movement speed of player"
+ },
+ {
+ -1, ED_COUNTER_YPOS(6) - MINI_TILEY,
+ GADGET_ID_GRAVITY, GADGET_ID_DOUBLE_SPEED,
+ &level.initial_gravity,
+ " ", "gravity", "set level gravity"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_COUNTER2_YPOS(9) - MINI_TILEY,
+ GADGET_ID_RANDOM_RESTRICTED, GADGET_ID_NONE,
+ &random_placement_background_restricted,
+ NULL,
+ "restrict random placement to:", "set random placement restriction"
+ },
+
+ /* ---------- element settings: configure (various elements) ------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ GADGET_ID_STICK_ELEMENT, GADGET_ID_NONE,
+ &stick_element_properties_window,
+ NULL,
+ "stick this screen to edit content","stick this screen to edit content"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
+ GADGET_ID_EM_SLIPPERY_GEMS, GADGET_ID_NONE,
+ &level.em_slippery_gems,
+ NULL,
+ "slip down from certain flat walls","use EM style slipping behaviour"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ GADGET_ID_USE_SPRING_BUG, GADGET_ID_NONE,
+ &level.use_spring_bug,
+ NULL,
+ "use spring pushing bug", "use odd spring pushing behaviour"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ GADGET_ID_BLOCK_LAST_FIELD, GADGET_ID_NONE,
+ &level.block_last_field,
+ NULL,
+ "block last field when moving", "player blocks last field when moving"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ GADGET_ID_SP_BLOCK_LAST_FIELD, GADGET_ID_NONE,
+ &level.sp_block_last_field,
+ NULL,
+ "block last field when moving", "player blocks last field when moving"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0),
+ GADGET_ID_CAN_MOVE_INTO_ACID, GADGET_ID_NONE,
+ &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
+ NULL,
+ "can move into acid", "element can move into acid pool"
+ },
+
+ /* ---------- element settings: configure 1 (custom elements) ----------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
+ GADGET_ID_CUSTOM_USE_GRAPHIC, GADGET_ID_NONE,
+ &custom_element.use_gfx_element,
+ NULL, "use graphic of element:", "use graphic for custom element"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2),
+ GADGET_ID_CUSTOM_USE_TEMPLATE, GADGET_ID_NONE,
+ &level.use_custom_template,
+ NULL, "use template", "use template for custom properties"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_ACCESSIBLE, GADGET_ID_NONE,
+ &custom_element_properties[EP_ACCESSIBLE],
+ NULL, NULL, "player can walk to or pass this field"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(5),
+ GADGET_ID_CUSTOM_WALK_TO_OBJECT, GADGET_ID_NONE,
+ &custom_element_properties[EP_WALK_TO_OBJECT],
+ NULL, NULL, "player can dig/collect/push element"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(8),
+ GADGET_ID_CUSTOM_CAN_MOVE, GADGET_ID_NONE,
+ &custom_element_properties[EP_CAN_MOVE],
+ NULL, NULL, "element can move in some direction"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(13),
+ GADGET_ID_CUSTOM_CAN_FALL, GADGET_ID_NONE,
+ &custom_element_properties[EP_CAN_FALL],
+ NULL, "can fall", "element can fall down"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(13),
+ GADGET_ID_CUSTOM_CAN_SMASH, GADGET_ID_CUSTOM_CAN_FALL,
+ &custom_element_properties[EP_CAN_SMASH],
+ " ", NULL, "element can smash other elements"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(14),
+ GADGET_ID_CUSTOM_SLIPPERY, GADGET_ID_NONE,
+ &custom_element_properties[EP_SLIPPERY],
+ NULL, NULL, "other elements can fall down from it"
+ },
+
+ /* ---------- element settings: configure 2 (custom elements) ----------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
+ GADGET_ID_CUSTOM_DEADLY, GADGET_ID_NONE,
+ &custom_element_properties[EP_DEADLY],
+ NULL, NULL, "element can kill the player"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2),
+ GADGET_ID_CUSTOM_EXPLODE_RESULT, GADGET_ID_NONE,
+ &custom_element_properties[EP_EXPLODE_RESULT],
+ NULL, NULL, "set consistency/destructibility"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_EXPLODE_FIRE, GADGET_ID_NONE,
+ &custom_element.can_explode_by_fire,
+ NULL, "by fire", "element can explode by fire/explosion"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_EXPLODE_SMASH, GADGET_ID_CUSTOM_EXPLODE_FIRE,
+ &custom_element.can_explode_smashed,
+ " ", "smashed", "element can explode when smashed"
+ },
+ {
+ -1, ED_SETTINGS_YPOS(3),
+ GADGET_ID_CUSTOM_EXPLODE_IMPACT, GADGET_ID_CUSTOM_EXPLODE_SMASH,
+ &custom_element.can_explode_impact,
+ " ", "impact", "element can explode on impact"
+ },
+
+ /* ---------- element settings: advanced (custom elements) --------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
+ GADGET_ID_CUSTOM_CAN_CHANGE, GADGET_ID_NONE,
+ &custom_element_change.can_change,
+ NULL, "element changes to:", "element can change to other element"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(2),
+ GADGET_ID_CHANGE_DELAY, GADGET_ID_NONE,
+ &custom_element_change_events[CE_DELAY],
+ NULL, NULL, "element changes after delay"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4),
+ GADGET_ID_CHANGE_BY_DIRECT_ACT, GADGET_ID_NONE,
+ &custom_element_change_events[CE_BY_DIRECT_ACTION],
+ NULL, NULL, "element changes by direct action"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(5),
+ GADGET_ID_CHANGE_BY_OTHER_ACT, GADGET_ID_NONE,
+ &custom_element_change_events[CE_BY_OTHER_ACTION],
+ NULL, NULL, "element changes by other element"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(7),
+ GADGET_ID_CHANGE_USE_EXPLOSION, GADGET_ID_NONE,
+ &custom_element_change.explode,
+ NULL, "explode instead of change", "element explodes instead of change"
+ },
+ {
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8),
+ GADGET_ID_CHANGE_USE_CONTENT, GADGET_ID_NONE,
+ &custom_element_change.use_content,
+ NULL, "use extended change target:","element changes to more elements"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(10),
+ GADGET_ID_CHANGE_ONLY_COMPLETE, GADGET_ID_NONE,
+ &custom_element_change.only_complete,
+ NULL, "replace all or nothing", "only replace when all can be changed"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(11),
+ GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE,
+ &custom_element_change.use_random_change,
+ NULL, NULL, "use percentage for random replace"
+ },
+};
+
+static struct
+{
+ int x, y;
+ int area_xsize, area_ysize;
+ int gadget_id;
+ int gadget_id_align;
+ char *text_left, *text_right, *text_below;
+} drawingarea_info[ED_NUM_DRAWING_AREAS] =
+{
+ /* ---------- level playfield content ------------------------------------ */
+
+ {
+ 0, 0,
+ MAX_ED_FIELDX, MAX_ED_FIELDY,
+ GADGET_ID_DRAWING_LEVEL, GADGET_ID_NONE,
+ NULL, NULL, NULL
+ },
+
+ /* ---------- yam yam content -------------------------------------------- */
+
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(0), ED_AREA_YAMYAM_CONTENT_YPOS(0),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_0, GADGET_ID_NONE,
+ NULL, NULL, "1"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(1), ED_AREA_YAMYAM_CONTENT_YPOS(1),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_1, GADGET_ID_NONE,
+ NULL, NULL, "2"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(2), ED_AREA_YAMYAM_CONTENT_YPOS(2),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_2, GADGET_ID_NONE,
+ NULL, NULL, "3"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(3), ED_AREA_YAMYAM_CONTENT_YPOS(3),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_3, GADGET_ID_NONE,
+ NULL, NULL, "4"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(4), ED_AREA_YAMYAM_CONTENT_YPOS(4),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_4, GADGET_ID_NONE,
+ NULL, NULL, "5"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(5), ED_AREA_YAMYAM_CONTENT_YPOS(5),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_5, GADGET_ID_NONE,
+ NULL, NULL, "6"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(6), ED_AREA_YAMYAM_CONTENT_YPOS(6),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_6, GADGET_ID_NONE,
+ NULL, NULL, "7"
+ },
+ {
+ ED_AREA_YAMYAM_CONTENT_XPOS(7), ED_AREA_YAMYAM_CONTENT_YPOS(7),
+ 3, 3,
+ GADGET_ID_ELEMENT_CONTENT_7, GADGET_ID_NONE,
+ NULL, NULL, "8"
+ },
+
+ /* ---------- amoeba content --------------------------------------------- */
+
+ {
+ ED_AREA_AMOEBA_CONTENT_XPOS, ED_AREA_AMOEBA_CONTENT_YPOS,
+ 1, 1,
+ GADGET_ID_AMOEBA_CONTENT, GADGET_ID_NONE,
+ "content:", NULL, NULL
+ },
+
+ /* ---------- custom graphic --------------------------------------------- */
+
+ {
+ -1, ED_AREA_ELEM_CONTENT3_YPOS,
+ 1, 1,
+ GADGET_ID_CUSTOM_GRAPHIC, GADGET_ID_CUSTOM_USE_GRAPHIC,
+ NULL, NULL, NULL
+ },
+
+ /* ---------- custom content (when exploding) ---------------------------- */
+
+ {
+ ED_AREA_ELEM_CONTENT4_XPOS, ED_AREA_ELEM_CONTENT4_YPOS,
+ 3, 3,
+ GADGET_ID_CUSTOM_CONTENT, GADGET_ID_NONE, /* align three rows */
+ "content:", NULL, NULL
+ },
+
+ /* ---------- custom enter and leave element (when moving) --------------- */
+
+ {
+ ED_SETTINGS_XPOS(1), ED_AREA_ELEM_CONTENT4a_YPOS,
+ 1, 1,
+ GADGET_ID_CUSTOM_MOVE_ENTER, GADGET_ID_NONE,
+ "can dig:", " ", NULL
+ },
+ {
+ -1, ED_AREA_ELEM_CONTENT4b_YPOS,
+ 1, 1,
+ GADGET_ID_CUSTOM_MOVE_LEAVE, GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,
+ NULL, NULL, NULL
+ },
+
+ /* ---------- custom change target --------------------------------------- */
+
+ {
+ -1, ED_AREA_ELEM_CONTENT2_YPOS,
+ 1, 1,
+ GADGET_ID_CUSTOM_CHANGE_TARGET, GADGET_ID_CUSTOM_CAN_CHANGE,
+ NULL, "after/when:", NULL
+ },
+
+ /* ---------- custom change content (extended change target) ------------- */
+
+ {
+ ED_AREA_ELEM_CONTENT6_XPOS, ED_AREA_ELEM_CONTENT6_YPOS,
+ 3, 3,
+ GADGET_ID_CUSTOM_CHANGE_CONTENT, GADGET_ID_NONE, /* align three rows */
+ NULL, NULL, NULL
+ },
+
+ /* ---------- custom change trigger (element causing change) ------------- */
+
+ {
+ -1, ED_AREA_ELEM_CONTENT5_YPOS,
+ 1, 1,
+ GADGET_ID_CUSTOM_CHANGE_TRIGGER, GADGET_ID_CHANGE_OTHER_ACTION,
+ NULL, NULL, NULL
+ },
+
+ /* ---------- group element content -------------------------------------- */
+
+ {
+ ED_AREA_GROUP_CONTENT_XPOS, ED_AREA_GROUP_CONTENT_YPOS,
+ MAX_ELEMENTS_IN_GROUP, 1,
+ GADGET_ID_GROUP_CONTENT, GADGET_ID_NONE,
+ "content:", NULL, NULL
+ },
+
+ /* ---------- random background (for random painting) -------------------- */
+
+ {
+ -1, ED_AREA_RANDOM_BACKGROUND_YPOS,
+ 1, 1,
+ GADGET_ID_RANDOM_BACKGROUND, GADGET_ID_RANDOM_RESTRICTED,
+ NULL, NULL, NULL
+ },
+};
+
+
+/*
+ -----------------------------------------------------------------------------
+ some internally used variables
+ -----------------------------------------------------------------------------
+*/
+
+/* actual size of level editor drawing area */
+static int ed_fieldx = MAX_ED_FIELDX - 1, ed_fieldy = MAX_ED_FIELDY - 1;
+
+/* actual position of level editor drawing area in level playfield */
+static int level_xpos = -1, level_ypos = -1;
+
+#define IN_ED_FIELD(x,y) ((x)>=0 && (x)<ed_fieldx && (y)>=0 &&(y)<ed_fieldy)
+
+/* drawing elements on the three mouse buttons */
+static int new_element1 = EL_WALL;
+static int new_element2 = EL_EMPTY;
+static int new_element3 = EL_SAND;
+
+#define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
+ (button) == 2 ? new_element2 : \
+ (button) == 3 ? new_element3 : EL_EMPTY)
+#define BUTTON_STEPSIZE(button) ((button) == 1 ? 1 : (button) == 2 ? 5 : 10)
+
+/* forward declaration for internal use */
+static void ModifyEditorCounter(int, int);
+static void ModifyEditorCounterLimits(int, int, int);
+static void ModifyEditorSelectbox(int, int);
+static void ModifyEditorDrawingArea(int, int, int);
+static void ModifyEditorElementList();
+static void RedrawDrawingElements();
+static void DrawDrawingWindow();
+static void DrawLevelInfoWindow();
+static void DrawPropertiesWindow();
+static void UpdateCustomElementGraphicGadgets();
+static boolean checkPropertiesConfig(int);
+static void CopyLevelToUndoBuffer(int);
+static void HandleDrawingAreas(struct GadgetInfo *);
+static void HandleCounterButtons(struct GadgetInfo *);
+static void HandleTextInputGadgets(struct GadgetInfo *);
+static void HandleTextAreaGadgets(struct GadgetInfo *);
+static void HandleSelectboxGadgets(struct GadgetInfo *);
+static void HandleTextbuttonGadgets(struct GadgetInfo *);
+static void HandleGraphicbuttonGadgets(struct GadgetInfo *);
+static void HandleRadiobuttons(struct GadgetInfo *);
+static void HandleCheckbuttons(struct GadgetInfo *);
+static void HandleControlButtons(struct GadgetInfo *);
+static void HandleDrawingAreaInfo(struct GadgetInfo *);
+
+static struct GadgetInfo *level_editor_gadget[NUM_EDITOR_GADGETS];
+static int right_gadget_border[NUM_EDITOR_GADGETS];
+
+static int drawing_function = GADGET_ID_SINGLE_ITEMS;
+static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
+static boolean draw_with_brush = FALSE;
+static int properties_element = 0;
+
+static short FieldBackup[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+static short UndoBuffer[NUM_UNDO_STEPS][MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+static int undo_buffer_position = 0;
+static int undo_buffer_steps = 0;
+
+static int edit_mode;
+static int edit_mode_properties;
+
+static int element_shift = 0;
+
+static int editor_hl_boulderdash[] =
+{
+ EL_CHAR('B'),
+ EL_CHAR('O'),
+ EL_CHAR('U'),
+ EL_CHAR('L'),
+
+ EL_CHAR('-'),
+ EL_CHAR('D'),
+ EL_CHAR('E'),
+ EL_CHAR('R'),
+
+ EL_CHAR('D'),
+ EL_CHAR('A'),
+ EL_CHAR('S'),
+ EL_CHAR('H'),
+};
+
+static int editor_el_boulderdash[] =
+{
+ EL_PLAYER_1,
+ EL_EMPTY,
+ EL_SAND,
+ EL_STEELWALL,
+
+ EL_BD_WALL,
+ EL_BD_MAGIC_WALL,
+ EL_EXIT_CLOSED,
+ EL_EXIT_OPEN,
+
+ EL_BD_DIAMOND,
+ EL_BD_BUTTERFLY_UP,
+ EL_BD_FIREFLY_UP,
+ EL_BD_ROCK,
+
+ EL_BD_BUTTERFLY_LEFT,
+ EL_BD_FIREFLY_LEFT,
+ EL_BD_BUTTERFLY_RIGHT,
+ EL_BD_FIREFLY_RIGHT,
+
+ EL_BD_AMOEBA,
+ EL_BD_BUTTERFLY_DOWN,
+ EL_BD_FIREFLY_DOWN,
+ EL_EMPTY,
+};
+static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash;
+static int *editor_el_boulderdash_ptr = editor_el_boulderdash;
+static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash);
+static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
+
+static int editor_hl_emerald_mine[] =
+{
+ EL_CHAR('E'),
+ EL_CHAR('M'),
+ EL_CHAR('E'),
+ EL_CHAR('-'),
+
+ EL_CHAR('R'),
+ EL_CHAR('A'),
+ EL_CHAR('L'),
+ EL_CHAR('D'),
+
+ EL_CHAR('M'),
+ EL_CHAR('I'),
+ EL_CHAR('N'),
+ EL_CHAR('E'),
+};
+
+static int editor_el_emerald_mine[] =
+{
+ EL_PLAYER_1,
+ EL_PLAYER_2,
+ EL_PLAYER_3,
+ EL_PLAYER_4,
+
+ EL_PLAYER_1,
+ EL_EMPTY,
+ EL_SAND,
+ EL_ROCK,
+
+ EL_STEELWALL,
+ EL_WALL,
+ EL_WALL_SLIPPERY,
+ EL_MAGIC_WALL,
+
+ EL_EMERALD,
+ EL_DIAMOND,
+ EL_NUT,
+ EL_BOMB,
+
+ EL_WALL_EMERALD,
+ EL_WALL_DIAMOND,
+ EL_QUICKSAND_EMPTY,
+ EL_QUICKSAND_FULL,
+
+ EL_DYNAMITE,
+ EL_DYNAMITE_ACTIVE,
+ EL_EXIT_CLOSED,
+ EL_EXIT_OPEN,
+
+ EL_YAMYAM,
+ EL_BUG_UP,
+ EL_SPACESHIP_UP,
+ EL_ROBOT,
+
+ EL_BUG_LEFT,
+ EL_SPACESHIP_LEFT,
+ EL_BUG_RIGHT,
+ EL_SPACESHIP_RIGHT,
+
+ EL_ROBOT_WHEEL,
+ EL_BUG_DOWN,
+ EL_SPACESHIP_DOWN,
+ EL_INVISIBLE_WALL,
+
+ EL_ACID_POOL_TOPLEFT,
+ EL_ACID,
+ EL_ACID_POOL_TOPRIGHT,
+ EL_EMPTY,
+
+ EL_ACID_POOL_BOTTOMLEFT,
+ EL_ACID_POOL_BOTTOM,
+ EL_ACID_POOL_BOTTOMRIGHT,
+ EL_EMPTY,
+
+ EL_AMOEBA_DROP,
+ EL_AMOEBA_DEAD,
+ EL_AMOEBA_WET,
+ EL_AMOEBA_DRY,
+
+#if 1
+ EL_EM_KEY_1,
+ EL_EM_KEY_2,
+ EL_EM_KEY_3,
+ EL_EM_KEY_4,
+#else
+ EL_EM_KEY_1_FILE,
+ EL_EM_KEY_2_FILE,
+ EL_EM_KEY_3_FILE,
+ EL_EM_KEY_4_FILE,
+#endif
+
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+
+ EL_EM_GATE_1_GRAY,
+ EL_EM_GATE_2_GRAY,
+ EL_EM_GATE_3_GRAY,
+ EL_EM_GATE_4_GRAY,
+};
+static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine;
+static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine;
+static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine);
+static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine);
+
+static int editor_hl_more[] =
+{
+ EL_CHAR('M'),
+ EL_CHAR('O'),
+ EL_CHAR('R'),
+ EL_CHAR('E'),
+};
+
+static int editor_el_more[] =
+{
+ EL_KEY_1,
+ EL_KEY_2,
+ EL_KEY_3,
+ EL_KEY_4,
+
+ EL_GATE_1,
+ EL_GATE_2,
+ EL_GATE_3,
+ EL_GATE_4,
+
+ EL_GATE_1_GRAY,
+ EL_GATE_2_GRAY,
+ EL_GATE_3_GRAY,
+ EL_GATE_4_GRAY,
+
+ EL_ARROW_LEFT,
+ EL_ARROW_RIGHT,
+ EL_ARROW_UP,
+ EL_ARROW_DOWN,
+
+ EL_AMOEBA_FULL,
+ EL_EMERALD_YELLOW,
+ EL_EMERALD_RED,
+ EL_EMERALD_PURPLE,
+
+ EL_WALL_BD_DIAMOND,
+ EL_WALL_EMERALD_YELLOW,
+ EL_WALL_EMERALD_RED,
+ EL_WALL_EMERALD_PURPLE,
+
+ EL_GAME_OF_LIFE,
+ EL_PACMAN_UP,
+ EL_TIME_ORB_FULL,
+ EL_TIME_ORB_EMPTY,
+
+ EL_PACMAN_LEFT,
+ EL_DARK_YAMYAM,
+ EL_PACMAN_RIGHT,
+ EL_EXPANDABLE_WALL,
+
+ EL_BIOMAZE,
+ EL_PACMAN_DOWN,
+ EL_LAMP,
+ EL_LAMP_ACTIVE,
+
+ EL_DYNABOMB_INCREASE_NUMBER,
+ EL_DYNABOMB_INCREASE_SIZE,
+ EL_DYNABOMB_INCREASE_POWER,
+ EL_STONEBLOCK,
+
+ EL_MOLE,
+ EL_PENGUIN,
+ EL_PIG,
+ EL_DRAGON,
+
+ EL_BUG,
+ EL_MOLE_UP,
+ EL_BD_BUTTERFLY,
+ EL_BD_FIREFLY,
+
+ EL_MOLE_LEFT,
+ EL_EMPTY,
+ EL_MOLE_RIGHT,
+ EL_PACMAN,
+
+ EL_SPACESHIP,
+ EL_MOLE_DOWN,
+ EL_BALLOON,
+ EL_BALLOON_SWITCH_ANY,
+
+ EL_BALLOON_SWITCH_LEFT,
+ EL_BALLOON_SWITCH_RIGHT,
+ EL_BALLOON_SWITCH_UP,
+ EL_BALLOON_SWITCH_DOWN,
+
+ EL_SATELLITE,
+ EL_EXPANDABLE_WALL_HORIZONTAL,
+ EL_EXPANDABLE_WALL_VERTICAL,
+ EL_EXPANDABLE_WALL_ANY,
+
+ EL_INVISIBLE_STEELWALL,
+ EL_INVISIBLE_WALL,
+ EL_SPEED_PILL,
+ EL_BLACK_ORB,
+
+ EL_EMC_STEELWALL_1,
+ EL_EMC_WALL_1,
+ EL_EMC_WALL_2,
+ EL_EMC_WALL_3,
+
+ EL_EMC_WALL_4,
+ EL_EMC_WALL_5,
+ EL_EMC_WALL_6,
+ EL_EMC_WALL_7,
+};
+static int *editor_hl_more_ptr = editor_hl_more;
+static int *editor_el_more_ptr = editor_el_more;
+static int num_editor_hl_more = SIZEOF_ARRAY_INT(editor_hl_more);
+static int num_editor_el_more = SIZEOF_ARRAY_INT(editor_el_more);
+
+static int editor_hl_sokoban[] =
+{
+ EL_CHAR('S'),
+ EL_CHAR('O'),
+ EL_CHAR('K'),
+ EL_CHAR('O'),
+
+ EL_CHAR('-'),
+ EL_CHAR('B'),
+ EL_CHAR('A'),
+ EL_CHAR('N'),
+};
+
+static int editor_el_sokoban[] =
+{
+ EL_SOKOBAN_OBJECT,
+ EL_SOKOBAN_FIELD_EMPTY,
+ EL_SOKOBAN_FIELD_FULL,
+ EL_SOKOBAN_FIELD_PLAYER,
+};
+static int *editor_hl_sokoban_ptr = editor_hl_sokoban;
+static int *editor_el_sokoban_ptr = editor_el_sokoban;
+static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban);
+static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
+
+static int editor_hl_supaplex[] =
+{
+ EL_CHAR('S'),
+ EL_CHAR('U'),
+ EL_CHAR('P'),
+ EL_CHAR('A'),
+
+ EL_CHAR('P'),
+ EL_CHAR('L'),
+ EL_CHAR('E'),
+ EL_CHAR('X'),
+};
+
+static int editor_el_supaplex[] =
+{
+#if 1
+ EL_EMPTY,
+#else
+ EL_SP_EMPTY,
+#endif
+ EL_SP_ZONK,
+ EL_SP_BASE,
+ EL_SP_MURPHY,
+
+ EL_SP_INFOTRON,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_HARDWARE_GRAY,
+ EL_SP_EXIT_CLOSED,
+
+ EL_SP_DISK_ORANGE,
+ EL_SP_PORT_RIGHT,
+ EL_SP_PORT_DOWN,
+ EL_SP_PORT_LEFT,
+
+ EL_SP_PORT_UP,
+ EL_SP_GRAVITY_PORT_RIGHT,
+ EL_SP_GRAVITY_PORT_DOWN,
+ EL_SP_GRAVITY_PORT_LEFT,
+
+ EL_SP_GRAVITY_PORT_UP,
+ EL_SP_SNIKSNAK,
+ EL_SP_DISK_YELLOW,
+ EL_SP_TERMINAL,
+
+ EL_SP_DISK_RED,
+ EL_SP_PORT_VERTICAL,
+ EL_SP_PORT_HORIZONTAL,
+ EL_SP_PORT_ANY,
+
+ EL_SP_ELECTRON,
+ EL_SP_BUGGY_BASE,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+
+ EL_SP_HARDWARE_BASE_1,
+ EL_SP_HARDWARE_GREEN,
+ EL_SP_HARDWARE_BLUE,
+ EL_SP_HARDWARE_RED,
+
+ EL_SP_HARDWARE_YELLOW,
+ EL_SP_HARDWARE_BASE_2,
+ EL_SP_HARDWARE_BASE_3,
+ EL_SP_HARDWARE_BASE_4,
+
+ EL_SP_HARDWARE_BASE_5,
+ EL_SP_HARDWARE_BASE_6,
+ EL_SP_CHIP_TOP,
+ EL_SP_CHIP_BOTTOM,
+};
+static int *editor_hl_supaplex_ptr = editor_hl_supaplex;
+static int *editor_el_supaplex_ptr = editor_el_supaplex;
+static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex);
+static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
+
+static int editor_hl_diamond_caves[] =
+{
+ EL_CHAR('D'),
+ EL_CHAR('I'),
+ EL_CHAR('A'),
+ EL_CHAR('-'),
-/* actual size of level editor drawing area */
-static int ed_fieldx = MAX_ED_FIELDX - 1, ed_fieldy = MAX_ED_FIELDY - 1;
+ EL_CHAR('M'),
+ EL_CHAR('O'),
+ EL_CHAR('N'),
+ EL_CHAR('D'),
-/* actual position of level editor drawing area in level playfield */
-static int level_xpos = -1, level_ypos = -1;
+ EL_CHAR('C'),
+ EL_CHAR('A'),
+ EL_CHAR('V'),
+ EL_CHAR('E'),
-#define IN_ED_FIELD(x,y) ((x)>=0 && (x)<ed_fieldx && (y)>=0 &&(y)<ed_fieldy)
+ EL_CHAR('S'),
+ EL_CHAR(' '),
+ EL_CHAR('I'),
+ EL_CHAR('I'),
+};
-/* drawing elements on the three mouse buttons */
-static int new_element1 = EL_MAUERWERK;
-static int new_element2 = EL_LEERRAUM;
-static int new_element3 = EL_ERDREICH;
+static int editor_el_diamond_caves[] =
+{
+ EL_PEARL,
+ EL_CRYSTAL,
+ EL_WALL_PEARL,
+ EL_WALL_CRYSTAL,
-#define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
- (button) == 2 ? new_element2 : \
- (button) == 3 ? new_element3 : EL_LEERRAUM)
-#define BUTTON_STEPSIZE(button) ((button) == 1 ? 1 : (button) == 2 ? 5 : 10)
+ EL_CONVEYOR_BELT_1_LEFT,
+ EL_CONVEYOR_BELT_1_MIDDLE,
+ EL_CONVEYOR_BELT_1_RIGHT,
+ EL_CONVEYOR_BELT_1_SWITCH_MIDDLE,
-/* forward declaration for internal use */
-static void ModifyEditorCounter(int, int);
-static void ModifyEditorCounterLimits(int, int, int);
-static void DrawDrawingWindow();
-static void DrawLevelInfoWindow();
-static void DrawPropertiesWindow();
-static void CopyLevelToUndoBuffer(int);
-static void HandleDrawingAreas(struct GadgetInfo *);
-static void HandleCounterButtons(struct GadgetInfo *);
-static void HandleTextInputGadgets(struct GadgetInfo *);
-static void HandleRadiobuttons(struct GadgetInfo *);
-static void HandleCheckbuttons(struct GadgetInfo *);
-static void HandleControlButtons(struct GadgetInfo *);
-static void HandleDrawingAreaInfo(struct GadgetInfo *);
+ EL_CONVEYOR_BELT_2_LEFT,
+ EL_CONVEYOR_BELT_2_MIDDLE,
+ EL_CONVEYOR_BELT_2_RIGHT,
+ EL_CONVEYOR_BELT_2_SWITCH_MIDDLE,
-static struct GadgetInfo *level_editor_gadget[NUM_EDITOR_GADGETS];
+ EL_CONVEYOR_BELT_3_LEFT,
+ EL_CONVEYOR_BELT_3_MIDDLE,
+ EL_CONVEYOR_BELT_3_RIGHT,
+ EL_CONVEYOR_BELT_3_SWITCH_MIDDLE,
-static int drawing_function = GADGET_ID_SINGLE_ITEMS;
-static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
-static boolean draw_with_brush = FALSE;
-static int properties_element = 0;
+ EL_CONVEYOR_BELT_4_LEFT,
+ EL_CONVEYOR_BELT_4_MIDDLE,
+ EL_CONVEYOR_BELT_4_RIGHT,
+ EL_CONVEYOR_BELT_4_SWITCH_MIDDLE,
-static short ElementContent[MAX_ELEMENT_CONTENTS][3][3];
-static short FieldBackup[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-static short UndoBuffer[NUM_UNDO_STEPS][MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-static int undo_buffer_position = 0;
-static int undo_buffer_steps = 0;
+ EL_CONVEYOR_BELT_1_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_2_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_3_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_4_SWITCH_LEFT,
-static int edit_mode;
+ EL_CONVEYOR_BELT_1_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT_2_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT_3_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT_4_SWITCH_RIGHT,
+
+ EL_SWITCHGATE_OPEN,
+ EL_SWITCHGATE_CLOSED,
+ EL_SWITCHGATE_SWITCH_UP,
+ EL_EMPTY,
+
+ EL_ENVELOPE_1,
+ EL_ENVELOPE_2,
+ EL_ENVELOPE_3,
+ EL_ENVELOPE_4,
+
+ EL_TIMEGATE_CLOSED,
+ EL_TIMEGATE_OPEN,
+ EL_TIMEGATE_SWITCH,
+ EL_EMPTY,
+
+ EL_LANDMINE,
+ EL_INVISIBLE_SAND,
+ EL_STEELWALL_SLIPPERY,
+ EL_EMPTY,
-static int counter_xsize = DXSIZE + FONT2_XSIZE - 2 * ED_GADGET_DISTANCE;
+ EL_SIGN_EXCLAMATION,
+ EL_SIGN_STOP,
+ EL_LIGHT_SWITCH,
+ EL_LIGHT_SWITCH_ACTIVE,
-int element_shift = 0;
+ EL_SHIELD_NORMAL,
+ EL_SHIELD_DEADLY,
+ EL_EXTRA_TIME,
+ EL_EMPTY,
+};
+static int *editor_hl_diamond_caves_ptr = editor_hl_diamond_caves;
+static int *editor_el_diamond_caves_ptr = editor_el_diamond_caves;
+static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves);
+static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves);
-int editor_element[] =
+static int editor_hl_dx_boulderdash[] =
{
+ EL_CHAR('D'),
+ EL_CHAR('X'),
+ EL_CHAR('-'),
+ EL_CHAR(' '),
+
EL_CHAR('B'),
EL_CHAR('O'),
EL_CHAR('U'),
EL_CHAR('A'),
EL_CHAR('S'),
EL_CHAR('H'),
+};
- EL_SPIELFIGUR,
- EL_LEERRAUM,
- EL_ERDREICH,
- EL_BETON,
-
- EL_BD_WALL,
- EL_MAGIC_WALL_BD_OFF,
- EL_AUSGANG_ZU,
- EL_AUSGANG_AUF,
+static int editor_el_dx_boulderdash[] =
+{
+ EL_SPRING,
+ EL_TUBE_RIGHT_DOWN,
+ EL_TUBE_HORIZONTAL_DOWN,
+ EL_TUBE_LEFT_DOWN,
- EL_EDELSTEIN_BD,
- EL_BUTTERFLY_UP,
- EL_FIREFLY_UP,
- EL_BD_ROCK,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERTICAL_RIGHT,
+ EL_TUBE_ANY,
+ EL_TUBE_VERTICAL_LEFT,
- EL_BUTTERFLY_LEFT,
- EL_FIREFLY_LEFT,
- EL_BUTTERFLY_RIGHT,
- EL_FIREFLY_RIGHT,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_HORIZONTAL_UP,
+ EL_TUBE_LEFT_UP,
- EL_AMOEBE_BD,
- EL_BUTTERFLY_DOWN,
- EL_FIREFLY_DOWN,
- EL_LEERRAUM,
+ EL_TRAP,
+ EL_DX_SUPABOMB,
+ EL_EMPTY,
+ EL_EMPTY
+};
+static int *editor_hl_dx_boulderdash_ptr = editor_hl_dx_boulderdash;
+static int *editor_el_dx_boulderdash_ptr = editor_el_dx_boulderdash;
+static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash);
+static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
+static int editor_hl_chars[] =
+{
+ EL_CHAR('T'),
EL_CHAR('E'),
- EL_CHAR('M'),
- EL_CHAR('E'),
- EL_CHAR('-'),
-
- EL_CHAR('R'),
- EL_CHAR('A'),
- EL_CHAR('L'),
- EL_CHAR('D'),
+ EL_CHAR('X'),
+ EL_CHAR('T'),
+};
- EL_CHAR('M'),
- EL_CHAR('I'),
- EL_CHAR('N'),
- EL_CHAR('E'),
+static int editor_el_chars[] =
+{
+ EL_CHAR(' '),
+ EL_CHAR('!'),
+ EL_CHAR('"'),
+ EL_CHAR('#'),
- EL_SPIELER1,
- EL_SPIELER2,
- EL_SPIELER3,
- EL_SPIELER4,
+ EL_CHAR('$'),
+ EL_CHAR('%'),
+ EL_CHAR('&'),
+ EL_CHAR('\''),
- EL_SPIELFIGUR,
- EL_LEERRAUM,
- EL_ERDREICH,
- EL_FELSBROCKEN,
+ EL_CHAR('('),
+ EL_CHAR(')'),
+ EL_CHAR('*'),
+ EL_CHAR('+'),
- EL_BETON,
- EL_MAUERWERK,
- EL_FELSBODEN,
- EL_MAGIC_WALL_OFF,
+ EL_CHAR(','),
+ EL_CHAR('-'),
+ EL_CHAR('.'),
+ EL_CHAR('/'),
- EL_EDELSTEIN,
- EL_DIAMANT,
- EL_KOKOSNUSS,
- EL_BOMBE,
+ EL_CHAR('0'),
+ EL_CHAR('1'),
+ EL_CHAR('2'),
+ EL_CHAR('3'),
- EL_ERZ_EDEL,
- EL_ERZ_DIAM,
- EL_MORAST_LEER,
- EL_MORAST_VOLL,
+ EL_CHAR('4'),
+ EL_CHAR('5'),
+ EL_CHAR('6'),
+ EL_CHAR('7'),
- EL_DYNAMITE_INACTIVE,
- EL_DYNAMITE_ACTIVE,
- EL_AUSGANG_ZU,
- EL_AUSGANG_AUF,
+ EL_CHAR('8'),
+ EL_CHAR('9'),
+ EL_CHAR(':'),
+ EL_CHAR(';'),
- EL_MAMPFER,
- EL_KAEFER_UP,
- EL_FLIEGER_UP,
- EL_ROBOT,
+ EL_CHAR('<'),
+ EL_CHAR('='),
+ EL_CHAR('>'),
+ EL_CHAR('?'),
- EL_KAEFER_LEFT,
- EL_FLIEGER_LEFT,
- EL_KAEFER_RIGHT,
- EL_FLIEGER_RIGHT,
+ EL_CHAR('@'),
+ EL_CHAR('A'),
+ EL_CHAR('B'),
+ EL_CHAR('C'),
- EL_ABLENK_AUS,
- EL_KAEFER_DOWN,
- EL_FLIEGER_DOWN,
- EL_UNSICHTBAR,
+ EL_CHAR('D'),
+ EL_CHAR('E'),
+ EL_CHAR('F'),
+ EL_CHAR('G'),
- EL_BADEWANNE1,
- EL_SALZSAEURE,
- EL_BADEWANNE2,
- EL_LEERRAUM,
+ EL_CHAR('H'),
+ EL_CHAR('I'),
+ EL_CHAR('J'),
+ EL_CHAR('K'),
- EL_BADEWANNE3,
- EL_BADEWANNE4,
- EL_BADEWANNE5,
- EL_LEERRAUM,
+ EL_CHAR('L'),
+ EL_CHAR('M'),
+ EL_CHAR('N'),
+ EL_CHAR('O'),
- EL_TROPFEN,
- EL_AMOEBE_TOT,
- EL_AMOEBE_NASS,
- EL_AMOEBE_NORM,
+ EL_CHAR('P'),
+ EL_CHAR('Q'),
+ EL_CHAR('R'),
+ EL_CHAR('S'),
- EL_EM_KEY_1_FILE,
- EL_EM_KEY_2_FILE,
- EL_EM_KEY_3_FILE,
- EL_EM_KEY_4_FILE,
+ EL_CHAR('T'),
+ EL_CHAR('U'),
+ EL_CHAR('V'),
+ EL_CHAR('W'),
- EL_EM_GATE_1,
- EL_EM_GATE_2,
- EL_EM_GATE_3,
- EL_EM_GATE_4,
+ EL_CHAR('X'),
+ EL_CHAR('Y'),
+ EL_CHAR('Z'),
+ EL_CHAR('['),
- EL_EM_GATE_1X,
- EL_EM_GATE_2X,
- EL_EM_GATE_3X,
- EL_EM_GATE_4X,
+ EL_CHAR('\\'),
+ EL_CHAR(']'),
+ EL_CHAR('^'),
+ EL_CHAR('_'),
- EL_CHAR('M'),
- EL_CHAR('O'),
- EL_CHAR('R'),
- EL_CHAR('E'),
+ EL_CHAR('©'),
+ EL_CHAR('Ä'),
+ EL_CHAR('Ö'),
+ EL_CHAR('Ü'),
- EL_SCHLUESSEL1,
- EL_SCHLUESSEL2,
- EL_SCHLUESSEL3,
- EL_SCHLUESSEL4,
-
- EL_PFORTE1,
- EL_PFORTE2,
- EL_PFORTE3,
- EL_PFORTE4,
-
- EL_PFORTE1X,
- EL_PFORTE2X,
- EL_PFORTE3X,
- EL_PFORTE4X,
-
- EL_PFEIL_LEFT,
- EL_PFEIL_RIGHT,
- EL_PFEIL_UP,
- EL_PFEIL_DOWN,
-
- EL_AMOEBE_VOLL,
- EL_EDELSTEIN_GELB,
- EL_EDELSTEIN_ROT,
- EL_EDELSTEIN_LILA,
-
- EL_ERZ_EDEL_BD,
- EL_ERZ_EDEL_GELB,
- EL_ERZ_EDEL_ROT,
- EL_ERZ_EDEL_LILA,
-
- EL_LIFE,
- EL_PACMAN_UP,
- EL_ZEIT_VOLL,
- EL_ZEIT_LEER,
+ EL_CHAR('°'),
+ EL_CHAR('®'),
+ EL_CHAR(FONT_ASCII_CURSOR),
+ EL_CHAR(' ')
+};
+static int *editor_hl_chars_ptr = editor_hl_chars;
+static int *editor_el_chars_ptr = editor_el_chars;
+static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
+static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
- EL_PACMAN_LEFT,
- EL_MAMPFER2,
- EL_PACMAN_RIGHT,
- EL_MAUER_LEBT,
+static int editor_hl_custom[] =
+{
+ EL_CHAR('C'),
+ EL_CHAR('U'),
+ EL_CHAR('S'),
+ EL_CHAR('-'),
- EL_LIFE_ASYNC,
- EL_PACMAN_DOWN,
- EL_BIRNE_AUS,
- EL_BIRNE_EIN,
+ EL_CHAR('T'),
+ EL_CHAR('O'),
+ EL_CHAR('M'),
+ EL_CHAR(' '),
- EL_DYNABOMB_NR,
- EL_DYNABOMB_SZ,
- EL_DYNABOMB_XL,
- EL_BADEWANNE,
+ EL_CHAR('E'),
+ EL_CHAR('L'),
+ EL_CHAR('E'),
+ EL_CHAR('M'),
- EL_MOLE,
- EL_PINGUIN,
- EL_SCHWEIN,
- EL_DRACHE,
+ EL_CHAR('E'),
+ EL_CHAR('N'),
+ EL_CHAR('T'),
+ EL_CHAR('S'),
+};
- EL_LEERRAUM,
- EL_MOLE_UP,
- EL_LEERRAUM,
- EL_LEERRAUM,
+static int editor_el_custom[] =
+{
+ EL_CUSTOM_START + 0,
+ EL_CUSTOM_START + 1,
+ EL_CUSTOM_START + 2,
+ EL_CUSTOM_START + 3,
+
+ EL_CUSTOM_START + 4,
+ EL_CUSTOM_START + 5,
+ EL_CUSTOM_START + 6,
+ EL_CUSTOM_START + 7,
+
+ EL_CUSTOM_START + 8,
+ EL_CUSTOM_START + 9,
+ EL_CUSTOM_START + 10,
+ EL_CUSTOM_START + 11,
+
+ EL_CUSTOM_START + 12,
+ EL_CUSTOM_START + 13,
+ EL_CUSTOM_START + 14,
+ EL_CUSTOM_START + 15,
+
+ EL_CUSTOM_START + 16,
+ EL_CUSTOM_START + 17,
+ EL_CUSTOM_START + 18,
+ EL_CUSTOM_START + 19,
+
+ EL_CUSTOM_START + 20,
+ EL_CUSTOM_START + 21,
+ EL_CUSTOM_START + 22,
+ EL_CUSTOM_START + 23,
+
+ EL_CUSTOM_START + 24,
+ EL_CUSTOM_START + 25,
+ EL_CUSTOM_START + 26,
+ EL_CUSTOM_START + 27,
+
+ EL_CUSTOM_START + 28,
+ EL_CUSTOM_START + 29,
+ EL_CUSTOM_START + 30,
+ EL_CUSTOM_START + 31,
+
+ EL_CUSTOM_START + 32,
+ EL_CUSTOM_START + 33,
+ EL_CUSTOM_START + 34,
+ EL_CUSTOM_START + 35,
+
+ EL_CUSTOM_START + 36,
+ EL_CUSTOM_START + 37,
+ EL_CUSTOM_START + 38,
+ EL_CUSTOM_START + 39,
+
+ EL_CUSTOM_START + 40,
+ EL_CUSTOM_START + 41,
+ EL_CUSTOM_START + 42,
+ EL_CUSTOM_START + 43,
+
+ EL_CUSTOM_START + 44,
+ EL_CUSTOM_START + 45,
+ EL_CUSTOM_START + 46,
+ EL_CUSTOM_START + 47,
+
+ EL_CUSTOM_START + 48,
+ EL_CUSTOM_START + 49,
+ EL_CUSTOM_START + 50,
+ EL_CUSTOM_START + 51,
+
+ EL_CUSTOM_START + 52,
+ EL_CUSTOM_START + 53,
+ EL_CUSTOM_START + 54,
+ EL_CUSTOM_START + 55,
+
+ EL_CUSTOM_START + 56,
+ EL_CUSTOM_START + 57,
+ EL_CUSTOM_START + 58,
+ EL_CUSTOM_START + 59,
+
+ EL_CUSTOM_START + 60,
+ EL_CUSTOM_START + 61,
+ EL_CUSTOM_START + 62,
+ EL_CUSTOM_START + 63,
+
+ EL_CUSTOM_START + 64,
+ EL_CUSTOM_START + 65,
+ EL_CUSTOM_START + 66,
+ EL_CUSTOM_START + 67,
+
+ EL_CUSTOM_START + 68,
+ EL_CUSTOM_START + 69,
+ EL_CUSTOM_START + 70,
+ EL_CUSTOM_START + 71,
+
+ EL_CUSTOM_START + 72,
+ EL_CUSTOM_START + 73,
+ EL_CUSTOM_START + 74,
+ EL_CUSTOM_START + 75,
+
+ EL_CUSTOM_START + 76,
+ EL_CUSTOM_START + 77,
+ EL_CUSTOM_START + 78,
+ EL_CUSTOM_START + 79,
+
+ EL_CUSTOM_START + 80,
+ EL_CUSTOM_START + 81,
+ EL_CUSTOM_START + 82,
+ EL_CUSTOM_START + 83,
+
+ EL_CUSTOM_START + 84,
+ EL_CUSTOM_START + 85,
+ EL_CUSTOM_START + 86,
+ EL_CUSTOM_START + 87,
+
+ EL_CUSTOM_START + 88,
+ EL_CUSTOM_START + 89,
+ EL_CUSTOM_START + 90,
+ EL_CUSTOM_START + 91,
+
+ EL_CUSTOM_START + 92,
+ EL_CUSTOM_START + 93,
+ EL_CUSTOM_START + 94,
+ EL_CUSTOM_START + 95,
+
+ EL_CUSTOM_START + 96,
+ EL_CUSTOM_START + 97,
+ EL_CUSTOM_START + 98,
+ EL_CUSTOM_START + 99,
+
+ EL_CUSTOM_START + 100,
+ EL_CUSTOM_START + 101,
+ EL_CUSTOM_START + 102,
+ EL_CUSTOM_START + 103,
+
+ EL_CUSTOM_START + 104,
+ EL_CUSTOM_START + 105,
+ EL_CUSTOM_START + 106,
+ EL_CUSTOM_START + 107,
+
+ EL_CUSTOM_START + 108,
+ EL_CUSTOM_START + 109,
+ EL_CUSTOM_START + 110,
+ EL_CUSTOM_START + 111,
+
+ EL_CUSTOM_START + 112,
+ EL_CUSTOM_START + 113,
+ EL_CUSTOM_START + 114,
+ EL_CUSTOM_START + 115,
+
+ EL_CUSTOM_START + 116,
+ EL_CUSTOM_START + 117,
+ EL_CUSTOM_START + 118,
+ EL_CUSTOM_START + 119,
+
+ EL_CUSTOM_START + 120,
+ EL_CUSTOM_START + 121,
+ EL_CUSTOM_START + 122,
+ EL_CUSTOM_START + 123,
+
+ EL_CUSTOM_START + 124,
+ EL_CUSTOM_START + 125,
+ EL_CUSTOM_START + 126,
+ EL_CUSTOM_START + 127
+};
+static int *editor_hl_custom_ptr = editor_hl_custom;
+static int *editor_el_custom_ptr = editor_el_custom;
+static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
+static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
- EL_MOLE_LEFT,
- EL_LEERRAUM,
- EL_MOLE_RIGHT,
- EL_LEERRAUM,
+static int editor_hl_custom_more[] =
+{
+};
- EL_LEERRAUM,
- EL_MOLE_DOWN,
- EL_BALLOON,
- EL_BALLOON_SEND_ANY,
+static int editor_el_custom_more[] =
+{
+ EL_CUSTOM_START + 128,
+ EL_CUSTOM_START + 129,
+ EL_CUSTOM_START + 130,
+ EL_CUSTOM_START + 131,
+
+ EL_CUSTOM_START + 132,
+ EL_CUSTOM_START + 133,
+ EL_CUSTOM_START + 134,
+ EL_CUSTOM_START + 135,
+
+ EL_CUSTOM_START + 136,
+ EL_CUSTOM_START + 137,
+ EL_CUSTOM_START + 138,
+ EL_CUSTOM_START + 139,
+
+ EL_CUSTOM_START + 140,
+ EL_CUSTOM_START + 141,
+ EL_CUSTOM_START + 142,
+ EL_CUSTOM_START + 143,
+
+ EL_CUSTOM_START + 144,
+ EL_CUSTOM_START + 145,
+ EL_CUSTOM_START + 146,
+ EL_CUSTOM_START + 147,
+
+ EL_CUSTOM_START + 148,
+ EL_CUSTOM_START + 149,
+ EL_CUSTOM_START + 150,
+ EL_CUSTOM_START + 151,
+
+ EL_CUSTOM_START + 152,
+ EL_CUSTOM_START + 153,
+ EL_CUSTOM_START + 154,
+ EL_CUSTOM_START + 155,
+
+ EL_CUSTOM_START + 156,
+ EL_CUSTOM_START + 157,
+ EL_CUSTOM_START + 158,
+ EL_CUSTOM_START + 159,
+
+ EL_CUSTOM_START + 160,
+ EL_CUSTOM_START + 161,
+ EL_CUSTOM_START + 162,
+ EL_CUSTOM_START + 163,
+
+ EL_CUSTOM_START + 164,
+ EL_CUSTOM_START + 165,
+ EL_CUSTOM_START + 166,
+ EL_CUSTOM_START + 167,
+
+ EL_CUSTOM_START + 168,
+ EL_CUSTOM_START + 169,
+ EL_CUSTOM_START + 170,
+ EL_CUSTOM_START + 171,
+
+ EL_CUSTOM_START + 172,
+ EL_CUSTOM_START + 173,
+ EL_CUSTOM_START + 174,
+ EL_CUSTOM_START + 175,
+
+ EL_CUSTOM_START + 176,
+ EL_CUSTOM_START + 177,
+ EL_CUSTOM_START + 178,
+ EL_CUSTOM_START + 179,
+
+ EL_CUSTOM_START + 180,
+ EL_CUSTOM_START + 181,
+ EL_CUSTOM_START + 182,
+ EL_CUSTOM_START + 183,
+
+ EL_CUSTOM_START + 184,
+ EL_CUSTOM_START + 185,
+ EL_CUSTOM_START + 186,
+ EL_CUSTOM_START + 187,
+
+ EL_CUSTOM_START + 188,
+ EL_CUSTOM_START + 189,
+ EL_CUSTOM_START + 190,
+ EL_CUSTOM_START + 191,
+
+ EL_CUSTOM_START + 192,
+ EL_CUSTOM_START + 193,
+ EL_CUSTOM_START + 194,
+ EL_CUSTOM_START + 195,
+
+ EL_CUSTOM_START + 196,
+ EL_CUSTOM_START + 197,
+ EL_CUSTOM_START + 198,
+ EL_CUSTOM_START + 199,
+
+ EL_CUSTOM_START + 200,
+ EL_CUSTOM_START + 201,
+ EL_CUSTOM_START + 202,
+ EL_CUSTOM_START + 203,
+
+ EL_CUSTOM_START + 204,
+ EL_CUSTOM_START + 205,
+ EL_CUSTOM_START + 206,
+ EL_CUSTOM_START + 207,
+
+ EL_CUSTOM_START + 208,
+ EL_CUSTOM_START + 209,
+ EL_CUSTOM_START + 210,
+ EL_CUSTOM_START + 211,
+
+ EL_CUSTOM_START + 212,
+ EL_CUSTOM_START + 213,
+ EL_CUSTOM_START + 214,
+ EL_CUSTOM_START + 215,
+
+ EL_CUSTOM_START + 216,
+ EL_CUSTOM_START + 217,
+ EL_CUSTOM_START + 218,
+ EL_CUSTOM_START + 219,
+
+ EL_CUSTOM_START + 220,
+ EL_CUSTOM_START + 221,
+ EL_CUSTOM_START + 222,
+ EL_CUSTOM_START + 223,
+
+ EL_CUSTOM_START + 224,
+ EL_CUSTOM_START + 225,
+ EL_CUSTOM_START + 226,
+ EL_CUSTOM_START + 227,
+
+ EL_CUSTOM_START + 228,
+ EL_CUSTOM_START + 229,
+ EL_CUSTOM_START + 230,
+ EL_CUSTOM_START + 231,
+
+ EL_CUSTOM_START + 232,
+ EL_CUSTOM_START + 233,
+ EL_CUSTOM_START + 234,
+ EL_CUSTOM_START + 235,
+
+ EL_CUSTOM_START + 236,
+ EL_CUSTOM_START + 237,
+ EL_CUSTOM_START + 238,
+ EL_CUSTOM_START + 239,
+
+ EL_CUSTOM_START + 240,
+ EL_CUSTOM_START + 241,
+ EL_CUSTOM_START + 242,
+ EL_CUSTOM_START + 243,
+
+ EL_CUSTOM_START + 244,
+ EL_CUSTOM_START + 245,
+ EL_CUSTOM_START + 246,
+ EL_CUSTOM_START + 247,
+
+ EL_CUSTOM_START + 248,
+ EL_CUSTOM_START + 249,
+ EL_CUSTOM_START + 250,
+ EL_CUSTOM_START + 251,
+
+ EL_CUSTOM_START + 252,
+ EL_CUSTOM_START + 253,
+ EL_CUSTOM_START + 254,
+ EL_CUSTOM_START + 255
+};
+static int *editor_hl_custom_more_ptr = editor_hl_custom_more;
+static int *editor_el_custom_more_ptr = editor_el_custom_more;
+static int num_editor_hl_custom_more = SIZEOF_ARRAY_INT(editor_hl_custom_more);
+static int num_editor_el_custom_more = SIZEOF_ARRAY_INT(editor_el_custom_more);
- EL_BALLOON_SEND_LEFT,
- EL_BALLOON_SEND_RIGHT,
- EL_BALLOON_SEND_UP,
- EL_BALLOON_SEND_DOWN,
+static int editor_hl_group[] =
+{
+ EL_CHAR('G'),
+ EL_CHAR('R'),
+ EL_CHAR('O'),
+ EL_CHAR('U'),
- EL_SONDE,
- EL_MAUER_X,
- EL_MAUER_Y,
- EL_MAUER_XY,
+ EL_CHAR('P'),
+ EL_CHAR(' '),
+ EL_CHAR(' '),
+ EL_CHAR(' '),
- EL_INVISIBLE_STEEL,
- EL_UNSICHTBAR,
- EL_SPEED_PILL,
- EL_BLACK_ORB,
+ EL_CHAR('E'),
+ EL_CHAR('L'),
+ EL_CHAR('E'),
+ EL_CHAR('M'),
- EL_EMC_STEEL_WALL_1,
- EL_EMC_WALL_1,
- EL_EMC_WALL_2,
- EL_EMC_WALL_3,
+ EL_CHAR('E'),
+ EL_CHAR('N'),
+ EL_CHAR('T'),
+ EL_CHAR('S'),
+};
- EL_EMC_WALL_4,
- EL_EMC_WALL_5,
- EL_EMC_WALL_6,
- EL_EMC_WALL_7,
+static int editor_el_group[] =
+{
+ EL_GROUP_START + 0,
+ EL_GROUP_START + 1,
+ EL_GROUP_START + 2,
+ EL_GROUP_START + 3,
+
+ EL_GROUP_START + 4,
+ EL_GROUP_START + 5,
+ EL_GROUP_START + 6,
+ EL_GROUP_START + 7,
+
+ EL_GROUP_START + 8,
+ EL_GROUP_START + 9,
+ EL_GROUP_START + 10,
+ EL_GROUP_START + 11,
+
+ EL_GROUP_START + 12,
+ EL_GROUP_START + 13,
+ EL_GROUP_START + 14,
+ EL_GROUP_START + 15
+};
+static int *editor_hl_group_ptr = editor_hl_group;
+static int *editor_el_group_ptr = editor_el_group;
+static int num_editor_hl_group = SIZEOF_ARRAY_INT(editor_hl_group);
+static int num_editor_el_group = SIZEOF_ARRAY_INT(editor_el_group);
+
+static int editor_hl_group_more[] =
+{
+};
+static int editor_el_group_more[] =
+{
+ EL_GROUP_START + 16,
+ EL_GROUP_START + 17,
+ EL_GROUP_START + 18,
+ EL_GROUP_START + 19,
+
+ EL_GROUP_START + 20,
+ EL_GROUP_START + 21,
+ EL_GROUP_START + 22,
+ EL_GROUP_START + 23,
+
+ EL_GROUP_START + 24,
+ EL_GROUP_START + 25,
+ EL_GROUP_START + 26,
+ EL_GROUP_START + 27,
+
+ EL_GROUP_START + 28,
+ EL_GROUP_START + 29,
+ EL_GROUP_START + 30,
+ EL_GROUP_START + 31
+};
+static int *editor_hl_group_more_ptr = editor_hl_group_more;
+static int *editor_el_group_more_ptr = editor_el_group_more;
+static int num_editor_hl_group_more = SIZEOF_ARRAY_INT(editor_hl_group_more);
+static int num_editor_el_group_more = SIZEOF_ARRAY_INT(editor_el_group_more);
+static int editor_hl_user_defined[] =
+{
+ EL_CHAR('U'),
EL_CHAR('S'),
- EL_CHAR('O'),
- EL_CHAR('K'),
- EL_CHAR('O'),
+ EL_CHAR('E'),
+ EL_CHAR('R'),
+
+ EL_CHAR('D'),
+ EL_CHAR('E'),
+ EL_CHAR('F'),
+ EL_CHAR('I'),
EL_CHAR('-'),
- EL_CHAR('B'),
- EL_CHAR('A'),
EL_CHAR('N'),
+ EL_CHAR('E'),
+ EL_CHAR('D'),
+};
- EL_SOKOBAN_OBJEKT,
- EL_SOKOBAN_FELD_LEER,
- EL_SOKOBAN_FELD_VOLL,
- EL_BETON,
-
- EL_CHAR('S'),
- EL_CHAR('U'),
- EL_CHAR('P'),
- EL_CHAR('A'),
+static int *editor_hl_user_defined_ptr = editor_hl_user_defined;
+static int *editor_el_user_defined_ptr = NULL;
+static int num_editor_hl_user_defined=SIZEOF_ARRAY_INT(editor_hl_user_defined);
+static int num_editor_el_user_defined = 0;
- EL_CHAR('P'),
- EL_CHAR('L'),
- EL_CHAR('E'),
- EL_CHAR('X'),
+static int editor_hl_empty[] = { };
+static int editor_el_empty[ED_NUM_ELEMENTLIST_BUTTONS];
- EL_SP_EMPTY,
- EL_SP_ZONK,
- EL_SP_BASE,
- EL_SP_MURPHY,
+static int *editor_hl_empty_ptr = editor_hl_empty;
+static int *editor_el_empty_ptr = editor_el_empty;
+static int num_editor_hl_empty = 0;
+static int num_editor_el_empty = 0; /* dynamically determined, if needed */
- EL_SP_INFOTRON,
- EL_SP_CHIP_SINGLE,
- EL_SP_HARD_GRAY,
- EL_SP_EXIT,
+static boolean use_el_empty = FALSE;
- EL_SP_DISK_ORANGE,
- EL_SP_PORT1_RIGHT,
- EL_SP_PORT1_DOWN,
- EL_SP_PORT1_LEFT,
+static int *editor_elements = NULL; /* dynamically allocated */
+static int num_editor_elements = 0; /* dynamically determined */
- EL_SP_PORT1_UP,
- EL_SP_PORT2_RIGHT,
- EL_SP_PORT2_DOWN,
- EL_SP_PORT2_LEFT,
+static struct
+{
+ boolean *setup_value;
- EL_SP_PORT2_UP,
- EL_SP_SNIKSNAK,
- EL_SP_DISK_YELLOW,
- EL_SP_TERMINAL,
+ int **headline_list;
+ int *headline_list_size;
- EL_SP_DISK_RED,
- EL_SP_PORT_Y,
- EL_SP_PORT_X,
- EL_SP_PORT_XY,
+ int **element_list;
+ int *element_list_size;
- EL_SP_ELECTRON,
- EL_SP_BUG,
- EL_SP_CHIP_LEFT,
- EL_SP_CHIP_RIGHT,
+ boolean last_setup_value;
+}
+editor_elements_info[] =
+{
+ {
+ &setup.editor.el_boulderdash,
+ &editor_hl_boulderdash_ptr, &num_editor_hl_boulderdash,
+ &editor_el_boulderdash_ptr, &num_editor_el_boulderdash
+ },
+ {
+ &setup.editor.el_emerald_mine,
+ &editor_hl_emerald_mine_ptr, &num_editor_hl_emerald_mine,
+ &editor_el_emerald_mine_ptr, &num_editor_el_emerald_mine
+ },
+ {
+ &setup.editor.el_more,
+ &editor_hl_more_ptr, &num_editor_hl_more,
+ &editor_el_more_ptr, &num_editor_el_more
+ },
+ {
+ &setup.editor.el_sokoban,
+ &editor_hl_sokoban_ptr, &num_editor_hl_sokoban,
+ &editor_el_sokoban_ptr, &num_editor_el_sokoban
+ },
+ {
+ &setup.editor.el_supaplex,
+ &editor_hl_supaplex_ptr, &num_editor_hl_supaplex,
+ &editor_el_supaplex_ptr, &num_editor_el_supaplex
+ },
+ {
+ &setup.editor.el_diamond_caves,
+ &editor_hl_diamond_caves_ptr, &num_editor_hl_diamond_caves,
+ &editor_el_diamond_caves_ptr, &num_editor_el_diamond_caves
+ },
+ {
+ &setup.editor.el_dx_boulderdash,
+ &editor_hl_dx_boulderdash_ptr, &num_editor_hl_dx_boulderdash,
+ &editor_el_dx_boulderdash_ptr, &num_editor_el_dx_boulderdash
+ },
+ {
+ &setup.editor.el_chars,
+ &editor_hl_chars_ptr, &num_editor_hl_chars,
+ &editor_el_chars_ptr, &num_editor_el_chars
+ },
+ {
+ &setup.editor.el_custom,
+ &editor_hl_custom_ptr, &num_editor_hl_custom,
+ &editor_el_custom_ptr, &num_editor_el_custom
+ },
+ {
+ &setup.editor.el_custom_more,
+ &editor_hl_custom_more_ptr, &num_editor_hl_custom_more,
+ &editor_el_custom_more_ptr, &num_editor_el_custom_more
+ },
+ {
+ &setup.editor.el_custom,
+ &editor_hl_group_ptr, &num_editor_hl_group,
+ &editor_el_group_ptr, &num_editor_el_group
+ },
+ {
+ &setup.editor.el_custom_more,
+ &editor_hl_group_more_ptr, &num_editor_hl_group_more,
+ &editor_el_group_more_ptr, &num_editor_el_group_more
+ },
+ {
+ &setup.editor.el_user_defined,
+ &editor_hl_user_defined_ptr, &num_editor_hl_user_defined,
+ &editor_el_user_defined_ptr, &num_editor_el_user_defined
+ },
+ {
+ &use_el_empty,
+ &editor_hl_empty_ptr, &num_editor_hl_empty,
+ &editor_el_empty_ptr, &num_editor_el_empty,
+ },
+ {
+ NULL,
+ NULL, NULL,
+ NULL, NULL
+ }
+};
- EL_SP_HARD_BASE1,
- EL_SP_HARD_GREEN,
- EL_SP_HARD_BLUE,
- EL_SP_HARD_RED,
+static struct
+{
+ short element;
+ short element_mapped;
+}
+forum_sketch_element_mapping[] =
+{
+ { EL_WALL_SLIPPERY, EL_WALL },
+ { EL_EXPANDABLE_WALL, EL_WALL },
+ { EL_EXPANDABLE_WALL_HORIZONTAL, EL_WALL },
+ { EL_EXPANDABLE_WALL_VERTICAL, EL_WALL },
+ { EL_EXPANDABLE_WALL_ANY, EL_WALL },
+ { EL_WALL_EMERALD, EL_WALL },
+ { EL_WALL_DIAMOND, EL_WALL },
+ { EL_WALL_BD_DIAMOND, EL_WALL },
+ { EL_WALL_EMERALD_YELLOW, EL_WALL },
+ { EL_WALL_EMERALD_RED, EL_WALL },
+ { EL_WALL_EMERALD_PURPLE, EL_WALL },
+ { EL_ACID_POOL_TOPLEFT, EL_WALL },
+ { EL_ACID_POOL_TOPRIGHT, EL_WALL },
+ { EL_ACID_POOL_BOTTOMLEFT, EL_WALL },
+ { EL_ACID_POOL_BOTTOM, EL_WALL },
+ { EL_ACID_POOL_BOTTOMRIGHT, EL_WALL },
+ { EL_BD_WALL, EL_WALL },
+
+ { EL_BD_ROCK, EL_ROCK },
+
+ { EL_SP_ZONK, EL_ROCK },
+ { EL_SP_BASE, EL_SAND },
+ { EL_SP_MURPHY, EL_PLAYER_1 },
+ { EL_SP_INFOTRON, EL_EMERALD },
+ { EL_SP_HARDWARE_GRAY, EL_STEELWALL },
+ { EL_SP_EXIT_CLOSED, EL_EXIT_OPEN },
+ { EL_SP_DISK_ORANGE, EL_BOMB },
+ { EL_SP_DISK_RED, EL_BOMB },
+ { EL_SP_DISK_YELLOW, EL_BOMB },
+ { EL_SP_PORT_RIGHT, EL_GATE_1_GRAY },
+ { EL_SP_PORT_DOWN, EL_GATE_1_GRAY },
+ { EL_SP_PORT_LEFT, EL_GATE_1_GRAY },
+ { EL_SP_PORT_UP, EL_GATE_1_GRAY },
+ { EL_SP_GRAVITY_PORT_RIGHT, EL_GATE_1_GRAY },
+ { EL_SP_GRAVITY_PORT_DOWN, EL_GATE_1_GRAY },
+ { EL_SP_GRAVITY_PORT_LEFT, EL_GATE_1_GRAY },
+ { EL_SP_GRAVITY_PORT_UP, EL_GATE_1_GRAY },
+ { EL_SP_PORT_VERTICAL, EL_GATE_1_GRAY },
+ { EL_SP_PORT_HORIZONTAL, EL_GATE_1_GRAY },
+ { EL_SP_PORT_ANY, EL_GATE_1_GRAY },
+ { EL_SP_SNIKSNAK, EL_BUG },
+ { EL_SP_ELECTRON, EL_SPACESHIP },
+ { EL_SP_CHIP_SINGLE, EL_WALL },
+ { EL_SP_CHIP_LEFT, EL_WALL },
+ { EL_SP_CHIP_RIGHT, EL_WALL },
+ { EL_SP_CHIP_TOP, EL_WALL },
+ { EL_SP_CHIP_BOTTOM, EL_WALL },
+ { EL_SP_HARDWARE_BASE_1, EL_STEELWALL },
+ { EL_SP_HARDWARE_GREEN, EL_STEELWALL },
+ { EL_SP_HARDWARE_BLUE, EL_STEELWALL },
+ { EL_SP_HARDWARE_RED, EL_STEELWALL },
+ { EL_SP_HARDWARE_YELLOW, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_2, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_3, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_3, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_4, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_5, EL_STEELWALL },
+ { EL_SP_HARDWARE_BASE_6, EL_STEELWALL },
+
+ { EL_STEELWALL_SLIPPERY, EL_STEELWALL },
+
+ { EL_EXIT_CLOSED, EL_EXIT_OPEN },
+
+ { EL_DIAMOND, EL_EMERALD },
+ { EL_BD_DIAMOND, EL_EMERALD },
+ { EL_EMERALD_YELLOW, EL_EMERALD },
+ { EL_EMERALD_RED, EL_EMERALD },
+ { EL_EMERALD_PURPLE, EL_EMERALD },
+
+ { EL_AMOEBA_DEAD, EL_AMOEBA },
+ { EL_AMOEBA_DROP, EL_AMOEBA },
+ { EL_AMOEBA_WET, EL_AMOEBA },
+ { EL_AMOEBA_DRY, EL_AMOEBA },
+ { EL_AMOEBA_FULL, EL_AMOEBA },
+ { EL_BD_AMOEBA, EL_AMOEBA },
+ { EL_AMOEBA_TO_DIAMOND, EL_AMOEBA },
+
+ { EL_DYNAMITE_ACTIVE, EL_DYNAMITE },
+
+ { EL_GATE_2_GRAY, EL_GATE_1_GRAY },
+ { EL_GATE_3_GRAY, EL_GATE_1_GRAY },
+ { EL_GATE_4_GRAY, EL_GATE_1_GRAY },
+
+ { EL_EM_KEY_1, EL_KEY_1 },
+ { EL_EM_KEY_2, EL_KEY_2 },
+ { EL_EM_KEY_3, EL_KEY_3 },
+ { EL_EM_KEY_4, EL_KEY_4 },
+
+ { EL_EM_GATE_1, EL_GATE_1 },
+ { EL_EM_GATE_2, EL_GATE_2 },
+ { EL_EM_GATE_3, EL_GATE_3 },
+ { EL_EM_GATE_4, EL_GATE_4 },
+
+ { EL_EM_GATE_1_GRAY, EL_GATE_1_GRAY },
+ { EL_EM_GATE_2_GRAY, EL_GATE_1_GRAY },
+ { EL_EM_GATE_3_GRAY, EL_GATE_1_GRAY },
+ { EL_EM_GATE_4_GRAY, EL_GATE_1_GRAY },
+
+ { EL_INVISIBLE_SAND, EL_EMPTY },
+ { EL_INVISIBLE_WALL, EL_EMPTY },
+ { EL_INVISIBLE_STEELWALL, EL_EMPTY },
+
+ { EL_PACMAN, EL_YAMYAM },
+ { EL_DARK_YAMYAM, EL_YAMYAM },
+
+ { EL_BD_MAGIC_WALL, EL_MAGIC_WALL },
+
+ { EL_DYNABOMB_INCREASE_NUMBER, EL_BOMB },
+ { EL_DYNABOMB_INCREASE_SIZE, EL_BOMB },
+ { EL_DYNABOMB_INCREASE_POWER, EL_BOMB },
+ { EL_BLACK_ORB, EL_BOMB },
+ { EL_DX_SUPABOMB, EL_BOMB },
+
+ { EL_SOKOBAN_OBJECT, EL_KEY_1 },
+ { EL_SOKOBAN_FIELD_EMPTY, EL_GATE_1_GRAY },
+ { EL_SOKOBAN_FIELD_FULL, EL_GATE_1 },
+ { EL_SOKOBAN_FIELD_PLAYER, EL_PLAYER_1 },
+
+ { EL_BD_BUTTERFLY_RIGHT, EL_BD_BUTTERFLY },
+ { EL_BD_BUTTERFLY_UP, EL_BD_BUTTERFLY },
+ { EL_BD_BUTTERFLY_LEFT, EL_BD_BUTTERFLY },
+ { EL_BD_BUTTERFLY_DOWN, EL_BD_BUTTERFLY },
+
+ { EL_BD_FIREFLY_RIGHT, EL_BD_FIREFLY },
+ { EL_BD_FIREFLY_UP, EL_BD_FIREFLY },
+ { EL_BD_FIREFLY_LEFT, EL_BD_FIREFLY },
+ { EL_BD_FIREFLY_DOWN, EL_BD_FIREFLY },
+
+ { EL_PLAYER_2, EL_PLAYER_1 },
+ { EL_PLAYER_3, EL_PLAYER_1 },
+ { EL_PLAYER_4, EL_PLAYER_1 },
+
+ { EL_BUG_RIGHT, EL_BUG },
+ { EL_BUG_UP, EL_BUG },
+ { EL_BUG_LEFT, EL_BUG },
+ { EL_BUG_DOWN, EL_BUG },
+
+ { EL_SPACESHIP_RIGHT, EL_SPACESHIP },
+ { EL_SPACESHIP_UP, EL_SPACESHIP },
+ { EL_SPACESHIP_LEFT, EL_SPACESHIP },
+ { EL_SPACESHIP_DOWN, EL_SPACESHIP },
+
+ { EL_PACMAN_RIGHT, EL_YAMYAM },
+ { EL_PACMAN_UP, EL_YAMYAM },
+ { EL_PACMAN_LEFT, EL_YAMYAM },
+ { EL_PACMAN_DOWN, EL_YAMYAM },
+
+ { -1, -1 }
+};
- EL_SP_HARD_YELLOW,
- EL_SP_HARD_BASE2,
- EL_SP_HARD_BASE3,
- EL_SP_HARD_BASE4,
+static struct
+{
+ short element;
+ char *element_string;
+}
+forum_sketch_element_strings[] =
+{
+ { EL_PLAYER_1, "p" },
+ { EL_EMPTY, "_" },
+ { EL_SAND, "s" },
+ { EL_ROCK, "b" },
+ { EL_EMERALD, "e" },
+ { EL_BUG, "u" },
+ { EL_SPACESHIP, "h" },
+ { EL_BD_FIREFLY, "f" },
+ { EL_BD_BUTTERFLY, "b" },
+ { EL_AMOEBA, "a" },
+ { EL_YAMYAM, "y" },
+ { EL_WALL, "w" },
+ { EL_STEELWALL, "t" },
+ { EL_MAGIC_WALL, "m" },
+ { EL_EXIT_OPEN, "x" },
+ { EL_DYNAMITE, "d" },
+ { EL_KEY_1, "1" },
+ { EL_KEY_2, "2" },
+ { EL_KEY_3, "3" },
+ { EL_KEY_4, "4" },
+ { EL_GATE_1, "5" },
+ { EL_GATE_2, "6" },
+ { EL_GATE_3, "7" },
+ { EL_GATE_4, "8" },
+ { EL_GATE_1_GRAY, "9" },
+ { EL_BOMB, "@" },
+ { EL_ROBOT, "r" },
+ { EL_ROBOT_WHEEL, "0" },
+ { EL_NUT, "n" },
+ { EL_CUSTOM_1, "c" },
+ { EL_CHAR_QUESTION, "?" },
+
+ { -1, NULL }
+};
- EL_SP_HARD_BASE5,
- EL_SP_HARD_BASE6,
- EL_SP_CHIP_UPPER,
- EL_SP_CHIP_LOWER,
- EL_CHAR('D'),
- EL_CHAR('I'),
- EL_CHAR('A'),
- EL_CHAR('-'),
+/*
+ -----------------------------------------------------------------------------
+ functions
+ -----------------------------------------------------------------------------
+*/
- EL_CHAR('M'),
- EL_CHAR('O'),
- EL_CHAR('N'),
- EL_CHAR('D'),
+static int getMaxInfoTextLength()
+{
+ return (SXSIZE / getFontWidth(FONT_TEXT_2));
+}
- EL_CHAR('C'),
- EL_CHAR('A'),
- EL_CHAR('V'),
- EL_CHAR('E'),
+static int getTextWidthForGadget(char *text)
+{
+ if (text == NULL)
+ return 0;
- EL_CHAR('S'),
- EL_CHAR(' '),
- EL_CHAR('I'),
- EL_CHAR('I'),
+ return (getTextWidth(text, FONT_TEXT_1) + ED_GADGET_TEXT_DISTANCE);
+}
- EL_PEARL,
- EL_CRYSTAL,
- EL_WALL_PEARL,
- EL_WALL_CRYSTAL,
+static int getTextWidthForDrawingArea(char *text)
+{
+ if (text == NULL)
+ return 0;
- EL_BELT1_LEFT,
- EL_BELT1_MIDDLE,
- EL_BELT1_RIGHT,
- EL_BELT1_SWITCH_MIDDLE,
+ return (getTextWidth(text, FONT_TEXT_1) + ED_DRAWINGAREA_TEXT_DISTANCE);
+}
- EL_BELT2_LEFT,
- EL_BELT2_MIDDLE,
- EL_BELT2_RIGHT,
- EL_BELT2_SWITCH_MIDDLE,
+static int getRightGadgetBorder(struct GadgetInfo *gi, char *text)
+{
+ return (gi->x + gi->width + getTextWidthForGadget(text));
+}
- EL_BELT3_LEFT,
- EL_BELT3_MIDDLE,
- EL_BELT3_RIGHT,
- EL_BELT3_SWITCH_MIDDLE,
+static char *getElementInfoText(int element)
+{
+ char *info_text = NULL;
- EL_BELT4_LEFT,
- EL_BELT4_MIDDLE,
- EL_BELT4_RIGHT,
- EL_BELT4_SWITCH_MIDDLE,
+ if (element < NUM_FILE_ELEMENTS)
+ {
+ if (strlen(element_info[element].description) > 0)
+ info_text = element_info[element].description;
+ else if (element_info[element].custom_description != NULL)
+ info_text = element_info[element].custom_description;
+ else if (element_info[element].editor_description != NULL)
+ info_text = element_info[element].editor_description;
+ }
- EL_BELT1_SWITCH_LEFT,
- EL_BELT2_SWITCH_LEFT,
- EL_BELT3_SWITCH_LEFT,
- EL_BELT4_SWITCH_LEFT,
+ if (info_text == NULL)
+ info_text = INFOTEXT_UNKNOWN_ELEMENT;
- EL_BELT1_SWITCH_RIGHT,
- EL_BELT2_SWITCH_RIGHT,
- EL_BELT3_SWITCH_RIGHT,
- EL_BELT4_SWITCH_RIGHT,
+ return info_text;
+}
- EL_SWITCHGATE_OPEN,
- EL_SWITCHGATE_CLOSED,
- EL_SWITCHGATE_SWITCH_1,
- EL_ENVELOPE,
+static void ReinitializeElementList()
+{
+ static boolean initialized = FALSE;
+ int pos = 0;
+ int i, j;
- EL_TIMEGATE_CLOSED,
- EL_TIMEGATE_OPEN,
- EL_TIMEGATE_SWITCH_OFF,
- EL_LEERRAUM,
+ checked_free(editor_elements);
- EL_LANDMINE,
- EL_SAND_INVISIBLE,
- EL_STEEL_SLANTED,
- EL_LEERRAUM,
+ if (!initialized)
+ {
+ /* initialize optional user defined element list */
+ LoadUserDefinedEditorElementList(&editor_el_user_defined_ptr,
+ &num_editor_el_user_defined);
- EL_SIGN_EXCLAMATION,
- EL_SIGN_STOP,
- EL_LIGHT_SWITCH_OFF,
- EL_LIGHT_SWITCH_ON,
+ /* initialize list of empty elements (used for padding, if needed) */
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ editor_el_empty[i] = EL_EMPTY;
- EL_SHIELD_PASSIVE,
- EL_SHIELD_ACTIVE,
- EL_EXTRA_TIME,
- EL_LEERRAUM,
+ /* do some sanity checks for each element from element list */
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
+ {
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
+ {
+ int element = (*editor_elements_info[i].element_list)[j];
- EL_CHAR('D'),
- EL_CHAR('X'),
- EL_CHAR('-'),
- EL_CHAR(' '),
+ if (element >= NUM_FILE_ELEMENTS)
+ Error(ERR_WARN, "editor element %d is runtime element", element);
- EL_CHAR('B'),
- EL_CHAR('O'),
- EL_CHAR('U'),
- EL_CHAR('L'),
+ if (strcmp(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT) == 0)
+ Error(ERR_WARN, "no element description for element %d", element);
+ }
+ }
- EL_CHAR('-'),
- EL_CHAR('D'),
- EL_CHAR('E'),
- EL_CHAR('R'),
+ initialized = TRUE;
+ }
- EL_CHAR('D'),
- EL_CHAR('A'),
- EL_CHAR('S'),
- EL_CHAR('H'),
+ num_editor_elements = 0;
+ use_el_empty = FALSE;
- EL_SPRING,
- EL_TUBE_RIGHT_DOWN,
- EL_TUBE_HORIZ_DOWN,
- EL_TUBE_LEFT_DOWN,
+ /* determine size of element list */
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
+ {
+ if (*editor_elements_info[i].setup_value)
+ {
+ if (setup.editor.el_headlines)
+ num_editor_elements += *editor_elements_info[i].headline_list_size;
- EL_TUBE_HORIZONTAL,
- EL_TUBE_VERT_RIGHT,
- EL_TUBE_CROSS,
- EL_TUBE_VERT_LEFT,
+ num_editor_elements += *editor_elements_info[i].element_list_size;
+ }
+ }
- EL_TUBE_VERTICAL,
- EL_TUBE_RIGHT_UP,
- EL_TUBE_HORIZ_UP,
- EL_TUBE_LEFT_UP,
+ if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
+ {
+ /* offer at least as many elements as element buttons exist */
+ use_el_empty = TRUE;
+ num_editor_el_empty = ED_NUM_ELEMENTLIST_BUTTONS - num_editor_elements;
- EL_TRAP_INACTIVE,
- EL_DX_SUPABOMB,
- EL_LEERRAUM,
- EL_LEERRAUM,
+ num_editor_elements += num_editor_el_empty;
+ }
- /*
- EL_CHAR('D'),
- EL_CHAR('Y'),
- EL_CHAR('N'),
- EL_CHAR('A'),
+ editor_elements = checked_malloc(num_editor_elements * sizeof(int));
- EL_CHAR('B'),
- EL_CHAR('L'),
- EL_CHAR('A'),
- EL_CHAR('S'),
+ /* fill element list */
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
+ {
+ if (*editor_elements_info[i].setup_value)
+ {
+ if (setup.editor.el_headlines)
+ for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
+ editor_elements[pos++] = (*editor_elements_info[i].headline_list)[j];
- EL_CHAR_MINUS,
- EL_CHAR('T'),
- EL_CHAR('E'),
- EL_CHAR('R'),
- */
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
+ editor_elements[pos++] = (*editor_elements_info[i].element_list)[j];
+ }
+ }
- EL_LEERRAUM,
- EL_LEERRAUM,
- EL_LEERRAUM,
- EL_LEERRAUM,
+ /* correct position of element list scrollbar */
+ if (element_shift < 0)
+ element_shift = 0;
+ if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
+ element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
+}
- EL_CHAR(' '),
- EL_CHAR('!'),
- EL_CHAR('"'),
- EL_CHAR('#'),
+void PrintEditorElementList()
+{
+ boolean *stop = &setup.editor.el_user_defined;
+ int i, j;
- EL_CHAR('$'),
- EL_CHAR('%'),
- EL_CHAR('&'),
- EL_CHAR('\''),
+ for (i = 0; editor_elements_info[i].setup_value != stop; i++)
+ {
+ for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
+ {
+ int element = (*editor_elements_info[i].headline_list)[j];
- EL_CHAR('('),
- EL_CHAR(')'),
- EL_CHAR('*'),
- EL_CHAR('+'),
+ printf("# %s\n", element_info[element].token_name);
+ }
- EL_CHAR(','),
- EL_CHAR('-'),
- EL_CHAR('.'),
- EL_CHAR('/'),
+ if (j > 0)
+ printf("#\n");
- EL_CHAR('0'),
- EL_CHAR('1'),
- EL_CHAR('2'),
- EL_CHAR('3'),
+ for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
+ {
+ int element = (*editor_elements_info[i].element_list)[j];
- EL_CHAR('4'),
- EL_CHAR('5'),
- EL_CHAR('6'),
- EL_CHAR('7'),
+ printf("# %s\n", element_info[element].token_name);
+ }
- EL_CHAR('8'),
- EL_CHAR('9'),
- EL_CHAR(':'),
- EL_CHAR(';'),
+ if (j > 0)
+ printf("#\n");
+ }
+}
- EL_CHAR('<'),
- EL_CHAR('='),
- EL_CHAR('>'),
- EL_CHAR('?'),
+static void ReinitializeElementListButtons()
+{
+ static boolean last_setup_value_headlines = FALSE;
+ static boolean initialization_needed = TRUE;
+ int i;
- EL_CHAR('@'),
- EL_CHAR('A'),
- EL_CHAR('B'),
- EL_CHAR('C'),
+ if (!initialization_needed) /* check if editor element setup has changed */
+ {
+ if (last_setup_value_headlines != setup.editor.el_headlines)
+ initialization_needed = TRUE;
- EL_CHAR('D'),
- EL_CHAR('E'),
- EL_CHAR('F'),
- EL_CHAR('G'),
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
+ if (editor_elements_info[i].last_setup_value !=
+ *editor_elements_info[i].setup_value)
+ initialization_needed = TRUE;
+ }
- EL_CHAR('H'),
- EL_CHAR('I'),
- EL_CHAR('J'),
- EL_CHAR('K'),
+ if (!initialization_needed)
+ return;
- EL_CHAR('L'),
- EL_CHAR('M'),
- EL_CHAR('N'),
- EL_CHAR('O'),
+ FreeLevelEditorGadgets();
+ CreateLevelEditorGadgets();
- EL_CHAR('P'),
- EL_CHAR('Q'),
- EL_CHAR('R'),
- EL_CHAR('S'),
+ /* store current setup values for next invocation of this function */
+ last_setup_value_headlines = setup.editor.el_headlines;
+ for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
+ editor_elements_info[i].last_setup_value =
+ *editor_elements_info[i].setup_value;
- EL_CHAR('T'),
- EL_CHAR('U'),
- EL_CHAR('V'),
- EL_CHAR('W'),
+ initialization_needed = FALSE;
+}
- EL_CHAR('X'),
- EL_CHAR('Y'),
- EL_CHAR('Z'),
- EL_CHAR('Ä'),
+static void DrawElementBorder(int dest_x, int dest_y, int width, int height,
+ boolean input)
+{
+ int border_graphic =
+ (input ? IMG_EDITOR_ELEMENT_BORDER_INPUT : IMG_EDITOR_ELEMENT_BORDER);
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ int num_mini_tilex = width / MINI_TILEX + 1;
+ int num_mini_tiley = height / MINI_TILEY + 1;
+ int x, y;
- EL_CHAR('Ö'),
- EL_CHAR('Ü'),
- EL_CHAR('^'),
- EL_CHAR(' ')
-};
-int elements_in_list = sizeof(editor_element)/sizeof(int);
+ getMiniGraphicSource(border_graphic, &src_bitmap, &src_x, &src_y);
-static char *getElementInfoText(int element)
+ for (y = 0; y < num_mini_tiley; y++)
+ for (x = 0; x < num_mini_tilex; x++)
+ BlitBitmap(src_bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY,
+ dest_x - MINI_TILEX / 2 + x * MINI_TILEX,
+ dest_y - MINI_TILEY / 2 + y * MINI_TILEY);
+
+ ClearRectangle(drawto, dest_x - 1, dest_y - 1, width + 2, height + 2);
+}
+
+static void DrawDrawingArea(int id)
{
- char *info_text = "unknown";
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
+ int x, y;
- if (element < num_element_info)
- info_text = element_info[element];
- else
- Error(ERR_WARN, "no element description for element %d", element);
+ if (id == ED_DRAWING_ID_RANDOM_BACKGROUND)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(random_placement_background_element));
+ else if (id == ED_DRAWING_ID_AMOEBA_CONTENT)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y, el2edimg(level.amoeba_content));
+ else if (id == ED_DRAWING_ID_CUSTOM_GRAPHIC)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(custom_element.gfx_element));
+ else if (id == ED_DRAWING_ID_CUSTOM_CONTENT)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ DrawMiniGraphicExt(drawto,
+ gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
+ el2edimg(custom_element.content[x][y]));
+ else if (id == ED_DRAWING_ID_CUSTOM_MOVE_ENTER)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(custom_element.move_enter_element));
+ else if (id == ED_DRAWING_ID_CUSTOM_MOVE_LEAVE)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(custom_element.move_leave_element));
+ else if (id == ED_DRAWING_ID_CUSTOM_CHANGE_TARGET)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(custom_element_change.target_element));
+ else if (id == ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ DrawMiniGraphicExt(drawto,
+ gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
+ el2edimg(custom_element_change.content[x][y]));
+ else if (id == ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER)
+ DrawMiniGraphicExt(drawto, gi->x, gi->y,
+ el2edimg(custom_element_change.trigger_element));
+ else if (id == ED_DRAWING_ID_GROUP_CONTENT)
+ for (x = 0; x < group_element_info.num_elements; x++)
+ DrawMiniGraphicExt(drawto, gi->x + x * MINI_TILEX, gi->y,
+ el2edimg(group_element_info.element[x]));
+ else if (id >= ED_DRAWING_ID_ELEMENT_CONTENT_0 &&
+ id <= ED_DRAWING_ID_ELEMENT_CONTENT_7)
+ {
+ int nr = id - ED_DRAWING_ID_ELEMENT_CONTENT_0;
- return info_text;
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ DrawMiniGraphicExt(drawto,
+ gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY,
+ el2edimg(level.yamyam_content[nr][x][y]));
+ }
}
static void ScrollMiniLevel(int from_x, int from_y, int scroll)
if (dx)
{
x = (dx == 1 ? 0 : ed_fieldx - 1);
- for(y=0; y<ed_fieldy; y++)
+ for (y = 0; y < ed_fieldy; y++)
DrawMiniElementOrWall(x, y, from_x, from_y);
}
else if (dy)
{
y = (dy == 1 ? 0 : ed_fieldy - 1);
- for(x=0; x<ed_fieldx; x++)
+ for (x = 0; x < ed_fieldx; x++)
DrawMiniElementOrWall(x, y, from_x, from_y);
}
static void CreateControlButtons()
{
- Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
unsigned long event_mask;
int i;
/* create toolbox buttons */
- for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
{
int id = i;
int width, height;
id == GADGET_ID_FILLED_BOX ||
id == GADGET_ID_FLOOD_FILL ||
id == GADGET_ID_GRAB_BRUSH ||
- id == GADGET_ID_PICK_ELEMENT)
+ id == GADGET_ID_PICK_ELEMENT ||
+ id == GADGET_ID_CUSTOM_COPY_FROM ||
+ id == GADGET_ID_CUSTOM_COPY_TO ||
+ id == GADGET_ID_CUSTOM_EXCHANGE)
{
button_type = GD_TYPE_RADIO_BUTTON;
radio_button_nr = RADIO_NR_DRAWING_TOOLBOX;
gd_yoffset = ED_CTRL1_BUTTONS_YPOS + y * ED_CTRL1_BUTTON_YSIZE;
width = ED_CTRL1_BUTTON_XSIZE;
height = ED_CTRL1_BUTTON_YSIZE;
+
+ gd_x1 = DOOR_GFX_PAGEX8 + gd_xoffset;
+ gd_x2 = DOOR_GFX_PAGEX7 + gd_xoffset;
+ gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL1_BUTTONS_GFX_YPOS + gd_yoffset;
+ gd_y2 = DOOR_GFX_PAGEY1 + ED_CTRL1_BUTTONS_ALT_GFX_YPOS + gd_yoffset;
}
- else
+ else if (id < ED_NUM_CTRL1_2_BUTTONS)
{
int x = (i - ED_NUM_CTRL1_BUTTONS) % ED_CTRL2_BUTTONS_HORIZ;
int y = (i - ED_NUM_CTRL1_BUTTONS) / ED_CTRL2_BUTTONS_HORIZ;
gd_yoffset = ED_CTRL2_BUTTONS_YPOS + y * ED_CTRL2_BUTTON_YSIZE;
width = ED_CTRL2_BUTTON_XSIZE;
height = ED_CTRL2_BUTTON_YSIZE;
- }
- gd_x1 = DOOR_GFX_PAGEX8 + gd_xoffset;
- gd_x2 = DOOR_GFX_PAGEX7 + gd_xoffset;
- gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL_BUTTONS_GFX_YPOS + gd_yoffset;
- gd_y2 = DOOR_GFX_PAGEY1 + ED_CTRL_BUTTONS_ALT_GFX_YPOS + gd_yoffset;
+ gd_x1 = DOOR_GFX_PAGEX8 + gd_xoffset;
+ gd_x2 = DOOR_GFX_PAGEX7 + gd_xoffset;
+ gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL2_BUTTONS_GFX_YPOS + gd_yoffset;
+ gd_y2 = 0; /* no alternative graphic for these buttons */
+ }
+ else
+ {
+ int x = (i - ED_NUM_CTRL1_2_BUTTONS) % ED_CTRL3_BUTTONS_HORIZ + 1;
+ int y = (i - ED_NUM_CTRL1_2_BUTTONS) / ED_CTRL3_BUTTONS_HORIZ;
+
+ gd_xoffset = ED_CTRL3_BUTTONS_XPOS + x * ED_CTRL3_BUTTON_XSIZE;
+ gd_yoffset = ED_CTRL3_BUTTONS_YPOS + y * ED_CTRL3_BUTTON_YSIZE;
+ width = ED_CTRL3_BUTTON_XSIZE;
+ height = ED_CTRL3_BUTTON_YSIZE;
+
+ gd_x1 = DOOR_GFX_PAGEX6 + gd_xoffset;
+ gd_x2 = DOOR_GFX_PAGEX5 + gd_xoffset;
+ gd_y1 = DOOR_GFX_PAGEY1 + ED_CTRL3_BUTTONS_GFX_YPOS + gd_yoffset;
+ gd_y2 = DOOR_GFX_PAGEY1 + ED_CTRL3_BUTTONS_ALT_GFX_YPOS + gd_yoffset;
+ }
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
}
/* create buttons for scrolling of drawing area and element list */
- for (i=0; i<ED_NUM_SCROLLBUTTONS; i++)
+ for (i = 0; i < ED_NUM_SCROLLBUTTONS; i++)
{
int id = scrollbutton_info[i].gadget_id;
int x, y, width, height;
y += DY;
width = ED_SCROLLBUTTON2_XSIZE;
height = ED_SCROLLBUTTON2_YSIZE;
- gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[i].xpos;
- gd_y1 = DOOR_GFX_PAGEY1 + scrollbutton_info[i].ypos;
+ gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[i].gd_x;
+ gd_y1 = DOOR_GFX_PAGEY1 + scrollbutton_info[i].gd_y;
gd_x2 = gd_x1 - ED_SCROLLBUTTON2_XSIZE;
gd_y2 = gd_y1;
}
y += SY;
width = ED_SCROLLBUTTON_XSIZE;
height = ED_SCROLLBUTTON_YSIZE;
- gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[i].xpos;
- gd_y1 = DOOR_GFX_PAGEY1 + scrollbutton_info[i].ypos;
+ gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[i].gd_x;
+ gd_y1 = DOOR_GFX_PAGEY1 + scrollbutton_info[i].gd_y;
gd_x2 = gd_x1 - ED_SCROLLBUTTON_XSIZE;
gd_y2 = gd_y1;
}
}
/* create buttons for element list */
- for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
- Bitmap deco_bitmap;
+ Bitmap *deco_bitmap;
int deco_x, deco_y, deco_xpos, deco_ypos;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
int x = i % ED_ELEMENTLIST_BUTTONS_HORIZ;
int y = i / ED_ELEMENTLIST_BUTTONS_HORIZ;
int id = GADGET_ID_ELEMENTLIST_FIRST + i;
+ int element = editor_elements[i];
event_mask = GD_EVENT_RELEASED;
gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
- getMiniGraphicSource(el2gfx(editor_element[i]),
- &deco_bitmap, &deco_x, &deco_y);
+ getMiniGraphicSource(el2edimg(element), &deco_bitmap, &deco_x, &deco_y);
deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
- GDI_INFO_TEXT, getElementInfoText(editor_element[i]),
+ GDI_INFO_TEXT, getElementInfoText(element),
GDI_X, DX + gd_xoffset,
GDI_Y, DY + gd_yoffset,
GDI_WIDTH, ED_ELEMENTLIST_XSIZE,
static void CreateCounterButtons()
{
+ int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_COUNTERBUTTONS; i++)
+ for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++)
{
int j;
- int xpos = SX + counterbutton_info[i].x; /* xpos of down count button */
- int ypos = SY + counterbutton_info[i].y;
+ int x = SX + counterbutton_info[i].x; /* down count button */
+ int y = SY + counterbutton_info[i].y;
+
+ /* determine horizontal position to the right of specified gadget */
+ if (counterbutton_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[counterbutton_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
- for (j=0; j<2; j++)
+ /* determine horizontal offset for leading text */
+ if (counterbutton_info[i].text_left != NULL)
+ x += getTextWidthForGadget(counterbutton_info[i].text_left);
+
+ for (j = 0; j < 2; j++)
{
- Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
int id = (j == 0 ?
counterbutton_info[i].gadget_id_down :
int gd_x, gd_x1, gd_x2, gd_y;
int x_size, y_size;
unsigned long event_mask;
- char infotext[MAX_INFOTEXT_LEN + 1];
+ char infotext[max_infotext_len + 1];
event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
event_mask |= GD_EVENT_RELEASED;
if (j == 1)
- xpos += 2 * ED_GADGET_DISTANCE;
- ypos += ED_GADGET_DISTANCE;
+ x += 2 * ED_GADGET_DISTANCE;
+ y += ED_GADGET_DISTANCE;
- gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[sid].xpos;
+ gd_x1 = DOOR_GFX_PAGEX8 + scrollbutton_info[sid].gd_x;
gd_x2 = gd_x1 - ED_SCROLLBUTTON_XSIZE;
- gd_y = DOOR_GFX_PAGEY1 + scrollbutton_info[sid].ypos;
+ gd_y = DOOR_GFX_PAGEY1 + scrollbutton_info[sid].gd_y;
x_size = ED_SCROLLBUTTON_XSIZE;
y_size = ED_SCROLLBUTTON_YSIZE;
}
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_INFO_TEXT, infotext,
- GDI_X, xpos,
- GDI_Y, ypos,
+ GDI_X, x,
+ GDI_Y, y,
GDI_WIDTH, x_size,
GDI_HEIGHT, y_size,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
Error(ERR_EXIT, "cannot create gadget");
level_editor_gadget[id] = gi;
- xpos += gi->width + ED_GADGET_DISTANCE; /* xpos of text count button */
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, counterbutton_info[i].text_right);
+
+ x += gi->width + ED_GADGET_DISTANCE; /* text count button */
if (j == 0)
{
- int font_type = FC_YELLOW;
+ int font_type = FONT_INPUT_1;
+ int font_type_active = FONT_INPUT_1_ACTIVE;
int gd_width = ED_WIN_COUNT_XSIZE;
id = counterbutton_info[i].gadget_id_text;
if (i == ED_COUNTER_ID_SELECT_LEVEL)
{
- font_type = FC_SPECIAL3;
+ font_type = FONT_LEVEL_NUMBER;
+ font_type_active = FONT_LEVEL_NUMBER;
- xpos += 2 * ED_GADGET_DISTANCE;
- ypos -= ED_GADGET_DISTANCE;
+ x += 2 * ED_GADGET_DISTANCE;
+ y -= ED_GADGET_DISTANCE;
gd_x = DOOR_GFX_PAGEX6 + ED_WIN_COUNT2_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_WIN_COUNT2_YPOS;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_INFO_TEXT, "enter counter value",
- GDI_X, xpos,
- GDI_Y, ypos,
- GDI_TYPE, GD_TYPE_TEXTINPUT_NUMERIC,
+ GDI_X, x,
+ GDI_Y, y,
+ GDI_TYPE, GD_TYPE_TEXT_INPUT_NUMERIC,
GDI_NUMBER_VALUE, 0,
GDI_NUMBER_MIN, counterbutton_info[i].min_value,
GDI_NUMBER_MAX, counterbutton_info[i].max_value,
GDI_TEXT_SIZE, 3,
GDI_TEXT_FONT, font_type,
+ GDI_TEXT_FONT_ACTIVE, font_type_active,
GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
- GDI_BORDER_SIZE, ED_BORDER_SIZE,
- GDI_TEXTINPUT_DESIGN_WIDTH, gd_width,
+ GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+ GDI_DESIGN_WIDTH, gd_width,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleCounterButtons,
Error(ERR_EXIT, "cannot create gadget");
level_editor_gadget[id] = gi;
- xpos += gi->width + ED_GADGET_DISTANCE; /* xpos of up count button */
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, counterbutton_info[i].text_right);
+
+ x += gi->width + ED_GADGET_DISTANCE; /* up count button */
}
}
}
static void CreateDrawingAreas()
{
- struct GadgetInfo *gi;
- unsigned long event_mask;
- int id;
int i;
- event_mask =
- GD_EVENT_PRESSED | GD_EVENT_RELEASED | GD_EVENT_MOVING |
- GD_EVENT_OFF_BORDERS;
-
- /* one for the level drawing area ... */
- id = GADGET_ID_DRAWING_LEVEL;
- gi = CreateGadget(GDI_CUSTOM_ID, id,
- GDI_X, SX,
- GDI_Y, SY,
- GDI_TYPE, GD_TYPE_DRAWING_AREA,
- GDI_AREA_SIZE, ed_fieldx, ed_fieldy,
- GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
- GDI_EVENT_MASK, event_mask,
- GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
- GDI_CALLBACK_ACTION, HandleDrawingAreas,
- GDI_END);
+ for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
+ {
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ int id = drawingarea_info[i].gadget_id;
+ int x = SX + drawingarea_info[i].x;
+ int y = SY + drawingarea_info[i].y;
+ int area_xsize = drawingarea_info[i].area_xsize;
+ int area_ysize = drawingarea_info[i].area_ysize;
- if (gi == NULL)
- Error(ERR_EXIT, "cannot create gadget");
+ event_mask =
+ GD_EVENT_PRESSED | GD_EVENT_RELEASED | GD_EVENT_MOVING |
+ GD_EVENT_OFF_BORDERS;
- level_editor_gadget[id] = gi;
+ /* determine horizontal position to the right of specified gadget */
+ if (drawingarea_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[drawingarea_info[i].gadget_id_align] +
+ ED_DRAWINGAREA_TEXT_DISTANCE);
- /* ... up to eight areas for element content ... */
- for (i=0; i<MAX_ELEMENT_CONTENTS; i++)
- {
- int gx = SX + ED_AREA_ELEM_CONTENT_XPOS + 5 * (i % 4) * MINI_TILEX;
- int gy = SX + ED_AREA_ELEM_CONTENT_YPOS + 6 * (i / 4) * MINI_TILEY;
+ /* determine horizontal offset for leading text */
+ if (drawingarea_info[i].text_left != NULL)
+ x += getTextWidthForDrawingArea(drawingarea_info[i].text_left);
- id = GADGET_ID_ELEM_CONTENT_0 + i;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
- GDI_X, gx,
- GDI_Y, gy,
- GDI_WIDTH, 3 * MINI_TILEX,
- GDI_HEIGHT, 3 * MINI_TILEY,
+ GDI_X, x,
+ GDI_Y, y,
GDI_TYPE, GD_TYPE_DRAWING_AREA,
+ GDI_AREA_SIZE, area_xsize, area_ysize,
GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
Error(ERR_EXIT, "cannot create gadget");
level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, drawingarea_info[i].text_right);
}
-
- /* ... one for the amoeba content */
- id = GADGET_ID_AMOEBA_CONTENT;
- gi = CreateGadget(GDI_CUSTOM_ID, id,
- GDI_X, SX + ED_AREA_ELEM_CONTENT_XPOS,
- GDI_Y, SY + ED_AREA_ELEM_CONTENT_YPOS,
- GDI_WIDTH, MINI_TILEX,
- GDI_HEIGHT, MINI_TILEY,
- GDI_TYPE, GD_TYPE_DRAWING_AREA,
- GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
- GDI_EVENT_MASK, event_mask,
- GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
- GDI_CALLBACK_ACTION, HandleDrawingAreas,
- GDI_END);
-
- if (gi == NULL)
- Error(ERR_EXIT, "cannot create gadget");
-
- level_editor_gadget[id] = gi;
-
- /* ... and one for random placement background restrictions */
-
- id = GADGET_ID_RANDOM_BACKGROUND;
- gi = CreateGadget(GDI_CUSTOM_ID, id,
- GDI_X, SX + ED_AREA_RANDOM_BACKGROUND_XPOS,
- GDI_Y, SY + ED_AREA_RANDOM_BACKGROUND_YPOS,
- GDI_WIDTH, MINI_TILEX,
- GDI_HEIGHT, MINI_TILEY,
- GDI_TYPE, GD_TYPE_DRAWING_AREA,
- GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY,
- GDI_EVENT_MASK, event_mask,
- GDI_CALLBACK_INFO, HandleDrawingAreaInfo,
- GDI_CALLBACK_ACTION, HandleDrawingAreas,
- GDI_END);
-
- if (gi == NULL)
- Error(ERR_EXIT, "cannot create gadget");
-
- level_editor_gadget[id] = gi;
}
static void CreateTextInputGadgets()
{
+ int max_infotext_len = getMaxInfoTextLength();
int i;
- for (i=0; i<ED_NUM_TEXTINPUT; i++)
+ for (i = 0; i < ED_NUM_TEXTINPUT; i++)
{
- Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
struct GadgetInfo *gi;
unsigned long event_mask;
- char infotext[1024];
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
int id = textinput_info[i].gadget_id;
event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
gd_y = DOOR_GFX_PAGEY1 + ED_WIN_COUNT_YPOS;
sprintf(infotext, "Enter %s", textinput_info[i].infotext);
- infotext[MAX_INFOTEXT_LEN] = '\0';
+ infotext[max_infotext_len] = '\0';
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_INFO_TEXT, infotext,
GDI_X, SX + textinput_info[i].x,
GDI_Y, SY + textinput_info[i].y,
- GDI_TYPE, GD_TYPE_TEXTINPUT_ALPHANUMERIC,
+ GDI_TYPE, GD_TYPE_TEXT_INPUT_ALPHANUMERIC,
GDI_TEXT_VALUE, textinput_info[i].value,
GDI_TEXT_SIZE, textinput_info[i].size,
- GDI_TEXT_FONT, FC_YELLOW,
+ GDI_TEXT_FONT, FONT_INPUT_1,
+ GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
- GDI_BORDER_SIZE, ED_BORDER_SIZE,
- GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+ GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+ GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleTextInputGadgets,
}
}
+static void CreateTextAreaGadgets()
+{
+ int max_infotext_len = getMaxInfoTextLength();
+ int i;
+
+ for (i = 0; i < ED_NUM_TEXTAREAS; i++)
+ {
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ int gd_x, gd_y;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ int id = textarea_info[i].gadget_id;
+ int area_xsize = textarea_info[i].xsize;
+ int area_ysize = textarea_info[i].ysize;
+
+ event_mask = GD_EVENT_TEXT_LEAVING;
+
+ gd_x = DOOR_GFX_PAGEX4 + ED_WIN_COUNT_XPOS;
+ gd_y = DOOR_GFX_PAGEY1 + ED_WIN_COUNT_YPOS;
+
+ sprintf(infotext, "Enter %s", textarea_info[i].infotext);
+ infotext[max_infotext_len] = '\0';
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_CUSTOM_TYPE_ID, i,
+ GDI_INFO_TEXT, infotext,
+ GDI_X, SX + textarea_info[i].x,
+ GDI_Y, SY + textarea_info[i].y,
+ GDI_TYPE, GD_TYPE_TEXT_AREA,
+ GDI_AREA_SIZE, area_xsize, area_ysize,
+ GDI_TEXT_FONT, FONT_INPUT_1,
+ GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+ GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
+ GDI_CALLBACK_ACTION, HandleTextAreaGadgets,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+ }
+}
+
+static void CreateSelectboxGadgets()
+{
+ int max_infotext_len = getMaxInfoTextLength();
+ int i, j;
+
+ for (i = 0; i < ED_NUM_SELECTBOX; i++)
+ {
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ int gd_x, gd_y;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ int id = selectbox_info[i].gadget_id;
+ int x = SX + selectbox_info[i].x;
+ int y = SY + selectbox_info[i].y;
+
+ if (selectbox_info[i].size == -1) /* dynamically determine size */
+ {
+ /* (we cannot use -1 for uninitialized values if we directly compare
+ with results from strlen(), because the '<' and '>' operation will
+ implicitely cast -1 to an unsigned integer value!) */
+ selectbox_info[i].size = 0;
+
+ for (j = 0; selectbox_info[i].options[j].text != NULL; j++)
+ if (strlen(selectbox_info[i].options[j].text) > selectbox_info[i].size)
+ selectbox_info[i].size = strlen(selectbox_info[i].options[j].text);
+
+ selectbox_info[i].size++; /* add one character empty space */
+ }
+
+ event_mask = GD_EVENT_RELEASED |
+ GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
+
+ gd_x = DOOR_GFX_PAGEX4 + ED_SELECTBOX_XPOS;
+ gd_y = DOOR_GFX_PAGEY1 + ED_SELECTBOX_YPOS;
+
+ /* determine horizontal position to the right of specified gadget */
+ if (selectbox_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[selectbox_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
+
+ /* determine horizontal offset for leading text */
+ if (selectbox_info[i].text_left != NULL)
+ x += getTextWidthForGadget(selectbox_info[i].text_left);
+
+ sprintf(infotext, "Select %s", selectbox_info[i].infotext);
+ infotext[max_infotext_len] = '\0';
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_CUSTOM_TYPE_ID, i,
+ GDI_INFO_TEXT, infotext,
+ GDI_X, x,
+ GDI_Y, y,
+ GDI_TYPE, GD_TYPE_SELECTBOX,
+ GDI_SELECTBOX_OPTIONS, selectbox_info[i].options,
+ GDI_TEXT_SIZE, selectbox_info[i].size,
+ GDI_TEXT_FONT, FONT_INPUT_1,
+ GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+ GDI_BORDER_SIZE_SELECTBUTTON, ED_SELECTBOX_BUTTON_XSIZE,
+ GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
+ GDI_CALLBACK_ACTION, HandleSelectboxGadgets,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, selectbox_info[i].text_right);
+ }
+}
+
+static void CreateTextbuttonGadgets()
+{
+ int max_infotext_len = getMaxInfoTextLength();
+ int i;
+
+ for (i = 0; i < ED_NUM_TEXTBUTTONS; i++)
+ {
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ int gd_x1, gd_x2, gd_y1, gd_y2;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ int id = textbutton_info[i].gadget_id;
+ int x = SX + textbutton_info[i].x;
+ int y = SY + textbutton_info[i].y;
+
+ if (textbutton_info[i].size == -1) /* dynamically determine size */
+ textbutton_info[i].size = strlen(textbutton_info[i].text);
+
+ event_mask = GD_EVENT_RELEASED;
+
+ if (id >= GADGET_ID_PROPERTIES_INFO && id <= GADGET_ID_PROPERTIES_CHANGE)
+ {
+ gd_x1 = DOOR_GFX_PAGEX4 + ED_TEXTBUTTON_TAB_XPOS;
+ gd_x2 = DOOR_GFX_PAGEX3 + ED_TEXTBUTTON_TAB_XPOS;
+ gd_y1 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_TAB_YPOS;
+ gd_y2 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_TAB_INACTIVE_YPOS;
+ }
+ else
+ {
+ gd_x1 = DOOR_GFX_PAGEX4 + ED_TEXTBUTTON_XPOS;
+ gd_x2 = DOOR_GFX_PAGEX3 + ED_TEXTBUTTON_XPOS;
+ gd_y1 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_YPOS;
+ gd_y2 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_INACTIVE_YPOS;
+ }
+
+ sprintf(infotext, "%s", textbutton_info[i].infotext);
+ infotext[max_infotext_len] = '\0';
+
+ /* determine horizontal position to the right of specified gadget */
+ if (textbutton_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[textbutton_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
+
+ /* determine horizontal offset for leading text */
+ if (textbutton_info[i].text_left != NULL)
+ x += getTextWidthForGadget(textbutton_info[i].text_left);
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_CUSTOM_TYPE_ID, i,
+ GDI_INFO_TEXT, infotext,
+ GDI_X, x,
+ GDI_Y, y,
+ GDI_TYPE, GD_TYPE_TEXT_BUTTON,
+ GDI_TEXT_VALUE, textbutton_info[i].text,
+ GDI_TEXT_SIZE, textbutton_info[i].size,
+ GDI_TEXT_FONT, FONT_INPUT_2_ACTIVE,
+ GDI_TEXT_FONT_ACTIVE, FONT_INPUT_2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+ GDI_BORDER_SIZE, ED_BORDER_TEXT_XSIZE, ED_BORDER_SIZE,
+ GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+ GDI_DECORATION_SHIFTING, 1, 1,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
+ GDI_CALLBACK_ACTION, HandleTextbuttonGadgets,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, textbutton_info[i].text_right);
+ }
+}
+
+static void CreateGraphicbuttonGadgets()
+{
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ int i;
+
+ /* create buttons for scrolling of drawing area and element list */
+ for (i = 0; i < ED_NUM_GRAPHICBUTTONS; i++)
+ {
+ int id = graphicbutton_info[i].gadget_id;
+ int gd_x1, gd_x2, gd_y1, gd_y2;
+ int x = SX + graphicbutton_info[i].x;
+ int y = SY + graphicbutton_info[i].y;
+
+ event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
+
+ gd_x1 = DOOR_GFX_PAGEX4 + graphicbutton_info[i].gd_x;
+ gd_x2 = DOOR_GFX_PAGEX3 + graphicbutton_info[i].gd_x;
+ gd_y1 = DOOR_GFX_PAGEY1 + graphicbutton_info[i].gd_y;
+ gd_y2 = gd_y1;
+
+ /* determine horizontal position to the right of specified gadget */
+ if (graphicbutton_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[graphicbutton_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
+
+ /* determine horizontal offset for leading text */
+ if (graphicbutton_info[i].text_left != NULL)
+ x += getTextWidthForGadget(graphicbutton_info[i].text_left);
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_CUSTOM_TYPE_ID, i,
+ GDI_INFO_TEXT, graphicbutton_info[i].infotext,
+ GDI_X, x,
+ GDI_Y, y,
+ GDI_WIDTH, graphicbutton_info[i].width,
+ GDI_HEIGHT, graphicbutton_info[i].height,
+ GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
+ GDI_STATE, GD_BUTTON_UNPRESSED,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
+ GDI_CALLBACK_ACTION, HandleGraphicbuttonGadgets,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, graphicbutton_info[i].text_right);
+ }
+}
+
static void CreateScrollbarGadgets()
{
int i;
- for (i=0; i<ED_NUM_SCROLLBARS; i++)
+ for (i = 0; i < ED_NUM_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
- Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
if (i == ED_SCROLLBAR_ID_LIST_VERTICAL)
{
- items_max = elements_in_list / ED_ELEMENTLIST_BUTTONS_HORIZ;
+ items_max = num_editor_elements / ED_ELEMENTLIST_BUTTONS_HORIZ;
items_visible = ED_ELEMENTLIST_BUTTONS_VERT;
- item_position = 0;
+ item_position = element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ;
}
else /* drawing area scrollbars */
{
event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
- gd_x1 = DOOR_GFX_PAGEX8 + scrollbar_info[i].xpos;
+ gd_x1 = DOOR_GFX_PAGEX8 + scrollbar_info[i].gd_x;
gd_x2 = (gd_x1 - (scrollbar_info[i].type == GD_TYPE_SCROLLBAR_HORIZONTAL ?
scrollbar_info[i].height : scrollbar_info[i].width));
- gd_y1 = DOOR_GFX_PAGEY1 + scrollbar_info[i].ypos;
- gd_y2 = DOOR_GFX_PAGEY1 + scrollbar_info[i].ypos;
+ gd_y1 = DOOR_GFX_PAGEY1 + scrollbar_info[i].gd_y;
+ gd_y2 = DOOR_GFX_PAGEY1 + scrollbar_info[i].gd_y;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
- GDI_BORDER_SIZE, ED_BORDER_SIZE,
+ GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleControlButtons,
static void CreateCheckbuttonGadgets()
{
- Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
unsigned long event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
- boolean checked;
int i;
event_mask = GD_EVENT_PRESSED;
gd_x4 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_CHECKED_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_RADIOBUTTON_YPOS;
- for (i=0; i<ED_NUM_RADIOBUTTONS; i++)
+ for (i = 0; i < ED_NUM_CHECKBUTTONS; i++)
{
- int id = radiobutton_info[i].gadget_id;
+ int id = checkbutton_info[i].gadget_id;
+ int x = SX + checkbutton_info[i].x;
+ int y = SY + checkbutton_info[i].y;
- checked =
- (*radiobutton_info[i].value == radiobutton_info[i].checked_value);
+ if (id == GADGET_ID_STICK_ELEMENT)
+ gd_y = DOOR_GFX_PAGEY1 + ED_STICKYBUTTON_YPOS;
+ else
+ gd_y = DOOR_GFX_PAGEY1 + ED_CHECKBUTTON_YPOS;
+
+ /* determine horizontal position to the right of specified gadget */
+ if (checkbutton_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[checkbutton_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
+
+ /* determine horizontal offset for leading text */
+ if (checkbutton_info[i].text_left != NULL)
+ x += getTextWidthForGadget(checkbutton_info[i].text_left);
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
- GDI_INFO_TEXT, radiobutton_info[i].infotext,
- GDI_X, SX + radiobutton_info[i].x,
- GDI_Y, SY + radiobutton_info[i].y,
+ GDI_INFO_TEXT, checkbutton_info[i].infotext,
+ GDI_X, x,
+ GDI_Y, y,
GDI_WIDTH, ED_CHECKBUTTON_XSIZE,
GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
- GDI_TYPE, GD_TYPE_RADIO_BUTTON,
- GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
- GDI_CHECKED, checked,
+ GDI_TYPE, GD_TYPE_CHECK_BUTTON,
+ GDI_CHECKED, *checkbutton_info[i].value,
GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
- GDI_CALLBACK_ACTION, HandleRadiobuttons,
+ GDI_CALLBACK_ACTION, HandleCheckbuttons,
GDI_END);
if (gi == NULL)
Error(ERR_EXIT, "cannot create gadget");
level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, checkbutton_info[i].text_right);
}
+}
+
+static void CreateRadiobuttonGadgets()
+{
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ struct GadgetInfo *gi;
+ unsigned long event_mask;
+ int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
+ int i;
+
+ event_mask = GD_EVENT_PRESSED;
+
+ gd_x1 = DOOR_GFX_PAGEX4 + ED_CHECKBUTTON_UNCHECKED_XPOS;
+ gd_x2 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_UNCHECKED_XPOS;
+ gd_x3 = DOOR_GFX_PAGEX4 + ED_CHECKBUTTON_CHECKED_XPOS;
+ gd_x4 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_CHECKED_XPOS;
+ gd_y = DOOR_GFX_PAGEY1 + ED_RADIOBUTTON_YPOS;
- for (i=0; i<ED_NUM_CHECKBUTTONS; i++)
+ for (i = 0; i < ED_NUM_RADIOBUTTONS; i++)
{
- int id = checkbutton_info[i].gadget_id;
+ int id = radiobutton_info[i].gadget_id;
+ int x = SX + radiobutton_info[i].x;
+ int y = SY + radiobutton_info[i].y;
- if (id == GADGET_ID_STICK_ELEMENT)
- gd_y = DOOR_GFX_PAGEY1 + ED_STICKYBUTTON_YPOS;
- else
- gd_y = DOOR_GFX_PAGEY1 + ED_CHECKBUTTON_YPOS;
+ int checked =
+ (*radiobutton_info[i].value == radiobutton_info[i].checked_value);
+
+ /* determine horizontal position to the right of specified gadget */
+ if (radiobutton_info[i].gadget_id_align != GADGET_ID_NONE)
+ x = (right_gadget_border[radiobutton_info[i].gadget_id_align] +
+ ED_GADGET_TEXT_DISTANCE);
+
+ /* determine horizontal offset for leading text */
+ if (radiobutton_info[i].text_left != NULL)
+ x += getTextWidthForGadget(radiobutton_info[i].text_left);
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
- GDI_INFO_TEXT, checkbutton_info[i].infotext,
- GDI_X, SX + checkbutton_info[i].x,
- GDI_Y, SY + checkbutton_info[i].y,
+ GDI_INFO_TEXT, radiobutton_info[i].infotext,
+ GDI_X, x,
+ GDI_Y, y,
GDI_WIDTH, ED_CHECKBUTTON_XSIZE,
GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
- GDI_TYPE, GD_TYPE_CHECK_BUTTON,
- GDI_CHECKED, *checkbutton_info[i].value,
+ GDI_TYPE, GD_TYPE_RADIO_BUTTON,
+ GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
+ GDI_CHECKED, checked,
GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
- GDI_CALLBACK_ACTION, HandleCheckbuttons,
+ GDI_CALLBACK_ACTION, HandleRadiobuttons,
GDI_END);
if (gi == NULL)
Error(ERR_EXIT, "cannot create gadget");
level_editor_gadget[id] = gi;
+ right_gadget_border[id] =
+ getRightGadgetBorder(gi, radiobutton_info[i].text_right);
}
}
void CreateLevelEditorGadgets()
{
+ int old_game_status = game_status;
+
+ /* setting 'game_status' is needed to get the right fonts for the editor */
+ game_status = GAME_MODE_EDITOR;
+
+ ReinitializeElementList();
+
CreateControlButtons();
- CreateCounterButtons();
- CreateDrawingAreas();
- CreateTextInputGadgets();
CreateScrollbarGadgets();
+
+ /* order of function calls is important because of cross-references */
CreateCheckbuttonGadgets();
+ CreateCounterButtons();
+ CreateRadiobuttonGadgets();
+ CreateTextInputGadgets();
+ CreateTextAreaGadgets();
+ CreateSelectboxGadgets();
+ CreateGraphicbuttonGadgets();
+ CreateTextbuttonGadgets();
+ CreateDrawingAreas();
+
+ game_status = old_game_status;
+}
+
+void FreeLevelEditorGadgets()
+{
+ int i;
+
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
+ FreeGadget(level_editor_gadget[i]);
}
static void MapCounterButtons(int id)
{
- MapGadget(level_editor_gadget[counterbutton_info[id].gadget_id_down]);
- MapGadget(level_editor_gadget[counterbutton_info[id].gadget_id_text]);
- MapGadget(level_editor_gadget[counterbutton_info[id].gadget_id_up]);
+ int gadget_id_down = counterbutton_info[id].gadget_id_down;
+ int gadget_id_text = counterbutton_info[id].gadget_id_text;
+ int gadget_id_up = counterbutton_info[id].gadget_id_up;
+ struct GadgetInfo *gi_down = level_editor_gadget[gadget_id_down];
+ struct GadgetInfo *gi_text = level_editor_gadget[gadget_id_text];
+ struct GadgetInfo *gi_up = level_editor_gadget[gadget_id_up];
+#if 0
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ int max_infotext_len = getMaxInfoTextLength();
+ int xoffset_left = 0;
+ int yoffset_left = ED_BORDER_SIZE;
+ int xoffset_right = getCounterGadgetWidth();
+ int yoffset_right = ED_BORDER_SIZE;
+#else
+ int xoffset_left = getTextWidthForGadget(counterbutton_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset_above = MINI_TILEX + ED_GADGET_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi_down->x - xoffset_left;
+ int x_right = gi_up->x + gi_up->width + xoffset_right;
+ int y_above = gi_down->y - yoffset_above;
+ int x = gi_down->x;
+ int y; /* set after gadget position was modified */
+#endif
+
+ /* set position for "score" counter gadget */
+ if (id == ED_COUNTER_ID_ELEMENT_SCORE)
+ {
+ ModifyGadget(gi_down, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
+ ModifyGadget(gi_text, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
+ ModifyGadget(gi_up, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
+ }
+
+ y = gi_up->y + yoffset;
+
+ if (counterbutton_info[id].text_above)
+ DrawText(x, y_above, counterbutton_info[id].text_above, FONT_TEXT_1);
+
+ if (counterbutton_info[id].text_left)
+ DrawText(x_left, y, counterbutton_info[id].text_left, FONT_TEXT_1);
+
+ if (counterbutton_info[id].text_right)
+ DrawText(x_right, y, counterbutton_info[id].text_right, FONT_TEXT_1);
+
+ ModifyEditorCounter(id, *counterbutton_info[id].value);
+
+ MapGadget(gi_down);
+ MapGadget(gi_text);
+ MapGadget(gi_up);
}
static void MapControlButtons()
int counter_id;
int i;
- /* map toolbox buttons */
- for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
+ /* map toolbox buttons (excluding special CE toolbox buttons) */
+ for (i = 0; i < ED_NUM_CTRL1_2_BUTTONS; i++)
MapGadget(level_editor_gadget[i]);
/* map buttons to select elements */
- for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_UP]);
ModifyEditorCounterLimits(counter_id,
leveldir_current->first_level,
leveldir_current->last_level);
- ModifyEditorCounter(counter_id, *counterbutton_info[counter_id].value);
MapCounterButtons(counter_id);
}
static void MapDrawingArea(int id)
{
- MapGadget(level_editor_gadget[id]);
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
+ int area_xsize = gi->drawing.area_xsize;
+ int area_ysize = gi->drawing.area_ysize;
+ int xoffset_left= getTextWidthForDrawingArea(drawingarea_info[id].text_left);
+ int xoffset_below= getTextWidth(drawingarea_info[id].text_below,FONT_TEXT_1);
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + ED_DRAWINGAREA_TEXT_DISTANCE;
+ int x_below = gi->x + (gi->width - xoffset_below) / 2;
+ int y_side = gi->y + (gi->height - getFontHeight(FONT_TEXT_1)) / 2;
+ int y_below = gi->y + gi->height + ED_DRAWINGAREA_TEXT_DISTANCE;
+
+ if (drawingarea_info[id].text_left)
+ DrawText(x_left, y_side, drawingarea_info[id].text_left, FONT_TEXT_1);
+
+ if (drawingarea_info[id].text_right)
+ DrawText(x_right, y_side, drawingarea_info[id].text_right, FONT_TEXT_1);
+
+ if (drawingarea_info[id].text_below)
+ DrawText(x_below, y_below, drawingarea_info[id].text_below, FONT_TEXT_1);
+
+ if (id != ED_DRAWING_ID_DRAWING_LEVEL)
+ {
+ DrawElementBorder(gi->x, gi->y,
+ area_xsize * MINI_TILEX, area_ysize * MINI_TILEY, TRUE);
+
+ DrawDrawingArea(id);
+ }
+
+ MapGadget(gi);
}
static void MapTextInputGadget(int id)
{
- MapGadget(level_editor_gadget[textinput_info[id].gadget_id]);
+ struct GadgetInfo *gi = level_editor_gadget[textinput_info[id].gadget_id];
+ int xoffset_above = 0;
+ int yoffset_above = -(MINI_TILEX + ED_GADGET_DISTANCE);
+ int x_above = textinput_info[id].x + xoffset_above;
+ int y_above = textinput_info[id].y + yoffset_above;
+
+ if (textinput_info[id].text_above)
+ DrawTextS(x_above, y_above, FONT_TEXT_1, textinput_info[id].text_above);
+
+ ModifyGadget(gi, GDI_TEXT_VALUE, textinput_info[id].value, GDI_END);
+
+ MapGadget(gi);
+}
+
+static void MapTextAreaGadget(int id)
+{
+ struct GadgetInfo *gi = level_editor_gadget[textarea_info[id].gadget_id];
+ int xoffset_above = 0;
+ int yoffset_above = -(MINI_TILEX + ED_GADGET_DISTANCE);
+ int x_above = textarea_info[id].x + xoffset_above;
+ int y_above = textarea_info[id].y + yoffset_above;
+
+ if (textarea_info[id].text_above)
+ DrawTextS(x_above, y_above, FONT_TEXT_1, textarea_info[id].text_above);
+
+ ModifyGadget(gi, GDI_TEXT_VALUE, textarea_info[id].value, GDI_END);
+
+ MapGadget(gi);
+}
+
+static void MapSelectboxGadget(int id)
+{
+ struct GadgetInfo *gi = level_editor_gadget[selectbox_info[id].gadget_id];
+ int xoffset_left = getTextWidthForGadget(selectbox_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + xoffset_right;
+ int y = gi->y + yoffset;
+
+ if (selectbox_info[id].text_left)
+ DrawText(x_left, y, selectbox_info[id].text_left, FONT_TEXT_1);
+
+ if (selectbox_info[id].text_right)
+ DrawText(x_right, y, selectbox_info[id].text_right, FONT_TEXT_1);
+
+ ModifyEditorSelectbox(id, *selectbox_info[id].value);
+
+ MapGadget(gi);
+}
+
+static void MapTextbuttonGadget(int id)
+{
+ struct GadgetInfo *gi = level_editor_gadget[textbutton_info[id].gadget_id];
+ int xoffset_left = getTextWidthForGadget(textbutton_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + xoffset_right;
+ int y = gi->y + yoffset;
+
+ /* only show button to delete change pages when more than minimum pages */
+ if (id == ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE &&
+ custom_element.num_change_pages == MIN_CHANGE_PAGES)
+ return;
+
+ if (textbutton_info[id].text_left)
+ DrawText(x_left, y, textbutton_info[id].text_left, FONT_TEXT_1);
+
+ if (textbutton_info[id].text_right)
+ DrawText(x_right, y, textbutton_info[id].text_right, FONT_TEXT_1);
+
+ MapGadget(gi);
+}
+
+static void MapGraphicbuttonGadget(int id)
+{
+ struct GadgetInfo *gi= level_editor_gadget[graphicbutton_info[id].gadget_id];
+ int xoffset_left = getTextWidthForGadget(graphicbutton_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + xoffset_right;
+ int y = gi->y + yoffset;
+
+ if (graphicbutton_info[id].text_left)
+ DrawText(x_left, y, graphicbutton_info[id].text_left, FONT_TEXT_1);
+
+ if (graphicbutton_info[id].text_right)
+ DrawText(x_right, y, graphicbutton_info[id].text_right, FONT_TEXT_1);
+
+ MapGadget(gi);
}
static void MapRadiobuttonGadget(int id)
{
- MapGadget(level_editor_gadget[radiobutton_info[id].gadget_id]);
+ struct GadgetInfo *gi = level_editor_gadget[radiobutton_info[id].gadget_id];
+ int xoffset_left = getTextWidthForGadget(checkbutton_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + xoffset_right;
+ int y = gi->y + yoffset;
+ boolean checked =
+ (*radiobutton_info[id].value == radiobutton_info[id].checked_value);
+
+ if (radiobutton_info[id].text_left)
+ DrawText(x_left, y, radiobutton_info[id].text_left, FONT_TEXT_1);
+
+ if (radiobutton_info[id].text_right)
+ DrawText(x_right, y, radiobutton_info[id].text_right, FONT_TEXT_1);
+
+ ModifyGadget(gi, GDI_CHECKED, checked, GDI_END);
+
+ MapGadget(gi);
}
static void MapCheckbuttonGadget(int id)
{
- MapGadget(level_editor_gadget[checkbutton_info[id].gadget_id]);
+ struct GadgetInfo *gi = level_editor_gadget[checkbutton_info[id].gadget_id];
+ int xoffset_left = getTextWidthForGadget(checkbutton_info[id].text_left);
+ int xoffset_right = ED_GADGET_TEXT_DISTANCE;
+ int yoffset = ED_BORDER_SIZE;
+ int x_left = gi->x - xoffset_left;
+ int x_right = gi->x + gi->width + xoffset_right;
+ int y; /* set after gadget position was modified */
+
+ /* set position for "stickybutton" and "can move into acid" gadgets */
+ if (id == ED_CHECKBUTTON_ID_STICK_ELEMENT ||
+ id == ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID)
+ ModifyGadget(gi, GDI_Y, SY + checkbutton_info[id].y, GDI_END);
+
+ y = gi->y + yoffset;
+
+ if (checkbutton_info[id].text_left)
+ DrawText(x_left, y, checkbutton_info[id].text_left, FONT_TEXT_1);
+
+ if (checkbutton_info[id].text_right)
+ DrawText(x_right, y, checkbutton_info[id].text_right, FONT_TEXT_1);
+
+ ModifyGadget(gi, GDI_CHECKED, *checkbutton_info[id].value, GDI_END);
+
+ MapGadget(gi);
}
static void MapMainDrawingArea()
boolean no_vertical_scrollbar = (lev_fieldy + 2 <= ed_fieldy);
int i;
- for (i=ED_SCROLLBUTTON_ID_AREA_FIRST; i<=ED_SCROLLBUTTON_ID_AREA_LAST; i++)
+ for (i=ED_SCROLLBUTTON_ID_AREA_FIRST; i <= ED_SCROLLBUTTON_ID_AREA_LAST; i++)
{
if (((i == ED_SCROLLBUTTON_ID_AREA_LEFT ||
i == ED_SCROLLBUTTON_ID_AREA_RIGHT) &&
MapGadget(level_editor_gadget[scrollbutton_info[i].gadget_id]);
}
- for (i=ED_SCROLLBAR_ID_AREA_FIRST; i<=ED_SCROLLBAR_ID_AREA_LAST; i++)
+ for (i = ED_SCROLLBAR_ID_AREA_FIRST; i <= ED_SCROLLBAR_ID_AREA_LAST; i++)
{
if ((i == ED_SCROLLBAR_ID_AREA_HORIZONTAL && no_horizontal_scrollbar) ||
(i == ED_SCROLLBAR_ID_AREA_VERTICAL && no_vertical_scrollbar))
MapGadget(level_editor_gadget[scrollbar_info[i].gadget_id]);
}
- MapDrawingArea(GADGET_ID_DRAWING_LEVEL);
+ MapDrawingArea(ED_DRAWING_ID_DRAWING_LEVEL);
+}
+
+static void MapOrUnmapLevelEditorToolboxCustomGadgets(boolean map)
+{
+ int i;
+
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
+ {
+ if (i == GADGET_ID_CUSTOM_COPY_FROM ||
+ i == GADGET_ID_CUSTOM_COPY_TO ||
+ i == GADGET_ID_CUSTOM_EXCHANGE)
+ {
+ if (map)
+ MapGadget(level_editor_gadget[i]);
+ else
+ UnmapGadget(level_editor_gadget[i]);
+ }
+ }
+}
+
+static void MapLevelEditorToolboxCustomGadgets()
+{
+ MapOrUnmapLevelEditorToolboxCustomGadgets(TRUE);
+}
+
+static void UnmapLevelEditorToolboxCustomGadgets()
+{
+ MapOrUnmapLevelEditorToolboxCustomGadgets(FALSE);
+}
+
+static void MapOrUnmapLevelEditorToolboxDrawingGadgets(boolean map)
+{
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ int i;
+
+ for (i = 0; i < ED_NUM_CTRL1_BUTTONS; i++)
+ {
+ if (i != GADGET_ID_SINGLE_ITEMS &&
+ i != GADGET_ID_PROPERTIES &&
+ i != GADGET_ID_PICK_ELEMENT)
+ {
+ struct GadgetInfo *gi = level_editor_gadget[i];
+
+ if (map)
+ MapGadget(gi);
+ else
+ {
+ UnmapGadget(gi);
+
+ BlitBitmap(gd_bitmap, drawto,
+ DOOR_GFX_PAGEX6 + ED_CTRL_NO_BUTTONS_GFX_XPOS,
+ DOOR_GFX_PAGEY1 + ED_CTRL_NO_BUTTONS_GFX_YPOS,
+ gi->width, gi->height, gi->x, gi->y);
+
+ redraw_mask |= REDRAW_DOOR_3;
+ }
+ }
+ }
+}
+
+static void MapLevelEditorToolboxDrawingGadgets()
+{
+ MapOrUnmapLevelEditorToolboxDrawingGadgets(TRUE);
+}
+
+static void UnmapLevelEditorToolboxDrawingGadgets()
+{
+ MapOrUnmapLevelEditorToolboxDrawingGadgets(FALSE);
}
static void UnmapDrawingArea(int id)
{
- UnmapGadget(level_editor_gadget[id]);
+ UnmapGadget(level_editor_gadget[drawingarea_info[id].gadget_id]);
}
-void UnmapLevelEditorWindowGadgets()
+static void UnmapLevelEditorWindowGadgets()
{
int i;
- for (i=0; i<NUM_EDITOR_GADGETS; i++)
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
if (level_editor_gadget[i]->x < SX + SXSIZE)
UnmapGadget(level_editor_gadget[i]);
}
{
int i;
- for (i=0; i<NUM_EDITOR_GADGETS; i++)
+ for (i = 0; i < NUM_EDITOR_GADGETS; i++)
UnmapGadget(level_editor_gadget[i]);
}
static void DrawEditModeWindow()
{
+ ModifyEditorElementList();
+ RedrawDrawingElements();
+
if (edit_mode == ED_MODE_INFO)
DrawLevelInfoWindow();
else if (edit_mode == ED_MODE_PROPERTIES)
boolean level_changed = FALSE;
int x, y;
- for(y=0; y<lev_fieldy; y++)
- for(x=0; x<lev_fieldx; x++)
- if (Feld[x][y] != Ur[x][y])
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ if (Feld[x][y] != level.field[x][y])
level_changed = TRUE;
return level_changed;
boolean player_found = FALSE;
int x, y;
- for(y=0; y<lev_fieldy; y++)
- for(x=0; x<lev_fieldx; x++)
- if (Feld[x][y] == EL_SPIELFIGUR ||
- Feld[x][y] == EL_SPIELER1 ||
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ if (Feld[x][y] == EL_PLAYER_1 ||
Feld[x][y] == EL_SP_MURPHY)
player_found = TRUE;
return player_found;
}
+static void CopyPlayfield(short src[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
+ short dst[MAX_LEV_FIELDX][MAX_LEV_FIELDY])
+{
+ int x, y;
+
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
+ dst[x][y] = src[x][y];
+}
+
+static int setSelectboxValue(int selectbox_id, int new_value)
+{
+ int new_index_value = 0;
+ int i;
+
+ for (i = 0; selectbox_info[selectbox_id].options[i].text != NULL; i++)
+ if (selectbox_info[selectbox_id].options[i].value == new_value)
+ new_index_value = i;
+
+ *selectbox_info[selectbox_id].value =
+ selectbox_info[selectbox_id].options[new_index_value].value;
+
+ return new_index_value;
+}
+
+static void copy_custom_element_settings(int element_from, int element_to)
+{
+#if 1
+ struct ElementInfo ei_to_old = element_info[element_to];
+ struct ElementInfo *ei_from = &element_info[element_from];
+ struct ElementInfo *ei_to = &element_info[element_to];
+ int i;
+
+ /* ---------- copy whole element structure ---------- */
+ *ei_to = *ei_from;
+
+ /* ---------- restore structure pointers which cannot be copied ---------- */
+ ei_to->token_name = ei_to_old.token_name;
+ ei_to->class_name = ei_to_old.class_name;
+ ei_to->editor_description = ei_to_old.editor_description;
+ ei_to->custom_description = ei_to_old.custom_description;
+ ei_to->change_page = ei_to_old.change_page;
+ ei_to->change = ei_to_old.change;
+ ei_to->group = ei_to_old.group;
+
+ /* ---------- copy element base properties ---------- */
+ Properties[element_to][EP_BITFIELD_BASE] =
+ Properties[element_from][EP_BITFIELD_BASE];
+
+ /* ---------- reinitialize and copy change pages ---------- */
+ setElementChangePages(ei_to, ei_to->num_change_pages);
+
+ for (i=0; i < ei_to->num_change_pages; i++)
+ ei_to->change_page[i] = ei_from->change_page[i];
+
+ /* ---------- copy group element info ---------- */
+ if (ei_from->group != NULL && ei_to->group != NULL) /* group or internal */
+ *ei_to->group = *ei_from->group;
+
+#else
+
+ struct ElementInfo *ei_from = &element_info[element_from];
+ struct ElementInfo *ei_to = &element_info[element_to];
+ int i, x, y;
+
+ /* ---------- copy element description ---------- */
+ for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
+ ei_to->description[i] = ei_from->description[i];
+
+ /* ---------- copy element properties ---------- */
+ Properties[element_to][EP_BITFIELD_BASE] =
+ Properties[element_from][EP_BITFIELD_BASE];
+
+ /* ---------- copy custom property values ---------- */
+
+ ei_to->use_gfx_element = ei_from->use_gfx_element;
+ ei_to->gfx_element = ei_from->gfx_element;
+
+ ei_to->collect_score = ei_from->collect_score;
+ ei_to->collect_count = ei_from->collect_count;
+
+ ei_to->push_delay_fixed = ei_from->push_delay_fixed;
+ ei_to->push_delay_random = ei_from->push_delay_random;
+ ei_to->move_delay_fixed = ei_from->move_delay_fixed;
+ ei_to->move_delay_random = ei_from->move_delay_random;
+
+ ei_to->move_pattern = ei_from->move_pattern;
+ ei_to->move_direction_initial = ei_from->move_direction_initial;
+ ei_to->move_stepsize = ei_from->move_stepsize;
+
+ ei_to->slippery_type = ei_from->slippery_type;
+
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ ei_to->content[x][y] = ei_from->content[x][y];
+
+ ei_to->num_change_pages = ei_from->num_change_pages;
+ setElementChangePages(ei_to, ei_to->num_change_pages);
+
+ for (i=0; i < ei_to->num_change_pages; i++)
+ {
+ struct ElementChangeInfo *change_to = &ei_to->change_page[i];
+ struct ElementChangeInfo *change_from = &ei_from->change_page[i];
+
+ /* always start with reliable default values */
+ setElementChangeInfoToDefaults(change_to);
+
+ change_to->events = change_from->events;
+
+ change_to->target_element = change_from->target_element;
+
+ change_to->delay_fixed = change_from->delay_fixed;
+ change_to->delay_random = change_from->delay_random;
+ change_to->delay_frames = change_from->delay_frames;
+
+ change_to->trigger_element = change_from->trigger_element;
+
+ change_to->explode = change_from->explode;
+ change_to->use_content = change_from->use_content;
+ change_to->only_complete = change_from->only_complete;
+ change_to->use_random_change = change_from->use_random_change;
+
+ change_to->random = change_from->random;
+ change_to->power = change_from->power;
+
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ change_to->content[x][y] = change_from->content[x][y];
+
+ change_to->can_change = change_from->can_change;
+
+ change_to->sides = change_from->sides;
+ }
+#endif
+
+ /* mark this custom element as modified */
+ ei_to->modified_settings = TRUE;
+}
+
+static void replace_custom_element_in_settings(int element_from,
+ int element_to)
+{
+ int i, j, x, y;
+
+ for (i = 0; i < NUM_FILE_ELEMENTS; i++)
+ {
+ struct ElementInfo *ei = &element_info[i];
+
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ if (ei->content[x][y] == element_from)
+ ei->content[x][y] = element_to;
+
+ for (j = 0; j < ei->num_change_pages; j++)
+ {
+ struct ElementChangeInfo *change = &ei->change_page[j];
+
+ if (change->target_element == element_from)
+ change->target_element = element_to;
+
+ if (change->trigger_element == element_from)
+ change->trigger_element = element_to;
+
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ if (change->content[x][y] == element_from)
+ change->content[x][y] = element_to;
+ }
+
+ if (ei->group != NULL) /* group or internal */
+ for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
+ if (ei->group->element[j] == element_from)
+ ei->group->element[j] = element_to;
+ }
+}
+
+static void replace_custom_element_in_playfield(int element_from,
+ int element_to)
+{
+ int x, y;
+
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
+ if (Feld[x][y] == element_from)
+ Feld[x][y] = element_to;
+}
+
+static boolean CopyCustomElement(int element_old, int element_new,
+ int copy_mode)
+{
+ if (IS_CUSTOM_ELEMENT(element_old) && !IS_CUSTOM_ELEMENT(element_new))
+ {
+ Request("Please choose custom element !", REQ_CONFIRM);
+
+ return FALSE;
+ }
+ else if (IS_GROUP_ELEMENT(element_old) && !IS_GROUP_ELEMENT(element_new))
+ {
+ Request("Please choose group element !", REQ_CONFIRM);
+
+ return FALSE;
+ }
+
+ if (copy_mode == GADGET_ID_CUSTOM_COPY_FROM)
+ {
+ copy_custom_element_settings(element_new, element_old);
+ }
+ else if (copy_mode == GADGET_ID_CUSTOM_COPY_TO)
+ {
+ copy_custom_element_settings(element_old, element_new);
+ }
+ else if (copy_mode == GADGET_ID_CUSTOM_EXCHANGE)
+ {
+ copy_custom_element_settings(element_old, EL_INTERNAL_EDITOR);
+ copy_custom_element_settings(element_new, element_old);
+ copy_custom_element_settings(EL_INTERNAL_EDITOR, element_new);
+
+ replace_custom_element_in_settings(element_old, EL_INTERNAL_EDITOR);
+ replace_custom_element_in_settings(element_new, element_old);
+ replace_custom_element_in_settings(EL_INTERNAL_EDITOR, element_new);
+
+ replace_custom_element_in_playfield(element_old, EL_INTERNAL_EDITOR);
+ replace_custom_element_in_playfield(element_new, element_old);
+ replace_custom_element_in_playfield(EL_INTERNAL_EDITOR, element_new);
+ }
+
+ UpdateCustomElementGraphicGadgets();
+ DrawPropertiesWindow();
+
+ return TRUE;
+}
+
+static void CopyCustomElementPropertiesToEditor(int element)
+{
+ int i;
+ int current_change_page = element_info[element].current_change_page;
+
+ /* dynamically (re)build selectbox for selecting change page */
+ for (i = 0; i < element_info[element].num_change_pages; i++)
+ {
+ sprintf(options_change_page_strings[i], "%d", i + 1);
+
+ options_change_page[i].value = i;
+ options_change_page[i].text = options_change_page_strings[i];
+ }
+
+ options_change_page[i].value = -1;
+ options_change_page[i].text = NULL;
+
+ /* needed here to initialize combined element properties */
+ InitElementPropertiesEngine(level.game_version);
+
+ element_info[element].change =
+ &element_info[element].change_page[current_change_page];
+
+ custom_element = element_info[element];
+ custom_element_change = *element_info[element].change;
+
+ /* needed to initially set selectbox value variables to reliable defaults */
+ for (i = 0; i < ED_NUM_SELECTBOX; i++)
+ setSelectboxValue(i, *selectbox_info[i].value);
+
+ for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
+ custom_element_properties[i] = HAS_PROPERTY(element, i);
+
+ for (i = 0; i < NUM_CHANGE_EVENTS; i++)
+ custom_element_change_events[i] = HAS_CHANGE_EVENT(element, i);
+
+ /* ---------- element settings: configure (custom elements) ------------- */
+
+ /* set accessible layer selectbox help value */
+ custom_element.access_type =
+ (IS_WALKABLE(element) ? EP_WALKABLE :
+ IS_PASSABLE(element) ? EP_PASSABLE :
+ custom_element.access_type);
+ custom_element.access_layer =
+ (IS_ACCESSIBLE_OVER(element) ? EP_ACCESSIBLE_OVER :
+ IS_ACCESSIBLE_INSIDE(element) ? EP_ACCESSIBLE_INSIDE :
+ IS_ACCESSIBLE_UNDER(element) ? EP_ACCESSIBLE_UNDER :
+ custom_element.access_layer);
+ custom_element.access_protected =
+ (IS_PROTECTED(element) ? 1 : 0);
+ custom_element_properties[EP_ACCESSIBLE] =
+ (IS_ACCESSIBLE_OVER(element) ||
+ IS_ACCESSIBLE_INSIDE(element) ||
+ IS_ACCESSIBLE_UNDER(element));
+
+ /* set walk-to-object action selectbox help value */
+ custom_element.walk_to_action =
+ (IS_DIGGABLE(element) ? EP_DIGGABLE :
+ IS_COLLECTIBLE_ONLY(element) ? EP_COLLECTIBLE_ONLY :
+ IS_DROPPABLE(element) ? EP_DROPPABLE :
+ IS_PUSHABLE(element) ? EP_PUSHABLE :
+ custom_element.walk_to_action);
+ custom_element_properties[EP_WALK_TO_OBJECT] =
+ (IS_DIGGABLE(element) ||
+ IS_COLLECTIBLE_ONLY(element) ||
+ IS_DROPPABLE(element) ||
+ IS_PUSHABLE(element));
+
+ /* set smash targets selectbox help value */
+ custom_element.smash_targets =
+ (CAN_SMASH_EVERYTHING(element) ? EP_CAN_SMASH_EVERYTHING :
+ CAN_SMASH_ENEMIES(element) ? EP_CAN_SMASH_ENEMIES :
+ CAN_SMASH_PLAYER(element) ? EP_CAN_SMASH_PLAYER :
+ custom_element.smash_targets);
+ custom_element_properties[EP_CAN_SMASH] =
+ (CAN_SMASH_EVERYTHING(element) ||
+ CAN_SMASH_ENEMIES(element) ||
+ CAN_SMASH_PLAYER(element));
+
+ /* set deadliness selectbox help value */
+ custom_element.deadliness =
+ (DONT_TOUCH(element) ? EP_DONT_TOUCH :
+ DONT_COLLIDE_WITH(element) ? EP_DONT_COLLIDE_WITH :
+ DONT_RUN_INTO(element) ? EP_DONT_RUN_INTO :
+ custom_element.deadliness);
+ custom_element_properties[EP_DEADLY] =
+ (DONT_TOUCH(element) ||
+ DONT_COLLIDE_WITH(element) ||
+ DONT_RUN_INTO(element));
+
+ /* set consistency selectbox help value */
+ custom_element.consistency =
+ (IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE :
+ CAN_EXPLODE_1X1(element) ? EP_CAN_EXPLODE_1X1 :
+ CAN_EXPLODE_3X3(element) ? EP_CAN_EXPLODE_3X3 :
+ CAN_EXPLODE_DYNA(element) ? EP_CAN_EXPLODE_DYNA :
+ custom_element.consistency);
+ custom_element_properties[EP_EXPLODE_RESULT] =
+ (IS_INDESTRUCTIBLE(element) ||
+ CAN_EXPLODE_1X1(element) ||
+ CAN_EXPLODE_3X3(element) ||
+ CAN_EXPLODE_DYNA(element));
+
+ /* special case: sub-settings dependent from main setting */
+ if (CAN_EXPLODE_BY_FIRE(element))
+ custom_element.can_explode_by_fire = TRUE;
+ if (CAN_EXPLODE_SMASHED(element))
+ custom_element.can_explode_smashed = TRUE;
+ if (CAN_EXPLODE_IMPACT(element))
+ custom_element.can_explode_impact = TRUE;
+
+ /* ---------- element settings: advanced (custom elements) --------------- */
+
+ /* set "change by direct action" selectbox help value */
+ custom_element_change.direct_action =
+ (HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_ENTERED_BY_PLAYER) ? CE_ENTERED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_DROPPED_BY_PLAYER) ? CE_DROPPED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_SWITCHED) ? CE_SWITCHED :
+ HAS_CHANGE_EVENT(element, CE_HITTING_SOMETHING) ? CE_HITTING_SOMETHING :
+ HAS_CHANGE_EVENT(element, CE_HIT_BY_SOMETHING) ? CE_HIT_BY_SOMETHING :
+ HAS_CHANGE_EVENT(element, CE_IMPACT) ? CE_IMPACT :
+ HAS_CHANGE_EVENT(element, CE_SMASHED) ? CE_SMASHED :
+ custom_element_change.direct_action);
+
+ /* set "change by other element action" selectbox help value */
+ custom_element_change.other_action =
+ (HAS_CHANGE_EVENT(element, CE_OTHER_GETS_TOUCHED) ? CE_OTHER_GETS_TOUCHED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PRESSED) ? CE_OTHER_GETS_PRESSED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PUSHED) ? CE_OTHER_GETS_PUSHED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_ENTERED) ? CE_OTHER_GETS_ENTERED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_LEFT) ? CE_OTHER_GETS_LEFT :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DIGGED) ? CE_OTHER_GETS_DIGGED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_COLLECTED) ? CE_OTHER_GETS_COLLECTED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DROPPED) ? CE_OTHER_GETS_DROPPED :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_TOUCHING) ? CE_OTHER_IS_TOUCHING :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_HITTING) ? CE_OTHER_IS_HITTING :
+ HAS_CHANGE_EVENT(element, CE_OTHER_GETS_HIT) ? CE_OTHER_GETS_HIT :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_SWITCHING) ? CE_OTHER_IS_SWITCHING :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_CHANGING) ? CE_OTHER_IS_CHANGING :
+ HAS_CHANGE_EVENT(element, CE_OTHER_IS_EXPLODING) ? CE_OTHER_IS_EXPLODING :
+ custom_element_change.other_action);
+}
+
+static void CopyGroupElementPropertiesToEditor(int element)
+{
+ group_element_info = *element_info[element].group;
+ custom_element = element_info[element]; /* needed for description */
+}
+
+static void CopyClassicElementPropertiesToEditor(int element)
+{
+#if 1
+ if (COULD_MOVE_INTO_ACID(element))
+ custom_element_properties[EP_CAN_MOVE_INTO_ACID] =
+ getMoveIntoAcidProperty(&level, element);
+
+#else
+
+ if (COULD_MOVE_INTO_ACID(element))
+ {
+ int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
+
+ if (bit_nr > -1)
+ custom_element_properties[EP_CAN_MOVE_INTO_ACID] =
+ ((level.can_move_into_acid & (1 << bit_nr)) != 0);
+ }
+#endif
+}
+
+static void CopyElementPropertiesToEditor(int element)
+{
+ if (IS_CUSTOM_ELEMENT(element))
+ CopyCustomElementPropertiesToEditor(element);
+ else if (IS_GROUP_ELEMENT(element))
+ CopyGroupElementPropertiesToEditor(element);
+ else
+ CopyClassicElementPropertiesToEditor(element);
+}
+
+static void CopyCustomElementPropertiesToGame(int element)
+{
+ int i;
+ int access_type_and_layer;
+
+ /* mark that this custom element has been modified */
+ custom_element.modified_settings = TRUE;
+
+ if (level.use_custom_template)
+ {
+ if (Request("Copy and modify level template ?", REQ_ASK))
+ {
+ level.use_custom_template = FALSE;
+ ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE],
+ GDI_CHECKED, FALSE, GDI_END);
+ }
+ else
+ {
+ LoadLevelTemplate(-1); /* this resets all element modifications ... */
+
+ DrawEditModeWindow(); /* ... and copies them to 'custom_element' */
+ }
+ }
+
+ element_info[element] = custom_element;
+ *element_info[element].change = custom_element_change;
+
+ /* ---------- element settings: configure (custom elements) ------------- */
+
+ /* set accessible property from checkbox and selectbox */
+ custom_element_properties[EP_WALKABLE_OVER] = FALSE;
+ custom_element_properties[EP_WALKABLE_INSIDE] = FALSE;
+ custom_element_properties[EP_WALKABLE_UNDER] = FALSE;
+ custom_element_properties[EP_PASSABLE_OVER] = FALSE;
+ custom_element_properties[EP_PASSABLE_INSIDE] = FALSE;
+ custom_element_properties[EP_PASSABLE_UNDER] = FALSE;
+ access_type_and_layer = ((custom_element.access_type == EP_WALKABLE ?
+ EP_WALKABLE_OVER : EP_PASSABLE_OVER) +
+ (custom_element.access_layer - EP_ACCESSIBLE_OVER));
+ custom_element_properties[access_type_and_layer] =
+ custom_element_properties[EP_ACCESSIBLE];
+ custom_element_properties[EP_PROTECTED] =
+ (custom_element.access_protected != 0 &&
+ custom_element_properties[EP_ACCESSIBLE]);
+
+ /* set walk-to-object property from checkbox and selectbox */
+ custom_element_properties[EP_DIGGABLE] = FALSE;
+ custom_element_properties[EP_COLLECTIBLE_ONLY] = FALSE;
+ custom_element_properties[EP_DROPPABLE] = FALSE;
+ custom_element_properties[EP_PUSHABLE] = FALSE;
+ custom_element_properties[custom_element.walk_to_action] =
+ custom_element_properties[EP_WALK_TO_OBJECT];
+
+ /* set smash property from checkbox and selectbox */
+ custom_element_properties[EP_CAN_SMASH_PLAYER] = FALSE;
+ custom_element_properties[EP_CAN_SMASH_ENEMIES] = FALSE;
+ custom_element_properties[EP_CAN_SMASH_EVERYTHING] = FALSE;
+ custom_element_properties[custom_element.smash_targets] =
+ custom_element_properties[EP_CAN_SMASH];
+
+ /* set deadliness property from checkbox and selectbox */
+ custom_element_properties[EP_DONT_RUN_INTO] = FALSE;
+ custom_element_properties[EP_DONT_COLLIDE_WITH] = FALSE;
+ custom_element_properties[EP_DONT_TOUCH] = FALSE;
+ custom_element_properties[custom_element.deadliness] =
+ custom_element_properties[EP_DEADLY];
+
+ /* set consistency property from checkbox and selectbox */
+ custom_element_properties[EP_INDESTRUCTIBLE] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_1X1] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_3X3] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_DYNA] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_SMASHED] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_IMPACT] = FALSE;
+ custom_element_properties[custom_element.consistency] =
+ custom_element_properties[EP_EXPLODE_RESULT];
+
+ /* special case: sub-settings dependent from main setting */
+ if (custom_element_properties[EP_CAN_EXPLODE_1X1] ||
+ custom_element_properties[EP_CAN_EXPLODE_3X3] ||
+ custom_element_properties[EP_CAN_EXPLODE_DYNA])
+ {
+ custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] =
+ custom_element.can_explode_by_fire;
+ custom_element_properties[EP_CAN_EXPLODE_SMASHED] =
+ custom_element.can_explode_smashed;
+ custom_element_properties[EP_CAN_EXPLODE_IMPACT] =
+ custom_element.can_explode_impact;
+ }
+
+ /* ---------- element settings: advanced (custom elements) --------------- */
+
+ /* set player change event from checkbox and selectbox */
+ custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_PUSHED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_DROPPED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_SWITCHED] = FALSE;
+ custom_element_change_events[CE_HITTING_SOMETHING] = FALSE;
+ custom_element_change_events[CE_HIT_BY_SOMETHING] = FALSE;
+ custom_element_change_events[CE_IMPACT] = FALSE;
+ custom_element_change_events[CE_SMASHED] = FALSE;
+ custom_element_change_events[custom_element_change.direct_action] =
+ custom_element_change_events[CE_BY_DIRECT_ACTION];
+
+ /* set other element action change event from checkbox and selectbox */
+ custom_element_change_events[CE_OTHER_GETS_TOUCHED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_PRESSED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_PUSHED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_ENTERED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_LEFT] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_DIGGED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_COLLECTED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_DROPPED] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_TOUCHING] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_HITTING] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_HIT] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_SWITCHING] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_CHANGING] = FALSE;
+ custom_element_change_events[CE_OTHER_IS_EXPLODING] = FALSE;
+ custom_element_change_events[custom_element_change.other_action] =
+ custom_element_change_events[CE_BY_OTHER_ACTION];
+
+ for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
+ SET_PROPERTY(element, i, custom_element_properties[i]);
+
+ for (i = 0; i < NUM_CHANGE_EVENTS; i++)
+ SET_CHANGE_EVENT(element, i, custom_element_change_events[i]);
+
+ /* copy change events also to special level editor variable */
+ custom_element = element_info[element];
+ custom_element_change = *element_info[element].change;
+}
+
+static void CopyGroupElementPropertiesToGame(int element)
+{
+ element_info[element] = custom_element;
+ *element_info[element].group = group_element_info;
+
+ /* mark that this group element has been modified */
+ element_info[element].modified_settings = TRUE;
+}
+
+static void CopyClassicElementPropertiesToGame(int element)
+{
+#if 1
+ if (COULD_MOVE_INTO_ACID(element))
+ setMoveIntoAcidProperty(&level, element,
+ custom_element_properties[EP_CAN_MOVE_INTO_ACID]);
+
+#else
+
+ if (COULD_MOVE_INTO_ACID(element))
+ {
+ int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
+
+ if (bit_nr > -1)
+ {
+ level.can_move_into_acid &= ~(1 << bit_nr);
+
+ if (custom_element_properties[EP_CAN_MOVE_INTO_ACID])
+ level.can_move_into_acid |= (1 << bit_nr);
+ }
+ }
+#endif
+}
+
+static void CopyElementPropertiesToGame(int element)
+{
+ if (IS_CUSTOM_ELEMENT(element))
+ CopyCustomElementPropertiesToGame(element);
+ else if (IS_GROUP_ELEMENT(element))
+ CopyGroupElementPropertiesToGame(element);
+ else
+ CopyClassicElementPropertiesToGame(element);
+}
+
void DrawLevelEd()
{
CloseDoor(DOOR_CLOSE_ALL);
if (level_editor_test_game)
{
- int x, y;
-
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
- Feld[x][y] = Ur[x][y];
-
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
- Ur[x][y] = FieldBackup[x][y];
+ CopyPlayfield(level.field, Feld);
+ CopyPlayfield(FieldBackup, level.field);
level_editor_test_game = FALSE;
}
else
{
edit_mode = ED_MODE_DRAWING;
+ edit_mode_properties = ED_MODE_PROPERTIES_INFO;
ResetUndoBuffer();
+
level_xpos = -1;
level_ypos = -1;
}
/* copy default editor door content to main double buffer */
- BlitBitmap(pix[PIX_DOOR], drawto,
+ BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#if 0
/* draw mouse button brush elements */
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
- el2gfx(new_element1));
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
- el2gfx(new_element2));
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
- el2gfx(new_element3));
+ RedrawDrawingElements();
+#endif
/* draw bigger door */
DrawSpecialEditorDoor();
/* draw new control window */
- BlitBitmap(pix[PIX_DOOR], drawto,
+ BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
redraw_mask |= REDRAW_ALL;
- MapControlButtons();
+ ReinitializeElementListButtons(); /* only needed after setup changes */
+#if 0
+ ModifyEditorElementList(); /* may be needed for custom elements */
+#endif
- /* copy actual editor door content to door double buffer for OpenDoor() */
- BlitBitmap(drawto, pix[PIX_DB_DOOR],
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ UnmapTapeButtons();
+ MapControlButtons();
DrawEditModeWindow();
- /*
- FadeToFront();
- */
-
+ /* copy actual editor door content to door double buffer for OpenDoor() */
+ BlitBitmap(drawto, bitmap_db_door,
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_1);
-
- /*
- OpenDoor(DOOR_OPEN_1 | DOOR_OPEN_2);
- */
}
static void AdjustDrawingAreaGadgets()
GDI_END);
}
-static void AdjustLevelScrollPosition()
+static void AdjustLevelScrollPosition()
+{
+ if (level_xpos < -1)
+ level_xpos = -1;
+ if (level_xpos > lev_fieldx - ed_fieldx + 1)
+ level_xpos = lev_fieldx - ed_fieldx + 1;
+ if (lev_fieldx < ed_fieldx - 2)
+ level_xpos = -1;
+
+ if (level_ypos < -1)
+ level_ypos = -1;
+ if (level_ypos > lev_fieldy - ed_fieldy + 1)
+ level_ypos = lev_fieldy - ed_fieldy + 1;
+ if (lev_fieldy < ed_fieldy - 2)
+ level_ypos = -1;
+}
+
+static void AdjustEditorScrollbar(int id)
+{
+ struct GadgetInfo *gi = level_editor_gadget[id];
+ int items_max, items_visible, item_position;
+
+ if (id == GADGET_ID_SCROLL_HORIZONTAL)
+ {
+ items_max = MAX(lev_fieldx + 2, ed_fieldx);
+ items_visible = ed_fieldx;
+ item_position = level_xpos + 1;
+ }
+ else
+ {
+ items_max = MAX(lev_fieldy + 2, ed_fieldy);
+ items_visible = ed_fieldy;
+ item_position = level_ypos + 1;
+ }
+
+ if (item_position > items_max - items_visible)
+ item_position = items_max - items_visible;
+
+ ModifyGadget(gi, GDI_SCROLLBAR_ITEMS_MAX, items_max,
+ GDI_SCROLLBAR_ITEM_POSITION, item_position, GDI_END);
+}
+
+static void ModifyEditorCounter(int counter_id, int new_value)
+{
+ int *counter_value = counterbutton_info[counter_id].value;
+ int gadget_id = counterbutton_info[counter_id].gadget_id_text;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+
+ ModifyGadget(gi, GDI_NUMBER_VALUE, new_value, GDI_END);
+
+ if (counter_value != NULL)
+ *counter_value = gi->textinput.number_value;
+}
+
+static void ModifyEditorCounterLimits(int counter_id, int min, int max)
+{
+ int gadget_id = counterbutton_info[counter_id].gadget_id_text;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+
+ ModifyGadget(gi, GDI_NUMBER_MIN, min, GDI_NUMBER_MAX, max, GDI_END);
+}
+
+static void ModifyEditorSelectbox(int selectbox_id, int new_value)
+{
+ int gadget_id = selectbox_info[selectbox_id].gadget_id;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ int new_index_value = setSelectboxValue(selectbox_id, new_value);
+
+ ModifyGadget(gi, GDI_SELECTBOX_INDEX, new_index_value, GDI_END);
+}
+
+static void ModifyEditorDrawingArea(int drawingarea_id, int xsize, int ysize)
+{
+ int gadget_id = drawingarea_info[drawingarea_id].gadget_id;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+
+ ModifyGadget(gi, GDI_AREA_SIZE, xsize, ysize, GDI_END);
+}
+
+static void ModifyEditorElementList()
+{
+ int i;
+
+ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
+ {
+ int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ struct GadgetDesign *gd = &gi->deco.design;
+ int element = editor_elements[element_shift + i];
+
+ UnmapGadget(gi);
+ getMiniGraphicSource(el2edimg(element), &gd->bitmap, &gd->x, &gd->y);
+ ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
+ MapGadget(gi);
+ }
+}
+
+static void PickDrawingElement(int button, int element)
+{
+ if (button < 1 || button > 3)
+ return;
+
+ if (button == 1)
+ {
+ new_element1 = element;
+ DrawMiniGraphicExt(drawto,
+ DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
+ el2edimg(new_element1));
+ }
+ else if (button == 2)
+ {
+ new_element2 = element;
+ DrawMiniGraphicExt(drawto,
+ DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
+ el2edimg(new_element2));
+ }
+ else
+ {
+ new_element3 = element;
+ DrawMiniGraphicExt(drawto,
+ DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
+ el2edimg(new_element3));
+ }
+
+ redraw_mask |= REDRAW_DOOR_1;
+}
+
+static void RedrawDrawingElements()
+{
+ PickDrawingElement(1, new_element1);
+ PickDrawingElement(2, new_element2);
+ PickDrawingElement(3, new_element3);
+}
+
+static void DrawDrawingWindow()
+{
+ stick_element_properties_window = FALSE;
+
+ SetMainBackgroundImage(IMG_UNDEFINED);
+ ClearWindow();
+
+ UnmapLevelEditorWindowGadgets();
+ UnmapLevelEditorToolboxCustomGadgets();
+
+ AdjustDrawingAreaGadgets();
+ AdjustLevelScrollPosition();
+ AdjustEditorScrollbar(GADGET_ID_SCROLL_HORIZONTAL);
+ AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL);
+
+ DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+
+ MapMainDrawingArea();
+ MapLevelEditorToolboxDrawingGadgets();
+}
+
+static void DrawLevelInfoWindow()
+{
+ int i;
+
+ stick_element_properties_window = FALSE;
+
+ SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
+ ClearWindow();
+ UnmapLevelEditorWindowGadgets();
+
+ DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS1_YPOS,
+ "Level Settings", FONT_TITLE_1);
+ DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS2_YPOS,
+ "Editor Settings", FONT_TITLE_1);
+
+ /* draw counter gadgets */
+ for (i = ED_COUNTER_ID_LEVEL_FIRST; i <= ED_COUNTER_ID_LEVEL_LAST; i++)
+ MapCounterButtons(i);
+
+ /* draw checkbutton gadgets */
+ for (i=ED_CHECKBUTTON_ID_LEVEL_FIRST; i <= ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
+ MapCheckbuttonGadget(i);
+
+ /* draw radiobutton gadgets */
+ for (i=ED_RADIOBUTTON_ID_LEVEL_FIRST; i <= ED_RADIOBUTTON_ID_LEVEL_LAST; i++)
+ MapRadiobuttonGadget(i);
+
+ /* draw text input gadgets */
+ for (i = ED_TEXTINPUT_ID_LEVEL_FIRST; i <= ED_TEXTINPUT_ID_LEVEL_LAST; i++)
+ MapTextInputGadget(i);
+
+ /* draw drawing area */
+ MapDrawingArea(ED_DRAWING_ID_RANDOM_BACKGROUND);
+}
+
+static void DrawCustomContentArea()
+{
+ int id = ED_DRAWING_ID_CUSTOM_CONTENT;
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
+ int x1 = right_gadget_border[GADGET_ID_CUSTOM_DEADLINESS];
+ int x2 = right_gadget_border[GADGET_ID_CUSTOM_CONSISTENCY];
+ int x3 = right_gadget_border[GADGET_ID_CUSTOM_EXPLODE_IMPACT];
+ int xoffset = ED_DRAWINGAREA_TEXT_DISTANCE;
+
+ /* add distance for potential left text (without drawing area border) */
+ x2 += getTextWidthForGadget(drawingarea_info[id].text_left);
+
+ ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
+
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_CONTENT);
+}
+
+static void DrawCustomChangeContentArea()
+{
+ int id = ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT;
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
+ int x1 = right_gadget_border[GADGET_ID_CHANGE_USE_CONTENT];
+ int x2 = right_gadget_border[GADGET_ID_CHANGE_POWER];
+ int x3 = right_gadget_border[GADGET_ID_CHANGE_ONLY_COMPLETE];
+ int xoffset = ED_DRAWINGAREA_TEXT_DISTANCE;
+
+ ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
+
+ MapDrawingArea(id);
+}
+
+static void DrawElementContentAreas()
+{
+ int x = SX + ED_AREA_YAMYAM_CONTENT_XPOS(3) + 4 * MINI_TILEX;
+ int y = SY + ED_AREA_YAMYAM_CONTENT_YPOS(0) + ED_BORDER_AREA_YSIZE;
+ int i;
+
+ /* display counter to choose number of element content areas */
+ MapCounterButtons(ED_COUNTER_ID_ELEMENT_CONTENT);
+
+ for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
+ {
+ int id = ED_DRAWING_ID_ELEMENT_CONTENT_0 + i;
+ int font_height = getFontHeight(FONT_TEXT_1);
+
+ if (i < level.num_yamyam_contents)
+ MapDrawingArea(id);
+ else
+ {
+ UnmapDrawingArea(id);
+
+ /* delete content areas in case of reducing number of them */
+ DrawBackground(SX + drawingarea_info[id].x - MINI_TILEX / 2,
+ SY + drawingarea_info[id].y - MINI_TILEY / 2,
+ 4 * MINI_TILEX,
+ 4 * MINI_TILEY + ED_GADGET_TEXT_DISTANCE + font_height);
+ }
+ }
+
+ DrawText(x, y + 0 * MINI_TILEY, "content", FONT_TEXT_1);
+ DrawText(x, y + 1 * MINI_TILEY, "when", FONT_TEXT_1);
+ DrawText(x, y + 2 * MINI_TILEY, "smashed", FONT_TEXT_1);
+}
+
+static void DrawGroupElementArea(int element)
+{
+ int num_elements = group_element_info.num_elements;
+ int id = ED_DRAWING_ID_GROUP_CONTENT;
+ int sx = SX + drawingarea_info[id].x - MINI_TILEX / 2;
+ int sy = SY + drawingarea_info[id].y - MINI_TILEY / 2;
+ int xsize = MAX_ELEMENTS_IN_GROUP;
+ int ysize = 1;
+
+ if (drawingarea_info[id].text_left != NULL)
+ sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
+
+ UnmapDrawingArea(id);
+
+ ModifyEditorDrawingArea(id, num_elements, 1);
+
+ /* delete content areas in case of reducing number of them */
+ DrawBackground(sx, sy, (xsize + 1) * MINI_TILEX, (ysize + 1) * MINI_TILEY);
+
+ MapDrawingArea(id);
+}
+
+static void DrawEnvelopeTextArea(int envelope_nr)
+{
+ int id = ED_TEXTAREA_ID_ENVELOPE_INFO;
+ struct GadgetInfo *gi = level_editor_gadget[textarea_info[id].gadget_id];
+
+ UnmapGadget(gi);
+ DrawBackground(gi->x, gi->y, gi->width, gi->height);
+
+ if (envelope_nr != -1)
+ textarea_info[id].value = level.envelope_text[envelope_nr];
+
+ ModifyGadget(gi, GDI_AREA_SIZE,
+ *counterbutton_info[ED_COUNTER_ID_ENVELOPE_XSIZE].value,
+ *counterbutton_info[ED_COUNTER_ID_ENVELOPE_YSIZE].value,
+ GDI_END);
+
+ MapTextAreaGadget(ED_TEXTAREA_ID_ENVELOPE_INFO);
+}
+
+char *getElementDescriptionFilename(int element)
+{
+ char *docs_dir = options.docs_directory;
+ char *elements_subdir = "elements";
+ static char *filename = NULL;
+ char basename[MAX_FILENAME_LEN];
+
+ checked_free(filename);
+
+ /* 1st try: look for element description file for exactly this element */
+ sprintf(basename, "%s.txt", element_info[element].token_name);
+ filename = getPath3(docs_dir, elements_subdir, basename);
+ if (fileExists(filename))
+ return filename;
+
+ free(filename);
+
+ /* 2nd try: look for element description file for this element's class */
+ sprintf(basename, "%s.txt", element_info[element].class_name);
+ filename = getPath3(docs_dir, elements_subdir, basename);
+ if (fileExists(filename))
+ return filename;
+
+ return NULL;
+}
+
+static boolean PrintInfoText(char *text, int font_nr, int start_line)
+{
+ int font_height = getFontHeight(font_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+
+ if (start_line >= max_lines_per_screen)
+ return FALSE;
+
+ DrawText(sx, sy + start_line * font_height, text, font_nr);
+
+ return TRUE;
+}
+
+#if 1
+
+static int PrintElementDescriptionFromFile(char *filename, int start_line)
+{
+ int font_nr = FONT_TEXT_2;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y + start_line * font_height;
+ int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+
+ return DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
+ max_lines_per_screen);
+}
+
+#else
+
+static int PrintElementDescriptionFromFile(char *filename, int start_line)
+{
+ int font_nr = FONT_TEXT_2;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y;
+ int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+ int current_line = start_line;
+ char line[MAX_LINE_LEN];
+ char buffer[max_chars_per_line + 1];
+ int buffer_len;
+ FILE *file;
+
+ if (current_line >= max_lines_per_screen)
+ return 0;
+
+ if (filename == NULL)
+ return 0;
+
+ if (!(file = fopen(filename, MODE_READ)))
+ return 0;
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+
+ while (!feof(file) && current_line < max_lines_per_screen)
+ {
+ char *line_ptr;
+ boolean last_line_was_empty = TRUE;
+
+ /* read next line of input file */
+ if (!fgets(line, MAX_LINE_LEN, file))
+ break;
+
+ /* skip comments (lines directly beginning with '#') */
+ if (line[0] == '#')
+ continue;
+
+ /* cut trailing newline from input line */
+ for (line_ptr = line; *line_ptr; line_ptr++)
+ {
+ if (*line_ptr == '\n' || *line_ptr == '\r')
+ {
+ *line_ptr = '\0';
+ break;
+ }
+ }
+
+ if (strlen(line) == 0) /* special case: force empty line */
+ strcpy(line, "\n");
+
+ line_ptr = line;
+
+ while (*line_ptr && current_line < max_lines_per_screen)
+ {
+ boolean buffer_filled = RenderLineToBuffer(&line_ptr,
+ buffer, &buffer_len,
+ last_line_was_empty,
+ max_chars_per_line);
+ if (buffer_filled)
+ {
+ DrawText(sx, sy + current_line * font_height, buffer, font_nr);
+ current_line++;
+
+ last_line_was_empty = (buffer_len == 0);
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+ }
+ }
+ }
+
+ fclose(file);
+
+ if (buffer_len > 0 && current_line < max_lines_per_screen)
+ {
+ DrawText(sx, sy + current_line * font_height, buffer, font_nr);
+ current_line++;
+ }
+
+ return (current_line - start_line);
+}
+
+#endif
+
+static void DrawPropertiesTabulatorGadgets()
{
- if (level_xpos < -1)
- level_xpos = -1;
- if (level_xpos > lev_fieldx - ed_fieldx + 1)
- level_xpos = lev_fieldx - ed_fieldx + 1;
- if (lev_fieldx < ed_fieldx - 2)
- level_xpos = -1;
+ struct GadgetInfo *gd_gi = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
+ struct GadgetDesign *gd = &gd_gi->alt_design[GD_BUTTON_UNPRESSED];
+ int gd_x = gd->x + gd_gi->border.width / 2;
+ int gd_y = gd->y + gd_gi->height - 1;
+ Pixel tab_color = GetPixel(gd->bitmap, gd_x, gd_y);
+ int id_first = ED_TEXTBUTTON_ID_PROPERTIES_INFO;
+ int id_last = ED_TEXTBUTTON_ID_PROPERTIES_CONFIG;
+ int max_tabs = 4;
+ int i;
- if (level_ypos < -1)
- level_ypos = -1;
- if (level_ypos > lev_fieldy - ed_fieldy + 1)
- level_ypos = lev_fieldy - ed_fieldy + 1;
- if (lev_fieldy < ed_fieldy - 2)
- level_ypos = -1;
+ /* draw additional "advanced" tabulator for custom elements */
+ if (IS_CUSTOM_ELEMENT(properties_element))
+ id_last = ED_TEXTBUTTON_ID_PROPERTIES_CHANGE;
+
+ for (i = id_first; i <= id_last; i++)
+ {
+ int gadget_id = textbutton_info[i].gadget_id;
+ struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ boolean active = (i != edit_mode_properties);
+
+ /* use "config 1" and "config 2" instead of "config" */
+ if (i == ED_TEXTBUTTON_ID_PROPERTIES_CONFIG &&
+ IS_CUSTOM_ELEMENT(properties_element))
+ continue;
+
+ /* draw background line below tabulator button */
+ ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width,1);
+
+ /* draw solid line below inactive tabulator buttons */
+ if (!active && tab_color != BLACK_PIXEL) /* black => transparent */
+ FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,1, tab_color);
+
+ ModifyGadget(gi, GDI_ACTIVE, active, GDI_END);
+ MapTextbuttonGadget(i);
+ }
+
+ /* draw little border line below tabulator buttons */
+ if (tab_color != BLACK_PIXEL) /* black => transparent */
+ FillRectangle(drawto, gd_gi->x, gd_gi->y + gd_gi->height + 1,
+ max_tabs * gd_gi->width + (max_tabs -1) * ED_GADGET_DISTANCE,
+ ED_GADGET_DISTANCE, tab_color);
}
-static void AdjustEditorScrollbar(int id)
+static void DrawPropertiesInfo()
{
- struct GadgetInfo *gi = level_editor_gadget[id];
- int items_max, items_visible, item_position;
-
- if (id == GADGET_ID_SCROLL_HORIZONTAL)
+ static struct
{
- items_max = MAX(lev_fieldx + 2, ed_fieldx);
- items_visible = ed_fieldx;
- item_position = level_xpos + 1;
+ int value;
+ char *text;
}
- else
+ properties[] =
{
- items_max = MAX(lev_fieldy + 2, ed_fieldy);
- items_visible = ed_fieldy;
- item_position = level_ypos + 1;
- }
+ /* configurable properties */
- if (item_position > items_max - items_visible)
- item_position = items_max - items_visible;
+ { EP_WALKABLE_OVER, "- player can walk over it" },
+ { EP_WALKABLE_INSIDE, "- player can walk inside it" },
+ { EP_WALKABLE_UNDER, "- player can walk under it" },
+ { EP_PASSABLE_OVER, "- player can pass over it" },
+ { EP_PASSABLE_INSIDE, "- player can pass through it" },
+ { EP_PASSABLE_UNDER, "- player can pass under it" },
- ModifyGadget(gi, GDI_SCROLLBAR_ITEMS_MAX, items_max,
- GDI_SCROLLBAR_ITEM_POSITION, item_position, GDI_END);
-}
+ { EP_DIGGABLE, "- can be digged away" },
+ { EP_COLLECTIBLE, "- can be collected" },
+ { EP_DROPPABLE, "- can be dropped after collecting" },
+ { EP_PUSHABLE, "- can be pushed" },
-static void ModifyEditorTextInput(int textinput_id, char *new_text)
-{
- int gadget_id = textinput_info[textinput_id].gadget_id;
- struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ { EP_CAN_MOVE, "- can move" },
+ { EP_CAN_FALL, "- can fall" },
- ModifyGadget(gi, GDI_TEXT_VALUE, new_text, GDI_END);
-}
+ { EP_CAN_SMASH_PLAYER, "- can smash player" },
+#if 0
+ { EP_CAN_SMASH_ENEMIES, "- can smash good and bad guys" },
+#endif
+ { EP_CAN_SMASH_EVERYTHING, "- can smash everything smashable" },
-static void ModifyEditorCounter(int counter_id, int new_value)
-{
- int *counter_value = counterbutton_info[counter_id].value;
- int gadget_id = counterbutton_info[counter_id].gadget_id_text;
- struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ { EP_SLIPPERY, "- slippery for falling objects" },
+ { EP_EM_SLIPPERY_WALL, "- slippery for some gems (EM style)" },
- ModifyGadget(gi, GDI_NUMBER_VALUE, new_value, GDI_END);
+ { EP_DONT_RUN_INTO, "- deadly when running into" },
+ { EP_DONT_COLLIDE_WITH, "- deadly when colliding with" },
+ { EP_DONT_TOUCH, "- deadly when touching" },
- if (counter_value != NULL)
- *counter_value = gi->text.number_value;
-}
+ { EP_INDESTRUCTIBLE, "- indestructible" },
-static void ModifyEditorCounterLimits(int counter_id, int min, int max)
-{
- int gadget_id = counterbutton_info[counter_id].gadget_id_text;
- struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ { EP_CAN_EXPLODE_BY_FIRE, "- can explode by fire or explosions" },
+ { EP_CAN_EXPLODE_SMASHED, "- can explode when smashed" },
+ { EP_CAN_EXPLODE_IMPACT, "- can explode on impact" },
- ModifyGadget(gi, GDI_NUMBER_MIN, min, GDI_NUMBER_MAX, max, GDI_END);
-}
+ { EP_CAN_CHANGE, "- can change to other element" },
-static void PickDrawingElement(int button, int element)
-{
- if (button < 1 || button > 3)
- return;
+ /* pre-defined properties */
+ { EP_CAN_PASS_MAGIC_WALL, "- can pass magic walls" },
+ { EP_HAS_CONTENT, "- can contain other elements" },
- if (button == 1)
+ { -1, NULL }
+ };
+ char *filename = getElementDescriptionFilename(properties_element);
+ char *percentage_text = "In this level:";
+ char *properties_text = "Standard properties:";
+ float percentage;
+ int num_elements_in_level;
+ int num_standard_properties = 0;
+ int font1_nr = FONT_TEXT_1;
+ int font2_nr = FONT_TEXT_2;
+ int font1_width = getFontWidth(font1_nr);
+ int font2_height = getFontHeight(font2_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int screen_line = 0;
+ int i, x, y;
+
+#if DEBUG
+ if (IS_CUSTOM_ELEMENT(properties_element))
{
- new_element1 = element;
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
- el2gfx(new_element1));
+ DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
+ "[Custom Element %d]", properties_element - EL_CUSTOM_START + 1);
+ screen_line++;
}
- else if (button == 2)
+ else if (IS_GROUP_ELEMENT(properties_element))
{
- new_element2 = element;
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
- el2gfx(new_element2));
+ DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
+ "[Group Element %d]", properties_element - EL_GROUP_START + 1);
+ screen_line++;
}
- else
+#endif
+
+ /* ----- print number of elements / percentage of this element in level */
+
+ num_elements_in_level = 0;
+ for (y = 0; y < lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ if (Feld[x][y] == properties_element)
+ num_elements_in_level++;
+ percentage = num_elements_in_level * 100.0 / (lev_fieldx * lev_fieldy);
+
+ DrawTextS(pad_x, pad_y + screen_line * font2_height, font1_nr,
+ percentage_text);
+ DrawTextF(pad_x + strlen(percentage_text) * font1_width,
+ pad_y + screen_line++ * font2_height, font2_nr,
+ "%d (%.2f%%)", num_elements_in_level, percentage);
+
+ screen_line++;
+
+ /* ----- print standard properties of this element */
+
+ DrawTextS(pad_x, pad_y + screen_line++ * font2_height, font1_nr,
+ properties_text);
+
+ for (i = 0; properties[i].value != -1; i++)
{
- new_element3 = element;
- DrawMiniGraphicExt(drawto, gc,
- DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
- el2gfx(new_element3));
+ if (!HAS_PROPERTY(properties_element, properties[i].value))
+ continue;
+
+ DrawTextS(pad_x, pad_y + screen_line++ * font2_height, font2_nr,
+ properties[i].text);
+ num_standard_properties++;
}
- redraw_mask |= REDRAW_DOOR_1;
-}
+ if (num_standard_properties == 0)
+ DrawTextS(pad_x + strlen(properties_text) * font1_width,
+ pad_y + (screen_line - 1) * font2_height, font2_nr, "none");
-static void DrawDrawingWindow()
-{
- ClearWindow();
- UnmapLevelEditorWindowGadgets();
- AdjustDrawingAreaGadgets();
- AdjustLevelScrollPosition();
- AdjustEditorScrollbar(GADGET_ID_SCROLL_HORIZONTAL);
- AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL);
- DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
- MapMainDrawingArea();
-}
+ screen_line++;
-static void DrawRandomPlacementBackgroundArea()
-{
- int area_x = ED_AREA_RANDOM_BACKGROUND_XPOS / MINI_TILEX;
- int area_y = ED_AREA_RANDOM_BACKGROUND_YPOS / MINI_TILEY;
- int area_sx = SX + ED_AREA_RANDOM_BACKGROUND_XPOS;
- int area_sy = SY + ED_AREA_RANDOM_BACKGROUND_YPOS;
- int x, y;
+ /* ----- print special description of this element */
- ElementContent[0][0][0] = random_placement_background_element;
+ PrintInfoText("Description:", FONT_TEXT_1, screen_line);
+ if (PrintElementDescriptionFromFile(filename, screen_line + 1) == 0)
+ PrintInfoText("No description available.", FONT_TEXT_1, screen_line);
+}
- /* draw decorative border for the object */
- for (y=0; y<2; y++)
- for (x=0; x<2; x++)
- DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
+#define TEXT_COLLECTING "Score for collecting"
+#define TEXT_SMASHING "Score for smashing"
+#define TEXT_CRACKING "Score for cracking"
+#define TEXT_SPEED "Speed of amoeba growth"
+#define TEXT_DURATION "Duration when activated"
- ClearRectangle(drawto,
- area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
- MINI_TILEX + 2, MINI_TILEY + 2);
+static struct
+{
+ int element;
+ int *value;
+ char *text;
+} elements_with_counter[] =
+{
+ { EL_EMERALD, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_BD_DIAMOND, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_EMERALD_YELLOW, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_EMERALD_RED, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_EMERALD_PURPLE, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_SP_INFOTRON, &level.score[SC_EMERALD], TEXT_COLLECTING },
+ { EL_DIAMOND, &level.score[SC_DIAMOND], TEXT_COLLECTING },
+ { EL_CRYSTAL, &level.score[SC_CRYSTAL], TEXT_COLLECTING },
+ { EL_PEARL, &level.score[SC_PEARL], TEXT_COLLECTING },
+ { EL_BUG, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BUG_RIGHT, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BUG_UP, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BUG_LEFT, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BUG_DOWN, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_RIGHT,&level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_UP, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_LEFT, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_DOWN, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_SP_ELECTRON, &level.score[SC_BUG], TEXT_SMASHING },
+ { EL_SPACESHIP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_SPACESHIP_RIGHT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_SPACESHIP_UP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_SPACESHIP_LEFT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_SPACESHIP_DOWN, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_BD_FIREFLY, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_BD_FIREFLY_RIGHT,&level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_BD_FIREFLY_UP, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_BD_FIREFLY_LEFT, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_BD_FIREFLY_DOWN, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_SP_SNIKSNAK, &level.score[SC_SPACESHIP], TEXT_SMASHING },
+ { EL_YAMYAM, &level.score[SC_YAMYAM], TEXT_SMASHING },
+ { EL_DARK_YAMYAM, &level.score[SC_YAMYAM], TEXT_SMASHING },
+ { EL_ROBOT, &level.score[SC_ROBOT], TEXT_SMASHING },
+ { EL_PACMAN, &level.score[SC_PACMAN], TEXT_SMASHING },
+ { EL_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING },
+ { EL_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING },
+ { EL_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING },
+ { EL_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING },
+ { EL_NUT, &level.score[SC_NUT], TEXT_CRACKING },
+ { EL_DYNAMITE, &level.score[SC_DYNAMITE], TEXT_COLLECTING },
+ { EL_DYNABOMB_INCREASE_NUMBER,&level.score[SC_DYNAMITE],TEXT_COLLECTING },
+ { EL_DYNABOMB_INCREASE_SIZE, &level.score[SC_DYNAMITE],TEXT_COLLECTING },
+ { EL_DYNABOMB_INCREASE_POWER, &level.score[SC_DYNAMITE],TEXT_COLLECTING },
+ { EL_SHIELD_NORMAL, &level.score[SC_SHIELD], TEXT_COLLECTING },
+ { EL_SHIELD_DEADLY, &level.score[SC_SHIELD], TEXT_COLLECTING },
+ { EL_EXTRA_TIME, &level.score[SC_TIME_BONUS], TEXT_COLLECTING },
+ { EL_KEY_1, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_KEY_2, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_KEY_3, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_KEY_4, &level.score[SC_KEY], TEXT_COLLECTING },
+#if 1
+ { EL_EM_KEY_1, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_2, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_3, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_4, &level.score[SC_KEY], TEXT_COLLECTING },
+#else
+ { EL_EM_KEY_1_FILE, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_2_FILE, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_3_FILE, &level.score[SC_KEY], TEXT_COLLECTING },
+ { EL_EM_KEY_4_FILE, &level.score[SC_KEY], TEXT_COLLECTING },
+#endif
+ { EL_AMOEBA_WET, &level.amoeba_speed, TEXT_SPEED },
+ { EL_AMOEBA_DRY, &level.amoeba_speed, TEXT_SPEED },
+ { EL_AMOEBA_FULL, &level.amoeba_speed, TEXT_SPEED },
+ { EL_BD_AMOEBA, &level.amoeba_speed, TEXT_SPEED },
+ { EL_MAGIC_WALL, &level.time_magic_wall, TEXT_DURATION },
+ { EL_ROBOT_WHEEL, &level.time_wheel, TEXT_DURATION },
+ { -1, NULL, NULL }
+};
- /* copy border to the right location */
- BlitBitmap(drawto, drawto,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+static boolean checkPropertiesConfig(int element)
+{
+ int i;
- DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
+ if (IS_GEM(element) ||
+ IS_CUSTOM_ELEMENT(element) ||
+ IS_GROUP_ELEMENT(element) ||
+ IS_ENVELOPE(element) ||
+ ELEM_IS_PLAYER(element) ||
+ HAS_CONTENT(element) ||
+ COULD_MOVE_INTO_ACID(element) ||
+ element == EL_SPRING)
+ return TRUE;
+ else
+ for (i = 0; elements_with_counter[i].element != -1; i++)
+ if (elements_with_counter[i].element == element)
+ return TRUE;
- MapDrawingArea(GADGET_ID_RANDOM_BACKGROUND);
+ return FALSE;
}
-static void DrawLevelInfoWindow()
+static void DrawPropertiesConfig()
{
- char infotext[1024];
- int xoffset_above = 0;
- int yoffset_above = -(MINI_TILEX + ED_GADGET_DISTANCE);
- int xoffset_right = counter_xsize;
- int yoffset_right = ED_BORDER_SIZE;
- int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE;
- int yoffset_right2 = ED_BORDER_SIZE;
- int font_color = FC_GREEN;
- int i, x, y;
+ int i;
- ClearWindow();
- UnmapLevelEditorWindowGadgets();
+ if (!checkPropertiesConfig(properties_element))
+ {
+ PrintInfoText("No configuration options available.", FONT_TEXT_1, 0);
- DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS_YPOS,
- "Level Settings", FS_BIG, FC_YELLOW);
- DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS2_YPOS,
- "Editor Settings", FS_BIG, FC_YELLOW);
+ return;
+ }
- /* draw counter gadgets */
- for (i=ED_COUNTER_ID_LEVEL_FIRST; i<=ED_COUNTER_ID_LEVEL_LAST; i++)
+ /* check if there are elements where a score can be chosen for */
+ for (i = 0; elements_with_counter[i].element != -1; i++)
{
- if (counterbutton_info[i].infotext_above)
+ if (elements_with_counter[i].element == properties_element)
{
- x = counterbutton_info[i].x + xoffset_above;
- y = counterbutton_info[i].y + yoffset_above;
+ int counter_id = ED_COUNTER_ID_ELEMENT_SCORE;
- sprintf(infotext, "%s:", counterbutton_info[i].infotext_above);
- infotext[MAX_INFOTEXT_LEN] = '\0';
- DrawTextF(x, y, font_color, infotext);
- }
+ counterbutton_info[counter_id].y =
+ ED_SETTINGS_YPOS((HAS_CONTENT(properties_element) ? 1 : 0) +
+ (COULD_MOVE_INTO_ACID(properties_element) ? 1 : 0));
- if (counterbutton_info[i].infotext_right)
- {
- x = counterbutton_info[i].x + xoffset_right;
- y = counterbutton_info[i].y + yoffset_right;
+ counterbutton_info[counter_id].value = elements_with_counter[i].value;
+ counterbutton_info[counter_id].text_right= elements_with_counter[i].text;
- sprintf(infotext, "%s", counterbutton_info[i].infotext_right);
- infotext[MAX_INFOTEXT_LEN] = '\0';
- DrawTextF(x, y, font_color, infotext);
+ MapCounterButtons(counter_id);
+
+ break;
}
+ }
- ModifyEditorCounter(i, *counterbutton_info[i].value);
- MapCounterButtons(i);
+ if (HAS_CONTENT(properties_element))
+ {
+ /* draw stickybutton gadget */
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
+
+ if (IS_AMOEBOID(properties_element))
+ MapDrawingArea(ED_DRAWING_ID_AMOEBA_CONTENT);
+ else
+ DrawElementContentAreas();
}
- /* draw text input gadgets */
- for (i=ED_TEXTINPUT_ID_LEVEL_FIRST; i<=ED_TEXTINPUT_ID_LEVEL_LAST; i++)
+ if (ELEM_IS_PLAYER(properties_element))
+ MapCheckbuttonGadget(properties_element == EL_SP_MURPHY ?
+ ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD :
+ ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD);
+
+ if (IS_GEM(properties_element))
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
+
+ if (COULD_MOVE_INTO_ACID(properties_element) &&
+ (!IS_CUSTOM_ELEMENT(properties_element) ||
+ edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2))
{
- x = textinput_info[i].x + xoffset_above;
- y = textinput_info[i].y + yoffset_above;
+ checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
+ ED_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 :
+ HAS_CONTENT(properties_element) ? 1 : 0);
+
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID);
+ }
- sprintf(infotext, "%s:", textinput_info[i].infotext);
- infotext[MAX_INFOTEXT_LEN] = '\0';
+ if (properties_element == EL_SPRING)
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_SPRING_BUG);
- DrawTextF(x, y, font_color, infotext);
- ModifyEditorTextInput(i, textinput_info[i].value);
- MapTextInputGadget(i);
+ if (IS_ENVELOPE(properties_element))
+ {
+ int counter1_id = ED_COUNTER_ID_ENVELOPE_XSIZE;
+ int counter2_id = ED_COUNTER_ID_ENVELOPE_YSIZE;
+ int envelope_nr = properties_element - EL_ENVELOPE_1;
+
+ counterbutton_info[counter1_id].value = &level.envelope_xsize[envelope_nr];
+ counterbutton_info[counter2_id].value = &level.envelope_ysize[envelope_nr];
+
+ /* display counter to choose size of envelope text area */
+ MapCounterButtons(ED_COUNTER_ID_ENVELOPE_XSIZE);
+ MapCounterButtons(ED_COUNTER_ID_ENVELOPE_YSIZE);
+
+ DrawEnvelopeTextArea(envelope_nr);
}
- /* draw radiobutton gadgets */
- for (i=ED_RADIOBUTTON_ID_LEVEL_FIRST; i<=ED_RADIOBUTTON_ID_LEVEL_LAST; i++)
+ if (IS_CUSTOM_ELEMENT(properties_element))
{
- boolean checked =
- (*radiobutton_info[i].value == radiobutton_info[i].checked_value);
+ /* draw stickybutton gadget */
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
+
+ if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_1)
+ {
+ /* draw checkbutton gadgets */
+ for (i = ED_CHECKBUTTON_ID_CUSTOM1_FIRST;
+ i <= ED_CHECKBUTTON_ID_CUSTOM1_LAST; i++)
+ MapCheckbuttonGadget(i);
+
+ /* draw counter gadgets */
+ for (i = ED_COUNTER_ID_CUSTOM1_FIRST;
+ i <= ED_COUNTER_ID_CUSTOM1_LAST; i++)
+ MapCounterButtons(i);
+
+ /* draw selectbox gadgets */
+ for (i = ED_SELECTBOX_ID_CUSTOM1_FIRST;
+ i <= ED_SELECTBOX_ID_CUSTOM1_LAST; i++)
+ MapSelectboxGadget(i);
+
+ /* draw textbutton gadgets */
+ MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE);
+
+ /* draw text input gadgets */
+ MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
+
+ /* draw drawing area gadgets */
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_ENTER);
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_LEAVE);
+ }
+ else if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2)
+ {
+ /* set position for special checkbutton for "can move into acid" */
- x = radiobutton_info[i].x + xoffset_right2;
- y = radiobutton_info[i].y + yoffset_right2;
+ /* draw checkbutton gadgets */
+ for (i = ED_CHECKBUTTON_ID_CUSTOM2_FIRST;
+ i <= ED_CHECKBUTTON_ID_CUSTOM2_LAST; i++)
+ MapCheckbuttonGadget(i);
- DrawTextF(x, y, font_color, radiobutton_info[i].text);
- ModifyGadget(level_editor_gadget[radiobutton_info[i].gadget_id],
- GDI_CHECKED, checked, GDI_END);
- MapRadiobuttonGadget(i);
+ /* draw counter gadgets */
+ for (i = ED_COUNTER_ID_CUSTOM2_FIRST;
+ i <= ED_COUNTER_ID_CUSTOM2_LAST; i++)
+ MapCounterButtons(i);
+
+ /* draw selectbox gadgets */
+ for (i = ED_SELECTBOX_ID_CUSTOM2_FIRST;
+ i <= ED_SELECTBOX_ID_CUSTOM2_LAST; i++)
+ MapSelectboxGadget(i);
+
+ /* draw drawing area gadgets */
+ DrawCustomContentArea();
+ }
}
+ else if (IS_GROUP_ELEMENT(properties_element))
+ {
+ /* draw stickybutton gadget */
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
- /* draw checkbutton gadgets */
- for (i=ED_CHECKBUTTON_ID_LEVEL_FIRST; i<=ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
+ /* draw checkbutton gadgets */
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC);
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE);
+
+ /* draw counter gadgets */
+ MapCounterButtons(ED_COUNTER_ID_GROUP_CONTENT);
+
+ /* draw selectbox gadgets */
+ MapSelectboxGadget(ED_SELECTBOX_ID_GROUP_CHOICE_MODE);
+
+ /* draw textbutton gadgets */
+ MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE);
+
+ /* draw drawing area gadgets */
+ DrawGroupElementArea(properties_element);
+
+ /* draw text input gadgets */
+ MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
+
+ /* draw drawing area gadgets */
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
+ }
+}
+
+static void DrawPropertiesChangeDrawingAreas()
+{
+ if (IS_CUSTOM_ELEMENT(properties_element))
{
- x = checkbutton_info[i].x + xoffset_right2;
- y = checkbutton_info[i].y + yoffset_right2;
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
- DrawTextF(x, y, font_color, checkbutton_info[i].text);
- ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
- GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
- MapCheckbuttonGadget(i);
+ DrawCustomChangeContentArea();
}
- /* draw drawing area */
- DrawRandomPlacementBackgroundArea();
+ redraw_mask |= REDRAW_FIELD;
}
-static void DrawAmoebaContentArea()
+static void DrawPropertiesChange()
{
- int area_x = ED_AREA_ELEM_CONTENT_XPOS / MINI_TILEX;
- int area_y = ED_AREA_ELEM_CONTENT_YPOS / MINI_TILEY;
- int area_sx = SX + ED_AREA_ELEM_CONTENT_XPOS;
- int area_sy = SY + ED_AREA_ELEM_CONTENT_YPOS;
- int font_color = FC_GREEN;
- int x, y;
+ int i;
- ElementContent[0][0][0] = level.amoeba_content;
+ /* draw stickybutton gadget */
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
- /* draw decorative border for the object */
- for (y=0; y<2; y++)
- for (x=0; x<2; x++)
- DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
+ /* draw checkbutton gadgets */
+ for (i = ED_CHECKBUTTON_ID_CHANGE_FIRST;
+ i <= ED_CHECKBUTTON_ID_CHANGE_LAST; i++)
+ MapCheckbuttonGadget(i);
- ClearRectangle(drawto,
- area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
- MINI_TILEX + 2, MINI_TILEY + 2);
+ /* draw counter gadgets */
+ for (i = ED_COUNTER_ID_CHANGE_FIRST;
+ i <= ED_COUNTER_ID_CHANGE_LAST; i++)
+ MapCounterButtons(i);
- /* copy border to the right location */
- BlitBitmap(drawto, drawto,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ /* draw selectbox gadgets */
+ for (i = ED_SELECTBOX_ID_CHANGE_FIRST;
+ i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
+ MapSelectboxGadget(i);
- DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
- FS_SMALL, font_color);
+ /* draw textbutton gadgets */
+ for (i = ED_TEXTBUTTON_ID_CHANGE_FIRST;
+ i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
+ MapTextbuttonGadget(i);
- DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
+ /* draw graphicbutton gadgets */
+ for (i = ED_GRAPHICBUTTON_ID_CHANGE_FIRST;
+ i <= ED_GRAPHICBUTTON_ID_CHANGE_LAST; i++)
+ MapGraphicbuttonGadget(i);
- MapDrawingArea(GADGET_ID_AMOEBA_CONTENT);
+ /* draw drawing area gadgets */
+ DrawPropertiesChangeDrawingAreas();
}
-static void DrawElementContentAreas()
+static void DrawElementName(int x, int y, int element)
{
- int counter_id = ED_COUNTER_ID_ELEM_CONTENT;
- int area_x = ED_AREA_ELEM_CONTENT_XPOS / MINI_TILEX;
- int area_y = ED_AREA_ELEM_CONTENT_YPOS / MINI_TILEY;
- int area_sx = SX + ED_AREA_ELEM_CONTENT_XPOS;
- int area_sy = SY + ED_AREA_ELEM_CONTENT_YPOS;
- int xoffset_right = counter_xsize;
- int yoffset_right = ED_BORDER_SIZE;
- int font_color = FC_GREEN;
- int i, x, y;
+ char *element_name = getElementInfoText(element);
+ int font_nr = FONT_TEXT_1;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int max_text_width = SXSIZE - x - ED_SETTINGS_XPOS(0);
+ int max_chars_per_line = max_text_width / font_width;
+ char buffer[max_chars_per_line + 1];
+
+ if (strlen(element_name) <= max_chars_per_line)
+ DrawTextS(x, y, font_nr, element_name);
+ else
+ {
+ int next_pos = max_chars_per_line;
- for (i=0; i<MAX_ELEMENT_CONTENTS; i++)
- for (y=0; y<3; y++)
- for (x=0; x<3; x++)
- ElementContent[i][x][y] = level.yam_content[i][x][y];
+ strncpy(buffer, element_name, max_chars_per_line);
+ buffer[max_chars_per_line] = '\0';
- for (i=0; i<MAX_ELEMENT_CONTENTS; i++)
- UnmapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
+ if (element_name[max_chars_per_line] == ' ')
+ next_pos++;
+ else
+ {
+ int i;
- /* display counter to choose number of element content areas */
- x = counterbutton_info[counter_id].x + xoffset_right;
- y = counterbutton_info[counter_id].y + yoffset_right;
- DrawTextF(x, y, font_color, "number of content areas");
+ for (i = max_chars_per_line - 1; i >= 0; i--)
+ if (buffer[i] == ' ')
+ break;
- ModifyEditorCounter(counter_id, *counterbutton_info[counter_id].value);
- MapCounterButtons(counter_id);
+ if (strlen(&element_name[i + 1]) <= max_chars_per_line)
+ {
+ buffer[i] = '\0';
+ next_pos = i + 1;
+ }
+ }
- /* delete content areas in case of reducing number of them */
- ClearRectangle(backbuffer,
- SX, area_sy - MINI_TILEX,
- SXSIZE, 12 * MINI_TILEY);
-
- /* draw some decorative border for the objects */
- for (i=0; i<level.num_yam_contents; i++)
- {
- for (y=0; y<4; y++)
- for (x=0; x<4; x++)
- DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
- EL_ERDREICH);
-
- ClearRectangle(drawto,
- area_sx + 5 * (i % 4) * MINI_TILEX + MINI_TILEX/2 - 1,
- area_sy + 6 * (i / 4) * MINI_TILEY + MINI_TILEY/2 - 1,
- 3 * MINI_TILEX + 2, 3 * MINI_TILEY + 2);
- }
+ DrawTextS(x, y - font_height / 2, font_nr, buffer);
- /* copy border to the right location */
- BlitBitmap(drawto, drawto,
- area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
-
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
- "Content", FS_SMALL, font_color);
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 1 * MINI_TILEY + 1,
- "when", FS_SMALL, font_color);
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 2 * MINI_TILEY + 1,
- "smashed", FS_SMALL, font_color);
-
- for (i=0; i<level.num_yam_contents; i++)
- {
- for (y=0; y<3; y++)
- for (x=0; x<3; x++)
- DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
- ElementContent[i][x][y]);
-
- DrawTextF(area_sx - SX + 5 * (i % 4) * MINI_TILEX + MINI_TILEX + 1,
- area_sy - SY + 6 * (i / 4) * MINI_TILEY + 4 * MINI_TILEY - 4,
- font_color, "%d", i + 1);
- }
+ strncpy(buffer, &element_name[next_pos], max_chars_per_line);
+ buffer[max_chars_per_line] = '\0';
- for (i=0; i<level.num_yam_contents; i++)
- MapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
+ DrawTextS(x, y + font_height / 2, font_nr, buffer);
+ }
}
-#define TEXT_COLLECTING "Score for collecting"
-#define TEXT_SMASHING "Score for smashing"
-#define TEXT_CRACKING "Score for cracking"
-#define TEXT_SPEED "Speed of amoeba growth"
-#define TEXT_DURATION "Duration when activated"
-
static void DrawPropertiesWindow()
{
- int counter_id = ED_COUNTER_ID_ELEM_SCORE;
- int num_elements_in_level;
- float percentage;
- int xoffset_right = counter_xsize;
- int yoffset_right = ED_BORDER_SIZE;
- int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE;
- int yoffset_right2 = ED_BORDER_SIZE;
int xstart = 2;
int ystart = 4;
- int font_color = FC_GREEN;
- int i, x, y;
- static struct
- {
- int element;
- int *value;
- char *text;
- } elements_with_counter[] =
- {
- { EL_EDELSTEIN, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_BD, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_GELB,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_ROT, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_LILA,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_DIAMANT, &level.score[SC_DIAMANT], TEXT_COLLECTING },
- { EL_KAEFER_RIGHT, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_LEFT, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_DOWN, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_RIGHT,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_LEFT,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_DOWN,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_FLIEGER_RIGHT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_RIGHT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_MAMPFER, &level.score[SC_MAMPFER], TEXT_SMASHING },
- { EL_MAMPFER2, &level.score[SC_MAMPFER], TEXT_SMASHING },
- { EL_ROBOT, &level.score[SC_ROBOT], TEXT_SMASHING },
- { EL_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING },
- { EL_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING },
- { EL_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING },
- { EL_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING },
- { EL_KOKOSNUSS, &level.score[SC_KOKOSNUSS], TEXT_CRACKING },
- { EL_DYNAMITE_INACTIVE,&level.score[SC_DYNAMIT], TEXT_COLLECTING },
- { EL_SCHLUESSEL1, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL2, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL3, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL4, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_1_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_2_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_3_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_4_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_AMOEBE_NASS, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_NORM, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_VOLL, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_BD, &level.amoeba_speed, TEXT_SPEED },
- { EL_MAGIC_WALL_OFF,&level.time_magic_wall, TEXT_DURATION },
- { EL_ABLENK_AUS, &level.time_wheel, TEXT_DURATION },
- { -1, NULL, NULL }
- };
- ClearWindow();
- UnmapLevelEditorWindowGadgets();
+ stick_element_properties_window = FALSE;
- DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS_YPOS,
- "Element Settings", FS_BIG, FC_YELLOW);
+ /* make sure that previous properties edit mode exists for this element */
+ if (edit_mode_properties > ED_MODE_PROPERTIES_CONFIG &&
+ !IS_CUSTOM_ELEMENT(properties_element))
+ edit_mode_properties = ED_MODE_PROPERTIES_CONFIG;
- /* draw some decorative border for the object */
- for (y=0; y<3; y++)
- for (x=0; x<3; x++)
- DrawMiniElement(xstart + x , ystart + y, EL_ERDREICH);
+ if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG &&
+ IS_CUSTOM_ELEMENT(properties_element))
+ edit_mode_properties = ED_MODE_PROPERTIES_CONFIG_1;
- ClearRectangle(drawto,
- SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
- SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
- TILEX + 2, TILEY + 2);
+ CopyElementPropertiesToEditor(properties_element);
- /* copy border to the right location */
- BlitBitmap(drawto, drawto,
- SX + xstart * MINI_TILEX,
- SY + ystart * MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ UnmapLevelEditorWindowGadgets();
+ UnmapLevelEditorToolboxDrawingGadgets();
+ UnmapLevelEditorToolboxCustomGadgets();
- DrawGraphic(xstart/2, ystart/2, el2gfx(properties_element));
+ if (IS_CUSTOM_ELEMENT(properties_element) ||
+ IS_GROUP_ELEMENT(properties_element))
+ MapLevelEditorToolboxCustomGadgets();
- /* copy the whole stuff to the definitive location */
- BlitBitmap(drawto, drawto,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
+ ClearWindow();
- DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
- font_color, getElementInfoText(properties_element));
+ DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS1_YPOS,
+ "Element Settings", FONT_TITLE_1);
- num_elements_in_level = 0;
- for (y=0; y<lev_fieldy; y++)
- for (x=0; x<lev_fieldx; x++)
- if (Feld[x][y] == properties_element)
- num_elements_in_level++;
- percentage = num_elements_in_level * 100.0 / (lev_fieldx * lev_fieldy);
+ DrawElementBorder(SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY + MINI_TILEY / 2,
+ TILEX, TILEY, FALSE);
+ DrawGraphicAnimationExt(drawto,
+ SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY + MINI_TILEY / 2,
+ el2img(properties_element), -1, NO_MASKING);
- DrawTextF(ED_SETTINGS_XPOS, 5 * TILEY, font_color, "In this level:");
- DrawTextF(ED_SETTINGS_XPOS + 15 * FONT2_XSIZE, 5 * TILEY, FC_YELLOW,
- "%d (%.2f%%)", num_elements_in_level, percentage);
+ FrameCounter = 0; /* restart animation frame counter */
- /* check if there are elements where a score can be chosen for */
- for (i=0; elements_with_counter[i].element != -1; i++)
- {
- if (elements_with_counter[i].element == properties_element)
- {
- int x = counterbutton_info[counter_id].x + xoffset_right;
- int y = counterbutton_info[counter_id].y + yoffset_right;
+ DrawElementName((xstart + 3) * MINI_TILEX + 1, (ystart + 1) * MINI_TILEY + 1,
+ properties_element);
- counterbutton_info[counter_id].value = elements_with_counter[i].value;
- DrawTextF(x, y, font_color, elements_with_counter[i].text);
+ DrawPropertiesTabulatorGadgets();
+
+ if (edit_mode_properties == ED_MODE_PROPERTIES_INFO)
+ DrawPropertiesInfo();
+ else if (edit_mode_properties == ED_MODE_PROPERTIES_CHANGE)
+ DrawPropertiesChange();
+ else /* (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG[_1|_2]) */
+ DrawPropertiesConfig();
+}
+
+static void UpdateCustomElementGraphicGadgets()
+{
+ int i;
- ModifyEditorCounter(counter_id, *counterbutton_info[counter_id].value);
- MapCounterButtons(counter_id);
- break;
- }
- }
+ ModifyEditorElementList();
+ RedrawDrawingElements();
- if (HAS_CONTENT(properties_element))
+ /* force redraw of all mapped drawing area gadgets */
+ for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
{
- /* draw stickybutton gadget */
- i = ED_CHECKBUTTON_ID_STICK_ELEMENT;
- x = checkbutton_info[i].x + xoffset_right2;
- y = checkbutton_info[i].y + yoffset_right2;
-
- DrawTextF(x, y, font_color, checkbutton_info[i].text);
- ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
- GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
- MapCheckbuttonGadget(i);
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[i].gadget_id];
- if (IS_AMOEBOID(properties_element))
- DrawAmoebaContentArea();
- else
- DrawElementContentAreas();
+ if (gi->mapped)
+ MapDrawingArea(i);
}
}
if (from_x > to_x)
swap_numbers(&from_x, &to_x);
- for (x=from_x; x<=to_x; x++)
+ for (x = from_x; x <= to_x; x++)
DrawLineElement(x, y, element, change_level);
}
else if (from_x == to_x) /* vertical line */
if (from_y > to_y)
swap_numbers(&from_y, &to_y);
- for (y=from_y; y<=to_y; y++)
+ for (y = from_y; y <= to_y; y++)
DrawLineElement(x, y, element, change_level);
}
else /* diagonal line */
if (from_x > to_x)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (x=0; x<=len_x; x++)
+ for (x = 0; x <= len_x; x++)
{
y = (int)(a * x + 0.5) * (to_y < from_y ? -1 : +1);
DrawLineElement(from_x + x, from_y + y, element, change_level);
if (from_y > to_y)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (y=0; y<=len_y; y++)
+ for (y = 0; y <= len_y; y++)
{
x = (int)(a * y + 0.5) * (to_x < from_x ? -1 : +1);
DrawLineElement(from_x + x, from_y + y, element, change_level);
}
}
-static void DrawRectangle(int from_x, int from_y, int to_x, int to_y,
- int element, boolean change_level)
+static void DrawBox(int from_x, int from_y, int to_x, int to_y,
+ int element, boolean change_level)
{
DrawLine(from_x, from_y, from_x, to_y, element, change_level);
DrawLine(from_x, to_y, to_x, to_y, element, change_level);
if (from_y > to_y)
swap_number_pairs(&from_x, &from_y, &to_x, &to_y);
- for (y=from_y; y<=to_y; y++)
+ for (y = from_y; y <= to_y; y++)
DrawLine(from_x, y, to_x, y, element, change_level);
}
/* not optimal (some points get drawn twice) but simple,
and fast enough for the few points we are drawing */
- for (x=0; x<=radius; x++)
+ for (x = 0; x <= radius; x++)
{
int sx, sy, lx, ly;
DrawLineElement(sx, sy, element, change_level);
}
- for (y=0; y<=radius; y++)
+ for (y = 0; y <= radius; y++)
{
int sx, sy, lx, ly;
int element, boolean change_level)
{
if (element == -1 || change_level)
- DrawRectangle(from_x, from_y, to_x, to_y, -1, FALSE);
+ DrawBox(from_x, from_y, to_x, to_y, -1, FALSE);
else
DrawAreaBorder(from_x, from_y, to_x, to_y);
}
#define CB_BRUSH_TO_CURSOR 1
#define CB_BRUSH_TO_LEVEL 2
#define CB_DELETE_OLD_CURSOR 3
+#define CB_DUMP_BRUSH 4
static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y,
int button, int mode)
int new_element = BUTTON_ELEMENT(button);
int x, y;
+ if (mode == CB_DUMP_BRUSH)
+ {
+ if (!draw_with_brush)
+ {
+ Error(ERR_WARN, "no brush selected");
+
+ return;
+ }
+
+ for (y = 0; y < brush_height; y++)
+ {
+ for (x = 0; x < brush_width; x++)
+ {
+ int element = brush_buffer[x][y];
+ int element_mapped = element;
+ char *element_string = "?";
+ int k;
+
+ for (k = 0; forum_sketch_element_mapping[k].element != -1; k++)
+ {
+ if (forum_sketch_element_mapping[k].element == element)
+ {
+ element_mapped = forum_sketch_element_mapping[k].element_mapped;
+ break;
+ }
+ }
+
+ if (IS_CUSTOM_ELEMENT(element))
+ element_mapped = EL_CUSTOM_1;
+
+ for (k = 0; forum_sketch_element_strings[k].element != -1; k++)
+ {
+ if (forum_sketch_element_strings[k].element == element_mapped)
+ {
+ element_string = forum_sketch_element_strings[k].element_string;
+ break;
+ }
+ }
+
+ printf("`%s", element_string);
+ }
+
+ printf("\n");
+ }
+
+ return;
+ }
+
if (mode == CB_DELETE_OLD_CURSOR && !delete_old_brush)
return;
from_lx = from_x + level_xpos;
from_ly = from_y + level_ypos;
- for (y=0; y<brush_height; y++)
+ for (y = 0; y < brush_height; y++)
{
- for (x=0; x<brush_width; x++)
+ for (x=0; x < brush_width; x++)
{
brush_buffer[x][y] = Feld[from_lx + x][from_ly + y];
return;
}
- for (y=0; y<brush_height; y++)
+ for (y = 0; y < brush_height; y++)
{
- for (x=0; x<brush_width; x++)
+ for (x = 0; x < brush_width; x++)
{
int sx = cursor_from_x + x;
int sy = cursor_from_y + y;
CopyBrushExt(0, 0, 0, 0, 0, CB_DELETE_OLD_CURSOR);
}
+void DumpBrush()
+{
+ CopyBrushExt(0, 0, 0, 0, 0, CB_DUMP_BRUSH);
+}
+
static void FloodFill(int from_x, int from_y, int fill_element)
{
int i,x,y;
old_element = Feld[from_x][from_y];
Feld[from_x][from_y] = fill_element;
- for(i=0;i<4;i++)
+ for (i = 0; i < 4; i++)
{
x = from_x + check[i][0];
y = from_y + check[i][1];
if (letter >= 'a' && letter <= 'z')
letter_element = EL_CHAR_ASCII0 + letter + (int)('A' - 'a');
else if (letter == 'ä' || letter == 'Ä')
- letter_element = EL_CHAR_AE;
+ letter_element = EL_CHAR_AUMLAUT;
else if (letter == 'ö' || letter == 'Ö')
- letter_element = EL_CHAR_OE;
+ letter_element = EL_CHAR_OUMLAUT;
else if (letter == 'ü' || letter == 'Ü')
- letter_element = EL_CHAR_UE;
+ letter_element = EL_CHAR_UUMLAUT;
else if (letter == '^')
- letter_element = EL_CHAR_COPY;
+ letter_element = EL_CHAR_COPYRIGHT;
else
letter_element = EL_CHAR_ASCII0 + letter;
undo_buffer_steps++;
}
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
UndoBuffer[undo_buffer_position][x][y] = Feld[x][y];
/* check if drawing operation forces change of border style */
SetBorderElement();
if (BorderElement != last_border_element)
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
-
-#if 0
-#ifdef DEBUG
- printf("level saved to undo buffer\n");
-#endif
-#endif
}
static void RandomPlacement(int new_element)
/* determine number of free positions for the new elements */
/* (maybe this statement should be formatted a bit more readable...) */
num_free_positions = 0;
- for (x=0; x<lev_fieldx; x++)
- for (y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
if ((free_position[x][y] =
((random_placement_background_restricted &&
Feld[x][y] == random_placement_background_element) ||
/* if not more free positions than elements to place, fill whole level */
if (num_elements >= num_free_positions)
{
- for (x=0; x<lev_fieldx; x++)
- for (y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] = new_element;
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
int wrap_dy = lev_fieldy - dy;
int x, y;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
FieldBackup[x][y] = Feld[x][y];
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] =
FieldBackup[(x + wrap_dx) % lev_fieldx][(y + wrap_dy) % lev_fieldy];
int sx = gi->event.x, sy = gi->event.y;
int min_sx = 0, min_sy = 0;
int max_sx = gi->drawing.area_xsize - 1, max_sy = gi->drawing.area_ysize - 1;
+ int item_xsize = gi->drawing.item_xsize, item_ysize = gi->drawing.item_ysize;
int lx = 0, ly = 0;
int min_lx = 0, min_ly = 0;
int max_lx = lev_fieldx - 1, max_ly = lev_fieldy - 1;
/* automatically switch to 'single item' drawing mode, if needed */
actual_drawing_function =
- (draw_level ? drawing_function : GADGET_ID_SINGLE_ITEMS);
+ (draw_level || drawing_function == GADGET_ID_PICK_ELEMENT ?
+ drawing_function : GADGET_ID_SINGLE_ITEMS);
+
+ /* clicking into drawing area with pressed Control key picks element */
+ if (GetKeyModState() & KMOD_Control)
+ {
+ last_drawing_function = drawing_function;
+ actual_drawing_function = GADGET_ID_PICK_ELEMENT;
+ }
switch (actual_drawing_function)
{
}
else if (new_element != Feld[lx][ly])
{
- if (new_element == EL_SPIELFIGUR)
+ if (new_element == EL_PLAYER_1)
{
/* remove player at old position */
- for(y=0; y<lev_fieldy; y++)
+ for (y = 0; y < lev_fieldy; y++)
{
- for(x=0; x<lev_fieldx; x++)
+ for (x = 0; x < lev_fieldx; x++)
{
- if (Feld[x][y] == EL_SPIELFIGUR || Feld[x][y] == EL_SPIELER1)
+ if (Feld[x][y] == EL_PLAYER_1)
{
- Feld[x][y] = EL_LEERRAUM;
+ Feld[x][y] = EL_EMPTY;
if (x - level_xpos >= 0 && x - level_xpos < ed_fieldx &&
y - level_ypos >= 0 && y - level_ypos < ed_fieldy)
DrawMiniElement(x - level_xpos, y - level_ypos,
- EL_LEERRAUM);
+ EL_EMPTY);
}
}
}
}
else
{
- DrawMiniGraphicExt(drawto, gc,
- gi->x + sx * MINI_TILEX,
- gi->y + sy * MINI_TILEY,
- el2gfx(new_element));
- DrawMiniGraphicExt(window, gc,
- gi->x + sx * MINI_TILEX,
- gi->y + sy * MINI_TILEY,
- el2gfx(new_element));
+ if (item_xsize == MINI_TILEX && item_ysize == MINI_TILEY)
+ DrawMiniGraphicExt(drawto,
+ gi->x + sx * MINI_TILEX,
+ gi->y + sy * MINI_TILEY,
+ el2edimg(new_element));
+ else
+ DrawGraphicExt(drawto,
+ gi->x + sx * TILEX,
+ gi->y + sy * TILEY,
+ el2img(new_element), 0);
if (id == GADGET_ID_AMOEBA_CONTENT)
level.amoeba_content = new_element;
+ else if (id == GADGET_ID_CUSTOM_GRAPHIC)
+ {
+ new_element = GFX_ELEMENT(new_element);
+ custom_element.gfx_element = new_element;
+
+ CopyElementPropertiesToGame(properties_element);
+
+ UpdateCustomElementGraphicGadgets();
+
+ FrameCounter = 0; /* restart animation frame counter */
+ }
+ else if (id == GADGET_ID_CUSTOM_CONTENT)
+ {
+ custom_element.content[sx][sy] = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_CUSTOM_MOVE_ENTER)
+ {
+ custom_element.move_enter_element = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_CUSTOM_MOVE_LEAVE)
+ {
+ custom_element.move_leave_element = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TARGET)
+ {
+ custom_element_change.target_element = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_CUSTOM_CHANGE_CONTENT)
+ {
+ custom_element_change.content[sx][sy] = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
+ {
+ custom_element_change.trigger_element = new_element;
+
+ CopyCustomElementPropertiesToGame(properties_element);
+ }
+ else if (id == GADGET_ID_GROUP_CONTENT)
+ {
+ group_element_info.element[sx] = new_element;
+
+ CopyGroupElementPropertiesToGame(properties_element);
+ }
else if (id == GADGET_ID_RANDOM_BACKGROUND)
random_placement_background_element = new_element;
- else if (id >= GADGET_ID_ELEM_CONTENT_0 &&
- id <= GADGET_ID_ELEM_CONTENT_7)
- level.yam_content[id - GADGET_ID_ELEM_CONTENT_0][sx][sy] =
+ else if (id >= GADGET_ID_ELEMENT_CONTENT_0 &&
+ id <= GADGET_ID_ELEMENT_CONTENT_7)
+ level.yamyam_content[id - GADGET_ID_ELEMENT_CONTENT_0][sx][sy] =
new_element;
}
break;
else if (drawing_function == GADGET_ID_ARC)
draw_func = DrawArc;
else if (drawing_function == GADGET_ID_RECTANGLE)
- draw_func = DrawRectangle;
+ draw_func = DrawBox;
else if (drawing_function == GADGET_ID_FILLED_BOX)
draw_func = DrawFilledBox;
else if (drawing_function == GADGET_ID_GRAB_BRUSH)
if (button_release_event)
ClickOnGadget(level_editor_gadget[last_drawing_function],
MB_LEFTBUTTON);
- else
+ else if (draw_level)
PickDrawingElement(button, Feld[lx][ly]);
+ else if (id == GADGET_ID_AMOEBA_CONTENT)
+ PickDrawingElement(button, level.amoeba_content);
+ else if (id == GADGET_ID_CUSTOM_GRAPHIC)
+ PickDrawingElement(button, custom_element.gfx_element);
+ else if (id == GADGET_ID_CUSTOM_CONTENT)
+ PickDrawingElement(button, custom_element.content[sx][sy]);
+ else if (id == GADGET_ID_CUSTOM_MOVE_ENTER)
+ PickDrawingElement(button, custom_element.move_enter_element);
+ else if (id == GADGET_ID_CUSTOM_MOVE_LEAVE)
+ PickDrawingElement(button, custom_element.move_leave_element);
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TARGET)
+ PickDrawingElement(button, custom_element_change.target_element);
+ else if (id == GADGET_ID_CUSTOM_CHANGE_CONTENT)
+ PickDrawingElement(button, custom_element_change.content[sx][sy]);
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
+ PickDrawingElement(button, custom_element_change.trigger_element);
+ else if (id == GADGET_ID_GROUP_CONTENT)
+ PickDrawingElement(button, group_element_info.element[sx]);
+ else if (id == GADGET_ID_RANDOM_BACKGROUND)
+ PickDrawingElement(button, random_placement_background_element);
+ else if (id >= GADGET_ID_ELEMENT_CONTENT_0 &&
+ id <= GADGET_ID_ELEMENT_CONTENT_7)
+ {
+ int i = id - GADGET_ID_ELEMENT_CONTENT_0;
+
+ PickDrawingElement(button, level.yamyam_content[i][sx][sy]);
+ }
break;
}
if (gadget_id == counterbutton_info[counter_id].gadget_id_text)
- *counter_value = gi->text.number_value;
+ *counter_value = gi->textinput.number_value;
else
ModifyEditorCounter(counter_id, *counter_value + step);
switch (counter_id)
{
- case ED_COUNTER_ID_ELEM_CONTENT:
+ case ED_COUNTER_ID_ELEMENT_CONTENT:
DrawElementContentAreas();
break;
+ case ED_COUNTER_ID_GROUP_CONTENT:
+ DrawGroupElementArea(properties_element);
+ CopyGroupElementPropertiesToGame(properties_element);
+ break;
+
+ case ED_COUNTER_ID_ENVELOPE_XSIZE:
+ case ED_COUNTER_ID_ENVELOPE_YSIZE:
+ DrawEnvelopeTextArea(-1);
+ break;
+
case ED_COUNTER_ID_LEVEL_XSIZE:
case ED_COUNTER_ID_LEVEL_YSIZE:
lev_fieldx = level.fieldx;
case ED_COUNTER_ID_SELECT_LEVEL:
LoadLevel(level_nr);
+ TapeErase();
ResetUndoBuffer();
DrawEditModeWindow();
break;
default:
break;
}
+
+ if ((counter_id >= ED_COUNTER_ID_CUSTOM_FIRST &&
+ counter_id <= ED_COUNTER_ID_CUSTOM_LAST) ||
+ (counter_id >= ED_COUNTER_ID_CHANGE_FIRST &&
+ counter_id <= ED_COUNTER_ID_CHANGE_LAST))
+ CopyElementPropertiesToGame(properties_element);
}
static void HandleTextInputGadgets(struct GadgetInfo *gi)
{
- strcpy(textinput_info[gi->custom_type_id].value, gi->text.value);
+ int type_id = gi->custom_type_id;
+
+ strcpy(textinput_info[type_id].value, gi->textinput.value);
+
+ if (type_id == ED_TEXTINPUT_ID_ELEMENT_NAME)
+ {
+ CopyElementPropertiesToGame(properties_element);
+
+ ModifyEditorElementList(); /* update changed button info text */
+ }
+}
+
+static void HandleTextAreaGadgets(struct GadgetInfo *gi)
+{
+ int type_id = gi->custom_type_id;
+
+ strcpy(textarea_info[type_id].value, gi->textarea.value);
+}
+
+static void HandleSelectboxGadgets(struct GadgetInfo *gi)
+{
+ int type_id = gi->custom_type_id;
+
+ *selectbox_info[type_id].value =
+ selectbox_info[type_id].options[gi->selectbox.index].value;
+
+ if (type_id == ED_SELECTBOX_ID_SELECT_CHANGE_PAGE)
+ {
+ element_info[properties_element].current_change_page = gi->selectbox.index;
+
+ DrawPropertiesWindow();
+ }
+ else if ((type_id >= ED_SELECTBOX_ID_CUSTOM_FIRST &&
+ type_id <= ED_SELECTBOX_ID_CUSTOM_LAST) ||
+ (type_id >= ED_SELECTBOX_ID_CHANGE_FIRST &&
+ type_id <= ED_SELECTBOX_ID_CHANGE_LAST) ||
+ (type_id == ED_SELECTBOX_ID_GROUP_CHOICE_MODE))
+ CopyElementPropertiesToGame(properties_element);
+}
+
+static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
+{
+ int type_id = gi->custom_type_id;
+ int i;
+
+ if (type_id >= ED_TEXTBUTTON_ID_PROPERTIES_FIRST &&
+ type_id <= ED_TEXTBUTTON_ID_PROPERTIES_LAST)
+ {
+ edit_mode_properties = gi->custom_type_id;
+
+ DrawPropertiesWindow();
+ }
+ else if (type_id == ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE)
+ {
+ char *template_filename = getDefaultLevelFilename(-1);
+ boolean new_template = !fileExists(template_filename);
+
+ if (new_template ||
+ Request("Save this template and kill the old ?", REQ_ASK))
+ SaveLevelTemplate();
+
+ if (new_template)
+ Request("Template saved !", REQ_CONFIRM);
+ }
+ else if (type_id == ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE &&
+ custom_element.num_change_pages < MAX_CHANGE_PAGES)
+ {
+ struct ElementInfo *ei = &element_info[properties_element];
+
+ setElementChangePages(ei, ei->num_change_pages + 1);
+
+ /* set new change page to be new current change page */
+ ei->current_change_page = ei->num_change_pages - 1;
+ ei->change = &ei->change_page[ei->current_change_page];
+
+ setElementChangeInfoToDefaults(ei->change);
+
+ DrawPropertiesWindow();
+ }
+ else if (type_id == ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE &&
+ custom_element.num_change_pages > MIN_CHANGE_PAGES)
+ {
+ struct ElementInfo *ei = &element_info[properties_element];
+
+ /* copy all change pages after change page to be deleted */
+ for (i = ei->current_change_page; i < ei->num_change_pages - 1; i++)
+ ei->change_page[i] = ei->change_page[i + 1];
+
+ setElementChangePages(ei, ei->num_change_pages - 1);
+
+ DrawPropertiesWindow();
+ }
+}
+
+static void HandleGraphicbuttonGadgets(struct GadgetInfo *gi)
+{
+ int type_id = gi->custom_type_id;
+
+ if (type_id == ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE ||
+ type_id == ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE)
+ {
+ struct ElementInfo *ei = &element_info[properties_element];
+ int step = BUTTON_STEPSIZE(gi->event.button);
+
+ step *= (type_id == ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE ? -1 : +1);
+ ei->current_change_page += step;
+
+ if (ei->current_change_page < 0)
+ ei->current_change_page = 0;
+ else if (ei->current_change_page >= ei->num_change_pages)
+ ei->current_change_page = ei->num_change_pages - 1;
+
+ DrawPropertiesWindow();
+ }
}
static void HandleRadiobuttons(struct GadgetInfo *gi)
static void HandleCheckbuttons(struct GadgetInfo *gi)
{
- *checkbutton_info[gi->custom_type_id].value ^= TRUE;
+ int type_id = gi->custom_type_id;
+
+ *checkbutton_info[type_id].value ^= TRUE;
+
+ if (type_id == ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID ||
+ (((type_id >= ED_CHECKBUTTON_ID_CUSTOM_FIRST &&
+ type_id <= ED_CHECKBUTTON_ID_CUSTOM_LAST) ||
+ (type_id >= ED_CHECKBUTTON_ID_CHANGE_FIRST &&
+ type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST)) &&
+ type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE))
+ {
+ CopyElementPropertiesToGame(properties_element);
+ }
+
+ if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC)
+ {
+ UpdateCustomElementGraphicGadgets();
+ }
+ else if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE)
+ {
+ char *template_filename = getDefaultLevelFilename(-1);
+
+ if (level.use_custom_template && !fileExists(template_filename))
+ {
+ Request("No level template found !", REQ_CONFIRM);
+
+ level.use_custom_template = FALSE;
+ ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END);
+
+ return;
+ }
+
+ LoadLevelTemplate(level.use_custom_template ? -1 : level_nr);
+
+ DrawEditModeWindow();
+ }
}
static void HandleControlButtons(struct GadgetInfo *gi)
{
+ static int last_level_drawing_function = GADGET_ID_SINGLE_ITEMS;
+ static int last_edit_mode = ED_MODE_DRAWING;
+ static int last_custom_copy_mode = -1;
int id = gi->custom_id;
int button = gi->event.button;
int step = BUTTON_STEPSIZE(button);
int new_element = BUTTON_ELEMENT(button);
- int i, x, y;
+ int x, y;
if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT)
DrawLevelText(0, 0, 0, TEXT_END);
- if (id < ED_NUM_CTRL1_BUTTONS && id != GADGET_ID_PROPERTIES &&
- edit_mode != ED_MODE_DRAWING)
+ if (id < ED_NUM_CTRL1_BUTTONS &&
+ id != GADGET_ID_SINGLE_ITEMS &&
+ id != GADGET_ID_PROPERTIES &&
+ id != GADGET_ID_PICK_ELEMENT &&
+ edit_mode != ED_MODE_DRAWING &&
+ drawing_function != GADGET_ID_PICK_ELEMENT &&
+ !(GetKeyModState() & KMOD_Control))
{
DrawDrawingWindow();
edit_mode = ED_MODE_DRAWING;
}
+ /* element copy mode active, but no element button pressed => deactivate */
+ if (last_custom_copy_mode != -1 && id < ED_NUM_CTRL_BUTTONS)
+ last_custom_copy_mode = -1;
+
switch (id)
{
case GADGET_ID_SCROLL_LEFT:
if (element_shift < 0)
element_shift = 0;
- if (element_shift > elements_in_list - ED_NUM_ELEMENTLIST_BUTTONS)
- element_shift = elements_in_list - ED_NUM_ELEMENTLIST_BUTTONS;
+ if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
+ element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
GDI_SCROLLBAR_ITEM_POSITION,
element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
}
- for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
- {
- int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
- struct GadgetInfo *gi = level_editor_gadget[gadget_id];
- struct GadgetDesign *gd = &gi->deco.design;
- int element = editor_element[element_shift + i];
+ ModifyEditorElementList();
- UnmapGadget(gi);
- getMiniGraphicSource(el2gfx(element), &gd->bitmap, &gd->x, &gd->y);
- ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
- MapGadget(gi);
- }
break;
case GADGET_ID_WRAP_LEFT:
case GADGET_ID_FLOOD_FILL:
case GADGET_ID_GRAB_BRUSH:
case GADGET_ID_PICK_ELEMENT:
- last_drawing_function = drawing_function;
+ if (drawing_function != GADGET_ID_PICK_ELEMENT)
+ last_drawing_function = drawing_function;
drawing_function = id;
draw_with_brush = FALSE;
break;
properties_element = new_element;
DrawPropertiesWindow();
edit_mode = ED_MODE_PROPERTIES;
+
+ last_level_drawing_function = drawing_function;
+ ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS],
+ MB_LEFTBUTTON);
}
else
{
DrawDrawingWindow();
edit_mode = ED_MODE_DRAWING;
+
+ ClickOnGadget(level_editor_gadget[last_level_drawing_function],
+ MB_LEFTBUTTON);
}
break;
+ case GADGET_ID_CUSTOM_COPY_FROM:
+ case GADGET_ID_CUSTOM_COPY_TO:
+ case GADGET_ID_CUSTOM_EXCHANGE:
+ last_custom_copy_mode = id;
+ last_drawing_function = drawing_function;
+ break;
+
case GADGET_ID_UNDO:
if (undo_buffer_steps == 0)
{
break;
}
+ if (edit_mode != ED_MODE_DRAWING)
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+
undo_buffer_position =
(undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS;
undo_buffer_steps--;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
Feld[x][y] = UndoBuffer[undo_buffer_position][x][y];
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos,level_ypos);
break;
case GADGET_ID_INFO:
if (edit_mode != ED_MODE_INFO)
{
- DrawLevelInfoWindow();
+ last_edit_mode = edit_mode;
edit_mode = ED_MODE_INFO;
+
+ DrawLevelInfoWindow();
}
else
{
- DrawDrawingWindow();
- edit_mode = ED_MODE_DRAWING;
+ edit_mode = last_edit_mode;
+
+ DrawEditModeWindow();
}
break;
case GADGET_ID_CLEAR:
- for(x=0; x<MAX_LEV_FIELDX; x++)
- for(y=0; y<MAX_LEV_FIELDY; y++)
- Feld[x][y] = (button == 1 ? EL_LEERRAUM : new_element);
+ if (edit_mode != ED_MODE_DRAWING)
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
+ Feld[x][y] = (button == 1 ? EL_EMPTY : new_element);
CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
Request("No Level without Gregor Mc Duffin please !", REQ_CONFIRM);
else
{
- if (Request("Save this level and kill the old ?", REQ_ASK))
+ char *level_filename = getDefaultLevelFilename(level_nr);
+ boolean new_level = !fileExists(level_filename);
+
+ if (new_level ||
+ Request("Save this level and kill the old ?", REQ_ASK))
{
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
- Ur[x][y] = Feld[x][y];
+ CopyPlayfield(Feld, level.field);
+
SaveLevel(level_nr);
}
+
+ if (new_level)
+ Request("Level saved !", REQ_CONFIRM);
}
break;
Request("No Level without Gregor Mc Duffin please !", REQ_CONFIRM);
else
{
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
- FieldBackup[x][y] = Ur[x][y];
+ if (LevelChanged())
+ level.game_version = GAME_VERSION_ACTUAL;
- for(x=0; x<lev_fieldx; x++)
- for(y=0; y<lev_fieldy; y++)
- Ur[x][y] = Feld[x][y];
+ CopyPlayfield(level.field, FieldBackup);
+ CopyPlayfield(Feld, level.field);
UnmapLevelEditorGadgets();
UndrawSpecialEditorDoor();
TapeStartRecording();
level_editor_test_game = TRUE;
- game_status = PLAYING;
+ game_status = GAME_MODE_PLAYING;
InitGame();
}
break;
case GADGET_ID_EXIT:
- if (!LevelChanged() ||
- Request("Level has changed! Exit without saving ?",
- REQ_ASK | REQ_STAY_OPEN))
- {
- CloseDoor(DOOR_CLOSE_1);
-
- /*
- CloseDoor(DOOR_CLOSE_ALL);
- */
-
- game_status = MAINMENU;
- DrawMainMenu();
- }
- else
- {
- CloseDoor(DOOR_CLOSE_1);
- BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
- OpenDoor(DOOR_OPEN_1);
- }
+ RequestExitLevelEditor(TRUE); /* if level has changed, ask user */
break;
default:
id <= GADGET_ID_ELEMENTLIST_LAST)
{
int element_position = id - GADGET_ID_ELEMENTLIST_FIRST;
- int new_element = editor_element[element_position + element_shift];
+ int new_element = editor_elements[element_position + element_shift];
+
+ if (last_custom_copy_mode != -1)
+ {
+ if (CopyCustomElement(properties_element, new_element,
+ last_custom_copy_mode))
+ {
+ ClickOnGadget(level_editor_gadget[last_drawing_function],
+ MB_LEFTBUTTON);
+
+ last_custom_copy_mode = -1;
+ }
+
+ break;
+ }
PickDrawingElement(button, new_element);
- if (!HAS_CONTENT(properties_element) ||
- !stick_element_properties_window)
+ if (!stick_element_properties_window &&
+ drawing_function != GADGET_ID_PICK_ELEMENT &&
+ !(GetKeyModState() & KMOD_Control))
{
properties_element = new_element;
if (edit_mode == ED_MODE_PROPERTIES)
DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
else if (key == KSYM_Return)
DrawLevelText(0, 0, 0, TEXT_NEWLINE);
+ else if (key == KSYM_Escape)
+ DrawLevelText(0, 0, 0, TEXT_END);
}
else if (button_status == MB_RELEASED)
{
- int i, id;
+ int i, id = GADGET_ID_NONE;
switch (key)
{
button = MB_RIGHTBUTTON;
break;
+ case KSYM_Escape:
+ if (edit_mode == ED_MODE_DRAWING)
+ {
+ RequestExitLevelEditor(setup.ask_on_escape);
+ }
+ else
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+ break;
+
default:
- id = GADGET_ID_NONE;
break;
}
ClickOnGadget(level_editor_gadget[id], button);
else if (letter == '.')
ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], button);
- else if (key == KSYM_space || key == KSYM_Return)
+ else if (key == KSYM_Return || key == setup.shortcut.toggle_pause)
ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
else
- for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
+ for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
if (letter && letter == control_info[i].shortcut)
if (!anyTextGadgetActive())
ClickOnGadget(level_editor_gadget[i], button);
}
}
+void HandleLevelEditorIdle()
+{
+ static unsigned long action_delay = 0;
+ unsigned long action_delay_value = GameFrameDelay;
+ int xpos = 1, ypos = 2;
+
+ if (edit_mode != ED_MODE_PROPERTIES)
+ return;
+
+ if (!DelayReached(&action_delay, action_delay_value))
+ return;
+
+ DrawGraphicAnimationExt(drawto,
+ SX + xpos * TILEX,
+ SY + ypos * TILEY + MINI_TILEY / 2,
+ el2img(properties_element), -1, NO_MASKING);
+
+ MarkTileDirty(xpos, ypos);
+ MarkTileDirty(xpos, ypos + 1);
+
+ FrameCounter++; /* increase animation frame counter */
+}
+
void ClearEditorGadgetInfoText()
{
- ClearRectangle(drawto,
- INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
- redraw_mask |= REDRAW_FIELD;
+ DrawBackground(INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
}
void HandleEditorGadgetInfoText(void *ptr)
{
struct GadgetInfo *gi = (struct GadgetInfo *)ptr;
- char infotext[MAX_INFOTEXT_LEN + 1];
- char shortcut[MAX_INFOTEXT_LEN + 1];
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ char shortcut[MAX_OUTPUT_LINESIZE + 1];
+ int max_infotext_len = getMaxInfoTextLength();
- if (game_status != LEVELED)
+ if (game_status != GAME_MODE_EDITOR)
return;
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* misuse this function to delete brush cursor, if needed */
if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
DeleteBrushFromCursor();
if (gi == NULL || gi->info_text == NULL)
return;
- strncpy(infotext, gi->info_text, MAX_INFOTEXT_LEN);
- infotext[MAX_INFOTEXT_LEN] = '\0';
+ strncpy(infotext, gi->info_text, max_infotext_len);
+ infotext[max_infotext_len] = '\0';
if (gi->custom_id < ED_NUM_CTRL_BUTTONS)
{
{
if (gi->custom_id == GADGET_ID_SINGLE_ITEMS) /* special case 1 */
sprintf(shortcut, " ('.' or '%c')", key);
- else if (gi->custom_id == GADGET_ID_TEST) /* special case 2 */
+ else if (gi->custom_id == GADGET_ID_PICK_ELEMENT) /* special case 2 */
+ sprintf(shortcut, " ('%c' or 'Ctrl')", key);
+ else if (gi->custom_id == GADGET_ID_TEST) /* special case 3 */
sprintf(shortcut, " ('Enter' or 'Shift-%c')", key);
else /* normal case */
sprintf(shortcut, " ('%s%c')",
(key >= 'A' && key <= 'Z' ? "Shift-" : ""), key);
- if (strlen(infotext) + strlen(shortcut) <= MAX_INFOTEXT_LEN)
+ if (strlen(infotext) + strlen(shortcut) <= max_infotext_len)
strcat(infotext, shortcut);
}
}
- DrawText(INFOTEXT_XPOS, INFOTEXT_YPOS, infotext, FS_SMALL, FC_YELLOW);
+ DrawText(INFOTEXT_XPOS, INFOTEXT_YPOS, infotext, FONT_TEXT_2);
}
static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
{
static int start_lx, start_ly;
- char *infotext;
int id = gi->custom_id;
int sx = gi->event.x;
int sy = gi->event.y;
int min_sx = 0, min_sy = 0;
int max_sx = gi->drawing.area_xsize - 1;
int max_sy = gi->drawing.area_ysize - 1;
+ int actual_drawing_function = drawing_function;
+ int max_infotext_len = getMaxInfoTextLength();
+ char infotext[MAX_OUTPUT_LINESIZE + 1];
+ char *text;
+
+ infotext[0] = '\0'; /* start with empty info text */
+
+ /* pressed Control key: simulate picking element */
+ if (GetKeyModState() & KMOD_Control)
+ actual_drawing_function = GADGET_ID_PICK_ELEMENT;
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* make sure to stay inside drawing area boundaries */
sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);
start_ly = ly;
}
- switch (drawing_function)
+ switch (actual_drawing_function)
{
case GADGET_ID_SINGLE_ITEMS:
- infotext = "Drawing single items";
+ text = "Drawing single items";
break;
case GADGET_ID_CONNECTED_ITEMS:
- infotext = "Drawing connected items";
+ text = "Drawing connected items";
break;
case GADGET_ID_LINE:
- infotext = "Drawing line";
+ text = "Drawing line";
break;
case GADGET_ID_ARC:
- infotext = "Drawing arc";
+ text = "Drawing arc";
break;
case GADGET_ID_TEXT:
- infotext = "Setting text cursor";
+ text = "Setting text cursor";
break;
case GADGET_ID_RECTANGLE:
- infotext = "Drawing rectangle";
+ text = "Drawing rectangle";
break;
case GADGET_ID_FILLED_BOX:
- infotext = "Drawing filled box";
+ text = "Drawing filled box";
break;
case GADGET_ID_FLOOD_FILL:
- infotext = "Flood fill";
+ text = "Flood fill";
break;
case GADGET_ID_GRAB_BRUSH:
- infotext = "Grabbing brush";
+ text = "Grabbing brush";
break;
case GADGET_ID_PICK_ELEMENT:
- infotext = "Picking element";
+ text = "Picking element";
break;
default:
- infotext = "Drawing position";
+ text = "Drawing position";
break;
}
- if (drawing_function == GADGET_ID_PICK_ELEMENT)
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+#if 1
+ if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
+ sprintf(infotext, "%s: %d, %d", text, lx, ly);
+ else
+ sprintf(infotext, "%s: %d, %d", text,
+ ABS(lx - start_lx) + 1, ABS(ly - start_ly) + 1);
+#else
+ if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"%s: %d, %d", infotext, lx, ly);
else
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"%s: %d, %d", infotext,
ABS(lx - start_lx) + 1, ABS(ly - start_ly) + 1);
+#endif
}
- else if (drawing_function == GADGET_ID_PICK_ELEMENT)
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+#if 1
+ else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
+ strncpy(infotext, getElementInfoText(Feld[lx][ly]), max_infotext_len);
+ else
+ sprintf(infotext, "Level position: %d, %d", lx, ly);
+#else
+ else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"%s", getElementInfoText(Feld[lx][ly]));
else
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2,
"Level position: %d, %d", lx, ly);
+#endif
}
/* misuse this function to draw brush cursor, if needed */
DeleteBrushFromCursor();
}
}
- else if (id == GADGET_ID_AMOEBA_CONTENT)
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
- "Amoeba content");
- else if (id == GADGET_ID_RANDOM_BACKGROUND)
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
- "Random placement background");
+ else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT)
+ {
+ int element = EL_EMPTY;
+
+ if (id == GADGET_ID_AMOEBA_CONTENT)
+ element = level.amoeba_content;
+ else if (id == GADGET_ID_CUSTOM_GRAPHIC)
+ element = custom_element.gfx_element;
+ else if (id == GADGET_ID_CUSTOM_CONTENT)
+ element = custom_element.content[sx][sy];
+ else if (id == GADGET_ID_CUSTOM_MOVE_ENTER)
+ element = custom_element.move_enter_element;
+ else if (id == GADGET_ID_CUSTOM_MOVE_LEAVE)
+ element = custom_element.move_leave_element;
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TARGET)
+ element = custom_element_change.target_element;
+ else if (id == GADGET_ID_CUSTOM_CHANGE_CONTENT)
+ element = custom_element_change.content[sx][sy];
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
+ element = custom_element_change.trigger_element;
+ else if (id == GADGET_ID_GROUP_CONTENT)
+ element = group_element_info.element[sx];
+ else if (id == GADGET_ID_RANDOM_BACKGROUND)
+ element = random_placement_background_element;
+ else if (id >= GADGET_ID_ELEMENT_CONTENT_0 &&
+ id <= GADGET_ID_ELEMENT_CONTENT_7)
+ element = level.yamyam_content[id - GADGET_ID_ELEMENT_CONTENT_0][sx][sy];
+
+ strncpy(infotext, getElementInfoText(element), max_infotext_len);
+ }
+ else
+ {
+ if (id == GADGET_ID_AMOEBA_CONTENT)
+ strcpy(infotext, "Amoeba content");
+ else if (id == GADGET_ID_CUSTOM_GRAPHIC)
+ strcpy(infotext, "Custom graphic element");
+ else if (id == GADGET_ID_CUSTOM_CONTENT)
+ sprintf(infotext, "Custom element content position: %d, %d", sx, sy);
+ else if (id == GADGET_ID_CUSTOM_MOVE_ENTER)
+ strcpy(infotext, "Element that can be digged/collected");
+ else if (id == GADGET_ID_CUSTOM_MOVE_LEAVE)
+ strcpy(infotext, "Element that will be left behind");
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TARGET)
+ strcpy(infotext, "New element after change");
+ else if (id == GADGET_ID_CUSTOM_CHANGE_CONTENT)
+ strcpy(infotext, "New extended elements after change");
+ else if (id == GADGET_ID_CUSTOM_CHANGE_TRIGGER)
+ strcpy(infotext, "Other element triggering change");
+ else if (id == GADGET_ID_GROUP_CONTENT)
+ sprintf(infotext, "Group element position: %d", sx + 1);
+ else if (id == GADGET_ID_RANDOM_BACKGROUND)
+ strcpy(infotext, "Random placement background");
+ else if (id >= GADGET_ID_ELEMENT_CONTENT_0 &&
+ id <= GADGET_ID_ELEMENT_CONTENT_7)
+ sprintf(infotext, "Content area %d position: %d, %d",
+ id - GADGET_ID_ELEMENT_CONTENT_0 + 1, sx, sy);
+ }
+
+ infotext[max_infotext_len] = '\0';
+
+ if (strlen(infotext) > 0)
+ DrawTextS(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, infotext);
+}
+
+void RequestExitLevelEditor(boolean ask_if_level_has_changed)
+{
+ if (!ask_if_level_has_changed ||
+ !LevelChanged() ||
+ Request("Level has changed! Exit without saving ?",
+ REQ_ASK | REQ_STAY_OPEN))
+ {
+#if 1
+ CloseDoor(DOOR_CLOSE_1);
+ SetDoorState(DOOR_CLOSE_2);
+#else
+ CloseDoor(DOOR_CLOSE_ALL);
+#endif
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenu();
+ }
else
- DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
- "Content area %d position: %d, %d",
- id - GADGET_ID_ELEM_CONTENT_0 + 1, sx, sy);
+ {
+ CloseDoor(DOOR_CLOSE_1);
+ BlitBitmap(bitmap_db_door, bitmap_db_door,
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ OpenDoor(DOOR_OPEN_1);
+ }
}