void _start(int argc, char *argv[], char *envp[]) { char *namep; environ = envp; NXArgc = argc; NXArgv = argv; if ((namep = argv[0]) != NULL) { if ((__progname = _strrchr(namep, '/')) == NULL) __progname = namep; else __progname++; } /* * Initialise hooks inside libc */ if (mach_init_routine) (*mach_init_routine)(); if (_cthread_init_routine) (*_cthread_init_routine)(); #ifdef PROFILE atexit(_mcleanup); moninit(); #endif atexit(_fini); _init(); exit(main(argc, argv, environ)); }
newwave() { register monster *mptr; addscore(FLUSHSCORE); Wave++; mvprintf(WAVEROW,WAVECOL+10,"%D",Wave); if ( Wave&1 ) { for ( mptr=Monster ; mptr < &Monster[MAXMONSTER] ; mptr++ ) if ( mptr->time > MINMONTIME ) mptr->time = max(mptr->time-MONDELTA,MINMONTIME); if ( Pacman.time > MINPACTIME ) Pacman.time = max(Pacman.time-PACDELTA,MINPACTIME); } newboard(); drawboard(); Dotsrem = DOTS; Seekprob += Seekinc; elinit(); pacinit(); moninit(); fruitinit(TRUE); }
main() { int i; #ifdef BILL BillMode = 1; #endif terminit(); for(i=0;i<MAXGAMES;i++) { Highscore[i] = 0; MaxWave[i] = 0; } Lastscore = -1; #ifdef HOSTCODE getscores(); #endif VolumeControl = 8; Abort = FALSE; Silent = FALSE; Running = TRUE; Paused = FALSE; Newgame = 0; /* * For each game played... */ while ( Running ) { /* * For each new wave... */ newgame(); while ( Pacmen > 0 && Running ) { newwave(); /* * For each game scan... */ while ( Dotsrem > 0 ) { /* * If the Pacman died, start a new one. */ if ( !Pacman.alive ) { addmen(-1); if ( Pacmen <= 0 ) break; elinit(); if ( Wallsoff ) { compwalls(); Wallsoff = FALSE; } pacinit(); moninit(); fruitinit(FALSE); } do { kbpoll(); } while ( Paused && Newgame==0); if ( Abort || Newgame ) break; elpoll(); } soundoff(); if ( Abort || Newgame ) break; paccomp(); moncomp(); fruitcomp(); soundoff(); } if (Game != 0) { #ifdef HOSTCODE sndhost ("%s%s%d\n%s%D %D\n", SYNCSTRING, GAMESTRING, Game, SCORESTRING, (long)Score, (long)KEY); #endif Lastscore = Score; if ( Score > Highscore[Game-1] ) { Highscore[Game-1] = Score; MaxWave[Game-1] = Wave; } } if ( Abort ) break; } #ifdef HOSTCODE sndhost ("%s", EXITSTRING); #endif termwrapup(); }