increased scrolling speed when wrapping around for BD engine
authorHolger Schemel <info@artsoft.org>
Sun, 10 Mar 2024 16:35:56 +0000 (17:35 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 10 Mar 2024 16:36:57 +0000 (17:36 +0100)
src/game_bd/bd_graphics.c

index bb3fb894d17673094d072e7cbcabfe34b6563287..ef87fc0f9465267ed2e79db8d00c5f2c8eb91147 100644 (file)
@@ -261,6 +261,13 @@ boolean gd_scroll(GdGame *game, boolean exact_scroll, boolean immediate)
   player_x = game->cave->player_x - game->cave->x1; // cell coordinates of player
   player_y = game->cave->player_y - game->cave->y1;
 
+  // when wrapping around to opposite level border, use faster scrolling
+  if (game->cave->player_x == game->cave->x1 ||
+      game->cave->player_x == game->cave->x2 ||
+      game->cave->player_y == game->cave->y1 ||
+      game->cave->player_y == game->cave->y2)
+    scroll_speed *= 4;
+
   // pixel size of visible part of the cave (may be smaller in intermissions)
   visible_x = (game->cave->x2 - game->cave->x1 + 1) * cell_size;
   visible_y = (game->cave->y2 - game->cave->y1 + 1) * cell_size;