コード例 #1
0
ファイル: bags.cpp プロジェクト: PavelGavlik/Digger
void dobags(void)
{
    int16_t bag;
    bool soundfalloffflag = true, soundwobbleoffflag = true;
    for (bag = 0; bag < BAGS; bag++)
        if (bagdat[bag].exist)
        {
            if (bagdat[bag].gt != 0)
            {
                if (bagdat[bag].gt == 1)
                {
                    soundbreak();
                    drawgold(bag, 4, bagdat[bag].x, bagdat[bag].y);
                    incpenalty();
                }
                if (bagdat[bag].gt == 3)
                {
                    drawgold(bag, 5, bagdat[bag].x, bagdat[bag].y);
                    incpenalty();
                }
                if (bagdat[bag].gt == 5)
                {
                    drawgold(bag, 6, bagdat[bag].x, bagdat[bag].y);
                    incpenalty();
                }
                bagdat[bag].gt++;
                if (bagdat[bag].gt == goldtime)
                    removebag(bag);
                else if (bagdat[bag].v < MHEIGHT - 1 &&
                         bagdat[bag].gt < goldtime - 10)
                    if ((getfield(bagdat[bag].h, bagdat[bag].v + 1) & 0x2000) ==
                            0)
                        bagdat[bag].gt = goldtime - 10;
            }
            else
                updatebag(bag);
        }
    for (bag = 0; bag < BAGS; bag++)
    {
        if (bagdat[bag].dir == DIR_DOWN && bagdat[bag].exist)
            soundfalloffflag = false;
        if (bagdat[bag].dir != DIR_DOWN && bagdat[bag].wobbling &&
                bagdat[bag].exist)
            soundwobbleoffflag = false;
    }
    if (soundfalloffflag)
        soundfalloff();
    if (soundwobbleoffflag)
        soundwobbleoff();
}
コード例 #2
0
ファイル: main.c プロジェクト: LibreGames/digger
int mainprog(void)
{
  int16_t frame,t;
  struct monster_obj *nobbin, *hobbin;
  struct digger_obj odigger;
  struct obj_position newpos;
  loadscores();
  escape=false;
  nobbin = NULL;
  hobbin = NULL;
  do {
    soundstop();
    creatembspr();
    detectjoy();
    ddap->gclear();
    ddap->gtitle();
    outtext(ddap, "D I G G E R",100,0,3);
    shownplayers();
    showtable(ddap);
    started=false;
    frame=0;
    newframe();
    teststart();
    while (!started) {
      started=teststart();
      if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') &&
          !gauntlet && diggers==1) {
        switchnplayers();
        shownplayers();
        akeypressed=0;
      }
      if (frame==0)
        for (t=54;t<174;t+=12)
          outtext(ddap, "            ",164,t,0);
      if (frame==50) {
        if (nobbin != NULL) {
          CALL_METHOD(nobbin, dtor);
        }
        nobbin = monster_obj_ctor(0, MON_NOBBIN, DIR_LEFT, 292, 63);
        CALL_METHOD(nobbin, put);
      }
      if (frame>50 && frame<=77) {
        CALL_METHOD(nobbin, getpos, &newpos);
        newpos.x -= 4;
        if (frame == 77) {
          newpos.dir = DIR_RIGHT;
        }
        CALL_METHOD(nobbin, setpos, &newpos);
      }
      if (frame > 50) {
        CALL_METHOD(nobbin, animate);
      }

      if (frame==83)
        outtext(ddap, "NOBBIN",216,64,2);
      if (frame==90) {
        if (hobbin != NULL) {
          CALL_METHOD(hobbin, dtor);
        }
        hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82);
        CALL_METHOD(hobbin, put);
      }
      if (frame>90 && frame<=117) {
        CALL_METHOD(hobbin, getpos, &newpos);
        newpos.x -= 4;
        if (frame == 117) { 
          newpos.dir = DIR_RIGHT;
        }
        CALL_METHOD(hobbin, setpos, &newpos);
      }
      if (frame == 100) {
        CALL_METHOD(hobbin, mutate);
      }
      if (frame > 90) {
        CALL_METHOD(hobbin, animate);
      }
      if (frame==123)
        outtext(ddap, "HOBBIN",216,83,2);
      if (frame==130) {
        digger_obj_init(&odigger, 0, DIR_LEFT, 292, 101);
        CALL_METHOD(&odigger, put);
      }
      if (frame>130 && frame<=157) {
        odigger.x -= 4;
      }
      if (frame>157) {
        odigger.dir = DIR_RIGHT;
      }
      if (frame >= 130) {
        CALL_METHOD(&odigger, animate);
      }
      if (frame==163)
        outtext(ddap, "DIGGER",216,102,2);
      if (frame==178) {
        movedrawspr(FIRSTBAG,184,120);
        drawgold(0,0,184,120);
      }
      if (frame==183)
        outtext(ddap, "GOLD",216,121,2);
      if (frame==198)
        drawemerald(184,141);
      if (frame==203)
        outtext(ddap, "EMERALD",216,140,2);
      if (frame==218)
        drawbonus(184,158);
      if (frame==223)
        outtext(ddap, "BONUS",216,159,2);
      if (frame == 235) {
          CALL_METHOD(nobbin, damage);
      }
      if (frame == 239) {
          CALL_METHOD(nobbin, kill);
      }
      if (frame == 242) {
          CALL_METHOD(hobbin, damage);
      }
      if (frame == 246) {
          CALL_METHOD(hobbin, kill);
      }
      newframe();
      frame++;
      if (frame>250)
        frame=0;
    }
    if (savedrf) {
      if (gotgame) {
        recsavedrf();
        gotgame=false;
      }
      savedrf=false;
      continue;
    }
    if (escape)
      break;
    recinit();
    game();
    gotgame=true;
    if (gotname) {
      recsavedrf();
      gotgame=false;
    }
    savedrf=false;
    escape=false;
  } while (!escape);
  finish();
  return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: glcoder/digger
