1 /* src/client/map_window.c */
3 #include "map_window.h"
4 #include <stdint.h> /* uint16_t */
5 #include "misc.h" /* center_offset() */
6 #include "wincontrol.h" /* get_win_by_id() */
7 #include "windows.h" /* struct Win */
8 #include "world.h" /* for global world */
12 extern void map_scroll(char d)
14 struct Win * win = get_win_by_id('m');
16 if (('N' == d || 'S' == d) && world.map.size.y > win->framesize.y)
18 offset = center_offset(win->center.y,
19 world.map.size.y, win->framesize.y);
20 win->center.y = offset + (win->framesize.y / 2);
21 if ('S' == d && win->center.y < world.map.size.y - 1)
26 win->center.y = win->center.y - ('N' == d && win->center.y > 0);
28 else if (('W' == d || 'E' == d) && world.map.size.x > win->framesize.x)
30 offset = center_offset(win->center.x,
31 world.map.size.x, win->framesize.x);
32 win->center.x = offset + (win->framesize.x / 2);
33 if ('E' == d && win->center.x < world.map.size.x - 1)
38 win->center.x = win->center.x - ('W' == d && win->center.x > 0);
44 extern void map_center()
46 struct Win * win_map = get_win_by_id('m');
47 win_map->center = world.player_pos;