}
else
{
- int offset = game.scroll_delay_value;
+ int offset_raw = game.scroll_delay_value;
if (jx != old_jx) // player has moved horizontally
{
+ int offset = MIN(offset_raw, (SCR_FIELDX - 2) / 2);
int offset_x = offset * (player->MovDir == MV_LEFT ? +1 : -1);
int new_scroll_x = jx - MIDPOSX + offset_x;
}
else // player has moved vertically
{
+ int offset = MIN(offset_raw, (SCR_FIELDY - 2) / 2);
int offset_y = offset * (player->MovDir == MV_UP ? +1 : -1);
int new_scroll_y = jy - MIDPOSY + offset_y;
int max_center_distance_player_nr =
getMaxCenterDistancePlayerNr(screen_x, screen_y);
int stepsize = TILEX / 8;
- int offset = game.scroll_delay_value * TILEX;
- int offset_x = offset;
- int offset_y = offset;
+ int offset_raw = game.scroll_delay_value;
+ int offset_x = MIN(offset_raw, (SCR_FIELDX - 2) / 2) * TILEX;
+ int offset_y = MIN(offset_raw, (SCR_FIELDY - 2) / 2) * TILEY;
int screen_x_old = screen_x;
int screen_y_old = screen_y;
int x, y, sx, sy;
if (game.centered_player_nr == -1)
{
- if (draw_new_player_location || offset == 0)
+ if (draw_new_player_location || offset_raw == 0)
{
setScreenCenteredToAllPlayers(&sx, &sy);
}