3 * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4 * or any later version. For details on its copyright, license, and warranties,
5 * see the file NOTICE in the root directory of the PlomRogue source package.
9 #include <stdint.h> /* uint8_t */
10 #include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
11 #include "world.h" /* for global world */
15 extern void map_scroll(char d)
17 world.focus_each_turn = 0;
18 struct Win * win = get_win_by_id('m');
20 if (('8' == d || '2' == d) && world.map.length > win->frame_size.y)
22 offset = center_offset(win->center.y,
23 world.map.length, win->frame_size.y);
24 win->center.y = offset + (win->frame_size.y / 2);
25 if ('2' == d && win->center.y < world.map.length - 1)
30 win->center.y = win->center.y - ('8' == d && win->center.y > 0);
32 else if (('4' == d || '6' == d) && (world.map.length*2) > win->frame_size.x)
34 offset = center_offset(win->center.x,
35 world.map.length*2, win->frame_size.x);
36 win->center.x = offset + (win->frame_size.x / 2);
37 if ('6' == d && win->center.x < (world.map.length * 2) - 1)
42 win->center.x = win->center.x - ('4' == d && win->center.x > 0);
48 extern void map_center()
50 struct Win * win_map = get_win_by_id('m');
51 win_map->center.y = world.player_pos.y;
52 win_map->center.x = world.player_pos.x * 2 + (world.player_pos.y % 2);
57 extern void toggle_autofocus()
59 world.focus_each_turn = world.focus_each_turn ? 0 : 1;