/*************************************************************************** * * MandelVroom Preset Pictures code * * Kevin L. Clague * * Copyright (C) 1987 * **************************************************************************/ #include "mand.h" #define NUMPRESETS 10 extern struct ViewPort *vp; extern struct Screen *screen; extern struct NewScreen NewScreen; extern struct Window *MandWind; extern float StartX,StartY,EndX,EndY; extern SHORT CountX,CountY,MaxCount; extern SHORT NumContours, *ContourBase; extern UBYTE *ColorBase; extern UBYTE MandType; extern ULONG BorderType; extern SHORT *CountBase; struct Preset { char *Name; float StartX, StartY, EndX, EndY; SHORT CountX, CountY; SHORT MaxCount; UBYTE MandType; USHORT ViewModes; USHORT Depth; ULONG BorderType; SHORT *ColorMap; SHORT NumContours; USHORT *Contours; UBYTE *Pens; }; extern struct Preset Preset[]; /* * Generate a preset picture */ SetPreset(Number) int Number; { if (InitPreset(Number) == 0) { CloseDisp(); OpenDisp(); if (MandWind->Width != CountX + LEFTMARG + RIGHTMARG || MandWind->Height != CountY + TOPMARG + BOTMARG) SizeWindow(MandWind, CountX + LEFTMARG + RIGHTMARG - MandWind->Width, CountY + TOPMARG + BOTMARG - MandWind->Height); Delay(1); GenerateIt(); } } /* * Set up system from preset list */ InitPreset(Number) int Number; { struct Preset *CurPreset; SHORT *CurColors; USHORT *CurContours; UBYTE *CurPens; SHORT i; if (Number < NUMPRESETS) { if (CountBase) { FreeMem(CountBase,CountX*CountY*sizeof(SHORT)); CountBase = (SHORT *) NULL; } CurPreset = &Preset[Number]; StartX = CurPreset->StartX; StartY = CurPreset->StartY; EndX = CurPreset->EndX; EndY = CurPreset->EndY; CountX = CurPreset->CountX; CountY = CurPreset->CountY; MaxCount = CurPreset->MaxCount; MandType = CurPreset->MandType; NewScreen.ViewModes = CurPreset->ViewModes; NewScreen.Depth = CurPreset->Depth; BorderType = CurPreset->BorderType; CurColors = CurPreset->ColorMap; LoadRGB4(vp, CurColors, 32); CurContours = CurPreset->Contours; for (i = 0; i < NumContours; i++) *(ContourBase + i) = *CurContours++; CurPens = CurPreset->Pens; for (i = 0; i < NumContours; i++) *(ColorBase + i) = *CurPens++; return(0); } else { DispErrMsg("Invalid Preset",0); return(1); } } /************************************************************************** * * Preset arrays for generating pictures * *************************************************************************/ SHORT big_brotPalette[] = { 0x0000, 0x0fff, 0x0ddf, 0x0bbf, 0x099f, 0x077c, 0x055a, 0x0337, 0x0114, 0x0337, 0x055a, 0x077c, 0x099f, 0x0bbf, 0x0ccf, 0x0eef, 0x0000, 0x0fff, 0x0fff, 0x0eef, 0x0eef, 0x0ddf, 0x0ddf, 0x0ccf, 0x0ccf, 0x099f, 0x088d, 0x066b, 0x055a, 0x0338, 0x0226, 0x0fff }; USHORT big_brotHeights[] = { 1023, 283, 257, 231, 205, 180, 154, 128, 103, 100, 95, 90, 85, 80, 75, 69, 35, 31, 28, 25, 21, 18, 15, 11, 7, 6, 5, 4, 3, 2, 1, 0 }; UBYTE big_brotPens[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 0 }; SHORT Hey_BabyPalette[] = { 0x0000, 0x0fff, 0x0ede, 0x0dbc, 0x0c9b, 0x0b6a, 0x0a49, 0x0927, 0x0806, 0x0716, 0x0727, 0x0637, 0x0658, 0x0568, 0x0579, 0x0489, 0x0000, 0x0fff, 0x0dee, 0x0bcd, 0x09bc, 0x06aa, 0x0499, 0x0278, 0x0067, 0x059a, 0x0acc, 0x0fff, 0x0bdd, 0x08bb, 0x0489, 0x0067 }; USHORT Hey_BabyHeights[] = { 1023, 247, 220, 193, 167, 160, 154, 147, 141, 134, 128, 122, 115, 110, 106, 102, 98, 93, 89, 85, 81, 77, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65 }; UBYTE Hey_BabyPens[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 20, 23 }; SHORT dragon_familyPalette[] = { 0x0000, 0x0a00, 0x0f20, 0x0f40, 0x0f60, 0x0f80, 0x0f90, 0x0fb0, 0x0fd0, 0x0ff0, 0x0dd1, 0x0bb2, 0x0993, 0x0884, 0x0665, 0x0446, 0x0227, 0x0008, 0x0207, 0x0406, 0x0605, 0x0804, 0x0903, 0x0b02, 0x0d01, 0x0f00, 0x0f20, 0x0f40, 0x0f50, 0x0f70, 0x0f90, 0x0fb0 }; USHORT dragon_familyHeights[] = { 1023, 142, 132, 123, 113, 104, 99, 94, 89, 84, 79, 74, 71, 68, 66, 63, 60, 58, 55, 52, 50, 48, 47, 45, 44, 42, 41, 39, 38, 36, 35, 34 }; UBYTE dragon_familyPens[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; SHORT sea_horsePalette[] = { 0x0000, 0x0fff, 0x0ddd, 0x0bbb, 0x0999, 0x0666, 0x0444, 0x0222, 0x0000, 0x0002, 0x0003, 0x0005, 0x0006, 0x0007, 0x0009, 0x000a, 0x002a, 0x003a, 0x0059, 0x0069, 0x0020, 0x0030, 0x0040, 0x0040, 0x0050, 0x0060, 0x0050, 0x0040, 0x0030, 0x0020, 0x0010, 0x0fff }; USHORT sea_horseHeights[] = { 1023, 635, 542, 449, 356, 263, 171, 145, 142, 140, 138, 135, 132, 128, 125, 122, 119, 115, 112, 109, 106, 103, 98, 94, 89, 85, 80, 76, 71, 67, 62, 58 }; UBYTE sea_horsePens[] = { 0, 7, 6, 5, 4, 3, 3, 1, 4, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 8, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0 }; SHORT spinePalette[] = { 0x0000, 0x0600, 0x0800, 0x0b00, 0x0d00, 0x0f00, 0x0f40, 0x0f80, 0x0fb0, 0x0ff0, 0x0bb0, 0x0660, 0x0220, 0x0335, 0x022a, 0x000f, 0x0c50, 0x0b40, 0x0940, 0x0830, 0x0630, 0x0520, 0x0310, 0x0210, 0x0000, 0x00c0, 0x0aaa, 0x0bbb, 0x0ccc, 0x0ddd, 0x0eee, 0x0fff }; USHORT spineHeights[] = { 1023, 318, 295, 272, 249, 226, 203, 180, 157, 135, 127, 120, 113, 106, 99, 92, 85, 68, 65, 62, 59, 56, 53, 0, 44, 43, 42, 41, 40, 39, 0, 0 }; UBYTE spinePens[] = { 15, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 13, 14, 15, 14, 13, 0, 14, 13, 14, 15, 14, 13, 0, 31 }; SHORT vertibraePalette[] = { 0x0000, 0x0f00, 0x0e01, 0x0d01, 0x0c02, 0x0a02, 0x0903, 0x0803, 0x0923, 0x0a42, 0x0b62, 0x0c82, 0x0c91, 0x0db1, 0x0ed0, 0x0ff0, 0x0de0, 0x0cd0, 0x0ac0, 0x09b0, 0x07a0, 0x0590, 0x0480, 0x0270, 0x0272, 0x0283, 0x0185, 0x0196, 0x0198, 0x0199, 0x00ab, 0x00ac }; USHORT vertibraeHeights[] = { 1023, 389, 355, 321, 287, 253, 219, 185, 151, 134, 127, 120, 113, 106, 99, 92, 85, 68, 66, 65, 63, 62, 61, 59, 58, 57, 55, 54, 53, 0, 0, 0 }; UBYTE vertibraePens[] = { 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; SHORT beauty2Palette[] = { 0x0000, 0x0d22, 0x0c22, 0x0b22, 0x0a22, 0x0822, 0x0932, 0x0b32, 0x0c42, 0x0d52, 0x0d71, 0x0e91, 0x0ea1, 0x0ec1, 0x0fd0, 0x0ff0, 0x0bd0, 0x08b0, 0x0490, 0x0070, 0x0062, 0x0053, 0x0045, 0x0047, 0x0038, 0x002a, 0x001b, 0x000d, 0x000a, 0x0007, 0x0004, 0x0f0f }; USHORT beauty2Heights[] = { 1023, 465, 427, 389, 351, 313, 276, 259, 244, 229, 213, 198, 183, 167, 163, 158, 154, 151, 148, 145, 142, 138, 134, 130, 126, 122, 118, 114, 109, 104, 99, 100 }; UBYTE beauty2Pens[] = { 31, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0 }; SHORT linkPalette[] = { 0x0000, 0x0ff0, 0x0f00, 0x0e00, 0x0c00, 0x0b00, 0x0900, 0x0800, 0x0600, 0x0fff, 0x0eee, 0x0ccc, 0x0bbb, 0x0999, 0x0888, 0x0777, 0x0555, 0x0ff0, 0x0f00, 0x0900, 0x0111, 0x0222, 0x0222, 0x0444, 0x0555, 0x0777, 0x0999, 0x0aaa, 0x0ccc, 0x0ddd, 0x0fff, 0x000f }; USHORT linkHeights[] = { 1023, 706, 675, 621, 568, 515, 461, 408, 355, 301, 248, 195, 163, 160, 158, 156, 154, 152, 150, 148, 146, 144, 142, 140, 138, 136, 134, 132, 130, 128, 126, 124 }; UBYTE linkPens[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 4, 3, 0, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 29, 28, 28, 27, 25, 25, 24, 23, 22 }; SHORT pretty_babyPalette[] = { 0x0000, 0x0044, 0x0255, 0x0477, 0x0688, 0x0abc, 0x0eef, 0x0ccf, 0x0bbf, 0x0aaf, 0x088e, 0x077e, 0x066e, 0x044d, 0x033d, 0x011c, 0x000c, 0x0310, 0x0420, 0x0521, 0x0531, 0x0632, 0x0742, 0x0842, 0x0953, 0x0953, 0x0a64, 0x0b64, 0x0953, 0x0732, 0x0421, 0x0200 }; USHORT pretty_babyHeights[] = { 1023, 618, 541, 465, 389, 313, 308, 304, 300, 296, 292, 288, 284, 280, 276, 272, 267, 203, 200, 197, 195, 192, 190, 187, 185, 182, 179, 177, 174, 172, 169, 167 }; UBYTE pretty_babyPens[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; SHORT horse_chainPalette[] = { 0x0000, 0x0a90, 0x0f00, 0x0d00, 0x0c00, 0x0a00, 0x0800, 0x0600, 0x0400, 0x0fff, 0x0eee, 0x0ccc, 0x0bbb, 0x0999, 0x0888, 0x0777, 0x0555, 0x0ff0, 0x0f00, 0x0d20, 0x0a30, 0x0620, 0x0222, 0x0444, 0x0555, 0x0777, 0x0999, 0x0aaa, 0x0ccc, 0x0ddd, 0x0fff, 0x000f }; USHORT horse_chainHeights[] = { 1023, 706, 441, 371, 295, 265, 247, 226, 205, 195, 185, 174, 136, 133, 130, 127, 124, 121, 118, 116, 113, 110, 107, 104, 101, 99, 96, 93, 90, 87, 84, 82 }; UBYTE horse_chainPens[] = { 31, 1, 8, 7, 6, 5, 4, 3, 2, 19, 20, 21, 0, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 29, 28, 28, 27, 25, 25, 24, 23, 22 }; struct Preset Preset[] = { { "big_brot", /* Preset Name */ -2.000000, -1.204545, /* StartX, StartY */ 2.820000, 1.204545, /* EndX, EndY */ 109, 78, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ &big_brotPalette[0], /* Palette colors */ 32, /* NumContours */ &big_brotHeights[0], /* ContourHeights */ &big_brotPens[0] /* ContourPens */ }, { "Hey_Baby", /* Preset Name */ -0.143523, -1.019072, /* StartX, StartY */ -0.143384, -1.018843, /* EndX, EndY */ 96, 65, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ Hey_BabyPalette, /* Palette colors */ 32, /* NumContours */ Hey_BabyHeights, /* ContourHeights */ Hey_BabyPens /* ContourPens */ }, { "dragon_family", /* Preset Name */ -0.942986, -0.270764, /* StartX, StartY */ -0.922458, -0.260287, /* EndX, EndY */ 129, 58, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ dragon_familyPalette, /* Palette colors */ 32, /* NumContours */ dragon_familyHeights, /* ContourHeights */ dragon_familyPens /* ContourPens */ }, { "spine", /* Preset Name */ -1.253688, -0.042351, /* StartX, StartY */ -1.251284, -0.040954, /* EndX, EndY */ 120, 76, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 4, /* Depth */ 0, /* Border Type*/ spinePalette, /* Palette colors */ 32, /* NumContours */ spineHeights, /* ContourHeights */ spinePens /* ContourPens */ }, { "vertibrae", /* Preset Name */ -1.253227, -0.041939, /* StartX, StartY */ -1.251660, -0.041292, /* EndX, EndY */ 105, 56, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ vertibraePalette, /* Palette colors */ 32, /* NumContours */ vertibraeHeights, /* ContourHeights */ vertibraePens /* ContourPens */ }, { "beauty", /* Preset Name */ -1.252925, -0.041729, /* StartX, StartY */ -1.252575, -0.041497, /* EndX, EndY */ 98, 56, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ beauty2Palette, /* Palette colors */ 32, /* NumContours */ beauty2Heights, /* ContourHeights */ beauty2Pens /* ContourPens */ }, { "sea_horse", /* Preset Name */ -0.749790, -0.113353, /* StartX, StartY */ -0.742342, -0.105343, /* EndX, EndY */ 69, 56, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ sea_horsePalette, /* Palette colors */ 32, /* NumContours */ sea_horseHeights, /* ContourHeights */ sea_horsePens /* ContourPens */ }, { "horse_chain", /* Preset Name */ -0.745445, -0.113237, /* StartX, StartY */ -0.744856, -0.112922, /* EndX, EndY */ 105, 56, /* CountX,CountY */ 1023, /* MaxCount */ 0, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ horse_chainPalette, /* Palette colors */ 32, /* NumContours */ horse_chainHeights, /* ContourHeights */ horse_chainPens /* ContourPens */ }, { "link", /* Preset Name */ -0.745464, -0.113034, /* StartX, StartY */ -0.745399, -0.112985, /* EndX, EndY */ 95, 56, /* CountX,CountY */ 1023, /* MaxCount */ 1, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ linkPalette, /* Palette colors */ 32, /* NumContours */ linkHeights, /* ContourHeights */ linkPens /* ContourPens */ }, { "pretty_baby", /* Preset Name */ -0.745436, -0.113016, /* StartX, StartY */ -0.745399, -0.113003, /* EndX, EndY */ 87, 56, /* CountX,CountY */ 1023, /* MaxCount */ 1, /* MandType */ 0x4000, /* ViewModes */ 5, /* Depth */ 0, /* Border Type*/ pretty_babyPalette, /* Palette colors */ 32, /* NumContours */ pretty_babyHeights, /* ContourHeights */ pretty_babyPens /* ContourPens */ }, }; #ifdef DEVELOPMENT SavePreset(name) char *name; { int i; FILE *SaveFile; SaveFile = fopen(name,"a"); if (SaveFile != (struct FILE *) NULL) { fprintf(SaveFile, "SHORT %sPalette[] =\n{\n",name); for (i = 0; i < 32; i++) { fprintf(SaveFile, " 0x%04x", GetRGB4(vp->ColorMap, i)); if (i != 31) fprintf(SaveFile,","); if (i % 8 == 7) fprintf(SaveFile, "\n"); } fprintf(SaveFile, "};\n"); fprintf(SaveFile, "USHORT %sHeights[] =\n{\n",name); for (i = 0; i < NumContours; i++) { fprintf(SaveFile, " %d", *(ContourBase + i) ); if (i != NumContours - 1) { fprintf(SaveFile,","); if (i % 8 == 7) fprintf(SaveFile, "\n"); } } fprintf(SaveFile, "\n};\n"); fprintf(SaveFile, "UBYTE %sPens[] =\n{\n",name); for (i = 0; i < NumContours; i++) { fprintf(SaveFile, " %d", *(ColorBase + i) ); if (i != NumContours - 1) { fprintf(SaveFile,","); if (i % 8 == 7) fprintf(SaveFile, "\n"); } } fprintf(SaveFile, "\n};\n"); fprintf(SaveFile, " {\n"); fprintf(SaveFile, " \"%s\", /* Preset Name */\n", name); fprintf(SaveFile, " %f, %f, /* StartX, StartY */\n", StartX, StartY); fprintf(SaveFile, " %f, %f, /* EndX, EndY */\n", EndX, EndY); fprintf(SaveFile, " %d, %d, /* CountX,CountY */\n", CountX, CountY); fprintf(SaveFile, " %d, /* MaxCount */\n", MaxCount); fprintf(SaveFile, " %d, /* MandType */\n", MandType); fprintf(SaveFile, " 0x%04x, /* ViewModes */\n", screen->ViewPort.Modes); fprintf(SaveFile, " %d, /* Depth */\n", screen->BitMap.Depth); fprintf(SaveFile, " %d, /* Border Type*/\n", BorderType); fprintf(SaveFile, " %sPalette, /* Palette colors */\n", name); fprintf(SaveFile, " %d, /* NumContours */\n", NumContours); fprintf(SaveFile, " %sHeights, /* ContourHeights */\n", name); fprintf(SaveFile, " %sPens /* ContourPens */\n", name); fprintf(SaveFile, " },\n\n\n"); } } #endif