Liquid and Moving bomb special added

origin
stpohle 22 years ago
parent 3ebf72b4d7
commit 32165ca1fe

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.49 2003/08/27 21:14:50 stpohle Exp $ */
/* $Id: basic.h,v 1.50 2003/08/29 22:04:19 stpohle Exp $ */
/* basic types which we need everywhere */
#ifndef _BC_BASIC_H_
@ -13,9 +13,6 @@
#define GAME_SPECIAL_ITEMSTRIGGER 3
#define GAME_SPECIAL_ITEMSROW 3
#define GAME_SPECIAL_ITEMSPUSH 3
#define GAME_SPECIAL_ITEMSKICK 0 // no use yet
#define GAME_SPECIAL_ITEMSLIQUID 0 // no use yet
#define GAME_SPECIAL_ITEMSDESTROY 0 // no use yet
#define GAME_MAX_TUNNELS 4 // number of tunnel entrys
#define GAME_TIMEOUT 30000 // game timeout 10min)
#define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min)
@ -28,10 +25,7 @@
#define SPECIAL_TRIGGER_TIME 25
#define SPECIAL_ROW_TIME 30
#define SPECIAL_PUSH_TIME 50
#define SPECIAL_KICK_NUMUSE 8
#define SPECIAL_LIQUID_NUMUSE 8
#define SPECIAL_DESTROY_NUMUSE 5
#define SPECIAL_8WAY_NUMUSE 10
// #define SPECIAL_DESTROY_NUMUSE 5
#define START_BOMBS 1
#define START_RANGE 2
@ -141,7 +135,8 @@ enum _fieldtype {
FT_sp_trigger, // The Triggered bomb Special
FT_sp_row, // The bomb-row special
FT_sp_push, // The push-boms special
FT_sp_kick, // The kick-boms special
FT_sp_moved, // The moved-boms special
FT_sp_liquid, // The liquid-bomb special
FT_max // just to know how many types there are
};
@ -159,7 +154,8 @@ enum _special {
SP_trigger, // triggered bomb
SP_row, // bomb row
SP_push, // push bombs
SP_kick, // kick bombs
SP_moved, // moved bombs
SP_liquid, // liquid bombs
SP_max // just to know how many types there are
};
@ -174,7 +170,6 @@ enum _playerillnestype {
PI_bomb, // player is dropping bombs permanently
PI_nobomb, // player cannot drop a bomb or only 1 bomb
PI_max // just to know what is the last number
};
@ -191,6 +186,7 @@ enum _bombmode {
BM_normal = 0,
BM_pushed,
BM_moving,
BM_liquid,
BM_kicked
};

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.41 2003/08/27 21:14:50 stpohle Exp $ */
/* $Id: bomb.c,v 1.42 2003/08/29 22:04:19 stpohle Exp $ */
/* everything what have to do with the bombs */
#include "bomberclone.h"
@ -118,12 +118,29 @@ bomb_move (_bomb * bomb)
if (((bomb->pos.x & 0xFF) == 0) && ((bomb->pos.y & 0xFF) == 0)) {
if (bomb->mode == BM_pushed)
bomb->mode = BM_normal;
else if (bomb->mode == BM_moving) {
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
/* it is a moving liquid bomb so check for another field */
_point b, d;
b.x = bomb->pos.x >> 8;
b.y = bomb->pos.y >> 8;
d.x = b.x + bomb->dest.x;
d.y = b.y + bomb->dest.y;
if (map.bfield[d.x][d.y] == 0 && (map.field[d.x][d.y].type == FT_nothing || map.field[d.x][d.y].type == FT_tunnel)) {
/* this direction is still oky */
map.bfield[d.x][d.y]++;
map.bfield[b.x][b.y]--;
keepdir = 1;
}
else {
keepdir = 0;
bomb->mode = BM_normal;
}
}
} while (dist < bomb->speed && bomb->mode == BM_moving && keepdir);
}
dist += step;
} while (dist < bomb->speed && (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir);
}
@ -313,6 +330,9 @@ restore_explosion (_bomb * bomb)
_y = bpos.y;
/* delete field from the bfield map */
if (bomb->mode == BM_moving || bomb->mode == BM_pushed || bomb->mode == BM_liquid)
map.bfield[bpos.x + bomb->dest.x][bpos.y + bomb->dest.y] = 0;
else
map.bfield[bpos.x][bpos.y] = 0;
};
@ -486,6 +506,7 @@ do_explosion (int p, int b)
inline void bomb_action (_bomb *bomb) {
switch (bomb->mode) {
case (BM_moving):
case (BM_liquid):
case (BM_pushed):
bomb_move (bomb);
break;

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.52 2003/08/27 21:14:50 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.53 2003/08/29 22:04:19 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -282,6 +282,10 @@ extern void special_use (int p_nr);
extern void special_pickup (int p_nr, int s_type);
extern void special_loop ();
extern void special_clear (int p_nr);
extern void special_push (int p_nr);
extern void special_row (int p_nr);
extern void special_trigger (int p_nr);
extern void special_liquidmoved (int p_nr);
extern void tileset_load (char *tileset);
extern void tileset_random ();

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.45 2003/08/27 21:14:50 stpohle Exp $ */
/* $Id: field.c,v 1.46 2003/08/29 22:04:19 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */
#include "bomberclone.h"
@ -187,6 +187,9 @@ draw_stone (int x, int y)
draw_fire (x, y, d, -1);
}
if (debug)
font_gfxdraw (dest.x, dest.y, (map.bfield[x][y] == 0) ? "0" : "1", 0, (y << 8) - 6);
return;
};

