home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 14 / CD_ASCQ_14_0694.iso / maj / 4524 / svgadem2.c < prev    next >
C/C++ Source or Header  |  1994-05-09  |  31KB  |  1,214 lines

  1. /****************************************************************************
  2.      
  3.       'SVGACC' A Super Vga Graphics Library for use with Microsoft and
  4.       Borland C/C++
  5.       Copyright 1993-1994 by Stephen L. Balkum and Daniel A. Sill
  6.  
  7.       GIF and 'Graphics Intechange Format' are trademarks (tm) of
  8.       Compuserve, Incorporated, an H&R Block Company.
  9.  
  10.     **************** UNREGISTERD SHAREWARE VERSION ***********************
  11.     * FOR EVUALATION ONLY. NOT FOR RESALE IN ANY FORM. SOFTWARE WRITTEN  *
  12.     * USING THIS UNREGISTERED SHAREWARE GRAPHICS LIBRARY MAY NOT BY SOLD *
  13.     * OR USED FOR ANY PURPOSE OTHER THAN THE EVUALTION OF THIS LIBRARY.  *
  14.     **********************************************************************
  15.  
  16.     **************** NO WARRANTIES AND NO LIABILITY **********************
  17.     * Stephen L. Balkum and Daniel A. Sill provide no warranties, either *
  18.     * expressed or implied, of merchantability, or fitness, for a        *
  19.     * particular use or purpose of this SOFTWARE and documentation.      *
  20.     * In no event shall Stephen L. Balkum or Daniel A. Sill be held      *
  21.     * liable for any damages resulting from the use or misuse of the     * 
  22.     * SOFTWARE and documentation.                                        *
  23.     **********************************************************************
  24.  
  25.     ************** U.S. GOVERNMENT RESTRICTED RIGHTS *********************
  26.     * Use, duplication, or disclosure of the SOFTWARE and documentation  *
  27.     * by the U.S. Government is subject to the restictions as set forth  *
  28.     * in subparagraph (c)(1)(ii) of the Rights in Technical Data and     *
  29.     * Computer Software cluse at DFARS 252.227-7013.                     *
  30.     * Contractor/manufacturer is Stephen L. Balkum and Daniel A. Sill,   *
  31.     * P.O. Box 7704, Austin, Texas 78713-7704                            *
  32.     **********************************************************************
  33.  
  34.     **********************************************************************
  35.     * By using this SOFTWARE or documentation, you agree to the above    *
  36.     * terms and conditions.                                              *
  37.     **********************************************************************
  38.  
  39.  ***************************************************************************/
  40.  
  41. #define MODULE
  42.  
  43. #include <stdio.h>
  44. #include <conio.h>
  45. #include <malloc.h>
  46. #include <string.h>
  47. #include <dos.h>
  48. #include <math.h>
  49.  
  50. #include "svgacc.h"
  51.  
  52. #include "svgademo.h"
  53.  
  54. char showgif(char fname[]);
  55. void showhouse(D2Point *plotarray, D2Point *oplotarray);
  56. void showstar(D2Point *plotarray, D2Point *oplotarray);
  57.  
  58.  
  59. /********
  60.  * DO2D *
  61.  ********/
  62.  
  63. char do2d(void)
  64. {
  65.     int i, trans;
  66.     int spcing, cntx, cnty;
  67.     D2Point pointarray[9];
  68.     D2Point plotarray[9];
  69.     D2Point oplotarray[9];
  70.     char ret;
  71.     char title[TITLEN];
  72.     char buf[TITLEN];
  73.     char buf2[TITLEN];
  74.  
  75.     /*
  76.      * Set up the Title
  77.      */
  78.     sprintf(title,"DEMO 11: 2D functions");
  79.     palset(pal,0,255);
  80.  
  81.     /*
  82.      * Set up the star patter of points
  83.      */
  84.     cntx = maxx / 2;
  85.     cnty = (maxy - 32) / 2 + 32;
  86.     spcing = maxx / 15;
  87.     pointarray[0].x = 0;
  88.     pointarray[0].y = -spcing * 3;
  89.     pointarray[1].x = spcing;
  90.     pointarray[1].y = -spcing;
  91.     pointarray[2].x = spcing * 3;
  92.     pointarray[2].y = 0;
  93.     pointarray[3].x = spcing;
  94.     pointarray[3].y = spcing;
  95.     pointarray[4].x = 0;
  96.     pointarray[4].y = spcing * 3;
  97.     pointarray[5].x = -spcing;
  98.     pointarray[5].y = spcing;
  99.     pointarray[6].x = -spcing * 3;
  100.     pointarray[6].y = 0;
  101.     pointarray[7].x = -spcing;
  102.     pointarray[7].y = -spcing;
  103.     pointarray[8].x = 0;
  104.     pointarray[8].y = -spcing * 3;
  105.  
  106.     /*
  107.      * Show d2translate
  108.      */
  109.     fillscreen(0);
  110.     setview(0,0,maxx,maxy);
  111.     drwstring(1,7,0,title,10,0);
  112.     sprintf(buf,"d2translate(point,xtrans,ytrans,inarray,outarray);");
  113.     drwstring(1,7,0,buf,10,16);
  114.     setview(0,32,maxx,maxy);
  115.     d2translate(9,cntx,cnty,pointarray,plotarray);
  116.     showstar(plotarray,oplotarray);
  117.     ret = getkey();
  118.     if ((ret=='s') || (ret=='q')) {
  119.         fillscreen(0);
  120.         setview(0,0,maxx,maxy);
  121.         return(ret);
  122.     }
  123.     trans = 0;
  124.     for(i=0;i<spcing;i++) {
  125.         trans+=2;
  126.         d2translate(9,cntx+trans,cnty+trans,pointarray,plotarray);
  127.         showstar(plotarray,oplotarray);
  128.         sdelay(2);
  129.     }
  130.     for(i=0;i<spcing;i++) {
  131.         trans-=2;
  132.         d2translate(9,cntx+trans,cnty+trans,pointarray,plotarray);
  133.         showstar(plotarray,oplotarray);
  134.         sdelay(2);
  135.     }
  136.     ret = getkey();
  137.     if ((ret=='s') || (ret=='q')) {
  138.         fillscreen(0);
  139.         setview(0,0,maxx,maxy);
  140.         return(ret);
  141.     }
  142.  
  143.     /*
  144.      * Show d2scale
  145.      */
  146.     setview(0,16,maxx,31);
  147.     fillview(0);
  148.     setview(0,16,maxx,maxy);
  149.     sprintf(buf,"d2scale(points,xscale,yscale,inarray,outarray);");
  150.     drwstring(1,7,0,buf,10,16);
  151.     setview(0,32,maxx,maxy);
  152.     d2translate(9,cntx,cnty,pointarray,plotarray);
  153.     showstar(plotarray,oplotarray);
  154.     for(i=256;i<=380;i+=4) {
  155.         d2scale(9,i,i,pointarray,plotarray);
  156.         d2translate(9,cntx,cnty,plotarray,plotarray);
  157.         showstar(plotarray,oplotarray);
  158.         sdelay(2);
  159.     }
  160.     for(i=384;i>=128;i-=4) {
  161.         d2scale(9,i,i,pointarray,plotarray);
  162.         d2translate(9,cntx,cnty,plotarray,plotarray);
  163.         showstar(plotarray,oplotarray);
  164.         sdelay(2);
  165.     }
  166.     for(i=124;i<=256;i+=4) {
  167.         d2scale(9,i,i,pointarray,plotarray);
  168.         d2translate(9,cntx,cnty,plotarray,plotarray);
  169.         showstar(plotarray,oplotarray);
  170.         sdelay(2);
  171.     }
  172.     ret = getkey();
  173.     if ((ret=='s') || (ret=='q')) {
  174.         fillscreen(0);
  175.         setview(0,0,maxx,maxy);
  176.         return(ret);
  177.     }
  178.  
  179.     /*
  180.      * Show d2rotate
  181.      */
  182.     setview(0,16,maxx,31);
  183.     fillview(0);
  184.     setview(0,16,maxx,maxy);
  185.     sprintf(buf,"d2rotate(points,xorigin,yorigin,angle,inarray,outarray);");
  186.     drwstring(1,7,0,buf,10,16);
  187.     sprintf(buf2,"Let's do it about the center of the object.");
  188.     drwstring(1,7,0,buf2,10,32);
  189.     setview(0,48,maxx,maxy);
  190.     d2translate(9,cntx,cnty,pointarray,plotarray);
  191.     showstar(plotarray,oplotarray);
  192.     for(i=0;i<=180;i++) {
  193.         d2rotate(9,0,0,i,pointarray,plotarray);
  194.         d2translate(9,cntx,cnty,plotarray,plotarray);
  195.         showstar(plotarray,oplotarray);
  196.         sdelay(2);
  197.     }
  198.     for(i=180;i>=0;i-=2) {
  199.         d2rotate(9,0,0,i,pointarray,plotarray);
  200.         d2translate(9,cntx,cnty,plotarray,plotarray);
  201.         showstar(plotarray,oplotarray);
  202.         sdelay(2);
  203.     }
  204.     ret = getkey();
  205.     if ((ret=='s') || (ret=='q')) {
  206.         fillscreen(0);
  207.         setview(0,0,maxx,maxy);
  208.         return(ret);
  209.     }
  210.  
  211.     /*
  212.      * Show d2rotate (about an arbitrary point)
  213.      */
  214.     setview(0,16,maxx,48);
  215.     fillview(0);
  216.     setview(0,16,maxx,maxy);
  217.     sprintf(buf,"d2rotate(points,xorigin,yorigin,angle,inarray,outarray);");
  218.     drwstring(1,7,0,buf,10,16);
  219.     sprintf(buf2,"Let's do it about an arbitrary point.");
  220.     drwstring(1,7,0,buf2,10,32);
  221.     setview(0,48,maxx,maxy);
  222.     d2translate(9,cntx,cnty,pointarray,plotarray);
  223.     showstar(plotarray,oplotarray);
  224.     for(i=0;i<=360;i+=2) {
  225.         d2rotate(9,0,spcing*3,i,pointarray,plotarray);
  226.         d2translate(9,cntx,cnty,plotarray,plotarray);
  227.         showstar(plotarray,oplotarray);
  228.         sdelay(2);
  229.     }
  230.     ret = getkey();
  231.     
  232.     fillscreen(0);
  233.     setview(0,0,maxx,maxy);
  234.     
  235.     return(ret);
  236.  
  237. }
  238.  
  239. /********
  240.  * DO3D *
  241.  ********/
  242.  
  243. char do3d(void)
  244. {
  245.     float pi;
  246.     int i;
  247.     float height, radius;
  248.     int spcing;
  249.     D3Point pointarray[14];
  250.     D3Point playarray[14];
  251.     D2Point plotarray[14];
  252.     D2Point oplotarray[14];
  253.     ProjParameters proj;
  254.     char ret;
  255.     char title[TITLEN];
  256.     char buf[TITLEN];
  257.     
  258.  
  259.     /*
  260.      * Set up the Title
  261.      */
  262.     sprintf(title,"DEMO 12: 3D functions");
  263.     palset(pal,0,255);
  264.  
  265.     /*
  266.      * Set up the house pattern of points
  267.      */
  268.     spcing = maxx / 6;
  269.     pointarray[0].x = -spcing;
  270.     pointarray[0].y = -spcing * 2;
  271.     pointarray[0].z = 0;
  272.     pointarray[1].x = spcing;
  273.     pointarray[1].y = -spcing * 2;
  274.     pointarray[1].z = 0;
  275.     pointarray[2].x = spcing;
  276.     pointarray[2].y = -spcing * 2;
  277.     pointarray[2].z = spcing * 2;
  278.     pointarray[3].x = -spcing;
  279.     pointarray[3].y = -spcing * 2;
  280.     pointarray[3].z = spcing * 2;
  281.     pointarray[4].x = -spcing;
  282.     pointarray[4].y = spcing * 2;
  283.     pointarray[4].z = 0;
  284.     pointarray[5].x = spcing;
  285.     pointarray[5].y = spcing * 2;
  286.     pointarray[5].z = 0;
  287.     pointarray[6].x = spcing;
  288.     pointarray[6].y = spcing * 2;
  289.     pointarray[6].z = spcing * 2;
  290.     pointarray[7].x = -spcing;
  291.     pointarray[7].y = spcing * 2;
  292.     pointarray[7].z = spcing * 2;
  293.     pointarray[8].x = 0;
  294.     pointarray[8].y = -spcing * 2;
  295.     pointarray[8].z = spcing * 3;
  296.     pointarray[9].x = 0;
  297.     pointarray[9].y = spcing * 2;
  298.     pointarray[9].z = spcing * 3;
  299.     pointarray[10].x = 0;
  300.     pointarray[10].y = 0;
  301.     pointarray[10].z = 0;
  302.     pointarray[11].x = spcing * 4;
  303.     pointarray[11].y = 0;
  304.     pointarray[11].z = 0;
  305.     pointarray[12].x = 0;
  306.     pointarray[12].y = 0;
  307.     pointarray[12].z = spcing * 4;
  308.     pointarray[13].x = 0;
  309.     pointarray[13].y = spcing * 4;
  310.     pointarray[13].z = 0;
  311.     bytecopy(pointarray,playarray,sizeof(pointarray));
  312.  
  313.     /*
  314.      * Show d3project
  315.      */
  316.     setview(0,0,maxx,maxy);
  317.     pi = (float)(4. * atan(1) / 180.);
  318.     fillscreen(0);
  319.     drwstring(1,7,0,title,10,0);
  320.     sprintf(buf,"d3project(points,projparams,inarray,outarray);");
  321.     drwstring(1,7,0,buf,10,16);
  322.     setview(0,32,maxx,maxy);
  323.     height = (float)(maxy * 8);
  324.     radius = (float)(maxx * 30);
  325.     proj.scrd = (int)(sqrt(radius * radius + height * height) / 2.);
  326.     proj.theta = 110;
  327.     proj.phi = (int)(atan(height / -radius) / pi);
  328.     proj.eyex = (int)(-radius * cos(proj.theta * pi));
  329.     proj.eyey = (int)(-radius * sin(proj.theta * pi));
  330.     proj.eyez = (int)height;
  331.     d3project(14,&proj,playarray,plotarray);
  332.     for(i=0;i<14;i++) {
  333.         oplotarray[i].x = plotarray[i].x;
  334.         oplotarray[i].y = plotarray[i].y;
  335.     }
  336.     showhouse(plotarray,oplotarray);
  337.     ret = getkey();
  338.     if ((ret=='s') || (ret=='q')) {
  339.         fillscreen(0);
  340.         setview(0,0,maxx,maxy);
  341.         return(ret);
  342.     }
  343.     for(i=112;i<=470;i+=3) {
  344.         proj.theta = i;
  345.         proj.eyex = (int)(-radius * cos(proj.theta * pi));
  346.         proj.eyey = (int)(-radius * sin(proj.theta * pi));
  347.         d3project(14,&proj,playarray,plotarray);
  348.         showhouse(plotarray,oplotarray);
  349.         sdelay(2);
  350.     }
  351.     ret = getkey();
  352.     if ((ret=='s') || (ret=='q')) {
  353.         fillscreen(0);
  354.         setview(0,0,maxx,maxy);
  355.         return(ret);
  356.     }
  357.  
  358.     /*
  359.      * Show d3translate
  360.      */
  361.     setview(0,16,maxx,31);
  362.     fillview(0);
  363.     sprintf(buf,"d3translate(points,xtrans,ytrans,ztrans,inarray,outarray);");
  364.     drwstring(1,7,0,buf,10,16);
  365.     setview(0,32,maxx,maxy);
  366.     for(i=2;i<=300;i+=6) {
  367.         d3translate(10,i,i,0,pointarray,playarray);
  368.         d3project(10,&proj,playarray,plotarray);
  369.         showhouse(plotarray,oplotarray);
  370.         sdelay(2);
  371.     }
  372.     for(i=302;i>=2;i-=6) {
  373.         d3translate(10,i,i,0,pointarray,playarray);
  374.         d3project(10,&proj,playarray,plotarray);
  375.         showhouse(plotarray,oplotarray);
  376.         sdelay(2);
  377.     }
  378.     ret = getkey();
  379.     if ((ret=='s') || (ret=='q')) {
  380.         fillscreen(0);
  381.         setview(0,0,maxx,maxy);
  382.         return(ret);
  383.     }
  384.  
  385.     /*
  386.      * Show d3scale
  387.      */
  388.     setview(0,16,maxx,31);
  389.     fillview(0);
  390.     sprintf(buf,"d3scale(points,xscale,yscale,zscale,inarray,outarray);");
  391.     drwstring(1,7,0,buf,10,16);
  392.     setview(0,32,maxx,maxy);
  393.     for(i=256;i<=380;i+=4) {
  394.         d3scale(10,i,i,i,pointarray,playarray);
  395.         d3project(10,&proj,playarray,plotarray);
  396.         showhouse(plotarray,oplotarray);
  397.         sdelay(2);
  398.     }
  399.     for(i=384;i>=128;i-=4) {
  400.         d3scale(10,i,i,i,pointarray,playarray);
  401.         d3project(10,&proj,playarray,plotarray);
  402.         showhouse(plotarray,oplotarray);
  403.         sdelay(2);
  404.     }
  405.     for(i=124;i<=256;i+=4) {
  406.         d3scale(10,i,i,i,pointarray,playarray);
  407.         d3project(10,&proj,playarray,plotarray);
  408.         showhouse(plotarray,oplotarray);
  409.         sdelay(2);
  410.     }
  411.     ret = getkey();
  412.     if ((ret=='s') || (ret=='q')) {
  413.         fillscreen(0);
  414.         setview(0,0,maxx,maxy);
  415.         return(ret);
  416.     }
  417.  
  418.     /*
  419.      * show d3rotate
  420.      */
  421.     setview(0,16,maxx,31);
  422.     fillview(0);
  423.     sprintf(buf,"d3rotate(points,xorigin,yorigin,zorigin,zangle,yangle,xangle,inarray,outarray);");
  424.     drwstring(1,7,0,buf,10,16);
  425.     setview(0,32,maxx,maxy);
  426.     for(i=0;i<=360;i+=3) {
  427.         d3rotate(10,0,0,0,0,i,i,pointarray,playarray);
  428.         d3project(10,&proj,playarray,plotarray);
  429.         showhouse(plotarray,oplotarray);
  430.         sdelay(2);
  431.     }
  432.     
  433.     ret = getkey();
  434.  
  435.     fillscreen(0);
  436.     setview(0,0,maxx,maxy);
  437.  
  438.     return(ret);
  439.  
  440. }
  441.  
  442. /***********
  443.  * DOMOUSE *
  444.  ***********/
  445.  
  446. char domouse(void)
  447. {
  448.     int i, mouse;
  449.     int colr, x1, x2, y1, y2;
  450.     int lb, cb, rb, x, y, mbuts;
  451.     int spcing;
  452.     char ret;
  453.     char title[TITLEN];
  454.     char buf[TITLEN];
  455.  
  456.     /*
  457.      * Set up the title
  458.      */
  459.     sprintf(title,"DEMO 9: Mouse functions");
  460.     fillscreen(0);
  461.     palset(pal,0,255);
  462.     setview(0,0,maxx,maxy);
  463.  
  464.     /*
  465.      * Check to see if we have a mouse so we can do the mouse demo
  466.      */
  467.     mouse = whichmouse();
  468.     if (mouse < 1) {
  469.         drwstring(1,7,0,title,10,0);
  470.         sprintf(buf,"Sorry, no mouse detected... Can not do the mouse demo.");
  471.         drwstring(1,7,0,buf,10,16);
  472.         ret = getkey();
  473.         fillscreen(0);
  474.         return(ret);
  475.     }
  476.     colr = 16;
  477.     for(i=0;i<=maxx/2;i++) {
  478.         drwcircle(1,colr,maxx/4 + i, maxy/2, maxy/5);
  479.         colr+=2;
  480.         if (colr>255)
  481.             colr = 16;
  482.     }
  483.  
  484.     /*
  485.      * Show mouseshow
  486.      */
  487.     setview(0,0,maxx,31);
  488.     fillview(0);   
  489.     drwstring(1,7,0,title,10,0);
  490.     sprintf(buf,"mouseshow();");
  491.     drwstring(1,7,0,buf,10,16);
  492.     setview(0,32,maxx,maxy);
  493.     mouseenter(); /* MUST BE CALLED FIRST TO ENABLE MOUSE FUNCTIONS */
  494.     mouseshow();
  495.     ret = getkey();
  496.     if ((ret=='s') || (ret=='q')) {
  497.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  498.         fillscreen(0);
  499.         setview(0,0,maxx,maxy);
  500.         return(ret);
  501.     }
  502.  
  503.     /*
  504.      * Show mousestatus
  505.      */
  506.     mousehide();
  507.     setview(0,16,maxx,31);
  508.     fillview(0);
  509.     sprintf(buf,"mousestatus(xloc,yloc,mbuts);");
  510.     drwstring(1,7,0,buf,10,16);
  511.     mouseshow();
  512.     setview(0,32,maxx,maxy);
  513.     beep();
  514.     while(!kbhit()) {
  515.         lb = cb = rb = 0;
  516.         mousestatus(&x,&y,&mbuts);
  517.         if (mbuts & 1)
  518.             lb = 1;
  519.         if (mbuts & 2)
  520.             rb = 1;
  521.         if (mbuts & 4)
  522.             cb = 1;
  523.         sprintf(buf,"X= %4d  Y= %4d  LB= %1d  CB= %1d  RB= %1d",x,y,lb,cb,rb);
  524.         drwstring(1,15,8,buf,10,32);
  525.     }
  526.     ret = (char)getch();
  527.     if ( (ret == 'Q') || (ret == 'q') )
  528.         endit = 1;
  529.     if (ret == 'Q')
  530.         ret = 'q';
  531.     if (ret == 'S')
  532.         ret = 's';
  533.     if ((ret=='s') || (ret=='q')) {
  534.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  535.         fillscreen(0);
  536.         setview(0,0,maxx,maxy);
  537.         return(ret);
  538.     }
  539.  
  540.     /*
  541.      * Show mousehide
  542.      */
  543.     mousehide();
  544.     setview(0,16,maxx,31);
  545.     fillview(0);
  546.     sprintf(buf,"mousehide(xloc,yloc,mbuts);");
  547.     drwstring(1,7,0,buf,10,16);
  548.     setview(0,32,maxx,maxy);
  549.     beep();
  550.     while(!kbhit()) {
  551.         lb = cb = rb = 0;
  552.         mousestatus(&x,&y,&mbuts);
  553.         if (mbuts & 1)
  554.             lb = 1;
  555.         if (mbuts & 2)
  556.             rb = 1;
  557.         if (mbuts & 4)
  558.             cb = 1;
  559.         sprintf(buf,"X= %4d  Y= %4d  LB= %1d  CB= %1d  RB= %1d",x,y,lb,cb,rb);
  560.         drwstring(1,15,8,buf,10,32);
  561.     }
  562.     ret = (char)getch();
  563.     if ( (ret == 'Q') || (ret == 'q') )
  564.         endit = 1;
  565.     if (ret == 'Q')
  566.         ret = 'q';
  567.     if (ret == 'S')
  568.         ret = 's';
  569.     if ((ret=='s') || (ret=='q')) {
  570.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  571.         fillscreen(0);
  572.         setview(0,0,maxx,maxy);
  573.         return(ret);
  574.     }
  575.  
  576.     /*
  577.      * Show mouserangeset
  578.      */
  579.     mousehide();
  580.     setview(0,16,maxx,maxy);
  581.     fillview(0);
  582.     sprintf(buf,"mouserangeset(x1,y1,x2,y2);");
  583.     drwstring(1,7,0,buf,10,16);
  584.     setview(0,32,maxx,maxy);
  585.     spcing = (maxy - 32) / 3;
  586.     x1 = spcing;
  587.     y1 = 32 + spcing;
  588.     x2 = maxx - spcing;
  589.     y2 = maxy - spcing;
  590.     drwbox(1,15,x1,y1,x2,y2);
  591.     mouseshow();
  592.     mouserangeset(x1,y1,x2,y2);
  593.     ret = getkey();
  594.     mouserangeset(0,0,maxx,maxy);
  595.     if ((ret=='s') || (ret=='q')) {
  596.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  597.         fillscreen(0);
  598.         setview(0,0,maxx,maxy);
  599.         return(ret);
  600.     }
  601.  
  602.     /*
  603.      * Show mousecursorset - use the magnifier
  604.      */
  605.     setview(0,16,maxx,31);
  606.     fillview(0);
  607.     sprintf(buf,"mousecursorset(mousecursor);");
  608.     drwstring(1,7,0,buf,10,16);
  609.     setview(0,32,maxx,maxy);
  610.     mousecursorset(&magmousecursor);
  611.     ret = getkey();
  612.     if ((ret=='s') || (ret=='q')) {
  613.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  614.         fillscreen(0);
  615.         setview(0,0,maxx,maxy);
  616.         return(ret);
  617.     }
  618.  
  619.     /*
  620.      * Show mousecursorset - use the big arrow
  621.      */
  622.     setview(0,32,maxx,maxy);
  623.     mousecursorset(&bigmousecursor);
  624.     ret = getkey();
  625.     if ((ret=='s') || (ret=='q')) {
  626.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  627.         fillscreen(0);
  628.         setview(0,0,maxx,maxy);
  629.         return(ret);
  630.     }
  631.  
  632.     /*
  633.      * Show mousecursorset - use the stopwatch
  634.      */
  635.     setview(0,32,maxx,maxy);
  636.     mousecursorset(&stwmousecursor);
  637.     ret = getkey();
  638.     if ((ret=='s') || (ret=='q')) {
  639.         mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  640.         fillscreen(0);
  641.         setview(0,0,maxx,maxy);
  642.         return(ret);
  643.     }
  644.  
  645.     /*
  646.      * Show mousecursordefault
  647.      */
  648.     mousehide();
  649.     setview(0,16,maxx,31);
  650.     fillview(0);
  651.     sprintf(buf,"mousecursordefault();");
  652.     drwstring(1,7,0,buf,10,16);
  653.     mouseshow();
  654.     setview(0,32,maxx,maxy);
  655.     mousecursordefault();
  656.     ret = getkey();
  657.     mouseexit(); /* MUST BE CALLED TO DISABLE MOUSE FUNCTIONS */
  658.     fillscreen(0);
  659.     setview(0,0,maxx,maxy);
  660.  
  661.     return(ret);
  662.  
  663. }
  664.  
  665.  
  666. /*********
  667.  * DOGIF *
  668.  *********/
  669.  
  670. char dogif(void)
  671. {
  672.     
  673.     int endthis;
  674.     int ext, length;
  675.     char c, ret;
  676.     char title[TITLEN];
  677.     char buf[TITLEN];
  678.     char *fname;
  679.  
  680.     fname=malloc(128);
  681.  
  682.     /*
  683.      * Setup the title
  684.      */
  685.     sprintf(title,"DEMO 8: GIF functions");
  686.  
  687.     /*
  688.      * Show gifgetinfo
  689.      */
  690.     setview(0,0,maxx,maxy);
  691.     fillscreen(0);
  692.     drwstring(1,7,0,title,10,0);
  693.     endthis = 0;
  694.     ret = '\0';
  695.  
  696.     while (!endthis) {
  697.         sprintf(buf,"Please provide the name (and full path if not in the current drive/directory)");
  698.         drwstring(1,7,0,buf,10,64);
  699.         sprintf(buf,"of a GIF file you would like to see...");
  700.         drwstring(1,7,0,buf,10,80);
  701.         sprintf(buf,"Filename:");
  702.         drwstring(1,7,0,buf,10,96);
  703.  
  704.         sprintf(fname,"_");
  705.         length = 0;
  706.         ext = 0;
  707.         c = '\0';
  708.  
  709.         while(!ext) {
  710.             drwstring(1,7,0,fname,82,96);
  711.             c = (char)getch();
  712.             if(c>=' ' && c<='~') {
  713.                 fname[length] = c;
  714.                 fname[length+1] = '_';
  715.                 fname[length+2] = '\0';
  716.                 length++;
  717.             }
  718.             else
  719.                 if (c==8 && length>0) {
  720.                     drwstring(1,15,0,"   ",82+length*8,96);
  721.                     length--;
  722.                     fname[length] = '_';
  723.                     fname[length+1] = '\0';
  724.                 }
  725.                 else
  726.                     if (c==13)
  727.                         ext = 1;
  728.         }
  729.         if (length==0) {
  730.             free(fname);
  731.             return(ret);
  732.         }
  733.  
  734.         fname[length] = '\0';
  735.  
  736.         ret = showgif(fname);
  737.  
  738.         if ((ret=='s') || (ret=='q')) {
  739.             fillscreen(0);
  740.             free(fname);
  741.             return(ret);
  742.         }
  743.  
  744.         drwstring(1,7,0,title,10,0);
  745.         sprintf(buf,"Would you like to see another (Y/N) ?");
  746.         drwstring(1,7,0,buf,10,64);
  747.         ext = 0;
  748.         while(!ext) {
  749.             c=(char)getch();
  750.             if ((c=='n') || (c=='N')) {
  751.                 ext = 1;
  752.                 endthis = 1;
  753.             }
  754.             else
  755.                 if ((c=='y') || (c=='Y'))
  756.                     ext = 1;
  757.         }
  758.     }
  759.     fillscreen(0);
  760.  
  761.     free(fname);
  762.     
  763.     return(ret);
  764.  
  765. }
  766.  
  767. /**************
  768.  * DOJOYSTICK *
  769.  **************/
  770.  
  771. char dojoystick(void)
  772. {
  773.     int maxxa, maxya, minxa, minya;
  774.     int maxxb, maxyb, minxb, minyb;
  775.     int jax, jay, jabuts, jbx, jby, jbbuts;
  776.     int joystick, spcing, dist;
  777.     int x1, y1, x2, y2, x3, y3, x4, y4;
  778.     int cntax, cntay, cntbx, cntby;
  779.     int rangexa, rangeya, rangexb, rangeyb;
  780.     int jabax, jabay, jabbx, jabby;
  781.     int jbbax, jbbay, jbbbx, jbbby;
  782.     int oax, oay, obx, oby;
  783.     char ret;
  784.     char title[TITLEN];
  785.     char buf[TITLEN];
  786.  
  787.     oax = oay = obx = oby = 0;
  788.  
  789.     /*
  790.      * Set up the title
  791.      */
  792.     sprintf(title,"DEMO 10: Joystick functions");
  793.     palset(pal,0,255);
  794.     fillscreen(0);
  795.     setview(0,0,maxx,maxy);
  796.     drwstring(1,7,0,title,10,0);
  797.  
  798.     /*
  799.      * Check to see if we have a joystick so we can do the joystick demo
  800.      */
  801.     joystick = whichjoystick();
  802.     if (joystick < 1) {
  803.         sprintf(buf,"Sorry, no joystick detected... Can not do the joystick demo.");
  804.         drwstring(1,7,0,buf,10,16);
  805.         ret = getkey();
  806.         fillscreen(0);
  807.         return(ret);
  808.     }
  809.  
  810.     /*
  811.      * Show joystickinfo (here we do some joystick calibration
  812.      */
  813.     sprintf(buf,"joystickinfo(jax,jay,jabuts,jbx,jby,jbbuts);");
  814.     drwstring(1,7,0,buf,10,16);
  815.     switch(joystick) {
  816.         case 1:
  817.             sprintf(buf,"Please move Joystick A as far as it will go in all directions.");
  818.             break;
  819.         case 2:
  820.             sprintf(buf,"Please move Joystick B as far as it will go in all directions.");
  821.             break;
  822.         case 3:
  823.             sprintf(buf,"Please move Joystick A and B as far as they will go in all directions.");
  824.             break;
  825.     }
  826.     drwstring(1,7,0,buf,10,32);
  827.     drwstring(1,7,0,"And then press a key...",10,48);
  828.  
  829.     maxxa = -1;
  830.     maxya = -1;
  831.     minxa = 10000;
  832.     minya = 10000;
  833.     maxxb = -1;
  834.     maxyb = -1;
  835.     minxb = 10000;
  836.     minyb = 10000;
  837.     do {
  838.         while(!kbhit()) {
  839.             joystickinfo(&jax,&jay,&jabuts,&jbx,&jby,&jbbuts);
  840.             if (joystick & 1) {
  841.                 if (jax>maxxa)
  842.                     maxxa = jax;
  843.                 if (jax<minxa)
  844.                     minxa = jax;
  845.                 if (jay>maxya)
  846.                     maxya = jay;
  847.                 if (jay<minya)
  848.                     minya = jay;
  849.             }
  850.             if (joystick & 2) {
  851.                 if (jbx>maxxb)
  852.                     maxxb = jbx;
  853.                 if (jbx<minxb)
  854.                     minxb = jbx;
  855.                 if (jby>maxyb)
  856.                     maxyb = jby;
  857.                 if (jby<minyb)
  858.                     minyb = jby;
  859.             }
  860.         }
  861.         ret = getkey();
  862.     } while ( ((joystick & 1) && ((maxxa==minxa) || (maxya==minya))) || 
  863.         ((joystick & 2) && ((maxxb==minxb) || (maxyb==minyb))) );
  864.  
  865.     if ((ret=='s') || (ret=='q')) {
  866.         setview(0,0,maxx,maxy);
  867.         fillscreen(0);
  868.         return(ret);
  869.     }
  870.  
  871.     /*
  872.      * Calculate the center and stuff
  873.      */
  874.     spcing = maxx / 7;
  875.     dist = spcing * 2;
  876.     x1 = spcing / 2;
  877.     y1 = spcing / 2 + 32;
  878.     x2 = x1 + dist;
  879.     y2 = y1 + dist;
  880.     x4 = maxx - spcing;
  881.     y4 = y2;
  882.     x3 = x4 - dist;
  883.     y3 = y1;
  884.     cntax = (x2 - x1) / 2 + x1;
  885.     cntay = (y2 - y1) / 2 + y1;
  886.     cntbx = (x4 - x3) / 2 + x3;
  887.     cntby = (y4 - y3) / 2 + y3;
  888.     rangexa = maxxa - minxa;
  889.     rangeya = maxya - minya;
  890.     rangexb = maxxb - minxb;
  891.     rangeyb = maxyb - minyb;
  892.     jabax = (x2 - x1) / 4 + x1 - 16;
  893.     jabay = spcing / 4 + y2 - 6;
  894.     jabbx = x2 - (x2 - x1) / 4 - 16;
  895.     jabby = spcing / 4 + y2 - 6;
  896.     jbbax = (x4 - x3) / 4 + x3 - 16;
  897.     jbbay = spcing / 4 + y4 - 6;
  898.     jbbbx = x4 - (x4 - x3) / 4 - 16;
  899.     jbbby = spcing / 4 + y4 - 6;
  900.  
  901.     /*
  902.      * Let's move it (or them) around
  903.      */
  904.     setview(0,32,maxx,maxy);
  905.     fillview(0);
  906.     drwstring(1,7,0,"Joysticks are nonlinear devices and may not appear centered.",10,32);
  907.  
  908.     if (joystick & 1) {
  909.         drwbox(1,15,x1-1,y1-1,x2+1,y2+1);
  910.         drwbox(1,15,x1-1,y2+1,x2+1,y2+spcing/2);
  911.         drwline(1,15,(x2-x1)/2+x1,y2+1,(x2-x1)/2+x1,y2+spcing/2);
  912.         oax = cntax;
  913.         oay = cntay;
  914.         drwline(1,10,cntax,cntay,oax,oay);
  915.     }
  916.     else {
  917.         drwbox(1,8,x1-1,y1-1,x2+1,y2+1);
  918.         drwbox(1,8,x1-1,y2+1,x2+1,y2+spcing/2);
  919.         drwline(1,8,(x2-x1)/2+x1,y2+1,(x2-x1)/2+x1,y2+spcing/2);
  920.     }
  921.     if (joystick & 2) {
  922.         drwbox(1,15,x3-1,y3-1,x4+1,y4+1);
  923.         drwbox(1,15,x3-1,y4+1,x4+1,y4+spcing/2);
  924.         drwline(1,15,(x4-x3)/2+x3,y4+1,(x4-x3)/2+x3,y4+spcing/2);
  925.         obx = cntbx;
  926.         oby = cntby;
  927.         drwline(1,10,cntbx,cntby,obx,oby);
  928.     }
  929.     else {
  930.         drwbox(1,8,x3-1,y3-1,x4+1,y4+1);
  931.         drwbox(1,8,x3-1,y4+1,x4+1,y4+spcing/2);
  932.         drwline(1,8,(x4-x3)/2+x3,y4+1,(x4-x3)/2+x3,y4+spcing/2);
  933.     }
  934.     while(!kbhit()) {
  935.         joystickinfo(&jax,&jay,&jabuts,&jbx,&jby,&jbbuts);
  936.         if (joystick & 1) {
  937.             setview(x1,y1,x2,y2);
  938.             jax = jax - minxa;
  939.             jax = jax * dist / rangexa + x1;
  940.             jay = jay - minya;
  941.             jay = jay * dist / rangeya + y1;
  942.             drwline(1,0,cntax,cntay,oax,oay);
  943.             oax = jax;
  944.             oay = jay;
  945.             drwline(1,10,cntax,cntay,oax,oay);
  946.             setview(0,0,maxx,maxy);
  947.             sprintf(buf,"ButA");
  948.             if (jabuts & 1)
  949.                 drwstring(1,10,0,buf,jabax,jabay);
  950.             else
  951.                 drwstring(1,8,0,buf,jabax,jabay);
  952.             sprintf(buf,"ButB");
  953.             if (jabuts & 2)
  954.                 drwstring(1,10,0,buf,jabbx,jabby);
  955.             else
  956.                 drwstring(1,8,0,buf,jabbx,jabby);
  957.         }
  958.         if (joystick & 2) {
  959.             setview(x3,y3,x4,y4);
  960.             jbx = jbx - minxb;
  961.             jbx = jbx * dist / rangexb + x3;
  962.             jby = jby - minyb;
  963.             jby = jby * dist / rangeyb + y3;
  964.             drwline(1,0,cntbx,cntby,obx,oby);
  965.             obx = jbx;
  966.             oby = jby;
  967.             drwline(1,10,cntbx,cntby,obx,oby);
  968.             setview(0,0,maxx,maxy);
  969.             sprintf(buf,"ButA");
  970.             if (jbbuts & 1)
  971.                 drwstring(1,10,0,buf,jbbax,jbbay);
  972.             else
  973.                 drwstring(1,8,0,buf,jbbax,jbbay);
  974.             sprintf(buf,"ButB");
  975.             if (jbbuts & 2)
  976.                 drwstring(1,10,0,buf,jbbbx,jbbby);
  977.             else
  978.                 drwstring(1,8,0,buf,jbbbx,jbbby);
  979.         }
  980.     }
  981.     ret = getkey();
  982.     fillscreen(0);
  983.     setview(0,0,maxx,maxy);
  984.     return(ret);
  985. }
  986.  
  987.  
  988. /***********
  989.  * SHOWGIF *
  990.  ***********/
  991.  
  992. char showgif(char fname[])
  993. {
  994.     int i, ok;
  995.     int min, max, mincolor, maxcolor;
  996.     int xsize, ysize, numcol;
  997.     int xloc, yloc;
  998.     int fixit, t;
  999.     PaletteData gifpal;
  1000.     char ret;
  1001.     char *buf;
  1002.  
  1003.     buf = malloc(TITLEN);
  1004.  
  1005.     mincolor = maxcolor = 0;
  1006.  
  1007.     /*
  1008.      * Show gifgetinfo
  1009.      */
  1010.     palset(orgpal,0,255);
  1011.     setview(0,0,maxx,maxy);
  1012.     fillscreen(0);
  1013.     drwstring(1,7,0,"DEMO 8: GIF functions",10,0);
  1014.     sprintf(buf,"gifgetinfo(filename,gifxsize,gifysize,numcolors,palette);");
  1015.     drwstring(1,7,0,buf,10,16);
  1016.     ok = gifgetinfo(fname,&xsize,&ysize,&numcol,gifpal);
  1017.     min = 255 * 3;
  1018.     max = 0;
  1019.     if (ok == 1) {
  1020.         /*
  1021.          * We need to check the GIF color palette entries to see if any colors
  1022.          * are greater than six bits in length as the VGA color palette
  1023.          * registers are only six bits wide.  We also look for the brightest
  1024.          * and darkest colors to use as our text and background colors.
  1025.          */
  1026.         fixit = 0;
  1027.         for(i=0;i<numcol;i++) {
  1028.             if((gifpal[i].r>63) || (gifpal[i].g>63) || (gifpal[i].b>63))
  1029.                 fixit = 1;
  1030.             t = gifpal[i].r + gifpal[i].g + gifpal[i].b;
  1031.             if(t<min) {
  1032.                 min = t;
  1033.                 mincolor = i;
  1034.             }
  1035.             if(t>max) {
  1036.                 max = t;
  1037.                 maxcolor = i;
  1038.             }
  1039.         }
  1040.         /*
  1041.          * If the GIF uses more than 6 bit color, then we shift each color entry
  1042.          * right by 2 bits.  (This reduces it to 6 bits of color.)
  1043.          */
  1044.         if (fixit)
  1045.             for(i=0;i<numcol;i++) {
  1046.                 gifpal[i].r>>=2;
  1047.                 gifpal[i].g>>=2;
  1048.                 gifpal[i].b>>=2;
  1049.             }
  1050.         /*
  1051.          * If the GIF has a palette of 128 colors or less, then we can use
  1052.          * our own colors for the text and background.
  1053.          */
  1054.         if (numcol<=128) {
  1055.             gifpal[254].r = gifpal[254].g = gifpal[254].b = 0;
  1056.             mincolor = 254;
  1057.             gifpal[255].r = gifpal[255].g = gifpal[255].b = 32;
  1058.             maxcolor = 255;
  1059.         }
  1060.  
  1061.         sprintf(buf,"'%s' is identified as a 'Non-interlaced' type 'GIF87a' GIF image.",fname);
  1062.         drwstring(1,15,0,buf,10,64);
  1063.         sprintf(buf,"Dimensions are: %d pixels wide and %d pixels high.",xsize,ysize);
  1064.         drwstring(1,15,0,buf,10,80);
  1065.         sprintf(buf,"Number of colors: %d.",numcol);
  1066.         drwstring(1,15,0,buf,10,96);
  1067.  
  1068.         ret = getkey();
  1069.         if ((ret=='s') || (ret=='q')) {
  1070.             fillscreen(0);
  1071.             setview(0,0,maxx,maxy);
  1072.             palset(orgpal,0,255);
  1073.             free(buf);
  1074.             return(ret);
  1075.         }
  1076.  
  1077.         /*
  1078.          * Show gifput
  1079.          */
  1080.         palset(gifpal,0,255);
  1081.         overscanset(mincolor);
  1082.         fillscreen(mincolor);
  1083.         drwstring(1,maxcolor,mincolor,"DEMO 8: GIF functions",10,0);
  1084.         sprintf(buf,"gifput(mode,x,y,filename);");
  1085.         drwstring(1,maxcolor,mincolor,buf,10,16);
  1086.         setview(0,32,maxx,maxy);
  1087.         xloc = maxx / 2 - xsize / 2;
  1088.         yloc = (maxy - 32) / 2 - ysize / 2 + 32;
  1089.         ok = gifput(1,xloc,yloc,fname);
  1090.         if (ok!=1) {
  1091.             palset(orgpal,0,255);
  1092.             sprintf(buf,"The file '%s'",fname);
  1093.             switch (ok) {
  1094.                 case 0:
  1095.                     strcat(buf," does not exist in the specified directory.");
  1096.                     break;
  1097.                 case -1:
  1098.                     strcat(buf," does not have the 'GIF87a' signature.");
  1099.                     break;
  1100.                 case -2:
  1101.                     strcat(buf," is an interlaced GIF.");
  1102.                     break;
  1103.                 case -3:
  1104.                     strcat(buf," does not use a global color map.");
  1105.                     break;
  1106.                 default: /* should have a value of -4 */
  1107.                     strcat(buf," has some general error.");
  1108.             }
  1109.             drwstring(1,15,0,buf,10,64);
  1110.         }
  1111.     }
  1112.     else {
  1113.         palset(orgpal,0,255);
  1114.         sprintf(buf,"The file '%s'",fname);
  1115.         switch (ok) {
  1116.             case 0:
  1117.                 strcat(buf," does not exist in the specified directory.");
  1118.                 break;
  1119.             case -1:
  1120.                 strcat(buf," does not have the 'GIF87a' signature.");
  1121.                 break;
  1122.             case -2:
  1123.                 strcat(buf," is an interlaced GIF.");
  1124.                 break;
  1125.             case -3:
  1126.                 strcat(buf," does not use a global color map.");
  1127.                 break;
  1128.             default: /* should have a value of -4 */
  1129.                 strcat(buf," has some general error.");
  1130.         }
  1131.         drwstring(1,15,0,buf,10,64);
  1132.     }
  1133.  
  1134.     ret = getkey();
  1135.  
  1136.     palset(orgpal,0,255);
  1137.     overscanset(0);
  1138.     fillscreen(0);
  1139.     setview(0,0,maxx,maxy);
  1140.     free(buf);
  1141.     return(ret);
  1142. }
  1143.  
  1144.  
  1145. /*************
  1146.  * SHOWHOUSE *
  1147.  *************/
  1148.  
  1149. void showhouse(D2Point *plotarray, D2Point *oplotarray)
  1150. {
  1151.     int i;
  1152.  
  1153.     /* Erase old axes */
  1154.     drwline(1,0,(oplotarray+10)->x,(oplotarray+10)->y,(oplotarray+11)->x,(oplotarray+11)->y);
  1155.     drwline(1,0,(oplotarray+10)->x,(oplotarray+10)->y,(oplotarray+12)->x,(oplotarray+12)->y);
  1156.     drwline(1,0,(oplotarray+10)->x,(oplotarray+10)->y,(oplotarray+13)->x,(oplotarray+13)->y);
  1157.     
  1158.     /* Erase old house */
  1159.     for(i=0;i<3;i++) {
  1160.         drwline(1,0,(oplotarray+i)->x,(oplotarray+i)->y,(oplotarray+i+1)->x,(oplotarray+i+1)->y);
  1161.         drwline(1,0,(oplotarray+i+4)->x,(oplotarray+i+4)->y,(oplotarray+i+4+1)->x,(oplotarray+i+4+1)->y);
  1162.         drwline(1,0,(oplotarray+i)->x,(oplotarray+i)->y,(oplotarray+i+4)->x,(oplotarray+i+4)->y);
  1163.     }
  1164.     drwline(1,0,(oplotarray+3)->x,(oplotarray+3)->y,(oplotarray+7)->x,(oplotarray+7)->y);
  1165.     drwline(1,0,(oplotarray+0)->x,(oplotarray+0)->y,(oplotarray+3)->x,(oplotarray+3)->y);
  1166.     drwline(1,0,(oplotarray+4)->x,(oplotarray+4)->y,(oplotarray+7)->x,(oplotarray+7)->y);
  1167.     drwline(1,0,(oplotarray+3)->x,(oplotarray+3)->y,(oplotarray+8)->x,(oplotarray+8)->y);
  1168.     drwline(1,0,(oplotarray+8)->x,(oplotarray+8)->y,(oplotarray+2)->x,(oplotarray+2)->y);
  1169.     drwline(1,0,(oplotarray+9)->x,(oplotarray+9)->y,(oplotarray+7)->x,(oplotarray+7)->y);
  1170.     drwline(1,0,(oplotarray+9)->x,(oplotarray+9)->y,(oplotarray+6)->x,(oplotarray+6)->y);
  1171.     drwline(1,0,(oplotarray+8)->x,(oplotarray+8)->y,(oplotarray+9)->x,(oplotarray+9)->y);
  1172.  
  1173.     /* Draw new axes */
  1174.     drwline(1,8,(plotarray+10)->x,(plotarray+10)->y,(plotarray+11)->x,(plotarray+11)->y);
  1175.     drwline(1,8,(plotarray+10)->x,(plotarray+10)->y,(plotarray+12)->x,(plotarray+12)->y);
  1176.     drwline(1,8,(plotarray+10)->x,(plotarray+10)->y,(plotarray+13)->x,(plotarray+13)->y);
  1177.     
  1178.     /* Draw new house */
  1179.     for(i=0;i<3;i++) {
  1180.         drwline(1,10,(plotarray+i)->x,(plotarray+i)->y,(plotarray+i+1)->x,(plotarray+i+1)->y);
  1181.         drwline(1,10,(plotarray+i+4)->x,(plotarray+i+4)->y,(plotarray+i+4+1)->x,(plotarray+i+4+1)->y);
  1182.         drwline(1,10,(plotarray+i)->x,(plotarray+i)->y,(plotarray+i+4)->x,(plotarray+i+4)->y);
  1183.     }
  1184.     drwline(1,10,(plotarray+3)->x,(plotarray+3)->y,(plotarray+7)->x,(plotarray+7)->y);
  1185.     drwline(1,10,(plotarray+0)->x,(plotarray+0)->y,(plotarray+3)->x,(plotarray+3)->y);
  1186.     drwline(1,10,(plotarray+4)->x,(plotarray+4)->y,(plotarray+7)->x,(plotarray+7)->y);
  1187.     drwline(1,10,(plotarray+3)->x,(plotarray+3)->y,(plotarray+8)->x,(plotarray+8)->y);
  1188.     drwline(1,10,(plotarray+8)->x,(plotarray+8)->y,(plotarray+2)->x,(plotarray+2)->y);
  1189.     drwline(1,10,(plotarray+9)->x,(plotarray+9)->y,(plotarray+7)->x,(plotarray+7)->y);
  1190.     drwline(1,10,(plotarray+9)->x,(plotarray+9)->y,(plotarray+6)->x,(plotarray+6)->y);
  1191.     drwline(1,10,(plotarray+8)->x,(plotarray+8)->y,(plotarray+9)->x,(plotarray+9)->y);
  1192.  
  1193.     /* Save old points */
  1194.     bytecopy(plotarray,oplotarray,14*sizeof(*plotarray));
  1195.  
  1196.     return;
  1197. }
  1198.  
  1199. /************
  1200.  * SHOWSTAR *
  1201.  ************/
  1202.  
  1203. void showstar(D2Point *plotarray, D2Point *oplotarray)
  1204. {
  1205.     int i;
  1206.  
  1207.     for(i=0;i<8;i++)
  1208.         drwline(1,0,(oplotarray+i)->x,(oplotarray+i)->y,((oplotarray+i)+1)->x,((oplotarray+i)+1)->y);
  1209.     for(i=0;i<8;i++)
  1210.         drwline(1,10,(plotarray+i)->x,(plotarray+i)->y,((plotarray+i)+1)->x,((plotarray+i)+1)->y);
  1211.     bytecopy(plotarray,oplotarray,9*sizeof(*plotarray));
  1212.     return;
  1213. }
  1214.