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 */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -82,6 +82,9 @@ bomb_move (_bomb * bomb)
int step = 0, dist = 0, keepdir = 0; int step = 0, dist = 0, keepdir = 0;
_point fpos, rpos; _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 this once, and again if the direction is still ok */
do { do {
/* get the current position of the bomb */ /* get the current position of the bomb */
@ -128,19 +131,14 @@ bomb_move (_bomb * bomb)
d.x = b.x + bomb->dest.x; d.x = b.x + bomb->dest.x;
d.y = b.y + bomb->dest.y; 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 */ /* this direction is still oky */
map.bfield[d.x][d.y] = 1;
map.bfield[b.x][b.y] = 0;
keepdir = 1; keepdir = 1;
}
else if (bomb->mode == BM_liquid) { else if (bomb->mode == BM_liquid) {
/* liquid bomb so move to the other side */ /* liquid bomb so move to the other side */
keepdir = 0; keepdir = 0;
bomb->dest.x = -bomb->dest.x; bomb->dest.x = -bomb->dest.x;
bomb->dest.y = -bomb->dest.y; 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 { else {
/* stop moving this bomb */ /* stop moving this bomb */
@ -166,6 +164,9 @@ bomb_move (_bomb * bomb)
} }
dist += step; dist += step;
} while (dist < bomb->speed && (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir); } 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);
} }

@ -618,7 +618,7 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
if (bomb->state == BS_off && (b_dat->state == BS_ticking || b_dat->state == BS_trigger)) if (bomb->state == BS_off && (b_dat->state == BS_ticking || b_dat->state == BS_trigger))
snd_play (SND_bombdrop); snd_play (SND_bombdrop);
bomb->pos.x = b_dat->x; bomb->pos.x = b_dat->x;
bomb->pos.y = b_dat->y; bomb->pos.y = b_dat->y;

Loading…
Cancel
Save