X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fdraw_wins.c;h=bcce0a49cc221a53b19d8047c5a94e0ca28c48e7;hb=4f8360fb6aad70ba208ca60f0d9c94590b222530;hp=3741e4965371afb6ae3a287fe908972ba15c7bcc;hpb=6d5705b43adbc2a4b522f971206007c9073c7144;p=plomrogue diff --git a/src/draw_wins.c b/src/draw_wins.c index 3741e49..bcce0a4 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -6,6 +6,7 @@ #include "draw_wins.h" #include "roguelike.h" #include "keybindings.h" +#include "actors.h" void draw_with_linebreaks (struct Win * win, char * text, uint16_t start_y) { // Write text into window content space. Start on row start_y. Fill unused rows with whitespace. @@ -76,22 +77,22 @@ void draw_map_win (struct Win * win) { struct Player * player = world->player; struct Monster * monster; char * cells = map->cells; - uint16_t width_map_av = map->width - map->offset_x; - uint16_t height_map_av = map->height - map->offset_y; + uint16_t width_map_av = map->size.x - map->offset.x; + uint16_t height_map_av = map->size.y - map->offset.y; uint16_t x, y, z; for (y = 0; y < win->frame.size.y; y++) { - z = map->offset_x + (map->offset_y + y) * (map->width); + z = map->offset.x + (map->offset.y + y) * (map->size.x); for (x = 0; x < win->frame.size.x; x++) { if (y < height_map_av && x < width_map_av) { mvwaddch(win->frame.curses_win, y, x, cells[z]); z++; } } } - if ( player->y >= map->offset_y && player->y < map->offset_y + win->frame.size.y - && player->x >= map->offset_x && player->x < map->offset_x + win->frame.size.x) - mvwaddch(win->frame.curses_win, player->y - map->offset_y, player->x - map->offset_x, '@'); + 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 (monster = world->monster; monster != 0; monster = monster->next) - if ( monster->y >= map->offset_y && monster->y < map->offset_y + win->frame.size.y - && monster->x >= map->offset_x && monster->x < map->offset_x + win->frame.size.x) - mvwaddch(win->frame.curses_win, monster->y - map->offset_y, monster->x - map->offset_x, monster->name); } + 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); } void draw_info_win (struct Win * win) { // Draw info window by appending win->data integer value to "Turn: " display.