home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff214.lzh / MandelVroom / src / presets.c < prev    next >
C/C++ Source or Header  |  1989-05-30  |  28KB  |  955 lines

  1. /*
  2.  * MandelVroom 2.0
  3.  *
  4.  * (c) Copyright 1987,1989  Kevin L. Clague, San Jose, CA
  5.  *
  6.  * All rights reserved.
  7.  *
  8.  * Permission is hereby granted to distribute this program's source
  9.  * executable, and documentation for non-comercial purposes, so long as the
  10.  * copyright notices are not removed from the sources, executable or
  11.  * documentation.  This program may not be distributed for a profit without
  12.  * the express written consent of the author Kevin L. Clague.
  13.  *
  14.  * This program is not in the public domain.
  15.  *
  16.  * Fred Fish is expressly granted permission to distribute this program's
  17.  * source and executable as part of the "Fred Fish freely redistributable
  18.  * Amiga software library."
  19.  *
  20.  * Permission is expressly granted for this program and it's source to be
  21.  * distributed as part of the Amicus Amiga software disks, and the
  22.  * First Amiga User Group's Hot Mix disks.
  23.  *
  24.  * contents: this file contains the functions to create and initialize
  25.  * a preset project selected by the user.
  26.  */
  27.  
  28. #include "mandp.h"
  29.  
  30. #define NUMPRESETS 10
  31.  
  32. extern struct NewScreen NewScreen;
  33.  
  34. struct Preset {
  35.   char   *Name;
  36.   int     Type;
  37.   double  StartX, StartY, EndX, EndY;
  38.   SHORT   CountX, CountY;
  39.   SHORT   MaxCount;
  40.   UBYTE   MandType;
  41.   USHORT  ViewModes;
  42.   USHORT  Depth;
  43.   ULONG   BorderType;
  44.   SHORT  *ColorMap;
  45.   SHORT   NumContours;
  46.   USHORT *Contours;
  47.   UBYTE  *Pens;
  48. };
  49.  
  50.  
  51. extern int Num_vp_Colors;
  52.  
  53. extern struct Preset Preset[];
  54.  
  55. extern USHORT NewViewModes;
  56. extern UBYTE  NewDepth;
  57.  
  58. DefaultColors()
  59. {
  60.   LoadRGB4( vp, Preset[0].ColorMap, Num_vp_Colors );
  61. }
  62.  
  63. /*
  64.  * Generate a preset picture
  65.  */
  66. ClonePict( Pict, Type )
  67.   register struct Picture *Pict;
  68.   register SHORT Type;
  69. {
  70.   register struct Picture *ClonedPict;
  71.   struct Picture *NewPict();
  72.  
  73.   extern int Num_vp_Colors;
  74.  
  75.   if ( (ClonedPict = NewPict( Type )) == NULL ) {
  76.     ErrNoPict();
  77.     return;
  78.   }
  79.  
  80.   CopyPict( ClonedPict, Pict );
  81.  
  82.   strcpy(ClonedPict->Title,Pict->Title);
  83.  
  84.   ClonedPict->Flags = 0;
  85.   ClonedPict->ZoomType == GENPENDSTATE;
  86.  
  87.   if ( Pict->pNode.ln_Type != Type ) {
  88.  
  89.     if ( Type == JULIAPICT ) {
  90.       ClonedPict->Real     = Pict->RealLow;
  91.       ClonedPict->Imag     = Pict->ImagLow;
  92.       InitJulia( ClonedPict );
  93.  
  94.     } else {
  95.       InitMand( ClonedPict );
  96.     }
  97.   }
  98.  
  99.   if ( OpenPicture( ClonedPict ) != 0 ) {
  100.     ThrowPict( ClonedPict );
  101.   }
  102.  
  103.   GetCurPict();
  104. }
  105.  
  106. ErrNoPict()
  107. {
  108.   DispErrMsg( "Can't Allocate Picture.",0);
  109. }
  110.  
  111. CopyPict( DstPict, SrcPict )
  112.   register struct Picture *DstPict;
  113.   register struct Picture *SrcPict;
  114. {
  115.   movmem( &SrcPict->Real, &DstPict->Real, sizeof(struct Picture)-
  116.           ((char *) &SrcPict->Real - (char *) SrcPict) );
  117. }
  118.  
  119. /*
  120.  * Generate a preset picture
  121.  */
  122. int
  123. SetPreset(Number)
  124.   int Number;
  125. {
  126.   return( NewPreset( Number, Preset[Number].Type ));
  127. }
  128.  
  129. /*
  130.  * Generate a preset picture
  131.  */
  132. int
  133. NewPreset(Number, Type)
  134.   int Number;
  135.   int Type;
  136. {
  137.   register struct Picture *Pict;
  138.  
  139.   struct Picture *NewPict();
  140.  
  141.   extern int Num_vp_Colors;
  142.  
  143.   if ( (Pict = NewPict( Type )) == NULL ) {
  144.     ErrNoPict();
  145.     return(UNSUCCESSFUL);
  146.   }
  147.  
  148.   if (Number == -1) {
  149.     InitPreset( 0, Pict );
  150.  
  151. #define VIEW_MODE_MASK (HIRES|INTERLACE|EXTRA_HALFBRITE)
  152.  
  153.     Pict->ViewModes = NewViewModes = screen->ViewPort.Modes & VIEW_MODE_MASK;
  154.     Pict->Depth     = NewDepth     = screen->BitMap.Depth;
  155.  
  156.     if ( OpenPicture( Pict ) != 0 ) {
  157.  
  158.       ThrowPict( Pict );
  159.       return(UNSUCCESSFUL);
  160.  
  161.     }
  162.   } else {
  163.     InitPreset( Number, Pict );
  164.  
  165.     if (MaybeNewScreen() == 0) {
  166.  
  167.       if ( OpenPicture( Pict ) != 0 ) {
  168.  
  169.         ThrowPict( Pict );
  170.         return(UNSUCCESSFUL);
  171.  
  172.       } else {
  173.  
  174.         Generate( Pict );
  175.       }
  176.     }
  177.   }
  178.   GetCurPict();
  179.  
  180.   if (CurPict)
  181.     LoadRGB4( vp, CurPict->RGBs, Num_vp_Colors );
  182.  
  183.   return(SUCCESSFUL);
  184. }
  185.  
  186. InitJulia( Pict )
  187.   register struct Picture *Pict;
  188. {
  189.   double JCountX, JCountY;
  190.  
  191.   double AspectRatio();
  192.  
  193.   JCountX        = (double) Pict->CountX;
  194.   JCountY        = (double) Pict->CountY;
  195.  
  196.   Pict->ImagLow  = -1.0;
  197.   Pict->ImagHigh =  1.0;
  198.  
  199.   Pict->RealLow  =  Pict->ImagLow * AspectRatio() * JCountX / JCountY;
  200.   Pict->RealHigh = -Pict->RealLow;
  201. }
  202.  
  203. /*
  204.  * Set up system from preset list
  205.  */
  206. InitPreset(Number, Pict)
  207.   int Number;
  208.   register struct Picture *Pict;
  209. {
  210.   register LONG  i;
  211.  
  212.   register struct Preset  *CurPreset;
  213.  
  214.   register SHORT  *CurColors;
  215.   register USHORT *CurContours;
  216.   register UBYTE  *CurPens;
  217.  
  218.   register struct Node *pNode = (struct Node *) Pict;
  219.  
  220.   extern USHORT NewViewModes;
  221.   extern UBYTE  NewDepth;
  222.  
  223.   if (Pict == NULL) {
  224.     DispErrMsg("Initing NULL Pict",0);
  225.     return(0);
  226.   }
  227.  
  228.   if (Number < NUMPRESETS) {
  229.  
  230.     Pict->GenState = GENPENDSTATE;
  231.  
  232.     FreeCounts( Pict );
  233.  
  234.     CurPreset = &Preset[Number];
  235.  
  236.     sprintf(Pict->Title,"* %s",CurPreset->Name);
  237.  
  238.     Pict->CountX = CurPreset->CountX;
  239.     Pict->CountY = CurPreset->CountY;
  240.  
  241.     if ( pNode->ln_Type == JULIAPICT ) {
  242.  
  243.       Pict->Real     = CurPreset->StartX;
  244.       Pict->Imag     = CurPreset->StartY;
  245.  
  246.       InitJulia( Pict );
  247.  
  248.     } else {
  249.       Pict->RealLow  = CurPreset->StartX;
  250.       Pict->ImagLow  = CurPreset->StartY;
  251.       Pict->RealHigh = CurPreset->EndX;
  252.       Pict->ImagHigh = CurPreset->EndY;
  253.     }
  254.  
  255.     Pict->MaxIteration = CurPreset->MaxCount;
  256.  
  257.     Pict->MathMode = CurPreset->MandType;
  258.  
  259.     Pict->ViewModes = CurPreset->ViewModes;
  260.     Pict->Depth     = CurPreset->Depth;
  261.  
  262.     if ( Number != 0 ) {
  263.       NewViewModes = CurPreset->ViewModes;
  264.       NewDepth = CurPreset->Depth;
  265.     }
  266.  
  267.     CurColors = CurPreset->ColorMap;
  268.  
  269.     for (i = 0; i < 32; i++) {
  270.       Pict->RGBs[i] = *CurColors++;
  271.     }
  272.  
  273.     CurContours = CurPreset->Contours;
  274.     CurPens = CurPreset->Pens;
  275.  
  276.     for (i = 0; i < CurPreset->NumContours; i++) {
  277.       *(Pict->Heights + i) = *CurContours++;
  278.       *(Pict->Pens + i) = *CurPens++;
  279.     }
  280.  
  281.     for ( ; i < NumContours; i++ ) {
  282.       *(Pict->Heights + i) = 0;
  283.       *(Pict->Pens + i) = NORMALPEN;
  284.     }
  285.  
  286.     MakeColorXlate( Pict );
  287.  
  288.     CalculateGaps( Pict );
  289.  
  290.     return(0);
  291.   } else {
  292.     DispErrMsg("Invalid Preset",0);
  293.     return(1);
  294.   }
  295. }
  296.  
  297. /**************************************************************************
  298.  *
  299.  *  Preset arrays for generating pictures
  300.  *
  301.  *************************************************************************/
  302.  
  303. SHORT big_brotPalette[] =
  304. {
  305.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0114,  0x0225,  0x0337,  0x0448,
  306.   0x055a,  0x066b,  0x077c,  0x088e,  0x099f,  0x0bbf,  0x0ccf,  0x0eef,
  307.   0x0fff,  0x0eee,  0x0dde,  0x0ccd,  0x0ccd,  0x0bbc,  0x0aab,  0x099b,
  308.   0x088a,  0x077a,  0x0669,  0x0558,  0x0558,  0x0447,  0x0337,  0x0226
  309. };
  310. USHORT big_brotHeights[] =
  311. {
  312.   128,
  313.   29,19, 13,  10, 9,  8,  7,  6,
  314.   5,  4,  3,  2,  1,  0,  0,  0,
  315.   0,  0,  0,  0,  0,  0,  0,  0,
  316.   0,  0,  0,  0,  0,  0,  0,  0,
  317. };
  318. UBYTE big_brotPens[] =
  319. {
  320.   0,  16,  17,  18,  19,  20,  21,  22,
  321.   23,  24,  25,  26,  27,  28,  29,  30,
  322.   31,  4,  5,  6,  7,  8,  9,  10,
  323.   11,  12,  13,  14,  15,  16,  17,  18,
  324.   19,  20,  21,  22,  23,  24,  25,  26,
  325.   27,  28,  29,  30,  31,  4,  1,  1,
  326. };
  327.  
  328. SHORT Hey_BabyPalette[] =
  329. {
  330.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0c9b,  0x0b6a,  0x0a49,  0x0927,
  331.   0x0806,  0x0716,  0x0727,  0x0637,  0x0658,  0x0568,  0x0579,  0x0489,
  332.   0x0000,  0x0fff,  0x0dee,  0x0bcd,  0x09bc,  0x06aa,  0x0499,  0x0278,
  333.   0x0067,  0x059a,  0x0acc,  0x0fff,  0x0bdd,  0x08bb,  0x0489,  0x0067
  334. };
  335.  
  336. USHORT Hey_BabyHeights[] =
  337. {
  338.   1023,  247,  220,  193,  167,  160,  154,  147,
  339.   141,  134,  128,  122,  115,  110,  106,  102,
  340.   98,  93,  89,  85,  81,  77,  74,  73,
  341.   72,  71,  70,  69,  68,  67,  66,  65
  342. };
  343.  
  344. UBYTE Hey_BabyPens[] =
  345. {
  346.   0,  1,  2,  3,  4,  5,  6,  7,
  347.   8,  9,  10,  11,  12,  13,  14,  15,
  348.   30,  29,  28,  27,  26,  25,  24,  23,
  349.   22,  21,  20,  19,  18,  17,  20,  23
  350. };
  351.  
  352. SHORT coverPalette[] =
  353. {
  354.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0f58,  0x0f46,  0x0e46,  0x0d35,
  355.   0x0c35,  0x0b34,  0x0a33,  0x0923,  0x0822,  0x0611,  0x0511,  0x0400,
  356.   0x0fe7,  0x0f9d,  0x0f8c,  0x0f7a,  0x009f,  0x0ade,  0x0cee,  0x009f,
  357.   0x03af,  0x05bf,  0x05bd,  0x09de,  0x0ade,  0x0cee,  0x09cd,  0x06bc
  358. };
  359. USHORT coverHeights[] =
  360. {
  361.   1023,  111, 106,  96,  86,  76,  75,  74,
  362.   73,  72,  71,  70,  69,  68,  67,  66,
  363.   65,  64,  62,  61,  60,  59,  58,  57,
  364.   48,  47,  46,  45,  42,  39,  36,  35,
  365.   34,  33,  32,  31,  30,  29,  28,  27,
  366.   26,  25,  24,  23,  22,  21,  20,  19,
  367.   18,  17,  16,  15,  14,  13,  12,  11,
  368.   10,  14,  13,  12,  11,  10,  9,  8,
  369.   3,  0,  0,  0,  0,  0,  0,  0,
  370. };
  371. UBYTE coverPens[] =
  372. {
  373.   0,  16,  17,  18,  4,  5,  6,  7,
  374.   8,  9,  10,  11,  12,  13,  14,  15,
  375.   17,  17,  18,  19,  4,  5,  6,  7,
  376.   8,  9,  10,  11,  12,  13,  14,  15,
  377.   15,  14,  13,  12,  11,  10,  8,  7,
  378.   6,  5,  4,  19,  18,  17,  11,  10,
  379.   9,  8,  7,  6,  5,  4,  19,  18,
  380.   1,  1,  1,  1,  1,  1,  1,  1,
  381.   1,  1,  1,  1,  1,  1,  1,  1,
  382. };
  383.  
  384. SHORT sea_horsePalette[] =
  385. {
  386.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0fff,  0x0bbb,  0x0888,  0x0444,
  387.   0x0000,  0x0002,  0x0003,  0x0005,  0x0006,  0x0007,  0x0009,  0x000a,
  388.   0x002a,  0x003a,  0x0059,  0x0003,  0x0020,  0x0030,  0x0040,  0x0040,
  389.   0x0050,  0x0060,  0x0050,  0x0040,  0x0030,  0x0020,  0x0010,  0x0fff
  390. };
  391. USHORT sea_horseHeights[] =
  392. {
  393.   1023,  635,  542,  449,  356,  263,  171,  145,
  394.   142,  140,  139,  138,  137,  136,  135,  134,
  395.   133,  132,  131,  130,  129,  128,  127,  126,
  396.   125,  124,  123,  122,  121,  120,  119,  118,
  397.   117,  116,  115,  114,  113,  112,  111,  110,
  398.   109,  108,  107,  106,  105,  104,  103,  102,
  399.   101,  100,  99,  98,  97,  96,  95,  94,
  400.   93,  92,  91,  90,  89,  88,  87,  86,
  401.   85,  84,  83,  82,  81,  80,  79,  78,
  402.   77,  76,  75,  74,  73,  72,  71,  70,
  403.   69,  68,  67,  66,  65,  64,  63,  62,
  404.   61,  60,  59,  58,  57,  56,  55,  54,
  405.   53,  52,  51,  50,  49,  48,  47,  46,
  406.   45,  44,  43,  42,  41,  40,  39,  38,
  407.   37,  36,  35,  34,  33,  32,  31,  30,
  408.   29,  28,  27,  26,  25,  24,  23,  22,
  409.   21,  20,  19,  18,  17,  16,  15,  14,
  410.   13,  12,  11,  10,  9,  8,  7,  6,
  411.   5,  4,  3,  2,  1,  0,  0,  0,
  412. };
  413. UBYTE sea_horsePens[] =
  414. {
  415.   0,  7,  6,  5,  4,  4,  5,  6,
  416.   7,  8,  10,  20,  11,  21,  12,  22,
  417.   13,  23,  14,  24,  15,  25,  16,  26,
  418.   17,  27,  18,  28,  17,  29,  16,  30,
  419.   15,  20,  14,  21,  13,  22,  12,  23,
  420.   11,  24,  10,  25,  10,  26,  11,  27,
  421.   12,  28,  13,  29,  14,  30,  15,  20,
  422.   16,  21,  17,  22,  18,  23,  17,  24,
  423.   16,  25,  15,  26,  14,  27,  13,  28,
  424.   12,  29,  11,  30,  10,  20,  10,  21,
  425.   11,  22,  12,  23,  13,  24,  14,  25,
  426.   15,  26,  16,  27,  17,  28,  18,  29,
  427.   17,  30,  16,  20,  15,  21,  14,  22,
  428.   13,  23,  12,  24,  11,  25,  10,  26,
  429.   10,  27,  11,  28,  12,  29,  13,  30,
  430.   14,  20,  15,  21,  16,  22,  17,  23,
  431.   18,  24,  17,  25,  16,  26,  15,  27,
  432.   14,  28,  13,  29,  12,  30,  11,  20,
  433.   10,  21,  10,  22,  11,  23,  12,  1,
  434. };
  435.  
  436. SHORT golden_dragonPalette[] =
  437. {
  438.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0f93,  0x0e83,  0x0c73,  0x0b53,
  439.   0x0943,  0x0732,  0x0411,  0x0200,  0x0310,  0x0410,  0x0520,  0x0720,
  440.   0x0850,  0x0930,  0x0c80,  0x0fb0,  0x0620,  0x0510,  0x0310,  0x0200,
  441.   0x0521,  0x0742,  0x0a63,  0x0c84,  0x0a63,  0x0742,  0x0521,  0x0200
  442. };
  443. USHORT golden_dragonHeights[] =
  444. {
  445.   1023,  353,  316,  279,  274,  270,  266,  261,
  446.   257,  253,  249,  226,  224,  222,  220,  219,
  447.   217,  215,  213,  212,  210,  208,  207,  195,
  448.   194,  193,  192,  191,  190,  189,  188,  187,
  449.   186,  185,  184,  183,  182,  181,  180,  179,
  450.   178,  177,  176,  175,  174,  173,  172,  171,
  451.   170,  169,  168,  167,  166,  165,  164,  163,
  452.   162,  161,  160,  159,  158,  157,  156,  155,
  453.   154,  153,  152,  151,  150,  149,  148,  147,
  454.   146,  145,  144,  0,    0,    0,    0,    0,
  455. };
  456. UBYTE golden_dragonPens[] =
  457. {
  458.   0,  4,  5,  6,  7,  8,  9,  10,
  459.   11,  12,  14,  14,  15,  16,  17,  18,
  460.   19,  20,  21,  22,  23,  24,  25,  26,
  461.   27,  28,  29,  30,  23,  24,  25,  26,
  462.   27,  28,  29,  30,  23,  24,  25,  26,
  463.   27,  28,  29,  30,  23,  24,  25,  26,
  464.   27,  28,  29,  30,  23,  24,  25,  26,
  465.   27,  28,  29,  30,  23,  24,  25,  26,
  466.   27,  28,  29,  30,  13,  24,  25,  26,
  467.   27,  28,  29,  13,  1,  1,  1,  1,
  468. };
  469.  
  470. SHORT dual_spiralPalette[] =
  471. {
  472.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0bbb,  0x0999,  0x0777,  0x0555,
  473.   0x0333,  0x0246,  0x0357,  0x0468,  0x0479,  0x058b,  0x068c,  0x079d,
  474.   0x0fff,  0x0eee,  0x0ccc,  0x0fd0,  0x0246,  0x0357,  0x0468,  0x079d,
  475.   0x068c,  0x068b,  0x057a,  0x057a,  0x0469,  0x0358,  0x0357,  0x0246
  476. };
  477. USHORT dual_spiralHeights[] =
  478. {
  479.   1023,  283,  271,  260,  249,  238,  226,  225,
  480.   224,  223,  222,  221,  220,  219,  218,  217,
  481.   216,  215,  214,  213,  212,  211,  210,  209,
  482.   208,  207,  206,  205,  204,  203,  202,  201,
  483.   200,  199,  198,  197,  196,  195,  194,  193,
  484.   192,  191,  190,  189,  188,  187,  186,  185,
  485.   184,  183,  182,  181,  180,  179,  178,  177,
  486.   176,  175,  174,  173,  172,  171,  170,  169,
  487.   168,  167,  166,  165,  164,  163,  162,  161,
  488.   160,  159,  158,  157,  156,  155,  154,  153,
  489.   152,  151,  150,  149,  148,  147,  146,  145,
  490.   144,  143,  142,  141,  140,  139,  138,  137,
  491.   136,  135,  134,  133,  132,  131,  130,  129,
  492.   128,  127,  126,  125,  124,  123,  122,  121,
  493.   120,  119,  118,  117,  116,  115,  114,  113,
  494.   112,  111,  110,  109,  108,  107,  106,  105,
  495.   104,  103,  102,  101,  100,  99,  98,  97,
  496.   96,  95,  94,  93,  92,  91,  90,  89,
  497.   88,  87,  86,  85,  84,  83,  82,  81,
  498.   80,  79,  78,  77,  76,  75,  74,  73,
  499.   72,  71,  70,  69,  68,  67,  66,  65,
  500.   64,  63,  62,  61,  60,  59,  58,  57,
  501.   56,  55,  54,  53,  52,  51,  50,  49,
  502.   48,  47,  46,  45,  44,  43,  42,  41,
  503.   40,  39,  38,  37,  36,  35,  34,  33,
  504.   32,  31,  30,  29,  28,  27,  26,  25,
  505.   24,  23,  22,  21,  20,  19,  18,  17,
  506.   16,  15,  14,  13,  12,  11,  10,  9,
  507.   8,  7,  6,  5,  4,  3,  2,  1,
  508.   0,  0,  0,  0,  0,  0,  0,  0,
  509. };
  510. UBYTE dual_spiralPens[] =
  511. {
  512.   0,  16,  17,  18,  5,  6,  7,  31,
  513.   30,  29,  28,  27,  26,  25,  24,  23,
  514.   24,  25,  26,  27,  28,  29,  30,  31,
  515.   30,  29,  28,  27,  26,  25,  24,  23,
  516.   24,  25,  26,  27,  28,  29,  30,  31,
  517.   31,  30,  29,  28,  27,  26,  25,  24,
  518.   23,  24,  25,  26,  27,  28,  29,  30,
  519.   31,  31,  30,  29,  28,  27,  26,  25,
  520.   24,  23,  24,  25,  26,  27,  28,  29,
  521.   30,  31,  31,  30,  29,  28,  27,  26,
  522.   25,  24,  23,  24,  25,  26,  27,  28,
  523.   29,  30,  31,  31,  30,  29,  28,  27,
  524.   26,  25,  24,  23,  24,  25,  26,  27,
  525.   28,  29,  30,  31,  31,  30,  29,  28,
  526.   27,  26,  25,  24,  23,  24,  25,  26,
  527.   27,  28,  29,  30,  31,  31,  30,  29,
  528.   28,  27,  26,  25,  24,  23,  24,  25,
  529.   26,  27,  28,  29,  30,  31,  31,  30,
  530.   29,  28,  27,  26,  25,  24,  23,  24,
  531.   25,  26,  27,  28,  29,  30,  31,  31,
  532.   30,  29,  28,  27,  26,  25,  24,  23,
  533.   24,  25,  26,  27,  28,  29,  30,  31,
  534.   31,  30,  29,  28,  27,  26,  25,  24,
  535.   23,  24,  25,  26,  27,  28,  29,  30,
  536.   31,  31,  30,  29,  28,  27,  26,  25,
  537.   24,  23,  24,  25,  26,  27,  28,  29,
  538.   30,  31,  31,  30,  29,  28,  27,  26,
  539.   25,  24,  23,  24,  25,  26,  27,  28,
  540.   29,  30,  31,  31,  30,  29,  28,  27,
  541.   26,  25,  24,  23,  24,  25,  26,  27,
  542. };
  543.  
  544. SHORT halfbritePalette[] =
  545. {
  546.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0edd,  0x0dcc,  0x0dcc,  0x0cbb,
  547.   0x0cbb,  0x0baa,  0x0baa,  0x0a99,  0x0a99,  0x0988,  0x0988,  0x0877,
  548.   0x0445,  0x0fee,  0x0edd,  0x0dcc,  0x0cbb,  0x0a99,  0x0988,  0x0877,
  549.   0x0e95,  0x0d84,  0x0d83,  0x0c73,  0x0b62,  0x0a51,  0x0a41,  0x0940
  550. };
  551. USHORT halfbriteHeights[] =
  552. {
  553.   1023,  355,  333,  311,  289,  267,  245,  223,
  554.   201,  179,  173,  167,  161,  155,  149,  143,
  555.   137,  131,  125,  119,  113,  107,  101,  95,
  556.   94,  93,  92,  91,  90,  89,  88,  87,
  557.   86,  85,  84,  83,  82,  81,  80,  79,
  558.   78,  77,  76,  75,  74,  73,  72,  71,
  559.   70,  69,  68,  67,  66,  65,  64,  63,
  560.   62,  61,  60,  59,  58,  57,  56,  55,
  561.   54,  53,  52,  51,  50,  49,  48,  47,
  562.   46,  45,  44,  43,  42,  41,  40,  39,
  563.   38,  37,  36,  35,  34,  33,  32,  31,
  564.   30,  29,  28,  27,  26,  25,  24,  23,
  565.   22,  21,  20,  19,  18,  17,  16,  15,
  566.   14,  13,  12,  11,  10,  9,  8,  7,
  567.   6,  5,  4,  3,  2,  1,  0,  0,
  568. };
  569. UBYTE halfbritePens[] =
  570. {
  571.   17,  63,  62,  61,  60,  59,  58,  57,
  572.   56,  31,  30,  29,  28,  27,  26,  25,
  573.   24,  25,  26,  27,  28,  29,  30,  31,
  574.   56,  57,  58,  59,  60,  61,  62,  63,
  575.   55,  54,  53,  52,  51,  50,  49,  23,
  576.   22,  21,  20,  19,  18,  17,  18,  19,
  577.   20,  21,  22,  23,  49,  50,  51,  52,
  578.   53,  54,  55,  47,  46,  45,  44,  43,
  579.   42,  41,  40,  39,  38,  37,  36,  34,
  580.   15,  14,  13,  12,  11,  10,  9,  8,
  581.   7,  6,  5,  4,  5,  6,  7,  8,
  582.   9,  10,  11,  12,  13,  14,  15,  34,
  583.   36,  37,  38,  39,  40,  41,  42,  43,
  584.   44,  45,  46,  47,  47,  47,  46,  45,
  585.   44,  43,  42,  41,  40,  39,  38,  37,
  586. };
  587.  
  588. SHORT Valley_GalPalette[] =
  589. {
  590.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x099f,  0x077c,  0x055a,  0x0337,
  591.   0x0114,  0x0225,  0x0446,  0x0557,  0x0668,  0x0779,  0x099a,  0x0aab,
  592.   0x0bbc,  0x0ccd,  0x0eee,  0x0fff,  0x0eee,  0x0dde,  0x0ccd,  0x0bbc,
  593.   0x0aab,  0x099b,  0x077a,  0x0669,  0x0558,  0x0448,  0x0337,  0x0226
  594. };
  595. USHORT Valley_GalHeights[] =
  596. {
  597.   1023,  182,  137,  126,  115,  105,  94,  83,
  598.   73,  72,  71,  70,  69,  68,  67,  66,
  599.   65,  64,  63,  62,  61,  60,  59,  58,
  600.   57,  56,  55,  54,  53,  52,  51,  50,
  601.   49,  48,  47,  46,  45,  44,  43,  42,
  602.   41,  40,  39,  38,  37,  36,  35,  34,
  603.   33,  32,  31,  30,  29,  28,  27,  26,
  604.   25,  24,  23,  22,  21,  20,  19,  18,
  605.   17,  16,  15,  14,  13,  12,  11,  10,
  606.   9,  8,  7,  6,  5,  4,  3,  2,
  607.   1,  0,  0,  0,  0,  0,  0,  0,
  608. };
  609. UBYTE Valley_GalPens[] =
  610. {
  611.   0,  17,  15,  14,  13,  12,  11,  10,
  612.   9,  8,  8,  9,  10,  11,  12,  13,
  613.   14,  15,  16,  17,  18,  19,  20,  21,
  614.   22,  23,  24,  25,  26,  27,  28,  29,
  615.   30,  8,  9,  10,  11,  12,  13,  14,
  616.   15,  16,  17,  18,  19,  20,  21,  22,
  617.   23,  24,  25,  26,  27,  28,  29,  30,
  618.   8,  9,  10,  11,  12,  13,  14,  15,
  619.   16,  17,  18,  19,  20,  21,  22,  23,
  620.   24,  25,  26,  27,  28,  29,  30,  8,
  621.   9,  10,  11,  12,  13,  14,  15,  16,
  622. };
  623.  
  624. SHORT dragon_juliaPalette[] =
  625. {
  626.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x0f60,  0x0f80,  0x0f90,  0x0fb0,
  627.   0x0fd0,  0x0ff0,  0x0dd1,  0x0bb2,  0x0993,  0x0884,  0x0665,  0x0446,
  628.   0x0227,  0x0008,  0x0207,  0x0406,  0x0605,  0x0804,  0x0903,  0x0b02,
  629.   0x0d01,  0x0f00,  0x0f20,  0x0f40,  0x0f50,  0x0f70,  0x0f90,  0x0fb0
  630. };
  631. USHORT dragon_juliaHeights[] =
  632. {
  633.   1023,  142,  132,  123,  113,  104,  99,  94,
  634.   89,  84,  79,  74,  71,  68,  66,  63,
  635.   60,  58,  55,  52,  50,  48,  47,  45,
  636.   44,  42,  41,  39,  38,  36,  35,  34,
  637.   33,  32,  31,  30,  29,  28,  27,  26,
  638.   25,  24,  23,  22,  21,  20,  19,  18,
  639.   17,  16,  15,  14,  13,  12,  11,  10,
  640.   9,  8,  7,  6,  5,  4,  3,  2,
  641.   1,  0,  0,  0,  0,  0,  0,  0,
  642. };
  643. UBYTE dragon_juliaPens[] =
  644. {
  645.   0,  26,  27,  28,  4,  5,  6,  7,
  646.   8,  9,  10,  11,  12,  13,  14,  15,
  647.   16,  17,  18,  19,  20,  21,  22,  23,
  648.   24,  25,  26,  27,  28,  29,  30,  31,
  649.   9,  10,  11,  12,  13,  14,  15,  16,
  650.   17,  18,  19,  20,  21,  22,  23,  24,
  651.   25,  26,  27,  28,  29,  30,  31,  9,
  652.   10,  11,  12,  13,  14,  15,  16,  17,
  653.   18,  19,  20,  1,  1,  1,  1,  1,
  654. };
  655.  
  656. SHORT haloPalette[] =
  657. {
  658.   0x0000,  0x0b98,  0x0fdc,  0x0765,  0x000f,  0x011f,  0x022f,  0x033f,
  659.   0x055f,  0x066f,  0x077f,  0x088f,  0x099f,  0x0aaf,  0x0ccf,  0x0ddf,
  660.   0x0eef,  0x0fff,  0x0eee,  0x0dde,  0x0ccd,  0x0bbc,  0x0aac,  0x099b,
  661.   0x088a,  0x0779,  0x0669,  0x0558,  0x0447,  0x0337,  0x0226,  0x0fff
  662. };
  663. USHORT haloHeights[] =
  664. {
  665.   1023,  89,  88,  87,  86,  85,  84,  83,
  666.   82,  81,  80,  79,  78,  77,  76,  75,
  667.   74,  73,  72,  71,  70,  69,  68,  67,
  668.   66,  65,  64,  63,  62,  61,  60,  59,
  669.   58,  57,  56,  55,  54,  53,  52,  51,
  670.   50,  49,  48,  47,  46,  45,  44,  43,
  671.   42,  41,  40,  39,  38,  37,  36,  35,
  672.   34,  33,  32,  31,  30,  29,  28,  27,
  673.   26,  25,  24,  23,  22,  21,  20,  19,
  674.   18,  17,  16,  15,  14,  13,  12,  11,
  675.   10,  9,  8,  7,  6,  5,  4,  3,
  676.   2,  1,  0,  0,  0,  0,  0,  0,
  677. };
  678. UBYTE haloPens[] =
  679. {
  680.   0,  15,  14,  13,  12,  11,  10,  9,
  681.   8,  7,  6,  5,  4,  4,  5,  4,
  682.   5,  6,  7,  8,  9,  10,  11,  12,
  683.   13,  14,  15,  15,  14,  13,  12,  11,
  684.   10,  9,  8,  7,  6,  5,  4,  4,
  685.   5,  4,  5,  6,  7,  8,  9,  10,
  686.   11,  12,  13,  14,  15,  15,  14,  13,
  687.   12,  11,  10,  9,  8,  7,  6,  5,
  688.   4,  4,  5,  4,  5,  6,  7,  8,
  689.   9,  10,  11,  12,  13,  14,  15,  15,
  690.   14,  13,  12,  11,  10,  9,  8,  7,
  691.   6,  5,  4,  4,  5,  4,  5,  6,
  692. };
  693.  
  694. #define NUM_CONTOURS(a) (sizeof(a)/sizeof(USHORT))
  695.  
  696. struct Preset Preset[] =
  697.   {
  698.     {
  699.       "big_brot",  /* Preset Name */
  700.       MANDPICT,
  701.       -2.000000, -1.204545, /* StartX, StartY */
  702.       2.820000, 1.204545, /* EndX, EndY */
  703.       109, 78, /* CountX,CountY */
  704.       128,      /* MaxCount */
  705.       0,     /* MandType */
  706.       0x0000,   /* ViewModes */
  707.       5,     /* Depth */
  708.       0,     /* Border Type*/
  709.       &big_brotPalette[0], /* Palette colors */
  710.       32,         /* NumContours */
  711.       &big_brotHeights[0], /* ContourHeights */
  712.       &big_brotPens[0]     /* ContourPens */
  713.     },
  714.     {
  715.       "Hey_Baby",  /* Preset Name */
  716.       MANDPICT,
  717.       -0.143523, -1.019072, /* StartX, StartY */
  718.       -0.143384, -1.018843, /* EndX, EndY */
  719.       96, 65, /* CountX,CountY */
  720.       1023,     /* MaxCount */
  721.       0,     /* MandType */
  722.       0x0000,   /* ViewModes */
  723.       5,     /* Depth */
  724.       0,     /* Border Type*/
  725.       Hey_BabyPalette, /* Palette colors */
  726.       32,         /* NumContours */
  727.       Hey_BabyHeights, /* ContourHeights */
  728.       Hey_BabyPens     /* ContourPens */
  729.     },
  730.     {
  731.       "Aug_85_Cover",  /* Preset Name */
  732.       MANDPICT,
  733.       -0.948154, -0.296503, /* StartX, StartY */
  734.       -0.888359, -0.232261, /* EndX, EndY */
  735.       92, 86, /* CountX,CountY */
  736.       1023,     /* MaxCount */
  737.       0,     /* MathMode */
  738.       0x0000,   /* ViewModes */
  739.       5,     /* Depth */
  740.       0,     /* Border Type*/
  741.       coverPalette, /* Palette colors */
  742.       NUM_CONTOURS( coverHeights ),    /* NumContours */
  743.       coverHeights, /* ContourHeights */
  744.       coverPens     /* ContourPens */
  745.     },
  746.  
  747.     {
  748.       "sea_horse",  /* Preset Name */
  749.       MANDPICT,
  750.       -0.750055,  0.105343, /* StartX, StartY */
  751.       -0.742464,  0.113267, /* EndX, EndY */
  752.       86, 79, /* CountX,CountY */
  753.       1023,     /* MaxCount */
  754.       0,     /* MathMode */
  755.       0x0000,   /* ViewModes */
  756.       5,     /* Depth */
  757.       0,     /* Border Type*/
  758.       sea_horsePalette, /* Palette colors */
  759.       NUM_CONTOURS( sea_horseHeights ),         /* NumContours */
  760.       sea_horseHeights, /* ContourHeights */
  761.       sea_horsePens     /* ContourPens */
  762.     },
  763.  
  764.     {
  765.       "golden_dragon",  /* Preset Name */
  766.       MANDPICT,
  767.       -0.764140, -0.095187, /* StartX, StartY */
  768.       -0.764031, -0.095102, /* EndX, EndY */
  769.       117, 87, /* CountX,CountY */
  770.       1023,     /* MaxCount */
  771.       0,     /* MathMode */
  772.       0x0000,   /* ViewModes */
  773.       5,     /* Depth */
  774.       0,     /* Border Type*/
  775.       golden_dragonPalette, /* Palette colors */
  776.       NUM_CONTOURS( golden_dragonHeights ), /* NumContours */
  777.       golden_dragonHeights, /* ContourHeights */
  778.       golden_dragonPens     /* ContourPens */
  779.     },
  780.     {
  781.       "dual_spiral",  /* Preset Name */
  782.       MANDPICT,
  783.       -0.764616, -0.095488, /* StartX, StartY */
  784.       -0.764312, -0.094471, /* EndX, EndY */
  785.       94, 85, /* CountX,CountY */
  786.       1023,     /* MaxCount */
  787.       0,     /* MathMode */
  788.       0x0000,   /* ViewModes */
  789.       5,     /* Depth */
  790.       0,     /* Border Type*/
  791.       dual_spiralPalette, /* Palette colors */
  792.       NUM_CONTOURS( dual_spiralHeights ), /* NumContours */
  793.       dual_spiralHeights, /* ContourHeights */
  794.       dual_spiralPens     /* ContourPens */
  795.     },
  796.     {
  797.       "halfbrite",  /* Preset Name */
  798.       MANDPICT,
  799.       -0.655231, -0.366674, /* StartX, StartY */
  800.       -0.654933, -0.366417, /* EndX, EndY */
  801.       103, 84, /* CountX,CountY */
  802.       1023,     /* MaxCount */
  803.       0,     /* MathMode */
  804.       0x0080,   /* ViewModes */
  805.       6,     /* Depth */
  806.       0,     /* Border Type*/
  807.       halfbritePalette, /* Palette colors */
  808.       NUM_CONTOURS( halfbriteHeights ), /* NumContours */
  809.       halfbriteHeights, /* ContourHeights */
  810.       halfbritePens     /* ContourPens */
  811.     },
  812.     {
  813.       "Valley_Gal",  /* Preset Name */
  814.       JULIAPICT,
  815.       -0.760314, -0.135554, /* StartX, StartY */
  816.       1.707388, 1.064516, /* EndX, EndY */
  817.       133, 77, /* CountX,CountY */
  818.       1023,     /* MaxCount */
  819.       0,     /* MathMode */
  820.       0x0000,   /* ViewModes */
  821.       5,     /* Depth */
  822.       0,     /* Border Type*/
  823.       Valley_GalPalette, /* Palette colors */
  824.       NUM_CONTOURS( Valley_GalHeights ), /* NumContours */
  825.       Valley_GalHeights, /* ContourHeights */
  826.       Valley_GalPens     /* ContourPens */
  827.     },
  828.     {
  829.       "dragon_julia",  /* Preset Name */
  830.       JULIAPICT,
  831.       -0.942986, -0.270764, /* StartX, StartY */
  832.       1.288473, 0.974026, /* EndX, EndY */
  833.       149, 77, /* CountX,CountY */
  834.       1023,     /* MaxCount */
  835.       0,     /* MathMode */
  836.       0x0000,   /* ViewModes */
  837.       5,     /* Depth */
  838.       0,     /* Border Type*/
  839.       dragon_juliaPalette, /* Palette colors */
  840.       NUM_CONTOURS( dragon_juliaHeights ), /* NumContours */
  841.       dragon_juliaHeights, /* ContourHeights */
  842.       dragon_juliaPens     /* ContourPens */
  843.     },
  844.     {
  845.       "halo",  /* Preset Name */
  846.       JULIAPICT,
  847.        0.263523,  0.000016, /* StartX, StartY */
  848.       1.031916, 1.233333, /* EndX, EndY */
  849.       79, 77, /* CountX,CountY */
  850.       1023,     /* MaxCount */
  851.       0,     /* MathMode */
  852.       0x0000,   /* ViewModes */
  853.       5,     /* Depth */
  854.       0,     /* Border Type*/
  855.       haloPalette, /* Palette colors */
  856.       NUM_CONTOURS( haloHeights ),    /* NumContours */
  857.       haloHeights, /* ContourHeights */
  858.       haloPens     /* ContourPens */
  859.     }
  860.   };
  861.  
  862. #define DEVELOPMENT
  863. #ifdef DEVELOPMENT
  864.  
  865. SavePreset(name,MPict)
  866.   char *name;
  867.   struct Picture *MPict;
  868. {
  869.   register struct Picture *Pict = MPict;
  870.   int i;
  871.  
  872.   FILE *SaveFile;
  873.  
  874.   SaveFile = fopen(name,"a");
  875.  
  876.   if (SaveFile != (struct FILE *) NULL) {
  877.  
  878.     fprintf(SaveFile, "SHORT %sPalette[] =\n{\n",name);
  879.     for (i = 0; i < 32; i++) {
  880.       fprintf(SaveFile, "  0x%04x", GetRGB4(vp->ColorMap, i));
  881.  
  882.       if (i != 31)
  883.         fprintf(SaveFile,",");
  884.  
  885.       if (i % 8 == 7)
  886.         fprintf(SaveFile, "\n");
  887.     }
  888.     fprintf(SaveFile, "};\n");
  889.  
  890.     fprintf(SaveFile, "USHORT %sHeights[] =\n{\n",name);
  891.     for (i = 0; i < NumContours; i++) {
  892.       fprintf(SaveFile, "  %d", *(Pict->Heights + i) );
  893.  
  894.       if (i != NumContours - 1) {
  895.         fprintf(SaveFile,",");
  896.         if (i % 8 == 7)
  897.           fprintf(SaveFile, "\n");
  898.       }
  899.     }
  900.     fprintf(SaveFile, "\n};\n");
  901.  
  902.     fprintf(SaveFile, "UBYTE %sPens[] =\n{\n",name);
  903.     for (i = 0; i < NumContours; i++) {
  904.       fprintf(SaveFile, "  %d", *(Pict->Pens + i) );
  905.  
  906.       if (i != NumContours - 1) {
  907.         fprintf(SaveFile,",");
  908.         if (i % 8 == 7)
  909.           fprintf(SaveFile, "\n");
  910.       }
  911.     }
  912.     fprintf(SaveFile, "\n};\n");
  913.  
  914.     fprintf(SaveFile, "    {\n");
  915.     fprintf(SaveFile, "      \"%s\",  /* Preset Name */\n", name);
  916.  
  917.     if (Pict->pNode.ln_Type == JULIAPICT) {
  918.       fprintf(SaveFile, "      %f, %f, /* StartX, StartY */\n",
  919.                                       Pict->Real, Pict->Imag);
  920.     } else {
  921.       fprintf(SaveFile, "      %f, %f, /* StartX, StartY */\n",
  922.                                       Pict->RealLow, Pict->ImagLow);
  923.     }
  924.  
  925.     fprintf(SaveFile, "      %f, %f, /* EndX, EndY */\n", Pict->RealHigh,
  926.                                                           Pict->ImagHigh);
  927.     fprintf(SaveFile, "      %d, %d, /* CountX,CountY */\n",
  928.                              Pict->CountX, Pict->CountY);
  929.  
  930.     fprintf(SaveFile, "      %d,     /* MaxCount */\n", Pict->MaxIteration);
  931.     fprintf(SaveFile, "      %d,     /* MathMode */\n", Pict->MathMode);
  932.  
  933.     fprintf(SaveFile, "      0x%04x,   /* ViewModes */\n",
  934.                                     screen->ViewPort.Modes);
  935.  
  936.     fprintf(SaveFile, "      %d,     /* Depth */\n",
  937.                                     screen->BitMap.Depth);
  938.  
  939.     fprintf(SaveFile, "      %d,     /* Border Type*/\n", 0);
  940.  
  941.     fprintf(SaveFile, "      %sPalette, /* Palette colors */\n",
  942.                                     name);
  943.  
  944.     fprintf(SaveFile, "      %d,         /* NumContours */\n",
  945.                                     NumContours);
  946.  
  947.     fprintf(SaveFile, "      %sHeights, /* ContourHeights */\n", name);
  948.     fprintf(SaveFile, "      %sPens     /* ContourPens */\n", name);
  949.     fprintf(SaveFile, "    },\n\n\n");
  950.  
  951.     fclose( SaveFile );
  952.   }
  953. }
  954. #endif
  955.