static inline void store_dir_buffer(GdCave *cave, const int x, const int y, const GdDirection dir)
{
+ int old_x = x;
+ int old_y = y;
+
// raw values without range correction
int raw_x = x + gd_dx[dir];
int raw_y = y + gd_dy[dir];
int new_y = gety(cave, raw_x, raw_y);
int new_dir = (dir > GD_MV_TWICE ? dir - GD_MV_TWICE : dir);
- game_bd.game->dir_buffer[new_y][new_x] = new_dir;
+ // if tile is moving two steps at once, correct old position
+ if (dir > GD_MV_TWICE)
+ {
+ raw_x = x + gd_dx[new_dir];
+ raw_y = y + gd_dy[new_dir];
+
+ old_x = getx(cave, raw_x, raw_y);
+ old_y = gety(cave, raw_x, raw_y);
+ }
+
+ game_bd.game->dir_buffer_from[old_y][old_x] = new_dir;
+ game_bd.game->dir_buffer_to[new_y][new_x] = new_dir;
}
// store an element at the given position
gd_cave_clear_sounds(cave);
+ game_bd.player_moving = FALSE;
+ game_bd.player_snapping = FALSE;
+
// if diagonal movements not allowed,
// horizontal movements have precedence. [BROADRIBB]
if (!cave->diagonal_movements)
// if snapping anything and we have snapping explosions set.
// but these is not true for pushing.
if (remains == O_SPACE && player_fire && !push)
+ {
remains = cave->snap_element;
+ game_bd.player_snapping = TRUE;
+ }
+
if (remains != O_SPACE || player_fire)
+ {
// if any other element than space, player cannot move.
// also if pressing fire, will not move.
store_dir(cave, x, y, player_move, remains);
+ }
else
+ {
// if space remains there, the player moves.
move(cave, x, y, player_move, O_PLAYER);
+
+ game_bd.player_moving = TRUE;
+ }
}
}
break;