home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / aga_software / animdemo / playanim.h < prev    next >
C/C++ Source or Header  |  1993-01-23  |  4KB  |  168 lines

  1. /*******************************************************************************
  2.  *
  3.  * (c) Copyright 1993 Commodore-Amiga, Inc.  All rights reserved.
  4.  *
  5.  * This software is provided as-is and is subject to change; no warranties
  6.  * are made.  All use is at your own risk.  No liability or responsibility
  7.  * is assumed.
  8.  *
  9.  * playanim.h - header file for the anim code. 
  10.  *
  11.  ******************************************************************************/
  12.  
  13. struct BitMapHeader 
  14. {
  15.     UWORD    w, h;        /*  Width, height in pixels */
  16.     WORD    x, y;        /*  x, y position for this bitmap  */
  17.     UBYTE    nplanes;    /*  # of planes  */
  18.     UBYTE    Masking;
  19.     UBYTE    Compression;
  20.     UBYTE    pad1;
  21.     UWORD    TransparentColor;
  22.     UBYTE    XAspect, YAspect;
  23.     WORD    PageWidth, PageHeight;
  24. };
  25.  
  26. struct ANHD
  27. {
  28.     UBYTE operation;
  29.     UBYTE mask;
  30.     UWORD w, h;
  31.     WORD x, y;
  32.     ULONG abstime;
  33.     ULONG reltime;
  34.     UBYTE ileave;
  35.     UBYTE pad0;
  36.     ULONG bits;
  37.     UBYTE pad1[16];
  38. };
  39.  
  40. struct VHDR
  41. {
  42.     ULONG OneShotHiSamples;
  43.     ULONG RepeatHiSamples;
  44.     ULONG SamplesPerHiCycle;
  45.     UWORD SamplesPerSec;
  46.     UBYTE CtOctave;
  47.     UBYTE SCompression;
  48.     LONG  Volume;
  49. };
  50.  
  51. #define FIRSTCOLOUR_RED 0x0
  52. #define FIRSTCOLOUR_GREEN 0x44444444
  53. #define FIRSTCOLOUR_BLUE 0x88888888
  54. #define LASTCOLOUR_RED 0x0
  55. #define LASTCOLOUR_GREEN 0xffffffff
  56. #define LASTCOLOUR_BLUE 0xffffffff
  57.  
  58. #define COPLISTTYPES 1
  59. #define COLOURRANGE 50
  60. #define COPINSCNT COLOURRANGE
  61.  
  62. #define SECTORSIZE 2048
  63. #define DATASIZE ((sizeof(struct Frame1Head)) + (ncolours * 3))
  64. #define BYTES_TO_SECTORS(x) (((x) + DATASIZE + sizeof(struct VistaScript) + (SECTORSIZE - 1)) / SECTORSIZE)
  65. #define BYTES_TO_WHOLE_SECTORS(x) (BYTES_TO_SECTORS(x) * SECTORSIZE)
  66. #define WHOLE_SECTORS(x) (((x) + (SECTORSIZE - 1)) / SECTORSIZE)
  67.  
  68. /* Frame1 is the format of the 1st frame of the sequence.
  69.  * This cannot be defined in C, because the structure is of a variable length.
  70.  *
  71.  *
  72.  * struct Frame1Head
  73.  * {
  74.  *    ULONG f1_MaxSectorSize;     max number of sectors in a frame
  75.  *     ULONG f1_ByteSize;     number of bytes in this block
  76.  *    ULONG f1_Sectors;     number of sectors in this block
  77.  *    UWORD f1_ImageWidth;     number of pixels accross the image
  78.  *    UWORD f1_ImageHeight;     number of rows in the image
  79.  *    UWORD f1_ImageDepth;     depth of the image
  80.  *    UWORD f1_ScreenWidth;     number of pixels accross the screen
  81.  *    UWORD f1_ScreenHeight;
  82.  *    UWORD f1_ScreenDepth;
  83.  *    ULONG f1_ScreenModeID;
  84.  *    UWORD f1_Colours;     number of colours in the CMAP
  85.  *    UBYTE f1_CMAP[];     full CMAP structure.
  86.  *    UBYTE f1_ILBM;         ILBM of frame 1
  87.  *    ULONG f1_NextByteSize;     number of bytes in the next frame
  88.  *    ULONG f1_NextSectors;     number of sectors in the next frame
  89.  *      VistaScript Data
  90.  *    UBYTE f1_pads[];     pad to the next whole sector
  91.  *    AudioData
  92.  * };
  93.  */
  94.  
  95. /* Frame is the format of the other frames in the sequence.
  96.  *
  97.  * struct Frame
  98.  * {
  99.  *    UBYTE f1_DLTA[];     DLTA of this frame
  100.  *    ULONG f1_NextByteSize;     number of bytes in the next frame
  101.  *    ULONG f1_NextSectors;     number of sectors in the next frame
  102.  *      VistaScript Data
  103.  * };
  104.  */
  105.  
  106.  
  107. struct Frame1Head
  108. {
  109.     ULONG f1_MaxSectorSize;
  110.     ULONG f1_ByteSize;
  111.     ULONG f1_Sectors;
  112.     UWORD f1_ImageWidth;    /* number of pixels across the image */
  113.     UWORD f1_ImageHeight;    /* number of rows in the image */
  114.     UWORD f1_ImageDepth;    /* depth of the image */
  115.     UWORD f1_ScreenWidth;    /* number of pixels across the screen */
  116.     UWORD f1_ScreenHeight;
  117.     UWORD f1_ScreenDepth;
  118.     ULONG f1_ScreenModeID;
  119.     UWORD f1_Colours;
  120. };
  121.  
  122. struct VistaScript
  123. {
  124.     WORD vs_CamX;
  125.     WORD vs_CamY;
  126.     WORD vs_CamZ;
  127.     WORD vs_Bank;
  128.     WORD vs_Heading;
  129.     WORD vs_Pitch;
  130.     WORD vs_Focal;
  131. };
  132.  
  133. struct Missile
  134. {
  135.     struct ExtSprite *mis_Sprite;
  136.     WORD mis_Active;
  137.     WORD mis_StartX;
  138.     WORD mis_StartY;
  139.     WORD mis_StartZ;
  140.     WORD mis_StartPitch;
  141.     WORD mis_Distance;
  142. };
  143.  
  144. /* The Audio data in Frame1 has the following format:
  145.  * ULONG SizeOfSample;
  146.  * ULONG SamplesPerSecond;
  147.  * LONG  Volume;
  148.  * UBYTE Sample[];
  149.  * Pads to whole sector size.
  150.  *
  151.  * (Next sample).
  152.  *
  153.  * The first sample is of the gunshot (or missile launch, or whatever).
  154.  * The second is the thrusters.
  155.  */
  156.  
  157. #define PERIOD(p) ((ULONG)(SysBase->ex_EClockFrequency * 5) / (ULONG)(p))
  158. #define VOLUME(v) (((v) * 64) >> 16)
  159.  
  160. struct RawAudio
  161. {
  162.     ULONG ra_SizeOfSample;
  163.     ULONG ra_SamplesPerSecond;
  164.     ULONG ra_SamplesPerCycle;
  165.     LONG  ra_Volume;
  166.     /* UBYTE ra_Sample; starts here */
  167. };
  168.