From: Holger Schemel Date: Sat, 19 Jul 2003 12:58:23 +0000 (+0200) Subject: rnd-20030719-4-src X-Git-Tag: 3.0.0^2~15 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=370e7bae7b0968128ea650cbdf7f8b46816b7128;p=rocksndiamonds.git rnd-20030719-4-src --- diff --git a/src/conftime.h b/src/conftime.h index 0f93647a..f7a7573d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-07-19 03:57]" +#define COMPILE_DATE_STRING "[2003-07-19 14:57]" diff --git a/src/editor.c b/src/editor.c index a7dafcf9..860b4248 100644 --- a/src/editor.c +++ b/src/editor.c @@ -110,6 +110,12 @@ #define ED_AREA_ELEM_CONTENT_XPOS ( 2 * MINI_TILEX) #define ED_AREA_ELEM_CONTENT_YPOS (22 * MINI_TILEY) +/* yamyam content */ +#define ED_AREA_YAMYAM_CONTENT_XPOS(n) (ED_AREA_ELEM_CONTENT_XPOS + \ + 5 * (n % 4) * MINI_TILEX) +#define ED_AREA_YAMYAM_CONTENT_YPOS(n) (ED_AREA_ELEM_CONTENT_YPOS + \ + 6 * (n / 4) * MINI_TILEY) + /* custom change target */ #define ED_AREA_ELEM_CONTENT2_XPOS (20 * MINI_TILEX) #define ED_AREA_ELEM_CONTENT2_YPOS (ED_SETTINGS_YPOS(2) + \ @@ -603,6 +609,26 @@ #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_CHANGE_TARGET 12 +#define ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT 13 +#define ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER 14 +#define ED_DRAWING_ID_RANDOM_BACKGROUND 15 + +#define ED_NUM_DRAWING_AREAS 16 + /* ----------------------------------------------------------------------------- @@ -1492,6 +1518,138 @@ static struct }, }; +static struct +{ + int x, y; + int area_xsize, area_ysize; + int gadget_id; + char *text_left; +} drawingarea_info[ED_NUM_DRAWING_AREAS] = +{ + /* ---------- level playfield content ------------------------------------ */ + + { + 0, 0, + MAX_ED_FIELDX, MAX_ED_FIELDY, + GADGET_ID_DRAWING_LEVEL, + NULL + }, + + /* ---------- yam yam content -------------------------------------------- */ + + { + ED_AREA_YAMYAM_CONTENT_XPOS(0), ED_AREA_YAMYAM_CONTENT_YPOS(0), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_0, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(1), ED_AREA_YAMYAM_CONTENT_YPOS(1), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_1, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(2), ED_AREA_YAMYAM_CONTENT_YPOS(2), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_2, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(3), ED_AREA_YAMYAM_CONTENT_YPOS(3), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_3, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(4), ED_AREA_YAMYAM_CONTENT_YPOS(4), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_4, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(5), ED_AREA_YAMYAM_CONTENT_YPOS(5), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_5, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(6), ED_AREA_YAMYAM_CONTENT_YPOS(6), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_6, + NULL + }, + { + ED_AREA_YAMYAM_CONTENT_XPOS(7), ED_AREA_YAMYAM_CONTENT_YPOS(7), + 3, 3, + GADGET_ID_ELEMENT_CONTENT_7, + NULL + }, + + /* ---------- amoeba content --------------------------------------------- */ + + { + ED_AREA_ELEM_CONTENT_XPOS, ED_AREA_ELEM_CONTENT_YPOS, + 1, 1, + GADGET_ID_AMOEBA_CONTENT, + NULL + }, + + /* ---------- custom graphic --------------------------------------------- */ + + { + ED_AREA_ELEM_CONTENT3_XPOS, ED_AREA_ELEM_CONTENT3_YPOS, + 1, 1, + GADGET_ID_CUSTOM_GRAPHIC, + NULL + }, + + /* ---------- custom content (when exploding) ---------------------------- */ + + { + ED_AREA_ELEM_CONTENT4_XPOS, ED_AREA_ELEM_CONTENT4_YPOS, + 3, 3, + GADGET_ID_CUSTOM_CONTENT, + NULL + }, + + /* ---------- custom change target --------------------------------------- */ + + { + ED_AREA_ELEM_CONTENT2_XPOS, ED_AREA_ELEM_CONTENT2_YPOS, + 1, 1, + GADGET_ID_CUSTOM_CHANGE_TARGET, + NULL + }, + + /* ---------- custom change content (extended change target) ------------- */ + + { + ED_AREA_ELEM_CONTENT6_XPOS, ED_AREA_ELEM_CONTENT6_YPOS, + 3, 3, + GADGET_ID_CUSTOM_CHANGE_CONTENT, + NULL + }, + + /* ---------- custom change trigger (element causing change) ------------- */ + + { + ED_AREA_ELEM_CONTENT5_XPOS, ED_AREA_ELEM_CONTENT5_YPOS, + 1, 1, + GADGET_ID_CUSTOM_CHANGE_TRIGGER, + NULL + }, + + /* ---------- random background (for random painting) -------------------- */ + + { + ED_AREA_RANDOM_BACKGROUND_XPOS, ED_AREA_RANDOM_BACKGROUND_YPOS, + 1, 1, + GADGET_ID_RANDOM_BACKGROUND, + NULL + }, +}; + /* ----------------------------------------------------------------------------- @@ -2812,47 +2970,26 @@ static void CreateCounterButtons() 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); - - if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); - - level_editor_gadget[id] = gi; - - /* ... up to eight areas for element content ... */ - for (i=0; i= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height) gi->selectbox.current_index = - (my - gi->selectbox.y - gi->border.xsize) / getFontWidth(gi->font); + (my - gi->selectbox.y - gi->border.ysize) / getFontHeight(gi->font); if (gi->selectbox.current_index < 0) gi->selectbox.current_index = 0; @@ -1245,8 +1245,8 @@ void HandleGadgets(int mx, int my, int button) (mx >= gi->x && mx < gi->x + gi->width && my >= gi->y && my < gi->y + gi->height); gadget_released_inside_select_area = - (mx >= gi->selectbox.x && mx < gi->selectbox.x+gi->selectbox.width && - my >= gi->selectbox.y && my < gi->selectbox.y+gi->selectbox.height); + (mx >= gi->selectbox.x && mx < gi->selectbox.x + gi->selectbox.width && + my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height); } else { @@ -1304,7 +1304,7 @@ void HandleGadgets(int mx, int my, int button) /* if mouse moving inside activated selectbox, select value */ if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height) gi->selectbox.current_index = - (my - gi->selectbox.y - gi->border.xsize) / getFontWidth(gi->font); + (my - gi->selectbox.y - gi->border.ysize) / getFontHeight(gi->font); if (gi->selectbox.current_index < 0) gi->selectbox.current_index = 0;