home *** CD-ROM | disk | FTP | other *** search
- #include <clib/macros.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
- #include <libraries/mathffp.h>
- #include <intuition/intuition.h>
- #include <math.h>
-
- #undef NULL
- #define NULL ((void *)0)
-
- #define MakeID(a,b,c,d) ((a)<<24L | (b)<<16L | (c)<<8 | (d))
- #define ROUNDODDUP(a) (((a)+1)&(~1L))
- #define SafeRead(a,b,c) if (Read(a,b,c)==-1L) { Close(a); return(0); }
-
- #define NCOL 15 /* max # additional colors for HAM screen */
-
- #define INTUITION 0x0001
- #define GRAPHICS 0x0002
- #define SCREEN 0x0004
- #define WINDOW 0x0008
- #define ILBM 0x0010
-
- #define MAXWIDTH 376 /* max non-HIRES width */
- #define MAXHEIGHT 242 /* max non-interlaced height */
- #define MAXCOLORS 32 /* max # colors supported */
-
- #define ID_FORM MakeID('F','O','R','M')
- #define ID_ILBM MakeID('I','L','B','M')
- #define ID_BMHD MakeID('B','M','H','D')
- #define ID_CAMG MakeID('C','A','M','G')
- #define ID_CMAP MakeID('C','M','A','P')
- #define ID_BODY MakeID('B','O','D','Y')
-
- #define cmpByteRun1 1
-
- typedef struct {
- long ckID,ckSize;
- } Chunk;
-
- typedef struct {
- short w,h,x,y;
- char nPlanes,masking,compression,pad1;
- short transparentColor;
- char xAspect, yAspect;
- short pageWidth,pageHeight;
- } BitMapHeader;
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct IntuiMessage *message;
- struct Message *GetMsg();
- struct ViewPort *vp;
- struct RastPort *rp, *trp;
- struct Screen *s;
- struct Window *w;
- struct BitMap bmap;
- struct RastPort maprp;
- struct Image square[16];
-
- BitMapHeader bmhd;
- UBYTE *bufstart,*mapfile;
- Chunk header;
-
- int rm[MAXCOLORS],gm[MAXCOLORS],bm[MAXCOLORS];
-
- int rn[16] = { 0, 7 };
- int gn[16] = { 0, 7 };
- int bn[16] = { 0, 7 };
-
- unsigned int CMFF = FALSE;
- int rc,gc,bc,ro,go,bo,dmax,showtitle,nc = 0;
- short Width,Height,Depth;
- long PlaneSize,ViewModes = 0;
-
- struct NewScreen ns = {
- 0L, 0L, /* LeftEdge, TopEdge */
- 320L, 400L, 6L, /* Width, Height, Depth */
- 0L, 1L, /* DetailPen, BlockPen */
- HAM | /* ViewMode flags */
- LACE,
- CUSTOMSCREEN, /* Type */
- NULL, /* Default Font */
- NULL, /* No DefaultTitle for now */
- NULL, /* No custom gadgets */
- NULL /* No CustomBitMap */
- };
-
- struct NewWindow nw = {
- 0L, 0L, /* LeftEdge, TopEdge */
- 320L, 400L, /* Width, Height */
- 0L, 1L, /* DetailPen, BlockPen */
- MENUPICK, /* IDCMP flags */
- SMART_REFRESH | /* Flags */
- BACKDROP |
- BORDERLESS |
- ACTIVATE,
- NULL, /* No gadgets in window */
- NULL, /* Use default checkmark */
- NULL, /* No Title */
- NULL, /* Pointer to screen, to be set later */
- NULL, /* No superbitmap is used */
- 0L, 0L, 0L, 0L, /* Window is not resizable */
- CUSTOMSCREEN /* Screen Type */
- };
-
- struct IntuiText ScrnText2 = {
- 1,0,
- JAM2,
- 0,1,
- NULL,
- (UBYTE *)"Quit",
- NULL
- };
-
- struct MenuItem ScrnItem2 = {
- NULL,
- 0,11,135,11,
- ITEMTEXT | ITEMENABLED | HIGHCOMP,
- 0,
- (APTR)&ScrnText2,
- NULL,
- 0,
- NULL,
- 0
- };
-
- struct IntuiText ScrnText1 = {
- 1,0,
- JAM2,
- 0,1,
- NULL,
- (UBYTE *)" ",
- NULL
- };
-
- struct MenuItem ScrnItem1 = {
- &ScrnItem2,
- 0,0,135,11,
- ITEMTEXT | ITEMENABLED | HIGHCOMP,
- 0,
- (APTR)&ScrnText1,
- NULL,
- 0,
- NULL,
- 0
- };
-
- struct Menu ScrnMenu = {
- NULL,
- 5,0,85,10,
- MENUENABLED,
- "Screen",
- &ScrnItem1
- };
-