#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_XSTART (3 * MINI_TILEX / 2)
#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))
/* how many steps can be cancelled */
#define NUM_UNDO_STEPS (10 + 1)
-/* values for elements with score */
+/* values for elements with score for certain actions */
#define MIN_SCORE 0
#define MAX_SCORE 255
-/* values for elements with gem count */
-#define MIN_GEM_COUNT 0
-#define MAX_GEM_COUNT 100
+/* 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
MIN_SCORE, MAX_SCORE,
GADGET_ID_CUSTOM_SCORE_DOWN, GADGET_ID_CUSTOM_SCORE_UP,
GADGET_ID_CUSTOM_SCORE_TEXT, GADGET_ID_NONE,
- &custom_element.score,
- NULL, "collect score", NULL
+ &custom_element.collect_score,
+ NULL, "score", NULL
},
{
ED_SETTINGS_XPOS(13) + 10, ED_SETTINGS_YPOS(3),
- MIN_GEM_COUNT, MAX_GEM_COUNT,
+ 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.gem_count,
- NULL, "gems", NULL
+ &custom_element.collect_count,
+ NULL, "count", NULL
},
{
ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4),
GADGET_ID_ELEMENT_NAME,
MAX_ELEMENT_NAME_LEN - 2, /* currently 2 chars less editable */
custom_element.description,
- NULL
+ "Element name"
}
};
static struct ValueTextInfo options_walk_to_action[] =
{
{ EP_DIGGABLE, "diggable" },
- { EP_COLLECTIBLE, "collectible" },
+ { EP_COLLECTIBLE_ONLY, "collectible" },
+ { EP_DROPPABLE, "collectible & droppable" },
{ EP_PUSHABLE, "pushable" },
{ -1, NULL }
};
static struct ValueTextInfo options_consistency[] =
{
- { EP_CAN_EXPLODE, "can explode" },
+ { EP_CAN_EXPLODE_3X3, "can explode 3x3" },
+ { EP_CAN_EXPLODE_1X1, "can explode 1x1" },
{ EP_INDESTRUCTIBLE, "indestructible" },
{ -1, NULL }
};
{ CE_TOUCHED_BY_PLAYER, "touched" },
{ CE_PRESSED_BY_PLAYER, "pressed" },
{ CE_PUSHED_BY_PLAYER, "pushed" },
+ { CE_DROPPED_BY_PLAYER, "dropped" },
{ -1, NULL }
};
static struct ValueTextInfo options_change_other_action[] =
{
- { CE_OTHER_IS_TOUCHING, "touching" },
- { CE_OTHER_IS_CHANGING, "change of" },
- { CE_OTHER_IS_EXPLODING, "explosion of" },
- { CE_OTHER_GETS_TOUCHED, "player touches" },
- { CE_OTHER_GETS_PRESSED, "player presses" },
- { CE_OTHER_GETS_PUSHED, "player pushes" },
- { CE_OTHER_GETS_COLLECTED, "player collects" },
- { -1, NULL }
+ { CE_OTHER_IS_TOUCHING, "touching" },
+ { CE_OTHER_IS_CHANGING, "change of" },
+ { CE_OTHER_IS_EXPLODING, "explosion of" },
+ { CE_OTHER_GETS_TOUCHED, "player touches" },
+ { CE_OTHER_GETS_PRESSED, "player presses" },
+ { CE_OTHER_GETS_PUSHED, "player pushes" },
+ { CE_OTHER_GETS_COLLECTED, "player collects" },
+ { CE_OTHER_GETS_DROPPED, "player drops" },
+ { -1, NULL }
};
static struct ValueTextInfo options_change_power[] =
-1,
options_consistency,
&custom_element.consistency,
- NULL, "explodes to:", "consistency/destructibility"
+ NULL, NULL, "consistency/destructibility"
},
/* ---------- element settings: advanced (custom elements) --------------- */
int area_xsize, area_ysize;
int gadget_id;
int gadget_id_align;
- char *text_left, *text_right;
+ 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, 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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, NULL
+ NULL, "content of amoeba", NULL
},
/* ---------- custom graphic --------------------------------------------- */
ED_AREA_ELEM_CONTENT3_XPOS, ED_AREA_ELEM_CONTENT3_YPOS,
1, 1,
GADGET_ID_CUSTOM_GRAPHIC, GADGET_ID_CUSTOM_USE_GRAPHIC,
- NULL, NULL
+ 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 */
- NULL, NULL
+ "content:", NULL, NULL
},
/* ---------- custom change target --------------------------------------- */
ED_AREA_ELEM_CONTENT2_XPOS, ED_AREA_ELEM_CONTENT2_YPOS,
1, 1,
GADGET_ID_CUSTOM_CHANGE_TARGET, GADGET_ID_CUSTOM_CAN_CHANGE,
- NULL, "after/when:"
+ 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, NULL, NULL
},
/* ---------- custom change trigger (element causing change) ------------- */
ED_AREA_ELEM_CONTENT5_XPOS, ED_AREA_ELEM_CONTENT5_YPOS,
1, 1,
GADGET_ID_CUSTOM_CHANGE_TRIGGER, GADGET_ID_CHANGE_OTHER_ACTION,
- NULL, NULL
+ NULL, NULL, NULL
},
/* ---------- random background (for random painting) -------------------- */
ED_AREA_RANDOM_BACKGROUND_XPOS, ED_AREA_RANDOM_BACKGROUND_YPOS,
1, 1,
GADGET_ID_RANDOM_BACKGROUND, GADGET_ID_RANDOM_RESTRICTED,
- NULL, NULL
+ NULL, NULL, NULL
},
};
EL_STEELWALL,
EL_WALL,
- EL_WALL_CRUMBLED,
+ EL_WALL_SLIPPERY,
EL_MAGIC_WALL,
EL_EMERALD,
EL_LANDMINE,
EL_INVISIBLE_SAND,
- EL_STEELWALL_SLANTED,
+ EL_STEELWALL_SLIPPERY,
EL_EMPTY,
EL_SIGN_EXCLAMATION,
};
static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
+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_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 */
&num_editor_el_chars },
{ &setup.editor.el_custom, editor_el_custom,
&num_editor_el_custom },
+ { &setup.editor.el_custom_more, editor_el_custom_more,
+ &num_editor_el_custom_more },
{ NULL, NULL,
NULL }
};
if (*editor_elements_info[i].setup_value)
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()
return (SXSIZE / getFontWidth(FONT_TEXT_2));
}
-static int getFullTextWidth(char *text)
+static int getTextWidthForGadget(char *text)
{
if (text == NULL)
return 0;
- return (strlen(text) * getFontWidth(FONT_TEXT_1) + ED_GADGET_TEXT_DISTANCE);
+ 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 + getFullTextWidth(text));
+ return (gi->x + gi->width + getTextWidthForGadget(text));
}
static char *getElementInfoText(int element)
return info_text;
}
+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;
/* determine horizontal offset for leading text */
if (counterbutton_info[i].text_left != NULL)
- x += (getFontWidth(FONT_TEXT_1) * strlen(counterbutton_info[i].text_left)
- + ED_GADGET_TEXT_DISTANCE);
+ x += getTextWidthForGadget(counterbutton_info[i].text_left);
for (j=0; j<2; j++)
{
/* 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_GADGET_TEXT_DISTANCE + MINI_TILEX / 2);
+ ED_DRAWINGAREA_TEXT_DISTANCE);
/* determine horizontal offset for leading text */
if (drawingarea_info[i].text_left != NULL)
- x += (getFontWidth(FONT_TEXT_1) * strlen(drawingarea_info[i].text_left) +
- ED_GADGET_TEXT_DISTANCE + MINI_TILEX / 2);
+ x += getTextWidthForDrawingArea(drawingarea_info[i].text_left);
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
/* determine horizontal offset for leading text */
if (selectbox_info[i].text_left != NULL)
- x += (getFontWidth(FONT_TEXT_1) * strlen(selectbox_info[i].text_left) +
- ED_GADGET_TEXT_DISTANCE);
+ x += getTextWidthForGadget(selectbox_info[i].text_left);
sprintf(infotext, "Select %s", selectbox_info[i].infotext);
infotext[max_infotext_len] = '\0';
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, getFontWidth(FONT_INPUT_1),
+ GDI_BORDER_SIZE_SELECTBUTTON, ED_SELECTBOX_BUTTON_XSIZE,
GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
/* determine horizontal offset for leading text */
if (checkbutton_info[i].text_left != NULL)
- x += (getFontWidth(FONT_TEXT_1) * strlen(checkbutton_info[i].text_left) +
- ED_GADGET_TEXT_DISTANCE);
+ x += getTextWidthForGadget(checkbutton_info[i].text_left);
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
/* determine horizontal offset for leading text */
if (radiobutton_info[i].text_left != NULL)
- x += (getFontWidth(FONT_TEXT_1) * strlen(radiobutton_info[i].text_left) +
- ED_GADGET_TEXT_DISTANCE);
+ x += getTextWidthForGadget(radiobutton_info[i].text_left);
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
int xoffset_right = getCounterGadgetWidth();
int yoffset_right = ED_BORDER_SIZE;
#else
- int xoffset_left = getFullTextWidth(counterbutton_info[id].text_left);
+ 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;
static void MapDrawingArea(int id)
{
- MapGadget(level_editor_gadget[drawingarea_info[id].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)
{
+ struct GadgetInfo *gi = level_editor_gadget[textinput_info[id].gadget_id];
char infotext[MAX_OUTPUT_LINESIZE + 1];
int max_infotext_len = getMaxInfoTextLength();
int xoffset_above = 0;
DrawTextF(x, y, FONT_TEXT_1, infotext);
}
- ModifyGadget(level_editor_gadget[textinput_info[id].gadget_id],
- GDI_TEXT_VALUE, textinput_info[id].value, GDI_END);
+ ModifyGadget(gi, GDI_TEXT_VALUE, textinput_info[id].value, GDI_END);
- MapGadget(level_editor_gadget[textinput_info[id].gadget_id]);
+ MapGadget(gi);
}
static void MapSelectboxGadget(int id)
{
struct GadgetInfo *gi = level_editor_gadget[selectbox_info[id].gadget_id];
-#if 0
- int xoffset_left = 0;
- int yoffset_left = ED_BORDER_SIZE;
- int xoffset_right = ED_GADGET_TEXT_DISTANCE;
- int yoffset_right = ED_BORDER_SIZE;
- int x = selectbox_info[id].x + xoffset_left;
- int y = selectbox_info[id].y + yoffset_left;
-#else
- int xoffset_left = getFullTextWidth(selectbox_info[id].text_left);
+ 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;
-#endif
if (selectbox_info[id].text_left)
DrawText(x_left, y, selectbox_info[id].text_left, FONT_TEXT_1);
ModifyEditorSelectbox(id, *selectbox_info[id].value);
- MapGadget(level_editor_gadget[selectbox_info[id].gadget_id]);
+ MapGadget(gi);
}
static void MapTextbuttonGadget(int id)
{
- MapGadget(level_editor_gadget[textbutton_info[id].gadget_id]);
+ struct GadgetInfo *gi = level_editor_gadget[textbutton_info[id].gadget_id];
+
+ MapGadget(gi);
}
static void MapRadiobuttonGadget(int id)
int x = radiobutton_info[id].x + xoffset_right;
int y = radiobutton_info[id].y + yoffset_right;
#else
- int xoffset_left = getFullTextWidth(checkbutton_info[id].text_left);
+ 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;
if (radiobutton_info[id].text_right)
DrawText(x_right, y, radiobutton_info[id].text_right, FONT_TEXT_1);
- ModifyGadget(level_editor_gadget[radiobutton_info[id].gadget_id],
- GDI_CHECKED, checked, GDI_END);
+ ModifyGadget(gi, GDI_CHECKED, checked, GDI_END);
- MapGadget(level_editor_gadget[radiobutton_info[id].gadget_id]);
+ MapGadget(gi);
}
static void MapCheckbuttonGadget(int id)
int x = checkbutton_info[id].x + xoffset_right;
int y = checkbutton_info[id].y + yoffset_right;
#else
- int xoffset_left = getFullTextWidth(checkbutton_info[id].text_left);
+ 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;
#endif
/* special case needed for "sticky" gadget */
- ModifyGadget(level_editor_gadget[checkbutton_info[id].gadget_id],
- GDI_CHECKED, *checkbutton_info[id].value,
+ ModifyGadget(gi, GDI_CHECKED, *checkbutton_info[id].value,
GDI_Y, SY + checkbutton_info[id].y, GDI_END);
y = gi->y + yoffset;
if (checkbutton_info[id].text_right)
DrawText(x_right, y, checkbutton_info[id].text_right, FONT_TEXT_1);
- MapGadget(level_editor_gadget[checkbutton_info[id].gadget_id]);
+ MapGadget(gi);
}
static void MapMainDrawingArea()
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 CopyCustomElementPropertiesToEditor(int element)
{
int i;
custom_element = element_info[element];
+ /* 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);
/* set walk-to-object action selectbox help value */
custom_element.walk_to_action =
(IS_DIGGABLE(element) ? EP_DIGGABLE :
- IS_COLLECTIBLE(element) ? EP_COLLECTIBLE :
+ 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(element) ||
+ IS_COLLECTIBLE_ONLY(element) ||
+ IS_DROPPABLE(element) ||
IS_PUSHABLE(element));
/* set smash targets selectbox help value */
/* set consistency selectbox help value */
custom_element.consistency =
(IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE :
- CAN_EXPLODE(element) ? EP_CAN_EXPLODE :
+ CAN_EXPLODE_1X1(element) ? EP_CAN_EXPLODE_1X1 :
+ CAN_EXPLODE_3X3(element) ? EP_CAN_EXPLODE_3X3 :
custom_element.consistency);
custom_element_properties[EP_EXPLODE_RESULT] =
(IS_INDESTRUCTIBLE(element) ||
- CAN_EXPLODE(element));
+ CAN_EXPLODE_1X1(element) ||
+ CAN_EXPLODE_3X3(element));
/* special case: sub-settings dependent from main setting */
if (CAN_EXPLODE_BY_FIRE(element))
/* set change by player selectbox help value */
custom_element.change_player_action =
- (HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
+ (HAS_CHANGE_EVENT(element, CE_DROPPED_BY_PLAYER) ? CE_DROPPED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
custom_element.change_player_action);
/* set change by other element action selectbox help value */
custom_element.change_other_action =
- (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_GETS_COLLECTED) ? CE_OTHER_GETS_COLLECTED :
HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PUSHED) ? CE_OTHER_GETS_PUSHED :
HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PRESSED) ? CE_OTHER_GETS_PRESSED :
HAS_CHANGE_EVENT(element, CE_OTHER_GETS_TOUCHED) ? CE_OTHER_GETS_TOUCHED :
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 tem- plate ?", REQ_ASK))
}
else
{
- LoadLevelTemplate(-1);
+ LoadLevelTemplate(-1); /* this resets all element modifications ... */
- DrawEditModeWindow();
+ DrawEditModeWindow(); /* ... and copies them to 'custom_element' */
}
}
/* set walk-to-object property from checkbox and selectbox */
custom_element_properties[EP_DIGGABLE] = FALSE;
- custom_element_properties[EP_COLLECTIBLE] = 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 consistency property from checkbox and selectbox */
custom_element_properties[EP_INDESTRUCTIBLE] = FALSE;
- custom_element_properties[EP_CAN_EXPLODE] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_1X1] = FALSE;
+ custom_element_properties[EP_CAN_EXPLODE_3X3] = 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[EP_EXPLODE_RESULT];
/* special case: sub-settings dependent from main setting */
- if (custom_element_properties[EP_CAN_EXPLODE])
+ if (custom_element_properties[EP_CAN_EXPLODE_3X3] ||
+ custom_element_properties[EP_CAN_EXPLODE_1X1])
{
custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] =
custom_element.can_explode_by_fire;
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_DROPPED_BY_PLAYER] = FALSE;
custom_element_change_events[custom_element.change_player_action] =
custom_element_change_events[CE_BY_PLAYER];
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_COLLECTED] = FALSE;
+ custom_element_change_events[CE_OTHER_GETS_DROPPED] = FALSE;
custom_element_change_events[custom_element.change_other_action] =
custom_element_change_events[CE_BY_OTHER];
{
int gadget_id = selectbox_info[selectbox_id].gadget_id;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
- 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;
+ int new_index_value = SetSelectboxValue(selectbox_id, new_value);
ModifyGadget(gi, GDI_SELECTBOX_INDEX, new_index_value, GDI_END);
}
MapMainDrawingArea();
}
-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 DrawRandomPlacementBackgroundArea()
-{
- struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_RANDOM_BACKGROUND];
-#if 0
- 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;
-#endif
-
- DrawElementBorder(gi->x, gi->y, MINI_TILEX, MINI_TILEY, TRUE);
- DrawMiniElement(gi->x, gi->y, random_placement_background_element);
-
- MapDrawingArea(ED_DRAWING_ID_RANDOM_BACKGROUND);
-}
-
static void DrawLevelInfoWindow()
{
int i;
MapTextInputGadget(i);
/* draw drawing area */
- DrawRandomPlacementBackgroundArea();
-}
-
-static void DrawAmoebaContentArea()
-{
- 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;
-
- DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE);
- DrawMiniElement(area_x, area_y, level.amoeba_content);
-
- DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba", FONT_TEXT_1);
-
- MapDrawingArea(ED_DRAWING_ID_AMOEBA_CONTENT);
-}
-
-static void DrawCustomGraphicElementArea()
-{
- struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_GRAPHIC];
-#if 0
- int xpos = ED_AREA_ELEM_CONTENT3_XPOS;
- int ypos = ED_AREA_ELEM_CONTENT3_YPOS;
- int area_sx = SX + xpos;
- int area_sy = SY + ypos;
-#endif
-
- if (!IS_CUSTOM_ELEMENT(properties_element))
- {
- /* this should never happen */
- Error(ERR_WARN, "element %d is no custom element", properties_element);
-
- return;
- }
-
- DrawElementBorder(gi->x, gi->y, MINI_TILEX, MINI_TILEY, TRUE);
- DrawMiniGraphicExt(drawto, gi->x, gi->y,
- el2edimg(custom_element.gfx_element));
-
- MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
+ MapDrawingArea(ED_DRAWING_ID_RANDOM_BACKGROUND);
}
static void DrawCustomContentArea()
{
- struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CONTENT];
-#if 0
- int area_sx = SX + ED_AREA_ELEM_CONTENT4_XPOS;
- int area_sy = SY + ED_AREA_ELEM_CONTENT4_YPOS;
-#endif
+ 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_GADGET_TEXT_DISTANCE + MINI_TILEX / 2;
- int x, y;
-
- if (!IS_CUSTOM_ELEMENT(properties_element))
- {
- /* this should never happen */
- Error(ERR_WARN, "element %d is no custom element", properties_element);
+ int xoffset = ED_DRAWINGAREA_TEXT_DISTANCE;
- return;
- }
+ /* 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);
- DrawElementBorder(gi->x, gi->y, 3 * MINI_TILEX, 3 * MINI_TILEY, TRUE);
-
- 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]));
-
MapDrawingArea(ED_DRAWING_ID_CUSTOM_CONTENT);
}
-static void DrawCustomChangeTargetArea()
-{
- int id = ED_DRAWING_ID_CUSTOM_CHANGE_TARGET;
- int gadget_id = drawingarea_info[id].gadget_id;
- struct GadgetInfo *gi = level_editor_gadget[gadget_id];
-#if 0
- int xpos = ED_AREA_ELEM_CONTENT2_XPOS;
- int ypos = ED_AREA_ELEM_CONTENT2_YPOS;
- int area_sx = SX + xpos;
- int area_sy = SY + ypos;
-#endif
- int xoffset_left = 0;
- int yoffset_left = ED_BORDER_AREA_YSIZE;
- int xoffset_right = ED_GADGET_TEXT_DISTANCE + MINI_TILEX / 2;
- int yoffset_right = ED_BORDER_AREA_YSIZE;
- int x = drawingarea_info[id].x + xoffset_left;
- int y = drawingarea_info[id].y + yoffset_left;
-
- if (!IS_CUSTOM_ELEMENT(properties_element))
- {
- /* this should never happen */
- Error(ERR_WARN, "element %d is no custom element", properties_element);
-
- return;
- }
-
- DrawElementBorder(gi->x, gi->y, MINI_TILEX, MINI_TILEY, TRUE);
- DrawMiniGraphicExt(drawto, gi->x, gi->y,
- el2edimg(custom_element.change.target_element));
-
- MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
-
- if (drawingarea_info[id].text_left)
- DrawTextF(x, y, FONT_TEXT_1, drawingarea_info[id].text_left);
-
- if (drawingarea_info[id].text_right)
- {
- x = gi->x + gi->width + xoffset_right;
- y = SY + drawingarea_info[id].y + yoffset_right;
-
- DrawText(x, y, drawingarea_info[id].text_right, FONT_TEXT_1);
- }
-}
-
static void DrawCustomChangeContentArea()
{
- struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CHANGE_CONTENT];
-#if 0
- int area_sx = SX + ED_AREA_ELEM_CONTENT6_XPOS;
- int area_sy = SY + ED_AREA_ELEM_CONTENT6_YPOS;
-#endif
+ 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_GADGET_TEXT_DISTANCE + MINI_TILEX / 2;
- int x, y;
-
- if (!IS_CUSTOM_ELEMENT(properties_element))
- {
- /* this should never happen */
- Error(ERR_WARN, "element %d is no custom element", properties_element);
-
- return;
- }
+ int xoffset = ED_DRAWINGAREA_TEXT_DISTANCE;
ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
- DrawElementBorder(gi->x, gi->y, 3 * MINI_TILEX, 3 * MINI_TILEY, TRUE);
-
- 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]));
-
- MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT);
-}
-
-static void DrawCustomChangeTriggerArea()
-{
- struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CHANGE_TRIGGER];
-#if 0
- int xpos = ED_AREA_ELEM_CONTENT5_XPOS;
- int ypos = ED_AREA_ELEM_CONTENT5_YPOS;
- int area_sx = SX + xpos;
- int area_sy = SY + ypos;
-#endif
-
- if (!IS_CUSTOM_ELEMENT(properties_element))
- {
- /* this should never happen */
- Error(ERR_WARN, "element %d is no custom element", properties_element);
-
- return;
- }
-
- DrawElementBorder(gi->x, gi->y, MINI_TILEX, MINI_TILEY, TRUE);
- DrawMiniGraphicExt(drawto, gi->x, gi->y,
- el2edimg(custom_element.change.trigger_element));
-
- MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
+ MapDrawingArea(id);
}
static void DrawElementContentAreas()
{
- 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 i, x, y;
-
- for (i=0; i<MAX_ELEMENT_CONTENTS; i++)
- UnmapDrawingArea(GADGET_ID_ELEMENT_CONTENT_0 + i);
+ 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);
- /* delete content areas in case of reducing number of them */
- DrawBackground(SX, area_sy - MINI_TILEX, SXSIZE, 12 * MINI_TILEY);
-
- for (i=0; i<level.num_yamyam_contents; i++)
- DrawElementBorder(area_sx + 5 * (i % 4) * MINI_TILEX,
- area_sy + 6 * (i / 4) * MINI_TILEY,
- 3 * MINI_TILEX, 3 * MINI_TILEY, TRUE);
-
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
- "Content", FONT_TEXT_1);
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 1 * MINI_TILEY + 1,
- "when", FONT_TEXT_1);
- DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 2 * MINI_TILEY + 1,
- "smashed", FONT_TEXT_1);
-
- for (i=0; i<level.num_yamyam_contents; i++)
+ for (i=0; i < MAX_ELEMENT_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,
- level.yamyam_content[i][x][y]);
+ 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);
- 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_TEXT_1, "%d", i + 1);
+ /* 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_TILEX + ED_GADGET_TEXT_DISTANCE + font_height);
+ }
}
- for (i=0; i<level.num_yamyam_contents; i++)
- MapDrawingArea(ED_DRAWING_ID_ELEMENT_CONTENT_0 + i);
+ 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);
}
char *getElementDescriptionFilename(int element)
{ EP_PASSABLE_INSIDE, "- player can pass through it" },
{ EP_PASSABLE_UNDER, "- player can pass under it" },
- { EP_DIGGABLE, "- diggable" },
- { EP_COLLECTIBLE, "- collectible" },
- { EP_PUSHABLE, "- pushable" },
+ { EP_DIGGABLE, "- can be digged away" },
+ { EP_COLLECTIBLE, "- can be collected" },
+ { EP_DROPPABLE, "- can be dropped after collecting" },
+ { EP_PUSHABLE, "- can be pushed" },
{ EP_CAN_MOVE, "- can move" },
{ EP_CAN_FALL, "- can fall" },
MapCheckbuttonGadget(i);
if (IS_AMOEBOID(properties_element))
- DrawAmoebaContentArea();
+ MapDrawingArea(ED_DRAWING_ID_AMOEBA_CONTENT);
else
DrawElementContentAreas();
}
static void DrawPropertiesAdvancedDrawingAreas()
{
- DrawCustomGraphicElementArea();
- DrawCustomChangeTargetArea();
- DrawCustomChangeTriggerArea();
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TARGET);
+ MapDrawingArea(ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER);
+
DrawCustomChangeContentArea();
redraw_mask |= REDRAW_FIELD;