⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrac.c

📁 frasr200的win 版本源码(18.21),使用make文件,使用的vc版本较低,在我的环境下编译有问题! 很不错的分形程序代码!
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
   non-windows main driver of Fractint for Windows -
*/

void win_cmdfiles();
int cmp_line(), pot_line();

/* from MSC's <dos.h> */
#define FP_SEG(fp) (*((unsigned _far *)&(fp)+1))
#define FP_OFF(fp) (*((unsigned _far *)&(fp)))

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <search.h>
#include <string.h>
#include <float.h>
#include <ctype.h>
#include <time.h>

#include "fractint.h"
#include "fractype.h"

struct videoinfo videoentry;
int helpmode;

LPSTR win_lpCmdLine;

extern int time_to_act;
extern int time_to_restart;
extern int time_to_reinit;
extern int time_to_resume;
extern int time_to_quit;
extern int time_to_load;
extern int time_to_save;
extern int time_to_print;
extern int time_to_cycle;
extern int time_to_starfield;
extern int time_to_orbit;

extern char FileName[];

extern int xdots, ydots, colors, maxiter;
extern int ytop, ybottom, xleft, xright;

int fractype;
extern int invert;

double xxmin, xxmax, yymin, yymax;

int maxit, bitshift;
extern int color, row, col;
extern	int colorpreloaded;	/* comments in cmdfiles */

int calc_status; /* -1 no fractal		    */
		 /*  0 parms changed, recalc reqd   */
		 /*  1 actively calculating	    */
		 /*  2 interrupted, resumable	    */
		 /*  3 interrupted, not resumable   */
		 /*  4 completed		    */

extern int cpu;
extern int kbdcount;
extern int max_kbdcount;
extern int debugflag;
extern int bitshiftless1;
char usr_stdcalcmode;
int  usr_distest;

long delx, dely, delx2, dely2, delmin;
long xmin, xmax, ymin, ymax, x3rd, y3rd;
double  dxsize, dysize;		/* xdots-1, ydots-1	    */
double delxx, delyy, delxx2, delyy2, ddelmin, xx3rd, yy3rd;
double param[MAXPARAMS];
int diskvideo, savedac;

#define MAXLINE  2048

long   far *lx0, far *ly0, far *lx1, far *ly1;
double far *dx0, far *dy0, far *dx1, far *dy1;
extern double far *temp_array;

extern unsigned char far win_dacbox[256][3];
unsigned char dacbox[257][3];
extern unsigned char olddacbox[257][3];
int dotmode;
extern int pot16bit;
int andcolor, resave_flag;

int extraseg;
extern int initbatch;
extern unsigned char readname[];
int rowcount;
extern int showfile;
extern int initmode;
extern int overlay3d;
extern int display3d;
extern int filetype;
int comparegif = 0;
int diskisactive = 0;
extern int initsavetime;
int saveticks = 0;
int savebase = 0;
int zwidth = 0;
extern int (*outln)();
extern int out_line();
extern int outlin16();
static int call_line3d();
extern int line3d();
extern int gifview();
extern int tgaview();

int     sxdots,sydots;
int     sxoffs=0,syoffs=0;
float   finalaspectratio;
extern int filexdots, fileydots, filecolors;
int frommandel;

int onthelist[100];		/* list of available fractal types */
int CountFractalList;           /* how many are on the list? */
extern int CurrentFractal;		/* which one is current? */

extern int win_display3d, win_overlay3d;

int release;
extern int win_release;
extern int save_release;
void	(*outln_cleanup)();
extern int fpu;

compare_fractalnames( const void *element1, const void *element2)
{
int i, j, k;
    j = *(int*)element1;
    k = *(int*)element2;
for (i = 0; i < 100; i++) {
    if (fractalspecific[j].name[i] < fractalspecific[k].name[i])
        return(-1);
    if (fractalspecific[j].name[i] > fractalspecific[k].name[i])
        return(1);
    if (fractalspecific[j].name[i] == 0)
        return(0);
    }
return(0);
}

