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
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

@ -4,7 +4,7 @@ dnl If you don't want it to overwrite it,
dnl Please disable it in the Anjuta project configuration
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(bomberclone, 0.10.0)
AM_INIT_AUTOMAKE(bomberclone, 0.10.1)
AM_CONFIG_HEADER
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 */
#ifndef _BC_BASIC_H_
@ -16,8 +16,11 @@
#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_TIMEOUT 30000 // game timeout 10min)
#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)
#define GAME_TUNNEL_TO 50 /* wait 5 game cycls before move and show
player again */
#define EXPLOSION_SAVE_DISTANCE 64
#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 {
FT_nothing = 0, // Nothing in here
FT_stone, // Stones you can bomb away
FT_block, // Stones which can't bomb away
FT_tunnel, // the tunnel item
FT_death, // The bad Powerup
FT_fire, // The fire 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 */
#include "bomberclone.h"
@ -300,7 +300,8 @@ restore_explosion (_bomb * bomb)
// delete the stone completly if there was any in the way
if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block
&& bomb->ex_nr != map.field[_x][_y].ex_nr) {
&& map.field[_x][_y].type != FT_tunnel
&& bomb->ex_nr != map.field[_x][_y].ex_nr) {
map.field[_x][_y].ex_nr = bomb->ex_nr;
map.field[_x][_y].frame = 0;
@ -365,7 +366,7 @@ explosion_check_field (int x, int y, int p, int b)
}
// 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)
if (map.field[x][y].frame == 0) {
map.field[x][y].frameto = ANI_STONETIMEOUT;
@ -466,11 +467,14 @@ do_explosion (int p, int b)
}
if (bomb->firer[d] <= bomb->r) {
int checkfield;
dx = bomb->firer[d] * dx;
dy = bomb->firer[d] * dy;
if (explosion_check_field (bpos.x + dx, bpos.y + dy, p, b) ==
BS_off && bomb->firerst[d] == -1) {
checkfield = explosion_check_field (bpos.x + dx, bpos.y + dy, p, b);
if ((checkfield == FT_nothing || checkfield == FT_tunnel)
&& bomb->firerst[d] == -1) {
bomb->firer[d]++;
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];

@ -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 */
#ifndef _BOMBERCLONE_H_
@ -90,6 +90,9 @@ struct __player {
_point pos; /* position (without the offset)
_x = pos.x & 255; fx = pos.x >> 8; */
_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 m; // player is moving ?
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);
map.map[0] = 0;
map.map_selection = 2;
map.type = -1;
bman.firewall = 0;
bman.broadcasted_chat = 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 */
#include "bomberclone.h"
@ -95,7 +95,7 @@ draw_stone (int x, int y)
src.x = 0;
/* draw background if we have a stone, block or nothing */
if (stone->type <= FT_block) {
if (stone->type <= FT_tunnel) {
SDL_Rect srcbg;
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;
dest.h = src.h = gfx.field[stone->type].h;
dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w);
@ -153,9 +153,11 @@ draw_stone (int x, int 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);
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 */
srcimg = gfx.field[i].image;
src.y = 0;

@ -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. */
#include "bomberclone.h"
_map map;
// put items into the field
// put the special items into the field
void
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
how much items we want in the game */
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++) {
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);
y = ((float) rand () / (float) RAND_MAX) * (map.size.y - 1);
nb_try--;
@ -39,22 +38,61 @@ map_new (char *filename)
int x,
y;
FILE *fmap;
signed char old_maptype = map.type;
if (filename) {
fmap = fopen (filename, "r");
/* 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)
map_load (fmap);
}
else
fmap = NULL;
// Clean and create the field //
if (fmap == NULL)
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 */
for (x = 0; x < MAX_FIELDSIZE_X; x++)
for (y = 0; y < MAX_FIELDSIZE_Y; y++)
@ -81,6 +119,8 @@ map_new (char *filename)
map_fillitems (FT_sp_push, map.sp_push);
/* put the kick special in the field */
// map_fillitems (FT_sp_kick, GAME_SPECIAL_ITEMSKICK);
map.type = old_maptype;
}
void
@ -195,9 +235,12 @@ map_set_playerposition (int usermap)
/* make some space */
if (PLX != -1 && PLY != -1) {
map.field[PLX][PLY].type = FT_nothing;
map.field[PLX + dx][PLY].type = FT_nothing;
map.field[PLX][PLY + dy].type = FT_nothing;
if (map.field[PLX][PLY].type != FT_tunnel)
map.field[PLX][PLY].type = FT_nothing;
if (map.field[PLX + dx][PLY].type != FT_tunnel)
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;
}
}
}

