X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fmain.h;h=8ffeb3de6d9736a06e51fbfc382ea7b95da61b6d;hb=4c2027809249e8cfb5d81ef0ab5835f40c3a3835;hp=dc4b8fa33c248277a9cc89e18ef1e1b37eeae207;hpb=5f9fbeb32ecd4c70ed6d6df8809719af619b40c0;p=rocksndiamonds.git diff --git a/src/main.h b/src/main.h index dc4b8fa3..8ffeb3de 100644 --- a/src/main.h +++ b/src/main.h @@ -63,9 +63,9 @@ /* values for configurable properties (custom elem's only, else pre-defined) */ #define EP_DIGGABLE 0 #define EP_COLLECTIBLE 1 -#define EP_UNUSED_2 2 -#define EP_UNUSED_3 3 -#define EP_UNUSED_4 4 +#define EP_DONT_GO_TO 2 +#define EP_ENEMY 3 +#define EP_DONT_TOUCH 4 #define EP_INDESTRUCTIBLE 5 #define EP_SLIPPERY 6 #define EP_CAN_EXPLODE 7 @@ -97,46 +97,44 @@ #define EP_PLAYER 27 #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 +#define EP_BD_ELEMENT 30 +#define EP_SP_ELEMENT 31 +#define EP_SB_ELEMENT 32 +#define EP_GEM 33 +#define EP_FOOD_DARK_YAMYAM 34 +#define EP_FOOD_PENGUIN 35 +#define EP_FOOD_PIG 36 +#define EP_HISTORIC_WALL 37 +#define EP_HISTORIC_SOLID 38 +#define EP_BELT 39 +#define EP_BELT_ACTIVE 40 +#define EP_BELT_SWITCH 41 +#define EP_TUBE 42 +#define EP_KEYGATE 43 +#define EP_AMOEBOID 44 +#define EP_AMOEBALIVE 45 +#define EP_HAS_CONTENT 46 +#define EP_ACTIVE_BOMB 47 +#define EP_INACTIVE 48 /* values for derived properties (determined from properties above) */ -#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 +#define EP_ACCESSIBLE_OVER 49 +#define EP_ACCESSIBLE_INSIDE 50 +#define EP_ACCESSIBLE_UNDER 51 +#define EP_WALKABLE 52 +#define EP_PASSABLE 53 +#define EP_ACCESSIBLE 54 +#define EP_SNAPPABLE 55 +#define EP_WALL 56 +#define EP_SOLID_FOR_PUSHING 57 +#define EP_DRAGONFIRE_PROOF 58 +#define EP_EXPLOSION_PROOF 59 /* values for internal purpose only (level editor) */ -#define EP_WALK_TO_OBJECT 63 +#define EP_WALK_TO_OBJECT 60 +#define EP_DEADLY 61 -#define NUM_ELEMENT_PROPERTIES 64 +#define NUM_ELEMENT_PROPERTIES 62 #define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32) #define EP_BITFIELD_BASE 0 @@ -152,17 +150,14 @@ /* values for change events for custom elements */ -#define CE_DELAY_FIXED 0 -#define CE_DELAY_RANDOM 1 +#define CE_DELAY 0 -#define NUM_CHANGE_EVENTS 2 +#define NUM_CHANGE_EVENTS 1 #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 CH_EVENT_VAR(e) (element_info[e].change.events) #define HAS_CHANGE_EVENT(e,c) (IS_CUSTOM_ELEMENT(e) && \ (CH_EVENT_VAR(e) & CH_EVENT_BIT(c)) != 0) @@ -175,6 +170,9 @@ /* macros for configurable properties */ #define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE) #define IS_COLLECTIBLE(e) HAS_PROPERTY(e, EP_COLLECTIBLE) +#define DONT_GO_TO(e) HAS_PROPERTY(e, EP_DONT_GO_TO) +#define IS_ENEMY(e) HAS_PROPERTY(e, EP_ENEMY) +#define DONT_TOUCH(e) HAS_PROPERTY(e, EP_DONT_TOUCH) #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) @@ -187,8 +185,8 @@ #define IS_PASSABLE_OVER(e) HAS_PROPERTY(e, EP_PASSABLE_OVER) #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) +#define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE) /* macros for special configurable properties */ #define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL) @@ -200,9 +198,6 @@ #define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER) #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_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) @@ -236,12 +231,11 @@ #define IS_DRAGONFIRE_PROOF(e) HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF) #define IS_EXPLOSION_PROOF(e) HAS_PROPERTY(e, EP_EXPLOSION_PROOF) -#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \ +#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \ (e) <= EL_CUSTOM_END) -#define GFX_ELEMENT(e) (IS_CUSTOM_ELEMENT(e) && \ - CUSTOM_ELEMENT_INFO(e).use_gfx_element ? \ - CUSTOM_ELEMENT_INFO(e).gfx_element : e) +#define GFX_ELEMENT(e) (element_info[e].use_gfx_element ? \ + element_info[e].gfx_element : e) #define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y])) @@ -901,6 +895,7 @@ #define PROGRAM_VERSION_MAJOR 2 #define PROGRAM_VERSION_MINOR 2 #define PROGRAM_VERSION_PATCH 0 +#define PROGRAM_VERSION_RELEASE 7 #define PROGRAM_VERSION_STRING "2.2.0rc7" #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" @@ -948,9 +943,10 @@ #define GAME_VERSION_1_4 FILE_VERSION_1_4 #define GAME_VERSION_2_0 FILE_VERSION_2_0 -#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_MAJOR, \ +#define GAME_VERSION_ACTUAL RELEASE_IDENT(PROGRAM_VERSION_MAJOR, \ PROGRAM_VERSION_MINOR, \ - PROGRAM_VERSION_PATCH) + PROGRAM_VERSION_PATCH, \ + PROGRAM_VERSION_RELEASE) /* values for game_emulation */ #define EMU_NONE 0 @@ -1019,32 +1015,6 @@ struct PlayerInfo int shield_deadly_time_left; }; -struct CustomElementChangeInfo -{ - unsigned long events; /* bitfield for change events */ - - int delay_fixed; /* added frame delay before changed (fixed) */ - int delay_random; /* added frame delay before changed (random) */ - int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */ - - short successor; /* new custom element after change */ -}; - -struct CustomElementInfo -{ - boolean use_gfx_element; - short gfx_element; /* optional custom graphic element */ - - int move_direction; /* direction movable element moves to */ - - 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; -}; - struct LevelInfo { int file_version; /* file format version the level is stored with */ @@ -1073,8 +1043,6 @@ struct LevelInfo boolean gravity; boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */ - struct CustomElementInfo custom_element[NUM_CUSTOM_ELEMENTS]; - boolean no_level_file; }; @@ -1158,13 +1126,28 @@ struct DoorInfo int step_delay; }; +struct ElementChangeInfo +{ + unsigned long events; /* bitfield for change events */ + + int delay_fixed; /* added frame delay before changed (fixed) */ + int delay_random; /* added frame delay before changed (random) */ + int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */ + + short successor; /* new custom element after change */ +}; + struct ElementInfo { + /* ---------- token and description strings ---------- */ + char *token_name; /* element token used in config files */ char *class_name; /* element class used in config files */ char *editor_description; /* short description for level editor */ char *custom_description; /* custom description for level editor */ + /* ---------- graphic and sound definitions ---------- */ + int graphic[NUM_ACTIONS]; /* default graphics for several actions */ int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS]; /* special graphics for left/right/up/down */ @@ -1172,6 +1155,31 @@ struct ElementInfo /* special graphics for certain screens */ int sound[NUM_ACTIONS]; /* default sounds for several actions */ + + /* ---------- special element property values ---------- */ + + boolean use_template; /* use all properties from template file */ + + boolean use_gfx_element; + short gfx_element; /* optional custom graphic element */ + + int score; /* score for collection, smashing, ... */ + + int push_delay_fixed; /* constant frame delay for pushing */ + int push_delay_random; /* additional random frame delay for pushing */ + int move_delay_fixed; /* constant frame delay for moving */ + int move_delay_random; /* additional random frame delay for moving */ + + int move_pattern; /* direction movable element moves to */ + int move_direction_initial; /* initial direction element moves to */ + + int walk_to_action; /* only for level editor; not stored */ + int deadliness; /* only for level editor; not stored */ + int walkable_layer; /* only for level editor; not stored */ + + int content[3][3]; /* new elements after explosion */ + + struct ElementChangeInfo change; }; struct FontInfo