void drawvision(int x, int y) { static int oldx = -1,oldy = -1; int i,j,c; if (Current_Environment != E_COUNTRYSIDE) { if (Player.status[BLINDED]) { drawspot(oldx,oldy); drawspot(x,y); drawplayer(); } else { if (Player.status[ILLUMINATION] > 0) { for (i= -2;i<3;i++) for (j= -2;j<3;j++) if (inbounds(x+i,y+j)) if (view_los_p(x+i,y+j,Player.x,Player.y)) dodrawspot(x+i,y+j); } else { for (i= -1;i<2;i++) for (j= -1;j<2;j++) if (inbounds(x+i,y+j)) dodrawspot(x+i,y+j); } drawplayer(); drawmonsters(FALSE); /* erase all monsters */ drawmonsters(TRUE); /* draw those now visible */ } if ((! gamestatusp(FAST_MOVE)) || (! optionp(JUMPMOVE))) omshowcursor(Player.x,Player.y); oldx = x; oldy = y; } else { for (i= -1;i<2;i++) for (j= -1;j<2;j++) if (inbounds(x+i,y+j)) { c_set(x+i, y+j, SEEN); if (!offscreen(x+i,y+j)) { wmove(Levelw,screenmody(y+j),screenmodx(x+i)); c = Country[x+i][y+j].current_terrain_type; if (optionp(SHOW_COLOUR)) wattrset(Levelw, CHARATTR(c)); waddch(Levelw,(c&0xff)); } } drawplayer(); omshowcursor(Player.x,Player.y); } }
void bufferprint(void) { int i = bufferpos - 1, c, finished = 0; clearmsg(); #ifndef MSDOS_SUPPORTED_ANTIQUE wprintw(Msg1w,"^p for previous message, ^n for next, anything else to quit."); #else wprintw(Msg1w,"^o for last message, ^n for next, anything else to quit."); #endif wrefresh(Msg1w); do { if (i >= STRING_BUFFER_SIZE) i = 0; if (i < 0) i = STRING_BUFFER_SIZE - 1; wclear(Msg2w); wprintw(Msg2w,Stringbuffer[i]); wrefresh(Msg2w); c = mgetc(); #ifndef MSDOS_SUPPORTED_ANTIQUE if (c == 16) /* ^p */ #else if (c == 15) /* ^o */ #endif i--; else if (c == 14) /* ^n */ i++; else finished = 1; } while (!finished); clearmsg(); omshowcursor(Player.x,Player.y); }
/* for targeting in dungeon */ void movecursor(int *x, int *y, int dx, int dy) { if (inbounds(*x+dx,*y+dy)) { *x += dx; *y += dy; screencheck(*x,*y); } omshowcursor(*x,*y); }
/* move the cursor around, like for firing a wand, sets x and y to target */ void setspot(int *x, int *y) { char c = ' '; mprint("Targeting.... ? for help"); omshowcursor(*x,*y); while ((c != '.') && (c != ESCAPE)) { c = lgetc(); switch(c) { case 'h': case '4': movecursor(x,y,-1,0); break; case 'j': case '2': movecursor(x,y,0,1); break; case 'k': case '8': movecursor(x,y,0,-1); break; case 'l': case '6': movecursor(x,y,1,0); break; case 'b': case '1': movecursor(x,y,-1,1); break; case 'n': case '3': movecursor(x,y,1,1); break; case 'y': case '7': movecursor(x,y,-1,-1); break; case 'u': case '9': movecursor(x,y,1,-1); break; case '?': clearmsg(); mprint("Use vi keys or numeric keypad to move cursor to target."); mprint("Hit the '.' key when done, or ESCAPE to abort."); break; } } if (c==ESCAPE) { *x = *y = ABORT; clearmsg(); } screencheck(Player.x,Player.y); }