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

📄 game.c

📁 加密解密软件.rar
💻 C
字号:
#include "graphics.h"
#include "stdlib.h"
#include "conio.h"
#include "bios.h"

#define F1 59
#define F2 60
int gdriver=DETECT,gmode,errorcode,
errorcodeg,errorcode1,errorcode2,errorcode3,initg=0;
  void *Bitmap1;
  void *Bitmap3;
  void *Bitmap4;
  void *Bitmap5;
  void *bitmap2;
  void *Bitmap6;
  int midxx,midyy;
  int centerex,a,centery,size,size1,I,J,ij,x,y,x1,x2,mm;
  int ii,iii,gamp=0,jj=0,jp=0,jjj=0,ijj=0,nn=0,poly[8],poly2[6],poly3[6],poly4[6],maxx, maxy,n;
  char pattern[8] = { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
  char pattern1[8] = { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
  char spa;
  char cmm[25];
  int scan,ascii,snd=1,swintro=1;
  unsigned key;
main()
{init();
 paragame();
 }
init()
{
errorcodeg = registerbgidriver(EGAVGA_driver);
errorcode1 = registerbgifont(triplex_font);
if (errorcodeg <= 0)
{
   printf("%d",errorcodeg);
   exit(0);
}

initgraph(&gdriver, &gmode, "");
   errorcode = graphresult();
   if (errorcode != grOk)  {printf("halted error");exit(0);}
   paragame();
   return;
}
paragame()
{
   if(gamp==0)
   {
 loading();
 sndla();
 if(swintro!=0)info();
   cleardevice();
   gampu();
     }
   gamp=1;
   closegraph();
   exit(0);
 }
gampu()
{
   cleardevice();
   size=imagesize(120,70,140,100);
   Bitmap5=malloc(size);
   if (Bitmap5==NULL) main();
   getimage(120,70,140,100,Bitmap5);
   setcolor(BLUE);
   setfillpattern(pattern,9);
   bar(20,40,40,60);
   setcolor(13);
   settextstyle(8,0,1);
   outtextxy(25,35,"B");
   settextstyle(0,0,0);
   size=imagesize(20,30,40,60);
   Bitmap4=malloc(size);
   if (Bitmap4==NULL) exit(0);
   getimage(20,30,40,60,Bitmap4);
   cleardevice();
   setcolor(YELLOW);
   mm=0;
   iii=2;
   ball(2);
   free(Bitmap1);
   return;
 }
ball(int s)
  {
   levelstart(s);
   cleardevice();
   clearviewport();
    ij=0;jj=0;
   setcolor(2);
   settextstyle(0,0,0);
   rectangle(0,30,getmaxx(),getmaxy());
   centerex=getmaxx()/2;centery=getmaxy()/2;
   setfillstyle(8,3);
   setcolor(14);
   fillellipse(centerex,centery,10,10);
   size=imagesize(centerex-20,centery-20,centerex+20,centery+20);
   Bitmap1=malloc(size);
   if (Bitmap1==NULL) exit(0);
   getimage(centerex-10,centery-10,centerex+10,centery+10,Bitmap1);
	  size=imagesize(1,50,40,68);
   Bitmap3=malloc(size);
   if (Bitmap3==NULL) exit(0);
   getimage(1,50,40,68,Bitmap3);
   x=centerex-10;
   y=centery-10;
   I=3;J=3;
   a=0;
   maxx = getmaxx();
   maxy = getmaxy();
   poly[0] = maxx/2-40;
   poly[1] = maxy -49;
   poly[2] = maxx/2-40;
   poly[3] = maxy-44;
   poly[4] = maxx/2+40;
   poly[5] = maxy-44;
   poly[6] = maxx/2+40;
   poly[7] = maxy-49;
   setcolor(LIGHTBLUE);
   setfillstyle(11,14);
   fillpoly(4, poly);
   size1=imagesize(centerex-40,maxy-49,centerex+40,maxy-44);
   bitmap2=malloc(size1);
   if (bitmap2==NULL) exit(0);
   getimage(maxx/2-40,maxy-49,maxx/2+40,maxy-40,bitmap2);
   x1=maxx/2-40;
   x2=maxy-11;
   brick(1);
   setcolor(2);
   rectangle(0,30,getmaxx(),getmaxy());
   line(0,getmaxy()-38,getmaxx(),getmaxy()-38);
   outtextxy(20,getmaxy()-33,"CREATED BY : Mr.  SAMEER J. POTDAR     S.E. COMPUTERS.  ");
   circle(23,getmaxy()-13,7);
   outtextxy(20,getmaxy()-16,"c  SAMs SOFTWARES.");
   settextstyle(8,0,1);
   pre:setcolor(15);
   outtextxy(180,getmaxy()-200,"Press SPACE-BAR To Start !");
   setcolor(14);
   outtextxy(450,getmaxy()-30,"Hit ESC To Quit ");
   spa=getch();
   if(spa==27) goto esc;
   if(spa!=32) {sound(snd*500);delay(20);nosound();goto pre;}
   setcolor(0);
   outtextxy(180,getmaxy()-200,"圹圹圹圹圹圹圹圹圹圹圹圹圹圹");
   settextstyle(0,0,0);
   nn=0;
   do
   {	 nn=nn+1;
	 setcolor(2);
	 rectangle(0,30,getmaxx(),getmaxy());
	 gotoxy(1,1);
	 clreol();
	 printf(" TIME : %d    P A R A N O I D      S C O R E ==>%d       L E V E L ==> %d        ",nn,mm,iii-1);
	 putimage(x,y,Bitmap1,XOR_PUT);
	   x+=3*I;y+=5*J;
	 putimage(x,y,Bitmap1,COPY_PUT);
		 if (y<=35)
	 { putimage(x-20,y,Bitmap3,COPY_PUT);
	   bapu(x-20-2,y);
	   putimage(x,y,Bitmap1,XOR_PUT);
	  }
	 if (x>getmaxx()-20||x<5)
	  {
	   sound(snd*2500);delay(10);
	   I*=-1;
	   nosound();
	  }
	 if (y>getmaxy()-85||y<35)
	  {
	   sound(snd*2500);delay(10);
	   J*=-1;
	   if (y>getmaxy()-85) ij=1;
	   if (y<35) ij=0;
	   nosound();
	  }
	if(kbhit())
	arro(s);
	delay((50*3)/s);
	 if ((nn>=20)&&(nn<=110))
	 {sound(snd*5160);
	  delay(5);
	  putimage(307-170,40+4*(nn-21),Bitmap4,AND_PUT);
	 putimage(307-170,40+4*(nn-20),Bitmap4,COPY_PUT);
	 sound(snd*490);
	 delay(10);
	 if (nn>=110) putimage(307-170,40+4*(nn-20),Bitmap5,COPY_PUT);
	 if ((307-170>=x1&&(307-170<=x1+80))&&(nn>=110)&&(jj==0))
	 { mm+=10*(iii-1);jj=1;}
	 nosound();
	 }
	 if ((nn>=120)&&(nn<=210))
	 {sound(snd*5160);
	  delay(10);
	  putimage(307-70,40+4*(nn-121),Bitmap4,AND_PUT);
	 putimage(307-70,40+4*(nn-120),Bitmap4,COPY_PUT);
	 sound(snd*490);
	 delay(10);
	 if (nn>=210) putimage(307-70,40+4*(nn-120),Bitmap5,COPY_PUT);
	 if ((307-70>=x1&&(307-70<=x1+80))&&(nn>=210)&&(jp==0))
	 { mm+=10*(iii-1);jp=1;}
	 nosound();
	 }
	 if ((nn>=300)&&(nn<=390))
	 {
	  putimage(254,40+4*(nn-301),Bitmap4,AND_PUT);
	 putimage(254,40+4*(nn-300),Bitmap4,COPY_PUT);
	 if (nn>=390) putimage(254,40+4*(nn-300),Bitmap5,COPY_PUT);
	 if ((254>=x1&&(254<=x1+80))&&(nn>=390)&&(jjj==0))
	 { mm+=10*s;jjj=1;}
	 }
	 if ((nn>=500)&&(nn<=590))
	 {
	  putimage(getmaxx()-110,40+4*(nn-501),Bitmap4,AND_PUT);
	 putimage(getmaxx()-110,40+4*(nn-500),Bitmap4,COPY_PUT);
	 if (nn>=590) putimage(getmaxx()-110,40+4*(nn-500),Bitmap5,COPY_PUT);
	 if ((getmaxx()-110>=x1&&(getmaxx()-110<=x1+80))&&(nn>=590)&&(ijj==0))
	 { mm+=10*s;ijj=1;}
	 }
	 if (ij==0)
	if (((x+13)<=x1||(x+5>=x1+80))&&((y+75)>=x2))
	   gameover();

	gotoxy(2,1);
	clreol();
	if (nn==290) {level(iii);cleardevice();iii+=1;if (iii>=7) {closegraph();exit(0);}ball(iii);}
	}
	while (n!=27);
	if (n==27)
	{
	 esc: cleardevice();
	  gotoxy(30,60);
	  for (I=1;I<=10;I++)
	  {
	  sound(snd*5000/I);
	  funnyface();
	  arc(midxx-40,midyy-130,40,140,10);
	  delay(100);
	  nosound();
	  }
	 settextstyle(8,0,1);
	 setcolor(14);
	 outtextxy(getmaxx()/2-320,getmaxy()/2,"  YOU LOSE !!! YOU DON'T HAVE GUTS TO PLAY THE GAME !!");
	 setcolor(15);
	 outtextxy(getmaxx()/2-140,getmaxy()/2+200,"Press SPACE-BAR To Continue !!!");
	 settextstyle(0,0,0);
	  getch();
	  gamp=1;
	 }
	 gamp=1;
	  paragame();
}
arro(int ds)
{
	n=getch();
	if (n==77)
	 { if((x1+80)>=(getmaxx()+4+ds)) x1=x1;
	  putimage(x1,x2-38,bitmap2,XOR_PUT);
	   if((x1+80)>=(getmaxx()+4+ds)) x1=x1;
	 x1+=26+2+ds;
	  if((x1+80)>=(getmaxx()+4+ds))
		  {sound(snd*500);delay(15);
	  x1=x1-26-2-ds;nosound();}
		 putimage(x1,x2-38,bitmap2,COPY_PUT);
	 }
		if (n==75)
	 { if((x1-3)<=-2-ds) x1=x1;
	  putimage(x1,x2-38,bitmap2,XOR_PUT);
	   if((x1-3)<=-2-ds) x1=x1;
	 x1-=(26+2+ds);
	  if((x1-3)<=-2-ds)
	  {sound(snd*500);delay(15);
	  x1=x1+26+2+ds;nosound();}
	 putimage(x1,x2-38,bitmap2,COPY_PUT);
	 }
}
bapu(int l,int m)
{  int e;
   mm+=1*iii;
   sound(snd*200);delay(90);
   setcolor(RED);
   setfillstyle(XHATCH_FILL,RED);
   poly2[0] = l;        /* 1st vertex */
   poly2[1] = m;
   poly2[2] = l; /* 2nd */
   poly2[3] = m+15;
   poly2[4] = l+15; /* 3rd */
   poly2[5] = m;
   setfillstyle(XHATCH_FILL,RED);
   fillpoly(3, poly2);
   poly3[0] = l+30;        /* 1st vertex */
   poly3[1] = m;
   poly3[2] = l+30; /* 2nd */
   poly3[3] = m+15;
   poly3[4] = l+10; /* 3rd */
   poly3[5] = m;
   setfillstyle(XHATCH_FILL,RED);
   fillpoly(3, poly3);
   for(e=l;e<=l+15;e+=2)
  {
	putpixel(e+15,random(m)+48,5);
	putpixel(e+10,random(m)+38,5);
	putpixel(e+5,random(m)+58,5);
	putpixel(e,random(m)+31,5);
	putpixel(e+15,random(m)+55,5);
	putpixel(e+30,random(m)+42,5);
	putpixel(l+30,m+49,5);
	putpixel(l+31,m+49,5);
	putpixel(l+32,m+49,5);
	putpixel(l+33,m+49,5);
	setcolor(0);
	arc(x+10,y+10,240,70,10);
	nosound();
	delay(10);
   }
   return;
}
loading()
{int JJ;int m1=-1;
 setcolor(9);
 bar3d(getmaxx()/2-190,getmaxy()/2-40,getmaxx()/2+190,getmaxy()/2+40,5,1);
   pattern[4] -= 1;
   pattern[5] -= 3;
   pattern[6] += 3;
   pattern[7] -= 4;
  setfillpattern(pattern,9);
 bar(getmaxx()/2-189,getmaxy()/2-40,getmaxx()/2+189,getmaxy()/2+40);
 setcolor(1);
 rectangle(getmaxx()/2-181,getmaxy()/2+9,getmaxx()/2+186,getmaxy()/2+31);
 rectangle(getmaxx()/2-182,getmaxy()/2+8,getmaxx()/2+187,getmaxy()/2+32);
 setfillstyle(1,3);
 bar(getmaxx()/2-180,getmaxy()/2+10,getmaxx()/2+185,getmaxy()/2+30);
 setcolor(0);
 settextstyle(8,0,1);
 outtextxy(getmaxx()/2-180,getmaxy()/2-20,"LOADING .. Graphics !");
 setcolor(4);
 settextstyle(8,0,1);
 outtextxy(getmaxx()/2-177,getmaxy()/2-20,"LOADING .. Graphics !");
 outtextxy(getmaxx()-177,getmaxy()/2-20,"[  ]");
 outtextxy(getmaxx()-176,getmaxy()/2-20,"[  ]");
 setfillstyle(1,5);
 bar(getmaxx()/2-175,getmaxy()/2+12,getmaxx()/2-160,getmaxy()/2+28);
 size=imagesize(getmaxx()/2-175,getmaxy()/2+12,getmaxx()/2-160,getmaxy()/2+28);
 setfillstyle(1,7);
 bar(getmaxx()/2-170,getmaxy()/2+16,getmaxx()/2-165,getmaxy()/2+24);
  Bitmap6=malloc(size);
   if (Bitmap6==NULL) exit(0);
  getimage(getmaxx()/2-175,getmaxy()/2+12,getmaxx()/2-160,getmaxy()/2+28,Bitmap6);
  ii=0;
   while(ii<=320)
	{
	putimage(getmaxx()/2-155+ii,getmaxy()/2+12,Bitmap6,0);
	if(m1==-1)
{       setcolor(1);
	outtextxy(getmaxx()-170,getmaxy()/2-20,"圹");delay(10);
	setcolor(14);
	outtextxy(getmaxx()-160,getmaxy()/2-20,"

⌨️ 快捷键说明

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