/* cliparound(x, y)-- Make sure that the user is more-or-less centered on the screen if the playing area is larger than the screen. -- This function is only defined if CLIPPING is defined. */ void curses_cliparound(int x, int y) { int sx, sy, ex, ey; boolean redraw = curses_map_borders(&sx, &sy, &ex, &ey, x, y); if (redraw) { curses_draw_map(sx, sy, ex, ey); } }
void curses_putch(winid wid, int x, int y, int ch, int color, int attr) { int sx, sy, ex, ey; boolean border = curses_window_has_border(wid); nethack_char nch; static boolean map_initted = FALSE; if (wid == STATUS_WIN) { curses_update_stats(FALSE); } if (wid != MAP_WIN) { return; } if (!map_initted) { clear_map(); map_initted = TRUE; } map[y][x].ch = ch; map[y][x].color = color; map[y][x].attr = attr; nch = map[y][x]; (void)curses_map_borders(&sx, &sy, &ex, &ey, -1, -1); if ((x >= sx) && (x <= ex) && (y >= sy) && (y <= ey)) { if (border) { x++; y++; } write_wchar(mapwin, x - sx, y - sy, nch); } wrefresh(mapwin); }
void curses_move_cursor(winid wid, int x, int y) { int sx, sy, ex, ey; int xadj = 0; int yadj = 0; #ifndef PDCURSES WINDOW *win = curses_get_nhwin(MAP_WIN); #endif if (wid != MAP_WIN) { return; } #ifdef PDCURSES /* PDCurses seems to not handle wmove correctly, so we use move and physical screen coordinates instead */ curses_get_window_xy(wid, &xadj, &yadj); #endif curs_x = x + xadj; curs_y = y + yadj; curses_map_borders(&sx, &sy, &ex, &ey, x, y); if (curses_window_has_border(wid)) { curs_x++; curs_y++; } if ((x >= sx) && (x <= ex) && (y >= sy) && (y <= ey)) { curs_x -= sx; curs_y -= sy; #ifdef PDCURSES move(curs_y, curs_x); #else wmove(win, curs_y, curs_x); #endif } }