X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/static/git-logo.png?a=blobdiff_plain;f=src%2Fdraw_wins.c;h=dd96c36e71002212765dd4e2f37ce04e790a3950;hb=d951e2631a19500f1bb8c29f9e029a9d9fb29ae7;hp=197b7c383aa4f467d594535ef3790c70822e4306;hpb=8adb91a7c7de0716ce55784322e239415bf06e06;p=plomrogue diff --git a/src/draw_wins.c b/src/draw_wins.c index 197b7c3..dd96c36 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -4,9 +4,11 @@ #include #include #include "windows.h" -#include "roguelike.h" +#include "misc.h" #include "keybindings.h" #include "objects_on_map.h" +#include "map.h" +#include "main.h" static void draw_map_objects (void *, struct Map *, struct Win *); @@ -104,21 +106,15 @@ extern void draw_map_win (struct Win * win) { extern void draw_info_win (struct Win * win) { // Draw info window by appending win->data integer value to "Turn: " display. struct World * world = (struct World *) win->data; - uint16_t count = world->turn; char text[100]; - snprintf(text, 100, "Turn: %d", count); + snprintf(text, 100, "Turn: %d\nHitpoints: %d", world->turn, world->player->hitpoints); draw_with_linebreaks(win, text, 0); } extern void draw_keys_win (struct Win * win) { // Draw keybindings window. struct World * world = (struct World *) win->data; - uint16_t offset = 0, y, x; - if (world->keyswindata->max >= win->frame.size.y) { - if (world->keyswindata->select > win->frame.size.y / 2) { - if (world->keyswindata->select < (world->keyswindata->max - (win->frame.size.y / 2))) - offset = world->keyswindata->select - (win->frame.size.y / 2); - else - offset = world->keyswindata->max - win->frame.size.y + 1; } } + uint16_t offset, y, x; + offset = center_offset (world->keyswindata->select, world->keyswindata->max, win->frame.size.y - 1); uint8_t keydescwidth = 9 + 1; // max length assured by get_keyname() + \0 char * keydesc = malloc(keydescwidth), * keyname; attr_t attri;