From 6a066eac92bfa607cec653f6a97917891aee0d95 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 13 Apr 2003 18:27:39 +0200 Subject: [PATCH] rnd-20030413-3-src --- src/conftime.h | 2 +- src/editor.c | 50 +++++++- src/files.c | 10 +- src/game.c | 15 ++- src/init.c | 342 ++++++++++++++++++------------------------------- src/main.c | 3 +- src/main.h | 214 +++++++++++++++++++------------ 7 files changed, 323 insertions(+), 313 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 6970b695..eb689e1d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-04-13 03:34]" +#define COMPILE_DATE_STRING "[2003-04-13 18:26]" diff --git a/src/editor.c b/src/editor.c index 4707b4ff..66a09d7b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -531,6 +531,9 @@ static int random_placement_background_element = EL_SAND; static boolean random_placement_background_restricted = FALSE; static boolean stick_element_properties_window = FALSE; +#if 1 +boolean custom_element_properties[NUM_ELEMENT_PROPERTIES]; +#else static struct { boolean indestructible; @@ -539,6 +542,7 @@ static struct boolean pushable; boolean slippery; } custom_element_properties[NUM_CUSTOM_ELEMENTS]; +#endif static struct { @@ -857,31 +861,31 @@ static struct { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(10), GADGET_ID_CUSTOM_INDESTRUCTIBLE, - &custom_element_properties[0].indestructible, + &custom_element_properties[EP_INDESTRUCTIBLE], "indestructible", "element cannot be destroyed" }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(11), GADGET_ID_CUSTOM_CAN_FALL, - &custom_element_properties[0].can_fall, + &custom_element_properties[EP_CAN_FALL], "can fall", "element can fall down" }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(12), GADGET_ID_CUSTOM_CAN_SMASH, - &custom_element_properties[0].can_smash, + &custom_element_properties[EP_CAN_SMASH], "can smash", "element can smash other elements" }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(13), GADGET_ID_CUSTOM_PUSHABLE, - &custom_element_properties[0].pushable, + &custom_element_properties[EP_PUSHABLE], "pushable", "element can be pushed" }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(14), GADGET_ID_CUSTOM_SLIPPERY, - &custom_element_properties[0].slippery, + &custom_element_properties[EP_SLIPPERY], "slippery", "other elements can fall down from it" } }; @@ -2808,6 +2812,25 @@ static void CopyPlayfield(short src[MAX_LEV_FIELDX][MAX_LEV_FIELDY], dst[x][y] = src[x][y]; } +#if 1 +static void CopyCustomElementPropertiesToEditor(int element) +{ + int i; + + for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) + custom_element_properties[i] = PROPERTY_VALUE(element, i); +} + +static void CopyCustomElementPropertiesToGame(int element) +{ + int i; + + for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) + SET_PROPERTY(element, i, custom_element_properties[i]); +} + +#else + static void CopyCustomElementPropertiesToEditor() { int i; @@ -2870,6 +2893,7 @@ static void CopyCustomElementPropertiesToGame() Properties1[element] &= ~EP_BIT_SLIPPERY; } } +#endif void DrawLevelEd() { @@ -3480,16 +3504,20 @@ static void DrawPropertiesConfig() if (IS_CUSTOM_ELEMENT(properties_element)) { +#if 0 int nr = properties_element - EL_CUSTOM_START; +#endif - CopyCustomElementPropertiesToEditor(); + CopyCustomElementPropertiesToEditor(properties_element); /* draw checkbutton gadget */ i = ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE; x = checkbutton_info[i].x + xoffset_right2; y = checkbutton_info[i].y + yoffset_right2; +#if 0 checkbutton_info[i].value = &custom_element_properties[nr].indestructible; +#endif DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text); ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], @@ -3501,7 +3529,9 @@ static void DrawPropertiesConfig() x = checkbutton_info[i].x + xoffset_right2; y = checkbutton_info[i].y + yoffset_right2; +#if 0 checkbutton_info[i].value = &custom_element_properties[nr].can_fall; +#endif DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text); ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], @@ -3513,7 +3543,9 @@ static void DrawPropertiesConfig() x = checkbutton_info[i].x + xoffset_right2; y = checkbutton_info[i].y + yoffset_right2; +#if 0 checkbutton_info[i].value = &custom_element_properties[nr].can_smash; +#endif DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text); ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], @@ -3525,7 +3557,9 @@ static void DrawPropertiesConfig() x = checkbutton_info[i].x + xoffset_right2; y = checkbutton_info[i].y + yoffset_right2; +#if 0 checkbutton_info[i].value = &custom_element_properties[nr].pushable; +#endif DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text); ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], @@ -3537,7 +3571,9 @@ static void DrawPropertiesConfig() x = checkbutton_info[i].x + xoffset_right2; y = checkbutton_info[i].y + yoffset_right2; +#if 0 checkbutton_info[i].value = &custom_element_properties[nr].slippery; +#endif DrawTextF(x, y, FONT_TEXT_1, checkbutton_info[i].text); ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id], @@ -4794,7 +4830,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) if (type_id >= ED_CHECKBUTTON_ID_CUSTOM_FIRST && type_id <= ED_CHECKBUTTON_ID_CUSTOM_LAST) - CopyCustomElementPropertiesToGame(); + CopyCustomElementPropertiesToGame(properties_element); } static void HandleControlButtons(struct GadgetInfo *gi) diff --git a/src/files.c b/src/files.c index d13c2871..36380f92 100644 --- a/src/files.c +++ b/src/files.c @@ -97,7 +97,7 @@ static void setLevelInfoToDefaults() for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) { level.custom_element_successor[i] = EL_EMPTY_SPACE; - Properties1[EL_CUSTOM_START + i] = EP_BITMASK_DEFAULT; + Properties[EL_CUSTOM_START + i][EP_BITFIELD_BASE] = EP_BITMASK_DEFAULT; } BorderElement = EL_STEELWALL; @@ -337,7 +337,7 @@ static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level) int properties = getFile32BitBE(file); if (IS_CUSTOM_ELEMENT(element)) - Properties1[element] = properties; + Properties[element][EP_BITFIELD_BASE] = properties; else Error(ERR_WARN, "invalid custom element number %d", element); } @@ -726,12 +726,12 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level, { int element = EL_CUSTOM_START + i; - if (Properties1[element] != EP_BITMASK_DEFAULT) + if (Properties[element][EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT) { if (check < num_changed_custom_elements) { putFile16BitBE(file, element); - putFile32BitBE(file, Properties1[element]); + putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]); } check++; @@ -813,7 +813,7 @@ void SaveLevel(int level_nr) /* check for non-standard custom elements and calculate "CUS1" chunk size */ for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) - if (Properties1[EL_CUSTOM_START + i] != EP_BITMASK_DEFAULT) + if (Properties[EL_CUSTOM_START +i][EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT) num_changed_custom_elements1++; /* check for non-standard custom elements and calculate "CUS2" chunk size */ diff --git a/src/game.c b/src/game.c index d60f158a..bdd3059e 100644 --- a/src/game.c +++ b/src/game.c @@ -535,19 +535,30 @@ static void InitGameEngine() for (i=0; i VERSION_IDENT(2,0,1))); +#else if (level.em_slippery_gems && game.engine_version > VERSION_IDENT(2,0,1)) Properties2[EL_EXPANDABLE_WALL_GROWING] |= EP_BIT_EM_SLIPPERY_WALL; else Properties2[EL_EXPANDABLE_WALL_GROWING] &=~EP_BIT_EM_SLIPPERY_WALL; +#endif } /* initialize changing elements information */ diff --git a/src/init.c b/src/init.c index 14e64084..7af34951 100644 --- a/src/init.c +++ b/src/init.c @@ -1087,9 +1087,9 @@ void InitElementProperties() EL_AMOEBA_WET, EL_AMOEBA_DRY, EL_AMOEBA_FULL, - EL_BD_AMOEBA + EL_BD_AMOEBA, + -1 }; - static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive); static int ep_amoeboid[] = { @@ -1097,9 +1097,9 @@ void InitElementProperties() EL_AMOEBA_WET, EL_AMOEBA_DRY, EL_AMOEBA_FULL, - EL_BD_AMOEBA + EL_BD_AMOEBA, + -1 }; - static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid); static int ep_schluessel[] = { @@ -1110,9 +1110,9 @@ void InitElementProperties() EL_EM_KEY_1, EL_EM_KEY_2, EL_EM_KEY_3, - EL_EM_KEY_4 + EL_EM_KEY_4, + -1 }; - static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel); static int ep_pforte[] = { @@ -1150,9 +1150,9 @@ void InitElementProperties() EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, - EL_TUBE_RIGHT_DOWN + EL_TUBE_RIGHT_DOWN, + -1 }; - static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte); static int ep_solid[] = { @@ -1305,9 +1305,9 @@ void InitElementProperties() EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, - EL_TUBE_RIGHT_DOWN + EL_TUBE_RIGHT_DOWN, + -1 }; - static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid); static int ep_indestructible[] = { @@ -1397,9 +1397,9 @@ void InitElementProperties() EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, - EL_TUBE_RIGHT_DOWN + EL_TUBE_RIGHT_DOWN, + -1 }; - static int ep_indestructible_num = SIZEOF_ARRAY_INT(ep_indestructible); static int ep_slippery[] = { @@ -1434,9 +1434,9 @@ void InitElementProperties() EL_SPEED_PILL, EL_STEELWALL_SLANTED, EL_PEARL, - EL_CRYSTAL + EL_CRYSTAL, + -1 }; - static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery); static int ep_enemy[] = { @@ -1449,9 +1449,9 @@ void InitElementProperties() EL_ROBOT, EL_PACMAN, EL_SP_SNIKSNAK, - EL_SP_ELECTRON + EL_SP_ELECTRON, + -1 }; - static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy); static int ep_mauer[] = { @@ -1519,9 +1519,9 @@ void InitElementProperties() EL_EMC_WALL_5, EL_EMC_WALL_6, EL_EMC_WALL_7, - EL_EMC_WALL_8 + EL_EMC_WALL_8, + -1 }; - static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer); static int ep_can_fall[] = { @@ -1547,9 +1547,9 @@ void InitElementProperties() EL_PEARL, EL_CRYSTAL, EL_SPRING, - EL_DX_SUPABOMB + EL_DX_SUPABOMB, + -1 }; - static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall); static int ep_can_smash[] = { @@ -1572,9 +1572,9 @@ void InitElementProperties() EL_PEARL, EL_CRYSTAL, EL_SPRING, - EL_DX_SUPABOMB + EL_DX_SUPABOMB, + -1 }; - static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash); static int ep_can_change[] = { @@ -1585,9 +1585,9 @@ void InitElementProperties() EL_EMERALD_YELLOW, EL_EMERALD_RED, EL_EMERALD_PURPLE, - EL_DIAMOND + EL_DIAMOND, + -1 }; - static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change); static int ep_can_move[] = { @@ -1607,9 +1607,9 @@ void InitElementProperties() EL_SP_SNIKSNAK, EL_SP_ELECTRON, EL_BALLOON, - EL_SPRING + EL_SPRING, + -1 }; - static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move); static int ep_could_move[] = { @@ -1632,18 +1632,18 @@ void InitElementProperties() EL_PACMAN_RIGHT, EL_PACMAN_UP, EL_PACMAN_LEFT, - EL_PACMAN_DOWN + EL_PACMAN_DOWN, + -1 }; - static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move); static int ep_dont_touch[] = { EL_BUG, EL_SPACESHIP, EL_BD_BUTTERFLY, - EL_BD_FIREFLY + EL_BD_FIREFLY, + -1 }; - static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch); static int ep_dont_go_to[] = { @@ -1661,9 +1661,9 @@ void InitElementProperties() EL_SP_ELECTRON, EL_SP_BUGGY_BASE_ACTIVE, EL_TRAP_ACTIVE, - EL_LANDMINE + EL_LANDMINE, + -1 }; - static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to); static int ep_mampf2[] = { @@ -1688,9 +1688,9 @@ void InitElementProperties() EL_EMERALD_PURPLE, EL_DIAMOND, EL_PEARL, - EL_CRYSTAL + EL_CRYSTAL, + -1 }; - static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2); static int ep_bd_element[] = { @@ -1717,9 +1717,9 @@ void InitElementProperties() EL_BD_BUTTERFLY_3, EL_BD_BUTTERFLY_4, EL_BD_AMOEBA, - EL_CHAR_QUESTION + EL_CHAR_QUESTION, + -1 }; - static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element); static int ep_sb_element[] = { @@ -1729,9 +1729,9 @@ void InitElementProperties() EL_SOKOBAN_FIELD_EMPTY, EL_SOKOBAN_FIELD_FULL, EL_PLAYER_1, - EL_INVISIBLE_STEELWALL + EL_INVISIBLE_STEELWALL, + -1 }; - static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element); static int ep_gem[] = { @@ -1740,9 +1740,9 @@ void InitElementProperties() EL_EMERALD_YELLOW, EL_EMERALD_RED, EL_EMERALD_PURPLE, - EL_DIAMOND + EL_DIAMOND, + -1 }; - static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem); static int ep_inactive[] = { @@ -1876,9 +1876,9 @@ void InitElementProperties() EL_EMC_WALL_5, EL_EMC_WALL_6, EL_EMC_WALL_7, - EL_EMC_WALL_8 + EL_EMC_WALL_8, + -1 }; - static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive); static int ep_explosive[] = { @@ -1904,9 +1904,9 @@ void InitElementProperties() EL_SP_DISK_YELLOW, EL_SP_SNIKSNAK, EL_SP_ELECTRON, - EL_DX_SUPABOMB + EL_DX_SUPABOMB, + -1 }; - static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive); static int ep_mampf3[] = { @@ -1917,9 +1917,9 @@ void InitElementProperties() EL_EMERALD_PURPLE, EL_DIAMOND, EL_PEARL, - EL_CRYSTAL + EL_CRYSTAL, + -1 }; - static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3); static int ep_pushable[] = { @@ -1936,18 +1936,18 @@ void InitElementProperties() EL_SP_DISK_YELLOW, EL_BALLOON, EL_SPRING, - EL_DX_SUPABOMB + EL_DX_SUPABOMB, + -1 }; - static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable); static int ep_player[] = { EL_PLAYER_1, EL_PLAYER_2, EL_PLAYER_3, - EL_PLAYER_4 + EL_PLAYER_4, + -1 }; - static int ep_player_num = SIZEOF_ARRAY_INT(ep_player); static int ep_has_content[] = { @@ -1955,9 +1955,9 @@ void InitElementProperties() EL_AMOEBA_WET, EL_AMOEBA_DRY, EL_AMOEBA_FULL, - EL_BD_AMOEBA + EL_BD_AMOEBA, + -1 }; - static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content); static int ep_eatable[] = { @@ -1967,9 +1967,9 @@ void InitElementProperties() EL_SP_BUGGY_BASE_ACTIVATING, EL_TRAP, EL_INVISIBLE_SAND, - EL_INVISIBLE_SAND_ACTIVE + EL_INVISIBLE_SAND_ACTIVE, + -1 }; - static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable); static int ep_sp_element[] = { @@ -2017,9 +2017,9 @@ void InitElementProperties() /* additional elements that appeared in newer Supaplex levels */ EL_INVISIBLE_WALL, /* more than one murphy in a level results in an inactive clone */ - EL_SP_MURPHY_CLONE + EL_SP_MURPHY_CLONE, + -1 }; - static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element); static int ep_quick_gate[] = { @@ -2043,9 +2043,9 @@ void InitElementProperties() EL_SP_PORT_VERTICAL, EL_SP_PORT_ANY, EL_SWITCHGATE_OPEN, - EL_TIMEGATE_OPEN + EL_TIMEGATE_OPEN, + -1 }; - static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate); static int ep_over_player[] = { @@ -2070,9 +2070,9 @@ void InitElementProperties() EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, - EL_TUBE_RIGHT_DOWN + EL_TUBE_RIGHT_DOWN, + -1 }; - static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player); static int ep_active_bomb[] = { @@ -2081,9 +2081,9 @@ void InitElementProperties() EL_DYNABOMB_PLAYER_2_ACTIVE, EL_DYNABOMB_PLAYER_3_ACTIVE, EL_DYNABOMB_PLAYER_4_ACTIVE, - EL_SP_DISK_RED_ACTIVE + EL_SP_DISK_RED_ACTIVE, + -1 }; - static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb); static int ep_belt[] = { @@ -2099,8 +2099,8 @@ void InitElementProperties() EL_CONVEYOR_BELT_4_LEFT, EL_CONVEYOR_BELT_4_MIDDLE, EL_CONVEYOR_BELT_4_RIGHT, + -1 }; - static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt); static int ep_belt_active[] = { @@ -2116,8 +2116,8 @@ void InitElementProperties() EL_CONVEYOR_BELT_4_LEFT_ACTIVE, EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE, EL_CONVEYOR_BELT_4_RIGHT_ACTIVE, + -1 }; - static int ep_belt_active_num = SIZEOF_ARRAY_INT(ep_belt_active); static int ep_belt_switch[] = { @@ -2133,8 +2133,8 @@ void InitElementProperties() EL_CONVEYOR_BELT_4_SWITCH_LEFT, EL_CONVEYOR_BELT_4_SWITCH_MIDDLE, EL_CONVEYOR_BELT_4_SWITCH_RIGHT, + -1 }; - static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch); static int ep_tube[] = { @@ -2148,171 +2148,81 @@ void InitElementProperties() EL_TUBE_LEFT_UP, EL_TUBE_LEFT_DOWN, EL_TUBE_RIGHT_UP, - EL_TUBE_RIGHT_DOWN + EL_TUBE_RIGHT_DOWN, + -1 }; - static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube); - - static int ep_em_slippery_wall[] = - { - }; - static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall); static int ep_can_be_crumbled[] = { EL_SAND, EL_LANDMINE, EL_TRAP, - EL_TRAP_ACTIVE - }; - static int ep_can_be_crumbled_num = SIZEOF_ARRAY_INT(ep_can_be_crumbled); - - static long ep1_bit[] = - { - EP_BIT_AMOEBALIVE, - EP_BIT_AMOEBOID, - EP_BIT_SCHLUESSEL, - EP_BIT_PFORTE, - EP_BIT_SOLID, - EP_BIT_INDESTRUCTIBLE, - EP_BIT_SLIPPERY, - EP_BIT_ENEMY, - EP_BIT_MAUER, - EP_BIT_CAN_FALL, - EP_BIT_CAN_SMASH, - EP_BIT_CAN_CHANGE, - EP_BIT_CAN_MOVE, - EP_BIT_COULD_MOVE, - EP_BIT_DONT_TOUCH, - EP_BIT_DONT_GO_TO, - EP_BIT_MAMPF2, - EP_BIT_BD_ELEMENT, - EP_BIT_SB_ELEMENT, - EP_BIT_GEM, - EP_BIT_INACTIVE, - EP_BIT_EXPLOSIVE, - EP_BIT_MAMPF3, - EP_BIT_PUSHABLE, - EP_BIT_PLAYER, - EP_BIT_HAS_CONTENT, - EP_BIT_EATABLE, - EP_BIT_SP_ELEMENT, - EP_BIT_QUICK_GATE, - EP_BIT_OVER_PLAYER, - EP_BIT_ACTIVE_BOMB - }; - static long ep2_bit[] = - { - EP_BIT_BELT, - EP_BIT_BELT_ACTIVE, - EP_BIT_BELT_SWITCH, - EP_BIT_TUBE, - EP_BIT_EM_SLIPPERY_WALL, - EP_BIT_CAN_BE_CRUMBLED - }; - static int *ep1_array[] = - { - ep_amoebalive, - ep_amoeboid, - ep_schluessel, - ep_pforte, - ep_solid, - ep_indestructible, - ep_slippery, - ep_enemy, - ep_mauer, - ep_can_fall, - ep_can_smash, - ep_can_change, - ep_can_move, - ep_could_move, - ep_dont_touch, - ep_dont_go_to, - ep_mampf2, - ep_bd_element, - ep_sb_element, - ep_gem, - ep_inactive, - ep_explosive, - ep_mampf3, - ep_pushable, - ep_player, - ep_has_content, - ep_eatable, - ep_sp_element, - ep_quick_gate, - ep_over_player, - ep_active_bomb - }; - static int *ep2_array[] = - { - ep_belt, - ep_belt_active, - ep_belt_switch, - ep_tube, - ep_em_slippery_wall, - ep_can_be_crumbled - }; - static int *ep1_num[] = - { - &ep_amoebalive_num, - &ep_amoeboid_num, - &ep_schluessel_num, - &ep_pforte_num, - &ep_solid_num, - &ep_indestructible_num, - &ep_slippery_num, - &ep_enemy_num, - &ep_mauer_num, - &ep_can_fall_num, - &ep_can_smash_num, - &ep_can_change_num, - &ep_can_move_num, - &ep_could_move_num, - &ep_dont_touch_num, - &ep_dont_go_to_num, - &ep_mampf2_num, - &ep_bd_element_num, - &ep_sb_element_num, - &ep_gem_num, - &ep_inactive_num, - &ep_explosive_num, - &ep_mampf3_num, - &ep_pushable_num, - &ep_player_num, - &ep_has_content_num, - &ep_eatable_num, - &ep_sp_element_num, - &ep_quick_gate_num, - &ep_over_player_num, - &ep_active_bomb_num + EL_TRAP_ACTIVE, + -1 }; - static int *ep2_num[] = - { - &ep_belt_num, - &ep_belt_active_num, - &ep_belt_switch_num, - &ep_tube_num, - &ep_em_slippery_wall_num, - &ep_can_be_crumbled_num + + static struct + { + int *elements; + int property; + } element_properties[] = + { + { ep_amoebalive, EP_AMOEBALIVE }, + { ep_amoeboid, EP_AMOEBOID }, + { ep_schluessel, EP_SCHLUESSEL }, + { ep_pforte, EP_PFORTE }, + { ep_solid, EP_SOLID }, + { ep_indestructible, EP_INDESTRUCTIBLE }, + { ep_slippery, EP_SLIPPERY }, + { ep_enemy, EP_ENEMY }, + { ep_mauer, EP_MAUER }, + { ep_can_fall, EP_CAN_FALL }, + { ep_can_smash, EP_CAN_SMASH }, + { ep_can_change, EP_CAN_CHANGE }, + { ep_can_move, EP_CAN_MOVE }, + { ep_could_move, EP_COULD_MOVE }, + { ep_dont_touch, EP_DONT_TOUCH }, + { ep_dont_go_to, EP_DONT_GO_TO }, + { ep_mampf2, EP_MAMPF2 }, + { ep_bd_element, EP_BD_ELEMENT }, + { ep_sb_element, EP_SB_ELEMENT }, + { ep_gem, EP_GEM }, + { ep_inactive, EP_INACTIVE }, + { ep_explosive, EP_EXPLOSIVE }, + { ep_mampf3, EP_MAMPF3 }, + { ep_pushable, EP_PUSHABLE }, + { ep_player, EP_PLAYER }, + { ep_has_content, EP_HAS_CONTENT }, + { ep_eatable, EP_EATABLE }, + { ep_sp_element, EP_SP_ELEMENT }, + { ep_quick_gate, EP_QUICK_GATE }, + { ep_over_player, EP_OVER_PLAYER }, + { ep_active_bomb, EP_ACTIVE_BOMB }, + { ep_belt, EP_BELT }, + { ep_belt_active, EP_BELT_ACTIVE }, + { ep_belt_switch, EP_BELT_SWITCH }, + { ep_tube, EP_TUBE }, + { ep_can_be_crumbled, EP_CAN_BE_CRUMBLED }, + { NULL, -1 } }; - static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *); - static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *); + /* always start with reliable default values (no properties) */ for (i=0; i= 0; j++) + SET_PROPERTY((element_properties[i].elements)[j], + element_properties[i].property, TRUE); + /* set properties of character elements */ for (i=EL_CHAR_START; i<=EL_CHAR_END; i++) - Properties1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE); + { + SET_PROPERTY(i, EP_CHAR, TRUE); + SET_PROPERTY(i, EP_INACTIVE, TRUE); + } } static void InitGlobal() diff --git a/src/main.c b/src/main.c index 2c77e70a..dcd6301f 100644 --- a/src/main.c +++ b/src/main.c @@ -55,8 +55,7 @@ short AmoebaCnt2[MAX_NUM_AMOEBA]; short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; -unsigned long Properties1[MAX_NUM_ELEMENTS]; -unsigned long Properties2[MAX_NUM_ELEMENTS]; +unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS]; int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; diff --git a/src/main.h b/src/main.h index 545c161a..e5de8657 100644 --- a/src/main.h +++ b/src/main.h @@ -60,89 +60,144 @@ #define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2) #define IN_LEV_FIELD(x,y) ((x)>=0 && (x)=0 &&(y)= EL_CUSTOM_START && \ (e) <= EL_CUSTOM_END) @@ -1178,8 +1233,7 @@ extern short AmoebaCnt2[MAX_NUM_AMOEBA]; extern short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; -extern unsigned long Properties1[MAX_NUM_ELEMENTS]; -extern unsigned long Properties2[MAX_NUM_ELEMENTS]; +extern unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS]; extern int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; -- 2.34.1