X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fdraw_wins.c;h=5b60d81c644e3aae7f2d210026b41f0098db6475;hb=5dfbb430e0aed478ced7cdc32c1777745a435532;hp=bcce0a49cc221a53b19d8047c5a94e0ca28c48e7;hpb=4f8360fb6aad70ba208ca60f0d9c94590b222530;p=plomrogue diff --git a/src/draw_wins.c b/src/draw_wins.c index bcce0a4..5b60d81 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -1,9 +1,9 @@ +#include "draw_wins.h" #include #include -#include #include +#include #include "windows.h" -#include "draw_wins.h" #include "roguelike.h" #include "keybindings.h" #include "actors.h" @@ -76,6 +76,7 @@ void draw_map_win (struct Win * win) { struct Map * map = world->map; struct Player * player = world->player; struct Monster * monster; + struct Item * item; char * cells = map->cells; uint16_t width_map_av = map->size.x - map->offset.x; uint16_t height_map_av = map->size.y - map->offset.y; @@ -86,13 +87,17 @@ void draw_map_win (struct Win * win) { if (y < height_map_av && x < width_map_av) { mvwaddch(win->frame.curses_win, y, x, cells[z]); z++; } } } - if ( player->pos.y >= map->offset.y && player->pos.y < map->offset.y + win->frame.size.y - && player->pos.x >= map->offset.x && player->pos.x < map->offset.x + win->frame.size.x) - mvwaddch(win->frame.curses_win, player->pos.y - map->offset.y, player->pos.x - map->offset.x, '@'); + for (item = world->item; item != 0; item = item->next) + if ( item->pos.y >= map->offset.y && item->pos.y < map->offset.y + win->frame.size.y + && item->pos.x >= map->offset.x && item->pos.x < map->offset.x + win->frame.size.x) + mvwaddch(win->frame.curses_win, item->pos.y - map->offset.y, item->pos.x - map->offset.x, item->name); for (monster = world->monster; monster != 0; monster = monster->next) if ( monster->pos.y >= map->offset.y && monster->pos.y < map->offset.y + win->frame.size.y && monster->pos.x >= map->offset.x && monster->pos.x < map->offset.x + win->frame.size.x) - mvwaddch(win->frame.curses_win, monster->pos.y - map->offset.y, monster->pos.x - map->offset.x, monster->name); } + mvwaddch(win->frame.curses_win, monster->pos.y - map->offset.y, monster->pos.x - map->offset.x, monster->name); + if ( player->pos.y >= map->offset.y && player->pos.y < map->offset.y + win->frame.size.y + && player->pos.x >= map->offset.x && player->pos.x < map->offset.x + win->frame.size.x) + mvwaddch(win->frame.curses_win, player->pos.y - map->offset.y, player->pos.x - map->offset.x, '@'); } void draw_info_win (struct Win * win) { // Draw info window by appending win->data integer value to "Turn: " display.