-#define COMPILE_DATE_STRING "[2003-04-13 03:34]"
+#define COMPILE_DATE_STRING "[2003-04-13 18:26]"
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;
boolean pushable;
boolean slippery;
} custom_element_properties[NUM_CUSTOM_ELEMENTS];
+#endif
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"
}
};
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;
Properties1[element] &= ~EP_BIT_SLIPPERY;
}
}
+#endif
void DrawLevelEd()
{
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],
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],
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],
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],
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],
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)
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;
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);
}
{
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++;
/* 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 */
for (i=0; i<ep_em_slippery_wall_num; i++)
{
+#if 1
+ SET_PROPERTY(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL,
+ level.em_slippery_gems);
+#else
if (level.em_slippery_gems) /* special EM style gems behaviour */
- Properties2[ep_em_slippery_wall[i]] |=
+ PROPERTY_VAR(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL) |=
EP_BIT_EM_SLIPPERY_WALL;
else
- Properties2[ep_em_slippery_wall[i]] &=
+ PROPERTY_VAR(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL) &=
~EP_BIT_EM_SLIPPERY_WALL;
+#endif
}
/* "EL_EXPANDABLE_WALL_GROWING" wasn't slippery for EM gems in 2.0.1 */
+#if 1
+ SET_PROPERTY(EL_EXPANDABLE_WALL_GROWING, EP_EM_SLIPPERY_WALL,
+ (level.em_slippery_gems &&
+ game.engine_version > 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 */
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
/* 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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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[] =
{
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<MAX_NUM_ELEMENTS; i++)
- {
- Properties1[i] = 0;
- Properties2[i] = 0;
- }
+ for (j=0; j<NUM_EP_BITFIELDS; j++)
+ Properties[i][j] = EP_BITMASK_DEFAULT;
- for (i=0; i<num_properties1; i++)
- for (j=0; j<*(ep1_num[i]); j++)
- Properties1[(ep1_array[i])[j]] |= ep1_bit[i];
- for (i=0; i<num_properties2; i++)
- for (j=0; j<*(ep2_num[i]); j++)
- Properties2[(ep2_array[i])[j]] |= ep2_bit[i];
+ /* set all predefined element properties from above arrays */
+ for (i=0; element_properties[i].elements != NULL; i++)
+ for (j=0; (element_properties[i].elements)[j] >= 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()
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];
#define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
#define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
-/* values for 'Properties1' */
-#define EP_BIT_AMOEBALIVE (1 << 0)
-#define EP_BIT_AMOEBOID (1 << 1)
-#define EP_BIT_SCHLUESSEL (1 << 2)
-#define EP_BIT_PFORTE (1 << 3)
-#define EP_BIT_SOLID (1 << 4)
-#define EP_BIT_INDESTRUCTIBLE (1 << 5)
-#define EP_BIT_SLIPPERY (1 << 6)
-#define EP_BIT_ENEMY (1 << 7)
-#define EP_BIT_MAUER (1 << 8)
-#define EP_BIT_CAN_FALL (1 << 9)
-#define EP_BIT_CAN_SMASH (1 << 10)
-#define EP_BIT_CAN_CHANGE (1 << 11)
-#define EP_BIT_CAN_MOVE (1 << 12)
-#define EP_BIT_COULD_MOVE (1 << 13)
-#define EP_BIT_DONT_TOUCH (1 << 14)
-#define EP_BIT_DONT_GO_TO (1 << 15)
-#define EP_BIT_MAMPF2 (1 << 16)
-#define EP_BIT_CHAR (1 << 17)
-#define EP_BIT_BD_ELEMENT (1 << 18)
-#define EP_BIT_SB_ELEMENT (1 << 19)
-#define EP_BIT_GEM (1 << 20)
-#define EP_BIT_INACTIVE (1 << 21)
-#define EP_BIT_EXPLOSIVE (1 << 22)
-#define EP_BIT_MAMPF3 (1 << 23)
-#define EP_BIT_PUSHABLE (1 << 24)
-#define EP_BIT_PLAYER (1 << 25)
-#define EP_BIT_HAS_CONTENT (1 << 26)
-#define EP_BIT_EATABLE (1 << 27)
-#define EP_BIT_SP_ELEMENT (1 << 28)
-#define EP_BIT_QUICK_GATE (1 << 29)
-#define EP_BIT_OVER_PLAYER (1 << 30)
-#define EP_BIT_ACTIVE_BOMB (1 << 31)
+/* property values */
+#define EP_AMOEBALIVE 0
+#define EP_AMOEBOID 1
+#define EP_SCHLUESSEL 2
+#define EP_PFORTE 3
+#define EP_SOLID 4
+#define EP_INDESTRUCTIBLE 5
+#define EP_SLIPPERY 6
+#define EP_ENEMY 7
+#define EP_MAUER 8
+#define EP_CAN_FALL 9
+#define EP_CAN_SMASH 10
+#define EP_CAN_CHANGE 11
+#define EP_CAN_MOVE 12
+#define EP_COULD_MOVE 13
+#define EP_DONT_TOUCH 14
+#define EP_DONT_GO_TO 15
+#define EP_MAMPF2 16
+#define EP_CHAR 17
+#define EP_BD_ELEMENT 18
+#define EP_SB_ELEMENT 19
+#define EP_GEM 20
+#define EP_INACTIVE 21
+#define EP_EXPLOSIVE 22
+#define EP_MAMPF3 23
+#define EP_PUSHABLE 24
+#define EP_PLAYER 25
+#define EP_HAS_CONTENT 26
+#define EP_EATABLE 27
+#define EP_SP_ELEMENT 28
+#define EP_QUICK_GATE 29
+#define EP_OVER_PLAYER 30
+#define EP_ACTIVE_BOMB 31
+
+#define EP_BELT 32
+#define EP_BELT_ACTIVE 33
+#define EP_BELT_SWITCH 34
+#define EP_TUBE 35
+#define EP_EM_SLIPPERY_WALL 36
+#define EP_CAN_BE_CRUMBLED 37
+
+#define NUM_ELEMENT_PROPERTIES 38
+
+#define NUM_EP_BITFIELDS (NUM_ELEMENT_PROPERTIES / 32)
+#define EP_BITFIELD_BASE 0
+
+#define PROPERTY_BIT(p) (1 << ((p) % 32))
+#define PROPERTY_VAR(e, p) (Properties[e][(p) / 32])
+#define PROPERTY_VALUE(e, p) (PROPERTY_VAR(e, p) & PROPERTY_BIT(p))
+#define SET_PROPERTY(e, p, v) ((v) ? \
+ (PROPERTY_VAR(e,p) |= PROPERTY_BIT(p)) : \
+ (PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
+
+/* property bit masks */
+#define EP_BIT_AMOEBALIVE PROPERTY_BIT(EP_AMOEBALIVE)
+#define EP_BIT_AMOEBOID PROPERTY_BIT(EP_AMOEBOID)
+#define EP_BIT_SCHLUESSEL PROPERTY_BIT(EP_SCHLUESSEL)
+#define EP_BIT_PFORTE PROPERTY_BIT(EP_PFORTE)
+#define EP_BIT_SOLID PROPERTY_BIT(EP_SOLID)
+#define EP_BIT_INDESTRUCTIBLE PROPERTY_BIT(EP_INDESTRUCTIBLE)
+#define EP_BIT_SLIPPERY PROPERTY_BIT(EP_SLIPPERY)
+#define EP_BIT_ENEMY PROPERTY_BIT(EP_ENEMY)
+#define EP_BIT_MAUER PROPERTY_BIT(EP_MAUER)
+#define EP_BIT_CAN_FALL PROPERTY_BIT(EP_CAN_FALL)
+#define EP_BIT_CAN_SMASH PROPERTY_BIT(EP_CAN_SMASH)
+#define EP_BIT_CAN_CHANGE PROPERTY_BIT(EP_CAN_CHANGE)
+#define EP_BIT_CAN_MOVE PROPERTY_BIT(EP_CAN_MOVE)
+#define EP_BIT_COULD_MOVE PROPERTY_BIT(EP_COULD_MOVE)
+#define EP_BIT_DONT_TOUCH PROPERTY_BIT(EP_DONT_TOUCH)
+#define EP_BIT_DONT_GO_TO PROPERTY_BIT(EP_DONT_GO_TO)
+#define EP_BIT_MAMPF2 PROPERTY_BIT(EP_MAMPF2)
+#define EP_BIT_CHAR PROPERTY_BIT(EP_CHAR)
+#define EP_BIT_BD_ELEMENT PROPERTY_BIT(EP_BD_ELEMENT)
+#define EP_BIT_SB_ELEMENT PROPERTY_BIT(EP_SB_ELEMENT)
+#define EP_BIT_GEM PROPERTY_BIT(EP_GEM)
+#define EP_BIT_INACTIVE PROPERTY_BIT(EP_INACTIVE)
+#define EP_BIT_EXPLOSIVE PROPERTY_BIT(EP_EXPLOSIVE)
+#define EP_BIT_MAMPF3 PROPERTY_BIT(EP_MAMPF3)
+#define EP_BIT_PUSHABLE PROPERTY_BIT(EP_PUSHABLE)
+#define EP_BIT_PLAYER PROPERTY_BIT(EP_PLAYER)
+#define EP_BIT_HAS_CONTENT PROPERTY_BIT(EP_HAS_CONTENT)
+#define EP_BIT_EATABLE PROPERTY_BIT(EP_EATABLE)
+#define EP_BIT_SP_ELEMENT PROPERTY_BIT(EP_SP_ELEMENT)
+#define EP_BIT_QUICK_GATE PROPERTY_BIT(EP_QUICK_GATE)
+#define EP_BIT_OVER_PLAYER PROPERTY_BIT(EP_OVER_PLAYER)
+#define EP_BIT_ACTIVE_BOMB PROPERTY_BIT(EP_ACTIVE_BOMB)
/* values for 'Properties2' */
-#define EP_BIT_BELT (1 << 0)
-#define EP_BIT_BELT_ACTIVE (1 << 1)
-#define EP_BIT_BELT_SWITCH (1 << 2)
-#define EP_BIT_TUBE (1 << 3)
-#define EP_BIT_EM_SLIPPERY_WALL (1 << 4)
-#define EP_BIT_CAN_BE_CRUMBLED (1 << 5)
+#define EP_BIT_BELT PROPERTY_BIT(EP_BELT)
+#define EP_BIT_BELT_ACTIVE PROPERTY_BIT(EP_BELT_ACTIVE)
+#define EP_BIT_BELT_SWITCH PROPERTY_BIT(EP_BELT_SWITCH)
+#define EP_BIT_TUBE PROPERTY_BIT(EP_TUBE)
+#define EP_BIT_EM_SLIPPERY_WALL PROPERTY_BIT(EP_EM_SLIPPERY_WALL)
+#define EP_BIT_CAN_BE_CRUMBLED PROPERTY_BIT(EP_CAN_BE_CRUMBLED)
+
#define EP_BITMASK_DEFAULT 0
-#define IS_AMOEBALIVE(e) (Properties1[e] & EP_BIT_AMOEBALIVE)
-#define IS_AMOEBOID(e) (Properties1[e] & EP_BIT_AMOEBOID)
-#define IS_SCHLUESSEL(e) (Properties1[e] & EP_BIT_SCHLUESSEL)
-#define IS_PFORTE(e) (Properties1[e] & EP_BIT_PFORTE)
-#define IS_SOLID(e) (Properties1[e] & EP_BIT_SOLID)
-#define IS_INDESTRUCTIBLE(e) (Properties1[e] & EP_BIT_INDESTRUCTIBLE)
-#define IS_SLIPPERY(e) (Properties1[e] & EP_BIT_SLIPPERY)
-#define IS_ENEMY(e) (Properties1[e] & EP_BIT_ENEMY)
-#define IS_MAUER(e) (Properties1[e] & EP_BIT_MAUER)
-#define CAN_FALL(e) (Properties1[e] & EP_BIT_CAN_FALL)
-#define CAN_SMASH(e) (Properties1[e] & EP_BIT_CAN_SMASH)
-#define CAN_CHANGE(e) (Properties1[e] & EP_BIT_CAN_CHANGE)
-#define CAN_MOVE(e) (Properties1[e] & EP_BIT_CAN_MOVE)
-#define COULD_MOVE(e) (Properties1[e] & EP_BIT_COULD_MOVE)
-#define DONT_TOUCH(e) (Properties1[e] & EP_BIT_DONT_TOUCH)
-#define DONT_GO_TO(e) (Properties1[e] & EP_BIT_DONT_GO_TO)
-#define IS_MAMPF2(e) (Properties1[e] & EP_BIT_MAMPF2)
-#define IS_CHAR(e) (Properties1[e] & EP_BIT_CHAR)
-#define IS_BD_ELEMENT(e) (Properties1[e] & EP_BIT_BD_ELEMENT)
-#define IS_SB_ELEMENT(e) (Properties1[e] & EP_BIT_SB_ELEMENT)
-#define IS_GEM(e) (Properties1[e] & EP_BIT_GEM)
-#define IS_INACTIVE(e) (Properties1[e] & EP_BIT_INACTIVE)
-#define IS_EXPLOSIVE(e) (Properties1[e] & EP_BIT_EXPLOSIVE)
-#define IS_MAMPF3(e) (Properties1[e] & EP_BIT_MAMPF3)
-#define IS_PUSHABLE(e) (Properties1[e] & EP_BIT_PUSHABLE)
-#define ELEM_IS_PLAYER(e) (Properties1[e] & EP_BIT_PLAYER)
-#define HAS_CONTENT(e) (Properties1[e] & EP_BIT_HAS_CONTENT)
-#define IS_EATABLE(e) (Properties1[e] & EP_BIT_EATABLE)
-#define IS_SP_ELEMENT(e) (Properties1[e] & EP_BIT_SP_ELEMENT)
-#define IS_QUICK_GATE(e) (Properties1[e] & EP_BIT_QUICK_GATE)
-#define IS_OVER_PLAYER(e) (Properties1[e] & EP_BIT_OVER_PLAYER)
-#define IS_ACTIVE_BOMB(e) (Properties1[e] & EP_BIT_ACTIVE_BOMB)
-
-#define IS_BELT(e) (Properties2[e] & EP_BIT_BELT)
-#define IS_BELT_ACTIVE(e) (Properties2[e] & EP_BIT_BELT_ACTIVE)
-#define IS_BELT_SWITCH(e) (Properties2[e] & EP_BIT_BELT_SWITCH)
-#define IS_TUBE(e) (Properties2[e] & EP_BIT_TUBE)
-#define IS_EM_SLIPPERY_WALL(e) (Properties2[e] & EP_BIT_EM_SLIPPERY_WALL)
-#define CAN_BE_CRUMBLED(e) (Properties2[e] & EP_BIT_CAN_BE_CRUMBLED)
+/* property macros */
+#define IS_AMOEBALIVE(e) PROPERTY_VALUE(e, EP_AMOEBALIVE)
+#define IS_AMOEBOID(e) PROPERTY_VALUE(e, EP_AMOEBOID)
+#define IS_SCHLUESSEL(e) PROPERTY_VALUE(e, EP_SCHLUESSEL)
+#define IS_PFORTE(e) PROPERTY_VALUE(e, EP_PFORTE)
+#define IS_SOLID(e) PROPERTY_VALUE(e, EP_SOLID)
+#define IS_INDESTRUCTIBLE(e) PROPERTY_VALUE(e, EP_INDESTRUCTIBLE)
+#define IS_SLIPPERY(e) PROPERTY_VALUE(e, EP_SLIPPERY)
+#define IS_ENEMY(e) PROPERTY_VALUE(e, EP_ENEMY)
+#define IS_MAUER(e) PROPERTY_VALUE(e, EP_MAUER)
+#define CAN_FALL(e) PROPERTY_VALUE(e, EP_CAN_FALL)
+#define CAN_SMASH(e) PROPERTY_VALUE(e, EP_CAN_SMASH)
+#define CAN_CHANGE(e) PROPERTY_VALUE(e, EP_CAN_CHANGE)
+#define CAN_MOVE(e) PROPERTY_VALUE(e, EP_CAN_MOVE)
+#define COULD_MOVE(e) PROPERTY_VALUE(e, EP_COULD_MOVE)
+#define DONT_TOUCH(e) PROPERTY_VALUE(e, EP_DONT_TOUCH)
+#define DONT_GO_TO(e) PROPERTY_VALUE(e, EP_DONT_GO_TO)
+#define IS_MAMPF2(e) PROPERTY_VALUE(e, EP_MAMPF2)
+#define IS_CHAR(e) PROPERTY_VALUE(e, EP_CHAR)
+#define IS_BD_ELEMENT(e) PROPERTY_VALUE(e, EP_BD_ELEMENT)
+#define IS_SB_ELEMENT(e) PROPERTY_VALUE(e, EP_SB_ELEMENT)
+#define IS_GEM(e) PROPERTY_VALUE(e, EP_GEM)
+#define IS_INACTIVE(e) PROPERTY_VALUE(e, EP_INACTIVE)
+#define IS_EXPLOSIVE(e) PROPERTY_VALUE(e, EP_EXPLOSIVE)
+#define IS_MAMPF3(e) PROPERTY_VALUE(e, EP_MAMPF3)
+#define IS_PUSHABLE(e) PROPERTY_VALUE(e, EP_PUSHABLE)
+#define ELEM_IS_PLAYER(e) PROPERTY_VALUE(e, EP_PLAYER)
+#define HAS_CONTENT(e) PROPERTY_VALUE(e, EP_HAS_CONTENT)
+#define IS_EATABLE(e) PROPERTY_VALUE(e, EP_EATABLE)
+#define IS_SP_ELEMENT(e) PROPERTY_VALUE(e, EP_SP_ELEMENT)
+#define IS_QUICK_GATE(e) PROPERTY_VALUE(e, EP_QUICK_GATE)
+#define IS_OVER_PLAYER(e) PROPERTY_VALUE(e, EP_OVER_PLAYER)
+#define IS_ACTIVE_BOMB(e) PROPERTY_VALUE(e, EP_ACTIVE_BOMB)
+
+#define IS_BELT(e) PROPERTY_VALUE(e, EP_BELT)
+#define IS_BELT_ACTIVE(e) PROPERTY_VALUE(e, EP_BELT_ACTIVE)
+#define IS_BELT_SWITCH(e) PROPERTY_VALUE(e, EP_BELT_SWITCH)
+#define IS_TUBE(e) PROPERTY_VALUE(e, EP_TUBE)
+#define IS_EM_SLIPPERY_WALL(e) PROPERTY_VALUE(e, EP_EM_SLIPPERY_WALL)
+#define CAN_BE_CRUMBLED(e) PROPERTY_VALUE(e, EP_CAN_BE_CRUMBLED)
#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \
(e) <= EL_CUSTOM_END)
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];