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 struct Win * win = get_win_by_id('m');
14 if (('8' == d || '2' == d) && world.map.size.y > win->frame_size.y)
16 offset = center_offset(win->center.y,
17 world.map.size.y, win->frame_size.y);
18 win->center.y = offset + (win->frame_size.y / 2);
19 if ('2' == d && win->center.y < world.map.size.y - 1)
24 win->center.y = win->center.y - ('8' == d && win->center.y > 0);
26 else if (('4' == d || '6' == d) && world.map.size.x > win->frame_size.x)
28 offset = center_offset(win->center.x,
29 world.map.size.x, win->frame_size.x);
30 win->center.x = offset + (win->frame_size.x / 2);
31 if ('6' == d && win->center.x < world.map.size.x - 1)
36 win->center.x = win->center.x - ('4' == d && win->center.x > 0);
42 extern void map_center()
44 struct Win * win_map = get_win_by_id('m');
45 win_map->center.y = world.player_pos.y;
46 win_map->center.x = world.player_pos.x;