#define EP_PASSABLE_OVER 14
#define EP_PASSABLE_INSIDE 15
#define EP_PASSABLE_UNDER 16
-#define EP_UNUSED_17 17
+#define EP_CHANGEABLE 17
#define EP_UNUSED_18 18
#define EP_UNUSED_19 19
#define EP_UNUSED_20 20
#define EP_BITMASK_DEFAULT 0
#define PROPERTY_BIT(p) (1 << ((p) % 32))
-#define PROPERTY_VAR(e, p) (Properties[e][(p) / 32])
-#define HAS_PROPERTY(e, p) ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
-#define SET_PROPERTY(e, p, v) ((v) ? \
+#define PROPERTY_VAR(e,p) (Properties[e][(p) / 32])
+#define HAS_PROPERTY(e,p) ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
+#define SET_PROPERTY(e,p,v) ((v) ? \
(PROPERTY_VAR(e,p) |= PROPERTY_BIT(p)) : \
(PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
+
+/* values for change events for custom elements */
+#define CE_DELAY_FIXED 0
+#define CE_DELAY_RANDOM 1
+
+#define NUM_CHANGE_EVENTS 2
+
+#define CE_BITMASK_DEFAULT 0
+
+#define CUSTOM_ELEMENT_INFO(e) (level.custom_element[(e) - EL_CUSTOM_START])
+
+#define CH_EVENT_BIT(c) (1 << (c))
+#define CH_EVENT_VAR(e) (CUSTOM_ELEMENT_INFO(e).change.events)
+
+#define HAS_CHANGE_EVENT(e,c) (IS_CUSTOM_ELEMENT(e) && \
+ (CH_EVENT_VAR(e) & CH_EVENT_BIT(c)) != 0)
+#define SET_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ? \
+ ((v) ? \
+ (CH_EVENT_VAR(e) |= CH_EVENT_BIT(c)) : \
+ (CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0)
+
+
/* macros for configurable properties */
#define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE)
#define IS_COLLECTIBLE(e) HAS_PROPERTY(e, EP_COLLECTIBLE)
#define IS_PASSABLE_INSIDE(e) HAS_PROPERTY(e, EP_PASSABLE_INSIDE)
#define IS_PASSABLE_UNDER(e) HAS_PROPERTY(e, EP_PASSABLE_UNDER)
#define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE)
+#define IS_CHANGEABLE(e) HAS_PROPERTY(e, EP_CHANGEABLE)
/* macros for special configurable properties */
#define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
#define IS_LOOP_SOUND(s) (sound_info[s].loop)
-#if 0
-
-/* Bitmaps with graphic file */
-#define PIX_BACK 0
-#define PIX_DOOR 1
-#define PIX_TOONS 2
-#define PIX_FONT_BIG 3
-#define PIX_FONT_SMALL 4
-#define PIX_FONT_MEDIUM 5
-#define PIX_FONT_EM 6
-/* Bitmaps without graphic file */
-#define PIX_DB_DOOR 7
-#define PIX_DB_FIELD 8
-
-#define NUM_PICTURES 7
-#define NUM_BITMAPS 9
-
-#else
-
-/* Bitmaps with graphic file */
-#define PIX_BACK 0
-#define PIX_ELEMENTS 1
-#define PIX_DOOR 2
-#define PIX_HEROES 3
-#define PIX_TOONS 4
-#define PIX_SP 5
-#define PIX_DC 6
-#define PIX_MORE 7
-#define PIX_FONT_BIG 8
-#define PIX_FONT_SMALL 9
-#define PIX_FONT_MEDIUM 10
-#define PIX_FONT_EM 11
-/* Bitmaps without graphic file */
-#define PIX_DB_DOOR 12
-#define PIX_DB_FIELD 13
-
-#define NUM_PICTURES 12
-#define NUM_BITMAPS 14
-
-#endif
-
/* boundaries of arrays etc. */
#define MAX_LEVEL_NAME_LEN 32
#define MAX_LEVEL_AUTHOR_LEN 32
#define MAX_TAPELEN (1000 * 50) /* max. time * framerate */
#define MAX_SCORE_ENTRIES 100
-#if 0
-#define MAX_ELEMENTS 700 /* 500 static + 200 runtime */
-#define MAX_GRAPHICS 1536 /* see below: NUM_TILES */
-#endif
#define MAX_NUM_AMOEBA 100
/* values for elements with content */
int shield_deadly_time_left;
};
+struct CustomElementChangeInfo
+{
+ unsigned long events; /* bitfield for change events */
+
+ short successor; /* new custom element after change */
+
+ int delay_fixed; /* added frame delay before changed (fixed) */
+ int delay_random; /* added frame delay before changed (random) */
+};
+
+struct CustomElementInfo
+{
+ struct CustomElementChangeInfo change;
+};
+
struct LevelInfo
{
int file_version; /* file format version the level is stored with */
boolean gravity;
boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */
- short custom_element_successor[NUM_CUSTOM_ELEMENTS];
+ struct CustomElementInfo custom_element[NUM_CUSTOM_ELEMENTS];
boolean no_level_file;
};