|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: bomb.c,v 1.51 2003/11/09 04:09:49 stpohle Exp $ */
|
|
|
|
|
/* $Id: bomb.c,v 1.52 2004/01/07 23:04:31 patty21 Exp $ */
|
|
|
|
|
/* everything what have to do with the bombs */
|
|
|
|
|
|
|
|
|
|
#include "bomberclone.h"
|
|
|
|
@ -10,35 +10,79 @@ draw_bomb (_bomb * bomb)
|
|
|
|
|
SDL_Rect src,
|
|
|
|
|
dest;
|
|
|
|
|
int x = floorf (bomb->pos.x),
|
|
|
|
|
y = floorf (bomb->pos.y);
|
|
|
|
|
y = floorf (bomb->pos.y);
|
|
|
|
|
float w,
|
|
|
|
|
x1,
|
|
|
|
|
x2,
|
|
|
|
|
y1,
|
|
|
|
|
y2;
|
|
|
|
|
|
|
|
|
|
if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) {
|
|
|
|
|
d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bomb->state != BS_trigger
|
|
|
|
|
|| ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
|
|
|
|
|
if (bomb->state != BS_trigger || ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
|
|
|
|
|
/* check the framenumber */
|
|
|
|
|
bomb->frame += (timefactor/3.0);
|
|
|
|
|
bomb->frame += (timefactor / 3.0);
|
|
|
|
|
if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames)
|
|
|
|
|
bomb->frame = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
if (bomb->mode == BM_kicked) {
|
|
|
|
|
w = sqrt (bomb->speed);
|
|
|
|
|
w *= absol (sin (w));
|
|
|
|
|
x1 = bomb->dest.x - bomb->pos.x;
|
|
|
|
|
y1 = bomb->dest.y - bomb->pos.y;
|
|
|
|
|
if (x1 > 0) {
|
|
|
|
|
x2 = bomb->pos.x + x1 * bomb->speed / 88 + y1 * w / 20;
|
|
|
|
|
y2 = bomb->pos.y + y1 * bomb->speed / 88 - x1 * w / 20;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
x2 = bomb->pos.x + x1 * bomb->speed / 88 - y1 * w / 20;
|
|
|
|
|
y2 = bomb->pos.y + y1 * bomb->speed / 88 + x1 * w / 20;
|
|
|
|
|
}
|
|
|
|
|
x = floorf (x2);
|
|
|
|
|
y = floorf (y2);
|
|
|
|
|
bomb->speed -= timediff * 100;
|
|
|
|
|
if (bomb->speed < 0) {
|
|
|
|
|
dest.x = gfx.offset.x + bomb->pos.x * gfx.block.x;
|
|
|
|
|
dest.y = gfx.offset.y + bomb->pos.y * gfx.block.y;
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
w = sqrt (bomb->speed);
|
|
|
|
|
w *= absol (sin (w));
|
|
|
|
|
if (x1 > 0) {
|
|
|
|
|
x2 = bomb->pos.x + x1 * bomb->speed / 88 + y1 * w / 20;
|
|
|
|
|
y2 = bomb->pos.y + y1 * bomb->speed / 88 - x1 * w / 20;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
x2 = bomb->pos.x + x1 * bomb->speed / 88 - y1 * w / 20;
|
|
|
|
|
y2 = bomb->pos.y + y1 * bomb->speed / 88 + x1 * w / 20;
|
|
|
|
|
}
|
|
|
|
|
dest.x = gfx.offset.x + x2 * gfx.block.x;
|
|
|
|
|
dest.y = gfx.offset.y + y2 * gfx.block.y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
dest.x = gfx.offset.x + bomb->pos.x * gfx.block.x;
|
|
|
|
|
dest.y = gfx.offset.y + bomb->pos.y * gfx.block.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
src.x = 0;
|
|
|
|
|
src.y = src.h * (int)bomb->frame;
|
|
|
|
|
src.y = src.h * (int) bomb->frame;
|
|
|
|
|
stonelist_add (x, y);
|
|
|
|
|
if (bomb->mode != BM_normal) {
|
|
|
|
|
stonelist_add (x+1, y);
|
|
|
|
|
stonelist_add (x, y+1);
|
|
|
|
|
stonelist_add (x+1, y+1);
|
|
|
|
|
}
|
|
|
|
|
if (bomb->mode != BM_normal) {
|
|
|
|
|
stonelist_add (x + 1, y);
|
|
|
|
|
stonelist_add (x, y + 1);
|
|
|
|
|
stonelist_add (x + 1, y + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y*256) + 2);
|
|
|
|
|
gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y * 256) + 2);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -53,7 +97,7 @@ bomb_explode (int p, int b, int net)
|
|
|
|
|
if (bomb->ex_nr == -1)
|
|
|
|
|
bomb->ex_nr = bman.last_ex_nr++; // set bomb explosion id
|
|
|
|
|
|
|
|
|
|
players[p].bomb_lastex = b;
|
|
|
|
|
players[p].bomb_lastex = b;
|
|
|
|
|
|
|
|
|
|
bomb->to = EXPLOSIONTIMEOUT; /* set the timeout for the fireexplosion */
|
|
|
|
|
bomb->state = BS_exploding;
|
|
|
|
@ -74,99 +118,106 @@ bomb_explode (int p, int b, int net)
|
|
|
|
|
void
|
|
|
|
|
bomb_move (_bomb * bomb)
|
|
|
|
|
{
|
|
|
|
|
int keepdir = 0;
|
|
|
|
|
_pointf fpos, rpos;
|
|
|
|
|
float dist = 0.0f, step = 0.0f;
|
|
|
|
|
|
|
|
|
|
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 0; /* delete bfield */
|
|
|
|
|
stonelist_add (bomb->pos.x, bomb->pos.y);
|
|
|
|
|
|
|
|
|
|
/* do this once, and again if the direction is still ok */
|
|
|
|
|
do {
|
|
|
|
|
/* get the current position of the bomb */
|
|
|
|
|
fpos.x = (int) bomb->pos.x;
|
|
|
|
|
fpos.y = (int) bomb->pos.y;
|
|
|
|
|
rpos.x = CUTINT(bomb->pos.x);
|
|
|
|
|
rpos.y = CUTINT (bomb->pos.y);
|
|
|
|
|
|
|
|
|
|
/* calculate the next step speed or next full field..
|
|
|
|
|
depend on what is the smaler one */
|
|
|
|
|
if (bomb->dest.x < 0)
|
|
|
|
|
step = rpos.x;
|
|
|
|
|
else if (bomb->dest.x > 0) {
|
|
|
|
|
step = 1.0f - rpos.x;
|
|
|
|
|
fpos.x += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
else if (bomb->dest.y < 0)
|
|
|
|
|
step = rpos.y;
|
|
|
|
|
else if (bomb->dest.y > 0) {
|
|
|
|
|
step = 1.0f - rpos.y;
|
|
|
|
|
fpos.y += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (step > (timefactor * bomb->speed) || step == 0.0f)
|
|
|
|
|
step = (timefactor * bomb->speed);
|
|
|
|
|
|
|
|
|
|
/* move the bomb to the new position */
|
|
|
|
|
if (bomb->dest.x < 0)
|
|
|
|
|
bomb->pos.x -= step;
|
|
|
|
|
else if (bomb->dest.x > 0)
|
|
|
|
|
bomb->pos.x += step;
|
|
|
|
|
else if (bomb->dest.y < 0)
|
|
|
|
|
bomb->pos.y -= step;
|
|
|
|
|
else if (bomb->dest.y > 0)
|
|
|
|
|
bomb->pos.y += step;
|
|
|
|
|
|
|
|
|
|
/* if we are on a complete field, check if we
|
|
|
|
|
can move to the next one */
|
|
|
|
|
if ((CUTINT(bomb->pos.x) == 0.0f) && (CUTINT(bomb->pos.y) == 0.0f)) {
|
|
|
|
|
if (bomb->mode == BM_pushed)
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
|
|
|
|
|
/* it is a moving liquid bomb so check for another field */
|
|
|
|
|
_point b, d;
|
|
|
|
|
|
|
|
|
|
b.x = (int)bomb->pos.x;
|
|
|
|
|
b.y = (int)bomb->pos.y;
|
|
|
|
|
d.x = b.x + bomb->dest.x;
|
|
|
|
|
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))
|
|
|
|
|
/* this direction is still oky */
|
|
|
|
|
keepdir = 1;
|
|
|
|
|
else if (bomb->mode == BM_liquid) {
|
|
|
|
|
/* liquid bomb so move to the other side */
|
|
|
|
|
keepdir = 0;
|
|
|
|
|
bomb->dest.x = -bomb->dest.x;
|
|
|
|
|
bomb->dest.y = -bomb->dest.y;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* stop moving this bomb */
|
|
|
|
|
keepdir = 0;
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if a network game is running send bomb data with the
|
|
|
|
|
current information */
|
|
|
|
|
if (GT_MP) {
|
|
|
|
|
int b = -1, i = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
if (&players[bman.p_nr].bombs[i] == bomb)
|
|
|
|
|
b = i;
|
|
|
|
|
i++;
|
|
|
|
|
} while (b == -1 && i < MAX_BOMBS);
|
|
|
|
|
|
|
|
|
|
if (b != -1)
|
|
|
|
|
net_game_send_bomb (bman.p_nr, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dist += step;
|
|
|
|
|
} while (dist < (timefactor * bomb->speed) && (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir);
|
|
|
|
|
|
|
|
|
|
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 1; /* set new bfield */
|
|
|
|
|
stonelist_add (bomb->pos.x, bomb->pos.y);
|
|
|
|
|
int keepdir = 0;
|
|
|
|
|
_pointf fpos,
|
|
|
|
|
rpos;
|
|
|
|
|
float dist = 0.0f,
|
|
|
|
|
step = 0.0f;
|
|
|
|
|
|
|
|
|
|
map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 0; /* delete bfield */
|
|
|
|
|
stonelist_add (bomb->pos.x, bomb->pos.y);
|
|
|
|
|
|
|
|
|
|
/* do this once, and again if the direction is still ok */
|
|
|
|
|
do {
|
|
|
|
|
/* get the current position of the bomb */
|
|
|
|
|
fpos.x = (int) bomb->pos.x;
|
|
|
|
|
fpos.y = (int) bomb->pos.y;
|
|
|
|
|
rpos.x = CUTINT (bomb->pos.x);
|
|
|
|
|
rpos.y = CUTINT (bomb->pos.y);
|
|
|
|
|
|
|
|
|
|
/* calculate the next step speed or next full field..
|
|
|
|
|
depend on what is the smaler one */
|
|
|
|
|
if (bomb->dest.x < 0)
|
|
|
|
|
step = rpos.x;
|
|
|
|
|
else if (bomb->dest.x > 0) {
|
|
|
|
|
step = 1.0f - rpos.x;
|
|
|
|
|
fpos.x += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
else if (bomb->dest.y < 0)
|
|
|
|
|
step = rpos.y;
|
|
|
|
|
else if (bomb->dest.y > 0) {
|
|
|
|
|
step = 1.0f - rpos.y;
|
|
|
|
|
fpos.y += 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (step > (timefactor * bomb->speed) || step == 0.0f)
|
|
|
|
|
step = (timefactor * bomb->speed);
|
|
|
|
|
|
|
|
|
|
/* move the bomb to the new position */
|
|
|
|
|
if (bomb->dest.x < 0)
|
|
|
|
|
bomb->pos.x -= step;
|
|
|
|
|
else if (bomb->dest.x > 0)
|
|
|
|
|
bomb->pos.x += step;
|
|
|
|
|
else if (bomb->dest.y < 0)
|
|
|
|
|
bomb->pos.y -= step;
|
|
|
|
|
else if (bomb->dest.y > 0)
|
|
|
|
|
bomb->pos.y += step;
|
|
|
|
|
|
|
|
|
|
/* if we are on a complete field, check if we
|
|
|
|
|
can move to the next one */
|
|
|
|
|
if ((CUTINT (bomb->pos.x) == 0.0f) && (CUTINT (bomb->pos.y) == 0.0f)) {
|
|
|
|
|
if (bomb->mode == BM_pushed)
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
|
|
|
|
|
/* it is a moving liquid bomb so check for another field */
|
|
|
|
|
_point b,
|
|
|
|
|
d;
|
|
|
|
|
|
|
|
|
|
b.x = (int) bomb->pos.x;
|
|
|
|
|
b.y = (int) bomb->pos.y;
|
|
|
|
|
d.x = b.x + bomb->dest.x;
|
|
|
|
|
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))
|
|
|
|
|
/* this direction is still oky */
|
|
|
|
|
keepdir = 1;
|
|
|
|
|
else if (bomb->mode == BM_liquid) {
|
|
|
|
|
/* liquid bomb so move to the other side */
|
|
|
|
|
keepdir = 0;
|
|
|
|
|
bomb->dest.x = -bomb->dest.x;
|
|
|
|
|
bomb->dest.y = -bomb->dest.y;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* stop moving this bomb */
|
|
|
|
|
keepdir = 0;
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if a network game is running send bomb data with the
|
|
|
|
|
current information */
|
|
|
|
|
if (GT_MP) {
|
|
|
|
|
int b = -1,
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
if (&players[bman.p_nr].bombs[i] == bomb)
|
|
|
|
|
b = i;
|
|
|
|
|
i++;
|
|
|
|
|
} while (b == -1 && i < MAX_BOMBS);
|
|
|
|
|
|
|
|
|
|
if (b != -1)
|
|
|
|
|
net_game_send_bomb (bman.p_nr, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dist += step;
|
|
|
|
|
} while (dist < (timefactor * bomb->speed)
|
|
|
|
|
&& (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir);
|
|
|
|
|
|
|
|
|
|
map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 1; /* set new bfield */
|
|
|
|
|
stonelist_add (bomb->pos.x, bomb->pos.y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -188,14 +239,14 @@ bomb_loop ()
|
|
|
|
|
case BS_ticking:
|
|
|
|
|
case BS_trigger:
|
|
|
|
|
if (GT_MP_PTPM || GT_SP) {
|
|
|
|
|
bomb->to -= timediff;
|
|
|
|
|
bomb->to -= timediff;
|
|
|
|
|
if (bomb->to <= 0.0f) // bomb will have to explode in the next loop
|
|
|
|
|
bomb_explode (p, i, 1);
|
|
|
|
|
else
|
|
|
|
|
draw_bomb (bomb);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bomb->to -= timediff;
|
|
|
|
|
bomb->to -= timediff;
|
|
|
|
|
if (bomb->to <= 0.0f) { // bomb did not explode -> resend bombdata
|
|
|
|
|
if (bomb->state == BS_ticking)
|
|
|
|
|
bomb->to = BOMB_TIMEOUT;
|
|
|
|
@ -207,11 +258,11 @@ bomb_loop ()
|
|
|
|
|
draw_bomb (bomb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bomb->mode != BM_normal)
|
|
|
|
|
bomb_action (bomb);
|
|
|
|
|
if (bomb->mode != BM_normal)
|
|
|
|
|
bomb_action (bomb);
|
|
|
|
|
|
|
|
|
|
b++; // Count ticking Bombs for Return value
|
|
|
|
|
break;
|
|
|
|
|
b++; // Count ticking Bombs for Return value
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BS_exploding:
|
|
|
|
|
if (bomb->to > 0.0f) {
|
|
|
|
@ -248,7 +299,8 @@ get_bomb_on (float x, float y, _point bombs[])
|
|
|
|
|
for (b = 0; b < MAX_BOMBS; b++) {
|
|
|
|
|
bomb = &players[p].bombs[b];
|
|
|
|
|
if (bomb->state == BS_ticking || bomb->state == BS_trigger) {
|
|
|
|
|
if (bomb->pos.x-1.0f < x && bomb->pos.x+1.0f > x && bomb->pos.y-1.0f < y && bomb->pos.y+1.0f > y) {
|
|
|
|
|
if (bomb->pos.x - 1.0f < x && bomb->pos.x + 1.0f > x && bomb->pos.y - 1.0f < y
|
|
|
|
|
&& bomb->pos.y + 1.0f > y) {
|
|
|
|
|
bombs[i].x = p;
|
|
|
|
|
bombs[i].y = b;
|
|
|
|
|
i++;
|
|
|
|
@ -287,10 +339,13 @@ draw_fire (int x, int y, int d, int frame)
|
|
|
|
|
void
|
|
|
|
|
restore_explosion (_bomb * bomb)
|
|
|
|
|
{
|
|
|
|
|
int i, j,
|
|
|
|
|
d, dx = 0,
|
|
|
|
|
dy = 0, _x,
|
|
|
|
|
_y;
|
|
|
|
|
int i,
|
|
|
|
|
j,
|
|
|
|
|
d,
|
|
|
|
|
dx = 0,
|
|
|
|
|
dy = 0,
|
|
|
|
|
_x,
|
|
|
|
|
_y;
|
|
|
|
|
|
|
|
|
|
for (d = 0; d < 4; d++) {
|
|
|
|
|
switch (d) {
|
|
|
|
@ -319,10 +374,10 @@ restore_explosion (_bomb * bomb)
|
|
|
|
|
if (--map.field[_x][_y].ex[d].count == 0) // there was only one explosion so
|
|
|
|
|
map.field[_x][_y].ex[d].frame = 0; // reset the framenumber
|
|
|
|
|
|
|
|
|
|
for (j = 0; j >= 0 && j < 4; j++)
|
|
|
|
|
if (map.field[_x][_y].ex[j].count > 0 && j != d)
|
|
|
|
|
j = -4;
|
|
|
|
|
if (j > 0)
|
|
|
|
|
for (j = 0; j >= 0 && j < 4; j++)
|
|
|
|
|
if (map.field[_x][_y].ex[j].count > 0 && j != d)
|
|
|
|
|
j = -4;
|
|
|
|
|
if (j > 0)
|
|
|
|
|
stonelist_add (_x, _y);
|
|
|
|
|
|
|
|
|
|
_x = _x + dx;
|
|
|
|
@ -331,8 +386,7 @@ restore_explosion (_bomb * bomb)
|
|
|
|
|
|
|
|
|
|
// delete the stone completly if there was any in the way
|
|
|
|
|
if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block
|
|
|
|
|
&& map.field[_x][_y].type != FT_tunnel
|
|
|
|
|
&& bomb->ex_nr != map.field[_x][_y].ex_nr) {
|
|
|
|
|
&& map.field[_x][_y].type != FT_tunnel && bomb->ex_nr != map.field[_x][_y].ex_nr) {
|
|
|
|
|
|
|
|
|
|
map.field[_x][_y].ex_nr = bomb->ex_nr;
|
|
|
|
|
map.field[_x][_y].frame = 0.0f;
|
|
|
|
@ -354,10 +408,10 @@ restore_explosion (_bomb * bomb)
|
|
|
|
|
_y = bomb->pos.y;
|
|
|
|
|
|
|
|
|
|
/* delete field from the bfield map */
|
|
|
|
|
if (bomb->mode == BM_moving || bomb->mode == BM_pushed || bomb->mode == BM_liquid)
|
|
|
|
|
map.bfield[(int)bomb->pos.x + bomb->dest.x][(int)bomb->pos.y + bomb->dest.y] = 0;
|
|
|
|
|
if (bomb->mode == BM_moving || bomb->mode == BM_pushed || bomb->mode == BM_liquid)
|
|
|
|
|
map.bfield[(int) bomb->pos.x + bomb->dest.x][(int) bomb->pos.y + bomb->dest.y] = 0;
|
|
|
|
|
|
|
|
|
|
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 0;
|
|
|
|
|
map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -393,7 +447,8 @@ explosion_check_field (int x, int y, int p, int b)
|
|
|
|
|
for (i = 0; pl[i] != -1; i++) {
|
|
|
|
|
tmpplayer = &players[pl[i]];
|
|
|
|
|
if (((tmpplayer->state & PSF_alife) != 0)
|
|
|
|
|
&& (GT_SP || (GT_MP && (&players[bman.p_nr] == tmpplayer)) || (GT_MP_PTPM && PS_IS_aiplayer(tmpplayer->state))))
|
|
|
|
|
&& (GT_SP || (GT_MP && (&players[bman.p_nr] == tmpplayer))
|
|
|
|
|
|| (GT_MP_PTPM && PS_IS_aiplayer (tmpplayer->state))))
|
|
|
|
|
player_died (tmpplayer, p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -446,7 +501,7 @@ draw_explosion (_bomb * bomb)
|
|
|
|
|
map.field[p.x][p.y].ex[d].frame += timefactor;
|
|
|
|
|
if (map.field[p.x][p.y].ex[d].frame >= gfx.fire.frames)
|
|
|
|
|
map.field[p.x][p.y].ex[d].frame = 0.0f;
|
|
|
|
|
stonelist_add (p.x, p.y);
|
|
|
|
|
stonelist_add (p.x, p.y);
|
|
|
|
|
draw_fire (p.x, p.y, d, -1);
|
|
|
|
|
p.x += dx;
|
|
|
|
|
p.y += dy;
|
|
|
|
@ -460,8 +515,8 @@ do_explosion (int p, int b)
|
|
|
|
|
{
|
|
|
|
|
_bomb *bomb = &players[p].bombs[b];
|
|
|
|
|
int dx = 0,
|
|
|
|
|
dy = 0,
|
|
|
|
|
d;
|
|
|
|
|
dy = 0,
|
|
|
|
|
d;
|
|
|
|
|
|
|
|
|
|
for (d = 0; d < 4; d++) {
|
|
|
|
|
switch (d) {
|
|
|
|
@ -484,20 +539,21 @@ do_explosion (int p, int b)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bomb->firer[d] <= bomb->r) {
|
|
|
|
|
int checkfield;
|
|
|
|
|
int checkfield;
|
|
|
|
|
|
|
|
|
|
dx = bomb->firer[d] * dx;
|
|
|
|
|
dy = bomb->firer[d] * dy;
|
|
|
|
|
|
|
|
|
|
checkfield = explosion_check_field (bomb->pos.x + dx, bomb->pos.y + dy, p, b);
|
|
|
|
|
checkfield = explosion_check_field (bomb->pos.x + dx, bomb->pos.y + dy, p, b);
|
|
|
|
|
if ((checkfield == FT_nothing || checkfield == FT_tunnel)
|
|
|
|
|
&& bomb->firerst[d] == -1) {
|
|
|
|
|
&& bomb->firerst[d] == -1) {
|
|
|
|
|
bomb->firer[d]++;
|
|
|
|
|
map.field[(int)bomb->pos.x + dx][(int)bomb->pos.y + dy].ex[d].count++;
|
|
|
|
|
map.field[(int)bomb->pos.x + dx][(int)bomb->pos.y + dy].ex[d].frame = bomb->firer[d];
|
|
|
|
|
map.field[(int) bomb->pos.x + dx][(int) bomb->pos.y + dy].ex[d].count++;
|
|
|
|
|
map.field[(int) bomb->pos.x + dx][(int) bomb->pos.y + dy].ex[d].frame =
|
|
|
|
|
bomb->firer[d];
|
|
|
|
|
/* if we have a slow pc we can enable this and disable the drawing animation */
|
|
|
|
|
// draw_fire (bomb->pos.x + dx, bomb->pos.y + dy, d, gfx.fire.frames>>1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bomb->firerst[d] = bomb->firer[d];
|
|
|
|
|
stonelist_add (bomb->pos.x + dx, bomb->pos.y + dy);
|
|
|
|
@ -511,15 +567,19 @@ do_explosion (int p, int b)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void bomb_action (_bomb *bomb) {
|
|
|
|
|
switch (bomb->mode) {
|
|
|
|
|
case (BM_moving):
|
|
|
|
|
case (BM_liquid):
|
|
|
|
|
case (BM_pushed):
|
|
|
|
|
bomb_move (bomb);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
inline void
|
|
|
|
|
bomb_action (_bomb * bomb)
|
|
|
|
|
{
|
|
|
|
|
switch (bomb->mode) {
|
|
|
|
|
case (BM_moving):
|
|
|
|
|
case (BM_liquid):
|
|
|
|
|
case (BM_pushed):
|
|
|
|
|
bomb_move (bomb);
|
|
|
|
|
break;
|
|
|
|
|
case (BM_kicked):
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
bomb->mode = BM_normal;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|