home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 431.lha / Yawn! / Yawn!.c < prev    next >
C/C++ Source or Header  |  1990-11-10  |  16KB  |  385 lines

  1. /***************************************************************************
  2.  *                                       *
  3.  *                       YAWN!                     *
  4.  *                                       *
  5.  *     A little bit of diversion during endless compilation times...       *
  6.  *                                       *
  7.  *         written by Lorenz Wiest during 24th-26th July 1990           *
  8.  *                                       *
  9.  ***************************************************************************/
  10.  
  11. #define BORDERW 10
  12. #define BORDERH 5
  13. #define TILEW   22
  14. #define TILEH   11
  15. #define TOPY    11
  16. #define TILEX   BORDERW
  17. #define TILEY   ( TOPY + BORDERH )
  18.  
  19. #include "exec/types.h"
  20. #include "exec/memory.h"
  21. #include "intuition/intuition.h"
  22. #include "graphics/gfx.h"
  23.  
  24. ULONG Copy2Chip();
  25.  
  26. struct IntuitionBase *IntuitionBase = NULL;
  27. struct GfxBase       *GfxBase       = NULL;
  28. struct IntuiMessage  *Nachricht     = NULL;
  29. struct Window        *Window        = NULL;
  30. struct Remember      *MyRememberKey = NULL;
  31. struct RastPort      *WRast         = NULL;
  32.  
  33. UWORD DottedLine[]  ={0x5555,0x5555,0x5555,0x5555,0x5555,0x5555,0x5555,
  34.                       0x5555,0x5555,0x5555};
  35. UWORD ChkOffD[]     ={0xffff,0xffff,0xf80f,0xffff,0xc3e1,0xffff,0x9ffc,0xffff,
  36.                       0x3ffe,0x7fff,0x3ffe,0x7fff,0x3ffe,0x7fff,0x9ffc,0xffff,
  37.                       0xc3e1,0xffff,0xf80f,0xffff,
  38.                       0x0000,0x0000,0x07f0,0x0000,0x3c1e,0x0000,0x6003,0x0000,
  39.                       0xc001,0x8000,0xc001,0x8000,0xc001,0x8000,0x6003,0x0000,
  40.                       0x3c1e,0x0000,0x07f0,0x0000};
  41. UWORD CheckOnD[]     ={0xffff,0x0fff,0xf80c,0xf7ff,0xc3e3,0xefff,0x9dcf,0x1fff,
  42.                       0x1ebc,0x7fff,0x2f72,0x7fff,0x37ee,0x7fff,0x9bdc,0xffff,
  43.                       0xc1a1,0xffff,0xf80f,0xffff,
  44.                       0x0000,0xf000,0x07f3,0xf800,0x3c1f,0xf000,0x7e3f,0xe000,
  45.                       0xff7f,0x8000,0xdffd,0x8000,0xcff1,0x8000,0x67e3,0x0000,
  46.                       0x3fde,0x0000,0x07f0,0x0000};
  47. UWORD EuroNumbers[] ={0x87ff,0x33ff,0x23ff,0x03ff,0x13ff,0x33ff,0x87ff,
  48.                       0xcfff,0x8fff,0xcfff,0xcfff,0xcfff,0xcfff,0x03ff,        
  49.                       0x87ff,0x33ff,0xf3ff,0xc7ff,0x9fff,0x33ff,0x03ff,        
  50.                       0x87ff,0x33ff,0xf3ff,0xc7ff,0xf3ff,0x33ff,0x87ff,        
  51.                       0xe3ff,0xc3ff,0x93ff,0x33ff,0x01ff,0xf3ff,0xe1ff,        
  52.                       0x03ff,0x3fff,0x07ff,0xf3ff,0xf3ff,0x33ff,0x87ff,        
  53.                       0xc7ff,0x9fff,0x3fff,0x07ff,0x33ff,0x33ff,0x87ff,        
  54.                       0x03ff,0x33ff,0xf3ff,0xe7ff,0xcfff,0xcfff,0xcfff,        
  55.                       0x87ff,0x33ff,0x33ff,0x87ff,0x33ff,0x33ff,0x87ff,        
  56.                       0x87ff,0x33ff,0x33ff,0x83ff,0xf3ff,0xe7ff,0x8fff};
  57. UWORD HindiNumbers[]={0xffff,0x87ff,0x33ff,0x33ff,0x87ff,0xffff,0xffff,
  58.                       0x87ff,0x3bff,0x87ff,0xefff,0x9fff,0xcfff,0xe7ff,
  59.                       0x07ff,0xf3ff,0xe7ff,0x0fff,0x9fff,0xcfff,0xe3ff,
  60.                       0x07ff,0xf3ff,0x07ff,0xf3ff,0x07ff,0xcfff,0xe3ff,
  61.                       0x23ff,0x33ff,0x17ff,0x8fff,0x27ff,0x27ff,0x8fff,
  62.                       0x33ff,0x33ff,0x83ff,0xe7ff,0x0fff,0x27ff,0xf3ff,
  63.                       0x83ff,0x3fff,0x83ff,0x3fff,0x83ff,0xe7ff,0xf3ff,
  64.                       0x67ff,0x5bff,0x63ff,0x73ff,0x33ff,0x87ff,0xffff,
  65.                       0xffff,0x03ff,0x9fff,0x83ff,0xf3ff,0xffff,0xffff,
  66.                       0x8fff,0x3fff,0x0fff,0x3fff,0x1fff,0xc3ff,0xffff};
  67. UWORD ArabNumbers[] ={0xffff,0xffff,0xcfff,0x87ff,0xcfff,0xffff,0xffff,
  68.                       0xdfff,0xcfff,0xcfff,0xefff,0xefff,0xefff,0xefff,
  69.                       0x7bff,0x03ff,0x07ff,0x3fff,0xbfff,0xbfff,0xbfff,
  70.                       0x6bff,0x03ff,0x17ff,0x3fff,0xbfff,0xbfff,0xbfff,
  71.                       0x8fff,0x3fff,0x0fff,0xbfff,0x1fff,0x83ff,0xc3ff,
  72.                       0xffff,0xcfff,0xa7ff,0x73ff,0x07ff,0xffff,0xffff,
  73.                       0x07ff,0x07ff,0xf7ff,0xf3ff,0xfbff,0xfbff,0xfbff,
  74.                       0x73ff,0x73ff,0xa7ff,0xa7ff,0xa7ff,0xcfff,0xcfff,
  75.                       0xcfff,0xcfff,0xa7ff,0xa7ff,0xa7ff,0x73ff,0x73ff,
  76.                       0x8fff,0x67ff,0x87ff,0xe7ff,0xe7ff,0xf3ff,0xf3ff};
  77.  
  78. #define MTEXT ITEMTEXT|ITEMENABLED|HIGHCOMP
  79. #define MSELE CHECKIT|ITEMTEXT|ITEMENABLED|HIGHCOMP
  80. #define MGRAF ITEMENABLED|HIGHNONE
  81.  
  82. struct Image     Dots1c  = {2,0,155,1,1,NULL,1,1,NULL};
  83. struct IntuiText Text1cb = {3,1,JAM1,10,97,0,"I want to travel!",NULL    },
  84.                  Text1ca = {2,1,JAM1,12,97,0,"I want to travel!",&Text1cb},
  85.                  Text1c9 = {3,1,JAM1,50,86,0,"Copy me,"         ,&Text1ca},
  86.                  Text1c8 = {2,1,JAM1,52,86,0,"Copy me,"         ,&Text1c9},
  87.                  Text1c7 = {2,1,JAM1,27,68,0,"West Germany"     ,&Text1c8},
  88.                  Text1c6 = {2,1,JAM1,27,58,0,"7958 Laupheim"    ,&Text1c7},
  89.                  Text1c5 = {2,1,JAM1,27,48,0,"R\366ntgenweg 12" ,&Text1c6},
  90.                  Text1c4 = {2,1,JAM1,27,38,0,"Lorenz Wiest"     ,&Text1c5},
  91.                  Text1c3 = {2,1,JAM1,10,27,0,"was programmed by",&Text1c4},
  92.                  Text1c2 = {3,1,JAM1,57, 7,0,"Yawn!"            ,&Text1c3},
  93.                  Text1c1 = {2,1,JAM1,59, 7,0,"Yawn!"            ,&Text1c2};
  94. struct MenuItem  Item1c3 = {NULL    ,90,  2,1,1,MGRAF,0     ,&Dots1c,0,0,0,0},
  95.                  Item1c2 = {&Item1c3,90,-60,1,1,MGRAF,0     ,&Dots1c,0,0,0,0},
  96.                  Item1c1 = {&Item1c2,90,-80,157,107,MGRAF|ITEMTEXT,0,&Text1c1,0,0,0,0};
  97.  
  98. struct Image     CheckOn = {3,-2,21,10,2,NULL,3,0,NULL},
  99.                  ChkOff1 = {3,17,21,10,2,NULL,3,0,NULL},
  100.                  ChkOff2 = {3,28,21,10,2,NULL,3,0,&ChkOff1},
  101.                  ChkOff3 = {3,39,21,10,2,NULL,3,0,&ChkOff2},
  102.                  ChkOff4 = {3,50,21,10,2,NULL,3,0,&ChkOff3},
  103.                  ChkOff5 = {3,67,21,10,2,NULL,3,0,&ChkOff4},
  104.                  ChkOff6 = {3,78,21,10,2,NULL,3,0,&ChkOff5},
  105.                  ChkOff7 = {3,89,21,10,2,NULL,3,0,&ChkOff6},  
  106.                  Dots1  = {0,2,100 ,1,1,NULL,1,1,NULL};
  107. struct IntuiText Text1c = {2,1,JAM1,27,2,0,"About"   ,0},
  108.                  Text1a = {2,1,JAM1,27,2,0,"Hindi"   ,0},
  109.                  Text19 = {2,1,JAM1,27,2,0,"Arabic"  ,0},
  110.                  Text18 = {2,1,JAM1,27,2,0,"European",0},
  111.                  Text16 = {2,1,JAM1,27,2,0,"7 x 7"   ,0},
  112.                  Text15 = {2,1,JAM1,27,2,0,"6 x 6"   ,0},
  113.                  Text14 = {2,1,JAM1,27,2,0,"5 x 5"   ,0},
  114.                  Text13 = {2,1,JAM1,27,2,0,"4 x 4"   ,0},
  115.                  Text11 = {2,1,JAM1,27,2,0,"New"     ,0};
  116. struct MenuItem  Item1c = {NULL   ,0,106,100,11,MTEXT,0      ,&Text1c,0,0,&Item1c1,0},
  117.                  Item1b = {&Item1c,0,100,100, 2,MGRAF,0      ,&Dots1 ,0,0,0,0},
  118.                  Item1a = {&Item1b,0, 89,100,11,MSELE,0x300  ,&Text1a,0,0,0,0},
  119.                  Item19 = {&Item1a,0, 78,100,11,MSELE,0x500  ,&Text19,0,0,0,0},
  120.                  Item18 = {&Item19,0, 67,100,11,MSELE|CHECKED,0x600 ,&Text18,0,0,0,0},
  121.                  Item17 = {&Item18,0, 61,100, 2,MGRAF,0      ,&Dots1 ,0,0,0,0},
  122.                  Item16 = {&Item17,0, 50,100,11,MSELE,0x38   ,&Text16,0,0,0,0},
  123.                  Item15 = {&Item16,0, 39,100,11,MSELE,0x58   ,&Text15,0,0,0,0},
  124.                  Item14 = {&Item15,0, 28,100,11,MSELE|CHECKED,0x68  ,&Text14,0,0,0,0},
  125.                  Item13 = {&Item14,0, 17,100,11,MSELE,0x70   ,&Text13,0,0,0,0},
  126.                  Item12 = {&Item13,0, 11,100, 2,MGRAF,0      ,&Dots1 ,0,0,0,0},
  127.                  Item11 = {&Item12,0,  1,100,11,MTEXT,0      ,&Text11,0,0,0,0},
  128.                  Item10 = {&Item11,0,  0,  1, 2,HIGHNONE,0   ,&ChkOff7 ,0,0,0,0};   
  129. struct Menu      Menu1  = {NULL,10,0,65,0,MENUENABLED,"Options",&Item10};
  130. struct NewWindow NewWindow = { 30,30,100,50,2,1,
  131.                                NEWSIZE|CLOSEWINDOW|MENUPICK|MOUSEBUTTONS,
  132.                                BORDERLESS|WINDOWDEPTH|WINDOWDRAG|WINDOWCLOSE|ACTIVATE,
  133.                                0,&CheckOn,(UBYTE *)"Yawn!",0,0,0,0,0,0,WBENCHSCREEN };
  134.  
  135. int Reihe=5, Weite, Hoehe, Squared, Blank;
  136. int Tile[50];
  137. UWORD *European=NULL, *Hindi=NULL, *Arabic=NULL, *CurrentCountry=NULL;
  138.  
  139. main()
  140.  {
  141.   ULONG  NachArt;
  142.   USHORT Code;
  143.   SHORT  MausX, MausY;
  144.  
  145.   if ((IntuitionBase=(struct IntuitionBase *)
  146.               OpenLibrary("intuition.library",0))==NULL) ByeBye();
  147.   if ((GfxBase=(struct GfxBase *)
  148.               OpenLibrary("graphics.library",0))==NULL)  ByeBye();
  149.  
  150.   Dots1.ImageData   = Dots1c.ImageData = Copy2Chip(10,&DottedLine[0]);
  151.  
  152.   CheckOn.ImageData  = Copy2Chip(40,&CheckOnD[0]);
  153.   ChkOff1.ImageData  = Copy2Chip(40,&ChkOffD[0]);
  154.   ChkOff2.ImageData  = ChkOff3.ImageData = ChkOff4.ImageData = ChkOff1.ImageData;
  155.   ChkOff5.ImageData  = ChkOff6.ImageData = ChkOff7.ImageData = ChkOff1.ImageData; 
  156.  
  157.   European = Copy2Chip(70,&EuroNumbers[0]);
  158.   Hindi    = Copy2Chip(70,&HindiNumbers[0]);
  159.   Arabic   = Copy2Chip(70,&ArabNumbers[0]);
  160.   CurrentCountry = European;
  161.  
  162.   if ((Window=(struct Window *)OpenWindow(&NewWindow))==NULL) ByeBye();
  163.   WRast=Window->RPort;
  164.  
  165.   ResizeBoard(Reihe);
  166.   SetMenuStrip(Window, &Menu1);
  167.  
  168.   for (;;)
  169.    {
  170.     WaitPort(Window->UserPort);
  171.     while(Nachricht=(struct IntuiMessage *)GetMsg(Window->UserPort))
  172.      {
  173.       NachArt=Nachricht->Class;
  174.       Code   =Nachricht->Code;
  175.       MausX  =Nachricht->MouseX;
  176.       MausY  =Nachricht->MouseY;
  177.       ReplyMsg(Nachricht);
  178.       switch(NachArt)
  179.        {
  180.         case NEWSIZE      : SketchBoard(); break;
  181.         case MOUSEBUTTONS : if(Code==SELECTDOWN) MoveTile(MausX,MausY); break;
  182.         case MENUPICK     : if (MENUNUM(Code)!=MENUNULL)
  183.                               Do_Menu(ITEMNUM(Code)); break;
  184.         case CLOSEWINDOW  : ByeBye(); break;
  185.        } /* end of switch */
  186.      }  /* end of if */
  187.    }   /* end of for */
  188.  }    /* end of main */
  189.  
  190. Do_Menu(Item)
  191.  int Item;
  192.  {
  193.   int NewReihe;
  194.   UWORD *NewCountry;
  195.  
  196.   if(Item==1) SketchBoard();
  197.    
  198.   NewReihe=4;
  199.   if(Item14.Flags&CHECKED) NewReihe=5;
  200.   if(Item15.Flags&CHECKED) NewReihe=6;
  201.   if(Item16.Flags&CHECKED) NewReihe=7;
  202.  
  203.   NewCountry=European;
  204.   if(Item19.Flags&CHECKED) NewCountry=Arabic;
  205.   if(Item1a.Flags&CHECKED) NewCountry=Hindi;
  206.  
  207.   if(NewReihe!=Reihe) ResizeBoard(NewReihe);
  208.   if(NewCountry!=CurrentCountry) LabelBoard(NewCountry);
  209.  }
  210.  
  211. BlitTile(x1,y1,x2,y2)
  212.  int x1,y1,x2,y2;
  213.  {
  214.   int Index1, Index2;
  215.   Index1= (x1-BORDERW) / TILEW + (y1-BORDERH-TOPY) / TILEH * Reihe + 1;
  216.   Index2= (x2-BORDERW) / TILEW + (y2-BORDERH-TOPY) / TILEH * Reihe + 1;
  217.   Tile[Index2]=Tile[Index1];
  218.   Tile[Index1]=Squared;
  219.   ClipBlit(WRast, x1, y1, WRast, x2, y2, TILEW, TILEH, 0xe0 );
  220.   ClipBlit(WRast, x1, y1, WRast, x1, y1, TILEW, TILEH, 0x00 );
  221.  }
  222.  
  223. MoveTile(MausX, MausY)
  224.  SHORT MausX, MausY;
  225.  {
  226.   register int i;
  227.   int BoardX, BoardY, BlankX, BlankY;
  228.   int BoardTileX, BoardTileY, BlankTileX, BlankTileY;
  229.  
  230.   if( (MausX>=BORDERW) && (MausX<Weite-BORDERW)
  231.         && (MausY>TOPY+BORDERH) && (MausY<Hoehe-BORDERH) )
  232.    {
  233.     BoardX = (MausX     -BORDERW) / TILEW;
  234.     BoardY = (MausY-TOPY-BORDERH) / TILEH;
  235.     BlankX = (Blank-1) % Reihe;
  236.     BlankY = (Blank-1) / Reihe;
  237.  
  238.     if(((BlankX==BoardX)+(BlankY==BoardY))==1)
  239.      {
  240.       BlankTileX =        BORDERW + BlankX*TILEW;
  241.       BlankTileY = TOPY + BORDERH + BlankY*TILEH;
  242.       BoardTileX =        BORDERW + BoardX*TILEW;
  243.       BoardTileY = TOPY + BORDERH + BoardY*TILEH;
  244.  
  245.       if(BoardX==BlankX)
  246.         if(BoardY>BlankY)                                        /*** UP  ***/
  247.           for(i=BlankTileY+TILEH; i<=BoardTileY; i=i+TILEH)
  248.              BlitTile(BlankTileX,i ,BlankTileX, i-TILEH);
  249.         else                                                    /*** DOWN ***/
  250.           for(i=BlankTileY-TILEH; i>=BoardTileY; i=i-TILEH)
  251.              BlitTile(BlankTileX, i, BlankTileX, i+TILEH);
  252.       else if(BoardY==BlankY)
  253.         if(BoardX>BlankX)                                       /*** LEFT ***/
  254.           for(i=BlankTileX+TILEW; i<=BoardTileX; i=i+TILEW)
  255.              BlitTile(i, BlankTileY, i-TILEW, BlankTileY);
  256.         else                                                   /*** RIGHT ***/
  257.           for(i=BlankTileX-TILEW; i>=BoardTileX; i=i-TILEW)
  258.              BlitTile(i, BlankTileY, i+TILEW, BlankTileY);
  259.       Blank = (BoardX + BoardY * Reihe ) + 1 ;
  260.      }
  261.    }
  262.  }
  263.  
  264. ResizeBoard(NewReihe)
  265.  int NewReihe;
  266.  {
  267.   int dx, dy;
  268.  
  269.   Reihe   = NewReihe;
  270.   Squared = Reihe * Reihe;
  271.   Weite   = 2*BORDERW + Reihe*TILEW;
  272.   Hoehe   = 2*BORDERH + Reihe*TILEH + TOPY;
  273.  
  274.   dx = Window->WScreen->Width  - Window->LeftEdge - Weite;
  275.   dy = Window->WScreen->Height - Window->TopEdge - Hoehe;
  276.   MoveWindow(Window,(dx<0)*dx,(dy<0)*dy);
  277.   SizeWindow(Window, Weite-Window->Width, Hoehe-Window->Height);
  278.  }
  279.  
  280. SketchBoard()
  281.  {
  282.   register int i, j;
  283.  
  284.   /* J is the grid grid position, while Tile[] holds the tile label */
  285.   for(i=1; i<=Squared; i++) Tile[i]=0;     /*** here we shuffle the tiles ***/
  286.   for(i=1; i<=Squared; i++)
  287.     { do
  288.        j = ( rand()*Squared/32767 ) + 1;
  289.       while(Tile[j]!=0);
  290.       Tile[j]=i;
  291.       if(i==Squared) Blank=j; }
  292.  
  293.   BoxFill(2, 0, TOPY, Weite-1, Hoehe-1);   /**** Construct the gameboard ****/
  294.   BoxFill(0, TILEX, TILEY, Weite-BORDERW-1, Hoehe-BORDERH-1);
  295.  
  296.   SetAPen(WRast,0);                                            /* The edges */
  297.   Move(WRast,2,TOPY);
  298.   Draw(WRast,0,TOPY); Draw(WRast,0,TOPY+1);
  299.   Move(WRast,Weite-3,TOPY); 
  300.   Draw(WRast,Weite-1,TOPY); Draw(WRast,Weite-1,TOPY+1);
  301.   Move(WRast,0,Hoehe-2);
  302.   Draw(WRast,0,Hoehe-1); Draw(WRast,2,Hoehe-1);
  303.   Move(WRast,Weite-3,Hoehe-1);
  304.   Draw(WRast,Weite-1,Hoehe-1); Draw(WRast,Weite-1,Hoehe-2);
  305.  
  306.   BoxFill(3, TILEX+2, TILEY+1, TILEX+TILEW-3, TILEY+TILEH-2);/* One Tile... */
  307.   SetAPen(WRast,2);
  308.   Move(WRast,TILEX+1,TILEY);
  309.   Draw(WRast,TILEX+20,TILEY); Draw(WRast,TILEX+20,TILEY+9);
  310.   Draw(WRast,TILEX+21,TILEY+9); Draw(WRast,TILEX+21,TILEY+1);
  311.   SetAPen(WRast,1);
  312.   Move(WRast,TILEX+20,TILEY+10);
  313.   Draw(WRast,TILEX+1,TILEY+10); Draw(WRast,TILEX+1,TILEY+1);
  314.   Draw(WRast,TILEX+0,TILEY+1); Draw(WRast,TILEX+0,TILEY+9);
  315.  
  316.   for(i=1; i<Reihe; i++)
  317.     ClipBlit(WRast, TILEX, TILEY, WRast, TILEX + i*TILEW, TILEY,
  318.              TILEW, TILEH, 0xe0 );
  319.    for(j=1; j<Reihe; j++)
  320.     for(i=0; i<Reihe; i++)
  321.       ClipBlit(WRast, TILEX, TILEY, WRast, TILEX + i*TILEW, TILEY+j*TILEH,
  322.                TILEW, TILEH, 0xe0 );
  323.  
  324.   LabelBoard(CurrentCountry);
  325.  }
  326.  
  327. BoxFill(Color, X1, Y1, X2, Y2)
  328.  int Color, X1, Y1, X2, Y2;
  329.  {
  330.   SetAPen(WRast, Color);
  331.   SetBPen(WRast, Color);
  332.   RectFill(WRast, X1, Y1, X2, Y2);
  333.  }
  334.  
  335. LabelTile(Nummer, x, y)
  336.  int Nummer, x, y;
  337.  {
  338.   static struct Image Zeichen = {0,0,7,7,1,NULL,0x1,0x3,NULL};
  339.   Zeichen.LeftEdge  = x;
  340.   Zeichen.TopEdge   = y;
  341.   Zeichen.ImageData = CurrentCountry + Nummer * 7 ;
  342.   DrawImage(WRast, &Zeichen, 0, 0);
  343.  }
  344.  
  345. LabelBoard(Country)
  346.  USHORT *Country;
  347.  {
  348.   register int GridNr;
  349.   int x, y, Label;
  350.  
  351.   CurrentCountry = Country;
  352.   for(GridNr=1; GridNr<=Squared; GridNr++)
  353.     {
  354.      Label=Tile[GridNr];
  355.      x=TILEX + TILEW * ( (GridNr-1) % Reihe );
  356.      y=TILEY + TILEH * ( (GridNr-1) / Reihe );
  357.      if(Label==Squared) BoxFill(0,x,y,x+TILEW-1, y+TILEH-1);
  358.        else
  359.         { BoxFill(3,x+2,y+1,x+TILEW-3,y+TILEH-2);
  360.           if(Label<10) LabelTile(Label % 10, x+8, y+2);
  361.            else
  362.             {          LabelTile(Label / 10, x+3 , y+2);
  363.                        LabelTile(Label % 10, x+11, y+2); } }
  364.     }
  365.  }
  366.  
  367. ULONG Copy2Chip(WordCount, ArrayPnt)
  368.  int    WordCount;
  369.  UWORD *ArrayPnt;
  370.  {
  371.   UWORD *Zeiger;
  372.   Zeiger=AllocRemember(&MyRememberKey,WordCount<<1,MEMF_CHIP|MEMF_CLEAR);
  373.   CopyMem(ArrayPnt,Zeiger,WordCount<<1);
  374.   return(Zeiger);
  375.  }
  376.  
  377. ByeBye()
  378.  {
  379.   FreeRemember(&MyRememberKey, TRUE);
  380.   if(Window!=NULL)        CloseWindow(Window);
  381.   if(GfxBase!=NULL)       CloseLibrary(GfxBase);
  382.   if(IntuitionBase!=NULL) CloseLibrary(IntuitionBase);
  383.   exit(0);
  384.  }
  385.