home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 1: Collection A / 17Bit_Collection_A.iso / files / 223.dms / 223.adf / Source / spritedef.c < prev    next >
C/C++ Source or Header  |  1988-07-25  |  5KB  |  170 lines

  1. /*=========================================================================
  2.   SpriteDef.c - This routine installs the custom intuition pointer,
  3.   it was generated using SpriteMaker.
  4.  
  5.   Copyright (c) 1986 by Ray R. Larson
  6.   
  7.   This program may be freely distributed and copied, but may not be sold
  8.   without the permission of the author. If you modify or enhance it, 
  9.   please include the above credits (and please send me a copy!).
  10.  
  11. Ray R. Larson
  12. 6425 Central Ave. #304
  13. El Cerrito, CA 94530
  14.  
  15. BitNet  LARSON@UCBCMSA
  16. =========================================================================*/
  17. /*------------Header file for all of the standard stuff----*/ 
  18. /*-------------plus definitions of global structures-------*/
  19. #include "star.h" 
  20.  
  21.  
  22. /* defines for the sprite */
  23. #define STARSPRITE_WIDTH 16L
  24. #define STARSPRITE_HEIGHT 9L
  25. #define STARSPRITE_HOTX -4L
  26. #define STARSPRITE_HOTY -4L
  27. /***************************************************************/
  28. /*  The following array contains the sprite colors          */
  29. /***************************************************************/
  30. UWORD StarSprite_col[] =
  31.      { 0xf2f, 0x000, 0xd00 };
  32.  
  33. /***************************************************************/
  34. /*  The following data structure contains the sprite image  */
  35. /***************************************************************/
  36. USHORT StarSprite_dat[]=  {
  37.      /*plane1  plane0 */
  38.       0x0000,  0x0000,
  39.       0x0800,  0x0800,
  40.       0x4900,  0x0800,
  41.       0x2a00,  0x0800,
  42.       0x0800,  0x1c00,
  43.       0xf780,  0xf780,
  44.       0x0800,  0x1c00,
  45.       0x2a00,  0x0800,
  46.       0x4900,  0x0800,
  47.       0x0800,  0x0800,
  48.       0x0000,  0x0000
  49.      };
  50.  
  51. /***************************************************************/
  52. /*   The following routine will install the sprite as the   */
  53. /*   Intuition pointer. A pointer to your current window is */
  54. /*   needed as a parameter to this routine.                 */
  55. /***************************************************************/
  56. do_StarSprite(window)
  57. struct Window *window;
  58. {
  59.  SHORT i;
  60.  UWORD red,green,blue;
  61.  struct ViewPort *vport, *ViewPortAddress();
  62.  
  63. /* Get the window's viewport address */
  64.  vport = ViewPortAddress(window);
  65.  
  66. /* Set the colors for the sprite */
  67. for (i=0;i<3;i++)
  68.    {
  69.      red = (StarSprite_col[i] & 0xf00) >> 8;
  70.      green = (StarSprite_col[i] & 0x0f0) >> 4;
  71.      blue  = (StarSprite_col[i] & 0x00f) ;
  72.      SetRGB4(vport,(LONG)17+i,(LONG)red,(LONG)green,(LONG)blue);
  73.    }
  74.  
  75.  /* get rid of the previous pointer */
  76.  ClearPointer(window);
  77.  /* and install the new one */
  78.  SetPointer(window,
  79.             &StarSprite_dat,
  80.             STARSPRITE_HEIGHT,
  81.             STARSPRITE_WIDTH,
  82.             STARSPRITE_HOTX,
  83.             STARSPRITE_HOTY);
  84.  }
  85.  
  86.  
  87.  
  88. /* defines for the sprite */
  89. #define SNOOZE_WIDTH 16L
  90. #define SNOOZE_HEIGHT 27L
  91. #define SNOOZE_HOTX 0L
  92. #define SNOOZE_HOTY 0L
  93.  
  94. /***************************************************************/
  95. /*  The following array contains the sprite colors          */
  96. /***************************************************************/
  97. UWORD Snooze_col[] =
  98.      { 0xfff, 0x000, 0xe30 };
  99.  
  100. /***************************************************************/
  101. /*  The following data structure contains the sprite image  */
  102. /***************************************************************/
  103. USHORT Snooze_dat[]=  {
  104.      /*plane1  plane0 */
  105.       0x0000,  0x0000,
  106.       0x03f0,  0x0000,
  107.       0x0ffc,  0x0000,
  108.       0x0c3e,  0x03c0,
  109.       0x07bc,  0x0040,
  110.       0x3f7e,  0x0080,
  111.       0x7eff,  0x0100,
  112.       0xfdff,  0x0200,
  113.       0xfc3f,  0x03c0,
  114.       0xffff,  0x0000,
  115.       0x7f0e,  0x00f0,
  116.       0x3fee,  0x0010,
  117.       0x3fd8,  0x0020,
  118.       0x1fbc,  0x0040,
  119.       0x037c,  0x0080,
  120.       0x0108,  0x00f0,
  121.       0x07f0,  0x0000,
  122.       0x0ff0,  0x0000,
  123.       0x0ff8,  0x0000,
  124.       0x1ff8,  0x0000,
  125.       0x1fe0,  0x0000,
  126.       0x0fc0,  0x0000,
  127.       0x0700,  0x0000,
  128.       0x0400,  0x0000,
  129.       0x0e00,  0x0000,
  130.       0x1f00,  0x0000,
  131.       0x0e00,  0x0000,
  132.       0x0400,  0x0000,
  133.       0x0000,  0x0000
  134.      };
  135.  
  136. /***************************************************************/
  137. /*   The following routine will install the sprite as the   */
  138. /*   Intuition pointer. A pointer to your current window is */
  139. /*   needed as a parameter to this routine.                 */
  140. /***************************************************************/
  141. do_Snooze(window)
  142. struct Window *window;
  143. {
  144.  SHORT i;
  145.  UWORD red,green,blue;
  146.  struct ViewPort *vport;
  147.  
  148. /* Get the window's viewport address */
  149.  vport = ViewPortAddress(window);
  150.  
  151. /* Set the colors for the sprite */
  152. for (i=0;i<3;i++)
  153.    {
  154.      red = (Snooze_col[i] & 0xf00) >> 8;
  155.      green = (Snooze_col[i] & 0x0f0) >> 4;
  156.      blue  = (Snooze_col[i] & 0x00f) ;
  157.      SetRGB4(vport,(LONG)(17+i),(LONG)red,(LONG)green,(LONG)blue);
  158.    }
  159.  
  160.  /* get rid of the previous pointer */
  161.  ClearPointer(window);
  162.  /* and install the new one */
  163.  SetPointer(window,
  164.             &Snooze_dat,
  165.             SNOOZE_HEIGHT,
  166.             SNOOZE_WIDTH,
  167.             SNOOZE_HOTX,
  168.             SNOOZE_HOTY);
  169.  }
  170.