Example #1
0
/*
 * Reset interface.
 */
void
elreset(struct el_softc *sc)
{
	int s;

	DPRINTF(("elreset()\n"));
	s = splnet();
	elstop(sc);
	elinit(sc);
	splx(s);
}
Example #2
0
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);
}
Example #3
0
/*
 * Process an ioctl request. This code needs some work - it looks pretty ugly.
 */
int
elioctl(struct ifnet *ifp, u_long cmd, void *data)
{
	struct el_softc *sc = ifp->if_softc;
	struct ifaddr *ifa = (struct ifaddr *)data;
	int s, error = 0;

	s = splnet();

	switch (cmd) {

	case SIOCINITIFADDR:
		ifp->if_flags |= IFF_UP;

		elinit(sc);
		switch (ifa->ifa_addr->sa_family) {
#ifdef INET
		case AF_INET:
			arp_ifinit(ifp, ifa);
			break;
#endif
		default:
			break;
		}
		break;

	case SIOCSIFFLAGS:
		if ((error = ifioctl_common(ifp, cmd, data)) != 0)
			break;
		/* XXX re-use ether_ioctl() */
		switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
		case IFF_RUNNING:
			/*
			 * If interface is marked down and it is running, then
			 * stop it.
			 */
			elstop(sc);
			ifp->if_flags &= ~IFF_RUNNING;
			break;
		case IFF_UP:
			/*
			 * If interface is marked up and it is stopped, then
			 * start it.
			 */
			elinit(sc);
			break;
		default:
			/*
			 * Some other important flag might have changed, so
			 * reset.
			 */
			elreset(sc);
			break;
		}
		break;

	default:
		error = ether_ioctl(ifp, cmd, data);
		break;
	}

	splx(s);
	return error;
}
Example #4
0
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();
}