4 #include <stdint.h> /* uint8_t */
5 #include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
6 #include "world.h" /* for global world */
10 extern void map_scroll(char d)
12 world.focus_each_turn = 0;
13 struct Win * win = get_win_by_id('m');
15 if (('8' == d || '2' == d) && world.map.length > win->frame_size.y)
17 offset = center_offset(win->center.y,
18 world.map.length, win->frame_size.y);
19 win->center.y = offset + (win->frame_size.y / 2);
20 if ('2' == d && win->center.y < world.map.length - 1)
25 win->center.y = win->center.y - ('8' == d && win->center.y > 0);
27 else if (('4' == d || '6' == d) && (world.map.length*2) > win->frame_size.x)
29 offset = center_offset(win->center.x,
30 world.map.length*2, win->frame_size.x);
31 win->center.x = offset + (win->frame_size.x / 2);
32 if ('6' == d && win->center.x < (world.map.length * 2) - 1)
37 win->center.x = win->center.x - ('4' == d && win->center.x > 0);
43 extern void map_center()
45 struct Win * win_map = get_win_by_id('m');
46 win_map->center.y = world.player_pos.y;
47 win_map->center.x = world.player_pos.x * 2 + (world.player_pos.y % 2);
52 extern void toggle_autofocus()
54 world.focus_each_turn = world.focus_each_turn ? 0 : 1;