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(); }
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)); } }