diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 637bbe69a..b86888334 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1484,39 +1484,36 @@ void CL_UpdateServerList (void) #endif // ifndef NONET -static void M_ConfirmConnect(event_t *ev) +static void M_ConfirmConnect(void) { #ifndef NONET - if (ev->type == ev_keydown) + if (G_PlayerInputDown(0, gc_a, 1) || gamekeydown[0][KEY_ENTER]) { - if (G_PlayerInputDown(0, gc_a, 1) || gamekeydown[0][KEY_ENTER]) + if (totalfilesrequestednum > 0) { - if (totalfilesrequestednum > 0) +#ifdef HAVE_CURL + if (http_source[0] == '\0' || curl_failedwebdownload) +#endif { -#ifdef HAVE_CURL - if (http_source[0] == '\0' || curl_failedwebdownload) -#endif + if (CL_SendFileRequest()) { - if (CL_SendFileRequest()) - { - cl_mode = CL_DOWNLOADFILES; - } + cl_mode = CL_DOWNLOADFILES; } -#ifdef HAVE_CURL - else - cl_mode = CL_PREPAREHTTPFILES; -#endif } +#ifdef HAVE_CURL else - cl_mode = CL_LOADFILES; + cl_mode = CL_PREPAREHTTPFILES; +#endif + } + else + cl_mode = CL_LOADFILES; - M_ClearMenus(true); - } - else if (G_PlayerInputDown(0, gc_b, 1) || G_PlayerInputDown(0, gc_x, 1) || gamekeydown[0][KEY_ESCAPE]) - { - cl_mode = CL_ABORTED; - M_ClearMenus(true); - } + M_ClearMenus(true); + } + else if (G_PlayerInputDown(0, gc_b, 1) || G_PlayerInputDown(0, gc_x, 1) || gamekeydown[0][KEY_ESCAPE]) + { + cl_mode = CL_ABORTED; + M_ClearMenus(true); } #else (void)ev; @@ -1570,8 +1567,8 @@ static boolean CL_FinishedFileList(void) "\n" "You may load server addons (if any), and wait for a slot.\n" "\n" - "Press (A) to continue or (B) to cancel.\n\n" - ), FUNCPTRCAST (M_ConfirmConnect), MM_EVENTHANDLER); + "Press (A) to continue or (B) to cancel\n" + ), NULL, MM_NOTHING); cl_mode = CL_CONFIRMCONNECT; } else @@ -1633,18 +1630,21 @@ static boolean CL_FinishedFileList(void) if (serverisfull) M_StartMessage(va(M_GetText( "This server is full!\n" - "Download of %s additional content is required to join.\n" + "Download of %s additional content\n" + "is required to join.\n" "\n" - "You may download, load server addons, and wait for a slot.\n" + "You may download, load server addons,\n" + "and wait for a slot.\n" "\n" - "Press (A) to continue or (B) to cancel.\n\n" - ), downloadsize), FUNCPTRCAST(M_ConfirmConnect), MM_EVENTHANDLER); + "Press (A) to continue or (B) to cancel\n" + ), downloadsize), NULL, MM_NOTHING); else M_StartMessage(va(M_GetText( - "Download of %s additional content is required to join.\n" + "Download of %s additional content\n" + "is required to join.\n" "\n" - "Press (A) to continue or (B) to cancel.\n\n" - ), downloadsize), FUNCPTRCAST(M_ConfirmConnect), MM_EVENTHANDLER); + "Press (A) to continue or (B) to cancel\n" + ), downloadsize), NULL, MM_NOTHING); Z_Free(downloadsize); cl_mode = CL_CONFIRMCONNECT; @@ -1919,19 +1919,24 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic memset(deviceResponding, false, sizeof (deviceResponding)); - if (cl_mode == CL_CONFIRMCONNECT) - { - D_ProcessEvents(); //needed for menu system to receive inputs - } - else if (netgame) + if (netgame) { for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) + { G_MapEventsToControls(&events[eventtail]); + } - if (G_PlayerInputDown(0, gc_b, 1) - || G_PlayerInputDown(0, gc_x, 1) - || gamekeydown[0][KEY_ESCAPE]) - cl_mode = CL_ABORTED; + if (cl_mode == CL_CONFIRMCONNECT) + { + M_ConfirmConnect(); + } + else + { + if (G_PlayerInputDown(0, gc_b, 1) + || G_PlayerInputDown(0, gc_x, 1) + || gamekeydown[0][KEY_ESCAPE]) + cl_mode = CL_ABORTED; + } } if (cl_mode == CL_ABORTED) @@ -1962,13 +1967,17 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic M_DrawEggaChannel(); } CL_DrawConnectionStatus(); + + if (cl_mode == CL_CONFIRMCONNECT) + { #ifdef HAVE_THREADS - I_lock_mutex(&k_menu_mutex); + I_lock_mutex(&k_menu_mutex); #endif - M_Drawer(); //Needed for drawing messageboxes on the connection screen + M_DrawMenuMessage(); #ifdef HAVE_THREADS - I_unlock_mutex(k_menu_mutex); + I_unlock_mutex(k_menu_mutex); #endif + } I_UpdateNoVsync(); // page flip or blit buffer if (moviemode) M_SaveFrame(); diff --git a/src/k_menu.h b/src/k_menu.h index 75160c22e..859e972be 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -561,6 +561,7 @@ void M_Init(void); extern menu_t MessageDef; void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype); void M_StopMessage(INT32 choice); +void M_DrawMenuMessage(void); void M_QuitResponse(INT32 ch); void M_QuitSRB2(INT32 choice); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 4c3db159a..509fb1673 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -433,7 +433,7 @@ static void M_DrawMenuTyping(void) } // Draw the message popup submenu -static void M_DrawMenuMessage(void) +void M_DrawMenuMessage(void) { INT32 y = menumessage.y + (9-menumessage.fadetimer)*20; @@ -443,6 +443,9 @@ static void M_DrawMenuMessage(void) INT32 mlines; const char *msg = menumessage.message; + if (!menumessage.active) + return; + mlines = menumessage.m>>8; max = (INT16)((UINT8)(menumessage.m & 0xFF)*8); @@ -550,8 +553,7 @@ void M_Drawer(void) } // Draw message overlay when needed - if (menumessage.active) - M_DrawMenuMessage(); + M_DrawMenuMessage(); // Draw typing overlay when needed, above all other menu elements. if (menutyping.active) diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 8adb24070..2ce5ef95b 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1813,7 +1813,7 @@ void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtyp strncpy(menumessage.message, string, MAXMENUMESSAGE); menumessage.flags = itemtype; *(void**)&menumessage.routine = routine; - menumessage.fadetimer = 1; + menumessage.fadetimer = (gamestate == GS_WAITINGPLAYERS) ? 9 : 1; menumessage.active = true; start = 0;