From abc50df9c2f5bd6584ceb4c42327b0037fbfd289 Mon Sep 17 00:00:00 2001 From: stpohle Date: Sun, 27 Jul 2003 13:29:25 +0000 Subject: [PATCH] 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. --- configure.in | 2 +- maps/kitutou1.map | 20 --- maps/kitutou2.map | 27 ---- maps/smalfull.map | 15 -- src/basic.h | 22 ++- src/bomberclone.h | 6 +- src/field.c | 379 ++++++++++++++++++++++++++++++++++------------ src/font.c | 4 +- src/game.c | 12 +- src/map.h | 4 +- src/mapmenu.c | 8 +- src/netmenu.c | 4 +- src/network.c | 4 +- src/network.h | 2 +- src/single.c | 8 +- 15 files changed, 334 insertions(+), 183 deletions(-) delete mode 100644 maps/kitutou1.map delete mode 100644 maps/kitutou2.map delete mode 100644 maps/smalfull.map diff --git a/configure.in b/configure.in index 851347f..57f9146 100644 --- a/configure.in +++ b/configure.in @@ -135,5 +135,5 @@ AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}") AC_OUTPUT([ Makefile src/Makefile +data/Makefile ]) - diff --git a/maps/kitutou1.map b/maps/kitutou1.map deleted file mode 100644 index 5cb700b..0000000 --- a/maps/kitutou1.map +++ /dev/null @@ -1,20 +0,0 @@ -% Map created by kitutou (04/05/2003) -% for testing purpose -% -######################### -#@@ @@@@@ @@# -#@@ @@@@@ @@# -# @@@@@ # -# @@@@@ # -# @@@@@ # -#@@@@@@@@@@@@@@@@@@@@@@@# -#@@@@@@@@@@ @@@@@@@@@@# -#@@@@@@@@@@ @@@@@@@@@@# -#@@@@@@@@@@ @@@@@@@@@@# -#@@@@@@@@@@@@@@@@@@@@@@@# -# @@@@@ # -# @@@@@ # -# @@@@@ # -#@@ @@@@@ @@# -#@@ @@@@@ @@# -######################### diff --git a/maps/kitutou2.map b/maps/kitutou2.map deleted file mode 100644 index d4122fb..0000000 --- a/maps/kitutou2.map +++ /dev/null @@ -1,27 +0,0 @@ -% Map created by kitutou (04/05/2003) -% for testing purpose -% -######################## -# # -# # -# # # # -# #### #### # -# # # # -# ###@@@@### # -# ### #@@@@# ### # -# # # #@@@@# # # # -# # ####@@@@#### # # -# ## @@@@@@@@@@@@ ## # -# @@@@@ @@@@@ # -# @@@@@ @@@@@ # -# ## @@@@@@@@@@@@ ## # -# # ####@@@@#### # # -# # # #@@@@# # # # -# ### #@@@@# ### # -# ###@@@@### # -# # # # -# #### #### # -# # # # -# # -# # -######################## \ No newline at end of file diff --git a/maps/smalfull.map b/maps/smalfull.map deleted file mode 100644 index 46a907c..0000000 --- a/maps/smalfull.map +++ /dev/null @@ -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 -% -########### -#@@@@#@@@@# -#@#@@@@@#@# -#@#######@# -#@#@@@@#@@# -#@@@@#@@@@# -#@#######@# -#@#@@@@@#@# -#@@@@#@@@@# -########### \ No newline at end of file diff --git a/src/basic.h b/src/basic.h index 22a063d..6a2e66e 100644 --- a/src/basic.h +++ b/src/basic.h @@ -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 */ #ifndef _BC_BASIC_H_ @@ -16,6 +16,8 @@ #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_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min) #define EXPLOSION_SAVE_DISTANCE 64 #define SPECIAL_TRIGGER_TIMEOUT 15 @@ -78,6 +80,11 @@ #define MENU_BG_SHADE_DARK -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--); enum _networkflags { @@ -202,6 +209,19 @@ enum _dirbitmask { // bit mask for the directions 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 { short int x; diff --git a/src/bomberclone.h b/src/bomberclone.h index 1b57d49..6097049 100644 --- a/src/bomberclone.h +++ b/src/bomberclone.h @@ -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 */ #ifndef _BOMBERCLONE_H_ @@ -131,6 +131,7 @@ struct __bomberclone { unsigned char gametype; unsigned char multitype; unsigned char state; + int timeout; // game timeout char playername[LEN_PLAYERNAME]; int players_nr_s; // number of players at the beginning 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_animation_add (int x, int y); 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 stonelist_add (int x, int y); extern void stonelist_del (); diff --git a/src/field.c b/src/field.c index 3bb7ee6..5e9d8ff 100644 --- a/src/field.c +++ b/src/field.c @@ -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 */ #include "bomberclone.h" @@ -6,48 +6,63 @@ static _point fieldani[MAX_FIELDANIMATION]; 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 */ -void stonelist_del () { - register int i; - - for (i = 0; i < MAX_STONESTODRAW; i++) - stonelist[i].x = stonelist[i].y = -1; +void +stonelist_del () +{ + register int i; + + for (i = 0; i < MAX_STONESTODRAW; i++) + stonelist[i].x = stonelist[i].y = -1; } /* stonelist will be draw and cleaned */ -void stonelist_draw () { - int i; - - 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; - } +void +stonelist_draw () +{ + int i; + + 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 */ -static void _stonelist_add (int x, int y, int recursive) { - int i; - _point *slentry = NULL; - - for (i = 0, slentry = NULL; i < MAX_STONESTODRAW && slentry == NULL; i++) - if (stonelist[i].x == -1 || stonelist[i].y == -1 || (stonelist[i].x == x && stonelist[i].y == y)) - slentry = &stonelist[i]; - - if (slentry == NULL) // no space left - d_fatal ("field.c adddraw_stone(): out of space in stonelist[]\n"); - else { - slentry->x = x; - slentry->y = y; - - 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); - } +static void +_stonelist_add (int x, int y, int recursive) +{ + int i; + _point *slentry = NULL; + + for (i = 0, slentry = NULL; i < MAX_STONESTODRAW && slentry == NULL; i++) + if (stonelist[i].x == -1 || stonelist[i].y == -1 + || (stonelist[i].x == x && stonelist[i].y == y)) + slentry = &stonelist[i]; + + if (slentry == NULL) // no space left + d_fatal ("field.c adddraw_stone(): out of space in stonelist[]\n"); + else { + slentry->x = x; + slentry->y = y; + + 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 @@ -60,10 +75,10 @@ draw_stone (int x, int y) int i, d; - 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); - return; - } + 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); + return; + } src.w = dest.w = gfx.block.x; src.h = dest.h = gfx.block.y; @@ -81,26 +96,26 @@ draw_stone (int x, int y) srcbg.h = dest.h; srcbg.x = (x % gfx.field[FT_nothing].frames) * gfx.block.x; srcbg.y = (y % gfx.field[FT_nothing].frames) * gfx.block.y; - + gfx_blit (gfx.field[FT_nothing].image, &srcbg, gfx.screen, &dest, 0); } - if (stone->type == FT_mixed) { - i = stone->mixframe; - if (i < FT_death || i >= FT_mixed) - i = FT_death; - } - else - i = stone->type; - + if (stone->type == FT_mixed) { + i = stone->mixframe; + if (i < FT_death || i >= FT_mixed) + i = FT_death; + } + else + i = stone->type; + /* animate the stone if needed only for exploding stone */ if (stone->type == FT_stone && stone->frame > 0) { field_animation_add (x, y); if (stone->frame < gfx.field[FT_stone].frames) { src.y = stone->frame * 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.h = src.h = gfx.field[FT_stone].h; + dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w); srcimg = gfx.field[FT_stone].image; } else { @@ -111,47 +126,52 @@ draw_stone (int x, int y) else if (stone->type == FT_stone || stone->type == FT_block) { 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); + dest.h = src.h = gfx.field[stone->type].h; + dest.y -= (gfx.field[stone->type].h - gfx.field[stone->type].w); srcimg = gfx.field[stone->type].image; } - + /* some powerup so we need to animate this too */ if (i == FT_death) - d = PWUP_bad; - else if (i >= FT_sp_trigger) - d = PWUP_special; - else - d = PWUP_good; + d = PWUP_bad; + else if (i >= FT_sp_trigger) + d = PWUP_special; + else + d = PWUP_good; - if (i >= FT_death) { + if (i >= FT_death) { field_animation_add (x, y); srcimg = gfx.powerup[d].image; - if (stone->frame >= gfx.powerup[d].frames) - stone->frame = 0; + if (stone->frame >= gfx.powerup[d].frames) + stone->frame = 0; src.y = stone->frame * gfx.block.y; - } - + } + if (srcimg != NULL) gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 1); - if (i >= FT_death) { /* draw now the powerup itself */ - srcimg = gfx.field[i].image; + if (i >= FT_death) { /* draw now the powerup itself */ + srcimg = gfx.field[i].image; src.y = 0; gfx_blit (srcimg, &src, gfx.screen, &dest, (y << 8) + 2); } - /* if the current field is half hidden by the lower - 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) { - src.x = 0; - src.y = map.field[x][y+1].frame * gfx.field[map.field[x][y+1].type].h; - dest.h = src.h = gfx.field[map.field[x][y+1].type].h - gfx.field[map.field[x][y+1].type].w; - 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); - } - + /* if the current field is half hidden by the lower + 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) { + src.x = 0; + src.y = map.field[x][y + 1].frame * gfx.field[map.field[x][y + 1].type].h; + dest.h = src.h = + gfx.field[map.field[x][y + 1].type].h - gfx.field[map.field[x][y + 1].type].w; + 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 for (d = 0, i = 0; d < 4; d++) if (stone->ex[d].count > 0) { @@ -189,15 +209,16 @@ field_clear (int x, int y) void field_animation () { - int i,j; - _field *stone; - + int i, + j; + _field *stone; + for (i = 0; i < MAX_FIELDANIMATION; i++) if (fieldani[i].x >= 0 && fieldani[i].x < map.size.x && fieldani[i].y >= 0 && fieldani[i].y < map.size.y) { /* 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)) { /* animate this stone */ if (stone->type == FT_stone) { @@ -210,27 +231,27 @@ field_animation () if (stone->frameto > 0) stone->frameto--; } - else { /* animation is a powerup */ - /* select right powerup animation */ - if (stone->type == FT_death) - j = PWUP_bad; - else if (stone->type > FT_sp_trigger) - j = PWUP_special; - else - j = PWUP_good; - - /* do the animation of the FT_mixed */ - if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) { - stone->frameto = ANI_STONETIMEOUT; - stone->frame++; - if (stone->type == FT_mixed) { - stone->mixframe++; - if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed) - stone->mixframe = FT_death; - } + else { /* animation is a powerup */ + /* select right powerup animation */ + if (stone->type == FT_death) + j = PWUP_bad; + else if (stone->type > FT_sp_trigger) + j = PWUP_special; + else + j = PWUP_good; + + /* do the animation of the FT_mixed */ + if (stone->frameto-- <= 0 || stone->frameto > ANI_STONETIMEOUT) { + stone->frameto = ANI_STONETIMEOUT; + stone->frame++; + if (stone->type == FT_mixed) { + stone->mixframe++; + if (stone->mixframe < FT_death || stone->mixframe >= FT_mixed) + stone->mixframe = FT_death; + } } - - if (stone->frame >= gfx.powerup[j].frames) + + if (stone->frame >= gfx.powerup[j].frames) stone->frame = 0; } 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].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); + } + } +}; diff --git a/src/font.c b/src/font.c index 28af630..f298e93 100644 --- a/src/font.c +++ b/src/font.c @@ -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 #include @@ -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, y - bold, text, size); font_draw (x, y + bold, text, size); -}; \ No newline at end of file +}; diff --git a/src/game.c b/src/game.c index ee75249..2e62461 100644 --- a/src/game.c +++ b/src/game.c @@ -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. */ #include @@ -200,7 +200,7 @@ game_loop () /* this will even set the variable "bman.player_nr" to let us know how much Players are still left */ bomb_loop (); - field_animation (); + field_loop (); draw_players (); game_draw_info (); @@ -208,11 +208,12 @@ game_loop () and if there the last dieing animation is done */ if ((bman.players_nr < 2 && (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--; if (gameovertimeout <= 0) { - d_printf ("GAME: Game Over 'Cause only one or none anymore alife\n"); + d_printf ("GAME: Game Over\n"); done = 1; } @@ -278,6 +279,9 @@ game_start () tileset_load (map.tileset); gfx_load_players (gfx.block.x, gfx.block.y); snd_load (map.tileset); + + map.state = MS_normal; + bman.timeout = GAME_TIMEOUT; }; diff --git a/src/map.h b/src/map.h index 399958a..af8d31b 100644 --- a/src/map.h +++ b/src/map.h @@ -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 */ #ifndef _MAP_H_ @@ -40,6 +40,8 @@ struct __map { unsigned char sp_trigger; unsigned char sp_push; unsigned char sp_row; + + unsigned char state; // state of the map } typedef _map; diff --git a/src/mapmenu.c b/src/mapmenu.c index e82e79d..cce9b56 100644 --- a/src/mapmenu.c +++ b/src/mapmenu.c @@ -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 */ #include "bomberclone.h" @@ -37,7 +37,7 @@ mapmenu () while (menuselect != -1) { switch (map.map_selection) { - case (0): // Selected Map + case (MAPS_select): // Selected Map if (map.map[0] == 0) sprintf (menu[1].text, "Selected Map: < undefined >"); else @@ -49,7 +49,7 @@ mapmenu () menu[3].text[0] = 0; menu[3].index = 0; break; - case (1): // Random Map + case (MAPS_randmap): // Random Map menu[1].text[0] = 0; menu[1].index = 0; sprintf (menu[0].text, "Random Map: random file"); @@ -58,7 +58,7 @@ mapmenu () menu[3].text[0] = 0; menu[3].index = 0; break; - case (2): // Random Generated Map + case (MAPS_randgen): // Random Generated Map menu[1].text[0] = 0; menu[1].index = 0; sprintf (menu[0].text, "Random Map: auto-generated"); diff --git a/src/netmenu.c b/src/netmenu.c index dac76d9..d58b88e 100644 --- a/src/netmenu.c +++ b/src/netmenu.c @@ -235,7 +235,7 @@ host_multiplayer_game () init_map_tileset(); net_send_servermode (); game_start (); - net_new_gamedata (); + net_transmit_gamedata (); if (bman.state == GS_ready || bman.state == GS_running) { net_send_servermode (); @@ -274,7 +274,7 @@ join_multiplayer_game () game_start (); bman.state = GS_update; net_new_game (); - net_new_gamedata (); + net_transmit_gamedata (); if (bman.state == GS_ready || bman.state == GS_running) game_loop (); diff --git a/src/network.c b/src/network.c index 84e0b7c..7b3b1ad 100644 --- a/src/network.c +++ b/src/network.c @@ -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. */ @@ -391,7 +391,7 @@ net_change_playerid (int pl_nr, unsigned char senddata) within the network loop */ void -net_new_gamedata () +net_transmit_gamedata () { int done = 0, keypressed = 0, diff --git a/src/network.h b/src/network.h index 979361e..c27fa4c 100644 --- a/src/network.h +++ b/src/network.h @@ -73,7 +73,7 @@ extern int network_init (); extern int network_loop (); extern void net_change_playerid (int pl_nr, unsigned char senddata); 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_playermove (int p_nr, int mustsend); extern void net_game_send_bomb (int p, int b); diff --git a/src/single.c b/src/single.c index 3131384..4bc1856 100644 --- a/src/single.c +++ b/src/single.c @@ -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 */ #include "basic.h" @@ -61,7 +61,8 @@ inline int ai_checkfield (int x, int y) { 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); } @@ -139,8 +140,7 @@ ai_easyrunaway (_point p) /* give the run away direction - the return value: -*/ + the return value: */ _airunaway ai_runawayfrom (_point p, int nearbomb, signed char norecursive) {