fractint_main()
{
int i, k;
double temp1, temp2;
double dtemp;

outln_cleanup = NULL;		/* outln routine can set this */

CountFractalList = 0;
for (k = 0; fractalspecific[k].name != NULL; k++)
   if (fractalspecific[k].name[0] != '*' &&
       (fractalspecific[k].flags & WINFRAC) != 0 &&
       CountFractalList < 100) 
            onthelist[CountFractalList++] = k;
qsort(onthelist,CountFractalList,2,compare_fractalnames);
CurrentFractal = fractype;

lx0 = (long far *)&temp_array[0];
ly0 = (long far *)&lx0[MAXLINE];
lx1 = (long far *)&ly0[MAXLINE];
ly1 = (long far *)&ly0[MAXLINE];
dx0 = (double far *)&temp_array[0];
dy0 = (double far *)&dx0[MAXLINE];
dx1 = (double far *)&dy0[MAXLINE];
dy1 = (double far *)&dy0[MAXLINE];

extraseg = FP_SEG(dx0);

    {
    // wierd logic to initialize the palette
    int iLoop, jLoop;
    if (ValidateLuts("defaultw.map") == 0) {
        for (iLoop = 0; iLoop < 256; iLoop++)
            for (jLoop = 0; jLoop < 3; jLoop++)
                win_dacbox[iLoop][jLoop] = dacbox[iLoop][jLoop];
            spindac(0,1);
        }
    }

restoredac();		/* ensure that the palette has been initialized */

win_cmdfiles();				/* SSTOOLS.INI processing */

initmode = 1;                           /* override SSTOOLS.INI */

release = win_release;
save_release = win_release;

dotmode = 1;
diskvideo = 0;
usr_distest = 0;

max_kbdcount=(cpu==386) ? 80 : 30; /* check the keyboard less often */

/* ----- */

calc_status = -1;
resave_flag = 1;
strcpy(FileName,"Fract001");
if (showfile != 0) {
    strcpy(readname, FileName);
    }
else {
    if (strchr(readname,'.') == NULL)
	 strcat(readname,".gif");
    strcpy(FileName,readname);
    time_to_load = 1;
    }

if (debugflag == 17500) {   /* force the release number for screen-shots */
    extern int win_release;
    win_release = 1750;
    win_set_title_text();
    }

if (debugflag == 10000) {   /* check for free memory */
   char temp[50];
   char *tempptr;
   unsigned i,i2;
   long j,j2;

   sprintf(temp," %d bytes of free stack space",stackavail());
   stopmsg(0,temp);

   i = j = 0;
   i2 = 0x8000;
   while ((i2 >>= 1) != 0)
      if ((tempptr = malloc(i+i2)) != NULL) {
	 free(tempptr);
	 i += i2;
	 }
   sprintf(temp," %d NEAR bytes free", i);
   stopmsg(0,temp);
   }

if (debugflag == 70) fpu = 0;

init_help();

/* ----- */

time_to_quit = 0;
if (debugflag == 23232) /* give the Windows stuff control first */
    getakey(); 
if (time_to_quit) {
    end_help();
    return(0);
    }

reinit:
    time_to_reinit = 0;

    savedac = 0; 			/* don't save the VGA DAC */

    for (i = 0; i < 4; i++) {
        if(param[i] == FLT_MAX)
            param[i] = fractalspecific[fractype].paramvalue[i];
/*
        else
            fractalspecific[fractype].paramvalue[i] = param[i];
*/
        }

/*  Not used, MCP 8-6-91
    ccreal = param[0]; ccimag = param[1]; */ /* default C-values */
    frommandel = 0;

    if (xxmin > xxmax) {
       dtemp = xxmin; xxmin = xxmax; xxmax = dtemp;} 
    if (yymin > yymax) {
       dtemp = yymin; yymin = yymax; yymax = dtemp;} 

    ytop    = 0;
    ybottom = ydots-1;
    xleft   = 0;
    xright  = xdots-1;
    filexdots = xdots;
    fileydots = ydots;
    filecolors = colors;

restart:
    time_to_restart = 0;
    time_to_resume = 0;
    time_to_orbit = 0;

    win_title_text(1);

    if (calc_status == -99)
        calc_status = 2;			/* force a recalc */
    else
        calc_status = 0;			/* force a restart */

    maxit = maxiter;
    
    if (colors == 2 && (fractype == PLASMA || usr_stdcalcmode == 'b'))
        colors = 16;         /* 2-color mode just doesn't work on these */

    andcolor = colors-1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -