home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d502 / cells.lha / CELLS / CELLSSource.lzh / Cells.h < prev    next >
C/C++ Source or Header  |  1991-04-20  |  5KB  |  143 lines

  1. /*
  2.  *  CELLS       An Implementation of the WireWorld cellular automata
  3.  *              as described in Scientific American, Jan 1990.
  4.  *
  5.  *              Copyright 1990 by Davide P. Cervone.
  6.  *  You may use this code, provided this copyright notice is kept intact.
  7.  *  See the CELLS.HELP file for complete information on distribution conditions.
  8.  */
  9.  
  10. /*
  11.  *  File:  Cells.h      Main header file
  12.  */
  13.  
  14.  
  15. #define INTUITION_PREFERENCES_H             /* don't need 'em */
  16. #include <intuition/intuition.h>
  17.  
  18. #define INTUITION_REV   0
  19. #define GRAPHICS_REV    0
  20. #define DISKFONT_REV    0
  21.  
  22. #define ERROR_EXIT      10
  23. #define OK_EXIT         0
  24.  
  25. #define SHIFTKEYS       (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT)
  26. #define ALTKEYS         (IEQUALIFIER_LALT|IEQUALIFIER_RALT)
  27.  
  28. #define CELLSIZE        6                   /* default initial cell size */
  29. #define MINCELLSIZE     3                   /* smallest zoom out size */
  30. #define MAXCELLSIZE     15                  /* largest zoom in size */
  31.  
  32.  
  33. #define SCREEND         3                   /* screen depth */
  34. #define SCREENW         320                 /*        width */
  35. #define SCREENH         200                 /*        height */
  36. #define WINDOWW         320                 /* window width */
  37. #define WINDOWH         (SCREENH-10)        /*        height */
  38. #define WINDOWX         0                   /*        x position */
  39. #define WINDOWY         10                  /*        y position */
  40.  
  41. #define BOARDW          256                 /* width of grid area */
  42. #define BOARDH          180                 /* height of grid area */
  43.  
  44. #define MAXGRIDW        ((BOARDW-1)/MINCELLSIZE)    /* max size (in cells) */
  45. #define MAXGRIDH        ((BOARDH-1)/MINCELLSIZE)    /*   of entire grid */
  46. #define ARRAYSIZE       (MAXGRIDW*MAXGRIDH)         /* size of grid arrays */
  47.  
  48. /*
  49.  *  Pen numbers for specific functions
  50.  */
  51.  
  52. #define BACKGROUND      0
  53. #define HIGHLIGHT       1
  54. #define FOREGROUND      2
  55. #define SHADOW          3
  56.  
  57. #define POINTERPEN      18
  58.  
  59. #define BOXPEN          BACKGROUND
  60. #define HIGHPEN         HIGHLIGHT
  61. #define SELECTPEN       FOREGROUND
  62. #define MOVEPEN         HIGHLIGHT
  63. #define TEXTPEN         SHADOW
  64. #define TEXTSELECT      5
  65.  
  66. #define GRID            BACKGROUND
  67. #define BLANK           SHADOW
  68. #define WIRE            7
  69. #define HEAD            5
  70. #define TAIL            4
  71.  
  72. /*
  73.  *  MouseMove Types (i.e., what kind of action are mouse moves going to cause?)
  74.  */
  75.  
  76. #define MM_NONE         0
  77. #define MM_DRAW         1
  78. #define MM_SELECT       2
  79. #define MM_MOVE         3
  80. #define MM_COPY         4
  81.  
  82. /*
  83.  *  Select Type (i.e., what kind of selection is in effect?)
  84.  */
  85.  
  86. #define SEL_NONE        0       /* no selection */
  87. #define SEL_WAIT        1       /* waiting for start of selection or move */
  88. #define SEL_BOX         2       /* select box being dragged */
  89. #define SEL_CELLS       3       /* individual cells being selected */
  90. #define SEL_REPOSITION  4       /* select box being repositioned */
  91. #define SEL_MOVE        5       /* selection being moved */
  92. #define SEL_COPY        6       /* selection being copied */
  93.  
  94. #ifndef MAX
  95. #define MAX(x,y)        (((x)>(y))?(x):(y))
  96. #define MIN(x,y)        (((x)<(y))?(x):(y))
  97. #endif
  98.  
  99. /*
  100.  *  flag number to flag bit mask
  101.  *  (use MutualExclude field of gadgets for my own flags
  102.  */
  103.  
  104. #define BIT(x)          (1<<(x))
  105. #define MyFlags         MutualExclude
  106.  
  107. typedef void  (*FUNCTION)();
  108.  
  109. #define AllocMem        myAllocMem
  110.  
  111. extern struct IntuitionBase *IntuitionBase;
  112. extern struct GfxBase *GfxBase; 
  113. extern struct DiskfontBase *DiskfontBase;
  114.  
  115. extern struct Screen *myScreen;             /* the CELLS screen */
  116. extern struct Window *myWindow;             /* the CELLS window */
  117. extern struct RastPort *rp,*wrp,*irp;       /* some rast ports */
  118. extern int DBufMode;                        /* TRUE if double buffering */
  119. extern int BufferMouse;                     /* TRUE if collecting mouse moves */
  120. extern struct ExtRequest *ActiveRequest;    /* requester in use */
  121.  
  122. extern struct Gadget cGadget[];             /* the main gadget list */
  123. extern struct IntuiText cIText[];           /* the main gadget text list */
  124. extern struct Border cBorder[];             /* the main border list */
  125. extern struct Image cImage[];               /* the main image list */
  126. extern struct PropInfo cSlider[];           /* the sliders */
  127.  
  128. extern int Running,QuitInProgress;          /* flags */
  129. extern int Changed;
  130. extern int SliderActive;
  131.  
  132. extern int SelectType;                      /* selection type */
  133. extern int MouseMoveType;                   /* mouse move event type */
  134. extern int ColorInUse,PenInUse;             /* current drawing color */
  135.  
  136. extern short CellSize;                      /* current cell size */
  137. extern short GridX,GridY, GridW,GridH;      /* current (visible) grid size */
  138. extern short BoardX,BoardY, BoardW,BoardH;  /*  and screen position (pixels) */
  139. extern short MaxGridW,MaxGridH;             /* max for this cell size */
  140.  
  141. extern UBYTE *ResetArray,*UndoArray,*CurGen,*NewGen;    /* the state arrays */
  142. extern int GenerationDelay;                 /* delay between generations */
  143.