From: Holger Schemel Date: Sat, 24 Apr 2004 20:48:34 +0000 (+0200) Subject: rnd-20040424-2-src X-Git-Tag: 3.1.0^2~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=496ac49402b1cfe5e8a664ef351fc3188a20935c;p=rocksndiamonds.git rnd-20040424-2-src --- diff --git a/src/conftime.h b/src/conftime.h index 28fcf97a..2d700de5 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-04-24 03:11]" +#define COMPILE_DATE_STRING "[2004-04-24 21:58]" diff --git a/src/editor.c b/src/editor.c index c4392072..4326d882 100644 --- a/src/editor.c +++ b/src/editor.c @@ -429,7 +429,7 @@ #define GADGET_ID_TIME_OR_STEPS (GADGET_ID_SELECTBOX_FIRST + 0) #define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 1) -#define GADGET_ID_CUSTOM_CONSISTENCY (GADGET_ID_SELECTBOX_FIRST + 2) +#define GADGET_ID_CUSTOM_EXPLOSION_TYPE (GADGET_ID_SELECTBOX_FIRST + 2) #define GADGET_ID_CUSTOM_DEADLINESS (GADGET_ID_SELECTBOX_FIRST + 3) #define GADGET_ID_CUSTOM_MOVE_PATTERN (GADGET_ID_SELECTBOX_FIRST + 4) #define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 5) @@ -507,30 +507,31 @@ #define GADGET_ID_CAN_FALL_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 13) #define GADGET_ID_CAN_MOVE_INTO_ACID (GADGET_ID_CHECKBUTTON_FIRST + 14) #define GADGET_ID_DONT_COLLIDE_WITH (GADGET_ID_CHECKBUTTON_FIRST + 15) -#define GADGET_ID_CUSTOM_EXPLODE_RESULT (GADGET_ID_CHECKBUTTON_FIRST + 16) -#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 17) -#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 18) -#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 19) -#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 20) -#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 21) -#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 22) -#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 23) -#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 24) -#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 25) -#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 26) -#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 27) -#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 28) -#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 29) -#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 30) -#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 31) -#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 32) -#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 33) -#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 34) -#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 35) -#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 36) +#define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 16) +#define GADGET_ID_CUSTOM_CAN_EXPLODE (GADGET_ID_CHECKBUTTON_FIRST + 17) +#define GADGET_ID_CUSTOM_EXPLODE_FIRE (GADGET_ID_CHECKBUTTON_FIRST + 18) +#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 19) +#define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 20) +#define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 21) +#define GADGET_ID_CUSTOM_DEADLY (GADGET_ID_CHECKBUTTON_FIRST + 22) +#define GADGET_ID_CUSTOM_CAN_MOVE (GADGET_ID_CHECKBUTTON_FIRST + 23) +#define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 24) +#define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 25) +#define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 26) +#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 27) +#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 28) +#define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 29) +#define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 30) +#define GADGET_ID_CHANGE_USE_CONTENT (GADGET_ID_CHECKBUTTON_FIRST + 31) +#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 32) +#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 33) +#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 34) +#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 35) +#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 36) +#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 37) /* gadgets for buttons in element list */ -#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 37) +#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 38) #define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \ ED_NUM_ELEMENTLIST_BUTTONS - 1) @@ -638,7 +639,7 @@ #define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 10 #define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE 11 #define ED_SELECTBOX_ID_CUSTOM_DEADLINESS 12 -#define ED_SELECTBOX_ID_CUSTOM_CONSISTENCY 13 +#define ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE 13 #define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 14 #define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION 15 #define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 16 @@ -657,7 +658,7 @@ #define ED_SELECTBOX_ID_CUSTOM1_FIRST ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE #define ED_SELECTBOX_ID_CUSTOM1_LAST ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE #define ED_SELECTBOX_ID_CUSTOM2_FIRST ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS -#define ED_SELECTBOX_ID_CUSTOM2_LAST ED_SELECTBOX_ID_CUSTOM_CONSISTENCY +#define ED_SELECTBOX_ID_CUSTOM2_LAST ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE #define ED_SELECTBOX_ID_CUSTOM_FIRST ED_SELECTBOX_ID_CUSTOM1_FIRST #define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM2_LAST @@ -717,20 +718,21 @@ #define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 20 #define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 21 #define ED_CHECKBUTTON_ID_CUSTOM_DEADLY 22 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_RESULT 23 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 24 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 25 -#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 26 -#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 27 -#define ED_CHECKBUTTON_ID_CHANGE_DELAY 28 -#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 29 -#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 30 -#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 31 -#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 32 -#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 33 -#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 34 - -#define ED_NUM_CHECKBUTTONS 35 +#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 23 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE 24 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE 25 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 26 +#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 27 +#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 28 +#define ED_CHECKBUTTON_ID_CHANGE_DELAY 29 +#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 30 +#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT 31 +#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 32 +#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 33 +#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 34 +#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 35 + +#define ED_NUM_CHECKBUTTONS 36 #define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED @@ -1319,12 +1321,14 @@ static struct ValueTextInfo options_deadliness[] = { -1, NULL } }; -static struct ValueTextInfo options_consistency[] = +static struct ValueTextInfo options_explosion_type[] = { - { EP_CAN_EXPLODE_3X3, "can explode 3x3" }, - { EP_CAN_EXPLODE_CROSS, "can explode 3+3" }, - { EP_CAN_EXPLODE_1X1, "can explode 1x1" }, + { EXPLODES_3X3, "3x3" }, + { EXPLODES_CROSS, "3+3" }, + { EXPLODES_1X1, "1x1" }, +#if 0 { EP_INDESTRUCTIBLE, "indestructible" }, +#endif { -1, NULL } }; @@ -1600,11 +1604,11 @@ static struct }, { ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(2), - GADGET_ID_CUSTOM_CONSISTENCY, GADGET_ID_NONE, + GADGET_ID_CUSTOM_EXPLOSION_TYPE, GADGET_ID_NONE, -1, - options_consistency, - &custom_element.consistency, - NULL, NULL, "consistency/destructibility" + options_explosion_type, + &custom_element.explosion_type, + "can explode", NULL, "explosion type" }, /* ---------- element settings: advanced (custom elements) --------------- */ @@ -2086,28 +2090,34 @@ static struct &custom_element_properties[EP_DEADLY], NULL, NULL, "element can kill the player" }, + { + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(6), + GADGET_ID_CUSTOM_INDESTRUCTIBLE, GADGET_ID_NONE, + &custom_element_properties[EP_INDESTRUCTIBLE], + NULL, "indestructible", "element is indestructible" + }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2), - GADGET_ID_CUSTOM_EXPLODE_RESULT, GADGET_ID_NONE, - &custom_element_properties[EP_EXPLODE_RESULT], - NULL, NULL, "set consistency/destructibility" + GADGET_ID_CUSTOM_CAN_EXPLODE, GADGET_ID_NONE, + &custom_element_properties[EP_CAN_EXPLODE], + NULL, NULL, "element can explode" }, { ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(3), GADGET_ID_CUSTOM_EXPLODE_FIRE, GADGET_ID_NONE, - &custom_element.can_explode_by_fire, + &custom_element_properties[EP_EXPLODES_BY_FIRE], NULL, "by fire", "element can explode by fire/explosion" }, { -1, ED_SETTINGS_YPOS(3), GADGET_ID_CUSTOM_EXPLODE_SMASH, GADGET_ID_CUSTOM_EXPLODE_FIRE, - &custom_element.can_explode_smashed, + &custom_element_properties[EP_EXPLODES_SMASHED], " ", "smashed", "element can explode when smashed" }, { -1, ED_SETTINGS_YPOS(3), GADGET_ID_CUSTOM_EXPLODE_IMPACT, GADGET_ID_CUSTOM_EXPLODE_SMASH, - &custom_element.can_explode_impact, + &custom_element_properties[EP_EXPLODES_IMPACT], " ", "impact", "element can explode on impact" }, @@ -5845,19 +5855,28 @@ static void CopyCustomElementPropertiesToEditor(int element) DONT_COLLIDE_WITH(element) || DONT_RUN_INTO(element)); - /* set consistency selectbox help value */ - custom_element.consistency = - (IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE : +#if 0 + /* set explosion type selectbox help value */ + custom_element.explosion_type = + ( +#if 0 + IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE : +#endif CAN_EXPLODE_1X1(element) ? EP_CAN_EXPLODE_1X1 : CAN_EXPLODE_3X3(element) ? EP_CAN_EXPLODE_3X3 : CAN_EXPLODE_CROSS(element) ? EP_CAN_EXPLODE_CROSS : - custom_element.consistency); - custom_element_properties[EP_EXPLODE_RESULT] = - (IS_INDESTRUCTIBLE(element) || + custom_element.explosion_type); + custom_element_properties[EP_CAN_EXPLODE_AT_ALL] = + ( +#if 0 + IS_INDESTRUCTIBLE(element) || +#endif CAN_EXPLODE_1X1(element) || CAN_EXPLODE_3X3(element) || CAN_EXPLODE_CROSS(element)); +#endif +#if 0 /* special case: sub-settings dependent from main setting */ #if 0 custom_element.can_explode_by_fire = CAN_EXPLODE_BY_FIRE(element); @@ -5870,6 +5889,7 @@ static void CopyCustomElementPropertiesToEditor(int element) custom_element.can_explode_smashed = TRUE; if (CAN_EXPLODE_IMPACT(element)) custom_element.can_explode_impact = TRUE; +#endif #endif /* ---------- element settings: advanced (custom elements) --------------- */ @@ -5952,7 +5972,9 @@ static void CopyCustomElementPropertiesToGame(int element) { int i; int access_type_and_layer; +#if 0 boolean can_explode; +#endif /* mark that this custom element has been modified */ custom_element.modified_settings = TRUE; @@ -6017,17 +6039,22 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[custom_element.deadliness] = custom_element_properties[EP_DEADLY]; - /* set consistency property from checkbox and selectbox */ +#if 0 + /* set explosion type property from checkbox and selectbox */ +#if 0 custom_element_properties[EP_INDESTRUCTIBLE] = FALSE; +#endif custom_element_properties[EP_CAN_EXPLODE_1X1] = FALSE; custom_element_properties[EP_CAN_EXPLODE_3X3] = FALSE; custom_element_properties[EP_CAN_EXPLODE_CROSS] = FALSE; custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = FALSE; custom_element_properties[EP_CAN_EXPLODE_SMASHED] = FALSE; custom_element_properties[EP_CAN_EXPLODE_IMPACT] = FALSE; - custom_element_properties[custom_element.consistency] = - custom_element_properties[EP_EXPLODE_RESULT]; + custom_element_properties[custom_element.explosion_type] = + custom_element_properties[EP_CAN_EXPLODE_AT_ALL]; +#endif +#if 0 /* special case: sub-settings dependent from main setting */ #if 0 can_explode = (custom_element_properties[EP_CAN_EXPLODE_1X1] || @@ -6051,6 +6078,7 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[EP_CAN_EXPLODE_IMPACT] = custom_element.can_explode_impact; } +#endif #endif /* ---------- element settings: advanced (custom elements) --------------- */ @@ -6465,7 +6493,7 @@ static void DrawCustomContentArea() int id = ED_DRAWING_ID_CUSTOM_CONTENT; struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[id].gadget_id]; int x1 = right_gadget_border[GADGET_ID_CUSTOM_DEADLINESS]; - int x2 = right_gadget_border[GADGET_ID_CUSTOM_CONSISTENCY]; + int x2 = right_gadget_border[GADGET_ID_CUSTOM_EXPLOSION_TYPE]; int x3 = right_gadget_border[GADGET_ID_CUSTOM_EXPLODE_IMPACT]; int xoffset = ED_DRAWINGAREA_TEXT_DISTANCE; @@ -7063,7 +7091,7 @@ static void DrawPropertiesConfig() { /* set position for checkbutton for "can move into acid" */ checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y = - ED_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 : + ED_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 7 : HAS_CONTENT(properties_element) ? 1 : 0); MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID); diff --git a/src/files.c b/src/files.c index 929d38dc..b3350860 100644 --- a/src/files.c +++ b/src/files.c @@ -254,6 +254,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].slippery_type = SLIPPERY_ANY_RANDOM; + element_info[element].explosion_type = EXPLODES_3X3; element_info[element].explosion_delay = 16; element_info[element].ignition_delay = 8; @@ -267,7 +268,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].walk_to_action = 0; element_info[element].smash_targets = 0; element_info[element].deadliness = 0; - element_info[element].consistency = 0; element_info[element].can_explode_by_fire = FALSE; element_info[element].can_explode_smashed = FALSE; @@ -1086,9 +1086,10 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) ei->explosion_delay = getFile8Bit(file); ei->ignition_delay = getFile8Bit(file); + ei->explosion_type = getFile8Bit(file); /* some free bytes for future custom property values and padding */ - ReadUnusedBytesFromFile(file, 2); + ReadUnusedBytesFromFile(file, 1); /* read change property values */ @@ -2269,6 +2270,22 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } } + /* initialize "can_explode" field for old levels which did not store this */ + if (level->game_version <= VERSION_IDENT(3,1,0,2)) + { + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) + { + int element = EL_CUSTOM_START + i; + + if (EXPLODES_1X1_OLD(element)) + element_info[element].explosion_type = EXPLODES_1X1; + + SET_PROPERTY(element, EP_CAN_EXPLODE, (EXPLODES_BY_FIRE(element) || + EXPLODES_SMASHED(element) || + EXPLODES_IMPACT(element))); + } + } + #if 0 /* set default push delay values (corrected since version 3.0.7-1) */ if (level->game_version < VERSION_IDENT(3,0,7,1)) @@ -2760,9 +2777,10 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) putFile8Bit(file, ei->explosion_delay); putFile8Bit(file, ei->ignition_delay); + putFile8Bit(file, ei->explosion_type); /* some free bytes for future custom property values and padding */ - WriteUnusedBytesToFile(file, 2); + WriteUnusedBytesToFile(file, 1); /* write change property values */ diff --git a/src/game.c b/src/game.c index f0e568b8..28e62676 100644 --- a/src/game.c +++ b/src/game.c @@ -3066,9 +3066,15 @@ void Explode(int ex, int ey, int phase, int mode) #if 0 if (IS_INDESTRUCTIBLE(element)) Back[x][y] = element; +#else +#if 1 + if (IS_WALKABLE(element) && IS_INDESTRUCTIBLE(element) && + (x != ex || y != ey)) + Back[x][y] = element; #else if (IS_WALKABLE(element) && IS_INDESTRUCTIBLE(element)) Back[x][y] = element; +#endif #endif /* ignite explodable elements reached by other explosion */ @@ -3593,13 +3599,21 @@ void Bang(int x, int y) Explode(x, y, EX_PHASE_START, EX_TYPE_CENTER); break; default: +#if 1 + if (element_info[element].explosion_type == EXPLODES_CROSS) +#else if (CAN_EXPLODE_CROSS(element)) +#endif #if 1 Explode(x, y, EX_PHASE_START, EX_TYPE_CROSS); #else DynaExplode(x, y); #endif +#if 1 + else if (element_info[element].explosion_type == EXPLODES_1X1) +#else else if (CAN_EXPLODE_1X1(element)) +#endif Explode(x, y, EX_PHASE_START, EX_TYPE_CENTER); else Explode(x, y, EX_PHASE_START, EX_TYPE_NORMAL); diff --git a/src/init.c b/src/init.c index 04067389..70408171 100644 --- a/src/init.c +++ b/src/init.c @@ -2071,14 +2071,14 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_by_fire[] = + static int ep_explodes_by_fire[] = { - /* same elements as in 'ep_can_explode_impact' */ + /* same elements as in 'ep_explodes_impact' */ EL_BOMB, EL_SP_DISK_ORANGE, EL_DX_SUPABOMB, - /* same elements as in 'ep_can_explode_smashed' */ + /* same elements as in 'ep_explodes_smashed' */ EL_SATELLITE, EL_PIG, EL_DRAGON, @@ -2107,9 +2107,9 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_smashed[] = + static int ep_explodes_smashed[] = { - /* same elements as in 'ep_can_explode_impact' */ + /* same elements as in 'ep_explodes_impact' */ EL_BOMB, EL_SP_DISK_ORANGE, EL_DX_SUPABOMB, @@ -2122,7 +2122,7 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_impact[] = + static int ep_explodes_impact[] = { EL_BOMB, EL_SP_DISK_ORANGE, @@ -2214,7 +2214,7 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_1x1[] = + static int ep_explodes_1x1_old[] = { -1 }; @@ -2238,13 +2238,27 @@ void InitElementPropertiesStatic() -1 }; - static int ep_can_explode_cross[] = + static int ep_explodes_cross_old[] = { -1 }; static int ep_protected[] = { + /* same elements as in 'ep_walkable_inside' */ + EL_TUBE_ANY, + EL_TUBE_VERTICAL, + EL_TUBE_HORIZONTAL, + EL_TUBE_VERTICAL_LEFT, + EL_TUBE_VERTICAL_RIGHT, + EL_TUBE_HORIZONTAL_UP, + EL_TUBE_HORIZONTAL_DOWN, + EL_TUBE_LEFT_UP, + EL_TUBE_LEFT_DOWN, + EL_TUBE_RIGHT_UP, + EL_TUBE_RIGHT_DOWN, + + /* same elements as in 'ep_passable_over' */ EL_EM_GATE_1, EL_EM_GATE_2, EL_EM_GATE_3, @@ -2255,6 +2269,19 @@ void InitElementPropertiesStatic() EL_EM_GATE_4_GRAY, EL_SWITCHGATE_OPEN, EL_TIMEGATE_OPEN, + + /* same elements as in 'ep_passable_inside' */ + EL_SP_PORT_LEFT, + EL_SP_PORT_RIGHT, + EL_SP_PORT_UP, + EL_SP_PORT_DOWN, + EL_SP_PORT_HORIZONTAL, + EL_SP_PORT_VERTICAL, + EL_SP_PORT_ANY, + EL_SP_GRAVITY_PORT_LEFT, + EL_SP_GRAVITY_PORT_RIGHT, + EL_SP_GRAVITY_PORT_UP, + EL_SP_GRAVITY_PORT_DOWN, -1 }; @@ -2263,6 +2290,42 @@ void InitElementPropertiesStatic() -1 }; + static int ep_can_explode[] = + { + /* same elements as in 'ep_explodes_impact' */ + EL_BOMB, + EL_SP_DISK_ORANGE, + EL_DX_SUPABOMB, + + /* same elements as in 'ep_explodes_smashed' */ + EL_SATELLITE, + EL_PIG, + EL_DRAGON, + EL_MOLE, + + /* elements that can explode by explosion or by dragonfire */ + EL_DYNAMITE_ACTIVE, + EL_DYNAMITE, + EL_DYNABOMB_PLAYER_1_ACTIVE, + EL_DYNABOMB_PLAYER_2_ACTIVE, + EL_DYNABOMB_PLAYER_3_ACTIVE, + EL_DYNABOMB_PLAYER_4_ACTIVE, + EL_DYNABOMB_INCREASE_NUMBER, + EL_DYNABOMB_INCREASE_SIZE, + EL_DYNABOMB_INCREASE_POWER, + EL_SP_DISK_RED_ACTIVE, + EL_BUG, + EL_PENGUIN, + EL_SP_DISK_RED, + EL_SP_DISK_YELLOW, + EL_SP_SNIKSNAK, + EL_SP_ELECTRON, + + /* elements that can explode only by explosion */ + EL_BLACK_ORB, + -1 + }; + static int ep_player[] = { EL_PLAYER_1, @@ -3058,9 +3121,9 @@ void InitElementPropertiesStatic() { ep_can_smash_player, EP_CAN_SMASH_PLAYER }, { ep_can_smash_enemies, EP_CAN_SMASH_ENEMIES }, { ep_can_smash_everything, EP_CAN_SMASH_EVERYTHING }, - { ep_can_explode_by_fire, EP_CAN_EXPLODE_BY_FIRE }, - { ep_can_explode_smashed, EP_CAN_EXPLODE_SMASHED }, - { ep_can_explode_impact, EP_CAN_EXPLODE_IMPACT }, + { ep_explodes_by_fire, EP_EXPLODES_BY_FIRE }, + { ep_explodes_smashed, EP_EXPLODES_SMASHED }, + { ep_explodes_impact, EP_EXPLODES_IMPACT }, { ep_walkable_over, EP_WALKABLE_OVER }, { ep_walkable_inside, EP_WALKABLE_INSIDE }, { ep_walkable_under, EP_WALKABLE_UNDER }, @@ -3068,11 +3131,12 @@ void InitElementPropertiesStatic() { ep_passable_inside, EP_PASSABLE_INSIDE }, { ep_passable_under, EP_PASSABLE_UNDER }, { ep_droppable, EP_DROPPABLE }, - { ep_can_explode_1x1, EP_CAN_EXPLODE_1X1 }, + { ep_explodes_1x1_old, EP_EXPLODES_1X1_OLD }, { ep_pushable, EP_PUSHABLE }, - { ep_can_explode_cross, EP_CAN_EXPLODE_CROSS }, + { ep_explodes_cross_old, EP_EXPLODES_CROSS_OLD }, { ep_protected, EP_PROTECTED }, { ep_throwable, EP_THROWABLE }, + { ep_can_explode, EP_CAN_EXPLODE }, { ep_player, EP_PLAYER }, { ep_can_pass_magic_wall, EP_CAN_PASS_MAGIC_WALL }, @@ -3184,7 +3248,7 @@ void InitElementPropertiesEngine(int engine_version) EP_DONT_TOUCH, EP_DONT_RUN_INTO, EP_GEM, - EP_CAN_EXPLODE_BY_FIRE, + EP_EXPLODES_BY_FIRE, EP_PUSHABLE, EP_PLAYER, EP_HAS_CONTENT, @@ -3304,7 +3368,7 @@ void InitElementPropertiesEngine(int engine_version) !IS_DIGGABLE(i) && !IS_COLLECTIBLE(i))); -#if 1 +#if 0 /* ---------- PROTECTED ------------------------------------------------ */ if (IS_ACCESSIBLE_INSIDE(i)) SET_PROPERTY(i, EP_PROTECTED, TRUE); @@ -3361,11 +3425,14 @@ void InitElementPropertiesEngine(int engine_version) CAN_SMASH_ENEMIES(i) || CAN_SMASH_EVERYTHING(i))); +#if 0 /* ---------- CAN_EXPLODE ---------------------------------------------- */ SET_PROPERTY(i, EP_CAN_EXPLODE, (CAN_EXPLODE_BY_FIRE(i) || CAN_EXPLODE_SMASHED(i) || CAN_EXPLODE_IMPACT(i))); +#endif +#if 0 /* ---------- CAN_EXPLODE_3X3 ------------------------------------------ */ #if 0 SET_PROPERTY(i, EP_CAN_EXPLODE_3X3, (!CAN_EXPLODE_1X1(i) && @@ -3375,6 +3442,19 @@ void InitElementPropertiesEngine(int engine_version) !CAN_EXPLODE_1X1(i) && !CAN_EXPLODE_CROSS(i))); #endif +#endif + + /* ---------- CAN_EXPLODE_BY_FIRE -------------------------------------- */ + SET_PROPERTY(i, EP_CAN_EXPLODE_BY_FIRE, (CAN_EXPLODE(i) && + EXPLODES_BY_FIRE(i))); + + /* ---------- CAN_EXPLODE_SMASHED -------------------------------------- */ + SET_PROPERTY(i, EP_CAN_EXPLODE_SMASHED, (CAN_EXPLODE(i) && + EXPLODES_SMASHED(i))); + + /* ---------- CAN_EXPLODE_IMPACT --------------------------------------- */ + SET_PROPERTY(i, EP_CAN_EXPLODE_IMPACT, (CAN_EXPLODE(i) && + EXPLODES_IMPACT(i))); /* ---------- CAN_EXPLODE_BY_DRAGONFIRE -------------------------------- */ SET_PROPERTY(i, EP_CAN_EXPLODE_BY_DRAGONFIRE, CAN_EXPLODE_BY_FIRE(i)); @@ -3410,15 +3490,6 @@ void InitElementPropertiesEngine(int engine_version) SET_PROPERTY(i, EP_SP_PORT, (IS_SP_ELEMENT(i) && IS_PASSABLE_INSIDE(i))); -#if 0 - if (i == EL_CUSTOM_START + 253) - printf("::: %d, %d, %d -> %d\n", - CAN_EXPLODE_1X1(i), - CAN_EXPLODE_3X3(i), - CAN_EXPLODE_CROSS(i), - CAN_EXPLODE(i)); -#endif - /* ---------- CAN_CHANGE ----------------------------------------------- */ SET_PROPERTY(i, EP_CAN_CHANGE, FALSE); /* default: cannot change */ for (j = 0; j < element_info[i].num_change_pages; j++) diff --git a/src/main.h b/src/main.h index 9637f6ad..541139ce 100644 --- a/src/main.h +++ b/src/main.h @@ -74,9 +74,9 @@ #define EP_CAN_SMASH_PLAYER 10 #define EP_CAN_SMASH_ENEMIES 11 #define EP_CAN_SMASH_EVERYTHING 12 -#define EP_CAN_EXPLODE_BY_FIRE 13 -#define EP_CAN_EXPLODE_SMASHED 14 -#define EP_CAN_EXPLODE_IMPACT 15 +#define EP_EXPLODES_BY_FIRE 13 +#define EP_EXPLODES_SMASHED 14 +#define EP_EXPLODES_IMPACT 15 #define EP_WALKABLE_OVER 16 #define EP_WALKABLE_INSIDE 17 #define EP_WALKABLE_UNDER 18 @@ -84,12 +84,13 @@ #define EP_PASSABLE_INSIDE 20 #define EP_PASSABLE_UNDER 21 #define EP_DROPPABLE 22 -#define EP_CAN_EXPLODE_1X1 23 +#define EP_EXPLODES_1X1_OLD 23 #define EP_PUSHABLE 24 -#define EP_CAN_EXPLODE_CROSS 25 +#define EP_EXPLODES_CROSS_OLD 25 #define EP_PROTECTED 26 #define EP_CAN_MOVE_INTO_ACID 27 #define EP_THROWABLE 28 +#define EP_CAN_EXPLODE 29 /* values for pre-defined properties */ #define EP_PLAYER 32 @@ -139,21 +140,22 @@ #define EP_DRAGONFIRE_PROOF 70 #define EP_EXPLOSION_PROOF 71 #define EP_CAN_SMASH 72 -#define EP_CAN_EXPLODE 73 -#define EP_CAN_EXPLODE_3X3 74 -#define EP_SP_PORT 75 -#define EP_CAN_EXPLODE_BY_DRAGONFIRE 76 -#define EP_CAN_EXPLODE_BY_EXPLOSION 77 -#define EP_COULD_MOVE_INTO_ACID 78 -#define EP_MAYBE_DONT_COLLIDE_WITH 79 -#define EP_DIGGABLE_WITH_GRAVITY 80 +#define EP_EXPLODES_3X3_OLD 73 +#define EP_CAN_EXPLODE_BY_FIRE 74 +#define EP_CAN_EXPLODE_SMASHED 75 +#define EP_CAN_EXPLODE_IMPACT 76 +#define EP_SP_PORT 77 +#define EP_CAN_EXPLODE_BY_DRAGONFIRE 78 +#define EP_CAN_EXPLODE_BY_EXPLOSION 79 +#define EP_COULD_MOVE_INTO_ACID 80 +#define EP_MAYBE_DONT_COLLIDE_WITH 81 +#define EP_DIGGABLE_WITH_GRAVITY 82 /* values for internal purpose only (level editor) */ -#define EP_EXPLODE_RESULT 81 -#define EP_WALK_TO_OBJECT 82 -#define EP_DEADLY 83 +#define EP_WALK_TO_OBJECT 83 +#define EP_DEADLY 84 -#define NUM_ELEMENT_PROPERTIES 84 +#define NUM_ELEMENT_PROPERTIES 85 #define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32) #define EP_BITFIELD_BASE 0 @@ -307,6 +309,11 @@ #define SLIPPERY_ONLY_LEFT 3 #define SLIPPERY_ONLY_RIGHT 4 +/* values for explosion type for custom elements */ +#define EXPLODES_3X3 0 +#define EXPLODES_1X1 1 +#define EXPLODES_CROSS 2 + /* macros for configurable properties */ #define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE) #define IS_COLLECTIBLE_ONLY(e) HAS_PROPERTY(e, EP_COLLECTIBLE_ONLY) @@ -321,9 +328,9 @@ #define CAN_SMASH_PLAYER(e) HAS_PROPERTY(e, EP_CAN_SMASH_PLAYER) #define CAN_SMASH_ENEMIES(e) HAS_PROPERTY(e, EP_CAN_SMASH_ENEMIES) #define CAN_SMASH_EVERYTHING(e) HAS_PROPERTY(e, EP_CAN_SMASH_EVERYTHING) -#define CAN_EXPLODE_BY_FIRE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE) -#define CAN_EXPLODE_SMASHED(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED) -#define CAN_EXPLODE_IMPACT(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT) +#define EXPLODES_BY_FIRE(e) HAS_PROPERTY(e, EP_EXPLODES_BY_FIRE) +#define EXPLODES_SMASHED(e) HAS_PROPERTY(e, EP_EXPLODES_SMASHED) +#define EXPLODES_IMPACT(e) HAS_PROPERTY(e, EP_EXPLODES_IMPACT) #define IS_WALKABLE_OVER(e) HAS_PROPERTY(e, EP_WALKABLE_OVER) #define IS_WALKABLE_INSIDE(e) HAS_PROPERTY(e, EP_WALKABLE_INSIDE) #define IS_WALKABLE_UNDER(e) HAS_PROPERTY(e, EP_WALKABLE_UNDER) @@ -331,12 +338,13 @@ #define IS_PASSABLE_INSIDE(e) HAS_PROPERTY(e, EP_PASSABLE_INSIDE) #define IS_PASSABLE_UNDER(e) HAS_PROPERTY(e, EP_PASSABLE_UNDER) #define IS_DROPPABLE(e) HAS_PROPERTY(e, EP_DROPPABLE) -#define CAN_EXPLODE_1X1(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_1X1) +#define EXPLODES_1X1_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_1X1_OLD) #define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE) -#define CAN_EXPLODE_CROSS(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_CROSS) +#define EXPLODES_CROSS_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_CROSS_OLD) #define IS_PROTECTED(e) HAS_PROPERTY(e, EP_PROTECTED) #define CAN_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID) #define IS_THROWABLE(e) HAS_PROPERTY(e, EP_THROWABLE) +#define CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE) /* macros for special configurable properties */ #define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL) @@ -386,8 +394,10 @@ #define IS_DRAGONFIRE_PROOF(e) HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF) #define IS_EXPLOSION_PROOF(e) HAS_PROPERTY(e, EP_EXPLOSION_PROOF) #define CAN_SMASH(e) HAS_PROPERTY(e, EP_CAN_SMASH) -#define CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE) -#define CAN_EXPLODE_3X3(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_3X3) +#define EXPLODES_3X3_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_3X3_OLD) +#define CAN_EXPLODE_BY_FIRE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE) +#define CAN_EXPLODE_SMASHED(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED) +#define CAN_EXPLODE_IMPACT(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT) #define IS_SP_PORT(e) HAS_PROPERTY(e, EP_SP_PORT) #define CAN_EXPLODE_BY_DRAGONFIRE(e) \ HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_DRAGONFIRE) @@ -1687,6 +1697,7 @@ struct ElementInfo int content[3][3]; /* 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 */ int ignition_delay; /* delay for explosion by other explosion */ @@ -1720,7 +1731,6 @@ struct ElementInfo int walk_to_action; /* diggable/collectible/pushable */ int smash_targets; /* can smash player/enemies/everything */ int deadliness; /* deadly when running/colliding/touching */ - int consistency; /* indestructible/can explode */ boolean can_explode_by_fire; /* element explodes by fire */ boolean can_explode_smashed; /* element explodes when smashed */