/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved *
* |. o.| ||          Written by Doug Walker                                 *
* | .  | ||          The Software Distillery                                *
* | o  | ||          235 Trillingham Lane                                   *
* |  . |//           Cary, NC 27511                                         *
* ======             BBS:(919)-471-6436                                     *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "exec/types.h"
#include "intuition/intuition.h"

/* defines for the sprite */
#define PTR_WIDTH 16
#define PTR_HEIGHT 10
#define PTR_HOTX -8
#define PTR_HOTY 0
/***************************************************************/
/*  The following array contains the sprite colors          */
/***************************************************************/
UWORD ptr_col[] =
     { 0xfff, 0xf00, 0x000 };

/***************************************************************/
/*  The following data structures contain the sprite image  */
/***************************************************************/
USHORT From_dat[]=  {
     /*plane1  plane0 */
      0x0000,  0x0000,
      0x0000,  0x0100,
      0x0000,  0x0380,
      0x0000,  0x0540,
      0x0000,  0x0100,
      0xecea,  0x0000,
      0x8aae,  0x0000,
      0xccae,  0x0000,
      0x8aaa,  0x0000,
      0x8aea,  0x0000,
      0x0000,  0x0000,
      0x0000,  0x0000
     };

USHORT To_dat[]=  {
     /*plane1  plane0 */
      0x0000,  0x0000,
      0x0000,  0x0100,
      0x0000,  0x0380,
      0x0000,  0x0540,
      0x0000,  0x0100,
      0x0ee0,  0x0000,
      0x04a0,  0x0000,
      0x04a0,  0x0000,
      0x04a0,  0x0000,
      0x04e0,  0x0000,
      0x0000,  0x0000,
      0x0000,  0x0000
     };

/***************************************************************/
/*   The following routine will install the sprite as the   */
/*   Intuition pointer. A pointer to your current window is */
/*   needed as a parameter to this routine.                 */
/***************************************************************/
NewPtr(window, from)
struct Window *window;
int from;
{
 SHORT i;
 UWORD red,green,blue;
 struct ViewPort *vport;

/* Get the window's viewport address */
 vport = (struct ViewPort *) ViewPortAddress(window);

/* Set the colors for the sprite */
for (i=0;i<3;i++)
   {
     red = (ptr_col[i] & 0xf00) >> 8;
     green = (ptr_col[i] & 0x0f0) >> 4;
     blue  = (ptr_col[i] & 0x00f) ;
     SetRGB4(vport,17+i,red,green,blue);
   }
 /* get rid of the previous pointer */
 ClearPointer(window);
 /* and install the new one */
 SetPointer(window,
            (from ? &From_dat : &To_dat),
            PTR_HEIGHT,
            PTR_WIDTH,
            PTR_HOTX,
            PTR_HOTY);
 return(0);
 }
