Scroll main fortress/adventure world views
| 121 | |
| 122 | // Scroll main fortress/adventure world views |
| 123 | static void scroll_dwarfmode(int xdiff, int ydiff) { |
| 124 | using df::global::window_x; |
| 125 | using df::global::window_y; |
| 126 | using df::global::game; |
| 127 | // Scale the movement by pixels, to keep scroll speeds visually consistent |
| 128 | int tilesize = gps->viewport_zoom_factor / 4; |
| 129 | int width = gps->main_viewport->dim_x; |
| 130 | int height = gps->main_viewport->dim_y; |
| 131 | |
| 132 | // Ensure the map doesn't go fully off-screen |
| 133 | int min_x = -width / 2; |
| 134 | int min_y = -height / 2; |
| 135 | int max_x = world->map.x_count - (width / 2); |
| 136 | int max_y = world->map.y_count - (height / 2); |
| 137 | apply_scroll(window_x, xdiff * std::max(1, map_scroll_pixels / tilesize), min_x, max_x); |
| 138 | apply_scroll(window_y, ydiff * std::max(1, map_scroll_pixels / tilesize), min_y, max_y); |
| 139 | |
| 140 | // Force a minimap update |
| 141 | game->minimap.update = 1; |
| 142 | game->minimap.mustmake = 1; |
| 143 | } |
| 144 | |
| 145 | template<typename T> |
| 146 | static void scroll_world_internal(T* screen, int xdiff, int ydiff) { |
no test coverage detected