diff --git a/include/sysfunc.h b/include/sysfunc.h index c386762..f93da8d 100644 --- a/include/sysfunc.h +++ b/include/sysfunc.h @@ -1,4 +1,4 @@ -/* $Id: sysfunc.h,v 1.6 2004/01/07 23:04:31 patty21 Exp $ */ +/* $Id: sysfunc.h,v 1.7 2005/08/07 17:46:20 stpohle Exp $ */ /* include some system near functions */ #ifndef _SYSFUNC_H_ @@ -26,6 +26,7 @@ struct __direntry { } typedef _direntry; extern void s_delay (int ms); +extern int s_fetchevent (SDL_Event *event); extern int s_random (int maxnr); extern char *s_gethomedir (); extern int s_countbits (int nbomb, int nr); diff --git a/src/game.c b/src/game.c index ecf6341..4a799b9 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.112 2005/07/06 13:11:55 stpohle Exp $ +/* $Id: game.c,v 1.113 2005/08/07 17:46:21 stpohle Exp $ game.c - procedures for the game. */ #include @@ -257,7 +257,7 @@ game_loop () } while (!done && (bman.state == GS_running || bman.state == GS_ready)) { - if ((eventstate = SDL_PollEvent (&event)) != 0) + if ((eventstate = s_fetchevent (&event)) != 0) switch (event.type) { case (SDL_QUIT): done = 1; @@ -884,7 +884,7 @@ game_showresult () while (!done && bman.state != GS_quit) { /* do the keyboard handling */ - if (SDL_PollEvent (&event) != 0) + if (s_fetchevent (&event) != 0) switch (event.type) { case (SDL_QUIT): bman.state = GS_quit; diff --git a/src/keyb.c b/src/keyb.c index 768079f..b100928 100644 --- a/src/keyb.c +++ b/src/keyb.c @@ -1,4 +1,4 @@ -/* $Id: keyb.c,v 1.5 2004/09/13 22:15:57 stpohle Exp $ +/* $Id: keyb.c,v 1.6 2005/08/07 17:46:21 stpohle Exp $ * keyb.c */ @@ -202,7 +202,7 @@ void keyb_config_readkey (int key) { reorder = 0; } - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); if (eventstate >= 1) { switch (event.type) { diff --git a/src/mapmenu.c b/src/mapmenu.c index 0225eef..7f7667c 100644 --- a/src/mapmenu.c +++ b/src/mapmenu.c @@ -1,4 +1,4 @@ -/* $Id: mapmenu.c,v 1.25 2004/12/13 21:29:31 stpohle Exp $ */ +/* $Id: mapmenu.c,v 1.26 2005/08/07 17:46:21 stpohle Exp $ */ /* map/tileset selection menu */ #include "bomberclone.h" @@ -298,7 +298,7 @@ mapinfo () while (!done && bman.state == GS_wait) { if (GT_MP && bman.sock != -1) { network_loop (); - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); } else eventstate = SDL_WaitEvent (&event); diff --git a/src/menu.c b/src/menu.c index d41a2e3..7d16dbd 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,4 @@ -/* $Id: menu.c,v 1.50 2005/03/27 01:31:50 stpohle Exp $ +/* $Id: menu.c,v 1.51 2005/08/07 17:46:21 stpohle Exp $ * Menuhandling */ #include "basic.h" @@ -538,7 +538,7 @@ menu_loop (_menu * menu) reorder = 0; } - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); done = menu_event_loop (menu, &event, eventstate); diff --git a/src/multiwait.c b/src/multiwait.c index a8039b8..2ce462d 100644 --- a/src/multiwait.c +++ b/src/multiwait.c @@ -1,4 +1,4 @@ -/* $Id: multiwait.c,v 1.56 2005/07/06 13:11:55 stpohle Exp $ +/* $Id: multiwait.c,v 1.57 2005/08/07 17:46:21 stpohle Exp $ multiwait.c - this manages only the network screen where everyone have to select it's players and where even the basic chat is inside */ @@ -220,7 +220,7 @@ void wait_for_players () { mw_init (); do { - if (SDL_PollEvent (&event) != 0) + if (s_fetchevent (&event) != 0) switch (event.type) { case (SDL_QUIT): bman.state = GS_quit; diff --git a/src/netsrvlist.c b/src/netsrvlist.c index e999e78..1197dd1 100644 --- a/src/netsrvlist.c +++ b/src/netsrvlist.c @@ -1,4 +1,4 @@ -/* $Id: netsrvlist.c,v 1.16 2005/04/10 03:28:02 stpohle Exp $ +/* $Id: netsrvlist.c,v 1.17 2005/08/07 17:46:21 stpohle Exp $ * netsrvlist.c - shows a list of possible servers.*/ #include "basic.h" @@ -157,7 +157,7 @@ void net_getserver () { menu_draw (menu); } - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); gfx_blitdraw (); done = menu_event_loop (menu, &event, eventstate); diff --git a/src/network.c b/src/network.c index 2863556..98480f5 100644 --- a/src/network.c +++ b/src/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.75 2005/07/06 13:11:56 stpohle Exp $ */ +/* $Id: network.c,v 1.76 2005/08/07 17:46:21 stpohle Exp $ */ /* network routines. */ @@ -615,7 +615,7 @@ net_transmit_gamedata () /* do the grafik work */ draw_netupdatestate (0); - if (SDL_PollEvent (&event) != 0) + if (s_fetchevent (&event) != 0) switch (event.type) { case (SDL_QUIT): bman.state = GS_quit; diff --git a/src/playermenu.c b/src/playermenu.c index 53b1442..e22c85c 100644 --- a/src/playermenu.c +++ b/src/playermenu.c @@ -1,4 +1,4 @@ -/* $Id: playermenu.c,v 1.17 2005/07/06 13:11:56 stpohle Exp $ +/* $Id: playermenu.c,v 1.18 2005/08/07 17:46:21 stpohle Exp $ */ #include "bomberclone.h" @@ -128,7 +128,7 @@ int playermenu_selgfx (int pl_nr) { ogc_loop (); } - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); if (eventstate) { switch (event.type) { @@ -300,7 +300,7 @@ void playermenu () { detail_Addr->changed = 1; detail_Flags->changed = 1; - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); if (bman.sock != -1) network_loop (); diff --git a/src/single.c b/src/single.c index 9c78bd6..0a5c17b 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.84 2005/02/14 20:09:19 stpohle Exp $ */ +/* $Id: single.c,v 1.85 2005/08/07 17:46:21 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -744,7 +744,7 @@ single_menu () do { gfx_blitdraw (); - eventstate = SDL_PollEvent (&event); + eventstate = s_fetchevent (&event); done = menu_event_loop (menu, &event, eventstate); diff --git a/src/sysfunc.c b/src/sysfunc.c index ffd00b5..f497158 100644 --- a/src/sysfunc.c +++ b/src/sysfunc.c @@ -1,4 +1,4 @@ -/* $Id: sysfunc.c,v 1.24 2005/04/08 00:18:29 stpohle Exp $ +/* $Id: sysfunc.c,v 1.25 2005/08/07 17:46:22 stpohle Exp $ sysfunc.c - this file hold some routines for the system functions.. like d_delay */ @@ -27,6 +27,16 @@ s_delay (int ms) }; +int +s_fetchevent (SDL_Event *event) +{ + if (SDL_PollEvent (event)) + return 1; + s_delay (20); + return 0; +} + + int s_random (int maxnr) {