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){ firstbrick(); barx=0; baryy=bary+20; checkbrickexistence(); secondbrick(); barx=64; checkbrickexistence(); downevaluateflag=0;} if (ballcol>119 && ballcol<135){ secondbrick(); barx=64; baryy=bary+20; downevaluateflag=1; checkbrickexistence(); thirdbrick(); barx=128; downevaluateflag=1; checkbrickexistence();} if (ballcol>182 && ballcol<199){ thirdbrick(); barx=128; baryy=bary+20; downevaluateflag=1; checkbrickexistence(); fourthbrick(); barx=192; downevaluateflag=1; checkbrickexistence();} if (ballcol>248 && ballcol<264){ fourthbrick(); barx=192; baryy=bary+20; downevaluateflag=1; checkbrickexistence(); fifthbrick(); barx=256; downevaluateflag=1; checkbrickexistence();} if (ballcol>315 && ballcol<331){ fifthbrick(); baryy=bary+20; barx=256; downevaluateflag=1; checkbrickexistence(); sixthbrick(); barx=320; downevaluateflag=1; checkbrickexistence();} if (ballcol>374 && ballcol<394){ sixthbrick(); baryy=bary+20; barx=320; downevaluateflag=1; checkbrickexistence(); seventhbrick(); barx=384; downevaluateflag=1; checkbrickexistence();} if (ballcol>440 && ballcol<456){ seventhbrick(); baryy=bary+20; barx=384; downevaluateflag=1; checkbrickexistence(); eighthbrick(); barx=448; downevaluateflag=1; checkbrickexistence();} if (ballcol>501 && ballcol<521){ eighthbrick(); baryy=bary+20; barx=448; downevaluateflag=1; checkbrickexistence(); ninthbrick(); barx=512; downevaluateflag=1; checkbrickexistence();} if (ballcol>568 && ballcol<582){ ninthbrick(); barx=512; baryy=bary+20; downevaluateflag=1; checkbrickexistence(); tenthbrick(); barx=576; downevaluateflag=1; checkbrickexistence();} evaluateflag=3; return 1;} int checkbrickexistence(){ if (brickctr!=41){ sscanf(&brick[brickctr],"%d",&hitflag);} if (once==0 && hitflag==2 && downangle==0){ downangle=0; down=3; once=1;} if (once==0 && hitflag==2 && downangle==1){ downangle=1; down=1; once=1;} if (once==0 && hitflag==0 && brickctr!=41){ strcpy(&brick[brickctr],"1"); sscanf(&brick[brickctr],"%d",&hitflag); once=2;} if (once==2 && hitflag==1){ if (soundon==1){ sound(200); delay(20); nosound(); sound(50); delay(20); nosound();} downevaluateflag=2; barxx=barx+60; setfillstyle(SOLID_FILL,0); bar(barx,bary,barxx,baryy); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1);
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){ brickctr=1; once=0; bary=0;} if (ballrow>23 && ballrow<45){ brickctr=2; once=0; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=3; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=4; bary=72;} return 1;} int secondbrick(){ if (ballrow>=0 && ballrow<21){
once=0; brickctr=5; bary=0;} if (ballrow>23 && ballrow<45){ once=0; brickctr=6; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=7; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=8; bary=72;} return 1;} int thirdbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=9; bary=0;} if (ballrow>23 && ballrow<45){ once=0; brickctr=10; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=11; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=12; bary=72;} return 1;} int fourthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=13; bary=0;} if (ballrow>23 && ballrow<45){ once=0; brickctr=14; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=15; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=16; bary=72;} return 1;} int fifthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=17; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=18; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=19; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=20; bary=72;} return 1;} int sixthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=21; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=22; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=23; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=24; bary=72;} return 1;} int seventhbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=25; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=26; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=27; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=28; bary=72;} return 1;} int eighthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=29; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=30; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=31; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=32; bary=72;} return 1;} int ninthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=33; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=34; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=35; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=36; bary=72;} return 1;}
int tenthbrick(){ if (ballrow>=0 && ballrow<21){ once=0; brickctr=37; bary=0;} if (ballrow>24 && ballrow<45){ once=0; brickctr=38; bary=24;} if (ballrow>47 && ballrow<69){ once=0; brickctr=39; bary=48;} if (ballrow>71 && ballrow<95){ once=0; brickctr=40; bary=72;} return 1;} int upangles(){ if (angle==1){ if (ballrow>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 && wallctr==0){ ballcol=ballcol+2;} if (ballrow>0 && ballcol>=626){ if (soundon==1){ sound(50); delay(50); nosound();} wallctr=1;} if (wallctr==1){ ballcol=ballcol-2;}}
if (angle==6){ if (ballrow>0 && ballcol<626 && wallctr==0){ ballcol=ballcol+4;} if (ballrow>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 && wallctr==0){ ballcol=ballcol+6;} if (ballrow>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 && wallctr==0){ ballcol=ballcol+8;} if (ballrow>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);}
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 Bricks
No comments:
Post a Comment