@ -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 */
#ifndef _MAP_H_
@ -15,8 +15,8 @@ struct __field {
signed char mixframe; // data for the mixed frame
short int frame; // frame (frame > 0 && FS_stone)
int frameto; // frame to
unsigned char special; // to save special stones
_ex_field ex[4]; // count up every explosion there is on this field for ever direction
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
int ex_nr; // number to identify the explosion.
} typedef _field;
@ -25,13 +25,14 @@ struct __map {
_point size; // dimension of the field
_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
char tileset [LEN_TILESETNAME];
signed char random_tileset;
char map [LEN_PATHFILENAME];
signed char map_selection;
signed char type; // type of the map (MAPT_*);
unsigned char bombs;
unsigned char fire;
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.
*/
@ -748,6 +748,7 @@ net_new_game ()
for (p = 0; p < MAX_PLAYERS; p++) {
bman.players[p].frame = 0;
bman.players[p].frameto = 0;
bman.players[p].tunnelto = -1;
if (PS_IS_used (bman.players[p].state)) {
bman.players_nr_s++;

@ -313,6 +313,18 @@ stepmove_player (int pl_nr)
p->pos.y += d.y;
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)
@ -353,27 +365,35 @@ move_player (int pl_nr)
_player *p = &bman.players[pl_nr];
oldd = p->d;
if (p->m) {
player_animation (p);
if ((stepsleft = stepmove_player (pl_nr)) > 0) {
/* save the speed and go the rest of the step */
p->d = oldd;
speed = p->speed;
p->speed = stepsleft;
stepmove_player (pl_nr);
p->speed = speed;
}
/* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single)
net_game_send_playermove (pl_nr, (p->old_m == 0));
}
if (p->tunnelto > 0)
p->tunnelto--;
else {
if (p->m) {
player_animation (p);
if ((stepsleft = stepmove_player (pl_nr)) > 0) {
/* save the speed and go the rest of the step */
p->d = oldd;
speed = p->speed;
p->speed = stepsleft;
stepmove_player (pl_nr);
p->speed = speed;
}
/* the player just stopt moving so send data */
if (bman.gametype != GT_single && p->m == 0 && p->old_m != 0)
net_game_send_playermove (pl_nr, 1);
p->old_m = p->m; // save the old state
p->m = 0;
/* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single)
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 */
if (bman.gametype != GT_single && p->m == 0 && p->old_m != 0)
net_game_send_playermove (pl_nr, 1);
p->old_m = p->m; // save the old state
p->m = 0;
}
/* check the players position */
if ((p->pos.x & 0xFF) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right))
@ -388,7 +408,6 @@ move_player (int pl_nr)
&& (p->d == up || p->d == down)))
if (!check_field (p->pos.x >> 8, p->pos.y >> 8))
player_died (p, -1);
};
@ -502,10 +521,9 @@ player_died (_player * player, signed char dead_by)
void
draw_players ()
{
int 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]);
}
};

@ -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 */
#include "bomberclone.h"
@ -166,6 +166,9 @@ tileset_load (char *tilesetname)
case (FT_block):
sprintf (filename, "block");
break;
case (FT_tunnel) :
sprintf (filename, "tunnel");
break;
case (FT_death):
sprintf (filename, "pwdeath");
break;

Loading…
Cancel
Save