|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: single.c,v 1.18 2003/05/25 22:06:33 stpohle Exp $ */
|
|
|
|
|
/* $Id: single.c,v 1.19 2003/05/25 22:24:47 stpohle Exp $ */
|
|
|
|
|
/* single player */
|
|
|
|
|
|
|
|
|
|
#include "basic.h"
|
|
|
|
@ -315,8 +315,47 @@ ai_fleefrombomb (_point pos, int nearbomb, int range)
|
|
|
|
|
int d = 0,
|
|
|
|
|
dir = -1;
|
|
|
|
|
|
|
|
|
|
if (nearbomb != 0)
|
|
|
|
|
dir = ai_runawayfrom (pos, range);
|
|
|
|
|
if ((nearbomb & 3) != 0) { // bomb is in the same row.. try to go up down
|
|
|
|
|
if (s_random (2) == 0 || (nearbomb & 4) != 0)
|
|
|
|
|
d = 1;
|
|
|
|
|
if (bman.field[pos.x][pos.y + d].type == FT_nothing) {
|
|
|
|
|
if (d == 1)
|
|
|
|
|
dir = down;
|
|
|
|
|
else
|
|
|
|
|
dir = up;
|
|
|
|
|
}
|
|
|
|
|
else if (bman.field[pos.x][pos.y - d].type == FT_nothing) {
|
|
|
|
|
if (d == 1)
|
|
|
|
|
dir = up;
|
|
|
|
|
else
|
|
|
|
|
dir = down;
|
|
|
|
|
}
|
|
|
|
|
else if ((nearbomb & 1) == 0)
|
|
|
|
|
dir = left;
|
|
|
|
|
else if ((nearbomb & 2) == 0)
|
|
|
|
|
dir = right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if ((nearbomb & 12) != 0) { // bomb is updown from us
|
|
|
|
|
if (s_random (2) == 0 || (nearbomb & 1) != 0)
|
|
|
|
|
d = 1;
|
|
|
|
|
if (bman.field[pos.x + d][pos.y].type == FT_nothing) {
|
|
|
|
|
if (d == 1)
|
|
|
|
|
dir = right;
|
|
|
|
|
else
|
|
|
|
|
dir = left;
|
|
|
|
|
}
|
|
|
|
|
else if (bman.field[pos.x - d][pos.y].type == FT_nothing) {
|
|
|
|
|
if (d == 1)
|
|
|
|
|
dir = left;
|
|
|
|
|
else
|
|
|
|
|
dir = right;
|
|
|
|
|
}
|
|
|
|
|
else if ((nearbomb & 4) == 0)
|
|
|
|
|
dir = up;
|
|
|
|
|
else if ((nearbomb & 8) == 0)
|
|
|
|
|
dir = down;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dir == -1)
|
|
|
|
|
dir = s_random (4);
|
|
|
|
@ -327,7 +366,9 @@ ai_fleefrombomb (_point pos, int nearbomb, int range)
|
|
|
|
|
|
|
|
|
|
/* check if we are still running and fill out the position
|
|
|
|
|
return == 0 we're still walking ... else we have reached a point */
|
|
|
|
|
int ai_checkpos (_player *pl, _point *pos) {
|
|
|
|
|
int
|
|
|
|
|
ai_checkpos (_player * pl, _point * pos)
|
|
|
|
|
{
|
|
|
|
|
_point _p;
|
|
|
|
|
|
|
|
|
|
_p.x = pl->pos.x & 255;
|
|
|
|
@ -361,7 +402,8 @@ single_loop ()
|
|
|
|
|
|
|
|
|
|
i = ai_checkpos (pl, &plpos);
|
|
|
|
|
|
|
|
|
|
d_printf ("single_loop pos:%d,%d nearbomb:%d bestbombdir:%d, checkpos: %d\n", plpos.x, plpos.y, nearbomb, bestbombdir, i);
|
|
|
|
|
d_printf ("single_loop pos:%d,%d nearbomb:%d bestbombdir:%d, checkpos: %d\n", plpos.x,
|
|
|
|
|
plpos.y, nearbomb, bestbombdir, i);
|
|
|
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
|
/* we're still moving */
|
|
|
|
|