From: havoc Date: Tue, 1 Nov 2011 03:32:36 +0000 (+0000) Subject: fix compile errors and warnings in MSVC X-Git-Tag: xonotic-v0.6.0~163^2~54 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9615163fe2a5dfa13ef832d0d0e10b9cda619840;p=xonotic%2Fdarkplaces.git fix compile errors and warnings in MSVC git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11503 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/csprogs.c b/csprogs.c index 79af0570..732b6517 100644 --- a/csprogs.c +++ b/csprogs.c @@ -967,9 +967,9 @@ extern cvar_t csqc_usedemoprogs; void CL_VM_Init (void) { prvm_prog_t *prog = CLVM_prog; - const char* csprogsfn; + const char* csprogsfn = NULL; unsigned char *csprogsdata = NULL; - fs_offset_t csprogsdatasize; + fs_offset_t csprogsdatasize = 0; int csprogsdatacrc, requiredcrc; int requiredsize; char vabuf[1024]; diff --git a/darkplaces-dedicated.vcproj b/darkplaces-dedicated.vcproj index 3910650f..b96bdd59 100755 --- a/darkplaces-dedicated.vcproj +++ b/darkplaces-dedicated.vcproj @@ -364,10 +364,6 @@ RelativePath=".\cl_dyntexture.c" > - - diff --git a/darkplaces-sdl.vcproj b/darkplaces-sdl.vcproj index 123c8384..aeebb0d8 100755 --- a/darkplaces-sdl.vcproj +++ b/darkplaces-sdl.vcproj @@ -366,10 +366,6 @@ RelativePath=".\cl_dyntexture.c" > - - diff --git a/darkplaces-wgl.vcproj b/darkplaces-wgl.vcproj index fd905ff2..00a9bead 100644 --- a/darkplaces-wgl.vcproj +++ b/darkplaces-wgl.vcproj @@ -368,10 +368,6 @@ RelativePath=".\cl_dyntexture.c" > - - diff --git a/gl_rmain.c b/gl_rmain.c index 5dbeea50..1142ef25 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2656,7 +2656,7 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, if (permutation & SHADERPERMUTATION_DEFERREDLIGHTMAP ) R_Mesh_TexBind(GL20TU_SCREENSPECULAR , r_shadow_prepasslightingspeculartexture ); if (rsurface.rtlight || (r_shadow_usingshadowmaportho && !(rsurface.ent_flags & RENDER_NOSELFSHADOW))) { - R_Mesh_TexBind(GL20TU_SHADOWMAP2D, r_shadow_shadowmap2dcolortexture); + R_Mesh_TexBind(GL20TU_SHADOWMAP2D, r_shadow_shadowmap2ddepthtexture); if (rsurface.rtlight) { if (permutation & SHADERPERMUTATION_CUBEFILTER ) R_Mesh_TexBind(GL20TU_CUBE , rsurface.rtlight->currentcubemap ); @@ -3028,9 +3028,9 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight) R_SetupShader_SetPermutationHLSL(mode, permutation); hlslPSSetParameter3f(D3DPSREGISTER_LightPosition, viewlightorigin[0], viewlightorigin[1], viewlightorigin[2]); hlslPSSetParameter16f(D3DPSREGISTER_ViewToLight, viewtolight16f); - hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Ambient , lightcolorbase[0] * ambientscale * range, lightcolorbase[1] * ambientscale * range, lightcolorbase[2] * ambientscale * range); - hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Diffuse , lightcolorbase[0] * diffusescale * range, lightcolorbase[1] * diffusescale * range, lightcolorbase[2] * diffusescale * range); - hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Specular, lightcolorbase[0] * specularscale * range, lightcolorbase[1] * specularscale * range, lightcolorbase[2] * specularscale * range); + hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Ambient , lightcolorbase[0] * ambientscale , lightcolorbase[1] * ambientscale , lightcolorbase[2] * ambientscale ); + hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Diffuse , lightcolorbase[0] * diffusescale , lightcolorbase[1] * diffusescale , lightcolorbase[2] * diffusescale ); + hlslPSSetParameter3f(D3DPSREGISTER_DeferredColor_Specular, lightcolorbase[0] * specularscale, lightcolorbase[1] * specularscale, lightcolorbase[2] * specularscale); hlslPSSetParameter2f(D3DPSREGISTER_ShadowMap_TextureScale, r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]); hlslPSSetParameter4f(D3DPSREGISTER_ShadowMap_Parameters, r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]); hlslPSSetParameter1f(D3DPSREGISTER_SpecularPower, (r_shadow_gloss.integer == 2 ? r_shadow_gloss2exponent.value : r_shadow_glossexponent.value) * (r_shadow_glossexact.integer ? 0.25f : 1.0f) - 1.0f); @@ -3040,7 +3040,7 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight) R_Mesh_TexBind(GL20TU_ATTENUATION , r_shadow_attenuationgradienttexture ); R_Mesh_TexBind(GL20TU_SCREENNORMALMAP , r_shadow_prepassgeometrynormalmaptexture ); R_Mesh_TexBind(GL20TU_CUBE , rsurface.rtlight->currentcubemap ); - R_Mesh_TexBind(GL20TU_SHADOWMAP2D , r_shadow_shadowmap2dcolortexture ); + R_Mesh_TexBind(GL20TU_SHADOWMAP2D , r_shadow_shadowmap2ddepthtexture ); R_Mesh_TexBind(GL20TU_CUBEPROJECTION , r_shadow_shadowmapvsdcttexture ); #endif break; @@ -5974,7 +5974,7 @@ static void R_Bloom_StartFrame(void) switch (vid.renderpath) { case RENDERPATH_GL20: - r_fb.usedepthtextures = r_usedepthtextures.integer; + r_fb.usedepthtextures = r_usedepthtextures.integer != 0; if (vid.support.ext_framebuffer_object) { if (r_viewfbo.integer == 2) textype = TEXTYPE_COLORBUFFER16F; diff --git a/gl_textures.c b/gl_textures.c index a24c9067..37c135ed 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1964,7 +1964,9 @@ rtexture_t *R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char * case TEXTYPE_COLORBUFFER: d3dformat = D3DFMT_A8R8G8B8;glt->d3disrendertargetsurface = true;break; case TEXTYPE_COLORBUFFER16F: d3dformat = D3DFMT_A16B16G16R16F;glt->d3disrendertargetsurface = true;break; case TEXTYPE_COLORBUFFER32F: d3dformat = D3DFMT_A32B32G32R32F;glt->d3disrendertargetsurface = true;break; - case TEXTYPE_DEPTHBUFFER: d3dformat = D3DFMT_D24S8;glt->d3disdepthstencilsurface = true;break; + case TEXTYPE_DEPTHBUFFER16: d3dformat = D3DFMT_D16;glt->d3disdepthstencilsurface = true;break; + case TEXTYPE_DEPTHBUFFER24: d3dformat = D3DFMT_D24X8;glt->d3disdepthstencilsurface = true;break; + case TEXTYPE_DEPTHBUFFER24STENCIL8: d3dformat = D3DFMT_D24S8;glt->d3disdepthstencilsurface = true;break; default: d3dformat = D3DFMT_A8R8G8B8;Sys_Error("R_LoadTextureRenderbuffer: unsupported texture type %i when picking D3DFMT", (int)textype);break; } glt->d3dformat = d3dformat; diff --git a/snd_main.c b/snd_main.c index 09a13292..23f1bca7 100644 --- a/snd_main.c +++ b/snd_main.c @@ -1476,7 +1476,7 @@ static void SND_Spatialize_WithSfx(channel_t *ch, qboolean isstatic, sfx_t *sfx) f = dist * ch->distfade; f = - ((snd_attenuation_exponent.value == 0) ? 1.0 : pow(1.0 - min(1.0, f), snd_attenuation_exponent.value)) + ((snd_attenuation_exponent.value == 0) ? 1.0 : pow(1.0 - min(1.0, f), (double)snd_attenuation_exponent.value)) * ((snd_attenuation_decibel.value == 0) ? 1.0 : pow(0.1, 0.1 * snd_attenuation_decibel.value * f)); diff --git a/sys_shared.c b/sys_shared.c index bcbc727d..d033323a 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -450,6 +450,7 @@ void Sys_PrintfToTerminal(const char *fmt, ...) Sys_PrintToTerminal(msg); } +#ifndef WIN32 static const char *Sys_FindInPATH(const char *name, char namesep, const char *PATH, char pathsep, char *buf, size_t bufsize) { const char *p = PATH; @@ -472,6 +473,7 @@ static const char *Sys_FindInPATH(const char *name, char namesep, const char *PA } return name; } +#endif static const char *Sys_FindExecutableName(void) { diff --git a/vid_shared.c b/vid_shared.c index f9c56e2c..85d3ec37 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1411,7 +1411,7 @@ void VID_BuildGammaTables(unsigned short *ramps, int rampsize) { int i; for(i = 0; i < 3*rampsize; ++i) - ramps[i] = (int)floor(bound(0.0f, Image_sRGBFloatFromLinearFloat(ramps[i] / 65535.0), 1.0f) * 65535.0 + 0.5); + ramps[i] = (int)floor(bound(0.0f, Image_sRGBFloatFromLinearFloat(ramps[i] / 65535.0f), 1.0f) * 65535.0f + 0.5f); } // LordHavoc: this code came from Ben Winslow and Zinx Verituse, I have