+ 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.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), 0, /* set at runtime */
+ 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_COUNTER_YPOS(4),
+ GADGET_ID_EM_SLIPPERY_GEMS, GADGET_ID_NONE,
+ &level.em_slippery_gems,
+ NULL,
+ "slip down from certain flat walls","use EM style slipping behaviour"
+ },
+
+ /* ---------- element settings: configure (custom elements) ------------- */
+
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
+ 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(2),
+ 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(5),
+ 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(9),
+ 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(9),
+ 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(10),
+ GADGET_ID_CUSTOM_SLIPPERY, GADGET_ID_NONE,
+ &custom_element_properties[EP_SLIPPERY],
+ NULL, NULL, "other elements can fall down from it"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(11),
+ 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(12),
+ 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(13),
+ 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(13),
+ 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(13),
+ 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_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_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(3),
+ 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(5),
+ 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(6),
+ 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(8),
+ 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(9),
+ 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(11),
+ 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(12),
+ GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE,
+ &custom_element_change.use_random_change,
+ NULL, NULL, "use percentage for random replace"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(13),
+ GADGET_ID_CUSTOM_USE_TEMPLATE, GADGET_ID_NONE,
+ &level.use_custom_template,
+ NULL, "use template", "use template for custom properties"
+ },
+};
+
+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_ELEM_CONTENT_XPOS, ED_AREA_ELEM_CONTENT_YPOS,
+ 1, 1,
+ GADGET_ID_AMOEBA_CONTENT, GADGET_ID_NONE,
+ NULL, "content of amoeba", 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 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
+ },
+
+ /* ---------- 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 ModifyEditorElementList();
+static void RedrawDrawingElements();
+static void DrawDrawingWindow();
+static void DrawLevelInfoWindow();
+static void DrawPropertiesWindow();
+static boolean checkPropertiesConfig();
+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 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 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 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_STEELWALL,
+};
+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 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('-'),
+
+ EL_CHAR('M'),
+ EL_CHAR('O'),
+ EL_CHAR('N'),
+ EL_CHAR('D'),
+
+ EL_CHAR('C'),
+ EL_CHAR('A'),
+ EL_CHAR('V'),
+ EL_CHAR('E'),
+
+ EL_CHAR('S'),
+ EL_CHAR(' '),
+ EL_CHAR('I'),
+ EL_CHAR('I'),
+};
+
+static int editor_el_diamond_caves[] =
+{
+ EL_PEARL,
+ EL_CRYSTAL,
+ EL_WALL_PEARL,
+ EL_WALL_CRYSTAL,
+
+ EL_CONVEYOR_BELT_1_LEFT,
+ EL_CONVEYOR_BELT_1_MIDDLE,
+ EL_CONVEYOR_BELT_1_RIGHT,
+ EL_CONVEYOR_BELT_1_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT_2_LEFT,
+ EL_CONVEYOR_BELT_2_MIDDLE,
+ EL_CONVEYOR_BELT_2_RIGHT,
+ EL_CONVEYOR_BELT_2_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT_3_LEFT,
+ EL_CONVEYOR_BELT_3_MIDDLE,
+ EL_CONVEYOR_BELT_3_RIGHT,
+ EL_CONVEYOR_BELT_3_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT_4_LEFT,
+ EL_CONVEYOR_BELT_4_MIDDLE,
+ EL_CONVEYOR_BELT_4_RIGHT,
+ EL_CONVEYOR_BELT_4_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT_1_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_2_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_3_SWITCH_LEFT,
+ EL_CONVEYOR_BELT_4_SWITCH_LEFT,
+
+ 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,
+
+ EL_SIGN_EXCLAMATION,
+ EL_SIGN_STOP,
+ EL_LIGHT_SWITCH,
+ EL_LIGHT_SWITCH_ACTIVE,
+
+ EL_SHIELD_NORMAL,
+ EL_SHIELD_DEADLY,
+ EL_EXTRA_TIME,
+ EL_EMPTY,
+};
+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);
+
+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('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_dx_boulderdash[] =
+{
+ EL_SPRING,
+ EL_TUBE_RIGHT_DOWN,
+ EL_TUBE_HORIZONTAL_DOWN,
+ EL_TUBE_LEFT_DOWN,
+
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERTICAL_RIGHT,
+ EL_TUBE_ANY,
+ EL_TUBE_VERTICAL_LEFT,
+
+ EL_TUBE_VERTICAL,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_HORIZONTAL_UP,
+ EL_TUBE_LEFT_UP,
+
+ EL_TRAP,
+ EL_DX_SUPABOMB,
+ EL_EMPTY,
+ EL_EMPTY
+};
+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('X'),
+ EL_CHAR('T'),
+};
+
+static int editor_el_chars[] =
+{
+ EL_CHAR(' '),
+ EL_CHAR('!'),
+ EL_CHAR('"'),
+ EL_CHAR('#'),
+
+ EL_CHAR('$'),
+ EL_CHAR('%'),
+ EL_CHAR('&'),
+ EL_CHAR('\''),
+
+ EL_CHAR('('),
+ EL_CHAR(')'),
+ EL_CHAR('*'),
+ EL_CHAR('+'),
+
+ EL_CHAR(','),
+ EL_CHAR('-'),
+ EL_CHAR('.'),
+ EL_CHAR('/'),
+
+ EL_CHAR('0'),
+ EL_CHAR('1'),
+ EL_CHAR('2'),
+ EL_CHAR('3'),
+
+ EL_CHAR('4'),
+ EL_CHAR('5'),
+ EL_CHAR('6'),
+ EL_CHAR('7'),
+
+ EL_CHAR('8'),
+ EL_CHAR('9'),
+ EL_CHAR(':'),
+ EL_CHAR(';'),
+
+ EL_CHAR('<'),
+ EL_CHAR('='),
+ EL_CHAR('>'),
+ EL_CHAR('?'),
+
+ EL_CHAR('@'),
+ EL_CHAR('A'),
+ EL_CHAR('B'),
+ EL_CHAR('C'),
+
+ EL_CHAR('D'),
+ EL_CHAR('E'),
+ EL_CHAR('F'),
+ EL_CHAR('G'),
+
+ EL_CHAR('H'),
+ EL_CHAR('I'),
+ EL_CHAR('J'),
+ EL_CHAR('K'),
+
+ EL_CHAR('L'),
+ EL_CHAR('M'),
+ EL_CHAR('N'),
+ EL_CHAR('O'),
+
+ EL_CHAR('P'),
+ EL_CHAR('Q'),
+ EL_CHAR('R'),
+ EL_CHAR('S'),
+
+ EL_CHAR('T'),
+ EL_CHAR('U'),
+ EL_CHAR('V'),
+ EL_CHAR('W'),
+
+ EL_CHAR('X'),
+ EL_CHAR('Y'),
+ EL_CHAR('Z'),
+ EL_CHAR('['),
+
+ EL_CHAR('\\'),
+ EL_CHAR(']'),
+ EL_CHAR('^'),
+ EL_CHAR('_'),
+
+ EL_CHAR('©'),
+ EL_CHAR('Ä'),
+ EL_CHAR('Ö'),
+ EL_CHAR('Ü'),
+
+ EL_CHAR('°'),
+ EL_CHAR('®'),
+ EL_CHAR(FONT_ASCII_CURSOR),
+ EL_CHAR(' ')
+};
+static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
+static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
+
+static int editor_hl_custom[] =
+{
+ EL_CHAR('C'),
+ EL_CHAR('U'),
+ EL_CHAR('S'),
+ EL_CHAR('-'),
+
+ EL_CHAR('T'),
+ EL_CHAR('O'),
+ EL_CHAR('M'),
+ EL_CHAR(' '),
+
+ EL_CHAR('E'),
+ EL_CHAR('L'),
+ EL_CHAR('E'),
+ EL_CHAR('M'),
+
+ EL_CHAR('E'),
+ EL_CHAR('N'),
+ EL_CHAR('T'),
+ EL_CHAR('S'),
+};
+
+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 num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
+static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
+
+static int editor_hl_custom_more[] =
+{
+};
+
+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 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);
+
+static int *editor_elements = NULL; /* dynamically allocated */
+static int num_editor_elements = 0; /* dynamically determined */
+
+static struct
+{
+ boolean *setup_value;
+
+ int *headline_list;
+ int *headline_list_size;
+
+ int *element_list;
+ int *element_list_size;
+
+ boolean last_setup_value;
+}
+editor_elements_info[] =
+{
+ {
+ &setup.editor.el_boulderdash,
+ editor_hl_boulderdash, &num_editor_hl_boulderdash,
+ editor_el_boulderdash, &num_editor_el_boulderdash
+ },
+ {
+ &setup.editor.el_emerald_mine,
+ editor_hl_emerald_mine, &num_editor_hl_emerald_mine,
+ editor_el_emerald_mine, &num_editor_el_emerald_mine
+ },
+ {
+ &setup.editor.el_more,
+ editor_hl_more, &num_editor_hl_more,
+ editor_el_more, &num_editor_el_more
+ },
+ {
+ &setup.editor.el_sokoban,
+ editor_hl_sokoban, &num_editor_hl_sokoban,
+ editor_el_sokoban, &num_editor_el_sokoban
+ },
+ {
+ &setup.editor.el_supaplex,
+ editor_hl_supaplex, &num_editor_hl_supaplex,
+ editor_el_supaplex, &num_editor_el_supaplex
+ },
+ {
+ &setup.editor.el_diamond_caves,
+ editor_hl_diamond_caves, &num_editor_hl_diamond_caves,
+ editor_el_diamond_caves, &num_editor_el_diamond_caves
+ },
+ {
+ &setup.editor.el_dx_boulderdash,
+ editor_hl_dx_boulderdash, &num_editor_hl_dx_boulderdash,
+ editor_el_dx_boulderdash, &num_editor_el_dx_boulderdash
+ },
+ {
+ &setup.editor.el_chars,
+ editor_hl_chars, &num_editor_hl_chars,
+ editor_el_chars, &num_editor_el_chars
+ },
+ {
+ &setup.editor.el_custom,
+ editor_hl_custom, &num_editor_hl_custom,
+ editor_el_custom, &num_editor_el_custom
+ },
+ {
+ &setup.editor.el_custom_more,
+ editor_hl_custom_more, &num_editor_hl_custom_more,
+ editor_el_custom_more, &num_editor_el_custom_more
+ },
+ {
+ NULL,
+ NULL, NULL,
+ NULL, NULL
+ }
+};
+
+
+/*
+ -----------------------------------------------------------------------------
+ functions
+ -----------------------------------------------------------------------------
+*/
+
+static int getMaxInfoTextLength()
+{
+ return (SXSIZE / getFontWidth(FONT_TEXT_2));
+}
+
+static int getTextWidthForGadget(char *text)
+{
+ if (text == NULL)
+ return 0;
+
+ return (getTextWidth(text, FONT_TEXT_1) + ED_GADGET_TEXT_DISTANCE);
+}
+
+static int getTextWidthForDrawingArea(char *text)
+{
+ if (text == NULL)
+ return 0;
+
+ return (getTextWidth(text, FONT_TEXT_1) + ED_DRAWINGAREA_TEXT_DISTANCE);
+}
+
+static int getRightGadgetBorder(struct GadgetInfo *gi, char *text)
+{
+ return (gi->x + gi->width + getTextWidthForGadget(text));
+}
+
+static char *getElementInfoText(int element)
+{
+ char *info_text = NULL;
+
+ 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;
+ }
+
+ if (info_text == NULL)
+ info_text = INFOTEXT_UNKNOWN_ELEMENT;
+
+ return info_text;
+}
+
+static void ReinitializeElementList()
+{
+ static boolean initialized = FALSE;
+ int pos = 0;
+ int i, j;
+
+ if (editor_elements != NULL)
+ free(editor_elements);
+
+ /* do some sanity check for each element from element list at startup */
+ if (!initialized)
+ {
+ 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];
+
+ if (element >= NUM_FILE_ELEMENTS)
+ Error(ERR_WARN, "editor element %d is runtime element", element);
+
+ if (strcmp(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT) == 0)
+ Error(ERR_WARN, "no element description for element %d", element);
+ }
+ }
+
+ initialized = TRUE;
+ }
+
+ num_editor_elements = 0;
+
+ /* 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;
+
+ num_editor_elements += *editor_elements_info[i].element_list_size;
+ }
+ }
+
+ if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
+ {
+ /* workaround: offer at least as many elements as element buttons exist */
+ int list_nr = 1; /* see above: editor_elements_info for Emerald Mine */
+
+ *editor_elements_info[list_nr].setup_value = TRUE;
+ num_editor_elements += *editor_elements_info[list_nr].element_list_size;
+ }
+
+ editor_elements = checked_malloc(num_editor_elements * sizeof(int));
+
+ /* 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];
+
+ for (j=0; j < *editor_elements_info[i].element_list_size; j++)
+ editor_elements[pos++] = editor_elements_info[i].element_list[j];
+ }
+ }
+
+ /* 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;
+}
+
+static void ReinitializeElementListButtons()
+{
+ static boolean last_setup_value_headlines = FALSE;
+ static boolean initialization_needed = TRUE;
+ int i;
+
+ if (!initialization_needed) /* check if editor element setup has changed */
+ {
+ if (last_setup_value_headlines != setup.editor.el_headlines)
+ initialization_needed = TRUE;
+
+ 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;
+ }
+
+ if (!initialization_needed)
+ return;
+
+ FreeLevelEditorGadgets();
+ CreateLevelEditorGadgets();
+
+ /* 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;
+
+ initialization_needed = FALSE;
+}
+
+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 = width / MINI_TILEY + 1;
+ int x, y;
+
+ getMiniGraphicSource(border_graphic, &src_bitmap, &src_x, &src_y);
+
+ 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)
+{
+ struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id];
+ int x, y;
+
+ 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_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_ELEMENT_CONTENT_0 &&
+ id <= ED_DRAWING_ID_ELEMENT_CONTENT_7)
+ {
+ int nr = id - ED_DRAWING_ID_ELEMENT_CONTENT_0;
+
+ 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)
+{
+ int x,y;
+ int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
+ int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0);
+
+ BlitBitmap(drawto, drawto,
+ SX + (dx == -1 ? MINI_TILEX : 0),
+ SY + (dy == -1 ? MINI_TILEY : 0),
+ (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
+ (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
+ SX + (dx == +1 ? MINI_TILEX : 0),
+ SY + (dy == +1 ? MINI_TILEY : 0));
+ if (dx)
+ {
+ x = (dx == 1 ? 0 : ed_fieldx - 1);
+ 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++)
+ DrawMiniElementOrWall(x, y, from_x, from_y);
+ }
+
+ redraw_mask |= REDRAW_FIELD;
+ BackToFront();
+}
+
+static void CreateControlButtons()
+{
+ Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;