|
|
|
@ -11,15 +11,16 @@ draw_bomb (_bomb * bomb)
|
|
|
|
|
{
|
|
|
|
|
SDL_Rect src,
|
|
|
|
|
dest;
|
|
|
|
|
int x=bomb->pos.x >> 8,
|
|
|
|
|
y= bomb->pos.y >> 8;
|
|
|
|
|
int x = bomb->pos.x >> 8,
|
|
|
|
|
y = bomb->pos.y >> 8;
|
|
|
|
|
|
|
|
|
|
if (x < 0 || y < 0 || x >= bman.fieldsize.x || y >= bman.fieldsize.y) {
|
|
|
|
|
d_fatal ("Draw Bomb out of range [%d,%d]\n", x,y);
|
|
|
|
|
d_fatal ("Draw Bomb out of range [%d,%d]\n", x, y);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bomb->state != BS_trigger || ((bomb->state == BS_trigger) && (bomb->to<BOMB_TIMEOUT*TIME_FACTOR))) {
|
|
|
|
|
if (bomb->state != BS_trigger
|
|
|
|
|
|| ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT * TIME_FACTOR))) {
|
|
|
|
|
/* check the framenumber */
|
|
|
|
|
if (bomb->frameto-- == 0) {
|
|
|
|
|
bomb->frameto = ANI_BOMBTIMEOUT;
|
|
|
|
@ -33,8 +34,8 @@ draw_bomb (_bomb * bomb)
|
|
|
|
|
dest.w = src.w = gfx.bomb.image->w;
|
|
|
|
|
dest.h = src.h = gfx.block.y;
|
|
|
|
|
|
|
|
|
|
dest.x = gfx.offset.x + (x* gfx.block.x);
|
|
|
|
|
dest.y = gfx.offset.y + (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;
|
|
|
|
@ -71,26 +72,31 @@ bomb_explode (int p, int b, int net)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bomb_move (_bomb *bomb)
|
|
|
|
|
bomb_move (_bomb * bomb)
|
|
|
|
|
{
|
|
|
|
|
_point npos;
|
|
|
|
|
if (bomb->pos.x==bomb->moveto.x) {
|
|
|
|
|
if (bomb->pos.y==bomb->moveto.y) {
|
|
|
|
|
bomb->moves=0;return;}
|
|
|
|
|
if (bomb->pos.y>bomb->moveto.y) {
|
|
|
|
|
npos.y=bomb->pos.y-bomb->moves; //move bomb up
|
|
|
|
|
npos.x=bomb->pos.x;
|
|
|
|
|
} else {
|
|
|
|
|
npos.y=bomb->pos.y+bomb->moves; // move bomb down
|
|
|
|
|
npos.x=bomb->pos.x;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bomb->pos.x>bomb->moveto.x) {
|
|
|
|
|
npos.x=bomb->pos.x-bomb->moves; //move bomb left
|
|
|
|
|
npos.y=bomb->pos.y;
|
|
|
|
|
} else {
|
|
|
|
|
npos.x=bomb->pos.x+bomb->moves; // move bomb right
|
|
|
|
|
npos.y=bomb->pos.y;
|
|
|
|
|
if (bomb->pos.x == bomb->moveto.x) {
|
|
|
|
|
if (bomb->pos.y == bomb->moveto.y) {
|
|
|
|
|
bomb->moves = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (bomb->pos.y > bomb->moveto.y) {
|
|
|
|
|
npos.y = bomb->pos.y - bomb->moves; //move bomb up
|
|
|
|
|
npos.x = bomb->pos.x;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
npos.y = bomb->pos.y + bomb->moves; // move bomb down
|
|
|
|
|
npos.x = bomb->pos.x;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (bomb->pos.x > bomb->moveto.x) {
|
|
|
|
|
npos.x = bomb->pos.x - bomb->moves; //move bomb left
|
|
|
|
|
npos.y = bomb->pos.y;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
npos.x = bomb->pos.x + bomb->moves; // move bomb right
|
|
|
|
|
npos.y = bomb->pos.y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -109,7 +115,7 @@ bomb_loop ()
|
|
|
|
|
if ((bman.players[p].state & PSFM_used) != 0) {
|
|
|
|
|
for (i = 0; i < MAX_BOMBS; i++) {
|
|
|
|
|
bomb = &player->bombs[i];
|
|
|
|
|
switch (bomb->state){
|
|
|
|
|
switch (bomb->state) {
|
|
|
|
|
case BS_ticking:
|
|
|
|
|
case BS_trigger:
|
|
|
|
|
if (GT_MP_PTPM || bman.gametype == GT_single) {
|
|
|
|
@ -120,7 +126,7 @@ bomb_loop ()
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (--bomb->to == 0) { // bomb did not explode -> resend bombdata
|
|
|
|
|
if (bomb->state==BS_ticking)
|
|
|
|
|
if (bomb->state == BS_ticking)
|
|
|
|
|
bomb->to = BOMB_TIMEOUT * TIME_FACTOR;
|
|
|
|
|
else
|
|
|
|
|
bomb->to = SPECIAL_TRIGGER_TIMEOUT * TIME_FACTOR;
|
|
|
|
@ -163,8 +169,8 @@ get_bomb_on (int x, int y, _point bombs[])
|
|
|
|
|
if ((bman.players[p].state & PSFM_used) != 0) {
|
|
|
|
|
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 >>8 == x && bomb->pos.y>>8 == y) {
|
|
|
|
|
if (bomb->state == BS_ticking || bomb->state == BS_trigger) {
|
|
|
|
|
if (bomb->pos.x >> 8 == x && bomb->pos.y >> 8 == y) {
|
|
|
|
|
bombs[i].x = p;
|
|
|
|
|
bombs[i].y = b;
|
|
|
|
|
i++;
|
|
|
|
@ -278,7 +284,7 @@ restore_explosion (_bomb * bomb)
|
|
|
|
|
gfx.block.x * (bomb->firer[up] + bomb->firer[down] + 1));
|
|
|
|
|
|
|
|
|
|
/* delete field from the bfield map */
|
|
|
|
|
bman.bfield[bpos.x ][bpos.y] = 0;
|
|
|
|
|
bman.bfield[bpos.x][bpos.y] = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -328,7 +334,7 @@ explosion_check_field (int x, int y, int p, int b)
|
|
|
|
|
bman.field[x][y].frame = 1;
|
|
|
|
|
|
|
|
|
|
draw_stone (x, y);
|
|
|
|
|
field_update(x, y);
|
|
|
|
|
field_update (x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bman.field[x][y].type;
|
|
|
|
@ -343,7 +349,8 @@ draw_explosion (_bomb * bomb)
|
|
|
|
|
r,
|
|
|
|
|
dx,
|
|
|
|
|
dy;
|
|
|
|
|
_point p, bpos;
|
|
|
|
|
_point p,
|
|
|
|
|
bpos;
|
|
|
|
|
|
|
|
|
|
bpos.x = bomb->pos.x >> 8;
|
|
|
|
|
bpos.y = bomb->pos.y >> 8;
|
|
|
|
|