-1
};
+ static int ep_walkable_through[] =
+ {
+ 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,
+ -1
+ };
+
+ static int ep_walkable_under[] =
+ {
+ -1
+ };
+
+ static int ep_passable_over[] =
+ {
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1_GRAY,
+ EL_EM_GATE_2_GRAY,
+ EL_EM_GATE_3_GRAY,
+ EL_EM_GATE_4_GRAY,
+ EL_SWITCHGATE_OPEN,
+ EL_TIMEGATE_OPEN,
+ -1
+ };
+
+ static int ep_passable_through[] =
+ {
+ 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
+ };
+
+ static int ep_passable_under[] =
+ {
+ -1
+ };
+
static int ep_diggable[] =
{
EL_SAND,
-1
};
- static int ep_walkable_through[] =
- {
- EL_EM_GATE_1,
- EL_EM_GATE_2,
- EL_EM_GATE_3,
- EL_EM_GATE_4,
- EL_EM_GATE_1_GRAY,
- EL_EM_GATE_2_GRAY,
- EL_EM_GATE_3_GRAY,
- EL_EM_GATE_4_GRAY,
- 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,
- EL_SWITCHGATE_OPEN,
- EL_TIMEGATE_OPEN,
- -1
- };
-
static int ep_over_player[] =
{
EL_SP_PORT_LEFT,
-1
};
- static int ep_walkable_under[] =
- {
- 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,
- -1
- };
-
static int ep_sp_element[] =
{
EL_SP_EMPTY,
-1
};
- static int ep_solid_new[] =
- {
- -1
- };
-
static struct
{
int *elements;
{ ep_pushable, EP_PUSHABLE },
{ ep_player, EP_PLAYER },
{ ep_walkable_over, EP_WALKABLE_OVER },
+ { ep_walkable_through, EP_WALKABLE_THROUGH },
+ { ep_walkable_under, EP_WALKABLE_UNDER },
+ { ep_passable_over, EP_PASSABLE_OVER },
+ { ep_passable_through, EP_PASSABLE_THROUGH },
+ { ep_passable_under, EP_PASSABLE_UNDER },
+
{ ep_diggable, EP_DIGGABLE },
{ ep_collectible, EP_COLLECTIBLE },
- { ep_walkable_through, EP_WALKABLE_THROUGH },
{ 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_walkable_under, EP_WALKABLE_UNDER },
{ ep_sp_element, EP_SP_ELEMENT },
{ ep_has_content, EP_HAS_CONTENT },
- { ep_solid_new, EP_SOLID_NEW },
{ NULL, -1 }
};
EP_PLAYER,
EP_HAS_CONTENT,
EP_DIGGABLE,
- EP_WALKABLE_THROUGH,
+ EP_PASSABLE_THROUGH,
EP_OVER_PLAYER,
EP_ACTIVE_BOMB,
for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
SET_PROPERTY(i, EP_INACTIVE, TRUE);
+ /* set properties derived from other properties */
+ for (i=0; i<MAX_NUM_ELEMENTS; i++)
+ {
+ if (IS_WALKABLE_OVER(i) || IS_WALKABLE_THROUGH(i) || IS_WALKABLE_UNDER(i))
+ SET_PROPERTY(i, EP_WALKABLE, TRUE);
+
+ if (IS_PASSABLE_OVER(i) || IS_PASSABLE_THROUGH(i) || IS_PASSABLE_UNDER(i))
+ SET_PROPERTY(i, EP_PASSABLE, TRUE);
+
+ if (IS_WALKABLE_OVER(i) || IS_PASSABLE_OVER(i))
+ SET_PROPERTY(i, EP_PLAYER_OVER, TRUE);
+
+ if (IS_WALKABLE_THROUGH(i) || IS_PASSABLE_THROUGH(i))
+ SET_PROPERTY(i, EP_PLAYER_INSIDE, TRUE);
+
+ if (IS_WALKABLE_UNDER(i) || IS_PASSABLE_UNDER(i))
+ SET_PROPERTY(i, EP_PLAYER_UNDER, TRUE);
+ }
+
#if 0
/* determine inactive elements (used for engine main loop optimization) */
for (i=0; i < MAX_NUM_ELEMENTS; i++)
#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)
-/* property values */
+/* values for base properties */
#define EP_AMOEBALIVE 0
#define EP_AMOEBOID 1
#define EP_CAN_BE_CRUMBLED 2
#define EP_PUSHABLE 24
#define EP_PLAYER 25
#define EP_WALKABLE_OVER 26
-#define EP_DIGGABLE 27
-#define EP_COLLECTIBLE 28
-#define EP_WALKABLE_THROUGH 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_WALKABLE_UNDER 35
-#define EP_SP_ELEMENT 36
-#define EP_HAS_CONTENT 37
-#define EP_SOLID_NEW 38
-
-#define NUM_ELEMENT_PROPERTIES 39
+#define EP_WALKABLE_THROUGH 27
+#define EP_WALKABLE_UNDER 28
+#define EP_PASSABLE_OVER 29
+#define EP_PASSABLE_THROUGH 30
+#define EP_PASSABLE_UNDER 31
+
+/* values for runtime properties */
+#define EP_WALKABLE 32
+#define EP_PASSABLE 33
+#define EP_PLAYER_OVER 34
+#define EP_PLAYER_INSIDE 35
+#define EP_PLAYER_UNDER 36
+#define EP_DIGGABLE 37
+#define EP_COLLECTIBLE 38
+#define EP_OVER_PLAYER 39
+#define EP_ACTIVE_BOMB 40
+#define EP_BELT 41
+#define EP_BELT_ACTIVE 42
+#define EP_BELT_SWITCH 43
+#define EP_SP_ELEMENT 44
+#define EP_HAS_CONTENT 45
+
+#define NUM_ELEMENT_PROPERTIES 46
#define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32)
#define EP_BITFIELD_BASE 0
+#define EP_BITMASK_DEFAULT 0
+
#define PROPERTY_BIT(p) (1 << ((p) % 32))
#define PROPERTY_VAR(e, p) (Properties[e][(p) / 32])
#define HAS_PROPERTY(e, p) ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
(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_CAN_BE_CRUMBLED PROPERTY_BIT(EP_CAN_BE_CRUMBLED)
-#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_FOOD_DARK_YAMYAM PROPERTY_BIT(EP_FOOD_DARK_YAMYAM)
-#define EP_BIT_EM_SLIPPERY_WALL PROPERTY_BIT(EP_EM_SLIPPERY_WALL)
-#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_FOOD_PENGUIN PROPERTY_BIT(EP_FOOD_PENGUIN)
-#define EP_BIT_PUSHABLE PROPERTY_BIT(EP_PUSHABLE)
-#define EP_BIT_PLAYER PROPERTY_BIT(EP_PLAYER)
-#define EP_BIT_WALKABLE_OVER PROPERTY_BIT(EP_WALKABLE_OVER)
-#define EP_BIT_DIGGABLE PROPERTY_BIT(EP_DIGGABLE)
-#define EP_BIT_COLLECTIBLE PROPERTY_BIT(EP_COLLECTIBLE)
-#define EP_BIT_WALKABLE_THROUGH PROPERTY_BIT(EP_WALKABLE_THROUGH)
-#define EP_BIT_OVER_PLAYER PROPERTY_BIT(EP_OVER_PLAYER)
-#define EP_BIT_ACTIVE_BOMB PROPERTY_BIT(EP_ACTIVE_BOMB)
-
-#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_WALKABLE_UNDER PROPERTY_BIT(EP_WALKABLE_UNDER)
-#define EP_BIT_SP_ELEMENT PROPERTY_BIT(EP_SP_ELEMENT)
-#define EP_BIT_HAS_CONTENT PROPERTY_BIT(EP_HAS_CONTENT)
-#define EP_BIT_SOLID_NEW PROPERTY_BIT(EP_SOLID_NEW)
-
-
-#define EP_BITMASK_DEFAULT 0
-
-/* property macros */
+/* macros for base properties */
#define IS_AMOEBALIVE(e) HAS_PROPERTY(e, EP_AMOEBALIVE)
#define IS_AMOEBOID(e) HAS_PROPERTY(e, EP_AMOEBOID)
#define CAN_BE_CRUMBLED(e) HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED)
#define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE)
#define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER)
#define IS_WALKABLE_OVER(e) HAS_PROPERTY(e, EP_WALKABLE_OVER)
+#define IS_WALKABLE_THROUGH(e) HAS_PROPERTY(e, EP_WALKABLE_THROUGH)
+#define IS_WALKABLE_UNDER(e) HAS_PROPERTY(e, EP_WALKABLE_UNDER)
+#define IS_PASSABLE_OVER(e) HAS_PROPERTY(e, EP_PASSABLE_OVER)
+#define IS_PASSABLE_THROUGH(e) HAS_PROPERTY(e, EP_PASSABLE_THROUGH)
+#define IS_PASSABLE_UNDER(e) HAS_PROPERTY(e, EP_PASSABLE_UNDER)
+
+/* macros for runtime properties */
+#define IS_WALKABLE(e) HAS_PROPERTY(e, EP_WALKABLE)
+#define IS_PASSABLE(e) HAS_PROPERTY(e, EP_PASSABLE)
+#define IS_PLAYER_OVER(e) HAS_PROPERTY(e, EP_PLAYER_OVER)
+#define IS_PLAYER_INSIDE(e) HAS_PROPERTY(e, EP_PLAYER_INSIDE)
+#define IS_PLAYER_UNDER(e) HAS_PROPERTY(e, EP_PLAYER_UNDER)
#define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE)
#define IS_COLLECTIBLE(e) HAS_PROPERTY(e, EP_COLLECTIBLE)
-#define IS_WALKABLE_THROUGH(e) HAS_PROPERTY(e, EP_WALKABLE_THROUGH)
#define IS_OVER_PLAYER(e) HAS_PROPERTY(e, EP_OVER_PLAYER)
#define IS_ACTIVE_BOMB(e) HAS_PROPERTY(e, EP_ACTIVE_BOMB)
-
#define IS_BELT(e) HAS_PROPERTY(e, EP_BELT)
#define IS_BELT_ACTIVE(e) HAS_PROPERTY(e, EP_BELT_ACTIVE)
#define IS_BELT_SWITCH(e) HAS_PROPERTY(e, EP_BELT_SWITCH)
-#define IS_WALKABLE_UNDER(e) HAS_PROPERTY(e, EP_WALKABLE_UNDER)
#define IS_SP_ELEMENT(e) HAS_PROPERTY(e, EP_SP_ELEMENT)
#define HAS_CONTENT(e) HAS_PROPERTY(e, EP_HAS_CONTENT)
-#define IS_SOLID_NEW(e) HAS_PROPERTY(e, EP_SOLID_NEW)
#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \
(e) <= EL_CUSTOM_END)