ED_GADGET_DISTANCE)
/* extended custom change target */
#define ED_AREA_ELEM_CONTENT6_XPOS (29 * MINI_TILEX)
-#define ED_AREA_ELEM_CONTENT6_YPOS (ED_SETTINGS_YPOS(9) + \
+#define ED_AREA_ELEM_CONTENT6_YPOS (ED_SETTINGS_YPOS(10) + \
ED_GADGET_DISTANCE - MINI_TILEY)
/* group element content */
#define ED_AREA_GROUP_CONTENT_XPOS ED_SETTINGS_XPOS(0)
#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_POWER (GADGET_ID_SELECTBOX_FIRST + 17)
-#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 18)
-#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 19)
+#define GADGET_ID_CHANGE_PLAYERS (GADGET_ID_SELECTBOX_FIRST + 17)
+#define GADGET_ID_CHANGE_PAGES (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)
/* textbutton identifiers */
-#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 20)
+#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 22)
#define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0)
#define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1)
#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_POWER 17
-#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 18
-#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 19
+#define ED_SELECTBOX_ID_CHANGE_PLAYERS 17
+#define ED_SELECTBOX_ID_CHANGE_PAGES 18
+#define ED_SELECTBOX_ID_CHANGE_POWER 19
+#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 20
+#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 21
-#define ED_NUM_SELECTBOX 20
+#define ED_NUM_SELECTBOX 22
#define ED_SELECTBOX_ID_CUSTOM1_FIRST ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
#define ED_SELECTBOX_ID_CUSTOM1_LAST ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE
NULL, "+random", NULL
},
{
- ED_SETTINGS_XPOS(3), ED_SETTINGS_YPOS(11),
+ ED_SETTINGS_XPOS(3), ED_SETTINGS_YPOS(12),
0, 100,
GADGET_ID_CHANGE_CONT_RND_DOWN, GADGET_ID_CHANGE_CONT_RND_UP,
GADGET_ID_CHANGE_CONT_RND_TEXT, GADGET_ID_NONE,
static struct ValueTextInfo options_change_sides[] =
{
- { CH_SIDE_LEFT, "left side" },
- { CH_SIDE_RIGHT, "right side" },
- { CH_SIDE_TOP, "top side" },
- { CH_SIDE_BOTTOM, "bottom side" },
- { CH_SIDE_LEFT_RIGHT, "left/right side" },
- { CH_SIDE_TOP_BOTTOM, "top/bottom side" },
- { CH_SIDE_ANY, "any side" },
+ { CH_SIDE_LEFT, "left" },
+ { CH_SIDE_RIGHT, "right" },
+ { CH_SIDE_TOP, "top" },
+ { CH_SIDE_BOTTOM, "bottom" },
+ { 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" },
+ { -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, NULL }
};
-1,
options_change_sides,
&custom_element_change.sides,
- "... at", NULL, "element side that causes change"
+ "... at", "side", "element side that causes change"
},
{
- ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(9),
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(7),
+ GADGET_ID_CHANGE_PLAYERS, GADGET_ID_NONE,
+ -1,
+ options_change_trigger_player,
+ &custom_element_change.trigger_player,
+ "player:", " ", "player that causes change"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(7),
+ GADGET_ID_CHANGE_PAGES, GADGET_ID_CHANGE_PLAYERS,
+ -1,
+ options_change_trigger_page,
+ &custom_element_change.trigger_page,
+ "page:", NULL, "change page that causes change"
+ },
+ {
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(10),
GADGET_ID_CHANGE_POWER, GADGET_ID_NONE,
-1,
options_change_power,
"replace when", NULL, "which elements can be replaced"
},
{
- ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(13),
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(14),
GADGET_ID_SELECT_CHANGE_PAGE, GADGET_ID_NONE,
3,
options_change_page,
" ", "As Template", "Save current settings as new template"
},
{
- -1, ED_SETTINGS_YPOS(13),
+ -1, ED_SETTINGS_YPOS(14),
GADGET_ID_ADD_CHANGE_PAGE, GADGET_ID_NEXT_CHANGE_PAGE,
-1, "New",
" ", NULL, "Add new change page"
},
{
- -1, ED_SETTINGS_YPOS(13),
+ -1, ED_SETTINGS_YPOS(14),
GADGET_ID_DEL_CHANGE_PAGE, GADGET_ID_ADD_CHANGE_PAGE,
-1, "Delete",
NULL, NULL, "Delete current change page"
{
{
ED_BUTTON_MINUS_XPOS, ED_BUTTON_COUNT_YPOS,
- ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(13),
+ ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(14),
ED_BUTTON_COUNT_XSIZE, ED_BUTTON_COUNT_YSIZE,
GADGET_ID_PREV_CHANGE_PAGE, GADGET_ID_NONE,
NULL, NULL, "select previous change page"
},
{
ED_BUTTON_PLUS_XPOS, ED_BUTTON_COUNT_YPOS,
- -1, ED_SETTINGS_YPOS(13),
+ -1, ED_SETTINGS_YPOS(14),
ED_BUTTON_COUNT_XSIZE, ED_BUTTON_COUNT_YSIZE,
GADGET_ID_NEXT_CHANGE_PAGE, GADGET_ID_SELECT_CHANGE_PAGE,
NULL, "change page", "select next change page"
NULL, NULL, "element changes by other element"
},
{
- ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(7),
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8),
GADGET_ID_CHANGE_USE_EXPLOSION, GADGET_ID_NONE,
&custom_element_change.explode,
NULL, "explode instead of change", "element explodes instead of change"
},
{
- ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8),
+ ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(9),
GADGET_ID_CHANGE_USE_CONTENT, GADGET_ID_NONE,
&custom_element_change.use_content,
NULL, "use extended change target:","element changes to more elements"
},
{
- ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(10),
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(11),
GADGET_ID_CHANGE_ONLY_COMPLETE, GADGET_ID_NONE,
&custom_element_change.only_complete,
NULL, "replace all or nothing", "only replace when all can be changed"
},
{
- ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(11),
+ ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(12),
GADGET_ID_CHANGE_USE_RANDOM, GADGET_ID_NONE,
&custom_element_change.use_random_change,
NULL, NULL, "use percentage for random replace"
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);
+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);
static void PlayLevelSound(int, int, int);
case EL_PENGUIN:
case EL_LAMP:
case EL_LAMP_ACTIVE:
-
#if 1
case EL_AMOEBA_TO_DIAMOND:
#endif
-
if (IS_PLAYER(x, y))
Explode(x, y, EX_PHASE_START, EX_NORMAL);
else
Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */
- CheckTriggeredElementChange(x, y, Feld[x][y], CE_OTHER_IS_CHANGING);
+ CheckTriggeredElementPageChange(x,y, Feld[x][y], CE_OTHER_IS_CHANGING, page);
if (change->explode)
{
}
}
-static boolean CheckTriggeredElementSideChange(int lx, int ly,
- int trigger_element,
- int trigger_side,
- int trigger_event)
+static boolean CheckTriggeredElementChangeExt(int lx, int ly,
+ int trigger_element,
+ int trigger_side,
+ int trigger_event,
+ int trigger_player,
+ int trigger_page)
{
int i, j, x, y;
static boolean CheckTriggeredElementChange(int lx, int ly, int trigger_element,
int trigger_event)
{
- return CheckTriggeredElementSideChange(lx, ly, trigger_element, CH_SIDE_ANY,
- 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 CheckElementSideChange(int x, int y, int element, int side,
- int trigger_event, int page)
+static boolean CheckElementChangeExt(int x, int y, int element, int player,
+ int side, int trigger_event, int page)
{
if (!CAN_CHANGE(element) || !HAS_ANY_CHANGE_EVENT(element, trigger_event))
return FALSE;
static boolean CheckElementChange(int x, int y, int element, int trigger_event)
{
- return CheckElementSideChange(x, y, element, CH_SIDE_ANY, trigger_event, -1);
+ 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)
#if 1
if (IS_CUSTOM_ELEMENT(Feld[old_jx][old_jy]))
{
- CheckTriggeredElementSideChange(old_jx, old_jy, Feld[old_jx][old_jy],
- leave_side, CE_OTHER_GETS_LEFT);
- CheckElementSideChange(old_jx, old_jy, Feld[old_jx][old_jy],
- leave_side, CE_LEFT_BY_PLAYER, -1);
+ 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);
}
if (IS_CUSTOM_ELEMENT(Feld[jx][jy]))
{
- CheckTriggeredElementSideChange(jx, jy, Feld[jx][jy],
- enter_side, CE_OTHER_GETS_ENTERED);
- CheckElementSideChange(jx, jy, Feld[jx][jy],
- enter_side, CE_ENTERED_BY_PLAYER, -1);
+ 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);
}
#endif
if (IS_PLAYER(x, y))
{
+ struct PlayerInfo *player = PLAYERINFO(x, y);
+
if (game.engine_version < VERSION_IDENT(3,0,7,0))
border_element = Feld[xx][yy]; /* may be moving! */
else if (!IS_MOVING(xx, yy) && !IS_BLOCKED(xx, yy))
else
continue; /* center and border element do not touch */
- CheckTriggeredElementSideChange(xx, yy, border_element, border_side,
- CE_OTHER_GETS_TOUCHED);
- CheckElementSideChange(xx, yy, border_element, border_side,
- CE_TOUCHED_BY_PLAYER, -1);
+ 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);
}
else if (IS_PLAYER(xx, yy))
{
+ struct PlayerInfo *player = PLAYERINFO(xx, yy);
+
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
{
- struct PlayerInfo *player = PLAYERINFO(xx, yy);
-
if (player->MovPos != 0 && !(player->MovDir & touch_dir[i]))
continue; /* center and border element do not touch */
}
- CheckTriggeredElementSideChange(x, y, center_element, center_side,
- CE_OTHER_GETS_TOUCHED);
- CheckElementSideChange(x, y, center_element, center_side,
- CE_TOUCHED_BY_PLAYER, -1);
+ 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);
break;
}
PlayLevelSoundElementAction(x, y, element, ACTION_DIGGING);
- CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_DIGGED);
+ CheckTriggeredElementPlayerChange(x, y, element,
+ player->index_nr, CH_SIDE_ANY,
+ CE_OTHER_GETS_DIGGED);
#if 1
if (mode == DF_SNAP)
RaiseScoreElement(element);
PlayLevelSoundElementAction(x, y, element, ACTION_COLLECTING);
- CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_COLLECTED);
+ CheckTriggeredElementPlayerChange(x, y, element, player->index_nr,
+ CH_SIDE_ANY,
+ CE_OTHER_GETS_COLLECTED);
#if 1
if (mode == DF_SNAP)
else
player->push_delay_value = -1; /* get new value later */
- CheckTriggeredElementSideChange(x, y, element, dig_side,
- CE_OTHER_GETS_PUSHED);
- CheckElementSideChange(x, y, element, dig_side,
- CE_PUSHED_BY_PLAYER, -1);
+ 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);
break;
}
player->switch_x = x;
player->switch_y = y;
- CheckTriggeredElementSideChange(x, y, element, dig_side,
- CE_OTHER_IS_SWITCHING);
- CheckElementSideChange(x, y, element, dig_side, CE_SWITCHED, -1);
+ 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);
}
- CheckTriggeredElementSideChange(x, y, element, dig_side,
- CE_OTHER_GETS_PRESSED);
- CheckElementSideChange(x, y, element, dig_side,
- CE_PRESSED_BY_PLAYER, -1);
+ 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);
}
return MF_NO_ACTION;
Changed[jx][jy] = 0; /* allow another change */
#endif
- CheckTriggeredElementChange(jx, jy, new_element, CE_OTHER_GETS_DROPPED);
- CheckElementChange(jx, jy, new_element, CE_DROPPED_BY_PLAYER);
+ 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);
TestIfElementTouchesCustomElement(jx, jy);
}