game will have after a timeout or no other stones on the field a end game sequence. Like putting random powerups in the field or just get the size of the field down.

origin
stpohle 22 years ago
parent 92b79d1ddd
commit abc50df9c2

@ -135,5 +135,5 @@ AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
src/Makefile src/Makefile
data/Makefile
]) ])

@ -1,20 +0,0 @@
% Map created by kitutou (04/05/2003)
% for testing purpose
%
#########################
#@@ @@@@@ @@#
#@@ @@@@@ @@#
# @@@@@ #
# @@@@@ #
# @@@@@ #
#@@@@@@@@@@@@@@@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@@@@@@@@@@@@@@#
# @@@@@ #
# @@@@@ #
# @@@@@ #
#@@ @@@@@ @@#
#@@ @@@@@ @@#
#########################

@ -1,27 +0,0 @@
% Map created by kitutou (04/05/2003)
% for testing purpose
%
########################
# #
# #
# # # #
# #### #### #
# # # #
# ###@@@@### #
# ### #@@@@# ### #
# # # #@@@@# # # #
# # ####@@@@#### # #
# ## @@@@@@@@@@@@ ## #
# @@@@@ @@@@@ #
# @@@@@ @@@@@ #
# ## @@@@@@@@@@@@ ## #
# # ####@@@@#### # #
# # # #@@@@# # # #
# ### #@@@@# ### #
# ###@@@@### #
# # # #
# #### #### #
# # # #
# #
# #
########################

