void getinitials(void) { Sint4 k,i; newframe(); outtext("ENTER YOUR",100,70,3); outtext(" INITIALS",100,90,3); outtext("_ _ _",128,130,3); strcpy(scoreinit[0],"..."); killsound(); for (i=0;i<3;i++) { k=0; while (k==0) { k=getinitial(i*24+128,130); if (k==8 || k==127) { if (i>0) i--; k=0; } } if (k!=0) { gwrite(i*24+128,130,k,3); scoreinit[0][i]=k; } } for (i=0;i<20;i++) flashywait(15); setupsound(); gclear(); gpal(0); ginten(0); setretr(true); recputinit(scoreinit[0]); }
void finish(void) { killsound(); soundoff(); soundkillglob(); restorekeyb(); graphicsoff(); }
void getinitials(void) { Sint4 k,i; #ifdef _WINDOWS pause_windows_sound_playback(); #endif newframe(); outtext("ENTER YOUR",100,70,3); outtext(" INITIALS",100,90,3); outtext("_ _ _",128,130,3); strcpy(scoreinit[0],"..."); killsound(); for (i=0;i<3;i++) { k=0; while (k==0) { k=getinitial(i*24+128,130); if (k==8 || k==127) { if (i>0) i--; k=0; } } if (k!=0) { gwrite(i*24+128,130,k,3); scoreinit[0][i]=k; } } for (i=0;i<20;i++) #ifdef _WINDOWS flashywait(2); #else flashywait(15); #endif setupsound(); gclear(); gpal(0); ginten(0); setretr(TRUE); recputinit(scoreinit[0]); #ifdef _WINDOWS resume_windows_sound_playback(); #endif }
PlayMaze() { PrintStatus(); /* Prints the score and everything else */ BlackOut(ALLBLACK); /* Hide the reconstruction of the viewPort */ WaitTOF(),WaitTOF(); /* Wait for the Blackout to finish */ InitializeStarting(); ScrollDisplay(SCROLLDEFINITELY); killallsound(); button=0; joyx=0; joyy=0; /* Initialize Joy Regs */ JoyRead(CTRLR_RESET); while(!(joyx || joyy)) { WaitTOF(); JoyRead(CTRLR_READ); } playsound(SND_BACKGRND,0),playsound(SND_BACKGRND,0); SetAPen(rastport,PATHCOLOR); /* We will be erasing dots */ for(i=0; i<numghosts; i++) energized[i]=0; while(dead>=0 && numdots) { tx=xposn[0]+XOFF; ty=yposn[0]+YOFF; if(tx>=minx-1 && tx<=maxx+1 && ty>=miny-1 && ty<=maxy+1) { lookhere=ReadPixel(rastport,tx+x_dir,ty+y_dir); if(lookhere==DOTCOLOR) { atedot++; WritePixel(rastport,tx+x_dir,ty+y_dir); INCSCORE(10); if(--numdots==advspeed[speedindex]) { speedindex++; if(killsound(SND_BACKGRND)) playsound(SND_BACKGRND,0),playsound(SND_BACKGRND,0); } playsound(SND_DOT,1); } else if(lookhere==ENERGCOLOR) { atedot=1; for(i=-1; i<2; i++) for(c=-1; c<2; c++) /* Erase energizer */ WritePixel(rastport,tx+(x_dir<<1)+c,ty+(y_dir<<1)+i); INCSCORE(50); if(--numdots==advspeed[speedindex]) { speedindex++; if(killsound(SND_BACKGRND)) playsound(SND_BACKGRND,0),playsound(SND_BACKGRND,0); } playsound(SND_DOT,1); Energize(); } } if((!joyx)^(!joyy)) joy_dir =(joyy)?(1+joyy):(2-joyx); if(x_dir || y_dir) dir_code=(y_dir)?(1+y_dir):(2-x_dir); dvx=xposn[0]+XOFF-pdest_v->x; dvy=yposn[0]+YOFF-pdest_v->y; old_dcode = dir_code; if((ABS(dvx)+ABS(dvy))<2 && joy_dir!=dir_code && pdest_v->next[joy_dir]) { dir_code = joy_dir; dvx=0; dvy=0; xposn[0]=pdest_v->x-XOFF; yposn[0]=pdest_v->y-YOFF; at_vertex = TRUE; } else at_vertex=((!dvx && !dvy) || (x_dir==y_dir)); if ((!joyx)^(!joyy)) /* if joy movement */ { if (at_vertex) { if(joyx && pdest_v->next[joy_dir] && !(pdest_v->code[joy_dir]&FORBID)) { pmv=pdest_v; pdest_v=pdest_v->next[joy_dir]; /* Destination vertex */ x_dir=joyx; /* Direction we are now headed */ y_dir=0; } else if(joyy && pdest_v->next[1+joyy] && !(pdest_v->code[1+joyy]&FORBID)) { pmv=pdest_v; pdest_v=pdest_v->next[1+joyy]; x_dir=0; y_dir=joyy; } else if ((!(pdest_v->next[joy_dir]) || (pdest_v->code[joy_dir]&FORBID)) && ((!(pdest_v->next[old_dcode]) || (pdest_v->code[old_dcode]&FORBID)))) /* If(at_vertex && no (allowable) next vertex) dead end;stop */ { x_dir=0; y_dir=0; } else if (x_dir||y_dir) /* Joy in invalid dir on vertex */ { pmv=pdest_v; /* There is a path in current dir - follow it */ pdest_v=pdest_v->next[old_dcode]; dir_code = old_dcode; } } /* End of block for if at a vertex */ else if (joyx && !(joyx+x_dir)) /* Reverses direction on edge */ { x_dir=-x_dir; /* Reverse current direction */ tv=pdest_v; /* Swap pdest_v with last vertex */ pdest_v=pmv; pmv=tv; } else if (joyy && !(joyy+y_dir)) /* Reverses dir along y */ { y_dir=-y_dir; /* Reverse current direction */ tv=pdest_v; /* Swap pdest_v with last vertex */ pdest_v=pmv; pmv=tv; } } /* End of block for if no button but movement on joystick */ else if (at_vertex && (y_dir || x_dir)) /* move but no joymove */ { if(x_dir && (!pdest_v->next[old_dcode] || (pdest_v->code[old_dcode]&FORBID))) x_dir=0;/* Stop @ Dead End */ else if(y_dir && (!pdest_v->next[old_dcode] || (pdest_v->code[old_dcode]&FORBID))) y_dir=0; else { pmv=pdest_v; /* Continue moving to next vertex */ pdest_v=pdest_v->next[old_dcode]; } } if (atedot<2) { xposn[0]+=x_dir; yposn[0]+=y_dir; } else atedot=0; WrapSprite(0,x_dir,y_dir); /* Wrap around routine */ spoff=((xposn[0]+yposn[0])>>1)&3; spoff=(spoff>2) ? (1+3*dir_code) : (spoff+3*dir_code); ChangeSprite(svp,&sprite[0],(short *)(pacmen+spoff)); if ((dead=MoveGhosts())<0) { dead=-1; --lives; /* Kill a PACMAN */ Die(); } else { ScrollDisplay(SCROLLMAYBE); PrintScore(); } if(dead>0) { killallsound(); playsound(SND_MONSTER,1); playsound(SND_MONSTER,1); DeEnergize(dead-1,0); /* Eat a ghost! */ playsound(SND_EYES,0); } JoyRead(CTRLR_READ); } /* End of main control loop */ return 0; } /* End of loop to decrement lives. */
void parsecmd(int argc,char *argv[]) { char *word; Sint4 arg,i,j,speedmul; bool sf,gs=false,norepf=false; FILE *levf; for (arg=1;arg<argc;arg++) { word=argv[arg]; if (word[0]=='/' || word[0]=='-') { if (word[1]=='L' || word[1]=='l' || word[1]=='R' || word[1]=='r' || word[1]=='P' || word[1]=='p' || word[1]=='S' || word[1]=='s' || word[1]=='E' || word[1]=='e' || word[1]=='G' || word[1]=='g' || word[1]=='A' || word[1]=='a' || word[1]=='I' || word[1]=='i') if (word[2]==':') i=3; else i=2; if (word[1]=='L' || word[1]=='l') { j=0; while (word[i]!=0) levfname[j++]=word[i++]; levfname[j]=word[i]; levfflag=true; } if (word[1]=='R' || word[1]=='r') recname(word+i); if (word[1]=='P' || word[1]=='p' || word[1]=='E' || word[1]=='e') { openplay(word+i); if (escape) norepf=true; } if (word[1]=='E' || word[1]=='e') { finish(); if (escape) exit(0); exit(1); } if ((word[1]=='O' || word[1]=='o') && !norepf) { arg=0; continue; } if (word[1]=='S' || word[1]=='s') { speedmul=0; while (word[i]!=0) speedmul=10*speedmul+word[i++]-'0'; ftime=speedmul*2000l; gs=true; } if (word[1]=='I' || word[1]=='i') sscanf(word+i,"%u",&startlev); if (word[1]=='U' || word[1]=='u') unlimlives=true; if (word[1]=='?' || word[1]=='h' || word[1]=='H') { finish(); printf("DIGGER - Copyright (c) 1983 Windmill software\n" "Restored 1998 by AJ Software\n" "http://www.digger.org\n" "Version: "DIGGER_VERSION"\n\n" "Command line syntax:\n" " DIGGER [[/S:]speed] [[/L:]level file] [/C] [/B] [/Q] [/M] " "[/P:playback file]\n" " [/E:playback file] [/R:record file] [/O] [/K[A]] " "[/G[:time]] [/2]\n" " [/A:device,port,irq,dma,rate,length] [/V] [/U] " "[/I:level]\n\n" "/Q = Quiet mode (no sound at all) " "/M = No music\n" "/R = Record graphics to file\n" "/P = Playback and restart program " "/E = Playback and exit program\n" "/O = Loop to beginning of command line\n" "/K = Redefine keyboard\n" "/G = Gauntlet mode\n" "/2 = Two player simultaneous mode\n" "/A = Use alternate sound device\n" "/U = Allow unlimited lives\n" "/I = Start on a level other than 1\n"); exit(1); } if (word[1]=='Q' || word[1]=='q') soundflag=false; if (word[1]=='M' || word[1]=='m') musicflag=false; if (word[1]=='2') diggers=2; if (word[1]=='K' || word[1]=='k') if (word[2]=='A' || word[2]=='a') redefkeyb(true); else redefkeyb(false); if (word[1]=='A' || word[1]=='a') { sscanf(word+i,"%u,%x,%u,%u,%u,%u",&sound_device,&sound_port,&sound_irq, &sound_dma,&sound_rate,&sound_length); killsound(); volume=1; setupsound=s1setupsound; killsound=s1killsound; fillbuffer=s1fillbuffer; initint8=s1initint8; restoreint8=s1restoreint8; soundoff=s1soundoff; setspkrt2=s1setspkrt2; settimer0=s1settimer0; timer0=s1timer0; settimer2=s1settimer2; timer2=s1timer2; soundinitglob(sound_port,sound_irq,sound_dma,sound_length,sound_rate); initsound(); } if (word[1]=='V' || word[1]=='v') synchvid=true; if (word[1]=='G' || word[1]=='g') { gtime=0; while (word[i]!=0) gtime=10*gtime+word[i++]-'0'; if (gtime>3599) gtime=3599; if (gtime==0) gtime=120; gauntlet=true; } } else { i=strlen(word); if (i<1) continue; sf=true; if (!gs) for (j=0;j<i;j++) if (word[j]<'0' || word[j]>'9') { sf=false; break; } if (sf) { speedmul=0; j=0; while (word[j]!=0) speedmul=10*speedmul+word[j++]-'0'; gs=true; ftime=speedmul*2000l; } else { j=0; while (word[j]!=0) { levfname[j]=word[j]; j++; } levfname[j]=word[j]; levfflag=true; } } } if (levfflag) { levf=fopen(levfname,"rb"); if (levf==NULL) { strcat(levfname,".DLF"); levf=fopen(levfname,"rb"); } if (levf==NULL) levfflag=false; else { fread(&bonusscore,2,1,levf); fread(leveldat,1200,1,levf); fclose(levf); } } }