void pl_box(register FILE *plotfp, int x1, int y1, int x2, int y2) { pl_move( plotfp, x1, y1 ); pl_cont( plotfp, x1, y2 ); pl_cont( plotfp, x2, y2 ); pl_cont( plotfp, x2, y1 ); pl_cont( plotfp, x1, y1 ); pl_move( plotfp, x2, y2 ); }
/* ARGSUSED */ static int plot_drawString2D(struct dm *dmp, register char *str, fastf_t x, fastf_t y, int size, int use_aspect) { int sx, sy; sx = x * 2047; sy = y + 2047; pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx, sy); pl_label(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, str); return TCL_OK; }
/** * T P _ I 2 L I S T * * Take a set of x, y coordinates, and plot them as a * polyline, ie, connect them with line segments. * For markers, use tp_mlist(), below. * This "C" interface expects arrays of INTs. */ void tp_i2list(register FILE *fp, register int *x, register int *y, register int npoints) /* array of points */ /* array of points */ { if ( npoints <= 0 ) return; pl_move( fp, *x++, *y++ ); while ( --npoints > 0 ) pl_cont( fp, *x++, *y++ ); }
/** * P L O T _ 2 D _ G O T O */ HIDDEN int plot_drawLine2D(struct dm *dmp, fastf_t xpos1, fastf_t ypos1, fastf_t xpos2, fastf_t ypos2) { int sx1, sy1; int sx2, sy2; sx1 = xpos1 * 2047; sx2 = xpos2 * 2047; sy1 = ypos1 + 2047; sy2 = ypos2 + 2047; pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx1, sy1); pl_cont(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx2, sy2); return TCL_OK; }
/* * P L O T _ 2 D _ G O T O * */ static int plot_drawLine2D(struct dm *dmp, fastf_t x1, fastf_t y1, fastf_t x2, fastf_t y2) { int sx1, sy1; int sx2, sy2; sx1 = x1 * 2047; sx2 = x2 * 2047; sy1 = y1 + 2047; sy2 = y2 + 2047; pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx1, sy1); pl_cont(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx2, sy2); return TCL_OK; }
/** * P L O T _ P U T S * * Output a string into the displaylist. * The starting position of the beam is as specified. */ HIDDEN int plot_drawString2D(struct dm *dmp, const char *str, fastf_t x, fastf_t y, int size, int UNUSED(use_aspect)) { int sx, sy; if (!dmp || !str || size < 0) { return TCL_ERROR; } sx = x * 2047; sy = y + 2047; pl_move(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, sx, sy); pl_label(((struct plot_vars *)dmp->dm_vars.priv_vars)->up_fp, str); return TCL_OK; }
bool game::do_turn() { draw(); switch (getch()) { case 'j': pl_move( 0, 1); break; case 'k': pl_move( 0, -1); break; case 'h': pl_move(-1, 0); break; case 'l': pl_move( 1, 0); break; case 'y': pl_move(-1, -1); break; case 'u': pl_move( 1, -1); break; case 'b': pl_move(-1, 1); break; case 'n': pl_move( 1, 1); break; case 'i': { item tmp; tmp.set_type( rng(0, ITEMS_POOL.size() - 1) ); curMap.add_item( player.pos.x, player.pos.y, tmp); } break; case 'q': return false; } curMap.process_transformations(); return true; }