From: Holger Schemel Date: Fri, 27 Feb 2004 20:54:26 +0000 (+0100) Subject: rnd-20040227-1-src X-Git-Tag: 3.1.0^2~63 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3fd9eb037de275a9e65a712d7fbc0d95fe7b2747;p=rocksndiamonds.git rnd-20040227-1-src * fixed bug with exploding amoeba (explosion 3x3 instead of 1x1) --- diff --git a/ChangeLog b/ChangeLog index 4a20bdd3..71f243a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2004-02-24 + * fixed bug with exploding amoeba (explosion 3x3 instead of 1x1) + 2004-02-22 * fixed bug with dark yamyam changing to acid when moving over acid * fixed handling of levels with more than 999 seconds level time + (example: level 76 of "Denmine") 2004-02-21 * "spring push bug" reintroduced as configurable element property diff --git a/src/conftime.h b/src/conftime.h index f4add647..db9eba15 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-02-25 10:57]" +#define COMPILE_DATE_STRING "[2004-02-27 02:21]" diff --git a/src/editor.c b/src/editor.c index 40181b77..18ef65c8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -159,7 +159,7 @@ 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) @@ -456,12 +456,14 @@ #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) @@ -642,11 +644,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_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 @@ -1071,7 +1075,7 @@ static struct 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, @@ -1322,13 +1326,61 @@ static struct ValueTextInfo options_change_other_action[] = 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 } }; @@ -1509,10 +1561,26 @@ static struct -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, @@ -1520,7 +1588,7 @@ static struct "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, @@ -1608,13 +1676,13 @@ static struct " ", "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" @@ -1633,14 +1701,14 @@ static struct { { 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" @@ -1943,25 +2011,25 @@ static struct 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" diff --git a/src/game.c b/src/game.c index cd919a2b..bf4b1bf8 100644 --- a/src/game.c +++ b/src/game.c @@ -249,9 +249,14 @@ static void TestIfElementTouchesCustomElement(int, int); 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); @@ -3169,11 +3174,9 @@ void Bang(int x, int y) 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 @@ -6659,7 +6662,7 @@ static boolean ChangeElementNow(int x, int y, int element, int page) 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) { @@ -6833,10 +6836,12 @@ static void ChangeElement(int x, int y, int page) } } -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; @@ -6907,12 +6912,40 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly, 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; @@ -6968,7 +7001,27 @@ static boolean CheckElementSideChange(int x, int y, int element, int side, 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) @@ -8379,18 +8432,21 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) #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 @@ -8594,6 +8650,8 @@ void TestIfPlayerTouchesCustomElement(int x, int y) 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)) @@ -8603,25 +8661,27 @@ void TestIfPlayerTouchesCustomElement(int x, int y) 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; } @@ -9475,7 +9535,9 @@ int DigField(struct PlayerInfo *player, 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) @@ -9570,7 +9632,9 @@ int DigField(struct PlayerInfo *player, 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) @@ -9726,10 +9790,10 @@ int DigField(struct PlayerInfo *player, 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; } @@ -9833,15 +9897,16 @@ int DigField(struct PlayerInfo *player, 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; @@ -9980,8 +10045,10 @@ boolean DropElement(struct PlayerInfo *player) 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); } diff --git a/src/main.h b/src/main.h index c2c3ce52..490af4fa 100644 --- a/src/main.h +++ b/src/main.h @@ -1507,6 +1507,8 @@ struct ElementChangeInfo unsigned long events; /* change events */ int sides; /* change sides */ + int trigger_player; /* player triggering change */ + int trigger_page; /* page triggering change */ short target_element; /* target element after change */