void erasediggers(void) { int i; for (i=0;i<diggers;i++) erasespr(FIRSTDIGGER+i); digvisible=false; }
void erasemonsters(void) { Sint4 i; for (i=0;i<MONSTERS;i++) if (mondat[i].flag) erasespr(i+FIRSTMONSTER); }
void erasebonus(void) { if (bonusvisible) { bonusvisible=FALSE; erasespr(FIRSTBONUS); } ginten(0); }
void killfire(int n) { if (!digdat[n].notfiring) { digdat[n].notfiring=TRUE; erasespr(FIRSTFIREBALL+n-curplayer); soundfireoff(n); } }
void killmon(Sint4 mon) { if (mondat[mon].flag) { mondat[mon].flag=mondat[mon].alive=false; erasespr(mon+FIRSTMONSTER); if (bonusmode) totalmonsters++; } }
void erasebonus(struct digger_draw_api *ddap) { if (bonusvisible) { bonusvisible=false; erasespr(FIRSTBONUS); } ddap->ginten(0); }
void drawdig(int n) { CALL_METHOD(&digdat[n].dob, animate); if (digdat[n].invin) { digdat[n].ivt--; if (digdat[n].ivt==0) digdat[n].invin=false; else if (digdat[n].ivt%10<5) erasespr(FIRSTDIGGER+n-curplayer); } }
void drawdig(int n,int d,int x,int y,bool f) { drawdigger(n-curplayer,d,x,y,f); if (digdat[n].invin) { digdat[n].ivt--; if (digdat[n].ivt==0) digdat[n].invin=FALSE; else if (digdat[n].ivt%10<5) erasespr(FIRSTDIGGER+n-curplayer); } }
static int monster_obj_kill(struct monster_obj *self) { struct monster_obj_private *mop; mop = self->priv; if (!mop->alive) { /* No, you can't kill me twice */ assert(mop->zombie); } mop->alive = false; mop->zombie = false; erasespr(FIRSTMONSTER + mop->m_id); return (0); }
void cleanupbags(void) { Sint4 bag; soundfalloff(); for (bag=0;bag<BAGS;bag++) { if (bagdat[bag].exist && ((bagdat[bag].h==7 && bagdat[bag].v==9) || bagdat[bag].xr!=0 || bagdat[bag].yr!=0 || bagdat[bag].gt!=0 || bagdat[bag].fallh!=0 || bagdat[bag].wobbling)) { bagdat[bag].exist=FALSE; erasespr(bag+FIRSTBAG); } if (curplayer==0) memcpy(&bagdat1[bag],&bagdat[bag],sizeof(struct bag)); else memcpy(&bagdat2[bag],&bagdat[bag],sizeof(struct bag)); } }
static void diggerdie(struct digger_draw_api *ddap, int n) { int clfirst[TYPES],clcoll[SPRITES],i; bool alldead; switch (digdat[n].deathstage) { case 1: if (bagy(digdat[n].deathbag)+6>digdat[n].dob.y) digdat[n].dob.y=bagy(digdat[n].deathbag)+6; drawdigger(n-curplayer,15,digdat[n].dob.x,digdat[n].dob.y,false); incpenalty(); if (getbagdir(digdat[n].deathbag)+1==0) { soundddie(); digdat[n].deathtime=5; digdat[n].deathstage=2; digdat[n].deathani=0; digdat[n].dob.y-=6; } break; case 2: if (digdat[n].deathtime!=0) { digdat[n].deathtime--; break; } if (digdat[n].deathani==0) music(2); drawdigger(n-curplayer,14-digdat[n].deathani,digdat[n].dob.x,digdat[n].dob.y, false); for (i=0;i<TYPES;i++) clfirst[i]=first[i]; for (i=0;i<SPRITES;i++) clcoll[i]=coll[i]; incpenalty(); if (digdat[n].deathani==0 && clfirst[2]!=-1) killmonsters(clfirst,clcoll); if (digdat[n].deathani<4) { digdat[n].deathani++; digdat[n].deathtime=2; } else { digdat[n].deathstage=4; if (musicflag || diggers>1) digdat[n].deathtime=60; else digdat[n].deathtime=10; } break; case 3: digdat[n].deathstage=5; digdat[n].deathani=0; digdat[n].deathtime=0; break; case 5: if (digdat[n].deathani>=0 && digdat[n].deathani<=6) { drawdigger(n-curplayer,15,digdat[n].dob.x, digdat[n].dob.y-deatharc[digdat[n].deathani],false); if (digdat[n].deathani==6 && !isalive()) musicoff(); incpenalty(); digdat[n].deathani++; if (digdat[n].deathani==1) soundddie(); if (digdat[n].deathani==7) { digdat[n].deathtime=5; digdat[n].deathani=0; digdat[n].deathstage=2; } } break; case 4: if (digdat[n].deathtime!=0) digdat[n].deathtime--; else { digdat[n].dead=true; alldead=true; for (i=0;i<diggers;i++) if (!digdat[i].dead) { alldead=false; break; } if (alldead) setdead(true); else if (isalive() && digdat[n].lives>0) { if (!gauntlet) digdat[n].lives--; drawlives(ddap); if (digdat[n].lives>0) { digdat[n].v=9; digdat[n].mdir=4; digdat[n].h=(diggers==1) ? 7 : (8-n*2); digdat[n].dob.x=digdat[n].h*20+12; digdat[n].dob.dir=(n==0) ? DIR_RIGHT : DIR_LEFT; digdat[n].rx=0; digdat[n].ry=0; digdat[n].bagtime=0; digdat[n].dob.alive=true; digdat[n].dead=false; digdat[n].invin=true; digdat[n].ivt=50; digdat[n].deathstage=1; digdat[n].dob.y=digdat[n].v*18+18; erasespr(n+FIRSTDIGGER-curplayer); CALL_METHOD(&digdat[n].dob, put); digdat[n].notfiring=true; digdat[n].emocttime=0; digdat[n].firepressed=false; digdat[n].bob.expsn=0; digdat[n].rechargetime=0; digdat[n].emn=0; digdat[n].msc=1; } clearfire(n); if (bonusmode) music(0); else music(1); } } } }