X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fmain.h;h=6e3a8293a7ac1ba942359dbe3a976a39f79f1aaa;hb=dce12aedb7f597d85daf4ae5dfc4e058ae2f7b5c;hp=af3e7b4e187d4909df9ba9bc230de1054feef756;hpb=098ef036131fbf9cdcd77d1b985abae78df7cb3c;p=rocksndiamonds.git diff --git a/src/main.h b/src/main.h index af3e7b4e..6e3a8293 100644 --- a/src/main.h +++ b/src/main.h @@ -155,7 +155,11 @@ #define EP_WALK_TO_OBJECT 81 #define EP_DEADLY 82 -#define NUM_ELEMENT_PROPERTIES 83 +/* values for internal purpose only (game engine) */ +#define EP_HAS_ACTION 83 +#define EP_CAN_CHANGE_OR_HAS_ACTION 84 + +#define NUM_ELEMENT_PROPERTIES 85 #define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32) #define EP_BITFIELD_BASE 0 @@ -179,36 +183,34 @@ #define CE_HITTING_SOMETHING 5 #define CE_IMPACT 6 #define CE_SMASHED 7 -#define CE_OTHER_IS_TOUCHING 8 -#define CE_OTHER_IS_CHANGING 9 -#define CE_OTHER_IS_EXPLODING 10 -#define CE_OTHER_GETS_TOUCHED 11 -#define CE_OTHER_GETS_PRESSED 12 -#define CE_OTHER_GETS_PUSHED 13 -#define CE_OTHER_GETS_COLLECTED 14 -#define CE_OTHER_GETS_DROPPED 15 -#define CE_BY_PLAYER_OBSOLETE 16 /* obsolete; now CE_BY_DIRECT_ACTION */ -#define CE_BY_COLLISION_OBSOLETE 17 /* obsolete; now CE_BY_DIRECT_ACTION */ +#define CE_TOUCHING_X 8 +#define CE_CHANGE_OF_X 9 +#define CE_EXPLOSION_OF_X 10 +#define CE_PLAYER_TOUCHES_X 11 +#define CE_PLAYER_PRESSES_X 12 +#define CE_PLAYER_PUSHES_X 13 +#define CE_PLAYER_COLLECTS_X 14 +#define CE_PLAYER_DROPS_X 15 +#define CE_COUNT_AT_ZERO 16 +#define CE_COUNT_AT_ZERO_OF_X 17 #define CE_BY_OTHER_ACTION 18 /* activates other element events */ #define CE_BY_DIRECT_ACTION 19 /* activates direct element events */ -#define CE_OTHER_GETS_DIGGED 20 +#define CE_PLAYER_DIGS_X 20 #define CE_ENTERED_BY_PLAYER 21 #define CE_LEFT_BY_PLAYER 22 -#define CE_OTHER_GETS_ENTERED 23 -#define CE_OTHER_GETS_LEFT 24 +#define CE_PLAYER_ENTERS_X 23 +#define CE_PLAYER_LEAVES_X 24 #define CE_SWITCHED 25 -#define CE_OTHER_IS_SWITCHING 26 +#define CE_SWITCH_OF_X 26 #define CE_HIT_BY_SOMETHING 27 -#define CE_OTHER_IS_HITTING 28 -#define CE_OTHER_GETS_HIT 29 +#define CE_HITTING_X 28 +#define CE_HIT_BY_X 29 #define CE_BLOCKED 30 #define NUM_CHANGE_EVENTS 31 #define CE_BITMASK_DEFAULT 0 -#if 1 - #define CH_EVENT_VAR(e,c) (element_info[e].change->has_event[c]) #define CH_ANY_EVENT_VAR(e,c) (element_info[e].has_change_event[c]) @@ -223,25 +225,17 @@ #define SET_ANY_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ? \ CH_ANY_EVENT_VAR(e,c) = (v) : 0) -#else - -#define CH_EVENT_BIT(c) (1 << (c)) -#define CH_EVENT_VAR(e) (element_info[e].change->events) -#define CH_ANY_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) -#define HAS_ANY_CHANGE_EVENT(e,c) (IS_CUSTOM_ELEMENT(e) && \ - (CH_ANY_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) -#define SET_ANY_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ? \ - ((v) ? \ - (CH_ANY_EVENT_VAR(e) |= CH_EVENT_BIT(c)) : \ - (CH_ANY_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0) -#endif +/* values for player bitmasks */ +#define PLAYER_BITS_NONE 0 +#define PLAYER_BITS_1 (1 << 0) +#define PLAYER_BITS_2 (1 << 1) +#define PLAYER_BITS_3 (1 << 2) +#define PLAYER_BITS_4 (1 << 3) +#define PLAYER_BITS_ANY (PLAYER_BITS_1 | \ + PLAYER_BITS_2 | \ + PLAYER_BITS_3 | \ + PLAYER_BITS_4) +#define PLAYER_BITS_TRIGGER (1 << 4) /* values for change side for custom elements */ #define CH_SIDE_NONE MV_NO_MOVING @@ -254,13 +248,12 @@ #define CH_SIDE_ANY MV_ANY_DIRECTION /* values for change player for custom elements */ -#define CH_PLAYER_NONE 0 -#define CH_PLAYER_1 (1 << 0) -#define CH_PLAYER_2 (1 << 1) -#define CH_PLAYER_3 (1 << 2) -#define CH_PLAYER_4 (1 << 3) -#define CH_PLAYER_ANY (CH_PLAYER_1 | CH_PLAYER_2 | CH_PLAYER_3 | \ - CH_PLAYER_4) +#define CH_PLAYER_NONE PLAYER_BITS_NONE +#define CH_PLAYER_1 PLAYER_BITS_1 +#define CH_PLAYER_2 PLAYER_BITS_2 +#define CH_PLAYER_3 PLAYER_BITS_3 +#define CH_PLAYER_4 PLAYER_BITS_4 +#define CH_PLAYER_ANY PLAYER_BITS_ANY /* values for change page for custom elements */ #define CH_PAGE_ANY_FILE (0xff) @@ -274,6 +267,71 @@ #define CP_WHEN_REMOVABLE 4 #define CP_WHEN_WALKABLE 5 +/* values for change actions for custom elements */ +#define CA_NO_ACTION 0 +#define CA_EXIT_PLAYER 1 +#define CA_KILL_PLAYER 2 +#define CA_RESTART_LEVEL 3 +#define CA_SHOW_ENVELOPE 4 +#define CA_ADD_KEY 5 +#define CA_DEL_KEY 6 +#define CA_SET_PLAYER_SPEED 7 +#define CA_SET_GEMS 8 +#define CA_SET_TIME 9 +#define CA_SET_SCORE 10 +#define CA_SET_CE_SCORE 11 +#define CA_SET_CE_COUNT 12 +#define CA_SET_DYNABOMB_NUMBER 13 +#define CA_SET_DYNABOMB_SIZE 14 +#define CA_SET_DYNABOMB_POWER 15 +#define CA_TOGGLE_PLAYER_GRAVITY 16 +#define CA_ENABLE_PLAYER_GRAVITY 17 +#define CA_DISABLE_PLAYER_GRAVITY 18 + +/* values for change action mode for custom elements */ +#define CA_MODE_UNDEFINED 0 +#define CA_MODE_SET 1 +#define CA_MODE_ADD 2 +#define CA_MODE_SUBTRACT 3 +#define CA_MODE_MULTIPLY 4 +#define CA_MODE_DIVIDE 5 +#define CA_MODE_MODULO 6 + +/* values for change action parameters for custom elements */ +#define CA_ARG_MIN 0 +#define CA_ARG_0 0 +#define CA_ARG_1 1 +#define CA_ARG_2 2 +#define CA_ARG_3 3 +#define CA_ARG_4 4 +#define CA_ARG_5 5 +#define CA_ARG_10 10 +#define CA_ARG_100 100 +#define CA_ARG_1000 1000 +#define CA_ARG_MAX 9999 +#define CA_ARG_PLAYER 10000 +#define CA_ARG_PLAYER_HEADLINE (CA_ARG_PLAYER + 0) +#define CA_ARG_PLAYER_1 (CA_ARG_PLAYER + PLAYER_BITS_1) +#define CA_ARG_PLAYER_2 (CA_ARG_PLAYER + PLAYER_BITS_2) +#define CA_ARG_PLAYER_3 (CA_ARG_PLAYER + PLAYER_BITS_3) +#define CA_ARG_PLAYER_4 (CA_ARG_PLAYER + PLAYER_BITS_4) +#define CA_ARG_PLAYER_ANY (CA_ARG_PLAYER + PLAYER_BITS_ANY) +#define CA_ARG_PLAYER_TRIGGER (CA_ARG_PLAYER + PLAYER_BITS_TRIGGER) +#define CA_ARG_NUMBER 20000 +#define CA_ARG_NUMBER_HEADLINE (CA_ARG_NUMBER + 0) +#define CA_ARG_NUMBER_MIN (CA_ARG_NUMBER + 1) +#define CA_ARG_NUMBER_MAX (CA_ARG_NUMBER + 2) +#define CA_ARG_NUMBER_NORMAL (CA_ARG_NUMBER + 3) +#define CA_ARG_NUMBER_RESET (CA_ARG_NUMBER + 4) +#define CA_ARG_NUMBER_CE_SCORE (CA_ARG_NUMBER + 5) +#define CA_ARG_NUMBER_CE_COUNT (CA_ARG_NUMBER + 6) +#define CA_ARG_NUMBER_CE_DELAY (CA_ARG_NUMBER + 7) +#define CA_ARG_ELEMENT 30000 +#define CA_ARG_ELEMENT_HEADLINE (CA_ARG_ELEMENT + 0) +#define CA_ARG_ELEMENT_TARGET (CA_ARG_ELEMENT + 1) +#define CA_ARG_ELEMENT_TRIGGER (CA_ARG_ELEMENT + 2) +#define CA_ARG_UNDEFINED 30999 + /* values for custom move patterns (bits 0 - 3: basic move directions) */ #define MV_BIT_TOWARDS_PLAYER 4 #define MV_BIT_AWAY_FROM_PLAYER 5 @@ -424,6 +482,9 @@ HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_EXPLOSION) #define COULD_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_COULD_MOVE_INTO_ACID) #define MAYBE_DONT_COLLIDE_WITH(e) HAS_PROPERTY(e, EP_MAYBE_DONT_COLLIDE_WITH) +#define HAS_ACTION(e) HAS_PROPERTY(e, EP_HAS_ACTION) +#define CAN_CHANGE_OR_HAS_ACTION(e) \ + HAS_PROPERTY(e, EP_CAN_CHANGE_OR_HAS_ACTION) /* special macros used in game engine */ #define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \ @@ -527,8 +588,6 @@ #define PLAYERINFO(x,y) (&stored_player[StorePlayer[x][y]-EL_PLAYER_1]) #define SHIELD_ON(p) ((p)->shield_normal_time_left > 0) -#if 1 - #define ENEMY_PROTECTED_FIELD(x,y) (IS_PROTECTED(Feld[x][y]) || \ IS_PROTECTED(Back[x][y])) #define EXPLOSION_PROTECTED_FIELD(x,y) (IS_EXPLOSION_PROOF(Feld[x][y])) @@ -537,19 +596,12 @@ #define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \ EXPLOSION_PROTECTED_FIELD(x, y)) -#else - -#define PROTECTED_FIELD(x,y) (IS_ACCESSIBLE_INSIDE(Feld[x][y]) && \ - IS_INDESTRUCTIBLE(Feld[x][y])) -#define PLAYER_ENEMY_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \ - PROTECTED_FIELD(x, y)) -#define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \ - PROTECTED_FIELD(x, y)) -#endif - #define PLAYER_SWITCHING(p,x,y) ((p)->is_switching && \ (p)->switch_x == (x) && (p)->switch_y == (y)) +#define PLAYER_DROPPING(p,x,y) ((p)->is_dropping && \ + (p)->drop_x == (x) && (p)->drop_y == (y)) + #define PLAYER_NR_GFX(g,i) ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1)) #define ANIM_FRAMES(g) (graphic_info[g].anim_frames) @@ -599,7 +651,6 @@ #define MIN_ELEMENT_CONTENTS 1 #define STD_ELEMENT_CONTENTS 4 #define MAX_ELEMENT_CONTENTS 8 -#define NUM_MAGIC_BALL_CONTENTS 8 #define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */ @@ -1238,9 +1289,41 @@ #define ACTION_SLURPED_BY_SPRING 49 #define ACTION_TWINKLING 50 #define ACTION_SPLASHING 51 -#define ACTION_OTHER 52 - -#define NUM_ACTIONS 53 +#define ACTION_PAGE_1 52 +#define ACTION_PAGE_2 53 +#define ACTION_PAGE_3 54 +#define ACTION_PAGE_4 55 +#define ACTION_PAGE_5 56 +#define ACTION_PAGE_6 57 +#define ACTION_PAGE_7 58 +#define ACTION_PAGE_8 59 +#define ACTION_PAGE_9 60 +#define ACTION_PAGE_10 61 +#define ACTION_PAGE_11 62 +#define ACTION_PAGE_12 63 +#define ACTION_PAGE_13 64 +#define ACTION_PAGE_14 65 +#define ACTION_PAGE_15 66 +#define ACTION_PAGE_16 67 +#define ACTION_PAGE_17 68 +#define ACTION_PAGE_18 69 +#define ACTION_PAGE_19 70 +#define ACTION_PAGE_20 71 +#define ACTION_PAGE_21 72 +#define ACTION_PAGE_22 73 +#define ACTION_PAGE_23 74 +#define ACTION_PAGE_24 75 +#define ACTION_PAGE_25 76 +#define ACTION_PAGE_26 77 +#define ACTION_PAGE_27 78 +#define ACTION_PAGE_28 79 +#define ACTION_PAGE_29 80 +#define ACTION_PAGE_30 81 +#define ACTION_PAGE_31 82 +#define ACTION_PAGE_32 83 +#define ACTION_OTHER 84 + +#define NUM_ACTIONS 85 #define ACTION_BORING_LAST ACTION_BORING_10 #define ACTION_SLEEPING_LAST ACTION_SLEEPING_3 @@ -1301,8 +1384,9 @@ #define GFX_ARG_POST_DELAY_RANDOM 35 #define GFX_ARG_NAME 36 #define GFX_ARG_SCALE_UP_FACTOR 37 +#define GFX_ARG_CLONE_FROM 38 -#define NUM_GFX_ARGS 38 +#define NUM_GFX_ARGS 39 /* values for sound configuration suffixes */ @@ -1385,14 +1469,24 @@ /* program information and versioning definitions */ +#define RELEASE_3_1_2 FALSE + +#if RELEASE_3_1_2 +#define PROGRAM_VERSION_MAJOR 3 +#define PROGRAM_VERSION_MINOR 1 +#define PROGRAM_VERSION_PATCH 2 +#define PROGRAM_VERSION_BUILD 0 +#else +/* !!! make sure that packaging script can find unique version number !!! */ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 2 #define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 3 +#define PROGRAM_VERSION_BUILD 5 +#endif #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" -#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2004 by Holger Schemel" +#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2005 by Holger Schemel" #define ICON_TITLE_STRING PROGRAM_TITLE_STRING #define COOKIE_PREFIX "ROCKSNDIAMONDS" @@ -1489,6 +1583,11 @@ struct HiScore int Score; }; +struct Content +{ + int e[3][3]; +}; + struct PlayerInfo { boolean present; /* player present in level playfield */ @@ -1551,26 +1650,17 @@ struct PlayerInfo int num_special_action_sleeping; int switch_x, switch_y; + int drop_x, drop_y; int show_envelope; -#if 1 /* USE_NEW_MOVE_DELAY */ int move_delay; int move_delay_value; -#else - unsigned long move_delay; - int move_delay_value; -#endif - + int move_delay_value_next; int move_delay_reset_counter; -#if 1 /* USE_NEW_PUSH_DELAY */ int push_delay; int push_delay_value; -#else - unsigned long push_delay; - unsigned long push_delay_value; -#endif unsigned long actual_frame_counter; @@ -1636,7 +1726,7 @@ struct LevelInfo int score[LEVEL_SCORE_ELEMENTS]; - int yamyam_content[MAX_ELEMENT_CONTENTS][3][3]; + struct Content yamyam_content[MAX_ELEMENT_CONTENTS]; int num_yamyam_contents; int amoeba_speed; @@ -1659,7 +1749,7 @@ struct LevelInfo int lenses_time; int magnify_time; int wind_direction_initial; - int ball_content[NUM_MAGIC_BALL_CONTENTS][3][3]; + struct Content ball_content[MAX_ELEMENT_CONTENTS]; boolean android_array[16]; int can_move_into_acid_bits; /* bitfield to store property for elements */ @@ -1676,11 +1766,6 @@ struct LevelInfo boolean block_last_field; /* player blocks previous field while moving */ boolean sp_block_last_field; /* player blocks previous field while moving */ -#if 0 /* !!! THIS IS NOT A LEVEL SETTING => LOGIC MOVED TO "game.c" !!! */ - int block_delay; /* delay for blocking previous field */ - int sp_block_delay; /* delay for blocking previous field */ -#endif - /* ('int' instead of 'boolean' because used as selectbox value in editor) */ int use_step_counter; /* count steps instead of seconds for level */ @@ -1766,6 +1851,9 @@ struct GameInfo int player_boring_delay_random; int player_sleeping_delay_fixed; int player_sleeping_delay_random; + + /* values for special game initialization control */ + boolean restart_level; }; struct GlobalInfo @@ -1788,11 +1876,7 @@ struct ElementChangeInfo { boolean can_change; /* use or ignore this change info */ -#if 1 boolean has_event[NUM_CHANGE_EVENTS]; /* change events */ -#else - unsigned long events; /* change events */ -#endif int trigger_player; /* player triggering change */ int trigger_side; /* side triggering change */ @@ -1806,7 +1890,7 @@ struct ElementChangeInfo short trigger_element; /* element triggering change */ - int target_content[3][3]; /* elements for extended change target */ + struct Content target_content;/* elements for extended change target */ boolean use_target_content; /* use extended change target */ boolean only_if_complete; /* only use complete target content */ boolean use_random_replace; /* use random value for replacing elements */ @@ -1815,6 +1899,11 @@ struct ElementChangeInfo boolean explode; /* explode instead of change */ + boolean has_action; /* execute action on specified condition */ + int action_type; /* type of action */ + int action_mode; /* mode of action */ + int action_arg; /* parameter of action */ + /* ---------- internal values used at runtime when playing ---------- */ /* functions that are called before, while and after the change of an @@ -1826,6 +1915,8 @@ struct ElementChangeInfo short actual_trigger_element; /* element that actually triggered change */ int actual_trigger_player; /* player which actually triggered change */ + boolean can_change_or_has_action; /* can_change | has_action */ + /* ---------- internal values used in level editor ---------- */ int direct_action; /* change triggered by actions on element */ @@ -1890,8 +1981,8 @@ struct ElementInfo int access_direction; /* accessible from which direction */ - int collect_score; /* score value for collecting */ - int collect_count; /* count value for collecting */ + int collect_score_initial; /* initial score value for collecting */ + int collect_count_initial; /* initial count value for collecting */ int push_delay_fixed; /* constant delay before pushing */ int push_delay_random; /* additional random delay before pushing */ @@ -1910,7 +2001,7 @@ struct ElementInfo int slippery_type; /* how/where other elements slip away */ - int content[3][3]; /* new elements after explosion */ + struct Content content; /* new elements after explosion */ int explosion_type; /* type of explosion, like 3x3, 3+3 or 1x1 */ int explosion_delay; /* duration of explosion of this element */ @@ -1926,21 +2017,14 @@ struct ElementInfo /* ---------- internal values used at runtime when playing ---------- */ -#if 1 boolean has_change_event[NUM_CHANGE_EVENTS]; -#else - unsigned long change_events; /* bitfield for combined change events */ -#endif int event_page_nr[NUM_CHANGE_EVENTS]; /* page number for each event */ struct ElementChangeInfo *event_page[NUM_CHANGE_EVENTS]; /* page for event */ boolean in_group[NUM_GROUP_ELEMENTS]; -#if 0 - boolean can_leave_element; /* element can leave other element behind */ - boolean can_leave_element_last; -#endif + int collect_score; /* runtime score value for collecting */ /* ---------- internal values used in level editor ---------- */ @@ -1972,6 +2056,9 @@ struct FontInfo struct GraphicInfo { Bitmap *bitmap; + int src_image_width; /* scaled bitmap size, but w/o small images */ + int src_image_height; /* scaled bitmap size, but w/o small images */ + int src_x, src_y; /* start position of animation frames */ int width, height; /* width/height of each animation frame */ int offset_x, offset_y; /* x/y offset to next animation frame */ @@ -1988,6 +2075,7 @@ struct GraphicInfo int diggable_like; /* element for cloning digging graphics */ int border_size; /* border size for "crumbled" graphics */ int scale_up_factor; /* optional factor for scaling image up */ + int clone_from; /* graphic for cloning *all* settings */ int anim_delay_fixed; /* optional delay values for bored and */ int anim_delay_random; /* sleeping player animations (animation */ @@ -2075,10 +2163,6 @@ struct HelpAnimInfo }; -#if 0 -extern GC tile_clip_gc; -extern Bitmap *pix[]; -#endif extern Bitmap *bitmap_db_field, *bitmap_db_door; extern Pixmap tile_clipmask[]; extern DrawBuffer *fieldbuffer; @@ -2104,6 +2188,7 @@ extern short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +extern short Count[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];