Tunnels added to the game..

MAPT_normal for a normal game
MAPT_tunnel for a game with tunnels (only set during ceation of the map)
origin
stpohle 22 years ago
parent 78888ab433
commit 494a2137bb

@ -1,8 +1,15 @@
$Id: ChangeLog,v 1.36 2003/07/29 23:20:13 stpohle Exp $ $Id: ChangeLog,v 1.37 2003/08/10 15:10:19 stpohle Exp $
- tunnels added
- the first music file added to the game made by - the first music file added to the game made by
Digital_D <siggy_stardust@hotmail.com> Digital_D <siggy_stardust@hotmail.com>
the music files will be played out of the music
directory randomly
- chat windows size will be bigger in multiplayer
games and in single games the space for the chat
window is used for the gamefield size.
Version 0.10.0 Version 0.10.0

@ -4,7 +4,7 @@ dnl If you don't want it to overwrite it,
dnl Please disable it in the Anjuta project configuration dnl Please disable it in the Anjuta project configuration
AC_INIT(configure.in) AC_INIT(configure.in)
AM_INIT_AUTOMAKE(bomberclone, 0.10.0) AM_INIT_AUTOMAKE(bomberclone, 0.10.1)
AM_CONFIG_HEADER AM_CONFIG_HEADER
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.46 2003/07/27 21:09:57 stpohle Exp $ */ /* $Id: basic.h,v 1.47 2003/08/10 15:10:19 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -16,8 +16,11 @@
#define GAME_SPECIAL_ITEMSKICK 0 // no use yet #define GAME_SPECIAL_ITEMSKICK 0 // no use yet
#define GAME_SPECIAL_ITEMSLIQUID 0 // no use yet #define GAME_SPECIAL_ITEMSLIQUID 0 // no use yet
#define GAME_SPECIAL_ITEMSDESTROY 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_TIMEOUT 30000 // game timeout 10min)
#define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min) #define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min)
#define GAME_TUNNEL_TO 50 /* wait 5 game cycls before move and show
player again */
#define EXPLOSION_SAVE_DISTANCE 64 #define EXPLOSION_SAVE_DISTANCE 64
#define SPECIAL_TRIGGER_TIMEOUT 15 #define SPECIAL_TRIGGER_TIMEOUT 15
@ -116,10 +119,19 @@ enum _gamestate {
}; };
enum _maptype {
MAPT_normal = 0, // a normal map
MAPT_tunnel, // a map with tunnels
MAPT_max
};
enum _fieldtype { enum _fieldtype {
FT_nothing = 0, // Nothing in here FT_nothing = 0, // Nothing in here
FT_stone, // Stones you can bomb away FT_stone, // Stones you can bomb away
FT_block, // Stones which can't bomb away FT_block, // Stones which can't bomb away
FT_tunnel, // the tunnel item
FT_death, // The bad Powerup FT_death, // The bad Powerup
FT_fire, // The fire Powerup FT_fire, // The fire Powerup
FT_bomb, // The bomb Powerup FT_bomb, // The bomb Powerup

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.38 2003/07/27 14:34:39 stpohle Exp $ */ /* $Id: bomb.c,v 1.39 2003/08/10 15:10:19 stpohle Exp $ */
/* everything what have to do with the bombs */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -300,6 +300,7 @@ restore_explosion (_bomb * bomb)
// delete the stone completly if there was any in the way // delete the stone completly if there was any in the way
if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block
&& map.field[_x][_y].type != FT_tunnel
&& bomb->ex_nr != map.field[_x][_y].ex_nr) { && bomb->ex_nr != map.field[_x][_y].ex_nr) {
map.field[_x][_y].ex_nr = bomb->ex_nr; map.field[_x][_y].ex_nr = bomb->ex_nr;
@ -365,7 +366,7 @@ explosion_check_field (int x, int y, int p, int b)
} }
// let the stones right beside explode // let the stones right beside explode
if (map.field[x][y].type != FT_nothing if (map.field[x][y].type != FT_nothing && map.field[x][y].type != FT_tunnel
&& map.field[x][y].type != FT_block && bomb->ex_nr != map.field[x][y].ex_nr) && map.field[x][y].type != FT_block && bomb->ex_nr != map.field[x][y].ex_nr)
if (map.field[x][y].frame == 0) { if (map.field[x][y].frame == 0) {
map.field[x][y].frameto = ANI_STONETIMEOUT; map.field[x][y].frameto = ANI_STONETIMEOUT;
@ -466,11 +467,14 @@ do_explosion (int p, int b)
} }
if (bomb->firer[d] <= bomb->r) { if (bomb->firer[d] <= bomb->r) {
int checkfield;
dx = bomb->firer[d] * dx; dx = bomb->firer[d] * dx;
dy = bomb->firer[d] * dy; dy = bomb->firer[d] * dy;
if (explosion_check_field (bpos.x + dx, bpos.y + dy, p, b) == checkfield = explosion_check_field (bpos.x + dx, bpos.y + dy, p, b);
BS_off && bomb->firerst[d] == -1) { if ((checkfield == FT_nothing || checkfield == FT_tunnel)
&& bomb->firerst[d] == -1) {
bomb->firer[d]++; bomb->firer[d]++;
map.field[bpos.x + dx][bpos.y + dy].ex[d].count++; map.field[bpos.x + dx][bpos.y + dy].ex[d].count++;
map.field[bpos.x + dx][bpos.y + dy].ex[d].frame = bomb->firer[d]; map.field[bpos.x + dx][bpos.y + dy].ex[d].frame = bomb->firer[d];

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.49 2003/07/27 14:34:40 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.50 2003/08/10 15:10:19 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -90,6 +90,9 @@ struct __player {
_point pos; /* position (without the offset) _point pos; /* position (without the offset)
_x = pos.x & 255; fx = pos.x >> 8; */ _x = pos.x & 255; fx = pos.x >> 8; */
_point old; // the old position _point old; // the old position
int tunnelto; /* timeout for dont show and move player
needed on the tunnel effect */
signed char d; // direction signed char d; // direction
signed char m; // player is moving ? signed char m; // player is moving ?
signed char old_m; // to save the old state.. signed char old_m; // to save the old state..

@ -56,6 +56,7 @@ game_init (int argc, char **argv)
printf ("DataPath: %s\n", bman.datapath); printf ("DataPath: %s\n", bman.datapath);
map.map[0] = 0; map.map[0] = 0;
map.map_selection = 2; map.map_selection = 2;
map.type = -1;
bman.firewall = 0; bman.firewall = 0;
bman.broadcasted_chat = 1; bman.broadcasted_chat = 1;
bman.ai_players = 1; bman.ai_players = 1;

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.42 2003/07/27 21:09:57 stpohle Exp $ */ /* $Id: field.c,v 1.43 2003/08/10 15:10:19 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */ /* field.c - procedures which are needed to control the field */
#include "bomberclone.h" #include "bomberclone.h"
@ -95,7 +95,7 @@ draw_stone (int x, int y)
src.x = 0; src.x = 0;
/* draw background if we have a stone, block or nothing */ /* draw background if we have a stone, block or nothing */
if (stone->type <= FT_block) { if (stone->type <= FT_tunnel) {
SDL_Rect srcbg; SDL_Rect srcbg;
srcbg.w = dest.w; srcbg.w = dest.w;
@ -130,7 +130,7 @@ draw_stone (int x, int y)
} }
} }
else if (stone->type == FT_stone || stone->type == FT_block) { else if (stone->type > FT_nothing && stone->type < FT_death) {
src.y = stone->frame * gfx.field[stone->type].h; src.y = stone->frame * gfx.field[stone->type].h;
dest.h = src.h = gfx.field[stone->type].h; dest.h = src.h = gfx.field[stone->type].h;
dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w); dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w);
@ -153,8 +153,10 @@ draw_stone (int x, int y)
src.y = stone->frame * gfx.block.y; src.y = stone->frame * gfx.block.y;
} }
if (srcimg != NULL) if (srcimg != NULL && stone->type != FT_tunnel)
gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 1); gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 1);
else if (srcimg != NULL && stone->type == FT_tunnel)
gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) - 1);
if (i >= FT_death) { /* draw now the powerup itself */ if (i >= FT_death) { /* draw now the powerup itself */
srcimg = gfx.field[i].image; srcimg = gfx.field[i].image;

@ -1,11 +1,11 @@
/* $Id: map.c,v 1.6 2003/07/27 21:09:57 stpohle Exp $ */ /* $Id: map.c,v 1.7 2003/08/10 15:10:19 stpohle Exp $ */
/* map handling, like generate and load maps. */ /* map handling, like generate and load maps. */
#include "bomberclone.h" #include "bomberclone.h"
_map map; _map map;
// put items into the field // put the special items into the field
void void
map_fillitems (int fieldtype, int num) map_fillitems (int fieldtype, int num)
{ {
@ -16,11 +16,10 @@ map_fillitems (int fieldtype, int num)
/* this is the item factor we multiply it with this so we know /* this is the item factor we multiply it with this so we know
how much items we want in the game */ how much items we want in the game */
float fkt = ((float) (map.size.x * map.size.y)) / (25.0 * 17.0); float fkt = ((float) (map.size.x * map.size.y)) / (25.0 * 17.0);
/* put the row special in the field */
for (d = 0; d < num * fkt; d++) { for (d = 0; d < num * fkt; d++) {
x = y = 0; x = y = 0;
while (map.field[x][y].type != FT_stone || map.field[x][y].special != FT_nothing) { while (map.field[x][y].type != FT_tunnel && map.field[x][y].type != FT_stone && map.field[x][y].special != FT_nothing) {
x = ((float) rand () / (float) RAND_MAX) * (map.size.x - 1); x = ((float) rand () / (float) RAND_MAX) * (map.size.x - 1);
y = ((float) rand () / (float) RAND_MAX) * (map.size.y - 1); y = ((float) rand () / (float) RAND_MAX) * (map.size.y - 1);
nb_try--; nb_try--;
@ -39,12 +38,13 @@ map_new (char *filename)
int x, int x,
y; y;
FILE *fmap; FILE *fmap;
signed char old_maptype = map.type;
if (filename) { if (filename) {
fmap = fopen (filename, "r"); fmap = fopen (filename, "r");
/* if we can't open the given filename for any reason, reverting /* if we can't open the given filename for any reason, reverting
to default value else, load the file */ to default value else, load the file map*/
if (fmap) if (fmap)
map_load (fmap); map_load (fmap);
} }
@ -55,6 +55,44 @@ map_new (char *filename)
if (fmap == NULL) if (fmap == NULL)
map_genrandom (); map_genrandom ();
map.type = 1;
if (map.type == -1)
map.type = s_random (MAPT_max);
if (map.type == MAPT_tunnel) {
/* insert tunnels */
for (x = 0; x < GAME_MAX_TUNNELS; x++)
map.tunnel[x].x = map.tunnel[x].y = -1;
map.field[3][3].type = FT_tunnel;
map.field[3][3].special = 0;
map.field[map.size.x - 4][map.size.y - 4].type = FT_tunnel;
map.field[map.size.x - 4][map.size.y - 4].special = 1;
if (map.size.y > 12) {
map.field[map.size.x - 4][3].type = FT_tunnel;
map.field[map.size.x - 4][3].special = 2;
map.field[3][map.size.y - 4].type = FT_tunnel;
map.field[3][map.size.y - 4].special = 3;
map.tunnel[0].x = map.size.x - 4;
map.tunnel[0].y = 3;
map.tunnel[1].x = 3;
map.tunnel[1].y = map.size.y - 4;
map.tunnel[2].x = map.size.x - 4;
map.tunnel[2].y = map.size.y - 4;
map.tunnel[3].x = 3;
map.tunnel[3].y = 3;
}
else {
map.tunnel[0].x = map.size.x - 4;
map.tunnel[0].y = map.size.y - 4;
map.tunnel[1].x = 3;
map.tunnel[1].y = 3;
}
}
/* delete the bfield data */ /* delete the bfield data */
for (x = 0; x < MAX_FIELDSIZE_X; x++) for (x = 0; x < MAX_FIELDSIZE_X; x++)
for (y = 0; y < MAX_FIELDSIZE_Y; y++) for (y = 0; y < MAX_FIELDSIZE_Y; y++)
@ -81,6 +119,8 @@ map_new (char *filename)
map_fillitems (FT_sp_push, map.sp_push); map_fillitems (FT_sp_push, map.sp_push);
/* put the kick special in the field */ /* put the kick special in the field */
// map_fillitems (FT_sp_kick, GAME_SPECIAL_ITEMSKICK); // map_fillitems (FT_sp_kick, GAME_SPECIAL_ITEMSKICK);
map.type = old_maptype;
} }
void void
@ -195,8 +235,11 @@ map_set_playerposition (int usermap)
/* make some space */ /* make some space */
if (PLX != -1 && PLY != -1) { if (PLX != -1 && PLY != -1) {
if (map.field[PLX][PLY].type != FT_tunnel)
map.field[PLX][PLY].type = FT_nothing; map.field[PLX][PLY].type = FT_nothing;
if (map.field[PLX + dx][PLY].type != FT_tunnel)
map.field[PLX + dx][PLY].type = FT_nothing; map.field[PLX + dx][PLY].type = FT_nothing;
if (map.field[PLX][PLY + dy].type != FT_tunnel)
map.field[PLX][PLY + dy].type = FT_nothing; map.field[PLX][PLY + dy].type = FT_nothing;
} }
} }

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.3 2003/07/27 13:29:25 stpohle Exp $ */ /* $Id: map.h,v 1.4 2003/08/10 15:10:19 stpohle Exp $ */
/* map.h */ /* map.h */
#ifndef _MAP_H_ #ifndef _MAP_H_
@ -15,7 +15,7 @@ struct __field {
signed char mixframe; // data for the mixed frame signed char mixframe; // data for the mixed frame
short int frame; // frame (frame > 0 && FS_stone) short int frame; // frame (frame > 0 && FS_stone)
int frameto; // frame to int frameto; // frame to
unsigned char special; // to save special stones unsigned char special; // to save special stones, or the tunnel number
_ex_field ex[4]; // count up every explosion there is on this field for ever direction _ex_field ex[4]; // count up every explosion there is on this field for ever direction
int ex_nr; // number to identify the explosion. int ex_nr; // number to identify the explosion.
} typedef _field; } typedef _field;
@ -25,13 +25,14 @@ struct __map {
_point size; // dimension of the field _point size; // dimension of the field
_field field[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y]; _field field[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y];
_point tunnel[GAME_MAX_TUNNELS]; // save the destination of the tunnel
unsigned char bfield[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y]; // will hold informations if ther is a bomb unsigned char bfield[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y]; // will hold informations if ther is a bomb
char tileset [LEN_TILESETNAME]; char tileset [LEN_TILESETNAME];
signed char random_tileset; signed char random_tileset;
char map [LEN_PATHFILENAME]; char map [LEN_PATHFILENAME];
signed char map_selection; signed char map_selection;
signed char type; // type of the map (MAPT_*);
unsigned char bombs; unsigned char bombs;
unsigned char fire; unsigned char fire;
unsigned char shoes; unsigned char shoes;

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.38 2003/07/27 13:29:25 stpohle Exp $ */ /* $Id: network.c,v 1.39 2003/08/10 15:10:19 stpohle Exp $ */
/* /*
network routines. network routines.
*/ */
@ -748,6 +748,7 @@ net_new_game ()
for (p = 0; p < MAX_PLAYERS; p++) { for (p = 0; p < MAX_PLAYERS; p++) {
bman.players[p].frame = 0; bman.players[p].frame = 0;
bman.players[p].frameto = 0; bman.players[p].frameto = 0;
bman.players[p].tunnelto = -1;
if (PS_IS_used (bman.players[p].state)) { if (PS_IS_used (bman.players[p].state)) {
bman.players_nr_s++; bman.players_nr_s++;

@ -313,6 +313,18 @@ stepmove_player (int pl_nr)
p->pos.y += d.y; p->pos.y += d.y;
player_check_powerup (pl_nr); player_check_powerup (pl_nr);
fpos.x = p->pos.x >> 8;
fpos.y = p->pos.y >> 8;
_pos.x = p->pos.x & 255;
_pos.y = p->pos.y & 255;
if (_pos.x == 0 && _pos.y == 0 && map.field[fpos.x][fpos.y].type == FT_tunnel && p->tunnelto == -1) {
d.x = d.y = 0;
p->pos.x = map.tunnel[map.field[fpos.x][fpos.y].special].x << 8;
p->pos.y = map.tunnel[map.field[fpos.x][fpos.y].special].y << 8;
p->tunnelto = GAME_TUNNEL_TO;
}
} }
if (d.x == 0 && d.y == 0) if (d.x == 0 && d.y == 0)
@ -353,6 +365,10 @@ move_player (int pl_nr)
_player *p = &bman.players[pl_nr]; _player *p = &bman.players[pl_nr];
oldd = p->d; oldd = p->d;
if (p->tunnelto > 0)
p->tunnelto--;
else {
if (p->m) { if (p->m) {
player_animation (p); player_animation (p);
if ((stepsleft = stepmove_player (pl_nr)) > 0) { if ((stepsleft = stepmove_player (pl_nr)) > 0) {
@ -367,6 +383,8 @@ move_player (int pl_nr)
/* network packet send control - send data if it's time to send or if we need to */ /* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single) if (bman.gametype != GT_single)
net_game_send_playermove (pl_nr, (p->old_m == 0)); net_game_send_playermove (pl_nr, (p->old_m == 0));
if (p->tunnelto==0)
p->tunnelto = -1;
} }
/* the player just stopt moving so send data */ /* the player just stopt moving so send data */
@ -375,6 +393,8 @@ move_player (int pl_nr)
p->old_m = p->m; // save the old state p->old_m = p->m; // save the old state
p->m = 0; p->m = 0;
}
/* check the players position */ /* check the players position */
if ((p->pos.x & 0xFF) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right)) if ((p->pos.x & 0xFF) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right))
if (!check_field ((p->pos.x >> 8) + 1, (p->pos.y >> 8))) if (!check_field ((p->pos.x >> 8) + 1, (p->pos.y >> 8)))
@ -388,7 +408,6 @@ move_player (int pl_nr)
&& (p->d == up || p->d == down))) && (p->d == up || p->d == down)))
if (!check_field (p->pos.x >> 8, p->pos.y >> 8)) if (!check_field (p->pos.x >> 8, p->pos.y >> 8))
player_died (p, -1); player_died (p, -1);
}; };
@ -502,10 +521,9 @@ player_died (_player * player, signed char dead_by)
void void
draw_players () draw_players ()
{ {
int p; int p;
for (p = 0; p < MAX_PLAYERS; p++) { for (p = 0; p < MAX_PLAYERS; p++) {
if (PS_IS_playing (bman.players[p].state)) if (PS_IS_playing (bman.players[p].state) && bman.players[p].tunnelto <= 0)
draw_player (&bman.players[p]); draw_player (&bman.players[p]);
} }
}; };

@ -1,4 +1,4 @@
/* $Id: tileset.c,v 1.6 2003/08/06 22:23:42 stpohle Exp $ */ /* $Id: tileset.c,v 1.7 2003/08/10 15:10:19 stpohle Exp $ */
/* load and select tilesets */ /* load and select tilesets */
#include "bomberclone.h" #include "bomberclone.h"
@ -166,6 +166,9 @@ tileset_load (char *tilesetname)
case (FT_block): case (FT_block):
sprintf (filename, "block"); sprintf (filename, "block");
break; break;
case (FT_tunnel) :
sprintf (filename, "tunnel");
break;
case (FT_death): case (FT_death):
sprintf (filename, "pwdeath"); sprintf (filename, "pwdeath");
break; break;

Loading…
Cancel
Save