#define ED_AREA_ELEM_CONTENT3_YPOS (ED_SETTINGS_YPOS(2) + \
ED_GADGET_DISTANCE)
+#define ED_AREA_ELEM_CONTENT4_XPOS (17 * MINI_TILEX)
+#define ED_AREA_ELEM_CONTENT4_YPOS (ED_SETTINGS_YPOS(8) + \
+ ED_GADGET_DISTANCE - MINI_TILEY)
+
/* 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)
#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_CHANGED (GADGET_ID_DRAWING_AREA_FIRST + 11)
-#define GADGET_ID_RANDOM_BACKGROUND (GADGET_ID_DRAWING_AREA_FIRST + 12)
+#define GADGET_ID_CUSTOM_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 11)
+#define GADGET_ID_CUSTOM_CHANGED (GADGET_ID_DRAWING_AREA_FIRST + 12)
+#define GADGET_ID_RANDOM_BACKGROUND (GADGET_ID_DRAWING_AREA_FIRST + 13)
/* text input identifiers */
-#define GADGET_ID_TEXT_INPUT_FIRST (GADGET_ID_DRAWING_AREA_FIRST + 13)
+#define GADGET_ID_TEXT_INPUT_FIRST (GADGET_ID_DRAWING_AREA_FIRST + 14)
#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_EM_SLIPPERY_GEMS (GADGET_ID_CHECKBUTTON_FIRST + 6)
#define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 7)
#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 8)
-#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 9)
-#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 10)
-#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 11)
-#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 12)
-#define GADGET_ID_CUSTOM_WALKABLE (GADGET_ID_CHECKBUTTON_FIRST + 13)
-#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 14)
-#define GADGET_ID_CUSTOM_CHANGEABLE (GADGET_ID_CHECKBUTTON_FIRST + 15)
-#define GADGET_ID_CHANGE_DELAY_FIXED (GADGET_ID_CHECKBUTTON_FIRST + 16)
-#define GADGET_ID_CHANGE_DELAY_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 17)
+#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 9)
+#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 10)
+#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 11)
+#define GADGET_ID_CUSTOM_CAN_EXPLODE (GADGET_ID_CHECKBUTTON_FIRST + 12)
+#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 13)
+#define GADGET_ID_CUSTOM_WALKABLE (GADGET_ID_CHECKBUTTON_FIRST + 14)
+#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 15)
+#define GADGET_ID_CUSTOM_CHANGEABLE (GADGET_ID_CHECKBUTTON_FIRST + 16)
+#define GADGET_ID_CHANGE_DELAY_FIXED (GADGET_ID_CHECKBUTTON_FIRST + 17)
+#define GADGET_ID_CHANGE_DELAY_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 18)
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 18)
+#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 19)
#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS 4
#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 5
#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 6
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 7
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 8
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 9
-#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 10
-#define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE 11
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 12
-#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE 13
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED 14
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM 15
-
-#define ED_NUM_CHECKBUTTONS 16
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE 7
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 8
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 9
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE 10
+#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 11
+#define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE 12
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 13
+#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE 14
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED 15
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM 16
+
+#define ED_NUM_CHECKBUTTONS 17
#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED
#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
NULL, "diggable, collectible or pushable"
},
{
- ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(9),
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(10),
GADGET_ID_CUSTOM_WALKABLE_LAYER,
0,
options_walkable_layer, &index_walkable_layer,
0,
options_time_units, &index_time_units,
&custom_element.change.delay_frames,
- "delay units given in", "time units for change"
+ "delay time given in", "delay time units for change"
},
{
ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(8),
},
{
ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(5),
+ GADGET_ID_CUSTOM_CAN_MOVE,
+ &custom_element_properties[EP_CAN_MOVE],
+ "can move", "element can move in some direction"
+ },
+ {
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(6),
GADGET_ID_CUSTOM_CAN_FALL,
&custom_element_properties[EP_CAN_FALL],
"can fall", "element can fall down"
},
{
- ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(6),
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(7),
GADGET_ID_CUSTOM_CAN_SMASH,
&custom_element_properties[EP_CAN_SMASH],
"can smash", "element can smash other elements"
},
{
- ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(7),
- GADGET_ID_CUSTOM_CAN_MOVE,
- &custom_element_properties[EP_CAN_MOVE],
- "can move", "element can move in some direction"
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(8),
+ GADGET_ID_CUSTOM_CAN_EXPLODE,
+ &custom_element_properties[EP_CAN_EXPLODE],
+ "can explode to:", "element can explode to other elements"
},
{
- ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(8),
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(9),
GADGET_ID_CUSTOM_SLIPPERY,
&custom_element_properties[EP_SLIPPERY],
"slippery", "other elements can fall down from it"
},
{
- ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(9),
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(10),
GADGET_ID_CUSTOM_WALKABLE,
&custom_element_properties[EP_WALKABLE],
NULL, "player can walk on the same field"
level_editor_gadget[id] = gi;
+ /* ... one areas for custom element explosion content ... */
+ id = GADGET_ID_CUSTOM_CONTENT;
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_CUSTOM_TYPE_ID, i,
+ GDI_X, SX + ED_AREA_ELEM_CONTENT4_XPOS,
+ GDI_Y, SX + ED_AREA_ELEM_CONTENT4_YPOS,
+ GDI_WIDTH, 3 * MINI_TILEX,
+ GDI_HEIGHT, 3 * 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;
+
/* ... one for each custom element change target element ... */
id = GADGET_ID_CUSTOM_CHANGED;
gi = CreateGadget(GDI_CUSTOM_ID, id,
MapDrawingArea(GADGET_ID_CUSTOM_GRAPHIC);
}
+static void DrawCustomContentArea()
+{
+ struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CONTENT];
+ int area_sx = SX + ED_AREA_ELEM_CONTENT4_XPOS;
+ int area_sy = SY + ED_AREA_ELEM_CONTENT4_YPOS;
+ 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;
+ }
+
+ for (y=0; y<3; y++)
+ for (x=0; x<3; x++)
+ ElementContent[0][x][y] = custom_element.content[x][y];
+
+ DrawElementBorder(area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY, TRUE);
+
+ for (y=0; y<3; y++)
+ for (x=0; x<3; x++)
+#if 1
+ DrawMiniGraphicExt(drawto,
+ gi->x + x * MINI_TILEX,
+ gi->y + y * MINI_TILEY,
+ el2edimg(ElementContent[0][0][0]));
+#else
+ DrawMiniElement(area_x + x, area_y + y, ElementContent[0][x][y]);
+#endif
+
+ MapDrawingArea(GADGET_ID_CUSTOM_CONTENT);
+}
+
static void DrawCustomChangedArea()
{
struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CHANGED];
MapCheckbuttonGadget(i);
if (IS_CUSTOM_ELEMENT(properties_element))
+ {
DrawCustomGraphicElementArea();
+ DrawCustomContentArea();
+ }
else if (IS_AMOEBOID(properties_element))
DrawAmoebaContentArea();
else
#define EP_UNUSED_4 4
#define EP_INDESTRUCTIBLE 5
#define EP_SLIPPERY 6
-#define EP_UNUSED_7 7
-#define EP_UNUSED_8 8
+#define EP_CAN_EXPLODE 7
+#define EP_CAN_MOVE 8
#define EP_CAN_FALL 9
#define EP_CAN_SMASH 10
#define EP_WALKABLE_OVER 11
/* values for pre-defined properties */
#define EP_PLAYER 27
-#define EP_CAN_MOVE 28
-#define EP_CAN_PASS_MAGIC_WALL 29
-#define EP_SWITCHABLE 30
-#define EP_DONT_TOUCH 31
-#define EP_ENEMY 32
-#define EP_DONT_GO_TO 33
-#define EP_CAN_EXPLODE 34
-#define EP_BD_ELEMENT 35
-#define EP_SP_ELEMENT 36
-#define EP_SB_ELEMENT 37
-#define EP_GEM 38
-#define EP_FOOD_DARK_YAMYAM 39
-#define EP_FOOD_PENGUIN 40
-#define EP_FOOD_PIG 41
-#define EP_HISTORIC_WALL 42
-#define EP_HISTORIC_SOLID 43
-#define EP_BELT 44
-#define EP_BELT_ACTIVE 45
-#define EP_BELT_SWITCH 46
-#define EP_TUBE 47
-#define EP_KEYGATE 48
-#define EP_AMOEBOID 49
-#define EP_AMOEBALIVE 50
-#define EP_HAS_CONTENT 51
-#define EP_ACTIVE_BOMB 52
-#define EP_INACTIVE 53
+#define EP_CAN_PASS_MAGIC_WALL 28
+#define EP_SWITCHABLE 29
+#define EP_DONT_TOUCH 30
+#define EP_ENEMY 31
+#define EP_DONT_GO_TO 32
+#define EP_BD_ELEMENT 33
+#define EP_SP_ELEMENT 34
+#define EP_SB_ELEMENT 35
+#define EP_GEM 36
+#define EP_FOOD_DARK_YAMYAM 37
+#define EP_FOOD_PENGUIN 38
+#define EP_FOOD_PIG 39
+#define EP_HISTORIC_WALL 40
+#define EP_HISTORIC_SOLID 41
+#define EP_BELT 42
+#define EP_BELT_ACTIVE 43
+#define EP_BELT_SWITCH 44
+#define EP_TUBE 45
+#define EP_KEYGATE 46
+#define EP_AMOEBOID 47
+#define EP_AMOEBALIVE 48
+#define EP_HAS_CONTENT 49
+#define EP_ACTIVE_BOMB 50
+#define EP_INACTIVE 51
/* values for derived properties (determined from properties above) */
-#define EP_ACCESSIBLE_OVER 54
-#define EP_ACCESSIBLE_INSIDE 55
-#define EP_ACCESSIBLE_UNDER 56
-#define EP_WALKABLE 57
-#define EP_PASSABLE 58
-#define EP_ACCESSIBLE 59
-#define EP_SNAPPABLE 60
-#define EP_WALL 61
-#define EP_SOLID_FOR_PUSHING 62
-#define EP_DRAGONFIRE_PROOF 63
-#define EP_EXPLOSION_PROOF 64
+#define EP_ACCESSIBLE_OVER 52
+#define EP_ACCESSIBLE_INSIDE 53
+#define EP_ACCESSIBLE_UNDER 54
+#define EP_WALKABLE 55
+#define EP_PASSABLE 56
+#define EP_ACCESSIBLE 57
+#define EP_SNAPPABLE 58
+#define EP_WALL 59
+#define EP_SOLID_FOR_PUSHING 60
+#define EP_DRAGONFIRE_PROOF 61
+#define EP_EXPLOSION_PROOF 62
/* values for internal purpose only (level editor) */
-#define EP_WALK_TO_OBJECT 65
+#define EP_WALK_TO_OBJECT 63
-#define NUM_ELEMENT_PROPERTIES 66
+#define NUM_ELEMENT_PROPERTIES 64
#define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32)
#define EP_BITFIELD_BASE 0
#define IS_COLLECTIBLE(e) HAS_PROPERTY(e, EP_COLLECTIBLE)
#define IS_INDESTRUCTIBLE(e) HAS_PROPERTY(e, EP_INDESTRUCTIBLE)
#define IS_SLIPPERY(e) HAS_PROPERTY(e, EP_SLIPPERY)
+#define CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE)
+#define CAN_MOVE(e) HAS_PROPERTY(e, EP_CAN_MOVE)
#define CAN_FALL(e) HAS_PROPERTY(e, EP_CAN_FALL)
#define CAN_SMASH(e) HAS_PROPERTY(e, EP_CAN_SMASH)
#define IS_WALKABLE_OVER(e) HAS_PROPERTY(e, EP_WALKABLE_OVER)
/* macros for pre-defined properties */
#define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER)
-#define CAN_MOVE(e) HAS_PROPERTY(e, EP_CAN_MOVE)
#define CAN_PASS_MAGIC_WALL(e) HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
#define IS_SWITCHABLE(e) HAS_PROPERTY(e, EP_SWITCHABLE)
#define DONT_TOUCH(e) HAS_PROPERTY(e, EP_DONT_TOUCH)
#define IS_ENEMY(e) HAS_PROPERTY(e, EP_ENEMY)
#define DONT_GO_TO(e) HAS_PROPERTY(e, EP_DONT_GO_TO)
-#define IS_CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE)
#define IS_BD_ELEMENT(e) HAS_PROPERTY(e, EP_BD_ELEMENT)
#define IS_SP_ELEMENT(e) HAS_PROPERTY(e, EP_SP_ELEMENT)
#define IS_SB_ELEMENT(e) HAS_PROPERTY(e, EP_SB_ELEMENT)
int walk_to_action; /* only for level editor; not stored */
int walkable_layer; /* only for level editor; not stored */
+ int content[3][3]; /* new elements after explosion */
+
struct CustomElementChangeInfo change;
};