From 43782052139076b1216fcdd7e42134f4019cd053 Mon Sep 17 00:00:00 2001 From: stpohle Date: Sun, 27 Jul 2003 20:53:21 +0000 Subject: [PATCH] hurry warning --- src/basic.h | 8 +++++--- src/field.c | 22 +++++++++++++++------- src/game.c | 9 ++++++++- src/map.c | 4 ++-- src/packets.c | 2 ++ src/packets.h | 1 + 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/basic.h b/src/basic.h index 6a2e66e..0189e2b 100644 --- a/src/basic.h +++ b/src/basic.h @@ -1,4 +1,4 @@ -/* $Id: basic.h,v 1.43 2003/07/27 13:29:25 stpohle Exp $ */ +/* $Id: basic.h,v 1.44 2003/07/27 20:53:21 stpohle Exp $ */ /* basic types which we need everywhere */ #ifndef _BC_BASIC_H_ @@ -81,9 +81,10 @@ #define MENU_BG_SHADE_BRIGHT 64 #define FIELDECHECK_TIMEOUT 100 /* timeout for the field check function */ +#define FIELDHURRYWARN 200 /* hurry warning */ #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 FIELDHURRYSIZE 5 /* timeout when to put in some special items */ +#define FIELDHURRYSIZEMIN 15 /* 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--); @@ -217,6 +218,7 @@ enum _mapselection { enum _mstatus { MS_normal = 0, + MS_hurrywarn, MS_hurry, // mapsize will go down MS_dropitems, // alot of items will be droppen randomly into the game diff --git a/src/field.c b/src/field.c index 672aabb..04239fa 100644 --- a/src/field.c +++ b/src/field.c @@ -1,4 +1,4 @@ -/* $Id: field.c,v 1.40 2003/07/27 14:34:40 stpohle Exp $ */ +/* $Id: field.c,v 1.41 2003/07/27 20:53:21 stpohle Exp $ */ /* field.c - procedures which are needed to control the field */ #include "bomberclone.h" @@ -315,7 +315,6 @@ field_checkisempty () void field_loop () { - /* single game or multiplayer master, so check field state */ if (GT_MP_PTPM || bman.gametype == GT_single) { @@ -326,17 +325,26 @@ field_loop () bman.timeout = 0; // set the gametimeout to 0 } + /* to show the warning */ + if (map.state == MS_normal && bman.timeout-- <= 0) { + bman.timeout = FIELDHURRYWARN; + map.state = MS_hurrywarn; + bman.updatestatusbar = 1; + if (GT_MP_PTPM) + net_send_servermode (); + } + /* 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) { + if (bman.timeout-- <= 0 && map.state == MS_hurrywarn) { int rndmax; if (map.map_selection == MAPS_randgen) - rndmax = MS_max - 1; // generaged map + rndmax = MS_max - 2; // generaged map else - rndmax = MS_max - 2; // user defined map + rndmax = MS_max - 3; // user defined map - map.state = 1 + s_random (rndmax); + map.state = 2 + s_random (rndmax); d_printf ("Game Timeout 1 over: Random map.state = %d\n", map.state); bman.timeout = GAME_TIMEOUTHURRY; @@ -350,7 +358,7 @@ field_loop () field_hurrydropitems (); } - field_animation (); + field_animation (); }; diff --git a/src/game.c b/src/game.c index 054d46e..695e127 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.48 2003/07/27 20:16:58 stpohle Exp $ +/* $Id: game.c,v 1.49 2003/07/27 20:53:21 stpohle Exp $ game.c - procedures for the game. */ #include @@ -97,6 +97,13 @@ game_draw_info () font_draw (100, 32, "Press F4 to start the game", 0); else if (bman.state == GS_ready) font_draw (100, 32, "Waiting for the Server to Start", 0); + + if (map.state == MS_hurrywarn) { + font_setcolor (255,255,255,1); + font_drawbold ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 32, "HURRY HURRY", 1, 2); + font_setcolor (255,128, 128,1); + font_draw ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 32, "HURRY HURRY", 1); + } } if (chat.visible == 0 && GT_MP_PTP) diff --git a/src/map.c b/src/map.c index f89539b..b158ec8 100644 --- a/src/map.c +++ b/src/map.c @@ -1,4 +1,4 @@ -/* $Id: map.c,v 1.4 2003/07/27 14:34:40 stpohle Exp $ */ +/* $Id: map.c,v 1.5 2003/07/27 20:53:21 stpohle Exp $ */ /* map handling, like generate and load maps. */ #include "bomberclone.h" @@ -109,7 +109,7 @@ map_genrandom () if ((s_random (256) & 3) == 0) map.field[x][y].type = FT_nothing; else - map.field[x][y].type = FT_stone; + map.field[x][y].type = FT_nothing; } for (d = 0; d < 4; d++) diff --git a/src/packets.c b/src/packets.c index 4f03ad8..ff4be20 100644 --- a/src/packets.c +++ b/src/packets.c @@ -267,6 +267,7 @@ do_servermode (struct pkg_servermode *s_mod, _net_addr * addr) bman.gametype = GT_single; bman.state = s_mod->state; + map.state = s_mod->mapstate; if (s_mod->multitype == MT_ptpm) bman.multitype = MT_ptps; @@ -294,6 +295,7 @@ send_servermode (_net_addr * addr, int pl_nr) s_mod.h.len = sizeof (struct pkg_servermode); s_mod.h.flags = PKGF_ackreq; s_mod.type = bman.gametype; + s_mod.mapstate = map.state; if (bman.state == GS_quit) /* do not send GS_quit */ s_mod.state = GS_startup; else diff --git a/src/packets.h b/src/packets.h index ed3a4d6..f4fa8c7 100644 --- a/src/packets.h +++ b/src/packets.h @@ -85,6 +85,7 @@ struct pkg_servermode { unsigned char state; unsigned char multitype; unsigned char players; + unsigned char mapstate; unsigned char maxplayer; signed char last_winner; signed char fieldsize_x;