/*
              MAND.H -- The Constants and Definitions
             Mandelbrot Self-Squared Dragon Generator
                    For the Commodore Amiga
                         Version 2.01

                      Accompanies MAND.C

             Copyright (c) 1985, Robert S. French
                  Placed in the Public Domain

              Vastly Enhanced by =RJ Mical=  1985

This program may be distributed free of charge as long as the above
notice is retained.

*/


/*-------------------*/
/* Lots of includes! */

#include <exec/types.h>
#include <exec/tasks.h>
#include <exec/libraries.h>
#include <exec/devices.h>
#include <devices/keymap.h>
#include <graphics/copper.h>
#include <graphics/display.h>
#include <graphics/gfxbase.h>
#include <graphics/text.h>
#include <graphics/view.h>
#include <graphics/gels.h>
#include <graphics/regions.h>
#include <hardware/blit.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <stdio.h>

#include <libraries/dos.h>

#include <workbench/workbench.h>

#include "iff.h"


/*-------------------*/
/* Misc. definitions */
#define VERSION "2.01"

#define F_INTUITION 0x000001
#define F_GRAPHICS  0x000002
#define F_MATH      0x000004
#define F_MATHTRANS 0x000008
#define F_CONSOLE   0x000010
#define F_COLORTAB  0x000020
#define F_SETSTORE  0x000040
#define F_ICON      0x000080


#define EVER ;;
#define MAXX 640
#define MAXY 400
#define MAXMY 100
#define STARTY 0
#define PROCESS_STACKSIZE 6000

/*---------------------------------*/
/* Fast-Floating-Point Definitions */

extern   int     SPFix();
extern   int     SPFlt();
extern   int     SPCmp();
extern   int     SPTst();
extern   int     SPAbs();
extern   int     SPNeg();
extern   int     SPAdd();
extern   int     SPSub();
extern   int     SPMul();
extern   int     SPDiv();
 
extern   int     SPAtan();
extern   int     SPSin();
extern   int     SPCos();
extern   int     SPTan();
extern   int     SPSincos();
extern   int     SPSinh();
extern   int     SPCosh();
extern   int     SPTanh();
extern   int     SPExp();
extern   int     SPLog();
extern   int     SPPow();
extern   int     SPSqrt();
extern   int     SPTieee();
extern   int     SPFieee();


#define TOPW2 w2->BorderTop
#define BOTTOMW2 (w2->Height - w2->BorderBottom)
#define LEFTW2 w2->BorderLeft
#define RIGHTW2 (w2->Width - w2->BorderRight)


/* === these definitions are for the color_mode variable ================== */
#define NOT_HOLDANDMODIFY       0x0001
#define INTERLACE_MODE          0x0002
#define HIRES_MODE              0x0004

/* === these definitions are for the menu strips ========================== */#define ITEM_HEIGHT 10
#define MENU_PROJECT 0  /* first menu */
#define MENU_OPTIONS 1  /* next menu */
#define MENU_ZOOM 2     /* next menu */
#define MENU_COUNT 3

/* for the PROJECT Menu ... */
#define PROJECT_WIDTH   176
#define PROJECT_SAVEPICTURE 0
#define PROJECT_COUNT        1

/* for the OPTIONS Menu ... */
#define OPTIONS_WIDTH   176
#define OPTIONS_LEFT       (-24)
#define OPTIONS_QUARTER 0
#define OPTIONS_FULL    1
#define OPTIONS_GENERATE 2
#define OPTIONS_COLORS  3
#define OPTIONS_STOP    4
#define OPTIONS_CLOSE   5
#define OPTIONS_COUNT   6

/* for the ZOOM Menu ... */
#define ZOOM_WIDTH   222
#define ZOOM_LEFT       (-60)
#define ZOOM_SETCENTER    0
#define ZOOM_SIZEBOX      1
#define ZOOM_SIZEPROP     2
#define ZOOM_ZOOMIN       3
#define ZOOM_ZOOMIN10     4
#define ZOOM_ZOOMOUT2     5
#define ZOOM_ZOOMOUT10    6
#define ZOOM_COUNT        7


/* === the definitions for the ColorWindow ================================ */
#define COLOR_KNOB_BODY         0x1111

#define COLORWINDOW_WIDTH       208
#define COLORWINDOW_HEIGHT      91

#define DEFAULT_WINDOW_LEFT     (320 - COLORWINDOW_WIDTH)
#define DEFAULT_WINDOW_TOP      (200 - COLORWINDOW_HEIGHT)

#define CHARACTER_WIDTH         8
#define CHARACTER_HEIGHT        8

#define COLOR_BOX_LEFT          7
#define COLOR_BOX_TOP           6
#define COLOR_BOX_RIGHT         (COLOR_BOX_LEFT + 15)
#define COLOR_BOX_BOTTOM        (COLOR_BOX_TOP + 29)
#define COLOR_COLOR_TOP         45
#define COLOR_PROP_LEFT         38
#define COLOR_PROP_TOP          4
#define COLOR_PROP_WIDTH        165
#define COLOR_PROP_HEIGHT       10
#define COLOR_CLUSTER_LEFT      141
#define COLOR_CLUSTER_TOP       41
#define COLOR_CLUSTER_WIDTH     (CHARACTER_WIDTH * 6 + 4)
#define COLOR_CLUSTER_HEIGHT    9
#define COLOR_HSL_TOP           (COLOR_BOX_TOP - 2)
#define COLOR_HSL_LEFT          (COLOR_BOX_RIGHT + 3)

/* GREEN and RED are out of order.  Do you wonder why?  Some day I'll 
 * tell you.  =RJ=
 */
#define COLOR_COPY              32
#define COLOR_RANGE             33
#define COLOR_OK                34
#define COLOR_CANCEL            35
#define COLOR_GREEN             36
#define COLOR_RED               37
#define COLOR_BLUE              38
#define COLOR_HSL_RGB           39
#define COLOR_GADGETS_COUNT     40



/* === Our Definitions for the IFF Format ================================= */

struct  BitMapHeader
{
        USHORT  w;
        USHORT  h;
        SHORT   x, y;
        UBYTE   nPlanes, masking, compression, pad1;
        USHORT  TransparentColor;
        UBYTE   xAspect, yAspect;
        SHORT   PageWidth, PageHeight;
};

struct  PaintingHeader
{
        LONG    IFFID, FileLength, ILBMID, BMHDID, BitMapSize;
        struct  BitMapHeader BitMapHeader;
        LONG    CMAP, CMAPlength;
};

/* the MakeID macro is defined in iff.h */
#define ILBM                    MakeID('I','L','B','M')
#define BMHD                    MakeID('B','M','H','D')
#define BODY                    MakeID('B','O','D','Y')
#define CMAP                    MakeID('C','M','A','P')
#define CAMG                    MakeID('C','A','M','G')

/* ======================================================================== */

/* This constant is for Intuition V1.1.  If you are getting "redefinition"
 * warnings when you compile, it's because of this redeclaration.  
 * Is harmless, and when we all get to V1.1 then we all can delete this.
 */
#define INTUITICKS 0x00400000
MpP[tD F5<P	15JMANDELBROT C SOURCE RJMC source file for R J Mical (Author of Intuition) version of Mandelbrot
program. Use Lattice C 3.03 to compile. You need the following to make up
the whole program: IFF.H MAND.H MAND.C MAND1.C MAND2.C MAND3.C MAND4.C
MAND5.C MAND6.C MAND7.C Example of how to use Intuition from the man that
wrote it.
