|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: single.c,v 1.11 2003/05/11 17:27:30 stpohle Exp $ */
|
|
|
|
|
/* $Id: single.c,v 1.12 2003/05/11 23:32:42 stpohle Exp $ */
|
|
|
|
|
/* single player */
|
|
|
|
|
|
|
|
|
|
#include "basic.h"
|
|
|
|
@ -60,6 +60,38 @@ single_game_new ()
|
|
|
|
|
bman.state = GS_running;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* check if is there is a bom in the near
|
|
|
|
|
returns the directions (bits 0(left)-3(down)) where a bomb is */
|
|
|
|
|
int ai_findnearbombs (_player *pl) {
|
|
|
|
|
int d,
|
|
|
|
|
res = 0, // result if there is a bomb
|
|
|
|
|
dist[4][3]; // to check every direction (on three ways)
|
|
|
|
|
_point m[4]; // direction addition
|
|
|
|
|
|
|
|
|
|
for (d = 0; d < 4; d++) {
|
|
|
|
|
switch (d) {
|
|
|
|
|
case (left):
|
|
|
|
|
m[d].x = -1;
|
|
|
|
|
m[d].y = 0;
|
|
|
|
|
break;
|
|
|
|
|
case (right):
|
|
|
|
|
m[d].x = 1;
|
|
|
|
|
m[d].y = 0;
|
|
|
|
|
break;
|
|
|
|
|
case (up):
|
|
|
|
|
m[d].x = 0;
|
|
|
|
|
m[d].y = -1;
|
|
|
|
|
break;
|
|
|
|
|
case (down):
|
|
|
|
|
m[d].x = 0;
|
|
|
|
|
m[d].y = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
single_loop ()
|
|
|
|
@ -70,6 +102,7 @@ single_loop ()
|
|
|
|
|
for (p = 0; p < MAX_PLAYERS; p++)
|
|
|
|
|
if (p != bman.p_nr && PS_IS_playing (bman.players[p].state)) {
|
|
|
|
|
pl = &bman.players[p];
|
|
|
|
|
|
|
|
|
|
player_ilness_loop (p);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -105,7 +138,7 @@ void single_playergame () {
|
|
|
|
|
for (p = 0; p < MAX_PLAYERS; p++)
|
|
|
|
|
bman.players[p].state = 0;
|
|
|
|
|
|
|
|
|
|
single_create_ai (4);
|
|
|
|
|
// single_create_ai (4);
|
|
|
|
|
single_game_new ();
|
|
|
|
|
gfx_game_init ();
|
|
|
|
|
game_loop ();
|
|
|
|
|