예제 #1
0
파일: FACE.CPP 프로젝트: sigt44/ravage-sdl
//-------------------------------------------------------------------
// Play one frame of the DEMO GAME.
void demo(void)
{
   int  dx, dy, fire;

   newwave();
   enemystep();
	s_update();
   player[nowplayer].control(dx, dy, fire);
   weaponstep(nowplayer, dx * SHIPSPEED, dy * SHIPSPEED, fire);
   crash(nowplayer);
   if (gstate.frame < layerlength(1)) {
      gstate.frame++;
      movelayer(0, gstate.frame & 1);
      movelayer(1, 1);
   } else {
      movelayer(0, 0); movelayer(1, 0);
   }

	//Draw game to demo texture
	render.setTarget(&demoTexture);

   process_objects();
   drawscreen();
   postprocess_objects();

	render.setTarget(NULL);
}
예제 #2
0
파일: main.c 프로젝트: edu-bob/pacman
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();
}