|
|
|
@ -89,8 +89,7 @@ restore_players_screen ()
|
|
|
|
|
if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) {
|
|
|
|
|
|
|
|
|
|
if ((bman.players[i].old.x >> 8) < 0 || (bman.players[i].old.x >> 8) >= map.size.x
|
|
|
|
|
|| (bman.players[i].old.y >> 8) < 0
|
|
|
|
|
|| (bman.players[i].old.y >> 8) >= map.size.y)
|
|
|
|
|
|| (bman.players[i].old.y >> 8) < 0 || (bman.players[i].old.y >> 8) >= map.size.y)
|
|
|
|
|
d_printf ("FATAL: Restore Player out of range : playernr %d [%d,%d]\n", i,
|
|
|
|
|
(bman.players[i].old.x >> 8), (bman.players[i].old.y >> 8));
|
|
|
|
|
else {
|
|
|
|
@ -229,11 +228,17 @@ check_field (short int x, short int y)
|
|
|
|
|
int
|
|
|
|
|
stepmove_player (int pl_nr)
|
|
|
|
|
{
|
|
|
|
|
_point bomb1[MAX_PLAYERS * MAX_BOMBS], bomb2[MAX_PLAYERS * MAX_BOMBS];
|
|
|
|
|
_point bomb1[MAX_PLAYERS * MAX_BOMBS],
|
|
|
|
|
bomb2[MAX_PLAYERS * MAX_BOMBS];
|
|
|
|
|
_player *p = &bman.players[pl_nr];
|
|
|
|
|
int speed = 0, i, j, f;
|
|
|
|
|
int speed = 0,
|
|
|
|
|
i,
|
|
|
|
|
j,
|
|
|
|
|
f;
|
|
|
|
|
_point fpos, // field position
|
|
|
|
|
|
|
|
|
|
_pos, // position inside the field
|
|
|
|
|
|
|
|
|
|
d;
|
|
|
|
|
|
|
|
|
|
if (p->m == 1) {
|
|
|
|
@ -269,13 +274,17 @@ stepmove_player (int pl_nr)
|
|
|
|
|
|
|
|
|
|
// check the new field position
|
|
|
|
|
d.x = d.y = 0;
|
|
|
|
|
if (p->d == left && _pos.y == 0 && ((_pos.x == 0 && check_field (fpos.x - 1, fpos.y)) || (_pos.x > 0)))
|
|
|
|
|
if (p->d == left && _pos.y == 0
|
|
|
|
|
&& ((_pos.x == 0 && check_field (fpos.x - 1, fpos.y)) || (_pos.x > 0)))
|
|
|
|
|
d.x = -speed;
|
|
|
|
|
if (p->d == right && _pos.y == 0 && ((_pos.x == 0 && check_field (fpos.x + 1, fpos.y)) || (_pos.x > 0)))
|
|
|
|
|
if (p->d == right && _pos.y == 0
|
|
|
|
|
&& ((_pos.x == 0 && check_field (fpos.x + 1, fpos.y)) || (_pos.x > 0)))
|
|
|
|
|
d.x = speed;
|
|
|
|
|
if (p->d == up && _pos.x == 0 && ((_pos.y == 0 && check_field (fpos.x, fpos.y - 1)) || (_pos.y > 0)))
|
|
|
|
|
if (p->d == up && _pos.x == 0
|
|
|
|
|
&& ((_pos.y == 0 && check_field (fpos.x, fpos.y - 1)) || (_pos.y > 0)))
|
|
|
|
|
d.y = -speed;
|
|
|
|
|
if (p->d == down && _pos.x == 0 && ((_pos.y == 0 && check_field (fpos.x, fpos.y + 1)) || (_pos.y > 0)))
|
|
|
|
|
if (p->d == down && _pos.x == 0
|
|
|
|
|
&& ((_pos.y == 0 && check_field (fpos.x, fpos.y + 1)) || (_pos.y > 0)))
|
|
|
|
|
d.y = speed;
|
|
|
|
|
|
|
|
|
|
// check if we can move and if there is any bomb
|
|
|
|
@ -313,6 +322,27 @@ stepmove_player (int pl_nr)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* check if the givin position is oky
|
|
|
|
|
1 = ok, 0 = bad */
|
|
|
|
|
int
|
|
|
|
|
player_checkpos (int x, int y)
|
|
|
|
|
{
|
|
|
|
|
int i,
|
|
|
|
|
d;
|
|
|
|
|
|
|
|
|
|
for (i = 0, d = 0; d < 4; d++)
|
|
|
|
|
if (map.field[x][y].ex[d].count > 0)
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
if (map.field[x][y].type == FT_block || i > 0)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* move the player if he have to move AND check if we are on a block
|
|
|
|
|
or over fire */
|
|
|
|
|
void
|
|
|
|
|
move_player (int pl_nr)
|
|
|
|
|
{
|
|
|
|
@ -344,6 +374,21 @@ move_player (int pl_nr)
|
|
|
|
|
net_game_send_playermove (pl_nr, 1);
|
|
|
|
|
p->old_m = p->m; // save the old state
|
|
|
|
|
p->m = 0;
|
|
|
|
|
|
|
|
|
|
/* check the players position */
|
|
|
|
|
if ((p->pos.x & 0xFF) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right))
|
|
|
|
|
if (!check_field ((p->pos.x >> 8) + 1, (p->pos.y >> 8)))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
if ((p->pos.y & 0xFF) > EXPLOSION_SAVE_DISTANCE && (p->d == up || p->d == down))
|
|
|
|
|
if (!check_field ((p->pos.x >> 8), (p->pos.y >> 8) + 1))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
if (((p->pos.x & 0xFF) < (0x100 - EXPLOSION_SAVE_DISTANCE)
|
|
|
|
|
&& (p->d == left || p->d == right))
|
|
|
|
|
|| ((p->pos.y & 0xFF) < (0x100 - EXPLOSION_SAVE_DISTANCE)
|
|
|
|
|
&& (p->d == up || p->d == down)))
|
|
|
|
|
if (!check_field (p->pos.x >> 8, p->pos.y >> 8))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -757,8 +802,13 @@ player_set_gfx (_player * p, signed char gfx_nr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* find a free bomb */
|
|
|
|
|
int player_findfreebomb (_player *player) {
|
|
|
|
|
int i, bombused = 0, res = -1, nr;
|
|
|
|
|
int
|
|
|
|
|
player_findfreebomb (_player * player)
|
|
|
|
|
{
|
|
|
|
|
int i,
|
|
|
|
|
bombused = 0,
|
|
|
|
|
res = -1,
|
|
|
|
|
nr;
|
|
|
|
|
|
|
|
|
|
/* check every free bomb from next entry of the last
|
|
|
|
|
exploded bomb to the last exploded bomb */
|
|
|
|
|