diff options
Diffstat (limited to 'code/client/cl_main.c')
-rw-r--r-- | code/client/cl_main.c | 90 |
1 files changed, 86 insertions, 4 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c index e05a640..4c5b403 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -608,6 +608,9 @@ CL_ShutdownAll */ void CL_ShutdownAll(void) { +#if USE_CURL + CL_cURL_Shutdown(); +#endif // clear sounds S_DisableSounds(); // shutdown CGame @@ -1331,6 +1334,23 @@ Called when all downloading has been completed */ void CL_DownloadsComplete( void ) { +#if USE_CURL + // if we downloaded with cURL + if(clc.cURLUsed) { + clc.cURLUsed = qfalse; + CL_cURL_Shutdown(); + if( clc.cURLDisconnected ) { + if(clc.downloadRestart) { + FS_Restart(clc.checksumFeed); + clc.downloadRestart = qfalse; + } + clc.cURLDisconnected = qfalse; + CL_Reconnect_f(); + return; + } + } +#endif + // if we downloaded files we need to restart the file system if (clc.downloadRestart) { clc.downloadRestart = qfalse; @@ -1418,6 +1438,7 @@ A download completed or failed void CL_NextDownload(void) { char *s; char *remoteName, *localName; + qboolean useCURL = qfalse; // We are looking to start a download here if (*clc.downloadList) { @@ -1441,9 +1462,48 @@ void CL_NextDownload(void) { *s++ = 0; else s = localName + strlen(localName); // point at the nul byte - - CL_BeginDownload( localName, remoteName ); - +#if USE_CURL + if(!(cl_allowDownload->integer & DLF_NO_REDIRECT)) { + if(clc.sv_allowDownload & DLF_NO_REDIRECT) { + Com_Printf("WARNING: server does not " + "allow download redirection " + "(sv_allowDownload is %d)\n", + clc.sv_allowDownload); + } + else if(!*clc.sv_dlURL) { + Com_Printf("WARNING: server allows " + "download redirection, but does not " + "have sv_dlURL set\n"); + } + else if(!CL_cURL_Init()) { + Com_Printf("WARNING: could not load " + "cURL library\n"); + } + else { + CL_cURL_BeginDownload(localName, va("%s/%s", + clc.sv_dlURL, remoteName)); + useCURL = qtrue; + } + } + else if(!(clc.sv_allowDownload & DLF_NO_REDIRECT)) { + Com_Printf("WARNING: server allows download " + "redirection, but it disabled by client " + "configuration (cl_allowDownload is %d)\n", + cl_allowDownload->integer); + } +#endif /* USE_CURL */ + if(!useCURL) { + if((cl_allowDownload->integer & DLF_NO_UDP)) { + Com_Error(ERR_DROP, "UDP Downloads are " + "disabled on your client. " + "(cl_allowDownload is %d)", + cl_allowDownload->integer); + return; + } + else { + CL_BeginDownload( localName, remoteName ); + } + } clc.downloadRestart = qtrue; // move over the rest @@ -1466,7 +1526,7 @@ and determine if we need to download them void CL_InitDownloads(void) { char missingfiles[1024]; - if ( !cl_allowDownload->integer ) + if ( !(cl_allowDownload->integer & DLF_ENABLE) ) { // autodownload is disabled on the client // but it's possible that some referenced files on the server are missing @@ -2028,6 +2088,25 @@ void CL_Frame ( int msec ) { return; } +#if USE_CURL + if(clc.downloadCURLM) { + CL_cURL_PerformDownload(); + // we can't process frames normally when in disconnected + // download mode since the ui vm expects cls.state to be + // CA_CONNECTED + if(clc.cURLDisconnected) { + cls.realFrametime = msec; + cls.frametime = msec; + cls.realtime += cls.frametime; + SCR_UpdateScreen(); + S_Update(); + Con_RunConsole(); + cls.framecount++; + return; + } + } +#endif + if ( cls.cddialog ) { // bring up the cd error dialog if needed cls.cddialog = qfalse; @@ -2478,6 +2557,9 @@ void CL_Init( void ) { cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0); cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE); +#if USE_CURL + cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE); +#endif cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0); #ifdef MACOS_X |