My C programs - The Bricks Game !
/************************************************************************/ /* Designed & developed by J.V.RAVICHANDRAN. */ /* Started on 19/04/1998. */ /* Author's name -- J.V.RAVICHANDRAN */ /* Company's name -- Semantix Computers. */ /* Company's address -- B-10, Triveni Apartments, */ /* Vikas puri, New Delhi - 110018. */ /* Completed on -- 27th April, 1998. */ /* Name of software -- GREYcells Bricks */ /* Nature of software -- Game */ /************************************************************************/ #include#include #include #include #include #include #include #include #include #include #include
_fmode=O_BINARY; handle=_creat("termtic.$$$", FA_HIDDEN); lseek(handle, 0L, SEEK_SET); _write(handle,"1",1); _close(handle); _fmode=O_BINARY; handle=_creat("delaytic.$$$", FA_HIDDEN); lseek(handle, 0L, SEEK_SET); _write(handle,"1",1); _close(handle); goon=1;} if (ct==0){goon=1;} if (goon==1){ ct=access("termtic.$$$",0); if (ct==-1){ setfillstyle(SOLID_FILL,15); bar(100,100,400,200); setfillstyle(SOLID_FILL,0); bar(101,101,399,120); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(15); outtextxy(220,111,"GREYcells"); setcolor(0); outtextxy(110,135,"Intruder alert ! Please contact"); outtextxy(110,150,"the developer immediately."); sound(100); delay(75); nosound(); getch(); cleardevice(); closegraph(); _close(handle); ix=0; exit(0);}
if (ct==0){ handle=open("termtic.$$$", O_RDONLY | O_BINARY); lseek(handle, 0L, SEEK_SET); counter=0; leng=filelength(handle); sscanf(&terminator,"%d",&leng); while (!eof(handle)){ read(handle,&terminator,4);} } chmod("termtic.$$$",S_IWRITE); unlink("termtic.$$$");
_fmode=O_BINARY; handle=_creat("termtic.$$$", FA_HIDDEN); lseek(handle, 0L, SEEK_SET);
if (ballrow>=435 && down==1){ if (soundon==1){ sound(100); delay(10); nosound();}
wallctr=0; bx=x; bxx=xx; counter=bx; downangle=0; down=6;} if (ballrow>=435 && down==7){ if (soundon==1){ sound(100);
delay(10); nosound();}
wallctr=0; bx=x; bxx=xx; counter=bx; downangle=0; down=6;} if (down==6){ for (counter==bx;counter=bx-6 && ballcol<=bx+10){ angle=1; counter=bxx+3; down=3;} if (ballcol>bx+10 && ballcol<=bx+20){ angle=2; counter=bxx+3; down=3;} if (ballcol>bx+20 && ballcol<=bx+30){ angle=3; counter=bxx+3; down=3;} if (ballcol>bx+30 && ballcol<=bx+40 && ballcol!=bx+36 && ballcol!=bx+37){ angle=4; counter=bxx+3; down=3;} if (ballcol>bx+40 && ballcol<=bx+50){ angle=5; counter=bxx+3; down=3;} if (ballcol>bx+50 && ballcol<=bx+60){ angle=6; counter=bxx+3; down=3;} if (ballcol>bx+60 && ballcol<=bx+70){ angle=7; counter=bxx+3; down=3;} if (ballcol>bx+70 && ballcol<=bx+83){ angle=8; counter=bxx+3; down=3;}
if (ballcol==bx+36 || ballcol==bx+37){ ballrow=ballrow-5; angle=-1; down=4; counter=bxx+3;} if (down==6){ counter=bxx+3; down=5;} } } if (down==3){ upangles();} if (down==5){ if (delayover==3){ cleardevice(); start(); ballrow=125; ballcol=300; downangle=1; gamestart=1; delayover=5;}
if (delayover!=3 || delayover!=5){ if (soundon==1){ sound(100); delay(50); nosound();} ballrow=ballrow+10; incolor=9; ball(); if (ballcx<=135){ setcolor(0); circle(ballcx,470,7); ballcx=ballcx+25; ballnum++; if (ballnum>4){ballnum=0;} settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(10); outtextxy(125,250,"Have another ball !"); delay(1500); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(0); outtextxy(125,250,"Have another ball !");} if (ballcx>=150){ settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(12); outtextxy(225,250,"Game over !"); tune(); getch(); setfillstyle(SOLID_FILL,0); bar(x,y,xx,yy); incolor=0; ball(); delay(50);
settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(0); outtextxy(225,250,"Game over !"); score=0; start(); scorex=510; score=0; scorex+=textwidth("Score -"); scorex=scorex+5; ballcx=10;} } if (delayover==5){down=1;} writescore(); wallctr=0; incolor=0; ball(); ballrow=125; down=1;} incolor=12; ball(); } } key=getch(); switch(key){ case 32: if (gamestart==2){ if (menuon==2 && item==1){ sound(100); delay(50); nosound(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(15); soundon++; if (soundon>1){ soundon=0;} if (soundon==1){ setcolor(7); outtextxy(menucol+75,menurow+13,"Sound ( OFF )"); setcolor(15); outtextxy(menucol+75,menurow+13,"Sound ( ON )");} if (soundon==0){ setcolor(7); outtextxy(menucol+75,menurow+13,"Sound ( ON )"); setcolor(15); outtextxy(menucol+75,menurow+13,"Sound ( OFF )");} } } break; case ALT==1: case 129: if (gamestart==2){ if (menuon==0){ menucol=15; menurow=14; menucoll=164; menuroww=57; messageboxc=menucol; messageboxr=menurow; messageboxcc=menucoll; messageboxrr=menuroww; savebox(); dropdownmenu();
setcolor(12); settextstyle(DEFAULT_FONT,VERT_DIR,1); settextjustify(0,1); outtextxy(18,11,"0");
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); if (soundon==1){ outtextxy(menucol+75,menurow+13,"Sound ( ON )");} if (soundon==0){ outtextxy(menucol+75,menurow+13,"Sound ( OFF )");} outtextxy(menucol+75,menurow+33,"Levels (1-3)"); item=0; menuon=2;} } break; case 34: if (gamestart==2){ if (menuon==0){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=10; setcolor(12); outtextxy(cx,60,"G"); cx+=textwidth("G"); cx=cx+1; setcolor(15); outtextxy(cx,60,"ame"); menuon=1; menuflag=0; menuitem=1;} if (menuon==1 && menuitem==1 && menuflag==0){ menucol=10; menurow=63; menucoll=130;
menuroww=106; messageboxc=menucol; messageboxr=menurow; messageboxcc=menucoll; messageboxrr=menuroww; savebox(); dropdownmenu(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); outtextxy(menucol+60,menurow+13,"Start"); outtextxy(menucol+60,menurow+33,"Quit"); item=0; menuflag=1;} } break; case 35: if (gamestart==2){ if (menuon==0){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=100; setcolor(12); outtextxy(cx,60,"H"); cx+=textwidth("H"); cx=cx+1; setcolor(15); outtextxy(cx,60,"elp"); menuon=1; menuflag=0; menuitem=2;} if (menuon==1 && menuitem==2 && menuflag==0){ menucol=100; menurow=63; menucoll=239; menuroww=106; messageboxc=menucol; messageboxr=menurow; messageboxcc=menucoll; messageboxrr=menuroww; savebox(); dropdownmenu(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); outtextxy(menucol+75,menurow+13,"How to use..."); outtextxy(menucol+70,menurow+33,"About"); item=0; menuflag=1;} } break; case 80: if (gamestart==2){ if (menuon==2){ if (item==0){ threed_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1);
if (soundon==1){ setcolor(7); outtextxy(menucol+75,menurow+13,"Sound ( OFF )"); setcolor(15); outtextxy(menucol+75,menurow+13,"Sound ( ON )");} if (soundon==0){ setcolor(7); outtextxy(menucol+75,menurow+13,"Sound ( ON )"); setcolor(15); outtextxy(menucol+75,menurow+13,"Sound ( OFF )");} } if (item==1){ twod_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); if (soundon==1){ outtextxy(menucol+75,menurow+13,"Sound ( ON )");} if (soundon==0){ outtextxy(menucol+75,menurow+13,"Sound ( OFF )");} setlinestyle(SOLID_LINE,1,1); threed_menuitem2(); setcolor(15); outtextxy(menucol+75,menurow+33,"Levels (1-3)");} if (item==2){ twod_menuitem2(); setcolor(8); outtextxy(menucol+75,menurow+33,"Levels (1-3)");}
sound(20); delay(75); nosound(); item++; if (item==3){ item=0;} }
if (menuon==1 && menuflag==1 && menuitem==1){ if (item==0){ threed_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(15); outtextxy(menucol+60,menurow+13,"Start");} if (item==1){ twod_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); outtextxy(menucol+60,menurow+13,"Start"); setlinestyle(SOLID_LINE,1,1); threed_menuitem2(); setcolor(15); outtextxy(menucol+60,menurow+33,"Quit");} if (item==2){ twod_menuitem2(); setcolor(8); outtextxy(menucol+60,menurow+33,"Quit");}
sound(20); delay(75); nosound(); item++; if (item==3){ item=0;} } if (menuon==1 && menuflag==1 && menuitem==2){ if (item==0){ threed_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(15); outtextxy(menucol+75,menurow+13,"How to use...");} if (item==1){ twod_menu();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setcolor(8); outtextxy(menucol+75,menurow+13,"How to use..."); setlinestyle(SOLID_LINE,1,1); threed_menuitem2(); setcolor(15); outtextxy(menucol+70,menurow+33,"About");} if (item==2){ twod_menuitem2(); setcolor(8); outtextxy(menucol+70,menurow+33,"About");} sound(20); delay(75); nosound(); item++; if (item==3){ item=0;} } } break; case 13: if (gamestart==2){ if (menuon==1 && menuitem==1){ restorebox(); if (item==0){ sound(200); delay(25); nosound(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=10; setcolor(15); outtextxy(cx,60,"G"); cx+=textwidth("G"); cx=cx+1; setcolor(12); outtextxy(cx,60,"ame");} if (item==1){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=10; setcolor(15); outtextxy(cx,60,"G"); cx+=textwidth("G"); cx=cx+1; setcolor(12); outtextxy(cx,60,"ame"); item=0; menuon=0; menuflag=0; cleardevice(); textcounter=5; start(); writescore(); gamestart=1; count=1; down=1; ix=1;} if (item==2){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=10; setcolor(15); outtextxy(cx,60,"G"); cx+=textwidth("G"); cx=cx+1; setcolor(12); outtextxy(cx,60,"ame"); quit(); count=1; ix=0;} menuon=0; } if (menuon==1 && menuitem==2){ restorebox(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); cx=100; setcolor(15); outtextxy(cx,60,"H"); setcolor(12); cx+=textwidth("H"); cx=cx+1; outtextxy(cx,60,"elp"); if (item==0){ sound(200); delay(25); nosound();} if (item==1){ howtouse();} if (item==2){ about();} menuon=0;} if (menuon==2){ restorebox(); setcolor(7); settextstyle(DEFAULT_FONT,VERT_DIR,1); settextjustify(0,1); outtextxy(18,11,"0"); if (item==2){ shareware();}
settextstyle(DEFAULT_FONT,VERT_DIR,1); settextjustify(0,1); setcolor(7); outtextxy(18,11,"0"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(15); outtextxy(295,12,"GREYcells"); cx=10; setcolor(15); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); outtextxy(cx,60,"G"); cx+=textwidth("G"); cx=cx+1; setcolor(12); outtextxy(cx,60,"ame"); cx=100; setcolor(15); outtextxy(cx,60,"H"); cx+=textwidth("H"); cx=cx+1; setcolor(12); outtextxy(cx,60,"elp"); setlinestyle(SOLID_LINE,1,1); setcolor(15);
line(0,65,640,65); barx=0; barxx=barx+60; bary=75; baryy=bary+20; bricknum=0; ctr=0;
if (barxx>640){ if (ctr==0 || ctr==2 || ctr==4 || ctr==6 || ctr==8 || ctr==10 || ctr==12 || ctr==14){ bricknum=1;} if (ctr==1 || ctr==3 || ctr==5 || ctr==7 || ctr==9 || ctr==11 || ctr==13 || ctr==15){ bricknum=0;} if (bricknum==1){ bary=bary+25; baryy=bary+20; barx=0; barxx=barx+30;} if (bricknum==0){ bary=bary+25; baryy=bary+20; barx=0; barxx=barx+60;} ctr++;} } if (textcounter==0){ messageboxc=125; messageboxr=125; messageboxcc=450; messageboxrr=200; midx=265; sound(100); delay(75); nosound(); savebox(); errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Speed"); setcolor(0); outtextxy(messageboxc+5,messageboxr+35,"Enter ballspeed (less than 100) -"); messageboxc+=textwidth("Enter ballspeed (less than 100) -"); cursorctr=messageboxc+5; messageboxc=cursorctr; setfillstyle(SOLID_FILL,15); bar(messageboxc,messageboxr+45,messageboxc+5,messageboxr+50);} /* BRICKS */ /* B */ srand( seed ); /* Restart random # function */ count=0; color=15; while (!kbhit()){ if (count==0 || count==2){ i=0; z=50; q=20; w=200; h=125; ctr=0; greateri=1000; bee();} if (count==0 || count==1){ i=0; z=150; q=20; w=200; h=125; ctr=0; greateri=1000; arr();} if (count==0 || count==2){ i=0; z=250; q=20; w=200; h=125; greateri=1000; eye();} if (count==0 || count==1){ i=0; z=325; q=15; w=200; h=25; greateri=100; ctr=0; see();} if (count==0 || count==2){ i=0; z=425; q=20; w=200; h=125; greateri=1000; ctr=0; kay();} if (count==0 || count==1){ i=0; z=595; q=20; w=200; h=15; greateri=100; ctr=0; ess();} settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(10); outtextxy(115,340,"A ballgame designed & developed by J.V.Ravichandran"); sound(275); delay(50); sound(250); delay(100); sound(300); delay(75); sound(125); delay(50); sound(225); delay(50); sound(300); delay(100); sound(125); delay(50); sound(225); delay(100); nosound(); /* End */ delay(200); count++; color++; if (color>=15){ color=0;} } while (textcounter!=5){ ctrlbrk(c_break); key=getch(); switch(key){ case 8: if (textcounter>0 && messageboxc>cursorctr){ setfillstyle(SOLID_FILL,9); bar(messageboxc-3,messageboxr+30,messageboxc+10,messageboxr+50); messageboxc-=textwidth(&key); textcounter--;} if (textcounter<=0){textcounter=0;}
if (messageboxc<=cursorctr){messageboxc=cursorctr;} setfillstyle(SOLID_FILL,15); bar(messageboxc,messageboxr+45,messageboxc+5,messageboxr+50); break; case 27: sound(200); delay(50); nosound(); break; case 13: if (textcounter==0){ sound(200); delay(50); nosound();} if (delayover==1 && textcounter>0){ lastcounter=textcounter; gamestart=2; count=0; while (count
/* Frame */ setfillstyle(SOLID_FILL,2); bar(0,100,5,460); bar(0,455,640,460); bar(635,100,640,460);
ballrow=125; ballcol=300; once=0; down=1; brickctr=1; while (brickctr<=40){ strcpy(&brick[brickctr],"0"); brickctr++;} incolor=12; ball();
if (delayover==3 || delayover==5){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(12); outtextxy(275,470,"Level - 1"); if (ballnum==0){ ballcx=10;} if (ballnum==1){ ballcx=35;} if (ballnum==2){ ballcx=60;} if (ballnum==3){ ballcx=85;} if (ballnum==4){ ballcx=110;} if (ballnum>4){
srand( seed ); /* Restart Random # at same # */
vx=z+random(q-1); /* Column */ vy=w+random(h-1); /* Row */ putpixel( vx, vy, color );} ctr++; if (ctr==1){ i=0; z=170; q=15; w=200; greateri=50; h=15;} if (ctr==2){ i=0; greateri=50; z=180; q=15; w=200; h=25;} if (ctr==3){ i=0; greateri=50; z=190; q=15; w=210; h=25;} if (ctr==4){ i=0; greateri=50; z=200; q=15; w=220; h=25;} if (ctr==5){ i=0; greateri=50; z=190; q=15; w=210; h=25;} if (ctr==6){ i=0; greateri=50; z=170; q=15; w=250; h=25;} if (ctr==7){ i=0; greateri=50; z=180; q=15; w=240; h=25;} if (ctr==8){ i=0; z=190; q=15; w=230; greateri=50; h=25;} if (ctr==9){ i=0; z=170; q=15; w=250; greateri=50; h=15;} if (ctr==10){ i=0; greateri=50; z=180; q=15; w=250; h=25;} if (ctr==11){ i=0; greateri=50; z=180; q=15; w=260; h=25;} if (ctr==12){ i=0; greateri=50; z=195; q=15; w=270; h=25;} if (ctr==13){ i=0; greateri=50; z=200; q=15; w=280; h=25;} if (ctr==14){ i=0; greateri=50; z=205; q=15; w=290; h=25;} if (ctr==15){ i=0; greateri=50; z=205; q=15; w=300; h=25;} } srand(seed); return 1;} int eye(){ for( i=0 ; i
delay(100); for( i=0 ; i
w=195; greateri=100; h=25;} if (ctr==3){ i=0; z=565; q=15; w=205; greateri=100; h=25;} if (ctr==4){ i=0; z=555; q=15; w=210; greateri=100; h=25;} if (ctr==5){ i=0; z=545; q=15; w=215; greateri=100; h=25;} if (ctr==6){ i=0; z=545; q=15; w=225; greateri=100; h=25;} if (ctr==7){ i=0; z=555; q=15; w=235; greateri=100; h=25;} if (ctr==8){ i=0; z=565; q=15; w=245; greateri=100; h=25;} if (ctr==9){ i=0; z=575; q=15; w=255; greateri=100; h=25;} if (ctr==10){ i=0; z=585; q=15; w=265; greateri=100; h=25;} if (ctr==11){ i=0; z=585; q=15; w=275; greateri=100; h=25;} if (ctr==12){ i=0; z=575; q=15; w=285; greateri=100; h=25;} if (ctr==13){ i=0; z=565; q=15; w=290; greateri=100; h=25;} if (ctr==14){ i=0; z=555; q=15; w=290; greateri=100; h=25;} if (ctr==15){ i=0; z=545; q=15; w=295; greateri=100; h=25;} if (ctr==16){ i=0; z=535; q=15; w=300; greateri=100; h=25;} if (ctr==17){ i=0; z=525; q=15; w=300; greateri=100; h=25;}srand(seed); } return 1;} int dropdownmenu(){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setfillstyle(SOLID_FILL,15); bar(menucol,menurow+2,menucoll,menuroww); setfillstyle(SOLID_FILL,0); bar(menucol+1,menurow+3,menucoll-1,menuroww-1);setfillstyle(SOLID_FILL,7); bar(menucol+4,menurow+5,menucoll-3,menurow+20); bar(menucol+4,menurow+25,menucoll-3,menurow+41); setlinestyle(SOLID_LINE,1,2); setcolor(15); line(menucol+4,menurow+5,menucoll-3,menurow+5); line(menucol+4,menurow+5,menucol+4,menurow+20);line(menucol+4,menurow+25,menucoll-3,menurow+25); line(menucol+4,menurow+25,menucol+4,menurow+41);setcolor(0); line(menucol+4,menurow+20,menucoll-3,menurow+20); line(menucoll-3,menurow+5,menucoll-3,menurow+20);line(menucol+4,menurow+41,menucoll-3,menurow+41); line(menucoll-3,menurow+25,menucoll-3,menurow+41);/* line in between menu items */ setcolor(15); line(menucol,menurow+22,menucoll,menurow+22);return 1;} int threed_menu(){ setlinestyle(SOLID_LINE,1,1); setcolor(15); line(menucoll-6,menurow+8,menucoll-6,menurow+17); line(menucol+7,menurow+17,menucoll-6,menurow+17); setcolor(0); line(menucol+7,menurow+7,menucoll-7,menurow+7); line(menucol+7,menurow+7,menucol+7,menurow+17); return 1;}
int twod_menu(){ setlinestyle(SOLID_LINE,1,1); setcolor(7); line(menucol+7,menurow+7,menucoll-7,menurow+7); line(menucol+7,menurow+7,menucol+7,menurow+17); setcolor(7); line(menucoll-6,menurow+8,menucoll-6,menurow+17); line(menucol+7,menurow+17,menucoll-6,menurow+17); return 1;} int threed_menuitem2(){ setlinestyle(SOLID_LINE,1,1); setcolor(15); line(menucol+7,menurow+27,menucoll-8,menurow+27); line(menucol+7,menurow+27,menucol+7,menurow+39); setlinestyle(SOLID_LINE,1,1); setcolor(0); line(menucoll-6,menurow+27,menucoll-6,menurow+39); line(menucol+7,menurow+39,menucoll-6,menurow+39); return 1;} int twod_menuitem2(){ setlinestyle(SOLID_LINE,1,1); setcolor(7); line(menucol+7,menurow+27,menucoll-8,menurow+27); line(menucol+7,menurow+27,menucol+7,menurow+39); setlinestyle(SOLID_LINE,1,1); setcolor(7); line(menucoll-6,menurow+27,menucoll-6,menurow+39); line(menucol+7,menurow+39,menucoll-6,menurow+39); return 1;} int howtouse(){ messageboxc=125; messageboxr=125; messageboxcc=515; messageboxrr=320; midx=300; savebox(); errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Help"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,160,"How to use GREYcells Bricks"); setcolor(7); outtextxy(messageboxc+5,185,"Use the left & right arrow keys to move the"); outtextxy(messageboxc+5,200,"board between the walls. After a game is over,"); outtextxy(messageboxc+5,215,"select START from the menu to start a new game."); outtextxy(messageboxc+5,235,"To select a menu, depress ALT + the colored"); outtextxy(messageboxc+5,250,"letter. To select the oval menu, depress"); outtextxy(messageboxc+5,265,"ALT + Zero. To turn off sound use space bar."); outtextxy(messageboxc+5,280,"To exit game, press."); getch(); restorebox(); return 1;} int about(){ messageboxc=125; messageboxr=125; messageboxcc=515; messageboxrr=300; midx=300; savebox(); errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Help"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(3,1,3,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,155,"About GREYcells Bricks"); setcolor(7); outtextxy(messageboxc+5,185,"A game developed by J.V.Ravichandran, Software"); outtextxy(messageboxc+5,200,"architect/Software consultant/Proprietor."); outtextxy(messageboxc+5,230,"Semantix Computers, B-10, Triveni Apartments,"); outtextxy(messageboxc+5,245,"Near 'H' Block, Vikas puri, New Delhi-110 018."); getch(); restorebox(); return 1;} int shareware(){ messageboxc=125; messageboxr=125; messageboxcc=525; messageboxrr=325; savebox(); if (soundon==1){ sound(275); delay(150); sound(225); delay(250); sound(375); delay(250); nosound();} midx=300; errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Alert"); setusercharsize(3,1,3,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,155,"GREYcells Bricks"); setcolor(12); outtextxy(messageboxc+5,messageboxr+60,"A game developed by J.V.Ravichandran, Software"); outtextxy(messageboxc+5,messageboxr+75,"architect/Software consultant/Proprietor."); settextstyle(SMALL_FONT,HORIZ_DIR,3); settextjustify(0,1); setusercharsize(2,2,3,3); setcolor(0); outtextxy(messageboxc+5,messageboxr+95,"This is a shareware version. To increase the no. of levels in the"); outtextxy(messageboxc+5,messageboxr+110,"game, please send Rs.100.00 only or TEN dollars for more levels."); outtextxy(messageboxc+5,messageboxr+125,"Cheque to be drawn in favor of Semantix Computers, New Delhi,"); outtextxy(messageboxc+5,messageboxr+140,"and mail it to"); setcolor(10); outtextxy(messageboxc+5,messageboxr+155,"Mr. J.V.Ravichandran, Proprietor, Semantix Computers,"); outtextxy(messageboxc+5,messageboxr+170,"B-10, Triveni Apartments, Vikas puri, New Delhi-110 018."); outtextxy(messageboxc+5,messageboxr+185,""); getch(); restorebox(); return 1;}
int errorscreen(){ setfillstyle(SOLID_FILL,9); bar(messageboxc,messageboxr,messageboxcc,messageboxrr); setfillstyle(SOLID_FILL,7); bar(messageboxc+1,messageboxr+1,messageboxcc-1,messageboxr+16); setfillstyle(SOLID_FILL,0); bar(messageboxc+2,messageboxr+2,messageboxc+45,messageboxr+15); setlinestyle(SOLID_LINE,1,1); setcolor(15); line(messageboxc+45,messageboxr,messageboxcc,messageboxr); line(messageboxc+45,messageboxr,messageboxcc,messageboxr); setfillstyle(SOLID_FILL,7); bar(messageboxc+1,messageboxrr-16,messageboxcc-65,messageboxrr-1); setcolor(15); line(messageboxc,messageboxrr-16,messageboxcc-65,messageboxrr-16); line(messageboxc,messageboxrr-16,messageboxc,messageboxrr-15);
setfillstyle(SOLID_FILL,0); bar(messageboxcc-63,messageboxrr-16,messageboxcc-1,messageboxrr-1); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(15); setusercharsize(1,3,1,1); settextjustify(0,1); outtextxy(midx,messageboxr+5,"GREYcells"); setcolor(13); outtextxy(messageboxc+5,messageboxrr-11,"Press any key to continue..."); return 1;} int quit(){ messageboxc=150; messageboxr=173; messageboxcc=500; messageboxrr=300; midx=300; if (soundon==1){ sound(275); delay(150); sound(225); delay(250); sound(375); delay(250); nosound();} errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Exit"); setcolor(12); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); outtextxy(messageboxc+5,messageboxr+35,"GREYcells Bricks"); setcolor(10); outtextxy(messageboxc+5,messageboxr+55,"A game developed by J.V.Ravichandran."); setcolor(7); outtextxy(messageboxc+5,messageboxr+75,"(c) Semantix Computers, New Delhi"); setcolor(0); outtextxy(messageboxc+5,messageboxr+90,"B-10, Triveni apartments, Vikas puri,"); outtextxy(messageboxc+5,messageboxr+105,"New Delhi-110 018."); getch(); return 1;} int evaluate(){ if (ballcol>=0 && ballcol<=60){ firstbrick(); baryy=bary+20; once=0; barx=0; checkbrickexistence(); downevaluateflag=0;} if (ballcol>=64 && ballcol<=124){ downevaluateflag=0; secondbrick(); barx=64; baryy=bary+20; checkbrickexistence();} if (ballcol>=128 && ballcol<=188){ downevaluateflag=0; thirdbrick(); barx=128; baryy=bary+20; checkbrickexistence();} if (ballcol>=192 && ballcol<=252){ downevaluateflag=0; fourthbrick(); barx=192; baryy=bary+20; checkbrickexistence();} if (ballcol>=256 && ballcol<=316){ downevaluateflag=0; fifthbrick(); barx=256; baryy=bary+20; checkbrickexistence();} if (ballcol>=320 && ballcol<=380){ downevaluateflag=0; sixthbrick(); barx=320; baryy=bary+20; checkbrickexistence();} if (ballcol>=384 && ballcol<=444){ downevaluateflag=0; seventhbrick(); barx=384; baryy=bary+20; checkbrickexistence();} if (ballcol>=448 && ballcol<=508){ downevaluateflag=0; eighthbrick(); barx=448; baryy=bary+20; checkbrickexistence();} if (ballcol>=512 && ballcol<=572){ downevaluateflag=0; ninthbrick(); barx=512; baryy=bary+20; checkbrickexistence();} if (ballcol>=576 && ballcol<=636){ downevaluateflag=0; tenthbrick(); barx=576; baryy=bary+20; checkbrickexistence();} return 1;}
int secondevaluate(){ if (ballcol>56 && ballcol<70 ballcol="" barx="64;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="0;}" firstbrick="" if="" secondbrick="">119 && ballcol<135 ballcol="" barx="128;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" if="" secondbrick="" thirdbrick="">182 && ballcol<199 ballcol="" barx="192;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" fourthbrick="" if="" thirdbrick="">248 && ballcol<264 ballcol="" barx="256;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" fifthbrick="" fourthbrick="" if="">315 && ballcol<331 ballcol="" barx="320;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" fifthbrick="" if="" sixthbrick="">374 && ballcol<394 ballcol="" barx="384;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" if="" seventhbrick="" sixthbrick="">440 && ballcol<456 ballcol="" barx="448;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" eighthbrick="" if="" seventhbrick="">501 && ballcol<521 ballcol="" barx="512;" baryy="bary+20;" checkbrickexistence="" downevaluateflag="1;" eighthbrick="" if="" ninthbrick="">568 && ballcol<582 1="" bar="" barx="" barxx="" bary="" baryy="" brick="" brickctr="" checkbrickexistence="" d="" delay="" down="1;" downangle="1;" downevaluateflag="2;" evaluateflag="3;" hitflag="=1){" if="" int="" ninthbrick="" nosound="" once="=2" pre="" return="" setfillstyle="" settextjustify="" settextstyle="" sound="" soundon="=1){" sscanf="" strcpy="" tenthbrick="">
setcolor(0); scorex=510; scorex+=textwidth("Score -"); scorex=scorex+5; outtextxy(scorex,470,&newstr); strcpy(&brick[brickctr],"2"); sscanf(&brick[brickctr],"%d",&hitflag); score=score+10; scorex=510; scorex+=textwidth("Score -"); scorex=scorex+5; #if 0 setfillstyle(SOLID_FILL,15); bar(100,200,400,400); setcolor(0); outtextxy(110,225,"Ballcol"); outtextxy(110,250,"Ballrow"); outtextxy(110,275,"Brickctr"); sprintf(&newstr,"%d",ballcol); outtextxy(250,225,&newstr); sprintf(&newstr,"%d",ballrow); outtextxy(250,250,&newstr); sprintf(&newstr,"%d",brickctr); outtextxy(250,275,&newstr); getch(); #endif switch(score){ case 400: case 800: case 1200: case 1600: case 2000: case 2400: case 2800: case 3200: case 3600: case 4000: case 4400: case 4800: case 5200: case 5600: case 6000: case 6400: case 6800: case 7200: case 7600: case 8000: case 8400: case 8800: case 9200: case 9600: case 10000: delayover=3; down=5; once=0; break; } if (score>10000){ scorectr++; if (scorectr>=1){ settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(12); outtextxy(150,150,"Congratulations !"); outtextxy(225,250,"Join the"); outtextxy(175,300,"high scorers'"); outtextxy(250,350,"band !"); while (!kbhit()){ tune();} getch(); delayover=3; settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,1); setcolor(0); outtextxy(150,150,"Congratulations !"); outtextxy(225,250,"Join the"); outtextxy(175,300,"high scorers'"); outtextxy(250,350,"band !"); alertformoney(); down=5; gamestart=1; once=0;} } if (down==5 && scorectr>=1){ down=8;} if (down==8){ delayover=5; down=5;} if (down!=5){ scorex=510; scorex+=textwidth("Score -"); scorex=scorex+5; writescore(); bx=barx; bxx=barxx; counter=bx; downangle=1; once=0; down=1;} } return 1;} int firstbrick(){ if (ballrow>=0 && ballrow<21 ballrow="" bary="0;}" brickctr="1;" if="" once="0;">23 && ballrow<45 ballrow="" bary="24;}" brickctr="2;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="3;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="4;" if="" int="" once="0;" return="" secondbrick="">=0 && ballrow<21 pre="">582>521>456>394>331>264>199>135>70>
once=0; brickctr=5; bary=0;} if (ballrow>23 && ballrow<45 ballrow="" bary="24;}" brickctr="6;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="7;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="8;" if="" int="" once="0;" return="" thirdbrick="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="9;" if="" once="0;">23 && ballrow<45 ballrow="" bary="24;}" brickctr="10;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="11;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="12;" fourthbrick="" if="" int="" once="0;" return="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="13;" if="" once="0;">23 && ballrow<45 ballrow="" bary="24;}" brickctr="14;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="15;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="16;" fifthbrick="" if="" int="" once="0;" return="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="17;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="18;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="19;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="20;" if="" int="" once="0;" return="" sixthbrick="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="21;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="22;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="23;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="24;" if="" int="" once="0;" return="" seventhbrick="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="25;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="26;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="27;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="28;" eighthbrick="" if="" int="" once="0;" return="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="29;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="30;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="31;" if="" once="0;">71 && ballrow<95 1="" ballrow="" bary="72;}" brickctr="32;" if="" int="" ninthbrick="" once="0;" return="">=0 && ballrow<21 ballrow="" bary="0;}" brickctr="33;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="34;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="35;" if="" once="0;">71 && ballrow<95 1="" bary="72;}" brickctr="36;" once="0;" pre="" return="">21>95>69>45>21>
int tenthbrick(){ if (ballrow>=0 && ballrow<21 ballrow="" bary="0;}" brickctr="37;" if="" once="0;">24 && ballrow<45 ballrow="" bary="24;}" brickctr="38;" if="" once="0;">47 && ballrow<69 ballrow="" bary="48;}" brickctr="39;" if="" once="0;">71 && ballrow<95 1="" angle="=1){" ballrow="" bary="72;}" brickctr="40;" if="" int="" once="0;" return="" upangles="">0 && ballcol>14 && wallctr==0){ ballcol=ballcol-6;} if (ballrow>0 && ballcol<=14){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol+6; ballrow=ballrow-5;}} if (angle==2){ if (ballrow>0 && ballcol>14 && wallctr==0){ ballcol=ballcol-4;} if (ballrow>0 && ballcol<=14){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol+4;}} if (angle==3){ if (ballrow>0 && ballcol>14 && wallctr==0){ ballcol=ballcol-2;} if (ballrow>0 && ballcol<=14){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol+2;}} if (angle==4){ if (ballrow>0 && ballcol>14 && wallctr==0){ ballcol=ballcol-1;} if (ballrow>0 && ballcol<=14){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol+1;}} if (angle==5){ if (ballrow>0 && ballcol<626 ballcol="ballcol+2;}" ballrow="" if="" wallctr="=0){">0 && ballcol>=626){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol-2;}} 626>95>69>45>21>if (angle==6){ if (ballrow>0 && ballcol<626 ballcol="ballcol+4;}" ballrow="" if="" wallctr="=0){">0 && ballcol>=626){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol-4;} if (ballcol<=14){ballcol=14;} } if (angle==7){ if (ballrow>0 && ballcol<626 ballcol="ballcol+6;}" ballrow="" if="" wallctr="=0){">0 && ballcol>=626){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol-6;} if (ballcol<=14){ballcol=14;}} if (angle==8){ if (ballrow>0 && ballcol<626 ballcol="ballcol+8;}" ballrow="" if="" wallctr="=0){">0 && ballcol>=626){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol-8;} if (ballcol<=14){ballcol=14;}} if (ballrow<=0){ ballrow=0; incolor=0; ball(); ballrow=ballrow+5; delay(20); incolor=12; ball(); angle=-1; down=1;} ballrow=ballrow-5; return (ballrow);}626>626>626>int alertformoney(){ messageboxc=25; messageboxr=100; messageboxcc=615; messageboxrr=216; midx=300; savebox(); errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"Alert"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,3); setcolor(0); outtextxy(30,125,"This is a shareware software. To access all the features in the software,"); outtextxy(30,140,"please send a cheque of Rs.100.00 only or TEN dollars drawn in favor of"); outtextxy(30,155,"Semantix computers, New Delhi and address it to,"); setcolor(12); cx=30; outtextxy(cx,170,"J.V.Ravichandran,"); cx+=textwidth("J.V.Ravichandran,"); cx++; setcolor(14); outtextxy(cx,170,"Proprietor/Software Architect/Consultant."); setcolor(10); outtextxy(30,185,"B-10, Triveni Apartments, Vikas puri, New Delhi - 110 018."); getch(); restorebox(); return 1;} int tune(){ if (soundon==1){ sound(275); delay(50); sound(250); delay(100); sound(300); delay(75); sound(125); delay(50); sound(225); delay(50); sound(300); delay(100); sound(125); delay(50); sound(225); delay(100); nosound();}return 1;} int savebox(){ size=imagesize(messageboxc,messageboxr,messageboxcc,messageboxrr); sbox=malloc(size); getimage(messageboxc,messageboxr,messageboxcc,messageboxrr,sbox); return 1;} int restorebox(){ putimage(messageboxc,messageboxr,sbox, COPY_PUT); free(sbox); return 1;} int writescore(){ scorex=510; sprintf(&newstr,"%d",score); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); scorex+=textwidth("Score -"); scorex=scorex+5; setcolor(14); outtextxy(scorex,470,&newstr); return 1;} END OF GREYcells Bricks95>69>45>21>95>69>45>21>95>69>45>21>95>69>45>21>95>69>45>21>95>69>45>21>95>69>45>21>95>69>45>
No comments:
Post a Comment