Moving Bombs are now finished they should work.. added cleaning of bfield and setting the bfield at the first line in bomb_move and at the end of the function.

origin
stpohle 22 years ago
parent 624dc92039
commit 91c36ee6d5

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.45 2003/09/04 21:40:27 stpohle Exp $ */
/* $Id: bomb.c,v 1.46 2003/09/09 14:12:59 stpohle Exp $ */
/* everything what have to do with the bombs */
#include "bomberclone.h"
@ -82,6 +82,9 @@ bomb_move (_bomb * bomb)
int step = 0, dist = 0, keepdir = 0;
_point fpos, rpos;
map.bfield[bomb->pos.x>>8][bomb->pos.y>>8] = 0; /* delete bfield */
stonelist_add (bomb->pos.x>>8, bomb->pos.y>>8);
/* do this once, and again if the direction is still ok */
do {
/* get the current position of the bomb */
@ -128,19 +131,14 @@ bomb_move (_bomb * bomb)
d.x = b.x + bomb->dest.x;
d.y = b.y + bomb->dest.y;
if (map.bfield[d.x][d.y] == 0 && (map.field[d.x][d.y].type == FT_nothing || map.field[d.x][d.y].type == FT_tunnel)) {
if (map.bfield[d.x][d.y] == 0 && (map.field[d.x][d.y].type == FT_nothing || map.field[d.x][d.y].type == FT_tunnel))
/* this direction is still oky */
map.bfield[d.x][d.y] = 1;
map.bfield[b.x][b.y] = 0;
keepdir = 1;
}
else if (bomb->mode == BM_liquid) {
/* liquid bomb so move to the other side */
keepdir = 0;
bomb->dest.x = -bomb->dest.x;
bomb->dest.y = -bomb->dest.y;
map.bfield[b.x+bomb->dest.x][b.y+bomb->dest.y] = 1;
map.bfield[b.x][b.y] = 0;
}
else {
/* stop moving this bomb */
@ -166,6 +164,9 @@ bomb_move (_bomb * bomb)
}
dist += step;
} while (dist < bomb->speed && (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir);
map.bfield[bomb->pos.x>>8][bomb->pos.y>>8] = 1; /* set new bfield */
stonelist_add (bomb->pos.x>>8, bomb->pos.y>>8);
}

Loading…
Cancel
Save