- 7


case 'a': /* */

rotate_objekt(object, 0.05, x, y, sides); break;

case '\r': /* ,

*/

if(first_point)

startx = x, starty = y;

else

endx = x, endy = y;

first_point = !first_point; break;

case 'p':

pal_num = pal_num==1 ? 2:1;

palette(pal_num);

xhairs(x, y);

while (key.c[0]!='q');

getchar();

mode(2);

/* */

void palette(pnum)

int pnum;

union REGS r;

r.h.bh = 1; /* 4 */

r.h.bl = pnum;

r.h.ah = 11; /* */

int86(0x10, &r, &r);

/* - */

void mode (mode_code)

int mode_code;

union REGS r;

r.h.al = mode_code;

r.h.ah = 0;

int86(0x10,&r, &r);

/* */

void box(sx, sy, ex, ey, c)

int sx, sy, ex, ey, c;

line(sx, sy, ex, sy, c);

line(sx, sy, sx, ey, c);

line(sx, ey, ex, ey, c);

line(ex, sy, ex, ey, c);

/*

*/

void line(startx,starty,endx,endy,color)

int startx,starty,endx,endy,color;

register int t,distance;

int xerr=0,yerr=0,delta_x,delta_y;

int incx,incy;

/* */

delta_x=endx-startx;

delta_y=endy-starty;

/* ,

,

蠠 */

if (delta_x>0) incx=1;

else if (delta_x==0) incx=0;

else incx= -1;

if (delta_y>0) incy=1;

else if (delta_y==0) incy=0;

else incy= -1;

/* */

delta_x=abs(delta_x);

delta_y=abs(delta_y);

if (delta_x>delta_y) distance=delta_x;

else distance=delta_y;

/* */

for (t=0; t<=distance+1; t++)

mempoint(startx,starty,color);

xerr+=delta_x;