X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fmain.h;h=bccf5762a1f0640ad8cc4e3ebd8a033e07baffff;hb=7a7f090296fc140cb8d51bcc02759eb0d09ed8c8;hp=69f758a0ed50a1a4e86ad6a9c030fa566926971a;hpb=f857fec3082c785b0dd271b6ad1b7642a2ed4e65;p=rocksndiamonds.git diff --git a/src/main.h b/src/main.h index 69f758a0..bccf5762 100644 --- a/src/main.h +++ b/src/main.h @@ -78,7 +78,7 @@ #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 @@ -95,43 +95,45 @@ #define EP_CAN_BE_CRUMBLED 27 #define EP_CAN_MOVE 28 #define EP_CAN_PASS_MAGIC_WALL 29 -#define EP_DONT_TOUCH 30 -#define EP_ENEMY 31 -#define EP_DONT_GO_TO 32 -#define EP_CAN_EXPLODE 33 -#define EP_BD_ELEMENT 34 -#define EP_SP_ELEMENT 35 -#define EP_SB_ELEMENT 36 -#define EP_GEM 37 -#define EP_FOOD_DARK_YAMYAM 38 -#define EP_FOOD_PENGUIN 39 -#define EP_FOOD_PIG 40 -#define EP_HISTORIC_WALL 41 -#define EP_HISTORIC_SOLID 42 -#define EP_BELT 43 -#define EP_BELT_ACTIVE 44 -#define EP_BELT_SWITCH 45 -#define EP_TUBE 46 -#define EP_KEYGATE 47 -#define EP_AMOEBOID 48 -#define EP_AMOEBALIVE 49 -#define EP_HAS_CONTENT 50 -#define EP_ACTIVE_BOMB 51 -#define EP_INACTIVE 52 +#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 /* values for derived properties (determined from properties above) */ -#define EP_ACCESSIBLE_OVER 53 -#define EP_ACCESSIBLE_INSIDE 54 -#define EP_ACCESSIBLE_UNDER 55 -#define EP_WALKABLE 56 -#define EP_PASSABLE 57 -#define EP_ACCESSIBLE 58 -#define EP_WALL 59 -#define EP_SOLID_FOR_PUSHING 60 -#define EP_DRAGONFIRE_PROOF 61 -#define EP_EXPLOSION_PROOF 62 - -#define NUM_ELEMENT_PROPERTIES 63 +#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 NUM_ELEMENT_PROPERTIES 65 #define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32) #define EP_BITFIELD_BASE 0 @@ -139,12 +141,34 @@ #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) @@ -159,6 +183,7 @@ #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) @@ -168,6 +193,7 @@ #define CAN_BE_CRUMBLED(e) HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED) #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) @@ -196,6 +222,7 @@ #define IS_ACCESSIBLE_OVER(e) HAS_PROPERTY(e, EP_ACCESSIBLE_OVER) #define IS_ACCESSIBLE_INSIDE(e) HAS_PROPERTY(e, EP_ACCESSIBLE_INSIDE) #define IS_ACCESSIBLE_UNDER(e) HAS_PROPERTY(e, EP_ACCESSIBLE_UNDER) +#define IS_SNAPPABLE(e) HAS_PROPERTY(e, EP_SNAPPABLE) #define IS_WALKABLE(e) HAS_PROPERTY(e, EP_WALKABLE) #define IS_PASSABLE(e) HAS_PROPERTY(e, EP_PASSABLE) #define IS_ACCESSIBLE(e) HAS_PROPERTY(e, EP_ACCESSIBLE) @@ -252,56 +279,11 @@ #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 */ @@ -1028,6 +1010,21 @@ struct PlayerInfo 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 */ @@ -1056,7 +1053,7 @@ struct LevelInfo 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; };