@ -1,15 +0,0 @@
%
% $Id: smalfull.map,v 1.1 2003/05/08 18:11:12 kitutou Exp $
% First Map created by stpohle
% for testing purpose
%
###########
#@@@@#@@@@#
#@#@@@@@#@#
#@#######@#
#@#@@@@#@@#
#@@@@#@@@@#
#@#######@#
#@#@@@@@#@#
#@@@@#@@@@#
###########

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.42 2003/07/24 04:18:43 stpohle Exp $ */ /* $Id: basic.h,v 1.43 2003/07/27 13:29:25 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -16,6 +16,8 @@
#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_TIMEOUT 30000 // game timeout 10min)
#define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min)
#define EXPLOSION_SAVE_DISTANCE 64 #define EXPLOSION_SAVE_DISTANCE 64
#define SPECIAL_TRIGGER_TIMEOUT 15 #define SPECIAL_TRIGGER_TIMEOUT 15
@ -78,6 +80,11 @@
#define MENU_BG_SHADE_DARK -64 #define MENU_BG_SHADE_DARK -64
#define MENU_BG_SHADE_BRIGHT 64 #define MENU_BG_SHADE_BRIGHT 64
#define FIELDECHECK_TIMEOUT 100 /* timeout for the field check function */
#define FIELDHURRYDROPTO 50 /* timeout when to put in some special items */
#define FIELDHURRYSIZE 5 /* timeout when to put in some special items */
#define FIELDHURRYSIZEMIN 5 /* min size for the field */
#define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (bman.players[__result].gfx_nr != __gfx_nr) && (__result >= 0); __result--); #define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (bman.players[__result].gfx_nr != __gfx_nr) && (__result >= 0); __result--);
enum _networkflags { enum _networkflags {
@ -202,6 +209,19 @@ enum _dirbitmask { // bit mask for the directions
DIRM_under = 16 DIRM_under = 16
}; };
enum _mapselection {
MAPS_select = 0,
MAPS_randmap,
MAPS_randgen
};
enum _mstatus {
MS_normal = 0,
MS_hurry, // mapsize will go down
MS_dropitems, // alot of items will be droppen randomly into the game
MS_max
};
struct __point { struct __point {
short int x; short int x;

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.47 2003/07/25 21:44:47 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.48 2003/07/27 13:29:25 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -131,6 +131,7 @@ struct __bomberclone {
unsigned char gametype; unsigned char gametype;
unsigned char multitype; unsigned char multitype;
unsigned char state; unsigned char state;
int timeout; // game timeout
char playername[LEN_PLAYERNAME]; char playername[LEN_PLAYERNAME];
int players_nr_s; // number of players at the beginning int players_nr_s; // number of players at the beginning
int players_nr; // number of player who are alife int players_nr; // number of player who are alife
@ -184,6 +185,9 @@ extern void draw_field ();
extern void field_clear(int x, int y); extern void field_clear(int x, int y);
extern void field_animation_add (int x, int y); extern void field_animation_add (int x, int y);
extern void field_animation (); extern void field_animation ();
extern void field_loop ();
extern void field_hurrysize ();
extern void field_hurrydropitems ();
extern void draw_stone (int x, int y); extern void draw_stone (int x, int y);
extern void stonelist_add (int x, int y); extern void stonelist_add (int x, int y);
extern void stonelist_del (); extern void stonelist_del ();

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.38 2003/07/23 02:10:47 stpohle Exp $ */ /* $Id: field.c,v 1.39 2003/07/27 13:29:25 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"
@ -6,48 +6,63 @@
static _point fieldani[MAX_FIELDANIMATION]; static _point fieldani[MAX_FIELDANIMATION];
static _point stonelist[MAX_STONESTODRAW]; // keep all stones to draw static _point stonelist[MAX_STONESTODRAW]; // keep all stones to draw
static int fieldcheck_to; // timeout for the next fieldcheck FIELDCHECK_TIMEOUT
static int fieldhurry_to;
static _point fieldhurrypos; // x,y for the hurry
static int fieldhurryd; // direction for the hurry
/* delete the stone entry list */ /* delete the stone entry list */
void stonelist_del () { void
register int i; stonelist_del ()
{
for (i = 0; i < MAX_STONESTODRAW; i++) register int i;
stonelist[i].x = stonelist[i].y = -1;
for (i = 0; i < MAX_STONESTODRAW; i++)
stonelist[i].x = stonelist[i].y = -1;
} }
/* stonelist will be draw and cleaned */ /* stonelist will be draw and cleaned */
void stonelist_draw () { void
int i; stonelist_draw ()
{
for (i = 0; i < MAX_STONESTODRAW && stonelist[i].x != -1 && stonelist[i].y != -1; i++) { int i;
draw_stone (stonelist[i].x, stonelist[i].y);
stonelist[i].x = stonelist[i].y = -1; for (i = 0; i < MAX_STONESTODRAW && stonelist[i].x != -1 && stonelist[i].y != -1; i++) {
} draw_stone (stonelist[i].x, stonelist[i].y);
stonelist[i].x = stonelist[i].y = -1;
}
}; };
/* add stone to draw */ /* add stone to draw */
static void _stonelist_add (int x, int y, int recursive) { static void
int i; _stonelist_add (int x, int y, int recursive)
_point *slentry = NULL; {
int i;
for (i = 0, slentry = NULL; i < MAX_STONESTODRAW && slentry == NULL; i++) _point *slentry = NULL;
if (stonelist[i].x == -1 || stonelist[i].y == -1 || (stonelist[i].x == x && stonelist[i].y == y))
slentry = &stonelist[i]; for (i = 0, slentry = NULL; i < MAX_STONESTODRAW && slentry == NULL; i++)
if (stonelist[i].x == -1 || stonelist[i].y == -1
if (slentry == NULL) // no space left || (stonelist[i].x == x && stonelist[i].y == y))
d_fatal ("field.c adddraw_stone(): out of space in stonelist[]\n"); slentry = &stonelist[i];
else {
slentry->x = x; if (slentry == NULL) // no space left
slentry->y = y; d_fatal ("field.c adddraw_stone(): out of space in stonelist[]\n");
else {
if (recursive && gfx.field[map.field[x][y].type].h != gfx.field[map.field[x][y].type].w) slentry->x = x;
/* field is higher as usual */ slentry->y = y;
_stonelist_add (x, y-1, 0);
} if (recursive && gfx.field[map.field[x][y].type].h != gfx.field[map.field[x][y].type].w)
/* field is higher as usual */
_stonelist_add (x, y - 1, 0);
}
};
inline void
stonelist_add (int x, int y)
{
_stonelist_add (x, y, 1);
}; };
inline void stonelist_add (int x, int y) { _stonelist_add (x, y, 1); };
void void
@ -60,10 +75,10 @@ draw_stone (int x, int y)
int i, int i,
d; d;
if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) { if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) {
d_fatal ("Draw Stone out of range [%d,%d]\n", x, y); d_fatal ("Draw Stone out of range [%d,%d]\n", x, y);
return; return;
} }
src.w = dest.w = gfx.block.x; src.w = dest.w = gfx.block.x;
src.h = dest.h = gfx.block.y; src.h = dest.h = gfx.block.y;
@ -81,26 +96,26 @@ draw_stone (int x, int y)
srcbg.h = dest.h; srcbg.h = dest.h;
srcbg.x = (x % gfx.field[FT_nothing].frames) * gfx.block.x; srcbg.x = (x % gfx.field[FT_nothing].frames) * gfx.block.x;
srcbg.y = (y % gfx.field[FT_nothing].frames) * gfx.block.y; srcbg.y = (y % gfx.field[FT_nothing].frames) * gfx.block.y;
gfx_blit (gfx.field[FT_nothing].image, &srcbg, gfx.screen, &dest, 0); gfx_blit (gfx.field[FT_nothing].image, &srcbg, gfx.screen, &dest, 0);
} }
if (stone->type == FT_mixed) { if (stone->type == FT_mixed) {
i = stone->mixframe; i = stone->mixframe;
if (i < FT_death || i >= FT_mixed) if (i < FT_death || i >= FT_mixed)
i = FT_death; i = FT_death;
} }
else else
i = stone->type; i = stone->type;
/* animate the stone if needed only for exploding stone */ /* animate the stone if needed only for exploding stone */
if (stone->type == FT_stone && stone->frame > 0) { if (stone->type == FT_stone && stone->frame > 0) {
field_animation_add (x, y); field_animation_add (x, y);
if (stone->frame < gfx.field[FT_stone].frames) { if (stone->frame < gfx.field[FT_stone].frames) {
src.y = stone->frame * gfx.field[FT_stone].h; src.y = stone->frame * gfx.field[FT_stone].h;
dest.h = src.h = gfx.field[FT_stone].h; dest.h = src.h = gfx.field[FT_stone].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);
srcimg = gfx.field[FT_stone].image; srcimg = gfx.field[FT_stone].image;
} }
else { else {
@ -111,47 +126,52 @@ draw_stone (int x, int y)
else if (stone->type == FT_stone || stone->type == FT_block) { else if (stone->type == FT_stone || stone->type == FT_block) {
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);
srcimg = gfx.field[stone->type].image; srcimg = gfx.field[stone->type].image;
} }
/* some powerup so we need to animate this too */ /* some powerup so we need to animate this too */
if (i == FT_death) if (i == FT_death)
d = PWUP_bad; d = PWUP_bad;
else if (i >= FT_sp_trigger) else if (i >= FT_sp_trigger)
d = PWUP_special; d = PWUP_special;
else else
d = PWUP_good; d = PWUP_good;
if (i >= FT_death) { if (i >= FT_death) {
field_animation_add (x, y); field_animation_add (x, y);
srcimg = gfx.powerup[d].image; srcimg = gfx.powerup[d].image;
if (stone->frame >= gfx.powerup[d].frames) if (stone->frame >= gfx.powerup[d].frames)
stone->frame = 0; stone->frame = 0;
src.y = stone->frame * gfx.block.y; src.y = stone->frame * gfx.block.y;
} }
if (srcimg != NULL) if (srcimg != NULL)
gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 1); 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;
src.y = 0; src.y = 0;
gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 2); gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 2);
} }
/* if the current field is half hidden by the lower /* if the current field is half hidden by the lower
field (y+1) draw this little part too */ field (y+1) draw this little part too */
if (y < map.size.y-1 && gfx.field[map.field[x][y+1].type].h > gfx.field[map.field[x][y+1].type].w) { if (y < map.size.y - 1
src.x = 0; && gfx.field[map.field[x][y + 1].type].h > gfx.field[map.field[x][y + 1].type].w) {
src.y = map.field[x][y+1].frame * gfx.field[map.field[x][y+1].type].h; src.x = 0;
dest.h = src.h = gfx.field[map.field[x][y+1].type].h - gfx.field[map.field[x][y+1].type].w; src.y = map.field[x][y + 1].frame * gfx.field[map.field[x][y + 1].type].h;
dest.w = src.w = gfx.field[map.field[x][y+1].type].w; dest.h = src.h =
dest.y = gfx.offset.y + ((gfx.block.y * (y+1)) - (gfx.field[map.field[x][y+1].type].h - gfx.field[map.field[x][y+1].type].w)); gfx.field[map.field[x][y + 1].type].h - gfx.field[map.field[x][y + 1].type].w;
gfx_blit (gfx.field[map.field[x][y+1].type].image, &src, gfx.screen, &dest, (y << 8) + 5); dest.w = src.w = gfx.field[map.field[x][y + 1].type].w;
} dest.y =
gfx.offset.y + ((gfx.block.y * (y + 1)) -
(gfx.field[map.field[x][y + 1].type].h -
gfx.field[map.field[x][y + 1].type].w));
gfx_blit (gfx.field[map.field[x][y + 1].type].image, &src, gfx.screen, &dest, (y << 8) + 5);
}
// draw explosions if there is any // draw explosions if there is any
for (d = 0, i = 0; d < 4; d++) for (d = 0, i = 0; d < 4; d++)
if (stone->ex[d].count > 0) { if (stone->ex[d].count > 0) {
@ -189,15 +209,16 @@ field_clear (int x, int y)
void void
field_animation () field_animation ()
{ {
int i,j; int i,
_field *stone; j;
_field *stone;
for (i = 0; i < MAX_FIELDANIMATION; i++) for (i = 0; i < MAX_FIELDANIMATION; i++)
if (fieldani[i].x >= 0 && fieldani[i].x < map.size.x && fieldani[i].y >= 0 if (fieldani[i].x >= 0 && fieldani[i].x < map.size.x && fieldani[i].y >= 0
&& fieldani[i].y < map.size.y) { && fieldani[i].y < map.size.y) {
/* check if there is a need to animate this */ /* check if there is a need to animate this */
stone = &map.field[fieldani[i].x][fieldani[i].y]; stone = &map.field[fieldani[i].x][fieldani[i].y];
if ((stone->type == FT_stone && stone->frame > 0) || (stone->type >= FT_death)) { if ((stone->type == FT_stone && stone->frame > 0) || (stone->type >= FT_death)) {
/* animate this stone */ /* animate this stone */
if (stone->type == FT_stone) { if (stone->type == FT_stone) {
@ -210,27 +231,27 @@ field_animation ()
if (stone->frameto > 0) if (stone->frameto > 0)
stone->frameto--; stone->frameto--;
} }
else { /* animation is a powerup */ else { /* animation is a powerup */
/* select right powerup animation */ /* select right powerup animation */
if (stone->type == FT_death) if (stone->type == FT_death)
j = PWUP_bad; j = PWUP_bad;
else if (stone->type > FT_sp_trigger) else if (stone->type > FT_sp_trigger)
j = PWUP_special; j = PWUP_special;
else else
j = PWUP_good; j = PWUP_good;
/* do the animation of the FT_mixed */ /* do the animation of the FT_mixed */
if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) { if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) {
stone->frameto = ANI_STONETIMEOUT; stone->frameto = ANI_STONETIMEOUT;
stone->frame++; stone->frame++;
if (stone->type == FT_mixed) { if (stone->type == FT_mixed) {
stone->mixframe++; stone->mixframe++;
if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed) if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed)
stone->mixframe = FT_death; stone->mixframe = FT_death;
} }
} }
if (stone->frame >= gfx.powerup[j].frames) if (stone->frame >= gfx.powerup[j].frames)
stone->frame = 0; stone->frame = 0;
} }
stonelist_add (fieldani[i].x, fieldani[i].y); stonelist_add (fieldani[i].x, fieldani[i].y);
@ -269,3 +290,165 @@ field_animation_add (int x, int y)
fieldani[j].x = x; fieldani[j].x = x;
fieldani[j].y = y; fieldani[j].y = y;
}; };
/* check the field, if everything is empty */
int
field_checkisempty ()
{
register int x,
y;
int empty = 1;
for (x = 1; (x < (map.size.x - 1) && empty); x++)
for (y = 1; (y < (map.size.y - 1) && empty); y++)
if (map.field[x][y].type == FT_stone)
empty = 0;
return empty;
}
/* will check for some gamerelated map informations
check if the map is empty, and so something like a timeout so we won't
end up in a endless game */
void
field_loop ()
{
/* single game or multiplayer master, so check field state */
if (GT_MP_PTPM || bman.gametype == GT_single) {
/* timeout for rechecking every 5 secs the field */
if (map.state == MS_normal && map.map_selection == MAPS_randgen
&& (fieldcheck_to-- > FIELDECHECK_TIMEOUT || fieldcheck_to <= 0)) {
if (field_checkisempty ())
bman.timeout = 0; // set the gametimeout to 0
}
/* gametimeout is 0 and we are still at more normal set randomly a
way to end the game */
if (bman.timeout-- <= 0 && map.state == MS_normal) {
int rndmax;
if (map.map_selection == MAPS_randgen)
rndmax = MS_max - 1; // generaged map
else
rndmax = MS_max - 2; // user defined map
map.state = 1 + s_random (rndmax);
d_printf ("Game Timeout 1 over: Random map.state = %d\n", map.state);
bman.timeout = GAME_TIMEOUTHURRY;
fieldhurrypos.x = fieldhurrypos.y = 0;
}
/* check if we need to small down the map */
if (map.state == MS_hurry)
field_hurrysize ();
if (map.state == MS_dropitems)
field_hurrydropitems ();
}
field_animation ();
};
/* hurrymode drop a item randomly */
void
field_hurrydropitems ()
{
int x = 0,
y = 0,
try = 100;
if (fieldhurry_to-- <= 0 || fieldhurry_to > FIELDHURRYDROPTO) {
fieldhurry_to = FIELDHURRYDROPTO;
while (map.field[x][y].type != FT_nothing && (try--)) {
x = s_random (map.size.x - 2) + 1;
y = s_random (map.size.y - 2) + 1;
}
if (try) {
map.field[x][y].type = s_random (FT_mixed - 2) + 3;
stonelist_add (x, y);
if (GT_MP_PTPM)
net_game_send_field (x, y);
}
}
};
/* hurrymode small down the map */
void
field_hurrysize ()
{
int i;
if (fieldhurry_to-- <= 0 || fieldhurry_to > FIELDHURRYSIZE) {
fieldhurry_to = FIELDHURRYSIZE;
if (fieldhurrypos.x == 0) {
fieldhurrypos.x = fieldhurrypos.y = 1;
fieldhurryd = right;
}
else if (fieldhurrypos.x > 0) {
bman.timeout = GAME_TIMEOUTHURRY-1;
switch (fieldhurryd) {
case (right):
if (fieldhurrypos.x + 1 >= map.size.x - fieldhurrypos.y) {
fieldhurryd = down;
fieldhurrypos.y++;
}
else
fieldhurrypos.x++;
break;
case (down):
if (fieldhurrypos.y >= map.size.y - (map.size.x - fieldhurrypos.x)) {
fieldhurryd = left;
fieldhurrypos.x--;
}
else
fieldhurrypos.y++;
break;
case (left):
if (fieldhurrypos.x <= (map.size.y - fieldhurrypos.y)-1) {
fieldhurryd = up;
fieldhurrypos.y--;
}
else
fieldhurrypos.x--;
break;
default:
if (fieldhurrypos.y-1 <= fieldhurrypos.x) {
/* check if this is the end */
i = map.size.x - (2 * fieldhurrypos.x);
if (i > FIELDHURRYSIZEMIN)
i = map.size.y - (2 * fieldhurrypos.y);
if (i <= FIELDHURRYSIZEMIN)
fieldhurrypos.x = fieldhurrypos.y = -1;
else {
fieldhurryd = right;
fieldhurrypos.x++;
}
}
else
fieldhurrypos.y--;
break;
}
}
/* check if we have finished sizing down everything */
if (fieldhurrypos.x > 0) {
/* set the block on the position */
map.field[fieldhurrypos.x][fieldhurrypos.y].type = FT_block;
stonelist_add (fieldhurrypos.x, fieldhurrypos.y);
if (GT_MP_PTPM)
net_game_send_field (fieldhurrypos.x, fieldhurrypos.y);
}
}
};

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.7 2003/07/25 23:46:25 stpohle Exp $ */ /* $Id: font.c,v 1.8 2003/07/27 13:29:25 stpohle Exp $ */
// Using Fonts in SDL // Using Fonts in SDL
#include <string.h> #include <string.h>
@ -79,4 +79,4 @@ void font_drawbold (int x, int y, char *text, int size, int bold) {
font_draw (x + bold, y, text, size); font_draw (x + bold, y, text, size);
font_draw (x, y - bold, text, size); font_draw (x, y - bold, text, size);
font_draw (x, y + bold, text, size); font_draw (x, y + bold, text, size);
}; };

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.45 2003/07/26 02:43:21 stpohle Exp $ /* $Id: game.c,v 1.46 2003/07/27 13:29:25 stpohle Exp $
game.c - procedures for the game. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -200,7 +200,7 @@ game_loop ()
/* this will even set the variable "bman.player_nr" /* this will even set the variable "bman.player_nr"
to let us know how much Players are still left */ to let us know how much Players are still left */
bomb_loop (); bomb_loop ();
field_animation (); field_loop ();
draw_players (); draw_players ();
game_draw_info (); game_draw_info ();
@ -208,11 +208,12 @@ game_loop ()
and if there the last dieing animation is done */ and if there the last dieing animation is done */
if ((bman.players_nr < 2 if ((bman.players_nr < 2
&& (GT_MP_PTP || (bman.gametype == GT_single && bman.ai_players > 0))) && (GT_MP_PTP || (bman.gametype == GT_single && bman.ai_players > 0)))
|| (bman.gametype == GT_single && bman.ai_players == 0 && bman.players_nr < 1)) || (bman.gametype == GT_single && bman.ai_players == 0 && bman.players_nr < 1)
|| (bman.timeout <= 0 && map.state != MS_normal))
gameovertimeout--; gameovertimeout--;
if (gameovertimeout <= 0) { if (gameovertimeout <= 0) {
d_printf ("GAME: Game Over 'Cause only one or none anymore alife\n"); d_printf ("GAME: Game Over\n");
done = 1; done = 1;
} }
@ -278,6 +279,9 @@ game_start ()
tileset_load (map.tileset); tileset_load (map.tileset);
gfx_load_players (gfx.block.x, gfx.block.y); gfx_load_players (gfx.block.x, gfx.block.y);
snd_load (map.tileset); snd_load (map.tileset);
map.state = MS_normal;
bman.timeout = GAME_TIMEOUT;
}; };

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.2 2003/07/22 18:29:08 stpohle Exp $ */ /* $Id: map.h,v 1.3 2003/07/27 13:29:25 stpohle Exp $ */
/* map.h */ /* map.h */
#ifndef _MAP_H_ #ifndef _MAP_H_
@ -40,6 +40,8 @@ struct __map {
unsigned char sp_trigger; unsigned char sp_trigger;
unsigned char sp_push; unsigned char sp_push;
unsigned char sp_row; unsigned char sp_row;
unsigned char state; // state of the map
} typedef _map; } typedef _map;

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.6 2003/07/22 18:29:08 stpohle Exp $ */ /* $Id: mapmenu.c,v 1.7 2003/07/27 13:29:25 stpohle Exp $ */
/* map/tileset selection menu */ /* map/tileset selection menu */
#include "bomberclone.h" #include "bomberclone.h"
@ -37,7 +37,7 @@ mapmenu ()
while (menuselect != -1) { while (menuselect != -1) {
switch (map.map_selection) { switch (map.map_selection) {
case (0): // Selected Map case (MAPS_select): // Selected Map
if (map.map[0] == 0) if (map.map[0] == 0)
sprintf (menu[1].text, "Selected Map: < undefined >"); sprintf (menu[1].text, "Selected Map: < undefined >");
else else
@ -49,7 +49,7 @@ mapmenu ()
menu[3].text[0] = 0; menu[3].text[0] = 0;
menu[3].index = 0; menu[3].index = 0;
break; break;
case (1): // Random Map case (MAPS_randmap): // Random Map
menu[1].text[0] = 0; menu[1].text[0] = 0;
menu[1].index = 0; menu[1].index = 0;
sprintf (menu[0].text, "Random Map: random file"); sprintf (menu[0].text, "Random Map: random file");
@ -58,7 +58,7 @@ mapmenu ()
menu[3].text[0] = 0; menu[3].text[0] = 0;
menu[3].index = 0; menu[3].index = 0;
break; break;
case (2): // Random Generated Map case (MAPS_randgen): // Random Generated Map
menu[1].text[0] = 0; menu[1].text[0] = 0;
menu[1].index = 0; menu[1].index = 0;
sprintf (menu[0].text, "Random Map: auto-generated"); sprintf (menu[0].text, "Random Map: auto-generated");

@ -235,7 +235,7 @@ host_multiplayer_game ()
init_map_tileset(); init_map_tileset();
net_send_servermode (); net_send_servermode ();
game_start (); game_start ();
net_new_gamedata (); net_transmit_gamedata ();
if (bman.state == GS_ready || bman.state == GS_running) { if (bman.state == GS_ready || bman.state == GS_running) {
net_send_servermode (); net_send_servermode ();
@ -274,7 +274,7 @@ join_multiplayer_game ()
game_start (); game_start ();
bman.state = GS_update; bman.state = GS_update;
net_new_game (); net_new_game ();
net_new_gamedata (); net_transmit_gamedata ();
if (bman.state == GS_ready || bman.state == GS_running) if (bman.state == GS_ready || bman.state == GS_running)
game_loop (); game_loop ();

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.37 2003/07/24 01:47:48 stpohle Exp $ */ /* $Id: network.c,v 1.38 2003/07/27 13:29:25 stpohle Exp $ */
/* /*
network routines. network routines.
*/ */
@ -391,7 +391,7 @@ net_change_playerid (int pl_nr, unsigned char senddata)
within the network loop within the network loop
*/ */
void void
net_new_gamedata () net_transmit_gamedata ()
{ {
int done = 0, int done = 0,
keypressed = 0, keypressed = 0,

@ -73,7 +73,7 @@ extern int network_init ();
extern int network_loop (); extern int network_loop ();
extern void net_change_playerid (int pl_nr, unsigned char senddata); extern void net_change_playerid (int pl_nr, unsigned char senddata);
extern void net_new_game (); extern void net_new_game ();
extern void net_new_gamedata (); extern void net_transmit_gamedata ();
extern void net_game_send_player (int p_nr); extern void net_game_send_player (int p_nr);
extern void net_game_send_playermove (int p_nr, int mustsend); extern void net_game_send_playermove (int p_nr, int mustsend);
extern void net_game_send_bomb (int p, int b); extern void net_game_send_bomb (int p, int b);

@ -1,4 +1,4 @@
/* $Id: single.c,v 1.39 2003/07/25 21:44:47 stpohle Exp $ */ /* $Id: single.c,v 1.40 2003/07/27 13:29:25 stpohle Exp $ */
/* single player */ /* single player */
#include "basic.h" #include "basic.h"
@ -61,7 +61,8 @@ inline int
ai_checkfield (int x, int y) ai_checkfield (int x, int y)
{ {
return ((map.field[x][y].type == FT_nothing || map.field[x][y].type == FT_fire return ((map.field[x][y].type == FT_nothing || map.field[x][y].type == FT_fire
|| map.field[x][y].type == FT_shoe || map.field[x][y].type == FT_bomb) || map.field[x][y].type == FT_shoe || map.field[x][y].type == FT_bomb
|| map.field[x][y].type == FT_mixed)
&& map.bfield[x][y] == 0); && map.bfield[x][y] == 0);
} }
@ -139,8 +140,7 @@ ai_easyrunaway (_point p)
/* give the run away direction /* give the run away direction
the return value: the return value: */
*/
_airunaway _airunaway
ai_runawayfrom (_point p, int nearbomb, signed char norecursive) ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
{ {

Loading…
Cancel
Save