From 036cdf048c2430344ca46ccca1ae16d337431d29 Mon Sep 17 00:00:00 2001 From: patty21 Date: Fri, 30 May 2003 18:48:58 +0000 Subject: [PATCH] bombposition changed, now lower 8 bit mark position within the field --- src/bomb.c | 20 ++++++++++++-------- src/player.c | 4 ++++ src/single.c | 4 ++-- src/special.c | 8 ++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/bomb.c b/src/bomb.c index 46e8704..4f0db35 100644 --- a/src/bomb.c +++ b/src/bomb.c @@ -11,7 +11,9 @@ draw_bomb (_bomb * bomb) { SDL_Rect src, dest; - + int x=bomb->pos.x >> 8, + y= bomb->pos.y >> 8; + if (bomb->state != BS_trigger) { /* check the framenumber */ if (bomb->frameto-- == 0) { @@ -26,12 +28,12 @@ draw_bomb (_bomb * bomb) dest.w = src.w = gfx.bomb.image->w; dest.h = src.h = gfx.block.y; - dest.x = gfx.offset.x + (bomb->pos.x * gfx.block.x); - dest.y = gfx.offset.y + (bomb->pos.y * gfx.block.y); + dest.x = gfx.offset.x + (x* gfx.block.x); + dest.y = gfx.offset.y + (y* gfx.block.y); src.x = 0; src.y = src.h * bomb->frame; - draw_stone (bomb->pos.x, bomb->pos.y); + draw_stone (x, y); SDL_BlitSurface (gfx.bomb.image, &src, gfx.screen, &dest); gfx_AddUpdateRect (dest.x, dest.y, dest.w, dest.h); @@ -55,7 +57,9 @@ bomb_explode (int p, int b, int net) bomb->firer[d] = 0; bomb->firerst[d] = -1; } - + bomb->pos.x=bomb->pos.x>>8; + bomb->pos.y=bomb->pos.y>>8; + if (GT_MP_PTPM && net) /* from now on only the server let the bomb explode */ net_game_send_bomb (p, b); @@ -131,7 +135,7 @@ get_bomb_on (int x, int y, _point bombs[]) for (b = 0; b < MAX_BOMBS; b++) { bomb = &bman.players[p].bombs[b]; if (bomb->state == BS_ticking || bomb->state==BS_trigger) { - if (bomb->pos.x == x && bomb->pos.y == y) { + if (bomb->pos.x >>8 == x && bomb->pos.y>>8 == y) { bombs[i].x = p; bombs[i].y = b; i++; @@ -241,7 +245,7 @@ restore_explosion (_bomb * bomb) gfx.block.x * (bomb->firer[up] + bomb->firer[down] + 1)); /* delete field from the bfield map */ - bman.bfield[bomb->pos.x][bomb->pos.y] = 0; + bman.bfield[bomb->pos.x ][bomb->pos.y] = 0; }; @@ -390,7 +394,7 @@ do_explosion (int p, int b) } else { bomb->firerst[d] = bomb->firer[d]; - draw_stone (bomb->pos.x + dx, bomb->pos.y + dy); + draw_stone (bomb->pos.x + dx, bomb->pos.y + dy); } } } diff --git a/src/player.c b/src/player.c index 084b897..1f6eb92 100644 --- a/src/player.c +++ b/src/player.c @@ -351,6 +351,7 @@ player_drop_bomb (int pl_nr) bomb->pos.y += 1; _y = 0; } + get_bomb_on (bomb->pos.x, bomb->pos.y, bombs); if (bombs[0].x != -1) // is there already a bomb @@ -368,6 +369,9 @@ player_drop_bomb (int pl_nr) } bomb->ex_nr = -1; bman.bfield[bomb->pos.x][bomb->pos.y] = 1; + bomb->pos.x=bomb->pos.x << 8; + bomb->pos.y=bomb->pos.y << 8; + if (bman.gametype != GT_single) { net_game_send_bomb (pl_nr, i); if (GT_MP_PTPS) diff --git a/src/single.c b/src/single.c index 6050c0d..9ea42e1 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.26 2003/05/29 20:49:53 stpohle Exp $ */ +/* $Id: single.c,v 1.27 2003/05/30 18:48:58 patty21 Exp $ */ /* single player */ #include "basic.h" @@ -645,7 +645,7 @@ single_loop () bestbdir, i; _airunaway rawdir; - + return; for (p = 0; p < MAX_PLAYERS; p++) if (p != bman.p_nr && PS_IS_alife (bman.players[p].state)) { pl = &bman.players[p]; diff --git a/src/special.c b/src/special.c index 911145e..6e449e7 100644 --- a/src/special.c +++ b/src/special.c @@ -71,8 +71,8 @@ special_row (int p_nr) b->state = BS_ticking; b->r = p->range; b->ex_nr = -1; - b->pos.x = x; - b->pos.y = y; + b->pos.x = x<<8; + b->pos.y = y<<8; b->to = BOMB_TIMEOUT * TIME_FACTOR + t; // 5 Secs * 200 bman.bfield[x][y] = 1; if (bman.gametype != GT_single) { @@ -124,8 +124,8 @@ special_push (int p_nr) for (i = 0; bombs[i].x != -1; i++) { b = &bman.players[bombs[i].x].bombs[bombs[i].y]; if (b->state != BS_exploding) { - b->pos.x = x1; - b->pos.y = y1; + b->pos.x = x1<<8; + b->pos.y = y1<<8; bman.bfield[x][y]=0; bman.bfield[x1][y1]=1; draw_stone(x,y);