|
|
|
@ -360,9 +360,9 @@ player_drop_bomb (int pl_nr)
|
|
|
|
|
_y;
|
|
|
|
|
_point bombs[MAX_PLAYERS * MAX_BOMBS];
|
|
|
|
|
|
|
|
|
|
for (i = 0; ((i < player->bombs_n) && (player->bombs[i].state != BS_off)); i++);
|
|
|
|
|
i = player_findfreebomb (player);
|
|
|
|
|
|
|
|
|
|
if (i < player->bombs_n && PS_IS_alife (player->state)) { // free bomb found
|
|
|
|
|
if (i >= 0 && i < MAX_BOMBS && PS_IS_alife (player->state)) { // free bomb found
|
|
|
|
|
// get the best position for the bomb.
|
|
|
|
|
bomb = &player->bombs[i];
|
|
|
|
|
bomb->pos.x = player->pos.x >> 8;
|
|
|
|
@ -753,3 +753,23 @@ player_set_gfx (_player * p, signed char gfx_nr)
|
|
|
|
|
p->state |= PSF_playing;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* find a free bomb */
|
|
|
|
|
int player_findfreebomb (_player *player) {
|
|
|
|
|
int i, bombused = 0, res = -1;
|
|
|
|
|
|
|
|
|
|
/* check every free bomb from next entry of the last
|
|
|
|
|
exploded bomb to the last exploded bomb */
|
|
|
|
|
|
|
|
|
|
for (i = player->bomb_lastex + 1; (bombused < player->bombs_n && i != player->bomb_lastex && res == -1); i++) {
|
|
|
|
|
if (i < 0 || i > MAX_BOMBS) // i out of range .. restart at bomb 0
|
|
|
|
|
i = 0;
|
|
|
|
|
if (player->bombs[i].state == BS_off)
|
|
|
|
|
res = i;
|
|
|
|
|
else
|
|
|
|
|
bombused++; // count number of used bombs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
};
|
|
|
|
|