Skip to content

Commit

Permalink
Merge branch 'master' into game/eliteforce
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Aug 12, 2015
2 parents 9839534 + 49ab0cc commit 8eeac09
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 31 deletions.
63 changes: 47 additions & 16 deletions code/client/cl_curl.c
Expand Up @@ -177,12 +177,20 @@ void CL_cURL_Shutdown( void )
void CL_cURL_Cleanup(void)
{
if(clc.downloadCURLM) {
CURLMcode result;

if(clc.downloadCURL) {
qcurl_multi_remove_handle(clc.downloadCURLM,
result = qcurl_multi_remove_handle(clc.downloadCURLM,
clc.downloadCURL);
if(result != CURLM_OK) {
Com_DPrintf("qcurl_multi_remove_handle failed: %s\n", qcurl_multi_strerror(result));
}
qcurl_easy_cleanup(clc.downloadCURL);
}
qcurl_multi_cleanup(clc.downloadCURLM);
result = qcurl_multi_cleanup(clc.downloadCURLM);
if(result != CURLM_OK) {
Com_DPrintf("CL_cURL_Cleanup: qcurl_multi_cleanup failed: %s\n", qcurl_multi_strerror(result));
}
clc.downloadCURLM = NULL;
clc.downloadCURL = NULL;
}
Expand All @@ -209,8 +217,25 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
return size*nmemb;
}

CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...)
{
CURLcode result;
va_list args;

va_start(args, option);
result = qcurl_easy_setopt(curl, option, args);
va_end(args);
if(result != CURLE_OK) {
Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result));
}

return result;
}

void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
{
CURLMcode result;

clc.cURLUsed = qtrue;
Com_Printf("URL: %s\n", remoteURL);
Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
Expand Down Expand Up @@ -246,23 +271,23 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
}

if(com_developer->integer)
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
NET_AdrToString(clc.serverAddress)));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
Q3_VERSION, qcurl_version()));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
CL_cURL_CallbackWrite);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
CL_cURL_CallbackProgress);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt_warn(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
clc.downloadCURLM = qcurl_multi_init();
if(!clc.downloadCURLM) {
qcurl_easy_cleanup(clc.downloadCURL);
Expand All @@ -271,7 +296,13 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
"failed");
return;
}
qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
result = qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
if(result != CURLM_OK) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
Com_Error(ERR_DROP,"CL_cURL_BeginDownload: qcurl_multi_add_handle() failed: %s", qcurl_multi_strerror(result));
return;
}

