fix compile errors and warnings in MSVC
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 Nov 2011 03:32:36 +0000 (03:32 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 Nov 2011 03:32:36 +0000 (03:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11503 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
darkplaces-dedicated.vcproj
darkplaces-sdl.vcproj
darkplaces-wgl.vcproj
gl_rmain.c
gl_textures.c
snd_main.c
sys_shared.c
vid_shared.c

index 79af057..732b651 100644 (file)
--- 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];
index 3910650..b96bdd5 100755 (executable)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\cl_gecko.c"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\cl_input.c"\r
                                >\r
                        </File>\r
index 123c838..aeebb0d 100755 (executable)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\cl_gecko.c"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\cl_input.c"\r
                                >\r
                        </File>\r
index fd905ff..00a9bea 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\cl_gecko.c"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\cl_input.c"\r
                                >\r
                        </File>\r
index 5dbeea5..1142ef2 100644 (file)
@@ -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;
index a24c906..37c135e 100644 (file)
@@ -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;
index 09a1329..23f1bca 100644 (file)
@@ -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));
 
index bcbc727..d033323 100644 (file)
@@ -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)
 {
index f9c56e2..85d3ec3 100644 (file)
@@ -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