home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / frasrc18.zip / PROMPTS2.C < prev    next >
C/C++ Source or Header  |  1993-05-08  |  51KB  |  1,799 lines

  1. /*
  2.     Various routines that prompt for things.
  3.     This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
  4. */
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10. #ifndef XFRACT
  11. #include <dos.h>
  12. #elif !defined(__386BSD__)
  13. #include <sys/types.h>
  14. #include <sys/stat.h>
  15. #include <sys/dir.h>
  16. #endif
  17. #ifdef __TURBOC__
  18. #include <alloc.h>
  19. #elif !defined(__386BSD__)
  20. #include <malloc.h>
  21. #endif
  22.  
  23. #ifdef __hpux
  24. #include <sys/param.h>
  25. #define getwd(a) getcwd(a,MAXPATHLEN)
  26. #endif
  27.  
  28. #include "fractint.h"
  29. #include "fractype.h"
  30. #include "helpdefs.h"
  31. #include "prototyp.h"
  32.  
  33. /* Routines defined in prompts1.c */
  34.  
  35. extern    int prompt_checkkey(int curkey);
  36. extern    long get_file_entry(int,char *,char *,char *,char *);
  37.  
  38. /* Routines used in prompts1.c */
  39.  
  40.     int get_corners(void);
  41.     int edit_ifs_params(void );
  42.     int lccompare(VOIDCONSTPTR, VOIDCONSTPTR); /* Needed in prompts1.c PAV */
  43.  
  44. /* Routines in this module    */
  45.  
  46. static    int findfirst(char *path);
  47. static  int check_f6_key(int curkey,int choice);
  48. static    int findnext(void );
  49.     int splitpath(char *template,char *drive,char *dir,char *fname,char *ext);
  50. static    int makepath(char *template,char *drive,char *dir,char *fname,char *ext);
  51. static    void fix_dirname(char *dirname);
  52. static    int expand_dirname(char *dirname,char *drive);
  53. static    int filename_speedstr(int, int, int, char *, int);
  54. static    int isadirectory(char *s);
  55. static  int check_f6_key(int curkey,int choice);
  56.  
  57. extern int dotmode;
  58. extern int orbit_delay;
  59. extern char diskfilename[];
  60.  
  61. extern char *fract_dir1, *fract_dir2;
  62.  
  63. #ifndef XFRACT
  64. extern int strncasecmp(char *s,char *t,int ct);
  65. #endif
  66.  
  67. extern char temp1[256];   /* temporary strings          */
  68.  
  69. extern    double    xxmin,xxmax;    /* initial corner values    */
  70. extern    double    yymin,yymax;    /* initial corner values    */
  71. extern    BYTE usemag;
  72.  
  73. extern    int AntiAliasing;
  74. extern double zzmin, zzmax, ttmin, ttmax;
  75. extern int Transparent3D;
  76.  
  77. extern    double    xx3rd,yy3rd;    /* initial corner values    */
  78. extern    int    invert;     /* non-zero if inversion active */
  79. extern    double    inversion[3];    /* radius, xcenter, ycenter */
  80. extern    int    pot16bit;
  81. extern    int    disk16bit;
  82. extern    double    potparam[3];    /* three potential parameters*/
  83. extern    int    fractype;    /* if == 0, use Mandelbrot  */
  84. extern    char    usr_floatflag;    /* floating-point fractals? */
  85. extern    int    maxit;        /* try this many iterations */
  86. extern    int    inside;     /* inside color */
  87. extern    int    fillcolor;     /* fill color */
  88. extern    int    outside;    /* outside color */
  89. extern    int    finattract;    /* finite attractor switch */
  90. extern    char    savename[80];    /* save files using this name */
  91. extern    int    decomp[];    /* decomposition parameters */
  92. extern    int    usr_distest;    /* distance estimator option */
  93. extern    int    distestwidth;
  94. extern    char    usr_stdcalcmode; /* '1', '2', 'g', 'b' */
  95. extern    char    overwrite;     /* overwrite= flag */
  96. extern    int    soundflag;    /* sound option */
  97. extern    int    LogFlag;    /* non-zero if logarithmic palettes */
  98. extern    int    usr_biomorph;    /* Biomorph flag */
  99. #if 0
  100. //extern    long    xmin, xmax, ymin, ymax; /* screen corner values */
  101. #endif
  102. extern    int    xdots, ydots;    /* coordinates of dots on the screen  */
  103. extern    int    colors;     /* maximum colors available */
  104. extern    int    row, col;
  105. extern    int    viewwindow;
  106. extern    float    viewreduction;
  107. extern    int    viewcrop;
  108. extern    float    finalaspectratio;
  109. extern    int    viewxdots,viewydots;
  110. extern    int    textcbase;
  111. extern    int    textrow,textcol;
  112. extern    int    resave_flag;    /* resaving after a timed save */
  113. extern    int    started_resaves;
  114. extern    char    boxy[];
  115. extern    int    rotate_lo,rotate_hi;
  116. extern    int    rangeslen;
  117. extern float  screenaspect;
  118.  
  119. extern  int  cmdarg(char *,int);
  120.  
  121. extern char CommandFile[];
  122. extern char CommandName[];
  123. extern float far *ifs_defn;
  124. extern int ifs_type;
  125. extern int ifs_changed;
  126. extern int initbatch;        /* 1 if batch run (no kbd)  */
  127.  
  128. /* speed key state values */
  129. #define MATCHING     0    /* string matches list - speed key mode */
  130. #define TEMPLATE    -2    /* wild cards present - buiding template */
  131. #define SEARCHPATH    -3    /* no match - building path search name */
  132.  
  133. #define   FILEATTR     0x37       /* File attributes; select all but volume labels */
  134. #define   HIDDEN     2
  135. #define   SYSTEM     4
  136. #define   SUBDIR     16
  137. #define   MAXNUMFILES     300
  138.  
  139. #define FILE_MAX_PATH  80
  140. #define FILE_MAX_DIR   80
  141. #define FILE_MAX_DRIVE  3
  142. #define FILE_MAX_FNAME  9
  143. #define FILE_MAX_EXT    5
  144.  
  145. struct                   /* Allocate DTA and define structure */
  146. {
  147.      char path[21];            /* DOS path and filespec */
  148.      char attribute;            /* File attributes wanted */
  149.      int  ftime;            /* File creation time */
  150.      int  fdate;            /* File creation date */
  151.      long size;             /* File size in bytes */
  152.      char filename[13];         /* Filename and extension */
  153. } DTA;                   /* Disk Transfer Area */
  154.  
  155. #define GETFORMULA 0
  156. #define GETLSYS    1
  157. #define GETIFS       2
  158. #define GETPARM    3
  159.  
  160. /* --------------------------------------------------------------------- */
  161. extern char s_iter[];
  162. extern char s_real[];
  163. extern char s_mult[];
  164. extern char s_sum[];
  165. extern char s_imag[];
  166. extern char s_zmag[];
  167. extern char s_bof60[];
  168. extern char s_bof61[];
  169. extern char s_maxiter[];
  170. extern char s_epscross[];
  171. extern char s_startrail[];
  172. extern char s_normal[];
  173. extern char s_period[];
  174.  
  175. char commandmask[13] = {"*.par"};
  176.  
  177. void prompts2_overlay() { }    /* for restore_active_ovly */
  178.  
  179. #if 0
  180. /* --------------------------------------------------------------------- */
  181.  
  182. extern int promptfkeys;
  183.  
  184. int edit_ifs_params()    /* prompt for IFS params */
  185. {
  186.    int totcols;
  187.    int i, j, k, numlines, ret;
  188.    FILE *tempfile;
  189.    char msg[81];
  190.    char filename[81];
  191.    float ftemp;
  192.    int oldhelpmode;
  193.    int low, hi;
  194.  
  195.    if (!ifs_defn && !ifsload())
  196.       return(-1);
  197.  
  198.    totcols = (ifs_type == 0) ? IFSPARM : IFS3DPARM;
  199.    ret = 0;
  200.    oldhelpmode = helpmode;
  201.    helpmode = HT_IFS;
  202.  
  203.    low = 0;
  204.  
  205.    for ( ;; ) {
  206. static char far ifshdg2[]={"2D IFS Parameters"};
  207. static char far ifshdg3[]={"3D IFS Parameters"};
  208. static char far ifsparmmsg1[]={"#    a     b     c     d     e     f"};
  209. static char far ifsparmmsg2[]={"     g     h     i     j     k     l"};
  210. static char far ifsprompt[]={"\
  211. Enter the number of the line you want to edit,\n\
  212. S to save, F6 for corners, or ENTER to end ==>"};
  213.       int leftcol,promptrow,promptcol;
  214. #define IFS_NUM 12
  215.  
  216.       for (numlines = 0; numlines < NUMIFS; numlines++) /* find the first zero entry */
  217.      if (ifs_defn[(numlines * totcols) + totcols - 1] <= 0.0001) break;
  218.  
  219.       helptitle();
  220.       setattr(1,0,C_PROMPT_BKGRD,24*80); /* init rest of screen to background */
  221.       putstringcenter(2,0,80,C_GENERAL_HI,(ifs_type == 0) ? ifshdg2 : ifshdg3);
  222.       leftcol = (ifs_type == 0) ? 15 : 0;
  223.       putstring(4,leftcol+1,C_GENERAL_HI,ifsparmmsg1);
  224.       if (ifs_type != 0)
  225.      putstring(-1,-1,C_GENERAL_HI,ifsparmmsg2);
  226.       putstring(-1,-1,C_GENERAL_HI,"   prob \n\n");
  227.  
  228.       hi = low+IFS_NUM;
  229.       if (hi>numlines) hi = numlines;
  230.       for (i = low; i < hi; i++) {
  231.      sprintf(msg,"%2d", i+1);
  232.      putstring(5+i-low,leftcol,C_GENERAL_HI,msg);
  233.      for (j = 0; j < totcols; j++) {
  234.         sprintf(msg,"%6.2f",ifs_defn[(i*totcols)+j]);
  235.         putstring(-1,-1,C_GENERAL_MED,msg);
  236.         }
  237.      }
  238.       if (hi<numlines) {
  239.      putstring(5+IFS_NUM,leftcol,C_GENERAL_HI,"(more)");
  240.       }
  241.  
  242.       textcbase = 14;
  243.       putstring(5+i-low+1,0,C_GENERAL_HI,ifsprompt);
  244.       promptrow = textrow;
  245.       promptcol = textcol + textcbase + 1;
  246.       temp1[0] = textcbase = 0;
  247.       promptfkeys = 1<<6;
  248.       i = input_field(0,C_GENERAL_INPUT,temp1,2,promptrow,promptcol,
  249.           prompt_checkkey);
  250.       if (i<0) {
  251.       break;
  252.       } else if (i==PAGE_UP) {
  253.       low -= IFS_NUM;
  254.       if (low<0) low=0;
  255.       } else if (i==UP_ARROW) {
  256.       low -= 1;
  257.       if (low<0) low=0;
  258.       } else if (i==DOWN_ARROW) {
  259.       low += 1;
  260.       if (low+IFS_NUM>numlines) low=numlines-IFS_NUM;
  261.       if (low<0) low=0;
  262.       } else if (i==PAGE_DOWN) {
  263.       low += IFS_NUM;
  264.       if (low+IFS_NUM>numlines) low=numlines-IFS_NUM;
  265.       if (low<0) low=0;
  266.       } else if (i==F6) {
  267.       if (get_corners()) {
  268.           ret = 1;
  269.       }
  270.       } else if (i==0) {
  271.       if (temp1[0]==0) break;
  272.       } else {
  273.       continue;
  274.       }
  275.  
  276.       putstring(promptrow,promptcol,C_GENERAL_HI,temp1);
  277.       if (temp1[0] == 's' || temp1[0] == 'S') {
  278.      stackscreen();
  279.      filename[0] = 0;
  280.      i = field_prompt(0,"Enter the name of the .IFS file to save:",
  281.              NULL,filename,60,NULL);
  282.      unstackscreen();
  283.      if (i != -1) {
  284.         if (strchr(filename,'.') == NULL)
  285.            strcat(filename,".ifs");
  286.         if ((tempfile=fopen(filename,"w")) != NULL) {
  287.            for (i = 0; i < numlines; i++) {
  288.           for (j = 0; j < totcols; j++)
  289.              fprintf(tempfile, "%6.2f", (float)ifs_defn[(i*totcols)+j]);
  290.           fprintf(tempfile, "\n");
  291.           }
  292.            fclose(tempfile);
  293.            ifs_changed = 0;
  294.            }
  295.         else {
  296.            static char far msg[]={"Could not create file"};
  297.            stopmsg(0,msg);
  298.            }
  299.         }
  300.      continue;
  301.      }
  302.       i = atoi(temp1) - 1;
  303.       if (i >= 0 && i < numlines) {
  304.      for (j = 0; j < totcols; j++) {
  305.         if (j < totcols-1)
  306.            sprintf(msg,"Parameter %c",'a'+j);
  307.         else
  308.            sprintf(msg,"Probability");
  309.         putstring(promptrow+2,25,C_GENERAL_HI,msg);
  310.         sprintf(temp1,"%6.2f",(float)ifs_defn[k=(i*totcols)+j]);
  311.         if (input_field(1,C_GENERAL_INPUT,temp1,6,
  312.                 textrow,textcol+1,NULL) < 0)
  313.            break;
  314.         if (ifs_defn[k] != (ftemp = atof(temp1))) {
  315.            ifs_defn[k] = ftemp;
  316.            ret = ifs_changed = 1;
  317.            }
  318.         }
  319.      memset(msg,' ',80); msg[81] = 0;
  320.      putstring(promptrow+2,0,C_PROMPT_BKGRD,msg);
  321.      }
  322.       }
  323.  
  324.    helpmode = oldhelpmode;
  325.    return(ret);
  326. }
  327. #endif
  328. /* --------------------------------------------------------------------- */
  329. /*
  330.     get_toggles() is called from FRACTINT.C whenever the 'x' key
  331.     is pressed.  This routine prompts for several options,
  332.     sets the appropriate variables, and returns the following code
  333.     to the calling routine:
  334.  
  335.     -1  routine was ESCAPEd - no need to re-generate the image.
  336.      0  nothing changed, or minor variable such as "overwrite=".
  337.         No need to re-generate the image.
  338.      1  major variable changed (such as "inside=").  Re-generate
  339.         the image.
  340.  
  341.     Finally, remember to insert variables in the list *and* check
  342.     for them in the same order!!!
  343. */
  344. #define LOADCHOICES(X)     {\
  345.    static char far tmp[] = { X };\
  346.    choices[++k]= tmp;\
  347.    }
  348. int get_toggles()
  349. {
  350.    static char far hdg[]={"        Basic Options\n\
  351. (not all combinations make sense)"};
  352.    char far *choices[20];
  353.    int oldhelpmode;
  354.    char prevsavename[81];
  355.    struct fullscreenvalues uvalues[25];
  356.    int i, j, k;
  357.    char old_usr_stdcalcmode;
  358.    int old_maxit,old_inside,old_outside,old_soundflag;
  359.    int old_logflag,old_biomorph,old_decomp;
  360.    int old_fillcolor;
  361.    static char *calcmodes[] ={"1","2","g","b","t"};
  362.    static char *soundmodes[5]={"yes","no","x","y","z"};
  363.  
  364.    ENTER_OVLY(OVLY_PROMPTS2);
  365.  
  366.    k = -1;
  367.  
  368.    LOADCHOICES("Passes (1, 2, g[uessing], b[oundary trace], t[esseral])");
  369.    uvalues[k].type = 'l';
  370.    uvalues[k].uval.ch.vlen = 3;
  371.    uvalues[k].uval.ch.llen = sizeof(calcmodes)/sizeof(*calcmodes);
  372.    uvalues[k].uval.ch.list = calcmodes;
  373.    uvalues[k].uval.ch.val = (usr_stdcalcmode == '1') ? 0
  374.               : (usr_stdcalcmode == '2') ? 1
  375.                           : (usr_stdcalcmode == 'g') ? 2
  376.                           : (usr_stdcalcmode == 'b') ? 3 :4 ;
  377.    old_usr_stdcalcmode = usr_stdcalcmode;
  378.  
  379.    LOADCHOICES("Floating Point Algorithm");
  380.    uvalues[k].type = 'y';
  381.    uvalues[k].uval.ch.val = usr_floatflag;
  382.  
  383.    LOADCHOICES("Maximum Iterations (2 to 32767)");
  384.    uvalues[k].type = 'i';
  385.    uvalues[k].uval.ival = old_maxit = maxit;
  386.  
  387.    LOADCHOICES("Inside Color (<nnn>,maxiter,zmag,bof60,bof61,epscr,star,per)");
  388.    uvalues[k].type = 's';
  389.    if(inside == -59)
  390.       strcpy(uvalues[k].uval.sval,s_zmag);
  391.    else if(inside == -60)
  392.       strcpy(uvalues[k].uval.sval,s_bof60);
  393.    else if(inside == -61)
  394.       strcpy(uvalues[k].uval.sval,s_bof61);
  395.    else if(inside == -100)
  396.       strcpy(uvalues[k].uval.sval,s_epscross);
  397.    else if(inside == -101)
  398.       strcpy(uvalues[k].uval.sval,s_startrail);
  399.    else if(inside == -102)
  400.       strcpy(uvalues[k].uval.sval,s_period);
  401.    else if(inside == -1)
  402.       strcpy(uvalues[k].uval.sval,s_maxiter);
  403.    else
  404.       sprintf(uvalues[k].uval.sval,"%d",inside);
  405.    old_inside = inside;
  406.  
  407.    LOADCHOICES("Outside Color (<nnn>,iter,real,imag,mult,summ)");
  408.    uvalues[k].type = 's';
  409.    if(outside == -1)
  410.       strcpy(uvalues[k].uval.sval,s_iter);
  411.    else if(outside == -2)
  412.       strcpy(uvalues[k].uval.sval,s_real);
  413.    else if(outside == -3)
  414.       strcpy(uvalues[k].uval.sval,s_imag);
  415.    else if(outside == -4)
  416.       strcpy(uvalues[k].uval.sval,s_mult);
  417.    else if(outside == -5)
  418.       strcpy(uvalues[k].uval.sval,s_sum);
  419.    else
  420.       sprintf(uvalues[k].uval.sval,"%d",outside);
  421.    old_outside = outside;
  422.  
  423.    LOADCHOICES("Savename (.GIF implied)");
  424.    uvalues[k].type = 's';
  425.    strcpy(prevsavename,savename);
  426.    strcpy(uvalues[k].uval.sval,savename);
  427.  
  428.    LOADCHOICES("File Overwrite ('overwrite=')");
  429.    uvalues[k].type = 'y';
  430.    uvalues[k].uval.ch.val = overwrite;
  431.  
  432.    LOADCHOICES("Sound (no, yes, x, y, z)");
  433.    uvalues[k].type = 'l';
  434.    uvalues[k].uval.ch.vlen = 3;
  435.    uvalues[k].uval.ch.llen = 5;
  436.    uvalues[k].uval.ch.list = soundmodes;
  437.    uvalues[k].uval.ch.val = 1 + (old_soundflag = soundflag);
  438.  
  439.    if (rangeslen == 0) {
  440.       LOADCHOICES("Log Palette (0=no,1=yes,-1=old,+n=cmprsd,-n=sqrt)");
  441.       uvalues[k].type = 'i';
  442.       }
  443.    else {
  444.       LOADCHOICES("Log Palette (n/a, ranges= parameter is in effect)");
  445.       uvalues[k].type = '*';
  446.       }
  447.    uvalues[k].uval.ival = old_logflag = LogFlag;
  448.  
  449.    LOADCHOICES("Biomorph Color (-1 means OFF)");
  450.    uvalues[k].type = 'i';
  451.    uvalues[k].uval.ival = old_biomorph = usr_biomorph;
  452.  
  453.    LOADCHOICES("Decomp Option (2,4,8,..,256, 0=OFF)");
  454.    uvalues[k].type = 'i';
  455.    uvalues[k].uval.ival = old_decomp = decomp[0];
  456.  
  457.    LOADCHOICES("Fill Color (normal,<nnn>) (works with passes=t and =b)");
  458.    uvalues[k].type = 's';
  459.    if(fillcolor < 0)
  460.       strcpy(uvalues[k].uval.sval,s_normal);
  461.    else
  462.       sprintf(uvalues[k].uval.sval,"%d",fillcolor);
  463.    old_fillcolor = fillcolor;
  464.  
  465.    LOADCHOICES("Orbit delay (0 = none)");
  466.    uvalues[k].type = 'i';
  467.    uvalues[k].uval.ival = orbit_delay;
  468.  
  469. /*
  470.    LOADCHOICES("Antialiasing (0 to 8)");
  471.    uvalues[k].type = 'i';
  472.    uvalues[k].uval.ival = AntiAliasing;
  473. */
  474.  
  475.    oldhelpmode = helpmode;
  476.    helpmode = HELPXOPTS;
  477.    i = fullscreen_prompt(hdg,k+1,choices,uvalues,0,0,NULL);
  478.    helpmode = oldhelpmode;
  479.    if (i < 0) {
  480.       EXIT_OVLY;
  481.       return(-1);
  482.       }
  483.  
  484.    /* now check out the results (*hopefully* in the same order <grin>) */
  485.    k = -1;
  486.    j = 0;   /* return code */
  487.  
  488.    usr_stdcalcmode = calcmodes[uvalues[++k].uval.ch.val][0];
  489.    if (old_usr_stdcalcmode != usr_stdcalcmode) j = 1;
  490.  
  491.    if (uvalues[++k].uval.ch.val != usr_floatflag) {
  492.       usr_floatflag = uvalues[k].uval.ch.val;
  493.       j = 1;
  494.       }
  495.  
  496.    ++k;
  497.    maxit = uvalues[k].uval.ival;
  498.    if (maxit < 2) maxit = 2;
  499.  
  500. /* 'maxit' is an int so it is always <= 32767, MCP 12-3-91
  501.    if (maxit > 32767) maxit = 32767;
  502. */
  503.  
  504.    if (maxit != old_maxit) j = 1;
  505.  
  506.    if(strncmp(strlwr(uvalues[++k].uval.sval),s_zmag,4)==0)
  507.       inside = -59;
  508.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_bof60,5)==0)
  509.       inside = -60;
  510.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_bof61,5)==0)
  511.       inside = -61;
  512.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_epscross,3)==0)
  513.       inside = -100;
  514.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_startrail,4)==0)
  515.       inside = -101;
  516.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_period,3)==0)
  517.       inside = -102;
  518.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_maxiter,5)==0)
  519.       inside = -1;
  520.    else
  521.       inside = atoi(uvalues[k].uval.sval);
  522.    if (inside != old_inside) j = 1;
  523.  
  524.    if(strncmp(strlwr(uvalues[++k].uval.sval),s_real,4)==0)
  525.       outside = -2;
  526.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_imag,4)==0)
  527.       outside = -3;
  528.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_mult,4)==0)
  529.       outside = -4;
  530.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_sum,4)==0)
  531.       outside = -5;
  532.    else if(strncmp(strlwr(uvalues[k].uval.sval),s_iter,4)==0)
  533.       outside = -1;
  534.    else
  535.       outside = atoi(uvalues[k].uval.sval);
  536.    if (outside != old_outside) j = 1;
  537.  
  538.    strcpy(savename,uvalues[++k].uval.sval);
  539.    if (strcmp(savename,prevsavename))
  540.       resave_flag = started_resaves = 0; /* forget pending increment */
  541.  
  542.    overwrite = uvalues[++k].uval.ch.val;
  543.  
  544.    soundflag = uvalues[++k].uval.ch.val - 1;
  545.    if (soundflag != old_soundflag && (soundflag > 1 || old_soundflag > 1))
  546.       j = 1;
  547.  
  548.    LogFlag = uvalues[++k].uval.ival;
  549.    if (LogFlag != old_logflag) j = 1;
  550.  
  551.    usr_biomorph = uvalues[++k].uval.ival;
  552.    if (usr_biomorph != old_biomorph) j = 1;
  553.  
  554.    decomp[0] = uvalues[++k].uval.ival;
  555.    if (decomp[0] != old_decomp) j = 1;
  556.  
  557.    if(strncmp(strlwr(uvalues[++k].uval.sval),s_normal,4)==0)
  558.       fillcolor = -1;
  559.    else
  560.       fillcolor = atoi(uvalues[k].uval.sval);
  561.    if (fillcolor != old_fillcolor) j = 1;
  562.  
  563.    orbit_delay = uvalues[++k].uval.ival;
  564.  
  565. /*
  566.    if(AntiAliasing != uvalues[++k].uval.ival) j = 1;
  567.    AntiAliasing = uvalues[k].uval.ival;
  568.    if(AntiAliasing < 0) AntiAliasing = 0;
  569.    if(AntiAliasing > 8) AntiAliasing = 8;
  570. */
  571.  
  572.    EXIT_OVLY;
  573.    return(j);
  574. }
  575.  
  576. /*
  577.     get_toggles2() is similar to get_toggles, invoked by 'y' key
  578. */
  579.  
  580. int get_toggles2()
  581. {
  582.    static char far hdg[]={"       Extended Options\n\
  583. (not all combinations make sense)"};
  584.    char far *choices[20];
  585.    int oldhelpmode;
  586.  
  587.    struct fullscreenvalues uvalues[25];
  588.    int i, j, k;
  589.  
  590.    int old_rotate_lo,old_rotate_hi;
  591.    int old_usr_distest,old_distestwidth;
  592.    double old_potparam[3],old_inversion[3];
  593.  
  594.    ENTER_OVLY(OVLY_PROMPTS2);
  595.  
  596.    /* fill up the choices (and previous values) arrays */
  597.    k = -1;
  598.  
  599.    LOADCHOICES("Look for finite attractor (0=no,>0=yes,<0=phase)");
  600.    uvalues[k].type = 'i';
  601.    uvalues[k].uval.ch.val = finattract;
  602.  
  603.    LOADCHOICES("Potential Max Color (0 means off)");
  604.    uvalues[k].type = 'i';
  605.    uvalues[k].uval.ival = old_potparam[0] = potparam[0];
  606.  
  607.    LOADCHOICES("          Slope");
  608.    uvalues[k].type = 'd';
  609.    uvalues[k].uval.dval = old_potparam[1] = potparam[1];
  610.  
  611.    LOADCHOICES("          Bailout");
  612.    uvalues[k].type = 'i';
  613.    uvalues[k].uval.ival = old_potparam[2] = potparam[2];
  614.  
  615.    LOADCHOICES("          16 bit values");
  616.    uvalues[k].type = 'y';
  617.    uvalues[k].uval.ch.val = pot16bit;
  618.  
  619.    LOADCHOICES("Distance Estimator (0=off, <0=edge, >0=on):");
  620.    uvalues[k].type = 'i';
  621.    uvalues[k].uval.ival = old_usr_distest = usr_distest;
  622.  
  623.    LOADCHOICES("          width factor:");
  624.    uvalues[k].type = 'i';
  625.    uvalues[k].uval.ival = old_distestwidth = distestwidth;
  626.  
  627.  
  628.  
  629.    LOADCHOICES("Inversion radius or \"auto\" (0 means off)");
  630.    LOADCHOICES("          center X coordinate or \"auto\"");
  631.    LOADCHOICES("          center Y coordinate or \"auto\"");
  632.    k = k - 3;
  633.    for (i= 0; i < 3; i++) {
  634.       uvalues[++k].type = 's';
  635.       if ((old_inversion[i] = inversion[i]) == AUTOINVERT)
  636.      sprintf(uvalues[k].uval.sval,"auto");
  637.       else
  638.      sprintf(uvalues[k].uval.sval,"%g",inversion[i]);
  639.       }
  640.    LOADCHOICES("  (use fixed radius & center when zooming)");
  641.    uvalues[k].type = '*';
  642.  
  643.    LOADCHOICES("Color cycling from color (0 ... 254)");
  644.    uvalues[k].type = 'i';
  645.    uvalues[k].uval.ival = old_rotate_lo = rotate_lo;
  646.  
  647.    LOADCHOICES("              to   color (1 ... 255)");
  648.    uvalues[k].type = 'i';
  649.    uvalues[k].uval.ival = old_rotate_hi = rotate_hi;
  650.  
  651.    oldhelpmode = helpmode;
  652.    helpmode = HELPYOPTS;
  653.    i = fullscreen_prompt(hdg,k+1,choices,uvalues,0,0,NULL);
  654.    helpmode = oldhelpmode;
  655.    if (i < 0) {
  656.       EXIT_OVLY;
  657.       return(-1);
  658.       }
  659.  
  660.    /* now check out the results (*hopefully* in the same order <grin>) */
  661.    k = -1;
  662.    j = 0;   /* return code */
  663.  
  664.    if (uvalues[++k].uval.ch.val != finattract) {
  665.       finattract = uvalues[k].uval.ch.val;
  666.       j = 1;
  667.       }
  668.  
  669.    potparam[0] = uvalues[++k].uval.ival;
  670.    if (potparam[0] != old_potparam[0]) j = 1;
  671.  
  672.    potparam[1] = uvalues[++k].uval.dval;
  673.    if (potparam[0] != 0.0 && potparam[1] != old_potparam[1]) j = 1;
  674.  
  675.    potparam[2] = uvalues[++k].uval.ival;
  676.    if (potparam[0] != 0.0 && potparam[2] != old_potparam[2]) j = 1;
  677.  
  678.    if (uvalues[++k].uval.ch.val != pot16bit) {
  679.       pot16bit = uvalues[k].uval.ch.val;
  680.       if (pot16bit) { /* turned it on */
  681.      if (potparam[0] != 0.0) j = 1;
  682.      }
  683.       else /* turned it off */
  684.      if (dotmode != 11) /* ditch the disk video */
  685.         enddisk();
  686.      else /* keep disk video, but ditch the fraction part at end */
  687.         disk16bit = 0;
  688.       }
  689.  
  690.    ++k;
  691.    usr_distest = (uvalues[k].uval.ival > 32000) ? 32000 : uvalues[k].uval.ival;
  692.    if (usr_distest != old_usr_distest) j = 1;
  693.    ++k;
  694.    distestwidth = uvalues[k].uval.ival;
  695.    if (usr_distest && distestwidth != old_distestwidth) j = 1;
  696.  
  697.    for (i = 0; i < 3; i++) {
  698.       if (uvalues[++k].uval.sval[0] == 'a' || uvalues[k].uval.sval[0] == 'A')
  699.      inversion[i] = AUTOINVERT;
  700.       else
  701.      inversion[i] = atof(uvalues[k].uval.sval);
  702.       if (old_inversion[i] != inversion[i]
  703.     && (i == 0 || inversion[0] != 0.0))
  704.      j = 1;
  705.       }
  706.    invert = (inversion[0] == 0.0) ? 0 : 3;
  707.    ++k;
  708.  
  709.    rotate_lo = uvalues[++k].uval.ival;
  710.    rotate_hi = uvalues[++k].uval.ival;
  711.    if (rotate_lo < 0 || rotate_hi > 255 || rotate_lo > rotate_hi) {
  712.       rotate_lo = old_rotate_lo;
  713.       rotate_hi = old_rotate_hi;
  714.       }
  715.  
  716.    EXIT_OVLY;
  717.    return(j);
  718. }
  719.  
  720. /* --------------------------------------------------------------------- */
  721. /*
  722.     get_view_params() is called from FRACTINT.C whenever the 'v' key
  723.     is pressed.  Return codes are:
  724.     -1  routine was ESCAPEd - no need to re-generate the image.
  725.      0  minor variable changed.  No need to re-generate the image.
  726.      1  View changed.  Re-generate the image.
  727. */
  728.  
  729. int get_view_params()
  730. {
  731.    static char far hdg[]={"View Window Options"};
  732.    char far *choices[8];
  733.  
  734.    int oldhelpmode;
  735.    struct fullscreenvalues uvalues[25];
  736.    int i, k;
  737.    float old_viewreduction,old_aspectratio;
  738.    int old_viewwindow,old_viewcrop,old_viewxdots,old_viewydots;
  739.  
  740.    ENTER_OVLY(OVLY_PROMPTS2);
  741.    stackscreen();
  742.  
  743.    old_viewwindow    = viewwindow;
  744.    old_viewcrop      = viewcrop;
  745.    old_viewreduction = viewreduction;
  746.    old_aspectratio   = finalaspectratio;
  747.    old_viewxdots     = viewxdots;
  748.    old_viewydots     = viewydots;
  749.  
  750. get_view_restart:
  751.    /* fill up the previous values arrays */
  752.    k = -1;
  753.  
  754.    LOADCHOICES("Preview display? (no for full screen)");
  755.    uvalues[k].type = 'y';
  756.    uvalues[k].uval.ch.val = viewwindow;
  757.  
  758.    LOADCHOICES("Auto window size reduction factor");
  759.    uvalues[k].type = 'f';
  760.    uvalues[k].uval.dval = viewreduction;
  761.  
  762.    LOADCHOICES("Final media overall aspect ratio, y/x");
  763.    uvalues[k].type = 'f';
  764.    uvalues[k].uval.dval = finalaspectratio;
  765.  
  766.    LOADCHOICES("Crop starting coordinates to new aspect ratio?");
  767.    uvalues[k].type = 'y';
  768.    uvalues[k].uval.ch.val = viewcrop;
  769.  
  770.    LOADCHOICES("Explicit size x pixels (0 for auto size)");
  771.    uvalues[k].type = 'i';
  772.    uvalues[k].uval.ival = viewxdots;
  773.  
  774.    LOADCHOICES("              y pixels (0 to base on aspect ratio)");
  775.    uvalues[k].type = 'i';
  776.    uvalues[k].uval.ival = viewydots;
  777.  
  778.    LOADCHOICES("");
  779.    uvalues[k].type = '*';
  780.  
  781.    LOADCHOICES("Press F4 to reset view parameters to defaults.");
  782.    uvalues[k].type = '*';
  783.  
  784.    oldhelpmode = helpmode;     /* this prevents HELP from activating */
  785.    helpmode = HELPVIEW;
  786.    i = fullscreen_prompt(hdg,k+1,choices,uvalues,0,16,NULL);
  787.    helpmode = oldhelpmode;     /* re-enable HELP */
  788.    if (i < 0) {
  789.       viewwindow    = old_viewwindow;
  790.       viewcrop        = old_viewcrop;
  791.       viewreduction = old_viewreduction;
  792.       finalaspectratio = old_aspectratio;
  793.       viewxdots     = old_viewxdots;
  794.       viewydots     = old_viewydots;
  795.       unstackscreen();
  796.       EXIT_OVLY;
  797.       return(-1);
  798.       }
  799.  
  800.    if (i == F4) {
  801.       viewwindow = viewxdots = viewydots = 0;
  802.       viewreduction = 4.2;
  803.       viewcrop = 1;
  804.       finalaspectratio = screenaspect;
  805.       goto get_view_restart;
  806.       }
  807.  
  808.    /* now check out the results (*hopefully* in the same order <grin>) */
  809.    k = -1;
  810.  
  811.    viewwindow = uvalues[++k].uval.ch.val;
  812.  
  813.    viewreduction = uvalues[++k].uval.dval;
  814.  
  815.    if ((finalaspectratio = uvalues[++k].uval.dval) == 0)
  816.       finalaspectratio = screenaspect;
  817.  
  818.    viewcrop = uvalues[++k].uval.ch.val;
  819.  
  820.    viewxdots = uvalues[++k].uval.ival;
  821.    viewydots = uvalues[++k].uval.ival;
  822.  
  823.    if (finalaspectratio != old_aspectratio && viewcrop)
  824.       aspectratio_crop(old_aspectratio,finalaspectratio);
  825.  
  826.    i = 0;
  827.    if (viewwindow != old_viewwindow
  828.       || (viewwindow
  829.      && (  viewreduction != old_viewreduction
  830.         || finalaspectratio != old_aspectratio
  831.         || viewxdots != old_viewxdots
  832.         || (viewydots != old_viewydots && viewxdots) ) ) )
  833.       i = 1;
  834.  
  835.    unstackscreen();
  836.    EXIT_OVLY;
  837.    return(i);
  838. }
  839.  
  840. /*
  841.     get_cmd_string() is called from FRACTINT.C whenever the 'g' key
  842.     is pressed.  Return codes are:
  843.     -1  routine was ESCAPEd - no need to re-generate the image.
  844.      0  parameter changed, no need to regenerate
  845.     >0  parameter changed, regenerate
  846. */
  847.  
  848. int get_cmd_string()
  849. {
  850.    int oldhelpmode;
  851.    int i;
  852.    char cmdbuf[61];
  853.  
  854.    ENTER_OVLY(OVLY_PROMPTS2);
  855.  
  856.    oldhelpmode = helpmode;
  857.    helpmode = HELPCOMMANDS;
  858.    cmdbuf[0] = 0;
  859.    i = field_prompt(0,"Enter command string to use.",NULL,cmdbuf,60,NULL);
  860.    helpmode = oldhelpmode;
  861.    if (i >= 0 && cmdbuf[0] != 0)
  862.        i = cmdarg(cmdbuf, 2);
  863.  
  864.    EXIT_OVLY;
  865.    return(i);
  866. }
  867.  
  868.  
  869. /* --------------------------------------------------------------------- */
  870.  
  871. int Distribution = 30, Offset = 0, Slope = 25;
  872. long con;
  873.  
  874. static char far sf1[] = {"Star Density in Pixels per Star"};
  875. static char far sf2[] = {"Percent Clumpiness"};
  876. static char far sf3[] = {"Ratio of Dim stars to Bright"};
  877. static char far *starfield_prompts[] = {sf1,sf2,sf3};
  878.  
  879. static double starfield_values[4] = {
  880.     30.0,100.0,5.0,0.0
  881.     };
  882.  
  883. char GreyFile[] = "altern.map";
  884.  
  885. int starfield(void)
  886. {
  887.    int c;
  888.    extern char busy;
  889.    busy = 1;
  890.    if (starfield_values[0] <   1.0) starfield_values[0] =   1.0;
  891.    if (starfield_values[0] > 100.0) starfield_values[0] = 100.0;
  892.    if (starfield_values[1] <   1.0) starfield_values[1] =   1.0;
  893.    if (starfield_values[1] > 100.0) starfield_values[1] = 100.0;
  894.    if (starfield_values[2] <   1.0) starfield_values[2] =   1.0;
  895.    if (starfield_values[2] > 100.0) starfield_values[2] = 100.0;
  896.  
  897.    Distribution = (int)(starfield_values[0]);
  898.    con    = (long)(((starfield_values[1]) / 100.0) * (1L << 16));
  899.    Slope = (int)(starfield_values[2]);
  900.  
  901.    if (ValidateLuts(GreyFile) != 0) {
  902.       static char far msg[]={"Unable to load ALTERN.MAP"};
  903.       stopmsg(0,msg);
  904.       busy = 0;
  905.       return(-1);
  906.       }
  907.    spindac(0,1);         /* load it, but don't spin */
  908.    for(row = 0; row < ydots; row++) {
  909.       for(col = 0; col < xdots; col++) {
  910.      if(keypressed()) {
  911.         buzzer(1);
  912.         busy = 0;
  913.         return(1);
  914.         }
  915.      c = getcolor(col, row);
  916.          if(c == inside)
  917.             c = colors-1;
  918.      putcolor(col, row, GausianNumber(c, colors));
  919.       }
  920.    }
  921.    buzzer(0);
  922.    busy = 0;
  923.    return(0);
  924. }
  925.  
  926. int get_starfield_params(void) {
  927.    static char far hdg[]={"Starfield Parameters"};
  928.    struct fullscreenvalues uvalues[3];
  929.    int oldhelpmode, status;
  930.    int i;
  931.  
  932.    ENTER_OVLY(OVLY_PROMPTS2);
  933.  
  934.    if(colors < 255) {
  935.       static char far msg[]={"starfield requires 256 color mode"};
  936.       stopmsg(0,msg);
  937.  
  938.       EXIT_OVLY;
  939.       return(-1);
  940.    }
  941.    for (i = 0; i < 3; i++) {
  942.       uvalues[i].uval.dval = starfield_values[i];
  943.       uvalues[i].type = 'f';
  944.    }
  945.    stackscreen();
  946.    oldhelpmode = helpmode;
  947.    helpmode = HELPSTARFLD;
  948.    i = fullscreen_prompt(hdg,3,starfield_prompts,uvalues,0,0,NULL);
  949.    helpmode = oldhelpmode;
  950.    if (i < 0) {
  951.       unstackscreen();
  952.       EXIT_OVLY;
  953.       return(-1);
  954.       }
  955.    unstackscreen();
  956.  
  957.    for (i = 0; i < 3; i++)
  958.       starfield_values[i] = uvalues[i].uval.dval;
  959.  
  960.    EXIT_OVLY;
  961.    return(0);
  962. }
  963.  
  964. int get_a_number(double *x, double *y)
  965. {
  966.    static char far hdg[]={"Set Cursor Coordinates"};
  967.    double x1,y2;
  968.    char far *choices[2];
  969.  
  970.    int oldhelpmode;
  971.    struct fullscreenvalues uvalues[2];
  972.    int i, k;
  973.  
  974.    ENTER_OVLY(OVLY_PROMPTS2);
  975.    stackscreen();
  976.  
  977.    /* fill up the previous values arrays */
  978.    k = -1;
  979.  
  980.    LOADCHOICES("X coordinate at cursor");
  981.    uvalues[k].type = 'd';
  982.    uvalues[k].uval.dval = *x;
  983.  
  984.    LOADCHOICES("Y coordinate at cursor");
  985.    uvalues[k].type = 'd';
  986.    uvalues[k].uval.dval = *y;
  987.  
  988.    i = fullscreen_prompt(hdg,k+1,choices,uvalues,0,25,NULL);
  989.    if (i < 0) {
  990.       unstackscreen();
  991.       EXIT_OVLY;
  992.       return(-1);
  993.       }
  994.  
  995.    /* now check out the results (*hopefully* in the same order <grin>) */
  996.    k = -1;
  997.  
  998.    *x = uvalues[++k].uval.dval;
  999.    *y = uvalues[++k].uval.dval;
  1000.  
  1001.    unstackscreen();
  1002.    EXIT_OVLY;
  1003.    return(i);
  1004. }
  1005.  
  1006. /* --------------------------------------------------------------------- */
  1007.  
  1008. int get_commands()        /* execute commands from file */
  1009. {
  1010.    int ret;
  1011.    FILE *parmfile;
  1012.    long point;
  1013.    int oldhelpmode;
  1014.    ENTER_OVLY(OVLY_PROMPTS2);
  1015.    ret = 0;
  1016.    oldhelpmode = helpmode;
  1017.    helpmode = HELPPARMFILE;
  1018.    if ((point = get_file_entry(GETPARM,"Parameter Set",
  1019.                    commandmask,CommandFile,CommandName)) >= 0
  1020.      && (parmfile = fopen(CommandFile,"rb"))) {
  1021.       fseek(parmfile,point,SEEK_SET);
  1022.       ret = load_commands(parmfile);
  1023.       }
  1024.    helpmode = oldhelpmode;
  1025.    EXIT_OVLY;
  1026.    return(ret);
  1027. }
  1028.  
  1029. /* --------------------------------------------------------------------- */
  1030.  
  1031. void goodbye()            /* we done.  Bail out */
  1032. {
  1033.    static char far goodbyemessage[]={"   Thank You for using FRACTINT"};
  1034.    extern BYTE exitmode;
  1035.    extern int mode7text;
  1036.    extern int made_dsktemp;
  1037. #ifndef XFRACT
  1038.    union REGS r;
  1039. #endif
  1040.  
  1041. #ifdef WINFRACT
  1042.    return;
  1043. #endif
  1044.  
  1045.    setvideotext();
  1046. #ifdef XFRACT
  1047.    UnixDone();
  1048.    printf("\n\n\n%s\n",goodbyemessage); /* printf takes far pointer */
  1049. #else
  1050.    r.h.al = (mode7text == 0) ? exitmode : 7;
  1051.    r.h.ah = 0;
  1052.    int86(0x10, &r, &r);
  1053.    printf("\n\n\n%Fs\n",goodbyemessage); /* printf takes far pointer */
  1054. #endif
  1055.    movecursor(6,0);
  1056.    discardgraphics(); /* if any emm/xmm tied up there, release it */
  1057.    stopslideshow();
  1058. #ifndef XFRACT
  1059.    if (made_dsktemp)
  1060.       remove(diskfilename);
  1061. #endif
  1062.    end_help();
  1063.    if (initbatch == 3) /* exit with error code for batch file */
  1064.      exit(2);
  1065.    else if (initbatch == 4)
  1066.      exit(1);
  1067.    else
  1068.      exit(0);
  1069. }
  1070.  
  1071.  
  1072. /* --------------------------------------------------------------------- */
  1073.  
  1074. #ifdef XFRACT
  1075. static char searchdir[FILE_MAX_DIR];
  1076. static char searchname[FILE_MAX_PATH];
  1077. static char searchext[FILE_MAX_EXT];
  1078. static DIR *currdir = NULL;
  1079. #endif
  1080. static int  findfirst(char *path)       /* Find 1st file (or subdir) meeting path/filespec */
  1081. {
  1082. #ifndef XFRACT
  1083.      union REGS regs;
  1084.      regs.h.ah = 0x1A;           /* Set DTA to filedata */
  1085.      regs.x.dx = (unsigned)&DTA;
  1086.      intdos(®s, ®s);
  1087.      regs.h.ah = 0x4E;           /* Find 1st file meeting path */
  1088.      regs.x.dx = (unsigned)path;
  1089.      regs.x.cx = FILEATTR;
  1090.      intdos(®s, ®s);
  1091.      return(regs.x.ax);        /* Return error code */
  1092. #else
  1093.      if (currdir != NULL) {
  1094.          closedir(currdir);
  1095.          currdir = NULL;
  1096.      }
  1097.      splitpath(path,NULL,searchdir,searchname,searchext);
  1098.      if (searchdir[0]=='\0') {
  1099.          currdir = opendir(".");
  1100.      } else {
  1101.          currdir = opendir(searchdir);
  1102.      }
  1103.      if (currdir==NULL) {
  1104.          return -1;
  1105.      } else {
  1106.          return findnext();
  1107.      }
  1108. #endif
  1109. }
  1110.  
  1111. static int  findnext()        /* Find next file (or subdir) meeting above path/filespec */
  1112. {
  1113. #ifndef XFRACT
  1114.      union REGS regs;
  1115.      regs.h.ah = 0x4F;           /* Find next file meeting path */
  1116.      regs.x.dx = (unsigned)&DTA;
  1117.      intdos(®s, ®s);
  1118.      return(regs.x.ax);
  1119. #else
  1120. #ifdef DIRENT
  1121.      struct dirent *dirEntry;
  1122. #else
  1123.      struct direct *dirEntry;
  1124. #endif
  1125.      struct stat sbuf;
  1126.      char thisname[FILE_MAX_PATH];
  1127.      char tmpname[FILE_MAX_PATH];
  1128.      char thisext[FILE_MAX_EXT];
  1129.      while (1) {
  1130.          dirEntry = readdir(currdir);
  1131.          if (dirEntry == NULL) {
  1132.              closedir(currdir);
  1133.              currdir = NULL;
  1134.              return -1;
  1135.          } else if (dirEntry->d_ino != 0) {
  1136.              splitpath(dirEntry->d_name,NULL,NULL,thisname,thisext);
  1137.              if ((searchname[0]=='*' || strcmp(searchname,thisname)==0) &&
  1138.                      (searchext[0]=='*' || strcmp(searchext,thisext)==0)) {
  1139.                  strncpy(DTA.filename,dirEntry->d_name,20);
  1140.                  DTA.filename[20]=='\0';
  1141.                  strcpy(tmpname,searchdir);
  1142.                  strcat(tmpname,"/");
  1143.                  strcat(tmpname,dirEntry->d_name);
  1144.                  stat(tmpname,&sbuf);
  1145.                  if ((sbuf.st_mode&S_IFMT)==S_IFREG) {
  1146.                      DTA.attribute = 0;
  1147.                  } else if ((sbuf.st_mode&S_IFMT)==S_IFDIR) {
  1148.                      DTA.attribute = SUBDIR;
  1149.                  } else {
  1150.                      continue;
  1151.                  }
  1152.                  DTA.size = sbuf.st_size;
  1153.                  return 0;
  1154.              }
  1155.          }
  1156.      }
  1157. #endif
  1158. }
  1159.  
  1160. int lccompare(VOIDCONSTPTR arg1, VOIDCONSTPTR arg2) /* for qsort */
  1161. {
  1162.    return(strncasecmp(*((char **)arg1),*((char **)arg2),40));
  1163. }
  1164.  
  1165. static char *masks[] = {"*.pot","*.gif"};
  1166. static int speedstate;
  1167.  
  1168. int getafilename(char *hdg,char *template,char *flname)
  1169. {
  1170.    static char far instr[]={"Press F6 for default or environment directory"};
  1171.    int masklen;
  1172.    char filename[13];
  1173.    char speedstr[81];
  1174.    char tmpmask[FILE_MAX_PATH];   /* used to locate next file in list */
  1175.    static int numtemplates = 1;
  1176.    int i,j;
  1177.    int out;
  1178.    int retried;
  1179.    struct CHOICE
  1180.    {
  1181.       char name[13];
  1182.       char type;
  1183.    }
  1184.    *choices[MAXNUMFILES];
  1185.    int attributes[MAXNUMFILES];
  1186.    int filecount;   /* how many files */
  1187.    int dircount;    /* how many directories */
  1188.    int notroot;     /* not the root directory */
  1189.  
  1190.    char drive[FILE_MAX_DRIVE];
  1191.    char dir[FILE_MAX_DIR];
  1192.    char fname[FILE_MAX_FNAME];
  1193.    char ext[FILE_MAX_EXT];
  1194.  
  1195.    ENTER_OVLY(OVLY_PROMPTS2);
  1196.  
  1197.    /* steal existing array for "choices" */
  1198.    choices[0] = (struct CHOICE *)boxy;
  1199.    attributes[0] = 1;
  1200.    for(i=1;i<MAXNUMFILES;i++)
  1201.    {
  1202.       choices[i] = choices[i-1] + 1;
  1203.       attributes[i] = 1;
  1204.    }
  1205.  
  1206. restart:  /* return here if template or directory changes */
  1207.  
  1208.    tmpmask[0] = 0;
  1209.    if(flname[0] == 0)
  1210.       strcpy(flname,DOTSLASH);
  1211.    splitpath(flname ,drive,dir,fname,ext);
  1212.    makepath(filename,""   ,"" ,fname,ext);
  1213.    retried = 0;
  1214. retry_dir:
  1215.    if (dir[0] == 0)
  1216.       strcpy(dir,".");
  1217.    expand_dirname(dir,drive);
  1218.    makepath(tmpmask,drive,dir,"","");
  1219.    fix_dirname(tmpmask);
  1220.    if (retried == 0 && strcmp(dir,SLASH) && strcmp(dir,DOTSLASH))
  1221.    {
  1222.       tmpmask[(j = strlen(tmpmask) - 1)] = 0; /* strip trailing \ */
  1223.       if (strchr(tmpmask,'*') || strchr(tmpmask,'?')
  1224.     || findfirst(tmpmask) != 0
  1225.     || (DTA.attribute & SUBDIR) == 0)
  1226.       {
  1227.          strcpy(dir,DOTSLASH);
  1228.      ++retried;
  1229.      goto retry_dir;
  1230.       }
  1231.       tmpmask[j] = SLASHC;
  1232.    }
  1233.    if(template[0])
  1234.    {
  1235.       numtemplates = 1;
  1236.       splitpath(template,NULL,NULL,fname,ext);
  1237.    }
  1238.    else
  1239.       numtemplates = sizeof(masks)/sizeof(masks[0]);
  1240.    filecount = -1;
  1241.    dircount  = 0;
  1242.    notroot   = 0;
  1243.    j = 0;
  1244.    masklen = strlen(tmpmask);
  1245.    strcat(tmpmask,"*.*");
  1246.    out = findfirst(tmpmask);
  1247.    while(out == 0 && filecount < MAXNUMFILES)
  1248.    {
  1249.       if((DTA.attribute & SUBDIR) && strcmp(DTA.filename,"."))
  1250.       {
  1251.      strlwr(DTA.filename);
  1252.      if(strcmp(DTA.filename,".."))
  1253.             strcat(DTA.filename,SLASH);
  1254.      strncpy(choices[++filecount]->name,DTA.filename,13);
  1255.      choices[filecount]->name[12] = '\0';
  1256.      choices[filecount]->type = 1;
  1257.      dircount++;
  1258.      if(strcmp(DTA.filename,"..")==0)
  1259.         notroot = 1;
  1260.       }
  1261.       out = findnext();
  1262.    }
  1263.    tmpmask[masklen] = 0;
  1264.    if(template[0])
  1265.       makepath(tmpmask,drive,dir,fname,ext);
  1266.    do
  1267.    {
  1268.       if(numtemplates > 1)
  1269.      strcpy(&(tmpmask[masklen]),masks[j]);
  1270.       out = findfirst(tmpmask);
  1271.       while(out == 0 && filecount < MAXNUMFILES)
  1272.       {
  1273.      if(!(DTA.attribute & SUBDIR))
  1274.      {
  1275.         strlwr(DTA.filename);
  1276.         strncpy(choices[++filecount]->name,DTA.filename,13);
  1277.         choices[filecount]->type = 0;
  1278.      }
  1279.      out = findnext();
  1280.       }
  1281.    }
  1282.    while (++j < numtemplates);
  1283.    if (++filecount == 0)
  1284.    {
  1285.       strcpy(choices[filecount]->name,"*nofiles*");
  1286.       choices[filecount]->type = 0;
  1287.       ++filecount;
  1288.    }
  1289.    qsort(choices,filecount,sizeof(char *),lccompare); /* sort type list */
  1290.    if(notroot == 0 && dir[0] && dir[0] != SLASHC) /* must be in root directory */
  1291.    {
  1292.       splitpath(tmpmask,drive,dir,fname,ext);
  1293.       strcpy(dir,SLASH);
  1294.       makepath(tmpmask,drive,dir,fname,ext);
  1295.    }
  1296.    if(numtemplates > 1)
  1297.       strcat(tmpmask," *.pot");
  1298.    strcpy(temp1,hdg);
  1299.    strcat(temp1,"\nTemplate: ");
  1300.    strcat(temp1,tmpmask);
  1301.    strcpy(speedstr,filename);
  1302.    if (speedstr[0] == 0)
  1303.    {
  1304.       for (i=0; i<filecount; i++) /* find first file */
  1305.      if (choices[i]->type == 0)
  1306.         break;
  1307.       if (i >= filecount)
  1308.      i = 0;
  1309.    }
  1310.    i = fullscreen_choice(8,temp1,NULL,instr,filecount,(char **)choices,
  1311.           attributes,5,99,12,i,NULL,speedstr,filename_speedstr,check_f6_key);
  1312.    if (i==-F6)
  1313.    {
  1314.       static int lastdir=0;
  1315.       if (lastdir==0)
  1316.       {
  1317.      strcpy(dir,fract_dir1);
  1318.       }
  1319.       else
  1320.       {
  1321.      strcpy(dir,fract_dir2);
  1322.       }
  1323.       fix_dirname(dir);
  1324.        makepath(flname,drive,dir,"","");
  1325.        lastdir = 1-lastdir;
  1326.        goto restart;
  1327.    }
  1328.    if (i < 0)
  1329.    {
  1330.       EXIT_OVLY;
  1331.       return(-1);
  1332.    }
  1333.    if(speedstr[0] == 0 || speedstate == MATCHING)
  1334.    {
  1335.       if(choices[i]->type)
  1336.       {
  1337.      if(strcmp(choices[i]->name,"..") == 0) /* go up a directory */
  1338.      {
  1339.         if(strcmp(dir,DOTSLASH) == 0)
  1340.            strcpy(dir,DOTDOTSLASH);
  1341.         else
  1342.         {
  1343.            char *s;
  1344.            if(s = strrchr(dir,SLASHC)) /* trailing slash */
  1345.            {
  1346.           *s = 0;
  1347.           if(s = strrchr(dir,SLASHC))
  1348.              *(s+1) = 0;
  1349.            }
  1350.         }
  1351.      }
  1352.      else  /* go down a directory */
  1353.         strcat(dir,choices[i]->name);
  1354.      fix_dirname(dir);
  1355.      makepath(flname,drive,dir,"","");
  1356.      goto restart;
  1357.       }
  1358.       splitpath(choices[i]->name,NULL,NULL,fname,ext);
  1359.       makepath(flname,drive,dir,fname,ext);
  1360.    }
  1361.    else
  1362.    {
  1363.       if (speedstate == SEARCHPATH
  1364.     && strchr(speedstr,'*') == 0 && strchr(speedstr,'?') == 0
  1365.     && findfirst(speedstr) == 0
  1366.     && (DTA.attribute & SUBDIR)) /* it is a directory */
  1367.      speedstate = TEMPLATE;
  1368.       if(speedstate == TEMPLATE)
  1369.       {
  1370.      /* extract from tempstr the pathname and template information,
  1371.         being careful not to overwrite drive and directory if not
  1372.         newly specified */
  1373.      char drive1[FILE_MAX_DRIVE];
  1374.      char dir1[FILE_MAX_DIR];
  1375.      char fname1[FILE_MAX_FNAME];
  1376.      char ext1[FILE_MAX_EXT];
  1377.      splitpath(speedstr,drive1,dir1,fname1,ext1);
  1378.      if(drive1[0])
  1379.         strcpy(drive,drive1);
  1380.      if(dir1[0])
  1381.         strcpy(dir,dir1);
  1382.      makepath(flname,drive,dir,fname1,ext1);
  1383.      if(strchr(fname1,'*') || strchr(fname1,'?') ||
  1384.          strchr(ext1  ,'*') || strchr(ext1  ,'?'))
  1385.         makepath(template,"","",fname1,ext1);
  1386.      else if(isadirectory(flname))
  1387.         fix_dirname(flname);
  1388.      goto restart;
  1389.       }
  1390.       else /* speedstate == SEARCHPATH */
  1391.       {
  1392.      char fullpath[80];
  1393.       /* if (strchr(speedstr,'.') == NULL)
  1394.         strcat(speedstr,".gif"); */
  1395.      findpath(speedstr,fullpath);
  1396.      if(fullpath[0])
  1397.         strcpy(flname,fullpath);
  1398.      else
  1399.      {  /* failed, make diagnostic useful: */
  1400.         strcpy(flname,speedstr);
  1401.         if (strchr(speedstr,SLASHC) == NULL)
  1402.         {
  1403.            splitpath(speedstr,NULL,NULL,fname,ext);
  1404.            makepath(flname,drive,dir,fname,ext);
  1405.         }
  1406.      }
  1407.       }
  1408.    }
  1409.    EXIT_OVLY;
  1410.    return(0);
  1411. }
  1412.  
  1413. static int check_f6_key(int curkey,int choice)
  1414. {
  1415.    if (curkey == F6)
  1416.       return 0-F6;
  1417.    return 0;
  1418. }
  1419.  
  1420. static int filename_speedstr(int row, int col, int vid,
  1421.                  char *speedstring, int speed_match)
  1422. {
  1423.    extern char speed_prompt[];
  1424.    char *prompt;
  1425.    if ( strchr(speedstring,':')
  1426.      || strchr(speedstring,'*') || strchr(speedstring,'*')
  1427.      || strchr(speedstring,'?')) {
  1428.       speedstate = TEMPLATE;  /* template */
  1429.       prompt = "File Template";
  1430.       }
  1431.    else if (speed_match) {
  1432.       speedstate = SEARCHPATH; /* does not match list */
  1433.       prompt = "Search Path for";
  1434.       }
  1435.    else {
  1436.       speedstate = MATCHING;
  1437.       prompt = speed_prompt;
  1438.       }
  1439.    putstring(row,col,vid,prompt);
  1440.    return(strlen(prompt));
  1441. }
  1442.  
  1443. static int isadirectory(char *s)
  1444. {
  1445.    if(strchr(s,'*') || strchr(s,'?'))
  1446.       return(0); /* for my purposes, not a directory */
  1447.    if(findfirst(s) != 0) /* couldn't find it */
  1448.    {
  1449.       /* any better ideas?? */
  1450.       if(strchr(s,SLASHC)) /* we'll guess it is a directory */
  1451.      return(1);
  1452.       else
  1453.      return(0);  /* no slashes - we'll guess it's a file */
  1454.    }
  1455.    else if(DTA.attribute & SUBDIR)
  1456.       return(1);   /* we're SURE it's a directory */
  1457.    else
  1458.       return(0);
  1459. }
  1460.  
  1461.  
  1462. #ifndef XFRACT    /* This routine moved to unix.c so we can use it in hc.c */
  1463. int splitpath(char *template,char *drive,char *dir,char *fname,char *ext)
  1464. {
  1465.    int length;
  1466.    int len;
  1467.    int offset;
  1468.    char *tmp;
  1469.  
  1470.    if(drive)
  1471.       drive[0] = 0;
  1472.    if(dir)
  1473.       dir[0]   = 0;
  1474.    if(fname)
  1475.       fname[0] = 0;
  1476.    if(ext)
  1477.       ext[0]   = 0;
  1478.  
  1479.    if((length = strlen(template)) == 0)
  1480.       return(0);
  1481.    offset = 0;
  1482.  
  1483.    /* get drive */
  1484.    if(length >= 2)
  1485.       if(template[1] == ':')
  1486.       {
  1487.      if(drive)
  1488.      {
  1489.         drive[0] = template[offset++];
  1490.         drive[1] = template[offset++];
  1491.         drive[2] = 0;
  1492.      }
  1493.      else
  1494.      {
  1495.         offset++;
  1496.         offset++;
  1497.      }
  1498.       }
  1499.  
  1500.    /* get dir */
  1501.    if(offset < length)
  1502.    {
  1503.       tmp = strrchr(template,SLASHC);
  1504.       if(tmp)
  1505.       {
  1506.      tmp++;  /* first character after slash */
  1507.      len = tmp - &template[offset];
  1508.      if(len >=0 && len < 80 && dir)
  1509.         strncpy(dir,&template[offset],len);
  1510.      if(len < 80 && dir)
  1511.         dir[len] = 0;
  1512.      offset += len;
  1513.       }
  1514.    }
  1515.    else
  1516.       return(0);
  1517.  
  1518.    /* get fname */
  1519.    if(offset < length)
  1520.    {
  1521.       tmp = strrchr(template,'.');
  1522.       if(tmp < strrchr(template,SLASHC) || tmp < strrchr(template,':'))
  1523.      tmp = 0; /* in this case the '.' must be a directory */
  1524.       if(tmp)
  1525.       {
  1526.      tmp++; /* first character past "." */
  1527.      len = tmp - &template[offset];
  1528.      if((len > 0) && (offset+len < length) && fname)
  1529.      {
  1530.         strncpy(fname,&template[offset],len);
  1531.         fname[len] = 0;
  1532.      }
  1533.      offset += len;
  1534.      if((offset < length) && ext)
  1535.         strcpy(ext,&template[offset]);
  1536.       }
  1537.       else if((offset < length) && fname)
  1538.      strcpy(fname,&template[offset]);
  1539.    }
  1540.    return(0);
  1541. }
  1542. #endif
  1543.  
  1544. static makepath(char *template,char *drive,char *dir,char *fname,char *ext)
  1545. {
  1546. #ifndef XFRACT
  1547.    strcpy(template,drive);
  1548.    strcat(template,dir);
  1549. #else
  1550.    strcpy(template,dir);
  1551. #endif
  1552.    strcat(template,fname);
  1553.    strcat(template,ext);
  1554.    return(0);
  1555. }
  1556.  
  1557.  
  1558. /* fix up directory names */
  1559. static void fix_dirname(char *dirname)
  1560. {
  1561.    int length;
  1562.    /* scrub white space from end for safety */
  1563.    length = strlen(dirname); /* index of last character */
  1564.    while (--length >= 0 && isspace(dirname[length])) { }
  1565.    dirname[++length] = 0;
  1566.    /* make sure dirname ends with a slash */
  1567.    if(length == 0 || dirname[length-1] != SLASHC)
  1568.       strcat(dirname,SLASH);
  1569. }
  1570.  
  1571. static int expand_dirname(char *dirname,char *drive)
  1572. {
  1573.    fix_dirname(dirname);
  1574.    if (dirname[0] != SLASHC) {
  1575.       char buf[81],curdir[81];
  1576. #ifndef XFRACT
  1577.       union REGS regs;
  1578.       struct SREGS sregs;
  1579.       curdir[0] = 0;
  1580.       regs.h.ah = 0x47; /* get current directory */
  1581.       regs.h.dl = 0;
  1582.       if (drive[0] && drive[0] != ' ')
  1583.      regs.h.dl = tolower(drive[0])-'a'+1;
  1584.       regs.x.si = (unsigned int) &curdir[0];
  1585.       segread(&sregs);
  1586.       intdosx(®s, ®s, &sregs);
  1587. #else
  1588.       getwd(curdir);
  1589. #endif
  1590.       strcat(curdir,SLASH);
  1591.       while (strncmp(dirname,DOTSLASH,2) == 0) {
  1592.      strcpy(buf,&dirname[2]);
  1593.      strcpy(dirname,buf);
  1594.      }
  1595.       while (strncmp(dirname,DOTDOTSLASH,3) == 0) {
  1596.      char *s;
  1597.      curdir[strlen(curdir)-1] = 0; /* strip trailing slash */
  1598.      if (s = strrchr(curdir,SLASHC))
  1599.         *s = 0;
  1600.      strcat(curdir,SLASH);
  1601.      strcpy(buf,&dirname[3]);
  1602.      strcpy(dirname,buf);
  1603.      }
  1604.       strcpy(buf,dirname);
  1605.       dirname[0] = 0;
  1606.       if (curdir[0] != SLASHC)
  1607.      strcpy(dirname,SLASH);
  1608.       strcat(dirname,curdir);
  1609.       strcat(dirname,buf);
  1610.       }
  1611.    return(0);
  1612. }
  1613.  
  1614. #define LOADPROMPTS(X)     {\
  1615.    static char far tmp[] = { X };\
  1616.    prompts[++nump]= tmp;\
  1617.    }
  1618.  
  1619. int get_corners()
  1620. {
  1621.    struct fullscreenvalues values[15];
  1622.    char far *prompts[15];
  1623.    static char far xprompt[]={"          X"};
  1624.    static char far yprompt[]={"          Y"};
  1625.    static char far zprompt[]={"          Z"};
  1626.    int i,nump,prompt_ret;
  1627.    int cmag,transp3d;
  1628.    double Xctr,Yctr,Mag;
  1629.    BYTE ousemag;
  1630.    double oxxmin,oxxmax,oyymin,oyymax,oxx3rd,oyy3rd;
  1631.    double ozzmin,ozzmax,ottmin,ottmax;
  1632.    /* note that hdg[15] is used for non-transparent heading: */
  1633.    static char far hdg[]={"Transparent 3d Image Coordinates"};
  1634.    int oldhelpmode;
  1635.  
  1636.    transp3d = (Transparent3D && fractalspecific[fractype].orbitcalc == Formula);
  1637.    oldhelpmode = helpmode;
  1638.    ousemag = usemag;
  1639.    oxxmin = xxmin; oxxmax = xxmax;
  1640.    oyymin = yymin; oyymax = yymax;
  1641.    oxx3rd = xx3rd; oyy3rd = yy3rd;
  1642.    ozzmin = zzmin; ozzmax = zzmax;
  1643.    ottmin = ttmin; ottmax = ttmax;
  1644.  
  1645. gc_loop:
  1646.    for (i = 0; i < 15; ++i)
  1647.       values[i].type = 'd'; /* most values on this screen are type d */
  1648.    cmag = (!transp3d && usemag && cvtcentermag(&Xctr, &Yctr, &Mag));
  1649.  
  1650.    nump = -1;
  1651.    if (cmag) {
  1652.       LOADPROMPTS("Center X");
  1653.       values[nump].uval.dval = Xctr;
  1654.       LOADPROMPTS("Center Y");
  1655.       values[nump].uval.dval = Yctr;
  1656.       LOADPROMPTS("Magnification");
  1657.       values[nump].uval.dval = Mag;
  1658.       LOADPROMPTS("");
  1659.       values[nump].type = '*';
  1660.       LOADPROMPTS("Press F7 to switch to \"corners\" mode");
  1661.       values[nump].type = '*';
  1662.       }
  1663.  
  1664.    else {
  1665.       LOADPROMPTS("Top-Left Corner");
  1666.       values[nump].type = '*';
  1667.       prompts[++nump] = xprompt;
  1668.       values[nump].uval.dval = xxmin;
  1669.       prompts[++nump] = yprompt;
  1670.       values[nump].uval.dval = yymax;
  1671.       if (transp3d) {
  1672.          prompts[++nump] = zprompt;
  1673.          values[nump].uval.dval = zzmin;
  1674.       }
  1675.       LOADPROMPTS("Bottom-Right Corner");
  1676.       values[nump].type = '*';
  1677.       prompts[++nump] = xprompt;
  1678.       values[nump].uval.dval = xxmax;
  1679.       prompts[++nump] = yprompt;
  1680.       values[nump].uval.dval = yymin;
  1681.       if (transp3d) {
  1682.      prompts[++nump] = zprompt;
  1683.      values[nump].uval.dval = zzmax;
  1684.      }
  1685.       if (transp3d) {
  1686.      LOADPROMPTS("Time Step");
  1687.      values[nump].type = '*';
  1688.      LOADPROMPTS("          From");
  1689.      values[nump].uval.dval = ttmin;
  1690.      LOADPROMPTS("          To");
  1691.      values[nump].uval.dval = ttmax;
  1692.      }
  1693.       else {
  1694.      if (xxmin == xx3rd && yymin == yy3rd)
  1695.         xx3rd = yy3rd = 0;
  1696.      LOADPROMPTS("Bottom-left (zeros for top-left X, bottom-right Y)");
  1697.      values[nump].type = '*';
  1698.      prompts[++nump] = xprompt;
  1699.      values[nump].uval.dval = xx3rd;
  1700.      prompts[++nump] = yprompt;
  1701.      values[nump].uval.dval = yy3rd;
  1702.      LOADPROMPTS("Press F7 to switch to \"center-mag\" mode");
  1703.      values[nump].type = '*';
  1704.      }
  1705.       }
  1706.  
  1707.    LOADPROMPTS("Press F4 to reset to type default values");
  1708.    values[nump].type = '*';
  1709.  
  1710.    oldhelpmode = helpmode;
  1711.    helpmode = HELPCOORDS;
  1712.    prompt_ret = fullscreen_prompt((transp3d) ? hdg : &hdg[15],
  1713.              nump+1, prompts, values, 0,
  1714.              (transp3d) ? 0x10 : 0x90, /* function keys */
  1715.              NULL);
  1716.    helpmode = oldhelpmode;
  1717.  
  1718.    if (prompt_ret < 0) {
  1719.       usemag = ousemag;
  1720.       xxmin = oxxmin; xxmax = oxxmax;
  1721.       yymin = oyymin; yymax = oyymax;
  1722.       xx3rd = oxx3rd; yy3rd = oyy3rd;
  1723.       zzmin = ozzmin; zzmax = ozzmax;
  1724.       ttmin = ottmin; ttmax = ottmax;
  1725.       return -1;
  1726.       }
  1727.  
  1728.    if (prompt_ret == F4) { /* reset to type defaults */
  1729.       xx3rd = xxmin = curfractalspecific->xmin;
  1730.       xxmax        = curfractalspecific->xmax;
  1731.       yy3rd = yymin = curfractalspecific->ymin;
  1732.       yymax        = curfractalspecific->ymax;
  1733.       if (viewcrop && finalaspectratio != screenaspect)
  1734.      aspectratio_crop(screenaspect,finalaspectratio);
  1735.       goto gc_loop;
  1736.       }
  1737.  
  1738.    if (cmag) {
  1739.       if ( values[0].uval.dval != Xctr
  1740.     || values[1].uval.dval != Yctr
  1741.     || values[2].uval.dval != Mag) {
  1742.      double radius,width;
  1743.      radius = 1.0 / values[2].uval.dval;
  1744.      width = radius * (1.0 / screenaspect);
  1745.      yymax           = values[1].uval.dval + radius;
  1746.      yy3rd = yymin = values[1].uval.dval - radius;
  1747.      xxmax           = values[0].uval.dval + width;
  1748.      xx3rd = xxmin = values[0].uval.dval - width;
  1749.      }
  1750.       }
  1751.  
  1752.    else {
  1753.       nump = 1;
  1754.       xxmin = values[nump++].uval.dval;
  1755.       yymax = values[nump++].uval.dval;
  1756.       if (transp3d)
  1757.      zzmin = values[nump++].uval.dval;
  1758.       nump++;
  1759.       xxmax = values[nump++].uval.dval;
  1760.       yymin = values[nump++].uval.dval;
  1761.       if (transp3d)
  1762.      zzmax = values[nump++].uval.dval;
  1763.       nump++;
  1764.       if (transp3d) {
  1765.      ttmin = values[nump++].uval.dval;
  1766.      ttmax = values[nump++].uval.dval;
  1767.      }
  1768.       else {
  1769.      xx3rd = values[nump++].uval.dval;
  1770.      yy3rd = values[nump++].uval.dval;
  1771.      if (xx3rd == 0 && yy3rd == 0) {
  1772.         xx3rd = xxmin;
  1773.         yy3rd = yymin;
  1774.         }
  1775.      }
  1776.       }
  1777.  
  1778.    if (prompt_ret == F7) { /* toggle corners/center-mag mode */
  1779.       if (usemag == 0)
  1780.      if (cvtcentermag(&Xctr, &Yctr, &Mag) == 0)
  1781.      {
  1782.         static char far msg[] = 
  1783.            {"Corners rotated or stretched, can't use center-mag"};
  1784.         stopmsg(0,msg);
  1785.      }   
  1786.      else
  1787.         usemag = 1;
  1788.       else
  1789.      usemag = 0;
  1790.       goto gc_loop;
  1791.       }
  1792.  
  1793.    return((xxmin == oxxmin && xxmax == oxxmax
  1794.     && yymin == oyymin && yymax == oyymax
  1795.     && xx3rd == oxx3rd && yy3rd == oyy3rd
  1796.     && zzmin == ozzmin && zzmax == ozzmax
  1797.     && ttmin == ottmin && ttmax == ottmax) ? 0 : 1);
  1798. }
  1799.