From 94670e1fdf70889b42aaa6ab13d0aad0594b02e7 Mon Sep 17 00:00:00 2001 From: stpohle Date: Tue, 10 Jun 2003 18:14:13 +0000 Subject: [PATCH] Last Changes for smooth bomb pushing.. some clean up in the source --- src/basic.h | 4 ++-- src/bomb.c | 6 +++--- src/packets.c | 9 +++++++-- src/packets.h | 3 +++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/basic.h b/src/basic.h index 9c4bde8..13ae597 100644 --- a/src/basic.h +++ b/src/basic.h @@ -27,8 +27,8 @@ #define SPECIAL_DESTROY_NUMUSE 5 #define SPECIAL_8WAY_NUMUSE 10 -#define START_BOMBS 5 -#define START_RANGE 6 +#define START_BOMBS 1 +#define START_RANGE 2 #define START_SPEED 16 #define SPEEDMUL 1.2 diff --git a/src/bomb.c b/src/bomb.c index ef6d134..c4f5062 100644 --- a/src/bomb.c +++ b/src/bomb.c @@ -111,7 +111,7 @@ bomb_move (_bomb * bomb) else { dy = bomb->moveto.y - bomb->pos.y; //move bomb to field } - d_printf("move bomb %d %d\n",dx,dy); + if (!dx && !dy) { // bomb has reached its final position bomb->moves = 0; return; @@ -124,7 +124,7 @@ bomb_move (_bomb * bomb) } npos.x=bomb->pos.x+dx; npos.y=bomb->pos.y+dy; - d_printf("move bomb %d %d\n",dx,dy); + // check if field is used /* if (!(dx && dy)) { @@ -343,7 +343,7 @@ explosion_check_field (int x, int y, int p, int b) _bomb *bomb = &bman.players[p].bombs[b]; int pl[MAX_PLAYERS]; int i; - _point bo[MAX_PLAYERS * MAX_BOMBS], pos; + _point bo[MAX_PLAYERS * MAX_BOMBS]; _bomb *tmpbomb; _player *tmpplayer; diff --git a/src/packets.c b/src/packets.c index b1f3c5a..c7ba2de 100644 --- a/src/packets.c +++ b/src/packets.c @@ -619,13 +619,15 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr) bomb->r = b_dat->r; bomb->ex_nr = b_dat->ex_nr; bomb->state = b_dat->state; - + bomb->moves = b_dat->moves; + bomb->moveto.x = b_dat->movetox; + bomb->moveto.y = b_dat->movetoy; + if (bomb->state == BS_exploding) bomb_explode (b_dat->p_nr, b_dat->b_nr, 0); if (bomb->ex_nr > bman.last_ex_nr) bman.last_ex_nr = bomb->ex_nr; - }; @@ -645,6 +647,9 @@ send_bombdata (_net_addr * addr, int p, int b, _bomb * bomb) b_dat.b_nr = b; b_dat.p_nr = p; b_dat.h.flags = PKGF_ackreq; + b_dat.moves = bomb->moves; + b_dat.movetox = bomb->moveto.x; + b_dat.movetoy = bomb->moveto.y; send_pkg ((struct pkg *) &b_dat, addr); }; diff --git a/src/packets.h b/src/packets.h index f43fcca..26d5b78 100644 --- a/src/packets.h +++ b/src/packets.h @@ -150,6 +150,9 @@ struct pkg_bombdata { unsigned char r; int ex_nr; int to; + unsigned short int movetox; + unsigned short int movetoy; + signed short int moves; };