From e417274c1eddf920adb9bc42863251b4e81f76bf Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 5 Sep 2012 17:25:34 +0000 Subject: [PATCH] Move G_HandleAsync() into game.h as 'static inline' and use everywhere else. git-svn-id: https://svn.eduke32.com/eduke32@2996 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/anim.c | 6 ++---- polymer/eduke32/source/game.c | 6 ------ polymer/eduke32/source/game.h | 6 ++++++ polymer/eduke32/source/net.c | 3 +-- polymer/eduke32/source/premap.c | 20 ++++++-------------- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index d36f3c552..e19faf661 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -332,8 +332,7 @@ void G_PlayAnim(const char *fn,char t) do { - handleevents(); - Net_GetPackets(); + G_HandleAsync(); if (I_CheckAllInput()) { @@ -404,8 +403,7 @@ void G_PlayAnim(const char *fn,char t) while (totalclock < ototalclock) { - handleevents(); - Net_GetPackets(); + G_HandleAsync(); if (I_CheckAllInput()) goto ENDOFANIMLOOP; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b836db66c..233ec351b 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1919,12 +1919,6 @@ void P_DoQuote(int32_t q, DukePlayer_t *p) ////////// OFTEN-USED FEW-LINERS ////////// -static void G_HandleAsync(void) -{ - handleevents(); - Net_GetPackets(); -} - static void handle_events_while_no_input(void) { I_ClearInputWaiting(); diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index b0294cf19..7fe2fcd67 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -335,6 +335,12 @@ extern char forcegl; #define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) #define S_StopSound(num) S_StopEnvSound(num, -1) +static inline void G_HandleAsync(void) +{ + handleevents(); + Net_GetPackets(); +} + // sector effector lotags enum { SE_16_REACTOR = 16, diff --git a/polymer/eduke32/source/net.c b/polymer/eduke32/source/net.c index 03a3a668b..afb41a98f 100644 --- a/polymer/eduke32/source/net.c +++ b/polymer/eduke32/source/net.c @@ -2005,8 +2005,7 @@ void Net_WaitForServer(void) if (g_netClientPeer) enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(packbuf, 2, ENET_PACKET_FLAG_RELIABLE)); - handleevents(); - Net_GetPackets(); + G_HandleAsync(); if (g_player[0].pingcnt > server_ready) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index a9df00727..084fac2cb 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -330,10 +330,8 @@ static void G_PrecacheSounds(void) { j++; if ((j&7) == 0) - { - handleevents(); - Net_GetPackets(); - } + G_HandleAsync(); + G_CacheSound(i); } } @@ -545,10 +543,8 @@ void G_CacheMapData(void) MUSIC_Update(); if ((j&7) == 0) - { - handleevents(); - Net_GetPackets(); - } + G_HandleAsync(); + if (totalclock - tc > TICRATE/4) { /*Bsprintf(tempbuf,"%d resources remaining\n",g_precacheCount-pc+1);*/ @@ -1446,16 +1442,12 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk) DukePlayer_t *p = g_player[0].ps; int32_t i; - handleevents(); - Net_GetPackets(); + G_HandleAsync(); if (g_skillSoundID >= 0 && ud.config.FXDevice >= 0 && ud.config.SoundToggle) { while (S_CheckSoundPlaying(-1, g_skillSoundID)) - { - handleevents(); - Net_GetPackets(); - } + G_HandleAsync(); } g_skillSoundID = -1;