@ -1,4 +1,4 @@
/* $Id: map.c,v 1.9 2003/08/10 21:10:07 stpohle Exp $ */
/* $Id: map.c,v 1.10 2003/08/29 22:04:19 stpohle Exp $ */
/* map handling, like generate and load maps. */
#include "bomberclone.h"
@ -115,9 +115,9 @@ map_new (char *filename)
/* put the row special in the field */
map_fillitems (FT_sp_row, map.sp_row);
/* put the push special in the field */
map_fillitems (FT_sp_push, map.sp_push);
/* put the kick special in the field */
// map_fillitems (FT_sp_kick, GAME_SPECIAL_ITEMSKICK);
map_fillitems (FT_sp_push, map.sp_push/3);
map_fillitems (FT_sp_liquid, map.sp_push/3);
map_fillitems (FT_sp_moved, map.sp_push/3);
map.type = old_maptype;
}

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.4 2003/08/10 15:10:19 stpohle Exp $ */
/* $Id: map.h,v 1.5 2003/08/29 22:04:19 stpohle Exp $ */
/* map.h */
#ifndef _MAP_H_
@ -41,7 +41,6 @@ struct __map {
unsigned char sp_trigger;
unsigned char sp_push;
unsigned char sp_row;
unsigned char state; // state of the map
} typedef _map;

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.9 2003/08/24 19:01:30 stpohle Exp $ */
/* $Id: mapmenu.c,v 1.10 2003/08/29 22:04:19 stpohle Exp $ */
/* map/tileset selection menu */
#include "bomberclone.h"
@ -27,9 +27,10 @@ mapmenu ()
{10, "Mixed:"},
{11, "Death:"},
{12, "Special Trigger :"},
{13, "Special Push :"},
{13, "Special Push Liq. Moved:"},
{14, "Special Row :"},
{15, "Maptype: Random"},
{0, ""},
{16, "Maptype: Random"},
{0, ""},
{15, "Return To Previous Menu"},
{-1, ""}
@ -100,13 +101,13 @@ mapmenu ()
switch (map.type) {
case (MAPT_normal):
sprintf (menu[15].text, "Maptype: NORMAL");
sprintf (menu[16].text, "Maptype: NORMAL");
break;
case (MAPT_tunnel):
sprintf (menu[15].text, "Maptype: TUNNEL");
sprintf (menu[16].text, "Maptype: TUNNEL");
break;
default:
sprintf (menu[15].text, "Maptype: RANDOM");
sprintf (menu[16].text, "Maptype: RANDOM");
break;
}
@ -221,12 +222,12 @@ mapmenu ()
menu_get_text ("Row Specials", text, 2);
map.sp_row = atoi (text);
break;
case (15):
case (16):
map.type++;
if (map.type >= MAPT_max)
map.type = MAPT_random;
break;
case (17): // Return to previous menu
case (18): // Return to previous menu
menuselect = -1;
break;
}

@ -198,7 +198,8 @@ player_check_powerup (int p_nr)
case FT_sp_trigger:
case FT_sp_row:
case FT_sp_push:
case FT_sp_kick:
case FT_sp_moved:
case FT_sp_liquid:
special_pickup (p_nr, ft - FT_sp_trigger + 1);
bman.updatestatusbar = 1;
field_clear (fx, fy);

@ -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);
@ -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)
{
@ -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;

@ -1,4 +1,4 @@
/* $Id: tileset.c,v 1.7 2003/08/10 15:10:19 stpohle Exp $ */
/* $Id: tileset.c,v 1.8 2003/08/29 22:04:19 stpohle Exp $ */
/* load and select tilesets */
#include "bomberclone.h"
@ -190,9 +190,11 @@ tileset_load (char *tilesetname)
case (FT_sp_push):
sprintf (filename, "sppush");
break;
case (FT_sp_kick):
sprintf (filename, "spkick");
continue; // remove this if you find a kick image
case (FT_sp_moved):
sprintf (filename, "spmoved");
break;
case (FT_sp_liquid):
sprintf (filename, "spliquid");
break;
}
if (i != FT_mixed) {

Loading…
Cancel
Save