|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: special.c,v 1.25 2003/08/27 21:14:50 stpohle Exp $ */
|
|
|
|
|
/* $Id: special.c,v 1.26 2003/08/29 22:04:19 stpohle Exp $ */
|
|
|
|
|
/* special.c - procedues to control the specials */
|
|
|
|
|
|
|
|
|
|
#include "bomberclone.h"
|
|
|
|
@ -88,6 +88,76 @@ special_row (int p_nr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
special_liquidmoved (int p_nr)
|
|
|
|
|
{
|
|
|
|
|
_bomb *b = NULL;
|
|
|
|
|
_player *p = &bman.players[p_nr];
|
|
|
|
|
_point bombs[MAX_PLAYERS * MAX_BOMBS];
|
|
|
|
|
|
|
|
|
|
int x = p->pos.x >> 8,
|
|
|
|
|
y = p->pos.y >> 8,
|
|
|
|
|
dx = 0,
|
|
|
|
|
dy = 0,
|
|
|
|
|
x1,
|
|
|
|
|
y1,
|
|
|
|
|
i;
|
|
|
|
|
|
|
|
|
|
if ((p->pos.x & 0xff) || (p->pos.y & 0xff)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (p->d) {
|
|
|
|
|
case left:
|
|
|
|
|
dx = -1;
|
|
|
|
|
break;
|
|
|
|
|
case right:
|
|
|
|
|
dx = 1;
|
|
|
|
|
break;
|
|
|
|
|
case up:
|
|
|
|
|
dy = -1;
|
|
|
|
|
break;
|
|
|
|
|
case down:
|
|
|
|
|
dy = +1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
x += dx;
|
|
|
|
|
y += dy;
|
|
|
|
|
|
|
|
|
|
// check that player is beside a bomb
|
|
|
|
|
if (!map.bfield[x][y])
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
x1 = x + dx;
|
|
|
|
|
y1 = y + dy;
|
|
|
|
|
|
|
|
|
|
// check the field behind the bomb
|
|
|
|
|
if (map.bfield[x1][y1]
|
|
|
|
|
|| (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
get_bomb_on (x << 8, y << 8, bombs);
|
|
|
|
|
// move all bombs on that field (there should be only 1)
|
|
|
|
|
for (i = 0; bombs[i].x != -1; i++) {
|
|
|
|
|
b = &bman.players[bombs[i].x].bombs[bombs[i].y];
|
|
|
|
|
if (b->state != BS_exploding) {
|
|
|
|
|
b->dest.x = dx;
|
|
|
|
|
b->dest.y = dy;
|
|
|
|
|
b->speed = p->speed;
|
|
|
|
|
if (p->special.type == SP_liquid)
|
|
|
|
|
b->mode = BM_liquid;
|
|
|
|
|
else
|
|
|
|
|
b->mode = BM_moving;
|
|
|
|
|
map.bfield[x][y] = 0;
|
|
|
|
|
map.bfield[x1][y1] = 1;
|
|
|
|
|
stonelist_add (x, y);
|
|
|
|
|
if (bman.gametype != GT_single) {
|
|
|
|
|
net_game_send_bomb (bombs[i].x, bombs[i].y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
special_push (int p_nr)
|
|
|
|
|
{
|
|
|
|
@ -131,7 +201,8 @@ special_push (int p_nr)
|
|
|
|
|
y1 = y + dy;
|
|
|
|
|
|
|
|
|
|
// check the field behind the bomb
|
|
|
|
|
if (map.bfield[x1][y1] || (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
|
|
|
|
|
if (map.bfield[x1][y1]
|
|
|
|
|
|| (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
get_bomb_on (x << 8, y << 8, bombs);
|
|
|
|
@ -142,7 +213,7 @@ special_push (int p_nr)
|
|
|
|
|
b->dest.x = dx;
|
|
|
|
|
b->dest.y = dy;
|
|
|
|
|
b->speed = p->speed;
|
|
|
|
|
b->mode = BM_pushed;
|
|
|
|
|
b->mode = BM_pushed;
|
|
|
|
|
map.bfield[x][y] = 0;
|
|
|
|
|
map.bfield[x1][y1] = 1;
|
|
|
|
|
stonelist_add (x, y);
|
|
|
|
@ -171,6 +242,8 @@ special_pickup (int p_nr, int s_nr)
|
|
|
|
|
s->to = SPECIAL_ROW_TIME * TIME_FACTOR;
|
|
|
|
|
break;
|
|
|
|
|
case SP_push:
|
|
|
|
|
case SP_moved:
|
|
|
|
|
case SP_liquid:
|
|
|
|
|
s->to = SPECIAL_PUSH_TIME * TIME_FACTOR;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -178,6 +251,7 @@ special_pickup (int p_nr, int s_nr)
|
|
|
|
|
bman.updatestatusbar = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
special_clear (int p_nr)
|
|
|
|
|
{
|
|
|
|
@ -208,7 +282,7 @@ special_loop ()
|
|
|
|
|
int p_nr;
|
|
|
|
|
|
|
|
|
|
for (p_nr = 0; p_nr < MAX_PLAYERS; p_nr++) {
|
|
|
|
|
s = &bman.players[p_nr].special;
|
|
|
|
|
s = &bman.players[p_nr].special;
|
|
|
|
|
|
|
|
|
|
if (s->use) {
|
|
|
|
|
switch (s->type) {
|
|
|
|
@ -223,7 +297,10 @@ special_loop ()
|
|
|
|
|
if (bman.players[p_nr].m)
|
|
|
|
|
special_push (p_nr);
|
|
|
|
|
break;
|
|
|
|
|
case SP_kick:
|
|
|
|
|
case SP_liquid:
|
|
|
|
|
case SP_moved:
|
|
|
|
|
if (bman.players[p_nr].m)
|
|
|
|
|
special_liquidmoved (p_nr);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
s->use = 0;
|
|
|
|
|