home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 100.lha / Planete / planet.h < prev    next >
C/C++ Source or Header  |  1986-11-20  |  4KB  |  155 lines

  1. #include <clib/macros.h>
  2. #include <exec/memory.h>
  3. #include <libraries/dos.h>
  4. #include <libraries/mathffp.h>
  5. #include <intuition/intuition.h>
  6. #include <math.h>
  7.  
  8. #undef NULL
  9. #define NULL        ((void *)0)
  10.  
  11. #define MakeID(a,b,c,d) ((a)<<24L | (b)<<16L | (c)<<8 | (d))
  12. #define ROUNDODDUP(a) (((a)+1)&(~1L))
  13. #define SafeRead(a,b,c) if (Read(a,b,c)==-1L) { Close(a); return(0); }
  14.  
  15. #define NCOL      15  /* max # additional colors for HAM screen */
  16.  
  17. #define INTUITION  0x0001
  18. #define GRAPHICS   0x0002
  19. #define SCREEN     0x0004
  20. #define WINDOW     0x0008
  21. #define ILBM       0x0010
  22.  
  23. #define MAXWIDTH  376 /* max non-HIRES width */
  24. #define MAXHEIGHT 242 /* max non-interlaced height */
  25. #define MAXCOLORS 32  /* max # colors supported */
  26.  
  27. #define ID_FORM MakeID('F','O','R','M')
  28. #define ID_ILBM MakeID('I','L','B','M')
  29. #define ID_BMHD MakeID('B','M','H','D')
  30. #define ID_CAMG MakeID('C','A','M','G')
  31. #define ID_CMAP MakeID('C','M','A','P')
  32. #define ID_BODY MakeID('B','O','D','Y')
  33.  
  34. #define cmpByteRun1 1
  35.  
  36. typedef struct {
  37.   long ckID,ckSize;
  38. } Chunk;
  39.  
  40. typedef struct {
  41.   short w,h,x,y;
  42.   char  nPlanes,masking,compression,pad1;
  43.   short transparentColor;
  44.   char  xAspect, yAspect;
  45.   short pageWidth,pageHeight;
  46. } BitMapHeader;
  47.  
  48. struct IntuitionBase *IntuitionBase;
  49. struct GfxBase *GfxBase;
  50. struct IntuiMessage *message;
  51. struct Message *GetMsg();
  52. struct ViewPort *vp;
  53. struct RastPort *rp, *trp;
  54. struct Screen *s;
  55. struct Window *w;
  56. struct BitMap bmap;
  57. struct RastPort maprp;
  58. struct Image square[16];
  59.  
  60. BitMapHeader bmhd;
  61. UBYTE *bufstart,*mapfile;
  62. Chunk header;
  63.  
  64. int rm[MAXCOLORS],gm[MAXCOLORS],bm[MAXCOLORS];
  65.  
  66. int rn[16] = { 0, 7 };
  67. int gn[16] = { 0, 7 };
  68. int bn[16] = { 0, 7 };
  69.  
  70. unsigned int CMFF = FALSE;
  71. int rc,gc,bc,ro,go,bo,dmax,showtitle,nc = 0;
  72. short Width,Height,Depth;
  73. long PlaneSize,ViewModes = 0;
  74.  
  75. struct NewScreen ns = {
  76.    0L, 0L,                      /* LeftEdge, TopEdge */
  77.    320L, 400L, 6L,              /* Width, Height, Depth */
  78.    0L, 1L,                      /* DetailPen, BlockPen */
  79.    HAM |                        /* ViewMode flags */
  80.    LACE,
  81.    CUSTOMSCREEN,                /* Type */
  82.    NULL,                        /* Default Font */
  83.    NULL,                        /* No DefaultTitle for now */
  84.    NULL,                        /* No custom gadgets */
  85.    NULL                         /* No CustomBitMap */
  86. };
  87.  
  88. struct NewWindow nw = {
  89.    0L, 0L,                      /* LeftEdge, TopEdge */
  90.    320L, 400L,                  /* Width, Height */
  91.    0L, 1L,                      /* DetailPen, BlockPen */
  92.    MENUPICK,                    /* IDCMP flags */
  93.    SMART_REFRESH |              /* Flags */
  94.    BACKDROP |
  95.    BORDERLESS |
  96.    ACTIVATE,
  97.    NULL,                        /* No gadgets in window */
  98.    NULL,                        /* Use default checkmark */
  99.    NULL,                        /* No Title */
  100.    NULL,                        /* Pointer to screen, to be set later */
  101.    NULL,                        /* No superbitmap is used */
  102.    0L, 0L, 0L, 0L,              /* Window is not resizable */
  103.    CUSTOMSCREEN                 /* Screen Type */
  104. };
  105.  
  106. struct IntuiText ScrnText2 = {
  107.    1,0,
  108.    JAM2,
  109.    0,1,
  110.    NULL,
  111.    (UBYTE *)"Quit",
  112.    NULL
  113. };
  114.  
  115. struct MenuItem ScrnItem2 = {
  116.    NULL,
  117.    0,11,135,11,
  118.    ITEMTEXT | ITEMENABLED | HIGHCOMP,
  119.    0,
  120.    (APTR)&ScrnText2,
  121.    NULL,
  122.    0,
  123.    NULL,
  124.    0
  125. };
  126.  
  127. struct IntuiText ScrnText1 = {
  128.    1,0,
  129.    JAM2,
  130.    0,1,
  131.    NULL,
  132.    (UBYTE *)" ",
  133.    NULL
  134. };
  135.  
  136. struct MenuItem ScrnItem1 = {
  137.    &ScrnItem2,
  138.    0,0,135,11,
  139.    ITEMTEXT | ITEMENABLED | HIGHCOMP,
  140.    0,
  141.    (APTR)&ScrnText1,
  142.    NULL,
  143.    0,
  144.    NULL,
  145.    0
  146. };
  147.  
  148. struct Menu ScrnMenu = {
  149.    NULL,
  150.    5,0,85,10,
  151.    MENUENABLED,
  152.    "Screen",
  153.    &ScrnItem1
  154. };
  155.