home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 5 / amigaformatcd05.iso / screenplay / shareware / mastermind / source / misc.h < prev    next >
C/C++ Source or Header  |  1996-08-13  |  23KB  |  594 lines

  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h> 
  4. #include <string.h>
  5.  
  6. #include <proto/exec.h>
  7. #include <exec/memory.h>
  8.  
  9. #include <proto/intuition.h>
  10.  
  11. #include <proto/graphics.h>
  12. #include <graphics/gfxbase.h>
  13. #include <graphics/gfxmacros.h>
  14.  
  15. #include <proto/icon.h>
  16. #include <workbench/workbench.h>
  17. #include <workbench/startup.h>
  18.  
  19. #include <proto/dos.h>
  20.  
  21.         /* OS 3.0 functions */
  22. ULONG SetOutlinePen(struct RastPort *,ULONG);
  23. #pragma libcall GfxBase SetOutlinePen 3D2 0802
  24.  
  25. ULONG GetAPen(struct RastPort *);
  26. #pragma libcall GfxBase GetAPen 35A 801
  27.  
  28. VOID LoadRGB32(struct ViewPort *, ULONG *);
  29. #pragma libcall GfxBase LoadRGB32 372 9802
  30.  
  31.  
  32. #define NoError     0
  33. #define NoIntuition 1
  34. #define NoGraphics  2
  35. #define NoIcon      3
  36. #define NoScreen    4
  37. #define NoWindow    5
  38. #define NoMem       6
  39. #define NoPub       7
  40. #define RepFound    1000
  41.  
  42.  
  43. struct Screen *MyScreen = NULL;
  44. struct Window *MyWindow = NULL,*ResWindow = NULL,*ColorWindow = NULL;
  45.  
  46. struct TextAttr MyFont = { "topaz.font",8,FS_NORMAL,FPF_ROMFONT };
  47.  
  48. char NormalScrTitle[] = "                             MasterMind V1.6";
  49. char ExtraScrTitle[] = 
  50. "                             MasterMind V1.6                     Scrollable";
  51. struct NewScreen NewScr = 
  52.  { 0,0,640,256,4,0,1,HIRES,CUSTOMSCREEN,&MyFont,NormalScrTitle,NULL,NULL};
  53.  
  54. struct NewWindow MyNewWindow = 
  55.  { 0,0,640,256,0,1,IDCMP_MOUSEBUTTONS|IDCMP_GADGETUP,WFLG_BORDERLESS|
  56.    WFLG_BACKDROP|WFLG_ACTIVATE|WFLG_RMBTRAP,NULL, NULL,"MasterMind Window",
  57.    NULL,NULL,1,1,16000,16000,CUSTOMSCREEN };
  58.  
  59. struct NewWindow NewColorWindow = 
  60.  { 0,0,0,33,0,1,IDCMP_GADGETUP|IDCMP_MOUSEBUTTONS,WFLG_DRAGBAR|WFLG_RMBTRAP|
  61.    WFLG_ACTIVATE,NULL,NULL,"Choose!",NULL,NULL,1,1,640,512,CUSTOMSCREEN };
  62.  
  63. struct NewWindow MyResWindow = 
  64.  { 120,100,0,40,0,1,IDCMP_CLOSEWINDOW,
  65.    WFLG_CLOSEGADGET|WFLG_ACTIVATE|WFLG_DRAGBAR,NULL,
  66.    NULL,NULL,NULL,NULL,1,1,640,512,CUSTOMSCREEN };
  67.  
  68. UWORD __chip Logodata[1440] =
  69.     {
  70.     /* Plane 0 */
  71. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  72. 0x0000,0x1E00,0x7800,0x007F,0x4000,0x1FFC,0x0000,0x0000,0x003E,0x0000,0x0000,0x0000,
  73. 0x0000,0x0F00,0xF000,0x01E0,0xC000,0x0E0C,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  74. 0x0000,0x0F00,0xF000,0x03C0,0x4000,0x0E04,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  75. 0x0000,0x0F81,0xF000,0x01E0,0x0000,0x0E00,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  76. 0x0000,0x0F81,0xF000,0x0078,0x0000,0x0E20,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  77. 0x0000,0x0DC3,0x7000,0x001E,0x0000,0x0FE0,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  78. 0x0000,0x0CE6,0x7000,0x0007,0x8000,0x0E20,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  79. 0x0000,0x0C7E,0x7000,0x0003,0xC000,0x0E00,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  80. 0x0000,0x0C3C,0x7000,0x0203,0xC000,0x0E04,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  81. 0x0000,0x0C18,0x7000,0x0307,0x8000,0x0E0C,0x0000,0x0000,0x001C,0x0000,0x0000,0x0000,
  82. 0x0000,0x1E18,0xF800,0x02FE,0x0000,0x1FFC,0x0000,0x0000,0x003E,0x0000,0x0000,0x0000,
  83. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  84. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  85. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  86. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  87. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  88. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  89. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  90. 0x07F0,0x7C38,0x0000,0x0000,0x0000,0x0000,0x000F,0x8700,0x0000,0x0E00,0x0003,0x8000,
  91. 0x180C,0x3860,0x0000,0x0000,0x0000,0x0000,0x0007,0x0C00,0x0000,0x0E00,0x0003,0x8000,
  92. 0x3006,0x38C0,0x0000,0x0000,0x0000,0x0000,0x0007,0x1800,0x0000,0x0000,0x0000,0x0000,
  93. 0x61E3,0x3980,0x0000,0x0000,0x0000,0x0000,0x0007,0x3000,0x0000,0x0000,0x0000,0x0000,
  94. 0x6333,0x3B00,0xFE37,0x9F8D,0xFC1F,0xC77C,0x0007,0x601F,0xC6FE,0x1E37,0x9F87,0x8000,
  95. 0x6703,0x3E03,0x071C,0x71C7,0x8660,0xE3C7,0x0007,0xC060,0xE3C3,0x0E1C,0x71C3,0x8000,
  96. 0x6703,0x3F00,0x071C,0x71C7,0x0700,0xE383,0x8007,0xE000,0xE383,0x8E1C,0x71C3,0x8000,
  97. 0x6333,0x3B80,0xFF1C,0x71C7,0x001F,0xE383,0x8007,0x701F,0xE380,0x0E1C,0x71C3,0x8000,
  98. 0x31E6,0x39C1,0x871C,0x71C7,0x0030,0xE383,0x8007,0x3830,0xE380,0x0E1C,0x71C3,0x8000,
  99. 0x180C,0x38E3,0x871C,0x71C7,0x0070,0xE383,0x8007,0x1C70,0xE380,0x0E1C,0x71C3,0x8000,
  100. 0x07F0,0x7CF9,0xFFBC,0xFBEF,0x803F,0xF7C7,0xC00F,0x9F3F,0xF7C0,0x1F3C,0xFBE7,0xC000,
  101.     /* Plane 1 */
  102. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  103. 0x0000,0x0000,0x0000,0x0000,0x0000,0x1FFD,0xFF80,0x03C0,0x0F3E,0x703D,0xFF00,0x0000,
  104. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E0C,0xE0E0,0x01E0,0x1E1C,0x3818,0xE1C0,0x0000,
  105. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E04,0xE070,0x01E0,0x1E1C,0x3C18,0xE0E0,0x0000,
  106. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E00,0xE070,0x01F0,0x3E1C,0x3E18,0xE070,0x0000,
  107. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E20,0xE0E0,0x01F0,0x3E1C,0x3F18,0xE070,0x0000,
  108. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0FE0,0xFF80,0x01B8,0x6E1C,0x3798,0xE070,0x0000,
  109. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E20,0xEE00,0x019C,0xCE1C,0x33D8,0xE070,0x0000,
  110. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E00,0xE700,0x018F,0xCE1C,0x31F8,0xE070,0x0000,
  111. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E04,0xE380,0x0187,0x8E1C,0x30F8,0xE0E0,0x0000,
  112. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0E0C,0xE1C0,0x0183,0x0E1C,0x3078,0xE1C0,0x0000,
  113. 0x0000,0x0000,0x0000,0x0000,0x0000,0x1FFD,0xF1F0,0x03C3,0x1F3E,0x7839,0xFF00,0x0000,
  114. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  115. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  116. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  117. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  118. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  119. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  120. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  121. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  122. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  123. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  124. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  125. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  126. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  127. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,    
  128. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  129. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  130. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  131. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  132.     /* Plane 2 */
  133. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  134. 0x0000,0x1E00,0x780E,0x007F,0x5FFF,0xDFFC,0x0000,0x03C0,0x0F00,0x703C,0x0000,0x0000,
  135. 0x0000,0x0F00,0xF01F,0x01E0,0xD870,0xCE0C,0x0000,0x01E0,0x1E00,0x3818,0x0000,0x0000,
  136. 0x0000,0x0F00,0xF033,0x83C0,0x5070,0x4E04,0x0000,0x01E0,0x1E00,0x3C18,0x0000,0x0000,
  137. 0x0000,0x0F81,0xF033,0x81E0,0x0070,0x0E00,0x0000,0x01F0,0x3E00,0x3E18,0x0000,0x0000,
  138. 0x0000,0x0F81,0xF061,0xC078,0x0070,0x0E20,0x0000,0x01F0,0x3E00,0x3F18,0x0000,0x0000,
  139. 0x0000,0x0DC3,0x7061,0xC01E,0x0070,0x0FE0,0x0000,0x01B8,0x6E00,0x3798,0x0000,0x0000,
  140. 0x0000,0x0CE6,0x70FF,0xE007,0x8070,0x0E20,0x0000,0x019C,0xCE00,0x33D8,0x0000,0x0000,
  141. 0x0000,0x0C7E,0x70C0,0xE003,0xC070,0x0E00,0x0000,0x018F,0xCE00,0x31F8,0x0000,0x0000,
  142. 0x0000,0x0C3C,0x7180,0x7203,0xC070,0x0E04,0x0000,0x0187,0x8E00,0x30F8,0x0000,0x0000,
  143. 0x0000,0x0C18,0x7180,0x7307,0x8070,0x0E0C,0x0000,0x0183,0x0E00,0x3078,0x0000,0x0000,
  144. 0x0000,0x1E18,0xFBC0,0xFAFE,0x00F8,0x1FFC,0x0000,0x03C3,0x1F00,0x7838,0x0000,0x0000,
  145. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  146. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  147. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  148. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  149. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  150. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  151. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  152. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  153. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  154. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  155. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  156. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  157. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  158. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  159. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  160. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  161. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  162. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  163.     /* Plane 3 */
  164. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  165. 0x0000,0x1E00,0x7800,0x0000,0x1FFF,0xDFFC,0x0000,0x03C0,0x0F3E,0x0001,0xFF00,0x0000,
  166. 0x0000,0x0F00,0xF000,0x0000,0x1870,0xCE0C,0x0000,0x01E0,0x1E1C,0x0000,0xE1C0,0x0000,
  167. 0x0000,0x0F00,0xF000,0x0000,0x1070,0x4E04,0x0000,0x01E0,0x1E1C,0x0000,0xE0E0,0x0000,
  168. 0x0000,0x0F81,0xF000,0x0000,0x0070,0x0E00,0x0000,0x01F0,0x3E1C,0x0000,0xE070,0x0000,
  169. 0x0000,0x0F81,0xF000,0x0000,0x0070,0x0E20,0x0000,0x01F0,0x3E1C,0x0000,0xE070,0x0000,
  170. 0x0000,0x0DC3,0x7000,0x0000,0x0070,0x0FE0,0x0000,0x01B8,0x6E1C,0x0000,0xE070,0x0000,
  171. 0x0000,0x0CE6,0x7000,0x0000,0x0070,0x0E20,0x0000,0x019C,0xCE1C,0x0000,0xE070,0x0000,
  172. 0x0000,0x0C7E,0x7000,0x0000,0x0070,0x0E00,0x0000,0x018F,0xCE1C,0x0000,0xE070,0x0000,
  173. 0x0000,0x0C3C,0x7000,0x0000,0x0070,0x0E04,0x0000,0x0187,0x8E1C,0x0000,0xE0E0,0x0000,
  174. 0x0000,0x0C18,0x7000,0x0000,0x0070,0x0E0C,0x0000,0x0183,0x0E1C,0x0000,0xE1C0,0x0000,
  175. 0x0000,0x1E18,0xF800,0x0000,0x00F8,0x1FFC,0x0000,0x03C3,0x1F3E,0x0001,0xFF00,0x0000,
  176. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  177. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  178. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  179. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  180. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  181. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  182. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  183. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  184. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  185. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  186. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  187. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  188. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  189. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  190. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  191. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  192. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  193. 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
  194.     };
  195.  
  196. struct Image LogoImage = { 0,0,179,30,4,&Logodata[0],0xff,0x0,NULL };
  197.  
  198. UWORD __chip BData[20] =
  199.     {
  200.     /* Plane 0 */0x7000,0xF800,0xF800,0xF800,0x7000,
  201.     /* Plane 1 */0x0000,0x0000,0x0000,0x0000,0x0000,
  202.     /* Plane 2 */0x0000,0x0000,0x0000,0x0000,0x0000,
  203.     /* Plane 3 */0x0000,0x0000,0x0000,0x0000,0x0000
  204.     };
  205.  
  206. struct Image BCircle = { 0,0,5,5,4,&BData[0],0xff,0x0,NULL };
  207.  
  208.  
  209. UWORD __chip WData[20] =
  210.     {
  211.     /* Plane 0 */0x0000,0x0000,0x0000,0x0000,0x0000,
  212.     /* Plane 1 */0x7000,0xF800,0xF800,0xF800,0x7000,
  213.     /* Plane 2 */0x0000,0x0000,0x0000,0x0000,0x0000,
  214.     /* Plane 3 */0x0000,0x0000,0x0000,0x0000,0x0000
  215.     };
  216.  
  217. struct Image WCircle = { 0,0,5,5,4,&WData[0],0xff,0x0,NULL };
  218.  
  219.  
  220. UWORD __chip Board[228] =
  221.     {
  222.     /* Plane 0 */
  223.         0x8000,0x0000,0x8000,
  224.         0x7FFF,0xFFFF,0x8000,
  225.         0x4000,0x0000,0x8000,
  226.         0x4000,0x0000,0x8000,
  227.         0x41FF,0xFF00,0x8000,
  228.         0x4180,0x0000,0x8000,
  229.         0x4180,0x0000,0x8000,
  230.         0x4180,0x0000,0x8000,
  231.         0x4180,0x0000,0x8000,
  232.         0x4180,0x0000,0x8000,
  233.         0x4180,0x0000,0x8000,
  234.         0x4180,0x0000,0x8000,
  235.         0x4180,0x0000,0x8000,
  236.         0x4180,0x0000,0x8000,
  237.         0x4180,0x0000,0x8000,
  238.         0x4000,0x0000,0x8000,
  239.         0x4000,0x0000,0x8000,
  240.         0x4000,0x0001,0x8000,
  241.         0xFFFF,0xFFFF,0x8000,
  242.     /* Plane 1 */
  243.         0x7FFF,0xFFFF,0x0000,
  244.         0x8000,0x0000,0x0000,
  245.         0x8000,0x0001,0x0000,
  246.         0x8000,0x0001,0x0000,
  247.         0x8000,0x00C1,0x0000,
  248.         0x8000,0x00C1,0x0000,
  249.         0x8000,0x00C1,0x0000,
  250.         0x8000,0x00C1,0x0000,
  251.         0x8000,0x00C1,0x0000,
  252.         0x8000,0x00C1,0x0000,
  253.         0x8000,0x00C1,0x0000,
  254.         0x8000,0x00C1,0x0000,
  255.         0x8000,0x00C1,0x0000,
  256.         0x8000,0x00C1,0x0000,
  257.         0x807F,0xFFC1,0x0000,
  258.         0x8000,0x0001,0x0000,
  259.         0x8000,0x0001,0x0000,
  260.         0xBFFF,0xFFFE,0x0000,
  261.         0x0000,0x0000,0x0000,
  262.     /* Plane 2 */
  263.         0x0000,0x0000,0x0000,
  264.         0x0000,0x0000,0x0000,
  265.         0x0000,0x0000,0x0000,
  266.         0x0000,0x0000,0x0000,
  267.         0x0000,0x0000,0x0000,
  268.         0x0000,0x0000,0x0000,
  269.         0x0000,0x0000,0x0000,
  270.         0x0000,0x0000,0x0000,
  271.         0x0000,0x0000,0x0000,
  272.         0x0000,0x0000,0x0000,
  273.         0x0000,0x0000,0x0000,
  274.         0x0000,0x0000,0x0000,
  275.         0x0000,0x0000,0x0000,
  276.         0x0000,0x0000,0x0000,
  277.         0x0000,0x0000,0x0000,
  278.         0x0000,0x0000,0x0000,
  279.         0x0000,0x0000,0x0000,
  280.         0x0000,0x0000,0x0000,
  281.         0x0000,0x0000,0x0000,
  282.     /* Plane 3 */
  283.         0x0000,0x0000,0x0000,
  284.         0x0000,0x0000,0x0000,
  285.         0x0000,0x0000,0x0000,
  286.         0x0000,0x0000,0x0000,
  287.         0x0000,0x0000,0x0000,
  288.         0x0000,0x0000,0x0000,
  289.         0x0000,0x0000,0x0000,
  290.         0x0000,0x0000,0x0000,
  291.         0x0000,0x0000,0x0000,
  292.         0x0000,0x0000,0x0000,
  293.         0x0000,0x0000,0x0000,
  294.         0x0000,0x0000,0x0000,
  295.         0x0000,0x0000,0x0000,
  296.         0x0000,0x0000,0x0000,
  297.         0x0000,0x0000,0x0000,
  298.         0x0000,0x0000,0x0000,
  299.         0x0000,0x0000,0x0000,
  300.         0x0000,0x0000,0x0000,
  301.         0x0000,0x0000,0x0000
  302.     };
  303.  
  304.  
  305. struct Image MyImage = { 0,0,33,19,4,&Board[0],0xff,0x0,NULL };
  306.  
  307. ULONG CMap32Bit[] = { 16L<<16,
  308.                       0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,
  309.                       0x00000000,0x00000000,0x00000000,
  310.                       0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
  311.                       0x44444444,0x66666666,0xEEEEEEEE,
  312.                       0x00000000,0xEEEEEEEE,0x11111111,
  313.                       0x66666666,0x00000000,0x00000000,
  314.                       0xDDDDDDDD,0xDDDDDDDD,0x00000000,
  315.                       0x11111111,0x22222222,0xEEEEEEEE,
  316.                       0xEEEEEEEE,0x11111111,0x00000000,
  317.                       0x88888888,0x55555555,0xEEEEEEEE,
  318.                       0xDDDDDDDD,0x77777777,0x99999999,
  319.                       0x11111111,0x88888888,0x44444444,
  320.                       0xDDDDDDDD,0x44444444,0xEEEEEEEE,
  321.                       0x77777777,0xDDDDDDDD,0xAAAAAAAA,
  322.                       0x11111111,0xBBBBBBBB,0xFFFFFFFF,
  323.                       0x55555555,0x44444444,0x99999999,
  324.                       0x00000000};
  325.  
  326. UWORD CMap4Bit[] = { 0x0AAA,
  327.                      0x0000,
  328.                      0x0FFF,
  329.                      0x046E,
  330.                      0x00E1,
  331.                      0x0600,
  332.                      0x0DD0,
  333.                      0x012E,
  334.                      0x0E10,
  335.                      0x085E,
  336.                      0x0D79,
  337.                      0x0184,
  338.                      0x0D4E,
  339.                      0x07DA,
  340.                      0x01BF,
  341.                      0x0549};
  342.  
  343.  SHORT ColorLines1[] = { 0,10, 0,0, 20,0 }; 
  344.  SHORT ColorLines2[] = { 1,10, 20,10, 20,1 };
  345.  
  346. struct Border RevColorBorder[] = {
  347.   { -1,-1,1,0,JAM1,3,ColorLines1,NULL },
  348.   { -1,-1,2,0,JAM1,3,ColorLines2,&RevColorBorder[0] },
  349.  };
  350.  
  351. struct Border ColorBorder[] = {
  352.   { -1,-1,2,0,JAM1,3,ColorLines1,NULL },
  353.   { -1,-1,1,0,JAM1,3,ColorLines2,&ColorBorder[0] },
  354.  };
  355.  
  356.  
  357.  SHORT ResLines1[] = {2,-1, 2,1, -1,1};
  358.  SHORT ResLines2[] = {4,-1, -1,-1, -1,2};
  359.  SHORT ResLines3[] = {3,-1, 3,2, -1,2};
  360.  SHORT ResLines4[] = {3,-1 ,-1,-1, -1,1};
  361.  
  362. struct Border ResBorder[] = {
  363.   { -1,-1,2,0,JAM1,3,ResLines1,NULL },
  364.   { -1,-1,2,0,JAM1,3,ResLines2,&ResBorder[0] },
  365.   { -1,-1,1,0,JAM1,3,ResLines3,&ResBorder[1] },
  366.   { -1,-1,1,0,JAM1,3,ResLines4,&ResBorder[2] },
  367.  };
  368.  
  369.  
  370. struct IntuiText AcceptText = {1,0,JAM2,3,2,&MyFont,"<- Done",NULL};
  371.  
  372.  SHORT AcceptLines1[] = { 0,12, 0,0, 64,0 }; 
  373.  SHORT AcceptLines2[] = { 1,12, 64,12, 64,1 };
  374.  
  375. struct Border RevAcceptBorder[] = {
  376.   { -1,-1,1,0,JAM1,3,AcceptLines1,NULL },
  377.   { -1,-1,2,0,JAM1,3,AcceptLines2,&RevAcceptBorder[0] },
  378.  };
  379.  
  380. struct Border AcceptBorder[] = {
  381.   { -1,-1,2,0,JAM1,3,AcceptLines1,NULL },
  382.   { -1,-1,1,0,JAM1,3,AcceptLines2,&AcceptBorder[0] },
  383.  };
  384.  
  385. struct IntuiText   QuitText = {1,0,JAM2,3,2,&MyFont,"Quit Game",NULL};
  386. struct IntuiText ConfigText = {1,0,JAM2,3,2,&MyFont,"Configure",NULL};
  387. struct IntuiText DoneText = {1,0,JAM2,3,2,&MyFont,"  Done!  ",NULL};
  388. struct IntuiText NewText = {1,0,JAM2,8,2,&MyFont,"New Game",NULL};
  389. struct IntuiText AbortText = {1,0,JAM2,8,2,&MyFont," Abort! ",NULL};
  390. struct IntuiText OKText = {1,0,JAM2,8,2,&MyFont,"   OK   ",NULL};
  391. struct IntuiText CheaText = {1,0,JAM2,8,2,&MyFont," Cheat! ",NULL};
  392. struct IntuiText CheatSign = {2,0,JAM2,0,0,&MyFont,"*",NULL};
  393.  
  394.  SHORT QuitLines1[] = { 0,12, 0,0, 80,0 }; 
  395.  SHORT QuitLines2[] = { 1,12, 80,12, 80,1 };
  396.  
  397.  
  398. struct Border RevQuitBorder[] = {
  399.   { -1,-1,1,0,JAM1,3,QuitLines1,NULL },
  400.   { -1,-1,2,0,JAM1,3,QuitLines2,&RevQuitBorder[0] },
  401.  };
  402.  
  403. struct Border QuitBorder[] = {
  404.   { -1,-1,2,0,JAM1,3,QuitLines1,NULL },
  405.   { -1,-1,1,0,JAM1,3,QuitLines2,&QuitBorder[0] },
  406.  };
  407.  
  408.  
  409.  SHORT BigConfLines1[] = { 0,70, 0,0, 175,0 }; 
  410.  SHORT BigConfLines2[] = { 1,70, 175,70, 175,1 };
  411.  
  412. struct Border BigConfBorder[] = {
  413.   { -2,-5,2,0,JAM1,3,BigConfLines1,NULL },
  414.   { -2,-5,1,0,JAM1,3,BigConfLines2,&BigConfBorder[0] },
  415.  };
  416.  
  417.  
  418.  SHORT ConfLines1[] = {0,12, 0,-1, 30,-1};
  419.  SHORT ConfLines2[] = {1,11, 29,11, 29,0};
  420.  SHORT ConfLines3[] = {1,11, 1,0, 29,0};
  421.  SHORT ConfLines4[] = {1,12, 30,12, 30,0};
  422.  
  423. struct Border ConfBorder[] = {
  424.   { -4,-2,2,0,JAM1,3,ConfLines1,NULL },
  425.   { -4,-2,2,0,JAM1,3,ConfLines2,&ConfBorder[0] },
  426.   { -4,-2,1,0,JAM1,3,ConfLines3,&ConfBorder[1] },
  427.   { -4,-2,1,0,JAM1,3,ConfLines4,&ConfBorder[2] },
  428.  };
  429.  
  430.  
  431. struct IntuiText   crText = {1,0,JAM2,3,-1,&MyFont,
  432.                   "You Guess      Colors",NULL};
  433.  
  434. struct IntuiText   cmText = {1,0,JAM2,35,14,&MyFont,
  435.                       "Among      Colors",&crText};
  436.  
  437. struct IntuiText   rwText = {1,0,JAM2,3,30,&MyFont,
  438.                   "In At Most     Tries",&cmText};
  439.  
  440.  
  441. UBYTE crbuf[4],cmbuf[4],rwbuf[4];
  442. UBYTE crunbuf[4],cmunbuf[4],rwunbuf[4];
  443.  
  444. struct StringInfo cminfo = { cmbuf,cmunbuf,0,3,};
  445. struct StringInfo crinfo = { crbuf,crunbuf,0,3,};
  446. struct StringInfo rwinfo = { rwbuf,rwunbuf,0,3,};
  447.  
  448.  
  449. struct MD
  450. {
  451.  LONG RandomColor;
  452.  LONG GuessedColor;
  453. } MyData;
  454.  
  455. struct Gadget BoardGadget = { 
  456.   NULL,0,0,33,19,GFLG_GADGHNONE,GACT_RELVERIFY,
  457.   GTYP_BOOLGADGET,NULL,NULL,NULL,NULL,NULL,1,&MyData };
  458.  
  459. struct Gadget ColorGadget = {
  460.    NULL,0 ,0,20,10,GFLG_GADGHIMAGE,
  461.    GACT_RELVERIFY|GACT_TOGGLESELECT,GTYP_BOOLGADGET,
  462.    &ColorBorder[1],&RevColorBorder[1],NULL,NULL,NULL,100,NULL }; 
  463.  
  464. struct Gadget AcceptGadget = {
  465.    NULL,0,0,63,12,GFLG_GADGHIMAGE,GACT_RELVERIFY,GTYP_BOOLGADGET,
  466.    &AcceptBorder[1],&RevAcceptBorder[1],&AcceptText,NULL,NULL,300,NULL };
  467.  
  468. struct Gadget CheatGadget = {
  469.    &AcceptGadget,0,0,80,12,GFLG_GADGHIMAGE,GACT_RELVERIFY,GTYP_BOOLGADGET,
  470.    &QuitBorder[1],&RevQuitBorder[1],&CheaText,NULL,NULL,500,NULL }; 
  471.  
  472. struct Gadget QuitGadget = {
  473.    &CheatGadget,0,0,80,12,GFLG_GADGHIMAGE,GACT_RELVERIFY,GTYP_BOOLGADGET,
  474.    &QuitBorder[1],&RevQuitBorder[1],&QuitText,NULL,NULL,501,NULL };
  475.  
  476. struct Gadget NewGadget = {
  477.    &QuitGadget,0,0,80,12,GFLG_GADGHIMAGE,GACT_RELVERIFY,GTYP_BOOLGADGET,
  478.    &QuitBorder[1],&RevQuitBorder[1],&NewText,NULL,NULL,502,NULL }; 
  479.  
  480. struct Gadget ConfiGadget = {
  481.    &NewGadget,0,0,80,12,GFLG_GADGHIMAGE,GACT_RELVERIFY,GTYP_BOOLGADGET,
  482.    &QuitBorder[1],&RevQuitBorder[1],&ConfigText,NULL,NULL,503,NULL }; 
  483.  
  484. struct Gadget CMGadget = {
  485.    NULL,0,0,28,8,GFLG_GADGHCOMP,GACT_LONGINT|GACT_RELVERIFY,
  486.    GTYP_STRGADGET,NULL,NULL,NULL,NULL,&cminfo,1000,NULL }; 
  487.  
  488.  struct Gadget CRGadget = {
  489.    &CMGadget,0,0,28,8,GFLG_GADGHCOMP,GACT_LONGINT|GACT_RELVERIFY,
  490.    GTYP_STRGADGET,NULL,NULL,NULL,NULL,&crinfo,1001,NULL }; 
  491.  
  492. struct Gadget RWGadget = {
  493.    &CRGadget,0,0,28,8,GFLG_GADGHCOMP,GACT_LONGINT|GACT_RELVERIFY,
  494.    GTYP_STRGADGET,NULL,NULL,NULL,NULL,&rwinfo,1002,NULL }; 
  495.  
  496.  
  497.  
  498. #define UserWon     0
  499. #define GameDone    3
  500. #define ChooseCol   6
  501. #define AfterDone   9
  502. #define ChangeConf  12
  503. #define RepColoring 15
  504. #define Colorize    18
  505. #define CheatMe     21
  506. #define NoAvailMem  24
  507. #define FillFirst   27
  508. #define NoRep       30
  509. #define Visitors    33
  510.  
  511.  
  512. UBYTE *Messages[] = 
  513. {
  514.  "Congratulations!    ",
  515.  "You won.            ",
  516.  "Click on OK gadget. ",
  517.  
  518.  "You lost!  See  the ",
  519.  "correct setting,then",
  520.  "close the window.   ",
  521.  
  522.  "Choose a color, then",
  523.  "click on the desired",
  524.  "position.           ",
  525.  
  526.  "Saw the results?    ",
  527.  "Go on with the next ",
  528.  "row.                ",
  529.  
  530.  "Change Configuration",
  531.  "then click on Done! ",
  532.  "to affect the board.",
  533.  
  534.  "Repeat  this  until ",
  535.  "all the row has been",
  536.  "colored.            ",
  537.  
  538.  "Colorize the place  ",
  539.  "you like, but  use  ",
  540.  "each color only once",
  541.  
  542.  "This color is among ",
  543.  "the ones the  Amiga ",
  544.  "has chosen!         ",
  545.  
  546.  "Can  not  allocate  ",
  547.  "memory!!!. Quitting ",
  548.  "in 6 seconds...     ",
  549.  
  550.  "First  fill a  row, ",
  551.  "then click on Done. ",
  552.  "                    ",
  553.  "But I told you  not ",
  554.  "to use a color more ",
  555.  "than once!          ", 
  556.  
  557.  "Guest Windows Found!",
  558.  "Close  all of  them,",
  559.  "then try again!     ",
  560.  }; 
  561.  
  562.  SHORT MessLines1[] = {0,40, 0,0, 175,0};
  563.  SHORT MessLines2[] = {1,39, 174,39, 174,0};
  564.  SHORT MessLines3[] = {1,39, 1,1, 174,1};
  565.  SHORT MessLines4[] = {1,40, 175,40, 175,0};
  566.  
  567. struct Border MessBorder[] = {
  568.   { -4,-2,2,0,JAM1,3,MessLines1,NULL },
  569.   { -4,-2,2,0,JAM1,3,MessLines2,&MessBorder[0] },
  570.   { -4,-2,1,0,JAM1,3,MessLines3,&MessBorder[1] },
  571.   { -4,-2,1,0,JAM1,3,MessLines4,&MessBorder[2] },
  572.  };
  573.  
  574. UBYTE Row1[24],Row2[24],Row3[24];
  575.  
  576. struct IntuiText   row1Text = {1,0,JAM2,3,0,&MyFont,Row1,NULL};
  577.  
  578. struct IntuiText   row2Text = {1,0,JAM2,3,12,&MyFont,Row2,&row1Text};
  579.  
  580. struct IntuiText   row3Text = {1,0,JAM2,3,24,&MyFont,Row3,&row2Text};
  581.  
  582.  
  583.  SHORT CoLines1[] = {0,16, 0,0, -1,0};
  584.  SHORT CoLines2[] = {1,15, -2,15, -2,0};
  585.  SHORT CoLines3[] = {1,15, 1,1, -2,1};
  586.  SHORT CoLines4[] = {1,16, -1,16, -1,0};
  587.  
  588. struct Border ColBorder[] = {
  589.   { -4,-2,2,0,JAM1,3,CoLines1,NULL },
  590.   { -4,-2,2,0,JAM1,3,CoLines2,&ColBorder[0] },
  591.   { -4,-2,1,0,JAM1,3,CoLines3,&ColBorder[1] },
  592.   { -4,-2,1,0,JAM1,3,CoLines4,&ColBorder[2] },
  593.  };
  594.