X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fclient%2Fmap.c;h=e08e7b31af79f8858ccc85c6ccd7d7bbd7158764;hb=eec39e9d6f991c90c8555859b5f10eb30c0370c1;hp=48a9b5830de67de3cb60342b8e85277fb6700726;hpb=6b1d36c9e673fd8f8595119080dca63a39ba483b;p=plomrogue diff --git a/src/client/map.c b/src/client/map.c index 48a9b58..e08e7b3 100644 --- a/src/client/map.c +++ b/src/client/map.c @@ -1,4 +1,9 @@ -/* src/client/map.c */ +/* src/client/map.c + * + * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3 + * or any later version. For details on its copyright, license, and warranties, + * see the file NOTICE in the root directory of the PlomRogue source package. + */ #include "map.h" #include /* uint8_t */ @@ -9,26 +14,27 @@ extern void map_scroll(char d) { + world.focus_each_turn = 0; struct Win * win = get_win_by_id('m'); - uint8_t offset; - if (('8' == d || '2' == d) && world.map.size.y > win->frame_size.y) + uint16_t offset; + if (('8' == d || '2' == d) && world.map.length > win->frame_size.y) { offset = center_offset(win->center.y, - world.map.size.y, win->frame_size.y); + world.map.length, win->frame_size.y); win->center.y = offset + (win->frame_size.y / 2); - if ('2' == d && win->center.y < world.map.size.y - 1) + if ('2' == d && win->center.y < world.map.length - 1) { win->center.y++; return; } win->center.y = win->center.y - ('8' == d && win->center.y > 0); } - else if (('4' == d || '6' == d) && (world.map.size.x*2) > win->frame_size.x) + else if (('4' == d || '6' == d) && (world.map.length*2) > win->frame_size.x) { offset = center_offset(win->center.x, - world.map.size.x*2, win->frame_size.x); + world.map.length*2, win->frame_size.x); win->center.x = offset + (win->frame_size.x / 2); - if ('6' == d && win->center.x < (world.map.size.x * 2) - 1) + if ('6' == d && win->center.x < (world.map.length * 2) - 1) { win->center.x++; return; @@ -43,5 +49,12 @@ extern void map_center() { struct Win * win_map = get_win_by_id('m'); win_map->center.y = world.player_pos.y; - win_map->center.x = world.player_pos.x * 2; + win_map->center.x = world.player_pos.x * 2 + (world.player_pos.y % 2); +} + + + +extern void toggle_autofocus() +{ + world.focus_each_turn = world.focus_each_turn ? 0 : 1; }