예제 #1
0
파일: main.c 프로젝트: edu-bob/pacman
newgame()
{
	if (Newgame <= 0) {
		instruct();
		Game = 0;
	/*	while(Getc()!=-1) ; /* flush keyboard queue */
		while (Game==0 && Running) kbpoll();
	} else
		Game = Newgame;
	if ( !Running )
		return;
	black();

	switch ( Game ) {
	case 1:
		Seekprob = 40;
		Seekinc = 10;
		Monbase = 40;
		Pacman.time = 43;
		break;
	case 2:
		Seekprob = 80;
		Seekinc = 2;
		Monbase = 30;
		Pacman.time = 35;
		break;
	case 3:
		Seekprob = 100;
		Seekinc = 0;
		Monbase = MINMONTIME;
		Pacman.time = MINPACTIME;
		break;
	case 4:
		Seekprob = 90;
		Seekinc = 0;
		Monbase = 0;
		Pacman.time = 0;
	}
	Newgame = 0;
	Pacman.alive = TRUE;
	Wave = 0;
	Score = 0;
	Nextbonus = SCOREMOD;
	settextop(REPLACE);
	mvprintf(SCOREROW,1,"S C O R E : ");
	addscore(0);
	addscore(FLUSHSCORE);
#ifdef HIGHSCORE
	if ( Highscore[Game-1] != NOSCORE )
		mvprintf(SCOREROW,HIGHCOL,"H I G H   S C O R E : %D",(long)Highscore[Game-1]);
#endif
	Pacmen = 1;
	mvprintf(WAVEROW,WAVECOL,"W A V E : ");
	addmen(PACMEN-1);
	pacnew();
	monnew();
}
예제 #2
0
void emy_bomb::Isdead(){
	if (hp < 0.1){

		Sound::playback("bomb01");
		for (int j = 0; j < 6; j++){
			manager::get().effect_.add<dotsplash>(x, y);
			auto efp = manager::get().effect_.add<enemybombef>(x, y);
			double dx, dy;
			Func::polartoxy(dx, dy, Random::FRand(7.0, 15.0), 2 * PI * j / 6 + Random::FRand(0.0, 0.5));
			efp->vx = dx;
			efp->vy = dy;
		}
		manager::get().damagearea_.addptr(std::make_shared<dm_circle>(x, y, 100, 10, 0.0));

		SetDrawScreen(Screen::get().blood);
		for (int i = 0; i < 5; i++){
			double dx, dy;
			Random::RandInCircle(32, dx, dy);
			Draw_::exrot(x + dx, y + dy, Random::FRand(0.5, 1.5), Random::FRadRand(), Graph::handle("blood01"), 255);
		}
		SetDrawScreen(DX_SCREEN_BACK);
		deadlog();
		addscore();
		deleteflag = true;
	}
}
예제 #3
0
// Checks each row to see if any are full and need clearing, will add points and rebuild screen (move blocks down) if any are
int checkForFullRows(){
    int fullRow = 1;
	int anyCleared = 0;
    int i, j, a, b;
    //For bucket height
    for(i = 0; i < bucket.height - 1; i++){
        //For bucket width
        for(j = 0; j < bucket.width; j++){
            //If any character in this row is empty, the line can't be full
            if(bucket.bucket[i][j] == ' '){
                fullRow = 0;
            }
        }
        //If all cells in line have been considered and line is full
        if(fullRow == 1){
					anyCleared = 1;
            //Update score
            //For every line above this
            for(a = i; a > 0; a--){
                for(b = 0; b < bucket.width; b++){
                    //Move the blocks down by one
                    bucket.bucket[a][b] = bucket.bucket[a - 1][b];
                }
            }
						addscore();
        }
        
        //Reset check to 1 in preparation for checking next line
        fullRow = 1;
    }
		
		return anyCleared;
}
예제 #4
0
void emy_devide::Isdead(){
	if (hp < 0.1){
		for (int i = 0; i < 30; i++){
			manager::get().effect_.add<floting_dot>(x, y);
		}

		for (int i = 0; i < 16; i++){
			double dx, dy;
			Func::polartoxy(dx, dy, 50, 2 * PI * i / 16);
			manager::get().enemy_.addfromenemy<emy_normal>(x + dx, y + dy);
		}
		deadlog();
		addscore();
		deleteflag = true;
	}
}
예제 #5
0
main(int argn, char **argv)
{
	int sum, n;
	float avg;
	char board[100], fname[100], buf[100], path[300], *ptr;
	while (NULL != fgets(buf, sizeof (buf), stdin)) {
		if (sscanf(buf, "%d%f%d%s%s", &sum, &avg, &n, board, fname) !=
		    5) continue;
		sprintf(path, MY_BBS_HOME "/boards/%s/%s", board, fname);
		ptr = searchauthor(path);
		if (ptr == NULL)
			continue;
		addscore(ptr, sum, n);
	}
	printscore();
}
예제 #6
0
파일: score.c 프로젝트: anzerr/PiscineC
void initscore(t_minefield *game)
{
  int x;
  int y;
  x = 0;
  while (x < game->height)
    {
      y = 0;
      while (y < game->width)
	{
	  if (game->grid[x][y] == -1)
	    addscore(game, x, y);
	  y = y + 1;
	}
      x = x + 1;
    }
}
예제 #7
0
int main()
{
    initncurses();
    game.brdwin = newwin(BRD_HEIGHT+PAD, BRD_WIDTH+PAD, BRD_TOP, BRD_LEFT);
    game.holdwin = newwin(HOLD_HEIGHT+PAD, HOLD_WIDTH+PAD, BRD_TOP, BRD_LEFT+BRD_WIDTH+2);
    game.sidewin = newwin(SIDE_HEIGHT+PAD, SIDE_WIDTH+PAD, BRD_TOP+HOLD_HEIGHT+2, BRD_LEFT+BRD_WIDTH+3);
    game.brdpan = new_panel(game.brdwin);
    game.holdpan = new_panel(game.holdwin);
    game.sidepan = new_panel(game.sidewin);
    newgame();

    int diff;
    struct timeval prev, now;
    gettimeofday(&prev, NULL);

    // game loop
    while (route(getch())) {

        // get time difference in milliseconds; move piece down if 'diff' is large enough
        gettimeofday(&now, NULL);
        diff = ((now.tv_sec-prev.tv_sec)*1000)+((now.tv_usec-prev.tv_usec)/1000);
        if (diff >= game.msecstep && (!game.ended && !game.paused)) {
            mvpcdown();
            gettimeofday(&prev, NULL);
        }

        // draw end screen if the game's over, otherwise draw our board (unless paused)
        if ((game.ended = istopped())) {
            drawend();
        } else 
        if (!game.paused) {
            addscore(clrcols());
            drawbrd(game.brdwin, game.holdwin);
            drawside();
        }

        // reflect changes in our panels onscreen
        update_panels();
        doupdate();

    } 

    return 0;
}
예제 #8
0
void endofgame(void)
{
  Sint4 i;
  bool initflag=FALSE;
  for (i=0;i<diggers;i++)
    addscore(i,0);
  if (playing || !drfvalid)
    return;
  if (gauntlet) {
    cleartopline();
    outtext("TIME UP",120,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("       ",120,0,3);
  }
  for (i=curplayer;i<curplayer+diggers;i++) {
    scoret=scdat[i].score;
    if (scoret>scorehigh[11]) {
      gclear();
      drawscores();
      strcpy(pldispbuf,"PLAYER ");
      if (i==0)
        strcat(pldispbuf,"1");
      else
        strcat(pldispbuf,"2");
      outtext(pldispbuf,108,0,2);
      outtext(" NEW HIGH SCORE ",64,40,2);
      getinitials();
      shufflehigh();
      savescores();
      initflag=TRUE;
    }
  }
  if (!initflag && !gauntlet) {
    cleartopline();
    outtext("GAME OVER",104,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("         ",104,0,3);
    setretr(TRUE);
  }
}
예제 #9
0
파일: main.c 프로젝트: edu-bob/pacman
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);
}
예제 #10
0
void Ienemy::Isdead(){
	if (hp < 0.1){
		for (int i = 0; i < 10; i++){
			manager::get().effect_.add<enemy_bloodsplash>(x, y);
		}
		SetDrawScreen(Screen::get().blood);
		for (int i = 0; i < 5; i++){
			double dx, dy;
			Random::RandInCircle(32, dx, dy);
			Draw_::exrot(x + dx, y + dy, Random::FRand(0.5, 1.5), Random::FRadRand(), Graph::handle("blood01"), 255);
		}
		SetDrawScreen(DX_SCREEN_BACK);

		Sound::playback("enemydead");
		deadlog();
		addscore();
		deleteflag = true;
	}
	if (x < -300){
		deleteflag = true;
	}
}
예제 #11
0
파일: main.c 프로젝트: LibreGames/digger
void testpause(void)
{
  int i;
  if (pausef) {
    soundpause();
    sett2val(40);
    setsoundt2();
    cleartopline();
    outtext(ddap, "PRESS ANY KEY",80,0,1);
    getkey(true);
    cleartopline();
    drawscores(ddap);
    for (i=0;i<diggers;i++)
      addscore(ddap, i,0);
    drawlives(ddap);
    if (!synchvid)
      curtime=gethrt();
    pausef=false;
  }
  else
    soundpauseoff();
}
예제 #12
0
void initscores(void)
{
  int i;
  for (i=0;i<diggers;i++)
    addscore(i,0);
}
예제 #13
0
void scoreeatm(int n,int msc)
{
  addscore(n,msc*200);
}
예제 #14
0
void scorebonus(int n)
{
  addscore(n,1000);
}
예제 #15
0
void scoregold(int n)
{
  addscore(n,500);
}
예제 #16
0
void scoreoctave(int n)
{
  addscore(n,250);
}
예제 #17
0
void scoreemerald(int n)
{
  addscore(n,25);
}
예제 #18
0
void scorekill2(void)
{
  addscore(0,125);
  addscore(1,125);
}
예제 #19
0
void scorekill(int n)
{
  addscore(n,250);
}
예제 #20
0
파일: main.c 프로젝트: LibreGames/digger
void game(void)
{
  int16_t t,c,i;
  bool flashplayer=false;
  if (gauntlet) {
    cgtime=gtime*1193181l;
    timeout=false;
  }
  initlives();
  gamedat[0].level=startlev;
  if (nplayers==2)
    gamedat[1].level=startlev;
  alldead=false;
  ddap->gclear();
  curplayer=0;
  initlevel();
  curplayer=1;
  initlevel();
  zeroscores();
  bonusvisible=true;
  if (nplayers==2)
    flashplayer=true;
  curplayer=0;
  while (getalllives()!=0 && !escape && !timeout) {
    while (!alldead && !escape && !timeout) {
      initmbspr();

      if (playing)
        randv=playgetrand();
      else
        randv=getlrt();
#ifdef INTDRF
      fprintf(info,"%lu\n",randv);
      frame=0;
#endif
      recputrand(randv);
      if (levnotdrawn) {
        levnotdrawn=false;
        drawscreen(ddap);
        if (flashplayer) {
          flashplayer=false;
          strcpy(pldispbuf,"PLAYER ");
          if (curplayer==0)
            strcat(pldispbuf,"1");
          else
            strcat(pldispbuf,"2");
          cleartopline();
          for (t=0;t<15;t++)
            for (c=1;c<=3;c++) {
              outtext(ddap, pldispbuf,108,0,c);
              writecurscore(ddap, c);
              newframe();
              if (escape)
                return;
            }
          drawscores(ddap);
          for (i=0;i<diggers;i++)
            addscore(ddap, i,0);
        }
      }
      else
        initchars();
      outtext(ddap, "        ",108,0,3);
      initscores(ddap);
      drawlives(ddap);
      music(1);

      flushkeybuf();
      for (i=0;i<diggers;i++)
        readdirect(i);
      while (!alldead && !gamedat[curplayer].levdone && !escape && !timeout) {
        penalty=0;
        dodigger(ddap);
        domonsters(ddap);
        dobags(ddap);
        if (penalty>8)
          incmont(penalty-8);
        testpause();
        checklevdone();
      }
      erasediggers();
      musicoff();
      t=20;
      while ((getnmovingbags()!=0 || t!=0) && !escape && !timeout) {
        if (t!=0)
          t--;
        penalty=0;
        dobags(ddap);
        dodigger(ddap);
        domonsters(ddap);
        if (penalty<8)
          t=0;
      }
      soundstop();
      for (i=0;i<diggers;i++)
        killfire(i);
      erasebonus(ddap);
      cleanupbags();
      savefield();
      erasemonsters();
      recputeol();
      if (playing)
        playskipeol();
      if (escape)
        recputeog();
      if (gamedat[curplayer].levdone)
        soundlevdone();
      if (countem()==0 || gamedat[curplayer].levdone) {
#ifdef INTDRF
        fprintf(info,"%i\n",frame);
#endif
        for (i=curplayer;i<diggers+curplayer;i++)
          if (getlives(i)>0 && !digalive(i))
            declife(i);
        drawlives(ddap);
        gamedat[curplayer].level++;
        if (gamedat[curplayer].level>1000)
          gamedat[curplayer].level=1000;
        initlevel();
      }
      else
        if (alldead) {
#ifdef INTDRF
          fprintf(info,"%i\n",frame);
#endif
          for (i=curplayer;i<curplayer+diggers;i++)
            if (getlives(i)>0)
              declife(i);
          drawlives(ddap);
        }
      if ((alldead && getalllives()==0 && !gauntlet && !escape) || timeout)
        endofgame(ddap);
    }
    alldead=false;
    if (nplayers==2 && getlives(1-curplayer)!=0) {
      curplayer=1-curplayer;
      flashplayer=levnotdrawn=true;
    }
  }
#ifdef INTDRF
  fprintf(info,"-1\n%lu\n%i",getscore0(),gamedat[0].level);
#endif
}