|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
/* player.c - everything what have to do with the player */
|
|
|
|
|
/* $Id: player.c,v 1.55 2004/01/02 13:54:48 stpohle Exp $
|
|
|
|
|
* player.c - everything what have to do with the player */
|
|
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
#include "bomberclone.h"
|
|
|
|
@ -213,7 +214,7 @@ player_check_powerup (int p_nr)
|
|
|
|
|
int
|
|
|
|
|
check_field (short int x, short int y)
|
|
|
|
|
{
|
|
|
|
|
int res = 0;
|
|
|
|
|
int res = 0, i;
|
|
|
|
|
|
|
|
|
|
if (map.field[x][y].type != FT_stone && map.field[x][y].type != FT_block)
|
|
|
|
|
res = 1;
|
|
|
|
@ -222,6 +223,18 @@ check_field (short int x, short int y)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* check if there is any explosion on this field */
|
|
|
|
|
int check_exfield (short int x, short int y) {
|
|
|
|
|
int res = 1, i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; (i < 4 && res == 1); i++)
|
|
|
|
|
if (map.field[x][y].ex[i].count > 0)
|
|
|
|
|
res = 0;
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* make only a smal step until i can go around the corner
|
|
|
|
|
return the rest speed for this move */
|
|
|
|
|
int
|
|
|
|
@ -400,15 +413,15 @@ move_player (int pl_nr)
|
|
|
|
|
|
|
|
|
|
/* check the players position */
|
|
|
|
|
if ((CUTINT(p->pos.x) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right))
|
|
|
|
|
&& (!check_field (p->pos.x + 1.0f, p->pos.y)))
|
|
|
|
|
&& (!check_exfield (p->pos.x + 1.0f, p->pos.y)))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
if ((CUTINT(p->pos.y) > EXPLOSION_SAVE_DISTANCE && (p->d == up || p->d == down))
|
|
|
|
|
&& (!check_field (p->pos.x, p->pos.y + 1.0f)))
|
|
|
|
|
&& (!check_exfield (p->pos.x, p->pos.y + 1.0f)))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
if (((CUTINT(p->pos.x) < (1.0f - EXPLOSION_SAVE_DISTANCE) && (p->d == left || p->d == right))
|
|
|
|
|
|| (CUTINT(p->pos.y) < (1.0f - EXPLOSION_SAVE_DISTANCE)
|
|
|
|
|
&& (p->d == up || p->d == down)))
|
|
|
|
|
&& (!check_field (p->pos.x, p->pos.y)))
|
|
|
|
|
&& (!check_exfield (p->pos.x, p->pos.y)))
|
|
|
|
|
player_died (p, -1);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|