bombposition changed, now lower 8 bit mark position within the field

origin
patty21 23 years ago
parent 46549bfcb3
commit 036cdf048c

@ -11,6 +11,8 @@ draw_bomb (_bomb * bomb)
{ {
SDL_Rect src, SDL_Rect src,
dest; dest;
int x=bomb->pos.x >> 8,
y= bomb->pos.y >> 8;
if (bomb->state != BS_trigger) { if (bomb->state != BS_trigger) {
/* check the framenumber */ /* check the framenumber */
@ -26,12 +28,12 @@ draw_bomb (_bomb * bomb)
dest.w = src.w = gfx.bomb.image->w; dest.w = src.w = gfx.bomb.image->w;
dest.h = src.h = gfx.block.y; dest.h = src.h = gfx.block.y;
dest.x = gfx.offset.x + (bomb->pos.x * gfx.block.x); dest.x = gfx.offset.x + (x* gfx.block.x);
dest.y = gfx.offset.y + (bomb->pos.y * gfx.block.y); dest.y = gfx.offset.y + (y* gfx.block.y);
src.x = 0; src.x = 0;
src.y = src.h * bomb->frame; 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); SDL_BlitSurface (gfx.bomb.image, &src, gfx.screen, &dest);
gfx_AddUpdateRect (dest.x, dest.y, dest.w, dest.h); gfx_AddUpdateRect (dest.x, dest.y, dest.w, dest.h);
@ -55,6 +57,8 @@ bomb_explode (int p, int b, int net)
bomb->firer[d] = 0; bomb->firer[d] = 0;
bomb->firerst[d] = -1; 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 */ if (GT_MP_PTPM && net) /* from now on only the server let the bomb explode */
net_game_send_bomb (p, b); 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++) { for (b = 0; b < MAX_BOMBS; b++) {
bomb = &bman.players[p].bombs[b]; bomb = &bman.players[p].bombs[b];
if (bomb->state == BS_ticking || bomb->state==BS_trigger) { 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].x = p;
bombs[i].y = b; bombs[i].y = b;
i++; i++;
@ -241,7 +245,7 @@ restore_explosion (_bomb * bomb)
gfx.block.x * (bomb->firer[up] + bomb->firer[down] + 1)); gfx.block.x * (bomb->firer[up] + bomb->firer[down] + 1));
/* delete field from the bfield map */ /* 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 { else {
bomb->firerst[d] = bomb->firer[d]; 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);
} }
} }
} }

@ -352,6 +352,7 @@ player_drop_bomb (int pl_nr)
_y = 0; _y = 0;
} }
get_bomb_on (bomb->pos.x, bomb->pos.y, bombs); get_bomb_on (bomb->pos.x, bomb->pos.y, bombs);
if (bombs[0].x != -1) // is there already a bomb if (bombs[0].x != -1) // is there already a bomb
return; return;
@ -368,6 +369,9 @@ player_drop_bomb (int pl_nr)
} }
bomb->ex_nr = -1; bomb->ex_nr = -1;
bman.bfield[bomb->pos.x][bomb->pos.y] = 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) { if (bman.gametype != GT_single) {
net_game_send_bomb (pl_nr, i); net_game_send_bomb (pl_nr, i);
if (GT_MP_PTPS) if (GT_MP_PTPS)

@ -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 */ /* single player */
#include "basic.h" #include "basic.h"
@ -645,7 +645,7 @@ single_loop ()
bestbdir, bestbdir,
i; i;
_airunaway rawdir; _airunaway rawdir;
return;
for (p = 0; p < MAX_PLAYERS; p++) for (p = 0; p < MAX_PLAYERS; p++)
if (p != bman.p_nr && PS_IS_alife (bman.players[p].state)) { if (p != bman.p_nr && PS_IS_alife (bman.players[p].state)) {
pl = &bman.players[p]; pl = &bman.players[p];

@ -71,8 +71,8 @@ special_row (int p_nr)
b->state = BS_ticking; b->state = BS_ticking;
b->r = p->range; b->r = p->range;
b->ex_nr = -1; b->ex_nr = -1;
b->pos.x = x; b->pos.x = x<<8;
b->pos.y = y; b->pos.y = y<<8;
b->to = BOMB_TIMEOUT * TIME_FACTOR + t; // 5 Secs * 200 b->to = BOMB_TIMEOUT * TIME_FACTOR + t; // 5 Secs * 200
bman.bfield[x][y] = 1; bman.bfield[x][y] = 1;
if (bman.gametype != GT_single) { if (bman.gametype != GT_single) {
@ -124,8 +124,8 @@ special_push (int p_nr)
for (i = 0; bombs[i].x != -1; i++) { for (i = 0; bombs[i].x != -1; i++) {
b = &bman.players[bombs[i].x].bombs[bombs[i].y]; b = &bman.players[bombs[i].x].bombs[bombs[i].y];
if (b->state != BS_exploding) { if (b->state != BS_exploding) {
b->pos.x = x1; b->pos.x = x1<<8;
b->pos.y = y1; b->pos.y = y1<<8;
bman.bfield[x][y]=0; bman.bfield[x][y]=0;
bman.bfield[x1][y1]=1; bman.bfield[x1][y1]=1;
draw_stone(x,y); draw_stone(x,y);

Loading…
Cancel
Save