X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=7b3017e95a7f2864f62b877f913e4bebceccb933;hb=945d51a5966241e4964a2b72058b6295cbc4a688;hp=1c86acb0cc779f7196f82e660fc7361e9b164a2c;hpb=cd2e7117917e6fda0cffd50acabc71ac4e2672ce;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 1c86acb0..7b3017e9 100644 --- a/src/game.c +++ b/src/game.c @@ -3620,7 +3620,8 @@ void StartMoving(int x, int y) if (CAN_FALL(element) && y < lev_fieldy - 1) { - if ((x>0 && IS_PLAYER(x-1, y)) || (x 0 && IS_PLAYER(x - 1, y)) || + (x < lev_fieldx-1 && IS_PLAYER(x + 1, y))) if (JustBeingPushed(x, y)) return; @@ -4021,7 +4022,8 @@ void StartMoving(int x, int y) Moving2Blocked(x, y, &newx, &newy); /* get next screen position */ - if (DONT_COLLIDE_WITH(element) && IS_PLAYER(newx, newy) && + if (DONT_COLLIDE_WITH(element) && + IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) && !PLAYER_PROTECTED(newx, newy)) { #if 1 @@ -5310,14 +5312,14 @@ static void ChangeActiveTrap(int x, int y) static void ChangeElementNowExt(int x, int y, int target_element) { -#if 1 - /* check if the new element is unaccessible for the player */ - if (IS_PLAYER(x, y) && !IS_ACCESSIBLE(target_element)) + /* check if element under player changes from accessible to unaccessible + (needed for special case of dropping element which then changes) */ + if (IS_PLAYER(x, y) && + IS_ACCESSIBLE(Feld[x][y]) && !IS_ACCESSIBLE(target_element)) { Bang(x, y); return; } -#endif RemoveField(x, y); Feld[x][y] = target_element; @@ -5346,12 +5348,21 @@ static void ChangeElementNow(int x, int y, int element) { struct ElementChangeInfo *change = &element_info[element].change; +#if 0 + if (element >= EL_CUSTOM_START + 17 && element <= EL_CUSTOM_START + 39) + printf("::: changing... [%d]\n", FrameCounter); +#endif + +#if 0 /* prevent CheckTriggeredElementChange() from looping */ Changing[x][y] = TRUE; +#endif CheckTriggeredElementChange(x, y, Feld[x][y], CE_OTHER_IS_CHANGING); +#if 0 Changing[x][y] = FALSE; +#endif if (change->explode) { @@ -5542,6 +5553,10 @@ static boolean CheckTriggeredElementChange(int lx, int ly, int trigger_element, if (!(trigger_events[trigger_element] & CH_EVENT_BIT(trigger_event))) return FALSE; + /* prevent this function from running into a loop */ + if (trigger_event == CE_OTHER_IS_CHANGING) + Changing[lx][ly] = TRUE; + for (i=0; ilast_move_dir = player->MovDir; player->is_moving = TRUE; +#if 1 + player->snapped = FALSE; +#endif } else { @@ -7634,8 +7658,15 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) { player->is_digging = FALSE; player->is_collecting = FALSE; +#if 1 + player->is_moving = FALSE; +#endif } +#if 0 + printf("::: trying to snap...\n"); +#endif + return FALSE; } @@ -7644,12 +7675,25 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) player->MovDir = snap_direction; +#if 1 + player->is_digging = FALSE; + player->is_collecting = FALSE; +#if 1 + player->is_moving = FALSE; +#endif +#endif + if (DigField(player, x, y, 0, 0, DF_SNAP) == MF_NO_ACTION) return FALSE; player->snapped = TRUE; +#if 1 player->is_digging = FALSE; player->is_collecting = FALSE; +#if 1 + player->is_moving = FALSE; +#endif +#endif DrawLevelField(x, y); BackToFront();