#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 13)
#define GADGET_ID_CHANGE_DIRECT_ACTION (GADGET_ID_SELECTBOX_FIRST + 14)
#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 15)
-#define GADGET_ID_CHANGE_SIDES (GADGET_ID_SELECTBOX_FIRST + 16)
-#define GADGET_ID_CHANGE_PLAYERS (GADGET_ID_SELECTBOX_FIRST + 17)
-#define GADGET_ID_CHANGE_PAGES (GADGET_ID_SELECTBOX_FIRST + 18)
+#define GADGET_ID_CHANGE_SIDE (GADGET_ID_SELECTBOX_FIRST + 16)
+#define GADGET_ID_CHANGE_PLAYER (GADGET_ID_SELECTBOX_FIRST + 17)
+#define GADGET_ID_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 18)
#define GADGET_ID_CHANGE_POWER (GADGET_ID_SELECTBOX_FIRST + 19)
#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 20)
#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 21)
#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 13
#define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION 14
#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 15
-#define ED_SELECTBOX_ID_CHANGE_SIDES 16
-#define ED_SELECTBOX_ID_CHANGE_PLAYERS 17
-#define ED_SELECTBOX_ID_CHANGE_PAGES 18
+#define ED_SELECTBOX_ID_CHANGE_SIDE 16
+#define ED_SELECTBOX_ID_CHANGE_PLAYER 17
+#define ED_SELECTBOX_ID_CHANGE_PAGE 18
#define ED_SELECTBOX_ID_CHANGE_POWER 19
#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 20
#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 21
{
{ EP_WALKABLE, "walkable" },
{ EP_PASSABLE, "passable" },
+
{ -1, NULL }
};
{ EP_ACCESSIBLE_OVER, "over" },
{ EP_ACCESSIBLE_INSIDE, "inside" },
{ EP_ACCESSIBLE_UNDER, "under" },
+
{ -1, NULL }
};
{
{ 0, "unprotected" },
{ 1, "protected" },
+
{ -1, NULL }
};
{ MV_VERTICAL | MV_LEFT, "vertical + left" },
{ MV_VERTICAL | MV_RIGHT, "vertical + right" },
{ MV_ALL_DIRECTIONS, "all directions" },
+
{ -1, NULL }
};
{ EP_COLLECTIBLE_ONLY, "collectible" },
{ EP_DROPPABLE, "collectible & droppable" },
{ EP_PUSHABLE, "pushable" },
+
{ -1, NULL }
};
{ MV_WHEN_DROPPED, "when dropped" },
{ MV_MAZE_RUNNER, "maze runner style" },
{ MV_MAZE_HUNTER, "maze hunter style" },
+
{ -1, NULL }
};
{ MV_START_DOWN, "down" },
{ MV_START_RANDOM, "random" },
{ MV_START_PREVIOUS, "previous" },
+
{ -1, NULL }
};
{ 4, "normal" },
{ 8, "fast" },
{ 16, "very fast" },
+
{ -1, NULL }
};
{
{ LEAVE_TYPE_UNLIMITED, "leave behind" },
{ LEAVE_TYPE_LIMITED, "change it to" },
+
{ -1, NULL }
};
{ EP_CAN_SMASH_ENEMIES, "enemies" },
#endif
{ EP_CAN_SMASH_EVERYTHING, "everything" },
+
{ -1, NULL }
};
{ SLIPPERY_ANY_RIGHT_LEFT, "right, left" },
{ SLIPPERY_ONLY_LEFT, "only left" },
{ SLIPPERY_ONLY_RIGHT, "only right" },
+
{ -1, NULL }
};
{ EP_DONT_RUN_INTO, "running into" },
{ EP_DONT_COLLIDE_WITH, "colliding with" },
{ EP_DONT_TOUCH, "touching" },
+
{ -1, NULL }
};
{ EP_CAN_EXPLODE_DYNA, "can explode 3+3" },
{ EP_CAN_EXPLODE_1X1, "can explode 1x1" },
{ EP_INDESTRUCTIBLE, "indestructible" },
+
{ -1, NULL }
};
{
{ 1, "frames" },
{ FRAMES_PER_SECOND, "seconds" },
+
{ -1, NULL }
};
#endif
{ CE_IMPACT, "impact (on something)" },
{ CE_SMASHED, "smashed (from above)" },
+
{ -1, NULL }
};
{ CE_OTHER_GETS_HIT, "hit by ..." },
#endif
{ CE_OTHER_IS_SWITCHING, "switch of ..." },
- { CE_OTHER_IS_CHANGING, "change of" },
+ { CE_OTHER_IS_CHANGING, "change by page of" },
{ CE_OTHER_IS_EXPLODING, "explosion of" },
+
{ -1, NULL }
};
-static struct ValueTextInfo options_change_sides[] =
+static struct ValueTextInfo options_change_trigger_side[] =
{
{ CH_SIDE_LEFT, "left" },
{ CH_SIDE_RIGHT, "right" },
{ CH_SIDE_LEFT_RIGHT, "left/right" },
{ CH_SIDE_TOP_BOTTOM, "top/bottom" },
{ CH_SIDE_ANY, "any" },
+
{ -1, NULL }
};
static struct ValueTextInfo options_change_trigger_player[] =
{
- { 0, "any" },
- { 1, "1" },
- { 2, "2" },
- { 3, "3" },
- { 4, "4" },
+ { CH_PLAYER_1, "1" },
+ { CH_PLAYER_2, "2" },
+ { CH_PLAYER_3, "3" },
+ { CH_PLAYER_4, "4" },
+ { CH_PLAYER_ANY, "any" },
+
{ -1, NULL }
};
static struct ValueTextInfo options_change_trigger_page[] =
{
- { 0, "any" },
- { 1, "1" },
- { 2, "2" },
- { 3, "3" },
- { 4, "4" },
- { 5, "5" },
- { 6, "6" },
- { 7, "7" },
- { 8, "8" },
- { 9, "9" },
- { 10, "10" },
- { 11, "11" },
- { 12, "12" },
- { 13, "13" },
- { 14, "14" },
- { 15, "15" },
- { 16, "16" },
- { 17, "17" },
- { 18, "18" },
- { 19, "19" },
- { 20, "20" },
- { 21, "21" },
- { 22, "22" },
- { 23, "23" },
- { 24, "24" },
- { 25, "25" },
- { 26, "26" },
- { 27, "27" },
- { 28, "28" },
- { 29, "29" },
- { 30, "30" },
- { 31, "31" },
- { 32, "32" },
+ { (1 << 0), "1" },
+ { (1 << 1), "2" },
+ { (1 << 2), "3" },
+ { (1 << 3), "4" },
+ { (1 << 4), "5" },
+ { (1 << 5), "6" },
+ { (1 << 6), "7" },
+ { (1 << 7), "8" },
+ { (1 << 8), "9" },
+ { (1 << 9), "10" },
+ { (1 << 10), "11" },
+ { (1 << 11), "12" },
+ { (1 << 12), "13" },
+ { (1 << 13), "14" },
+ { (1 << 14), "15" },
+ { (1 << 15), "16" },
+ { (1 << 16), "17" },
+ { (1 << 17), "18" },
+ { (1 << 18), "19" },
+ { (1 << 19), "20" },
+ { (1 << 20), "21" },
+ { (1 << 21), "22" },
+ { (1 << 22), "23" },
+ { (1 << 23), "24" },
+ { (1 << 24), "25" },
+ { (1 << 25), "26" },
+ { (1 << 26), "27" },
+ { (1 << 27), "28" },
+ { (1 << 28), "29" },
+ { (1 << 29), "30" },
+ { (1 << 30), "31" },
+ { (1 << 31), "32" },
+ { CH_PAGE_ANY, "any" },
+
{ -1, NULL }
};
{ CP_NON_DESTRUCTIVE, "empty" },
{ CP_HALF_DESTRUCTIVE, "diggable" },
{ CP_FULL_DESTRUCTIVE, "destructible" },
+
{ -1, NULL }
};
{ ANIM_LINEAR, "linear" },
{ ANIM_PINGPONG, "pingpong" },
{ ANIM_PINGPONG2, "pingpong 2" },
+
{ -1, NULL }
};
},
{
ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(6),
- GADGET_ID_CHANGE_SIDES, GADGET_ID_NONE,
+ GADGET_ID_CHANGE_SIDE, GADGET_ID_NONE,
-1,
- options_change_sides,
- &custom_element_change.sides,
+ options_change_trigger_side,
+ &custom_element_change.trigger_side,
"... at", "side", "element side that causes change"
},
{
ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(7),
- GADGET_ID_CHANGE_PLAYERS, GADGET_ID_NONE,
+ GADGET_ID_CHANGE_PLAYER, GADGET_ID_NONE,
-1,
options_change_trigger_player,
&custom_element_change.trigger_player,
},
{
ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(7),
- GADGET_ID_CHANGE_PAGES, GADGET_ID_CHANGE_PLAYERS,
+ GADGET_ID_CHANGE_PAGE, GADGET_ID_CHANGE_PLAYER,
-1,
options_change_trigger_page,
&custom_element_change.trigger_page,
change_to->can_change = change_from->can_change;
- change_to->sides = change_from->sides;
+ change_to->trigger_side = change_from->trigger_side;
}
#endif
static void TestIfElementHitsCustomElement(int, int, int);
static void ChangeElement(int, int, int);
+
static boolean CheckTriggeredElementChangeExt(int, int, int, int, int,int,int);
-static boolean CheckTriggeredElementSideChange(int, int, int, int, int);
-static boolean CheckTriggeredElementPlayerChange(int, int, int, int, int, int);
-static boolean CheckTriggeredElementPageChange(int, int, int, int, int);
-static boolean CheckTriggeredElementChange(int, int, int, int);
+#define CheckTriggeredElementChange(x, y, e, ev) \
+ CheckTriggeredElementChangeExt(x, y, e, ev, -1, CH_SIDE_ANY, -1)
+#define CheckTriggeredElementChangePlayer(x, y, e, ev, p, s) \
+ CheckTriggeredElementChangeExt(x, y, e, ev, p, s, -1)
+#define CheckTriggeredElementChangeSide(x, y, e, ev, s) \
+ CheckTriggeredElementChangeExt(x, y, e, ev, -1, s, -1)
+#define CheckTriggeredElementChangePage(x, y, e, ev, p) \
+ CheckTriggeredElementChangeExt(x, y, e, ev, -1, CH_SIDE_ANY, p)
+
static boolean CheckElementChangeExt(int, int, int, int, int, int, int);
-static boolean CheckElementSideChange(int, int, int, int, int, int);
-static boolean CheckElementPlayerChange(int, int, int, int, int, int, int);
-static boolean CheckElementChange(int, int, int, int);
+#define CheckElementChange(x, y, e, ev) \
+ CheckElementChangeExt(x, y, e, ev, -1, CH_SIDE_ANY, -1)
+#define CheckElementChangePlayer(x, y, e, ev, p, s) \
+ CheckElementChangeExt(x, y, e, ev, p, s, -1)
+#define CheckElementChangeSide(x, y, e, ev, s) \
+ CheckElementChangeExt(x, y, e, ev, -1, s, -1)
+#define CheckElementChangePage(x, y, e, ev, p) \
+ CheckElementChangeExt(x, y, e, ev, -1, CH_SIDE_ANY, p)
static void PlayLevelSound(int, int, int);
static void PlayLevelSoundNearest(int, int, int);
struct PlayerInfo *player = &stored_player[i];
player->index_nr = i;
+ player->index_bit = (1 << i);
player->element_nr = EL_PLAYER_1 + i;
player->present = FALSE;
{
CheckElementChange(x, y + 1, smashed, CE_SMASHED);
- CheckTriggeredElementSideChange(x, y + 1, smashed, CH_SIDE_TOP,
- CE_OTHER_IS_SWITCHING);
- CheckElementSideChange(x, y + 1, smashed, CH_SIDE_TOP,
- CE_SWITCHED, -1);
+ CheckTriggeredElementChangeSide(x, y + 1, smashed,
+ CE_OTHER_IS_SWITCHING, CH_SIDE_TOP);
+ CheckElementChangeSide(x, y + 1, smashed, CE_SWITCHED, CH_SIDE_TOP);
}
}
else
int hitting_element = Feld[newx][newy];
/* !!! fix side (direction) orientation here and elsewhere !!! */
- CheckElementSideChange(newx, newy, hitting_element,
- direction, CE_HITTING_SOMETHING, -1);
+ CheckElementChangeSide(newx, newy, hitting_element, CE_HITTING_SOMETHING,
+ direction);
#if 0
if (IN_LEV_FIELD(nextx, nexty))
{
int i;
- CheckElementSideChange(nextx, nexty, touched_element,
- opposite_direction, CE_HIT_BY_SOMETHING, -1);
+ CheckElementChangeSide(nextx, nexty, touched_element,
+ CE_HIT_BY_SOMETHING, opposite_direction);
if (IS_CUSTOM_ELEMENT(hitting_element) &&
HAS_ANY_CHANGE_EVENT(hitting_element, CE_OTHER_IS_HITTING))
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_IS_HITTING) &&
- change->sides & touched_side &&
+ change->trigger_side & touched_side &&
change->trigger_element == touched_element)
{
- CheckElementSideChange(newx, newy, hitting_element,
- CH_SIDE_ANY, CE_OTHER_IS_HITTING, i);
+ CheckElementChangePage(newx, newy, hitting_element,
+ CE_OTHER_IS_HITTING, i);
break;
}
}
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_GETS_HIT) &&
- change->sides & hitting_side &&
+ change->trigger_side & hitting_side &&
change->trigger_element == hitting_element)
{
- CheckElementSideChange(nextx, nexty, touched_element,
- CH_SIDE_ANY, CE_OTHER_GETS_HIT, i);
+ CheckElementChangePage(nextx, nexty, touched_element,
+ CE_OTHER_GETS_HIT, i);
break;
}
}
Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */
- CheckTriggeredElementPageChange(x,y, Feld[x][y], CE_OTHER_IS_CHANGING, page);
+ CheckTriggeredElementChangePage(x,y, Feld[x][y], CE_OTHER_IS_CHANGING, page);
if (change->explode)
{
static boolean CheckTriggeredElementChangeExt(int lx, int ly,
int trigger_element,
- int trigger_side,
int trigger_event,
int trigger_player,
+ int trigger_side,
int trigger_page)
{
int i, j, x, y;
struct ElementChangeInfo *change = &element_info[element].change_page[j];
if (change->can_change &&
-#if 1
change->events & CH_EVENT_BIT(trigger_event) &&
-#endif
- change->sides & trigger_side &&
-#if 1
- IS_EQUAL_OR_IN_GROUP(trigger_element, change->trigger_element)
-#else
- change->trigger_element == trigger_element
-#endif
- )
+ change->trigger_side & trigger_side &&
+ change->trigger_player & trigger_player &&
+ change->trigger_page & (1 << trigger_page) &&
+ IS_EQUAL_OR_IN_GROUP(trigger_element, change->trigger_element))
{
#if 0
if (!(change->events & CH_EVENT_BIT(trigger_event)))
return TRUE;
}
-static boolean CheckTriggeredElementChange(int lx, int ly, int trigger_element,
- int trigger_event)
-{
- return CheckTriggeredElementChangeExt(lx, ly, trigger_element, CH_SIDE_ANY,
- trigger_event, -1, -1);
-}
-
-static boolean CheckTriggeredElementSideChange(int lx, int ly,
- int trigger_element,
- int trigger_side,
- int trigger_event)
-{
- return CheckTriggeredElementChangeExt(lx, ly, trigger_element, trigger_side,
- trigger_event, -1, -1);
-}
-
-static boolean CheckTriggeredElementPlayerChange(int lx, int ly,
- int trigger_element,
- int trigger_player,
- int trigger_side,
- int trigger_event)
-{
- return CheckTriggeredElementChangeExt(lx, ly, trigger_element, trigger_side,
- trigger_event, trigger_player, -1);
-}
-
-static boolean CheckTriggeredElementPageChange(int lx, int ly,
- int trigger_element,
- int trigger_event,
- int trigger_page)
-{
- return CheckTriggeredElementChangeExt(lx, ly, trigger_element, CH_SIDE_ANY,
- trigger_event, -1, trigger_page);
-}
-
-static boolean CheckElementChangeExt(int x, int y, int element, int player,
- int side, int trigger_event, int page)
+static boolean CheckElementChangeExt(int x, int y,
+ int element,
+ int trigger_event,
+ int trigger_player,
+ int trigger_side,
+ int trigger_page)
{
if (!CAN_CHANGE(element) || !HAS_ANY_CHANGE_EVENT(element, trigger_event))
return FALSE;
}
#if 1
- if (page < 0)
+ if (trigger_page < 0)
{
boolean change_element = FALSE;
int i;
if (change->can_change &&
change->events & CH_EVENT_BIT(trigger_event) &&
- change->sides & side)
+ change->trigger_side & trigger_side &&
+ change->trigger_player & trigger_player)
{
change_element = TRUE;
- page = i;
+ trigger_page = i;
break;
}
/* !!! this check misses pages with same event, but different side !!! */
- if (page < 0)
- page = element_info[element].event_page_nr[trigger_event];
+ if (trigger_page < 0)
+ trigger_page = element_info[element].event_page_nr[trigger_event];
- if (!(element_info[element].change_page[page].sides & side))
+ if (!(element_info[element].change_page[trigger_page].trigger_side & trigger_side))
return FALSE;
#endif
ChangeDelay[x][y] = 1;
ChangeEvent[x][y] = CH_EVENT_BIT(trigger_event);
- ChangeElement(x, y, page);
+ ChangeElement(x, y, trigger_page);
return TRUE;
}
-static boolean CheckElementChange(int x, int y, int element, int trigger_event)
-{
- return CheckElementChangeExt(x, y, element, -1, CH_SIDE_ANY, trigger_event,
- -1);
-}
-
-static boolean CheckElementSideChange(int x, int y, int element,
- int trigger_side,
- int trigger_event,
- int page)
-{
- return CheckElementChangeExt(x, y, element, -1, trigger_side, trigger_event,
- page);
-}
-
-static boolean CheckElementPlayerChange(int x, int y, int element,
- int trigger_player,
- int trigger_side,
- int trigger_event,
- int page)
-{
- return CheckElementChangeExt(x, y, element, trigger_player, trigger_side,
- trigger_event, page);
-}
-
static void PlayPlayerSound(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
int dx, int dy, int real_dx, int real_dy)
{
#if 0
- static int change_sides[4][2] =
+ static int trigger_sides[4][2] =
{
/* enter side leave side */
{ CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* moving left */
dx == +1 ? MV_RIGHT :
dy == -1 ? MV_UP :
dy == +1 ? MV_DOWN : MV_NO_MOVING);
- int enter_side = change_sides[MV_DIR_BIT(move_direction)][0];
- int leave_side = change_sides[MV_DIR_BIT(move_direction)][1];
+ int enter_side = trigger_sides[MV_DIR_BIT(move_direction)][0];
+ int leave_side = trigger_sides[MV_DIR_BIT(move_direction)][1];
#endif
int jx = player->jx, jy = player->jy;
int new_jx = jx + dx, new_jy = jy + dy;
#if 0
if (IS_CUSTOM_ELEMENT(Feld[jx][jy]))
{
- CheckTriggeredElementSideChange(jx, jy, Feld[jx][jy], leave_side,
- CE_OTHER_GETS_LEFT);
- CheckElementSideChange(jx, jy, Feld[jx][jy], leave_side,
- CE_LEFT_BY_PLAYER, -1);
+ CheckTriggeredElementChangeSide(jx, jy, Feld[jx][jy], CE_OTHER_GETS_LEFT,
+ leave_side);
+ CheckElementChangeSide(jx, jy, Feld[jx][jy], CE_LEFT_BY_PLAYER,leave_side);
}
if (IS_CUSTOM_ELEMENT(Feld[new_jx][new_jy]))
{
- CheckTriggeredElementSideChange(new_jx, new_jy, Feld[new_jx][new_jy],
- enter_side, CE_OTHER_GETS_ENTERED);
- CheckElementSideChange(new_jx, new_jy, Feld[new_jx][new_jy], enter_side,
- CE_ENTERED_BY_PLAYER, -1);
+ CheckTriggeredElementChangeSide(new_jx, new_jy, Feld[new_jx][new_jy],
+ CE_OTHER_GETS_ENTERED, enter_side);
+ CheckElementChangeSide(new_jx, new_jy, Feld[new_jx][new_jy],
+ CE_ENTERED_BY_PLAYER, enter_side);
}
#endif
#if 1
{
- static int change_sides[4][2] =
+ static int trigger_sides[4][2] =
{
/* enter side leave side */
{ CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* moving left */
{ CH_SIDE_TOP, CH_SIDE_BOTTOM } /* moving down */
};
int move_direction = player->MovDir;
- int enter_side = change_sides[MV_DIR_BIT(move_direction)][0];
- int leave_side = change_sides[MV_DIR_BIT(move_direction)][1];
+ int enter_side = trigger_sides[MV_DIR_BIT(move_direction)][0];
+ int leave_side = trigger_sides[MV_DIR_BIT(move_direction)][1];
#if 1
if (IS_CUSTOM_ELEMENT(Feld[old_jx][old_jy]))
{
- CheckTriggeredElementPlayerChange(old_jx, old_jy, Feld[old_jx][old_jy],
- player->index_nr, leave_side,
- CE_OTHER_GETS_LEFT);
- CheckElementPlayerChange(old_jx, old_jy, Feld[old_jx][old_jy],
- player->index_nr, leave_side,
- CE_LEFT_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy],
+ CE_OTHER_GETS_LEFT,
+ player->index_bit, leave_side);
+ CheckElementChangePlayer(old_jx, old_jy, Feld[old_jx][old_jy],
+ CE_LEFT_BY_PLAYER,
+ player->index_bit, leave_side);
}
if (IS_CUSTOM_ELEMENT(Feld[jx][jy]))
{
- CheckTriggeredElementPlayerChange(jx, jy, Feld[jx][jy],
- player->index_nr, enter_side,
- CE_OTHER_GETS_ENTERED);
- CheckElementPlayerChange(jx, jy, Feld[jx][jy], player->index_nr,
- enter_side, CE_ENTERED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(jx, jy, Feld[jx][jy],
+ CE_OTHER_GETS_ENTERED,
+ player->index_bit, enter_side);
+ CheckElementChangePlayer(jx, jy, Feld[jx][jy], CE_ENTERED_BY_PLAYER,
+ player->index_bit, enter_side);
}
#endif
{ +1, 0 },
{ 0, +1 }
};
- static int change_sides[4][2] =
+ static int trigger_sides[4][2] =
{
/* center side border side */
{ CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */
{
int xx = x + xy[i][0];
int yy = y + xy[i][1];
- int center_side = change_sides[i][0];
- int border_side = change_sides[i][1];
+ int center_side = trigger_sides[i][0];
+ int border_side = trigger_sides[i][1];
int border_element;
if (!IN_LEV_FIELD(xx, yy))
else
continue; /* center and border element do not touch */
- CheckTriggeredElementPlayerChange(xx, yy, border_element,
- player->index_nr, border_side,
- CE_OTHER_GETS_TOUCHED);
- CheckElementPlayerChange(xx, yy, border_element, player->index_nr,
- border_side, CE_TOUCHED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(xx, yy, border_element,
+ CE_OTHER_GETS_TOUCHED,
+ player->index_bit, border_side);
+ CheckElementChangePlayer(xx, yy, border_element, CE_TOUCHED_BY_PLAYER,
+ player->index_bit, border_side);
}
else if (IS_PLAYER(xx, yy))
{
continue; /* center and border element do not touch */
}
- CheckTriggeredElementPlayerChange(x, y, center_element,
- player->index_nr, center_side,
- CE_OTHER_GETS_TOUCHED);
- CheckElementPlayerChange(x, y, center_element, player->index_nr,
- center_side, CE_TOUCHED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(x, y, center_element,
+ CE_OTHER_GETS_TOUCHED,
+ player->index_bit, center_side);
+ CheckElementChangePlayer(x, y, center_element, CE_TOUCHED_BY_PLAYER,
+ player->index_bit, center_side);
break;
}
{ +1, 0 },
{ 0, +1 }
};
- static int change_sides[4][2] =
+ static int trigger_sides[4][2] =
{
/* center side border side */
{ CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */
{
int xx = x + xy[i][0];
int yy = y + xy[i][1];
- int center_side = change_sides[i][0];
- int border_side = change_sides[i][1];
+ int center_side = trigger_sides[i][0];
+ int border_side = trigger_sides[i][1];
int border_element;
if (!IN_LEV_FIELD(xx, yy))
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
- change->sides & border_side &&
+ change->trigger_side & border_side &&
#if 1
IS_EQUAL_OR_IN_GROUP(border_element, change->trigger_element)
#else
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
- change->sides & center_side &&
+ change->trigger_side & center_side &&
#if 1
IS_EQUAL_OR_IN_GROUP(center_element, change->trigger_element)
#else
#endif
)
{
- CheckElementSideChange(xx, yy, border_element, CH_SIDE_ANY,
- CE_OTHER_IS_TOUCHING, j);
+ CheckElementChangePage(xx, yy, border_element, CE_OTHER_IS_TOUCHING,
+ j);
break;
}
}
}
if (change_center_element)
- CheckElementSideChange(x, y, center_element, CH_SIDE_ANY,
- CE_OTHER_IS_TOUCHING, center_element_change_page);
+ CheckElementChangePage(x, y, center_element, CE_OTHER_IS_TOUCHING,
+ center_element_change_page);
}
void TestIfElementHitsCustomElement(int x, int y, int direction)
return;
#endif
- CheckElementSideChange(x, y, hitting_element,
- direction, CE_HITTING_SOMETHING, -1);
+ CheckElementChangeSide(x, y, hitting_element, CE_HITTING_SOMETHING,
+ direction);
if (IN_LEV_FIELD(hitx, hity))
{
{
int i;
- CheckElementSideChange(hitx, hity, touched_element,
- opposite_direction, CE_HIT_BY_SOMETHING, -1);
+ CheckElementChangeSide(hitx, hity, touched_element, CE_HIT_BY_SOMETHING,
+ opposite_direction);
if (IS_CUSTOM_ELEMENT(hitting_element) &&
HAS_ANY_CHANGE_EVENT(hitting_element, CE_OTHER_IS_HITTING))
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_IS_HITTING) &&
- change->sides & touched_side &&
+ change->trigger_side & touched_side &&
#if 1
IS_EQUAL_OR_IN_GROUP(touched_element, change->trigger_element)
#endif
)
{
- CheckElementSideChange(x, y, hitting_element,
- CH_SIDE_ANY, CE_OTHER_IS_HITTING, i);
+ CheckElementChangePage(x, y, hitting_element, CE_OTHER_IS_HITTING,
+ i);
break;
}
}
if (change->can_change &&
change->events & CH_EVENT_BIT(CE_OTHER_GETS_HIT) &&
- change->sides & hitting_side &&
+ change->trigger_side & hitting_side &&
#if 1
IS_EQUAL_OR_IN_GROUP(hitting_element, change->trigger_element)
#else
#endif
)
{
- CheckElementSideChange(hitx, hity, touched_element,
- CH_SIDE_ANY, CE_OTHER_GETS_HIT, i);
+ CheckElementChangePage(hitx, hity, touched_element,
+ CE_OTHER_GETS_HIT, i);
break;
}
}
int oldx, int oldy, int x, int y,
int real_dx, int real_dy, int mode)
{
- static int change_sides[4] =
+ static int trigger_sides[4] =
{
CH_SIDE_RIGHT, /* moving left */
CH_SIDE_LEFT, /* moving right */
dy == -1 ? MV_UP :
dy == +1 ? MV_DOWN : MV_NO_MOVING);
int opposite_direction = MV_DIR_OPPOSITE(move_direction);
- int dig_side = change_sides[MV_DIR_BIT(move_direction)];
+ int dig_side = trigger_sides[MV_DIR_BIT(move_direction)];
int old_element = Feld[jx][jy];
int element;
PlayLevelSoundElementAction(x, y, element, ACTION_DIGGING);
- CheckTriggeredElementPlayerChange(x, y, element,
- player->index_nr, CH_SIDE_ANY,
- CE_OTHER_GETS_DIGGED);
+ CheckTriggeredElementChangePlayer(x, y, element, CE_OTHER_GETS_DIGGED,
+ player->index_bit, CH_SIDE_ANY);
#if 1
if (mode == DF_SNAP)
RaiseScoreElement(element);
PlayLevelSoundElementAction(x, y, element, ACTION_COLLECTING);
- CheckTriggeredElementPlayerChange(x, y, element, player->index_nr,
- CH_SIDE_ANY,
- CE_OTHER_GETS_COLLECTED);
+ CheckTriggeredElementChangePlayer(x, y, element,
+ CE_OTHER_GETS_COLLECTED,
+ player->index_bit, CH_SIDE_ANY);
#if 1
if (mode == DF_SNAP)
else
player->push_delay_value = -1; /* get new value later */
- CheckTriggeredElementPlayerChange(x, y, element, player->index_nr,
- dig_side, CE_OTHER_GETS_PUSHED);
- CheckElementPlayerChange(x, y, element, player->index_nr, dig_side,
- CE_PUSHED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(x, y, element, CE_OTHER_GETS_PUSHED,
+ player->index_bit, dig_side);
+ CheckElementChangePlayer(x, y, element, CE_PUSHED_BY_PLAYER,
+ player->index_bit, dig_side);
break;
}
player->switch_x = x;
player->switch_y = y;
- CheckTriggeredElementPlayerChange(x, y, element, player->index_nr,
- dig_side, CE_OTHER_IS_SWITCHING);
- CheckElementPlayerChange(x, y, element, player->index_nr, dig_side,
- CE_SWITCHED, -1);
+ CheckTriggeredElementChangePlayer(x, y, element,
+ CE_OTHER_IS_SWITCHING,
+ player->index_bit, dig_side);
+ CheckElementChangePlayer(x, y, element, CE_SWITCHED,
+ player->index_bit, dig_side);
}
- CheckTriggeredElementPlayerChange(x, y, element, player->index_nr,
- dig_side, CE_OTHER_GETS_PRESSED);
- CheckElementPlayerChange(x, y, element, player->index_nr, dig_side,
- CE_PRESSED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(x, y, element, CE_OTHER_GETS_PRESSED,
+ player->index_bit, dig_side);
+ CheckElementChangePlayer(x, y, element, CE_PRESSED_BY_PLAYER,
+ player->index_bit, dig_side);
}
return MF_NO_ACTION;
Changed[jx][jy] = 0; /* allow another change */
#endif
- CheckTriggeredElementPlayerChange(jx, jy, new_element, player->index_nr,
- CH_SIDE_ANY, CE_OTHER_GETS_DROPPED);
- CheckElementPlayerChange(jx, jy, new_element, player->index_nr,
- CH_SIDE_ANY, CE_DROPPED_BY_PLAYER, -1);
+ CheckTriggeredElementChangePlayer(jx, jy, new_element,
+ CE_OTHER_GETS_DROPPED,
+ player->index_bit, CH_SIDE_ANY);
+ CheckElementChangePlayer(jx, jy, new_element, CE_DROPPED_BY_PLAYER,
+ player->index_bit, CH_SIDE_ANY);
TestIfElementTouchesCustomElement(jx, jy);
}
#if 1
TestIfElementHitsCustomElement(jx, jy, direction);
#else
- CheckElementSideChange(jx, jy, new_element,
- direction, CE_HITTING_SOMETHING, -1);
+ CheckElementChangeSide(jx, jy, new_element, CE_HITTING_SOMETHING,
+ direction);
#endif
}