if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
!clc.cURLDisconnected) {
Expand Down
4 changes: 2 additions & 2 deletions code/game/bg_pmove.c
Expand Up @@ -483,9 +483,9 @@ static void PM_WaterMove( void ) {
// jump = head for surface
if ( pm->cmd.upmove >= 10 ) {
if (pm->ps->velocity[2] > -300) {
if ( pm->watertype == CONTENTS_WATER ) {
if ( pm->watertype & CONTENTS_WATER ) {
pm->ps->velocity[2] = 100;
} else if (pm->watertype == CONTENTS_SLIME) {
} else if ( pm->watertype & CONTENTS_SLIME ) {
pm->ps->velocity[2] = 80;
} else {
pm->ps->velocity[2] = 50;
Expand Down
5 changes: 4 additions & 1 deletion code/sdl/sdl_gamma.c
Expand Up @@ -88,6 +88,9 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
}
}

SDL_SetWindowGammaRamp(SDL_window, table[0], table[1], table[2]);
if (SDL_SetWindowGammaRamp(SDL_window, table[0], table[1], table[2]) < 0)
{
ri.Printf( PRINT_DEVELOPER, "SDL_SetWindowGammaRamp() failed: %s\n", SDL_GetError() );
}
}

24 changes: 19 additions & 5 deletions code/sdl/sdl_glimp.c
Expand Up @@ -136,11 +136,16 @@ static void GLimp_DetectAvailableModes(void)

SDL_DisplayMode windowMode;
int display = SDL_GetWindowDisplayIndex( SDL_window );
if( display < 0 )
{
ri.Printf( PRINT_WARNING, "Couldn't get window display index, no resolutions detected: %s\n", SDL_GetError() );
return;
}
numSDLModes = SDL_GetNumDisplayModes( display );

if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 || numSDLModes <= 0 )
{
ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected\n" );
ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected: %s\n", SDL_GetError() );
return;
}

Expand Down Expand Up @@ -245,9 +250,15 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)

// If a window exists, note its display index
if( SDL_window != NULL )
{
display = SDL_GetWindowDisplayIndex( SDL_window );
if( display < 0 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_GetWindowDisplayIndex() failed: %s\n", SDL_GetError() );
}
}

if( SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 )
if( display >= 0 && SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 )
{
displayAspect = (float)desktopMode.w / (float)desktopMode.h;

Expand Down Expand Up @@ -435,7 +446,7 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
#endif

if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, x, y,
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == 0 )
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == NULL )
{
ri.Printf( PRINT_DEVELOPER, "SDL_CreateWindow failed: %s\n", SDL_GetError( ) );
continue;
Expand Down Expand Up @@ -476,7 +487,10 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
qglClear( GL_COLOR_BUFFER_BIT );
SDL_GL_SwapWindow( SDL_window );

SDL_GL_SetSwapInterval( r_swapInterval->integer );
if( SDL_GL_SetSwapInterval( r_swapInterval->integer ) == -1 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_GL_SetSwapInterval failed: %s\n", SDL_GetError( ) );
}

glConfig.colorBits = testColorBits;
glConfig.depthBits = testDepthBits;
Expand Down Expand Up @@ -516,7 +530,7 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
{
const char *driverName;

if (SDL_Init(SDL_INIT_VIDEO) == -1)
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
ri.Printf( PRINT_ALL, "SDL_Init( SDL_INIT_VIDEO ) FAILED (%s)\n", SDL_GetError());
return qfalse;
Expand Down
10 changes: 5 additions & 5 deletions code/sdl/sdl_input.c
Expand Up @@ -327,7 +327,7 @@ static void IN_ActivateMouse( void )
if( !mouseActive )
{
SDL_SetRelativeMouseMode( SDL_TRUE );
SDL_SetWindowGrab( SDL_window, 1 );
SDL_SetWindowGrab( SDL_window, SDL_TRUE );

IN_GobbleMotionEvents( );
}
Expand All @@ -338,9 +338,9 @@ static void IN_ActivateMouse( void )
if( in_nograb->modified || !mouseActive )
{
if( in_nograb->integer )
SDL_SetWindowGrab( SDL_window, 0 );
SDL_SetWindowGrab( SDL_window, SDL_FALSE );
else
SDL_SetWindowGrab( SDL_window, 1 );
SDL_SetWindowGrab( SDL_window, SDL_TRUE );

in_nograb->modified = qfalse;
}
Expand Down Expand Up @@ -371,7 +371,7 @@ static void IN_DeactivateMouse( void )
{
IN_GobbleMotionEvents( );

SDL_SetWindowGrab( SDL_window, 0 );
SDL_SetWindowGrab( SDL_window, SDL_FALSE );
SDL_SetRelativeMouseMode( SDL_FALSE );

// Don't warp the mouse unless the cursor is within the window
Expand Down Expand Up @@ -437,7 +437,7 @@ static void IN_InitJoystick( void )
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
{
Com_DPrintf("Calling SDL_Init(SDL_INIT_JOYSTICK)...\n");
if (SDL_Init(SDL_INIT_JOYSTICK) == -1)
if (SDL_Init(SDL_INIT_JOYSTICK) != 0)
{
Com_DPrintf("SDL_Init(SDL_INIT_JOYSTICK) failed: %s\n", SDL_GetError());
return;
Expand Down
2 changes: 1 addition & 1 deletion code/sdl/sdl_snd.c
Expand Up @@ -156,7 +156,7 @@ qboolean SNDDMA_Init(void)

if (!SDL_WasInit(SDL_INIT_AUDIO))
{
if (SDL_Init(SDL_INIT_AUDIO) == -1)
if (SDL_Init(SDL_INIT_AUDIO) != 0)
{
Com_Printf( "FAILED (%s)\n", SDL_GetError( ) );
return qfalse;
Expand Down
2 changes: 1 addition & 1 deletion make-macosx-app.sh
Expand Up @@ -42,7 +42,7 @@ if [ "$2" != "" ]; then
elif [ "$2" == "ppc" ]; then
CURRENT_ARCH="ppc"
else
echo "Invalid architecture: $1"
echo "Invalid architecture: $2"
echo "Valid architectures are:"
echo " x86"
echo " x86_64"
Expand Down

0 comments on commit 8eeac09

Please sign in to comment.