/************************************************************************/ /* Designed & developed by J.V.RAVICHANDRAN. */ /* Started on 02/09/1997. */ /* 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 -- 10th October, 1997. */ /* Name of software -- GREYcells Kulja Simsim */ /* Nature of software -- Password protect utility */ /************************************************************************/ #include#include #include #include #include #include #include #include #include #include
#define RESUME 1 #define ALT 1 unsigned size; unsigned menusize; unsigned newsize; void *bottombar; void *menubar; void *newbar; int length,validentry=0,incolor=0,color0=9,color1=9,secondline=0; int sharprow=280,sharpcol=285,sharprow1=295,sharpcoll=300,sharpcol1=315; int bodycol,bodyrow,bodycol1,bodyrow1,bodysize,bodycoll,bodycoll1,bodycounter,bodyinc; int handleseparatorrow=100,handleseparatorcol=285,handleseparatorcoll=315; int handlerow=100,handlecol=298,handlecoll=302; int sizecounter=0,charsize=1,charsize1=2; int scrollcounter,scrollrow,scrollcol=640; int row, row1, col, coll, coll1, col1, doorcounter,wedge,wedge1, midrow,midrow1,midcol,midcol1,midcoll,midcoll1,rwedge,lwedge,rwedge1,lwedge1; int xstart=99,ystart=99,yend=201,maxx=501,count=0,countt=0; int x,y,xx,yy,ctr,newlastcounter=0;; int gdriver = VGA, gmode=VGAHI, err_code; int cx=330,rx=150,ix=1,counter=0,gcx,ccx,rrx; char *str[40],*strin[40],*newstr[40],*newstrin[40],*compare[40]; char *grey[9],*strrr="J.V.Ravichandran,",titlestr; int ikey,inkey,key,ok,rrx=10,rrrx=10,ans,once=0,helpon=0,subhelpon=0; int cou=0,lastcount=0,twicecounter=0,secondttime=0,inputnewpassword=0; int ptr,time_spent=0,qr=0,wr=0,yr=0,twice=0,thrice=0,change=0; int handle,item=0,wwr,color=8,lastcounter=0,handl,curs_on_color=7,curs_off_color=9; int back,menuon=0,endcount=0; int nx,ny,nxx,nyy; int messageboxc,messageboxr,messageboxcc,messageboxrr,midx; int ct,visibleentry=0,a=1,mee=0,meex=0; char terminator,b;
int c_break() { if (inputnewpassword==1){ cleardevice(); new_password(); } if (helpon==0 && inputnewpassword==0){ cleardevice(); mainscreen(); } if (helpon==1 && subhelpon==0){ cleardevice(); drawhelpscreen(); } return (RESUME); } main() {
nosound(); ctrlbrk(c_break); initgraph(&gdriver, &gmode, ""); err_code = graphresult();
if (err_code !=grOk) { printf("Graphic initialization error...\n"); time_spent=0; while (time_spent<50){ time_spent++; delay(25);} exit(1); } screen(); mainscreen(); nosound();
ct=access("termin.$$$",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); exit(0); ix=0;}
if (ct==0){ handle=open("termin.$$$", O_RDONLY | O_BINARY); lseek(handle, 0L, SEEK_SET); counter=0; /* terminator=malloc(10);*/ while (!eof(handle)){ read(handle,&terminator,4);} } chmod("termin.$$$",S_IWRITE); unlink("termin.$$$");
_fmode=O_BINARY; handle=_creat("termin.$$$", FA_HIDDEN); lseek(handle, 0L, SEEK_SET);
sscanf(&terminator,"%d",&counter); counter++; sprintf(&terminator,"%d",counter); _write(handle,&terminator,4); /* free(terminator);*/ if (counter<28){ secondttime=0; ix=1;} if (counter>28){ sound(100); delay(25); sound(150); delay(25); sound(125); delay(25); nosound(); alertformoney(); #if 0 setfillstyle(SOLID_FILL,15); bar(100,100,550,260); setlinestyle(SOLID_LINE,1,1); setcolor(0); line(103,120,103,260); line(103,256,550,256); line(546,120,546,260); setfillstyle(SOLID_FILL,0); bar(101,101,549,120); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(15); settextjustify(0,1); outtextxy(295,111,"GREYcells"); settextstyle(DEFAULT_FONT,VERT_DIR,1); setcolor(7); settextjustify(0,1); outtextxy(125,111,"0"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(0); outtextxy(110,135,"Alert ! This version of GREYcells Kulja Simsim is a"); outtextxy(110,150,"shareware version. To access all the features in the"); outtextxy(110,165,"software, please send a cheque of Rs.500.00 only or"); outtextxy(110,180,"TWENTY-FIVE dollars drawn in favor of Semantix"); outtextxy(110,195,"Computers, New Delhi and address it to,"); setcolor(12); cx=110; outtextxy(cx,215,"J.V.Ravichandran,"); cx+=textwidth("J.V.Ravichandran,"); cx++; setcolor(14); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); outtextxy(cx,215,"Software Architect/Proprietor."); setcolor(9); outtextxy(110,230,"Semantix Computers, B-10, Triveni Apartments, Near 'H'"); outtextxy(110,245,"block, Vikas puri, New Delhi - 110 018."); #endif getch(); cleardevice(); mainscreen(); chmod("termin.$$$",S_IREAD); _close(handle); secondttime=1; cx=330; ix=1;}
counter=0; count=0; countt=0; lastcount=0; lastcounter=0; endcount=0; newlastcounter=0;
while (ix==1){ ctrlbrk(c_break); curs_on(); key=getch(); switch(key){ case ALT==1: case 129: while (qr<3){ x=100; y=100; xx=260; yy=170; save_menu_screen(); #if 0 settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxcc-50,messageboxrr-11,"Menu"); #endif settextstyle(DEFAULT_FONT,VERT_DIR,1); setusercharsize(3, 3, 1, 1); settextjustify(1,1); setcolor(12); outtextxy(119,106,"0"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); menu(); if (qr==1){ qr=4; } } if (qr==4){ qr=0; item=0;} break; case 8: #if 0 if (inputnewpassword==1){ if (cx<=350 && rx==175){ curs_off(); cx=480; rx=150; curs_on();} if (cx>350){ curs_off(); cx-=textwidth(&key); setfillstyle(SOLID_FILL,12); bar(cx-4,rx-5,cx+10,rx+10); curs_on();} if (countt>0){ countt--;} if (countt<=0){ countt=0;} if (cx==350 && rx==160){ curs_off(); sound(20); cx=350; rx=150; countt=0; curs_on(); nosound();} /* strcpy(&newstrin[countt],NULL);*/ } #endif if (inputnewpassword==0){ if (change==0){ if (cx<=330 && rx==170){ curs_off(); secondline=0; cx=483; rx=155; curs_on();} if (cx<333 && rx==155){ curs_off(); sound(20); cx=330; rx=155; count=0; curs_on(); nosound();} if (cx==330 && rx==155){ curs_off(); cx=330; rx=155; curs_on(); count=0;} if (cx>330){ curs_off(); cx-=textwidth(&key); setfillstyle(SOLID_FILL,curs_off_color); bar(cx-4,rx-5,cx+10,rx+10); count--; if (count<=0){ count=0;} /* strcpy(&strin[count],NULL);*/ curs_on();}} if (change==1){ if (cx<333 && rx==170){ curs_off(); cx-=textwidth(&key); setfillstyle(SOLID_FILL,curs_off_color); bar(cx-4,rx-5,cx+10,rx+10); count--; cx=480; secondline=0; rx=155; curs_on();} if (cx==350 && rx==155){ curs_off(); sound(20); cx=350; rx=155; curs_on(); count=0; nosound();} if (cx>330 && rx==170){ curs_off(); cx-=textwidth(&key); setfillstyle(SOLID_FILL,curs_off_color); bar(cx-4,rx-5,cx+10,rx+10); count--;} if (cx>350 && rx==155){ curs_off(); cx-=textwidth(&key); setfillstyle(SOLID_FILL,curs_off_color); bar(cx-4,rx-5,cx+10,rx+10); count--; if (count<=0){ count=0;} /* strcpy(&strin[count],NULL);*/ curs_on();}} } break; case 27: count=0; counter=0; countt=0; lastcount=0; lastcounter=0; endcount=0; newlastcounter=0; curs_off(); if (inputnewpassword==1){ cx=350; rx=155; } if (inputnewpassword==0){ if (change==0){ cx=330; rx=155;} if (change==1){ cx=350; rx=155;}} curs_on(); break; case 13: if (inputnewpassword==0 && count>0){ /* if (count>0){*/ handle=_open("pass.$$$", O_RDONLY | O_BINARY); lseek(handle, 0L, SEEK_SET); endcount=count; counter=0; cx=300; while (!eof(handle)){ read(handle,&str[counter],1); counter++;}
lastcounter=endcount; lastcount=counter; #if 0 sprintf(&titlestr,"%d",lastcounter); setcolor(15); outtextxy(100,300,&titlestr); sprintf(&titlestr,"%d",lastcount); setcolor(15); outtextxy(100,330,&titlestr); getch(); #endif if (lastcounter>=lastcount){ newlastcounter=lastcounter; } if (lastcounter0){ counter=newlastcounter; ok=1; } if (ptr<0){ ok=1; counter=newlastcounter; } counter++;} if (ok==0){ mess(); if (change==1){ inputnewpassword=1; countt=0; curs_off_color=9; new_password();} if (change==0){ cleardevice(); setfillstyle(SOLID_FILL,15); bar(195,95,408,305); setfillstyle(SOLID_FILL,0); bar(198,98,405,302); doorcounter=0; row=100; col=200; row1=300; col1=300; coll=303; coll1=403; midrow=100; midrow1=300; midcol=297; midcol1=302; midcoll=302; midcoll1=307; opendoors(); free(bottombar); /* chmod("pass.$$$", S_IEXEC);*/ /* free(menubar);*/ ix=0;}} if (ok==1){ mees(); yr=1;} /* }*/ } if (inputnewpassword==1 && countt>0){ /* if (countt>0){*/ yr=0; if (visibleentry==1){ lastcount=countt; count=0; messageboxc=100; messageboxr=350; messageboxcc=400; messageboxrr=430; midx=225; mee=1; meex=0; errorscreen(); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(12); outtextxy(messageboxc+5,messageboxr+5,"New"); setcolor(12); settextjustify(0,1); cx=messageboxc+5; outtextxy(cx,messageboxr+35,"Your new password is"); cx+=textwidth("Your new password is"); cx=cx+5; lastcount=countt; count=0; rx=messageboxr+35; while (count 395 && rx==385){ rx=rx+15; cx=messageboxc+5;} count++;} } cx=325; rx=155; message(); mee=0; if (ans==1){ if (visibleentry==1){ setfillstyle(SOLID_FILL,0); bar(100,350,400,430);} close(handle); chmod("pass.$$$",S_IWRITE); unlink("pass.$$$"); lastcount=countt; _fmode=O_BINARY; handle=_creat("pass.$$$", FA_HIDDEN); lseek(handle, 0L, SEEK_SET); count=0; setverify(1); while (count =480 && rx==165){ sound(200); curs_off(); cx=480; rx=165; curs_on(); delay(100); nosound();} if (cx>=480 && rx==150){ curs_off(); cx=350; secondline=1; rx=rx+15;} if (cx<480){ setcolor(color1); curs_off(); outtextxy(cx,rx,&key); cx+=textwidth(&key); curs_on(); strcpy(&newstrin[countt],&key); countt++;}} if (inputnewpassword==0){ setcolor(color0); if (cx>=480 && rx==155){ curs_off(); cx=330; rx=170; secondline=1; curs_on();} if (cx==480 && rx==170){ sound(20); curs_off(); cx=480; rx=170; delay(20); curs_on(); nosound();} if (cx<480){ curs_off(); outtextxy(cx,rx,&key); cx+=textwidth(&key); curs_on(); strcpy(&strin[count],&key); count++;}} break; } } cleardevice(); closegraph(); clrscr(); exit(0); }
int curs_on() { setfillstyle(SOLID_FILL,curs_on_color); bar(cx+2,rx-5,cx+10,rx+10); return 1; }
int curs_off() { setfillstyle(SOLID_FILL,curs_off_color); bar(cx+2,rx-5,cx+10,rx+10); return 1; }
int mess(){ messageboxc=175; messageboxr=150; messageboxcc=425; messageboxrr=200; midx=280; mee=2; 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,1); settextjustify(0,1); setcolor(13); outtextxy(messageboxc+5,messageboxrr-11,"Please wait..."); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(incolor); settextjustify(0,0); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); outtextxy(185,179,"Password Ok. Please proceed !"); time_spent=0; while (time_spent<100){ time_spent++; delay(25);} ok=-1;
if (incolor>15){ incolor=0;} #if 0 setfillstyle(SOLID_FILL,9); bar(175,150,425,175); if (incolor>15){ incolor=0;} mee=0; #endif return 1;}
int mees(){ messageboxc=175; messageboxr=150; messageboxcc=425; messageboxrr=200; midx=280; mee=2; 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,1); settextjustify(0,1); setcolor(13); outtextxy(messageboxc+5,messageboxrr-11,"Please wait..."); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(0,1); setcolor(incolor); outtextxy(235,177,"Invalid password !"); if (incolor>15){ incolor=0;}
#if 0 setfillstyle(SOLID_FILL,9); bar(175,150,425,175); if (incolor>15){ incolor=0;} setcolor(incolor); settextjustify(0,0); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); bar(175,150,425,175); outtextxy(235,173,"Invalid password !"); #endif time_spent=0; while (time_spent<100){ time_spent++; delay(25);} mainscreen(); counter=0; count=0; countt=0; lastcount=0; lastcounter=0; newlastcounter=0; if (change==0){ cx=330; rx=155; thrice++; } if (change==1){ cx=350; rx=150;} mee=0; if (thrice==3){ row=100; col=200; row1=300; coll1=403; col1=250; coll=353; doorcounter=0; closedoors(); doorcounter=1; incolor=0; while (doorcounter==1){ setcolor(incolor); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); outtextxy(300,170,"Access denied !"); outtextxy(300,180,"Please"); outtextxy(300,190,"shut down"); outtextxy(300,205,"the computer"); outtextxy(300,215,"now !"); sound(200); delay(500); sound(220); delay(500); sound(230); setcolor(0); outtextxy(300,170,"Access denied !"); outtextxy(300,180,"Please"); outtextxy(300,190,"shut down"); outtextxy(300,205,"the computer"); outtextxy(300,215,"now !"); incolor++; if (incolor>15){ incolor=0;} } free(bottombar); closegraph(); clrscr();} ok=-1; return 1;}
int save_screen() { size=imagesize(xstart,ystart,maxx,yend); bottombar=malloc(size); getimage(xstart,ystart,maxx,yend,bottombar); return 1;}
int restore_screen() { putimage(xstart, ystart, bottombar, COPY_PUT); return 1;} int save_menu_screen() { menusize=imagesize(x,y,xx,yy); menubar=malloc(menusize); getimage(x,y,xx,yy,menubar); return 1;}
int restore_menu_screen() { putimage(x, y, menubar, COPY_PUT); free(menubar); return 1;}
int leftdoor(){ #if 0 /* hinges */ setcolor(7); setlinestyle(SOLID_LINE,1,1); line(col-15,row+5,col-15,row1-5); setfillstyle(SOLID_FILL,7); bar(col-20,row+15,col-10,row+45); bar(col-20,row+55,col-10,row1-15); #endif /* left door */ setfillstyle(SOLID_FILL,7); bar(col,row,col1,row1); setfillstyle(SOLID_FILL,0); bar(col+2,row+2,col1-wedge,row+95); bar(col+2,row+100,col1-wedge,row1-2); setfillstyle(SOLID_FILL,8); bar(col+3,row+3,col1-wedge-1,row+94); bar(col+3,row+101,col1-wedge-1,row1-3); return 1;}
int rightdoor(){ /* right door */ setfillstyle(SOLID_FILL,7); bar(coll,row,coll1,row1); setfillstyle(SOLID_FILL,0); bar(coll+wedge1,row+2,coll1-2,row+95); bar(coll+wedge1,row+100,coll1-2,row1-2); setfillstyle(SOLID_FILL,8); bar(coll+wedge1+1,row+3,coll1-3,row+94); bar(coll+wedge1+1,row+101,coll1-3,row1-3); return 1;}
int closedoors(){ cleardevice(); setfillstyle(SOLID_FILL,15); bar(195,95,408,305); setfillstyle(SOLID_FILL,0); bar(198,98,405,302); wedge=12; wedge1=12; leftdoor(); rightdoor(); while(doorcounter<11){ sound(20); delay(100); setfillstyle(SOLID_FILL,0); bar(col,row,col1,row1); bar(coll,row,coll1,row1); wedge--; leftdoor(); wedge1--; rightdoor(); col1=col1+5; coll=coll-5; doorcounter++; nosound(); } return 1;}
int opendoors(){ wedge=0; wedge1=0; while(doorcounter<10){ sound(20); delay(100); midcol=midcol-5; setfillstyle(SOLID_FILL,0); bar(midcol,midrow,midcol1,midrow1); wedge++; rwedge=wedge+1; leftdoor(); wedge1++; midcoll1=midcoll1+5; setfillstyle(SOLID_FILL,0); bar(midcoll,midrow,midcoll1,midrow1); rightdoor(); col1=col1-5; coll=coll+5; doorcounter++; nosound(); } return 1;}
int screen(){ /* max right position = 300 */ /* max increment = 20 */
row=100; col=200; row1=300; col1=300; coll=303; coll1=403;
#if 0 leftdoor(); rightdoor();
/* line between doors */ setlinestyle(SOLID_LINE,1,1); setcolor(0); line(302,100,302,300); #endif /* Close doors */ col1=250; coll=353;
doorcounter=0; /* closedoors();*/ /* delay(1000);*/ setfillstyle(SOLID_FILL,15); bar(195,95,408,305); setfillstyle(SOLID_FILL,0); bar(198,98,405,302);
col1=250; coll=353;
/* open doors */ doorcounter=0; row=100; col=200; row1=300; col1=300; coll=303; coll1=403; midrow=100; midrow1=300; midcol=297; midcol1=302; midcoll=302; midcoll1=307; opendoors(); drawsword(); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,0); setcolor(7); outtextxy(col1-54,row+65,"GREYcells"); setcolor(10); outtextxy(col1-56,row+65,"GREYcells"); settextstyle(GOTHIC_FONT,HORIZ_DIR,3); setcolor(15); outtextxy(col1+22,row+90,"Kulja Simsim"); setlinestyle(SOLID_LINE,1,3); sizecounter=1; setcolor(9); while (sizecounter<135){ line(col1+20,row+95,col1+21,row+95); col1++; delay(10); sizecounter++; }
col1=300; settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setcolor(15); outtextxy(col1-95,row+120,"A password protection"); outtextxy(col1-95,row+130,"utility for Dos/Windows.");
setcolor(10); outtextxy(col1-95,row+180,"(c) Semantix Computers,"); outtextxy(col1-95,row+190,"New Delhi, 1997.");
scrollcounter=0; scrollcol=640; scrollrow=325; while (scrollcol>200){ setcolor(15); outtextxy(scrollcol,scrollrow,"D"); setcolor(0); outtextxy(scrollcol,scrollrow,"D"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"D"); scrollcol=640; scrollrow=325; while (scrollcol>210){ setcolor(15); outtextxy(scrollcol,scrollrow,"e"); setcolor(0); outtextxy(scrollcol,scrollrow,"e"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"e"); scrollcol=640; scrollrow=325; while (scrollcol>220){ setcolor(15); outtextxy(scrollcol,scrollrow,"s"); setcolor(0); outtextxy(scrollcol,scrollrow,"s"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"s"); scrollcol=640; scrollrow=325; while (scrollcol>230){ setcolor(15); outtextxy(scrollcol,scrollrow,"i"); setcolor(0); outtextxy(scrollcol,scrollrow,"i"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"i"); scrollcol=640; scrollrow=325; while (scrollcol>240){ setcolor(15); outtextxy(scrollcol,scrollrow,"g"); setcolor(0); outtextxy(scrollcol,scrollrow,"g"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"g"); scrollcol=640; scrollrow=325; while (scrollcol>250){ setcolor(15); outtextxy(scrollcol,scrollrow,"n"); setcolor(0); outtextxy(scrollcol,scrollrow,"n"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"n"); scrollcol=640; scrollrow=325; while (scrollcol>260){ setcolor(15); outtextxy(scrollcol,scrollrow,"e"); setcolor(0); outtextxy(scrollcol,scrollrow,"e"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"e"); scrollcol=640; scrollrow=325; while (scrollcol>270){ setcolor(15); outtextxy(scrollcol,scrollrow,"d"); setcolor(0); outtextxy(scrollcol,scrollrow,"d"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"d"); scrollcol=640; scrollrow=325; while (scrollcol>290){ setcolor(15); outtextxy(scrollcol,scrollrow,"&"); setcolor(0); outtextxy(scrollcol,scrollrow,"&"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"&"); scrollcol=640; scrollrow=325; while (scrollcol>310){ setcolor(15); outtextxy(scrollcol,scrollrow,"d"); setcolor(0); outtextxy(scrollcol,scrollrow,"d"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"d"); scrollcol=640; scrollrow=325; while (scrollcol>320){ setcolor(15); outtextxy(scrollcol,scrollrow,"e"); setcolor(0); outtextxy(scrollcol,scrollrow,"e"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"e"); scrollcol=640; scrollrow=325; while (scrollcol>330){ setcolor(15); outtextxy(scrollcol,scrollrow,"v"); setcolor(0); outtextxy(scrollcol,scrollrow,"v"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"v"); scrollcol=640; scrollrow=325; while (scrollcol>340){ setcolor(15); outtextxy(scrollcol,scrollrow,"e"); setcolor(0); outtextxy(scrollcol,scrollrow,"e"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"e"); scrollcol=640; scrollrow=325; while (scrollcol>350){ setcolor(15); outtextxy(scrollcol,scrollrow,"l"); setcolor(0); outtextxy(scrollcol,scrollrow,"l"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"l"); scrollcol=640; scrollrow=325; while (scrollcol>360){ setcolor(15); outtextxy(scrollcol,scrollrow,"o"); setcolor(0); outtextxy(scrollcol,scrollrow,"o"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"o"); scrollcol=640; scrollrow=325; while (scrollcol>370){ setcolor(15); outtextxy(scrollcol,scrollrow,"p"); setcolor(0); outtextxy(scrollcol,scrollrow,"p"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"p"); scrollcol=640; scrollrow=325; while (scrollcol>380){ setcolor(15); outtextxy(scrollcol,scrollrow,"e"); setcolor(0); outtextxy(scrollcol,scrollrow,"e"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"e"); scrollcol=640; scrollrow=325; while (scrollcol>390){ setcolor(15); outtextxy(scrollcol,scrollrow,"d"); setcolor(0); outtextxy(scrollcol,scrollrow,"d"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"d"); scrollcol=640; scrollrow=345; while (scrollcol>285){ setcolor(15); outtextxy(scrollcol,scrollrow,"b"); setcolor(0); outtextxy(scrollcol,scrollrow,"b"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"b"); scrollcol=640; scrollrow=345; while (scrollcol>295){ setcolor(15); outtextxy(scrollcol,scrollrow,"y"); setcolor(0); outtextxy(scrollcol,scrollrow,"y"); scrollcol=scrollcol-3; } setcolor(15); outtextxy(scrollcol,scrollrow,"y"); scrollcol=640; scrollrow=365; while (scrollcol>225){ setcolor(12); outtextxy(scrollcol,scrollrow,"J"); setcolor(0); outtextxy(scrollcol,scrollrow,"J"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"J"); scrollcol=640; scrollrow=365; while (scrollcol>235){ setcolor(12); outtextxy(scrollcol,scrollrow,"."); setcolor(0); outtextxy(scrollcol,scrollrow,"."); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"."); scrollcol=640; scrollrow=365; while (scrollcol>245){ setcolor(12); outtextxy(scrollcol,scrollrow,"V"); setcolor(0); outtextxy(scrollcol,scrollrow,"V"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"V"); scrollcol=640; scrollrow=365; while (scrollcol>255){ setcolor(12); outtextxy(scrollcol,scrollrow,"."); setcolor(0); outtextxy(scrollcol,scrollrow,"."); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"."); scrollcol=640; scrollrow=365; while (scrollcol>265){ setcolor(12); outtextxy(scrollcol,scrollrow,"R"); setcolor(0); outtextxy(scrollcol,scrollrow,"R"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"R"); scrollcol=640; scrollrow=365; while (scrollcol>275){ setcolor(12); outtextxy(scrollcol,scrollrow,"a"); setcolor(0); outtextxy(scrollcol,scrollrow,"a"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"a"); scrollcol=640; scrollrow=365; while (scrollcol>285){ setcolor(12); outtextxy(scrollcol,scrollrow,"v"); setcolor(0); outtextxy(scrollcol,scrollrow,"v"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"v"); scrollcol=640; scrollrow=365; while (scrollcol>295){ setcolor(12); outtextxy(scrollcol,scrollrow,"i"); setcolor(0); outtextxy(scrollcol,scrollrow,"i"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"i"); scrollcol=640; scrollrow=365; while (scrollcol>305){ setcolor(12); outtextxy(scrollcol,scrollrow,"c"); setcolor(0); outtextxy(scrollcol,scrollrow,"c"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"c"); scrollcol=640; scrollrow=365; while (scrollcol>315){ setcolor(12); outtextxy(scrollcol,scrollrow,"h"); setcolor(0); outtextxy(scrollcol,scrollrow,"h"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"h"); scrollcol=640; scrollrow=365; while (scrollcol>325){ setcolor(12); outtextxy(scrollcol,scrollrow,"a"); setcolor(0); outtextxy(scrollcol,scrollrow,"a"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"a"); scrollcol=640; scrollrow=365; while (scrollcol>335){ setcolor(12); outtextxy(scrollcol,scrollrow,"n"); setcolor(0); outtextxy(scrollcol,scrollrow,"n"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"n"); scrollcol=640; scrollrow=365; while (scrollcol>345){ setcolor(12); outtextxy(scrollcol,scrollrow,"d"); setcolor(0); outtextxy(scrollcol,scrollrow,"d"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"d"); scrollcol=640; scrollrow=365; while (scrollcol>355){ setcolor(12); outtextxy(scrollcol,scrollrow,"r"); setcolor(0); outtextxy(scrollcol,scrollrow,"r"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"r"); scrollcol=640; scrollrow=365; while (scrollcol>365){ setcolor(12); outtextxy(scrollcol,scrollrow,"a"); setcolor(0); outtextxy(scrollcol,scrollrow,"a"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"a"); scrollcol=640; scrollrow=365; while (scrollcol>375){ setcolor(12); outtextxy(scrollcol,scrollrow,"n"); setcolor(0); outtextxy(scrollcol,scrollrow,"n"); scrollcol=scrollcol-2; } setcolor(12); outtextxy(scrollcol,scrollrow,"n");
/*test*/ /* handl=_creat("tempfile.gry",FA_HIDDEN);*/ handl=open("tempfile.gry",O_RDONLY); /* write(handle,"GREYcells",9);*/ lseek(handl,0L,SEEK_SET); setcolor(12); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,0); ctr=0; gcx=194; row=165; while (ctr<9){ read(handl,&grey[ctr],1); outtextxy(gcx,row,&grey[ctr]); gcx+=textwidth(&grey[ctr]); delay(150); ctr++;} gcx=192; delay(500); setcolor(9); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); settextjustify(0,0); ctr=0; row=165; while (ctr<9){ outtextxy(gcx,row,&grey[ctr]); gcx+=textwidth(&grey[ctr]); delay(150); ctr++;}
close(handl); delay(1000); sizecounter=1; row=100; col=200; row1=300; col1=300; coll=303; coll1=403; /* Close doors */ col1=250; coll=353;
doorcounter=0; closedoors(); delay(1000);
cleardevice(); return 1; }
int mainscreen(){ messageboxc=100; messageboxr=100; messageboxcc=500; messageboxrr=200; midx=275; mee=1; meex=0; errorscreen(); settextstyle(DEFAULT_FONT,VERT_DIR,1); setusercharsize(3, 3, 1, 1); settextjustify(1,1); setcolor(12); outtextxy(119,106,"0"); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(CENTER_TEXT,CENTER_TEXT);
if (change==0){ cx=330; rx=155; setcolor(incolor); outtextxy(225,155,"Your password, please -"); curs_on(); } if (change==1){ cx=350; rx=155; setcolor(incolor); outtextxy(225,155,"Your old password, please -"); curs_on(); if (count>0){ count=0; } while (count<40){ strcpy(&strin[count],NULL); count++;} count=0; } incolor++; if (incolor==8){ incolor++;} if (incolor>15){ incolor=0;} return 1;}
int menu(){ settextstyle(DEFAULT_FONT,HORIZ_DIR,1); settextjustify(1,1); setfillstyle(SOLID_FILL,15); bar(118,114,256,167); setfillstyle(SOLID_FILL,0); bar(119,115,255,166);
setfillstyle(SOLID_FILL,8); bar(122,117,252,130); bar(122,134,252,147); bar(122,151,252,164);
setlinestyle(SOLID_LINE,1,2); setcolor(15); line(122,117,251,117); line(122,117,122,129);
line(122,134,251,134); line(122,134,122,146);
line(122,151,251,151); line(122,151,122,163); if (item>2){ item=0; } if (secondttime==1){ setcolor(7); outtextxy(188,124,"Change password"); setcolor(0); outtextxy(188,142,"Help"); setcolor(0); outtextxy(188,158,"Visible"); twicecounter=0; item=1; twice=-2;}
if (secondttime==0){ setcolor(0); outtextxy(188,124,"Change password"); outtextxy(188,142,"Help"); outtextxy(188,158,"Visible"); item=0; twice=0;}
qr=0; while (qr==0){ ikey=getch(); switch(ikey){ case 27: twice=0; qr=1; item=0; restore_menu_screen(); #if 0 settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(0); outtextxy(messageboxcc-50,messageboxrr-11,"Menu"); #endif rx=155; wwr=0; wr=0; break; case 72: if (twice==-2){ if (item==2){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(0); settextjustify(1,1); outtextxy(188,142,"Help");} if (item==3){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(0); settextjustify(1,1); outtextxy(188,158,"Visible"); setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(15); settextjustify(1,1); outtextxy(188,142,"Help"); twicecounter=0;} if (item>1){ item--;} if (item==1){ item=1;} sound(30); delay(20); nosound(); } if (twice>-1){ if (item==1){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,119,125,129); line(125,119,250,119); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,119,250,129); line(125,129,250,129); setcolor(0); settextjustify(1,1); outtextxy(188,124,"Change password");} if (item==2){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(0); settextjustify(1,1); outtextxy(188,142,"Help"); setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,119,125,129); line(125,119,250,119); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,119,250,129); line(125,129,250,129); setcolor(15); settextjustify(1,1); outtextxy(188,124,"Change password");} if (item==3){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(0); settextjustify(1,1); outtextxy(188,158,"Visible"); setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(15); settextjustify(1,1); outtextxy(188,142,"Help");}
if (item>0){ item--;} sound(30); delay(20); nosound(); } break; case 80: if (twice==-2){ if (item==1){ setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(15); settextjustify(1,1); outtextxy(188,142,"Help");}
if (item==2){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(0); settextjustify(1,1); outtextxy(188,142,"Help"); setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(15); settextjustify(1,1); outtextxy(188,158,"Visible");} if (item==3){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(0); settextjustify(1,1); outtextxy(188,158,"Visible");} item++; if (item>3){ item=1;} sound(20); delay(30); nosound(); twicecounter++; } if (twice>-1){ if (item==0){ setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,119,125,129); line(125,119,250,119); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,119,250,129); line(125,129,250,129); setcolor(15); settextjustify(1,1); outtextxy(188,124,"Change password");} if (item==1){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,119,125,129); line(125,119,250,119); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,119,250,129); line(125,129,250,129); setcolor(0); settextjustify(1,1); outtextxy(188,124,"Change password");
setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(15); settextjustify(1,1); outtextxy(188,142,"Help");} if (item==2){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,136,125,146); line(125,136,250,136); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,136,250,146); line(125,146,250,146); setcolor(0); settextjustify(1,1); outtextxy(188,142,"Help"); setcolor(0); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(7); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(15); settextjustify(1,1); outtextxy(188,158,"Visible");} if (item==3){ setcolor(8); setlinestyle(SOLID_LINE,1,2); line(125,153,125,163); line(125,153,250,153); setcolor(8); setlinestyle(SOLID_LINE,1,2); line(250,153,250,163); line(125,163,250,163); setcolor(0); settextjustify(1,1); outtextxy(188,158,"Visible"); item=-1;} item++; sound(30); delay(20); nosound(); } break; case 13: if (item==1){ twice++; inputnewpassword=0; secondttime=1; change=1; cx=375; rx=155; restore_menu_screen(); #if 0 settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(0); outtextxy(messageboxcc-50,messageboxrr-11,"Menu"); #endif cleardevice(); mainscreen(); qr=1; } if (item==2){ restore_menu_screen(); #if 0 settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(0); outtextxy(messageboxcc-50,messageboxrr-11,"Menu"); #endif xstart=99; ystart=99; yend=201; maxx=501; free(bottombar); save_screen(); curs_off(); helpon=1; help(); cleanhelpscreen(); restore_screen(); free(bottombar); qr=1; counter=0; count=0; countt=0; lastcount=0; lastcounter=0; endcount=0; newlastcounter=0; } if (item==3){ if (count==0 || countt==0){ counter=0; count=0; countt=0; lastcount=0; lastcounter=0; endcount=0; newlastcounter=0; } once++; if (once==1){ if (inputnewpassword==1){ curs_off_color=9; visibleentry=1; color1=15;} if (inputnewpassword==0){ curs_off_color=9; visibleentry=1; color1=15; color0=15;}} if (once>1){ if (inputnewpassword==0){ curs_off_color=9; visibleentry=0; color1=9; color0=9;} if (inputnewpassword==1){ curs_off_color=9; visibleentry=0; color0=9; color1=9;} once=0;} restore_menu_screen(); #if 0 settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setusercharsize(1,3,1,1); settextjustify(0,1); setcolor(0); outtextxy(messageboxcc-50,messageboxrr-11,"Menu"); #endif qr=1;} break; }} return 1;}
int message(){ validentry=0; messageboxc=125; messageboxr=150; messageboxcc=475; messageboxrr=200; midx=285; mee=2; meex=3; 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,1); settextjustify(0,1); setcolor(7); outtextxy(messageboxc+5,messageboxrr-11,"Press any key to continue..."); setcolor(13); outtextxy(messageboxc+5,messageboxrr-11,"Press 'y' to save 'n' to redo..."); setcolor(14); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(messageboxc+5,175,"Ok to save new password (y/n)? -"); ccx=messageboxc+5; ccx+=textwidth("Ok to save new password (y/n)? -"); ccx=ccx+5; #if 0 setfillstyle(SOLID_FILL,9); bar(125,150,475,185); setcolor(15); settextstyle(TRIPLEX_FONT,HORIZ_DIR,1); setusercharsize(1, 2, 1, 3); settextjustify(1,1); #endif while (yr==0){ inkey=getch(); switch(inkey){ case 27: inkey=NULL; yr=0; validentry=0; break; case 13: yr=0; sound(100); delay(50); nosound(); break; case 121: validentry=1; setcolor(9); outtextxy(ccx,175,&inkey); setcolor(14); outtextxy(ccx,175,&inkey); ans=1; yr=1; break; case 89: validentry=1; ans=1; setcolor(9); outtextxy(ccx,175,&inkey); setcolor(14); outtextxy(ccx,175,&inkey); yr=1; break; case 110: validentry=0; ans=0; setcolor(9); outtextxy(ccx,175,&inkey); setcolor(14); outtextxy(ccx,175,&inkey); yr=1; break; case 78: validentry=0; ans=0; setcolor(9); outtextxy(ccx,175,&inkey); setcolor(14); outtextxy(ccx,175,&inkey); yr=1; break;}
} return (ans);}
No comments:
Post a Comment