home *** CD-ROM | disk | FTP | other *** search
- #include<stdio.h>
- #include<process.h>
- #include<conio.h>
- #include<graphics.h>
- #include<string.h>
- #include<stdlib.h>
- int huge DetectVGA256();
- void fade();
- extern bigtile(int,int,unsigned char far *,char,char);
-
-
-
- title()
- {
- //return(0);
- FILE *in;
- int i,col;char inbuf[0x400];
- unsigned char count;
- char c[14][81];
- char title[5][0x400];char eye[2][0x400];
- int gdriver = DETECT, gmode, errorcode;
- //struct palette {int num,int red,int green,int blue;}palette;
-
- //installuserdriver("Svga256",DetectVGA256);
- registerbgidriver(EGAVGA_driver);
- initgraph(&gdriver, &gmode, "");
- //printf("%u %u %u",getmaxx(),getmaxy(),getmaxcolor());
-
- errorcode = graphresult();
-
- if (errorcode != grOk)
- {printf("Graphics error: %s\n", grapherrormsg(errorcode));
- printf("Press any key to halt:");
- getch();
- exit(1);}
-
-
-
- fade();
-
- in=fopen("t1.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- title[0][i]=inbuf[i];
- }
- fclose(in);
- in=fopen("t2.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- title[1][i]=inbuf[i];
- }
- fclose(in);
- in=fopen("t3.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- title[2][i]=inbuf[i];
- }
- fclose(in);
- in=fopen("t4.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- title[3][i]=inbuf[i];
- }
- fclose(in);
- in=fopen("t5.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- title[4][i]=inbuf[i];
- }
- fclose(in);
-
- in=fopen("t7.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- eye[0][i]=inbuf[i];
- }
- fclose(in);
-
- in=fopen("t8.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- eye[1][i]=inbuf[i];
- }
- fclose(in);
-
-
-
- for(i=0;i<5;++i)
- {
- bigtile(155+i*67,100,title[i],2,0);
- }
- setfillstyle(1,0xff);bar(150,168,491,171);
-
- setcolor(0x1a);circle(320,382,45);setcolor(0x17);circle(320,382,46);
- bigtile(290,350,eye[0],2,0);
- setcolor(0x0f);
-
-
-
- strcpy(c[0],"Written by me, Benjamin Peterson, using Borland C++ v3.1, and ");
- strcpy(c[1],"the SVGA256.BGI driver from Jordan Hargrafix Software. This");
- strcpy(c[2],"here program is Copyright (C) Benjamin Peterson 1995 but somehow");
- strcpy(c[3],"I don't think I'm going to be fighting any big legal battles");
- strcpy(c[4],"over it.");
- strcpy(c[5],"");
- strcpy(c[6],"Press '?' in the game for help. 'Num lock' must be on...");
- strcpy(c[7],"");
- strcpy(c[8],"I accept no responsibility for migraines, fits of depression or");
- strcpy(c[9],"damage to fists or computer equipment arising from the in-game");
- strcpy(c[10],"sound effects. I haven't got a soundcard and if you want me");
- strcpy(c[11],"to put in proper sound, I suggest you mail me one.");
- strcpy(c[12],"");
- strcpy(c[13],"Good luck folks!");
-
- settextstyle(0,0,1);
- for(i=0;i<14;++i)
- {
- setcolor(0x1f-(i/2));
- outtextxy(70,200+i*10,c[i]);
- }
- i=0;
-
-
- // for(i=0;i<255;++i)
- // {
- // setpalette(i,0,0,i);
- // }
-
- for(;;)
- {
- for(i=0;i<20;++i)
- {
- col=240+(i+count+16)%32;
- if(col>255)col=255-(col-255);
- setcolor(col);
- rectangle(i,i,639-i,479-i);
- if(kbhit())break;
-
- }
- /* ++count;
- for(i=0;i<14;++i)
- {
- setcolor(256-(240+(i+count+16)%16));
- rectangle(i,i,639-i,479-i);
- if(kbhit())break;
-
- } */
- ++count;
- if(kbhit())break;
- }
-
- getch();
-
- setfillstyle(1,0);
- bar(290,350,353,414);
-
- bigtile(290,350,eye[1],2,0);
-
-
- for(i=239;i<256;++i) //this ought to be in fade but I don't want a
- { //delay there.
- setrgbpalette(i,0,0,0);
- }
- setrgbpalette(238,0,0,0);
-
-
-
-
-
-
- //exit(0);
- return(0);
- }
-
-
- int huge DetectVGA256()
- {
-
- int Vid=2;
-
-
-
- //union REGS regs;
-
- // regs.x.ax = 0x4501;
- // int86(0x33, ®s, ®s);//ice hgx
-
- /*
- regs.x.ax = 0x4500; //reinit hgx
- regs.x.si = 640; // X resolution
- regs.x.di = 400; // Y resolution
- regs.h.bl = 0; // 8 bits packed ie normal 256col
- regs.x.dx = 320; // Bytes per line
- int86(0x33, ®s, ®s);
- //return ((regs.h.al == 0x45) ? 1 : 0); */
- return Vid;
-
- }
-
- void fade()
- {
- int i,j,px,py,c,r;
- float size;
- FILE* in;
- unsigned char fade[2][0x400];
- unsigned char inbuf[0x400];
-
-
-
- in=fopen("are.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- fade[0][i]=inbuf[i];
- }
- fclose(in);
- in=fopen("na.dat","rb");
- for (i=0;i<0x400;++i)
- {
- fscanf(in,"%c",&inbuf[i]);
- fade[1][i]=inbuf[i];
- }
- fclose(in);
-
-
- for(i=239;i<250;++i)
- {
- setrgbpalette(i,0,0,0);
- }
- setrgbpalette(238,0,0,0);
-
- for(size=15;size>1.5;size-=0.5)
- {
- r=size-1;
- for(i=0;i<0x400;++i)
- {
- px=310-size*32+(i%32)*size+random(r);py=200-size*16+(i/32)*size+random(r);
- if(fade[0][i]<240)
- {
- if(!fade[0][i])setfillstyle(1,238);
- else setfillstyle(1,fade[0][i]+239-16);
- bar(px,py,px+size-1,py+size-1);
- }
- }
- for(i=0;i<0x400;++i)
- {
- px=309+(i%32)*size+random(r);py=200-size*16+(i/32)*size+random(r);
- if(fade[1][i]<240)
- {
- if(!fade[1][i])setfillstyle(1,238);
- else setfillstyle(1,fade[1][i]+239-16);
- bar(px,py,px+size-1,py+size-1);
- }
- }
-
- }
-
- for(i=-64;i<0;i+=8)
- {
-
- for(j=16;j>0;--j)
- {
- c=i+j*4;if(c<0)c=0;
- setrgbpalette(j+239,c,0,0);
- }
- setrgbpalette(238,i+64,(i+64)/8,(i+64)/8);
- }
-
-
- setfillstyle(1,0);setcolor(0x1e);
- bar(230-1,289-1,390+1,301+1);
- rectangle(230,289,390,301);
-
- outtextxy(237,291,"Prepare yourself...");
- getch();
- //word zooms out of screen
- for(size=1.5;size<100;size*=1.2)
- {
- r=size-2;
- for(i=0;i<0x400;++i)
- {
- px=310-size*32+(i%32)*size+random(r);py=200-size*16+(i/32)*size+random(r);
- if(fade[0][i]<240)
- {
- if(!fade[0][i])setfillstyle(1,238);
- else setfillstyle(1,fade[0][i]+239-16);
- bar(px,py,px+size-1,py+size-1);
- }
- }
- for(i=0;i<0x400;++i)
- {
- px=309+(i%32)*size+random(r);py=200-size*16+(i/32)*size+random(r);
- if(fade[1][i]<240)
- {
- if(!fade[1][i])setfillstyle(1,238);
- else setfillstyle(1,fade[1][i]+239-16);
- bar(px,py,px+size-1,py+size-1);
- }
- }
-
- }
-
-
-
- setfillstyle(1,0);bar(0,0,639,479);
- }
-
-
-
-
-