hurry warning

origin
stpohle 22 years ago
parent 6d6c3ac7ff
commit 4378205213

@ -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 */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -81,9 +81,10 @@
#define MENU_BG_SHADE_BRIGHT 64 #define MENU_BG_SHADE_BRIGHT 64
#define FIELDECHECK_TIMEOUT 100 /* timeout for the field check function */ #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 FIELDHURRYDROPTO 50 /* timeout when to put in some special items */
#define FIELDHURRYSIZE 5 /* 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 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--); #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 { enum _mstatus {
MS_normal = 0, MS_normal = 0,
MS_hurrywarn,
MS_hurry, // mapsize will go down MS_hurry, // mapsize will go down
MS_dropitems, // alot of items will be droppen randomly into the game MS_dropitems, // alot of items will be droppen randomly into the game

@ -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 */ /* field.c - procedures which are needed to control the field */
#include "bomberclone.h" #include "bomberclone.h"
@ -315,7 +315,6 @@ field_checkisempty ()
void void
field_loop () field_loop ()
{ {
/* single game or multiplayer master, so check field state */ /* single game or multiplayer master, so check field state */
if (GT_MP_PTPM || bman.gametype == GT_single) { if (GT_MP_PTPM || bman.gametype == GT_single) {
@ -326,17 +325,26 @@ field_loop ()
bman.timeout = 0; // set the gametimeout to 0 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 /* gametimeout is 0 and we are still at more normal set randomly a
way to end the game */ way to end the game */
if (bman.timeout-- <= 0 && map.state == MS_normal) { if (bman.timeout-- <= 0 && map.state == MS_hurrywarn) {
int rndmax; int rndmax;
if (map.map_selection == MAPS_randgen) if (map.map_selection == MAPS_randgen)
rndmax = MS_max - 1; // generaged map rndmax = MS_max - 2; // generaged map
else 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); d_printf ("Game Timeout 1 over: Random map.state = %d\n", map.state);
bman.timeout = GAME_TIMEOUTHURRY; bman.timeout = GAME_TIMEOUTHURRY;

@ -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. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -97,6 +97,13 @@ game_draw_info ()
font_draw (100, 32, "Press F4 to start the game", 0); font_draw (100, 32, "Press F4 to start the game", 0);
else if (bman.state == GS_ready) else if (bman.state == GS_ready)
font_draw (100, 32, "Waiting for the Server to Start", 0); 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) if (chat.visible == 0 && GT_MP_PTP)

@ -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. */ /* map handling, like generate and load maps. */
#include "bomberclone.h" #include "bomberclone.h"
@ -109,7 +109,7 @@ map_genrandom ()
if ((s_random (256) & 3) == 0) if ((s_random (256) & 3) == 0)
map.field[x][y].type = FT_nothing; map.field[x][y].type = FT_nothing;
else else
map.field[x][y].type = FT_stone; map.field[x][y].type = FT_nothing;
} }
for (d = 0; d < 4; d++) for (d = 0; d < 4; d++)

@ -267,6 +267,7 @@ do_servermode (struct pkg_servermode *s_mod, _net_addr * addr)
bman.gametype = GT_single; bman.gametype = GT_single;
bman.state = s_mod->state; bman.state = s_mod->state;
map.state = s_mod->mapstate;
if (s_mod->multitype == MT_ptpm) if (s_mod->multitype == MT_ptpm)
bman.multitype = MT_ptps; 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.len = sizeof (struct pkg_servermode);
s_mod.h.flags = PKGF_ackreq; s_mod.h.flags = PKGF_ackreq;
s_mod.type = bman.gametype; s_mod.type = bman.gametype;
s_mod.mapstate = map.state;
if (bman.state == GS_quit) /* do not send GS_quit */ if (bman.state == GS_quit) /* do not send GS_quit */
s_mod.state = GS_startup; s_mod.state = GS_startup;
else else

@ -85,6 +85,7 @@ struct pkg_servermode {
unsigned char state; unsigned char state;
unsigned char multitype; unsigned char multitype;
unsigned char players; unsigned char players;
unsigned char mapstate;
unsigned char maxplayer; unsigned char maxplayer;
signed char last_winner; signed char last_winner;
signed char fieldsize_x; signed char fieldsize_x;

Loading…
Cancel
Save