home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / NEURLNET / NERVES.ZIP / PLAY / SHOWBUG.C < prev   
Encoding:
C/C++ Source or Header  |  1990-12-29  |  1.1 KB  |  56 lines

  1. #include "defn.h"
  2. #include "playdata.c"
  3. #include "playproto.h"
  4.  
  5.  
  6. void showbug(struct recbug *rc,int col)
  7.  {
  8.   int i,x,y,t1,t2,poly[12];
  9.  
  10.   setcolor(col);
  11.  
  12.   x = rc->x;
  13.   y = rc->y;
  14.  
  15.   /* draw head */
  16.   poly[0] = x;
  17.   poly[1] = y;
  18.   for (i=0; i<6; i+=2)
  19.    {
  20.     poly[i+2] = rc->head[i] + x;
  21.     poly[i+3] = rc->head[i+1] + y;
  22.    }
  23.   poly[8] = poly[0];
  24.   poly[9] = poly[1];
  25.   drawpoly(5,poly);
  26.   if (rc->mouthfood & 1)
  27.    line(poly[0],poly[1],poly[4],poly[5]);
  28.  
  29.   /* draw body */
  30.   for (i=0; i<12; i+=2)
  31.    {
  32.     poly[i] = rc->body[i] + x;
  33.     poly[i+1] = rc->body[i+1] + y;
  34.    }
  35.   drawpoly(6,poly);
  36.  
  37.   /* draw antennae */
  38.   for (i=0; i<2; i++)
  39.    {
  40.     line(rc->antax[i]+x,rc->antay[i]+y,rc->antx[i]+x,rc->anty[i]+y);
  41.    }
  42.  
  43.   /* draw cerci */
  44.   for (i=0; i<2; i++)
  45.    line(rc->cercax[i]+x,rc->cercay[i]+y,rc->cercx[i]+x,rc->cercy[i]+y);
  46.  
  47.   /* draw legs & feet */
  48.   for (i=0; i<6; i++)
  49.    {
  50.     t1 = rc->footx[i] + x;
  51.     t2 = rc->footy[i] + y;
  52.     line(rc->legx[i]+x,rc->legy[i]+y,t1,t2);
  53.     if (rc->footst & (1<<i))
  54.      rectangle(t1-1,t2-1,t1+1,t2+1);
  55.    }
  56.  }