int mainprog(void)
{
  Sint4 frame,t,x;
  loadscores();
  escape=false;
  do {
    soundstop();
    creatembspr();
    detectjoy();
    gclear();
    gtitle();
    outtext("D I G G E R",100,0,3);
    shownplayers();
    showtable();
    started=false;
    frame=0;
    newframe();
    teststart();
    while (!started) {
      started=teststart();
      if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') &&
          !gauntlet && diggers==1) {
        switchnplayers();
        shownplayers();
        akeypressed=0;
      }
      if (frame==0)
        for (t=54;t<174;t+=12)
          outtext("            ",164,t,0);
      if (frame==50) {
        movedrawspr(FIRSTMONSTER,292,63);
        x=292;
      }
      if (frame>50 && frame<=77) {
        x-=4;
        drawmon(0,1,DIR_LEFT,x,63);
      }
      if (frame>77)
        drawmon(0,1,DIR_RIGHT,184,63);
      if (frame==83)
        outtext("NOBBIN",216,64,2);
      if (frame==90) {
        movedrawspr(FIRSTMONSTER+1,292,82);
        drawmon(1,0,DIR_LEFT,292,82);
        x=292;
      }
      if (frame>90 && frame<=117) {
        x-=4;
        drawmon(1,0,DIR_LEFT,x,82);
      }
      if (frame>117)
        drawmon(1,0,DIR_RIGHT,184,82);
      if (frame==123)
        outtext("HOBBIN",216,83,2);
      if (frame==130) {
        movedrawspr(FIRSTDIGGER,292,101);
        drawdigger(0,DIR_LEFT,292,101,1);
        x=292;
      }
      if (frame>130 && frame<=157) {
        x-=4;
        drawdigger(0,DIR_LEFT,x,101,1);
      }
      if (frame>157)
        drawdigger(0,DIR_RIGHT,184,101,1);
      if (frame==163)
        outtext("DIGGER",216,102,2);
      if (frame==178) {
        movedrawspr(FIRSTBAG,184,120);
        drawgold(0,0,184,120);
      }
      if (frame==183)
        outtext("GOLD",216,121,2);
      if (frame==198)
        drawemerald(184,141);
      if (frame==203)
        outtext("EMERALD",216,140,2);
      if (frame==218)
        drawbonus(184,158);
      if (frame==223)
        outtext("BONUS",216,159,2);
      newframe();
      frame++;
      if (frame>250)
        frame=0;
    }
    if (savedrf) {
      if (gotgame) {
        recsavedrf();
        gotgame=false;
      }
      savedrf=false;
      continue;
    }
    if (escape)
      break;
    recinit();
    game();
    gotgame=true;
    if (gotname) {
      recsavedrf();
      gotgame=false;
    }
    savedrf=false;
    escape=false;
  } while (!escape);
  finish();
  return 0;
}