From: Holger Schemel Date: Mon, 20 Mar 2006 22:40:28 +0000 (+0100) Subject: rnd-20060320-1-src X-Git-Tag: 3.2.0^2~45 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=cfaefce799e67af6d8352f516a99d121b10d0cf6;p=rocksndiamonds.git rnd-20060320-1-src --- diff --git a/src/conftime.h b/src/conftime.h index ab9357c7..67a4fe6b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-03-19 20:13]" +#define COMPILE_DATE_STRING "[2006-03-20 23:36]" diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 2935096d..649a258a 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -694,6 +694,7 @@ void RedrawPlayfield_EM(boolean force_redraw) #else int player_nr = game_em.last_moving_player; #endif + int stepsize = TILEX / 8; int offset = (setup.scroll_delay ? 3 : 0) * TILEX; int offset_x = offset; int offset_y = offset; @@ -745,7 +746,11 @@ void RedrawPlayfield_EM(boolean force_redraw) if (game.centered_player_nr == -1) { +#if 1 + if (draw_new_player_location || offset == 0) +#else if (draw_new_player_location) +#endif { setScreenCenteredToAllPlayers(&sx, &sy); } @@ -906,23 +911,37 @@ void RedrawPlayfield_EM(boolean force_redraw) sy - offset_y > screen_y ? sy - offset_y : screen_y); - /* prevent scrolling further than player step size screen when scrolling */ - if (ABS(screen_x - screen_x_old) > TILEX / 8 || - ABS(screen_y - screen_y_old) > TILEY / 8) +#if 1 + /* prevent scrolling further than double player step size when scrolling */ + if (ABS(screen_x - screen_x_old) > 2 * stepsize || + ABS(screen_y - screen_y_old) > 2 * stepsize) { int dx = SIGN(screen_x - screen_x_old); int dy = SIGN(screen_y - screen_y_old); - screen_x = screen_x_old + dx * TILEX / 8; - screen_y = screen_y_old + dy * TILEY / 8; + screen_x = screen_x_old + dx * 2 * stepsize; + screen_y = screen_y_old + dy * 2 * stepsize; } +#else + /* prevent scrolling further than player step size when scrolling */ + if (ABS(screen_x - screen_x_old) > stepsize || + ABS(screen_y - screen_y_old) > stepsize) + { + int dx = SIGN(screen_x - screen_x_old); + int dy = SIGN(screen_y - screen_y_old); + + screen_x = screen_x_old + dx * stepsize; + screen_y = screen_y_old + dy * stepsize; + } +#endif /* prevent scrolling away from the other players when focus on all players */ if (game.centered_player_nr == -1) { #if 1 /* check if all players are still visible with new scrolling position */ - if (!checkIfAllPlayersAreVisible(screen_x, screen_y)) + if (checkIfAllPlayersAreVisible(screen_x_old, screen_y_old) && + !checkIfAllPlayersAreVisible(screen_x, screen_y)) { /* reset horizontal scroll position to last value, if needed */ if (!checkIfAllPlayersAreVisible(screen_x, screen_y_old)) diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index 38607713..b4533014 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -548,13 +548,26 @@ static void check_player(struct PLAYER *ply) int oldy = ply->y; int x = oldx + dx; int y = oldy + dy; - boolean can_move = TRUE; + boolean players_visible_before_move; + boolean players_visible_after_move; + boolean can_move; + + players_visible_before_move = checkIfAllPlayersFitToScreen(); ply->x = x; ply->y = y; + players_visible_after_move = checkIfAllPlayersFitToScreen(); + + /* + player is allowed to move only in the following cases: + - it is not needed to display all players (not focussed to all players) + - all players are (still or again) visible after the move + - some players were already outside visible screen area before the move + */ can_move = (game.centered_player_nr != -1 || - checkIfAllPlayersFitToScreen()); + players_visible_after_move || + !players_visible_before_move); ply->x = oldx; ply->y = oldy;