shithub: choc

Download patch

ref: 9935860426430cae26f58c0d066c8fb72cca2c3e
parent: c59c78f9a84567ddb77f4f89dd359c96ba4d29f3
author: Simon Howard <fraggle@gmail.com>
date: Thu Feb 28 15:04:10 EST 2008

Add fixes for MSVC warnings (thanks entryway).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1095

--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,7 @@
        now chosen by directly specifying the mode to use; the scale factor is
        then chosen to fit the screen.  This is helpful when using widescreen
        monitors (thanks Linguica)
-     * MSVC build project files (thanks GhostlyDeath).
+     * MSVC build project files (thanks GhostlyDeath and entryway).
      * Unix manpage improvements; the manpage now lists the environment
        variables that Chocolate Doom uses.  Manpages have been added for
        chocolate-setup and chocolate-server, from the versions for the Debian
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -195,17 +195,17 @@
 
 #define R (FRACUNIT)
 mline_t triangle_guy[] = {
-    { { -.867*R, -.5*R }, { .867*R, -.5*R } },
-    { { .867*R, -.5*R } , { 0, R } },
-    { { 0, R }, { -.867*R, -.5*R } }
+    { { (fixed_t)(-.867*R), (fixed_t)(-.5*R) }, { (fixed_t)(.867*R ), (fixed_t)(-.5*R) } },
+    { { (fixed_t)(.867*R ), (fixed_t)(-.5*R) }, { (fixed_t)(0      ), (fixed_t)(R    ) } },
+    { { (fixed_t)(0      ), (fixed_t)(R    ) }, { (fixed_t)(-.867*R), (fixed_t)(-.5*R) } }
 };
 #undef R
 
 #define R (FRACUNIT)
 mline_t thintriangle_guy[] = {
-    { { -.5*R, -.7*R }, { R, 0 } },
-    { { R, 0 }, { -.5*R, .7*R } },
-    { { -.5*R, .7*R }, { -.5*R, -.7*R } }
+    { { (fixed_t)(-.5*R), (fixed_t)(-.7*R) }, { (fixed_t)(R    ), (fixed_t)(0    ) } },
+    { { (fixed_t)(R    ), (fixed_t)(0    ) }, { (fixed_t)(-.5*R), (fixed_t)(.7*R ) } },
+    { { (fixed_t)(-.5*R), (fixed_t)(.7*R ) }, { (fixed_t)(-.5*R), (fixed_t)(-.7*R) } }
 };
 #undef R
 
@@ -271,7 +271,7 @@
 static mpoint_t f_oldloc;
 
 // used by MTOF to scale from map-to-frame-buffer coords
-static fixed_t scale_mtof = INITSCALEMTOF;
+static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
 // used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
 static fixed_t scale_ftom;
 
--- a/src/i_pcsound.c
+++ b/src/i_pcsound.c
@@ -47,17 +47,17 @@
 static int current_sound_handle = 0;
 
 static const float frequencies[] = {
-    0, 175.00, 180.02, 185.01, 190.02, 196.02, 202.02, 208.01, 214.02, 220.02,
-    226.02, 233.04, 240.02, 247.03, 254.03, 262.00, 269.03, 277.03, 285.04,
-    294.03, 302.07, 311.04, 320.05, 330.06, 339.06, 349.08, 359.06, 370.09,
-    381.08, 392.10, 403.10, 415.01, 427.05, 440.12, 453.16, 466.08, 480.15,
-    494.07, 508.16, 523.09, 539.16, 554.19, 571.17, 587.19, 604.14, 622.09,
-    640.11, 659.21, 679.10, 698.17, 719.21, 740.18, 762.41, 784.47, 807.29,
-    831.48, 855.32, 880.57, 906.67, 932.17, 960.69, 988.55, 1017.20, 1046.64,
-    1077.85, 1109.93, 1141.79, 1175.54, 1210.12, 1244.19, 1281.61, 1318.43,
-    1357.42, 1397.16, 1439.30, 1480.37, 1523.85, 1569.97, 1614.58, 1661.81,
-    1711.87, 1762.45, 1813.34, 1864.34, 1921.38, 1975.46, 2036.14, 2093.29,
-    2157.64, 2217.80, 2285.78, 2353.41, 2420.24, 2490.98, 2565.97, 2639.77,
+    0.0f, 175.00f, 180.02f, 185.01f, 190.02f, 196.02f, 202.02f, 208.01f, 214.02f, 220.02f,
+    226.02f, 233.04f, 240.02f, 247.03f, 254.03f, 262.00f, 269.03f, 277.03f, 285.04f,
+    294.03f, 302.07f, 311.04f, 320.05f, 330.06f, 339.06f, 349.08f, 359.06f, 370.09f,
+    381.08f, 392.10f, 403.10f, 415.01f, 427.05f, 440.12f, 453.16f, 466.08f, 480.15f,
+    494.07f, 508.16f, 523.09f, 539.16f, 554.19f, 571.17f, 587.19f, 604.14f, 622.09f,
+    640.11f, 659.21f, 679.10f, 698.17f, 719.21f, 740.18f, 762.41f, 784.47f, 807.29f,
+    831.48f, 855.32f, 880.57f, 906.67f, 932.17f, 960.69f, 988.55f, 1017.20f, 1046.64f,
+    1077.85f, 1109.93f, 1141.79f, 1175.54f, 1210.12f, 1244.19f, 1281.61f, 1318.43f,
+    1357.42f, 1397.16f, 1439.30f, 1480.37f, 1523.85f, 1569.97f, 1614.58f, 1661.81f,
+    1711.87f, 1762.45f, 1813.34f, 1864.34f, 1921.38f, 1975.46f, 2036.14f, 2093.29f,
+    2157.64f, 2217.80f, 2285.78f, 2353.41f, 2420.24f, 2490.98f, 2565.97f, 2639.77f,
 };
 
 static void PCSCallbackFunc(int *duration, int *freq)
--- a/src/i_scale.c
+++ b/src/i_scale.c
@@ -32,6 +32,10 @@
 #include "i_video.h"
 #include "z_zone.h"
 
+#if defined(_MSC_VER) && !defined(__cplusplus)
+#define inline __inline
+#endif
+
 // Should be screens[0]
 
 static byte *src_buffer;
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -273,13 +273,13 @@
             // Filter to the half sample rate of the original sound effect
             // (maximum frequency, by nyquist)
 
-            dt = 1.0 / mixer_freq;
-            rc = 1.0 / (3.14 * samplerate);
+            dt = 1.0f / mixer_freq;
+            rc = 1.0f / (3.14f * samplerate);
             alpha = dt / (rc + dt);
 
             for (i=1; i<expanded_length; ++i) 
             {
-                expanded[i] = alpha * expanded[i] + (1 - alpha) * expanded[i-1];
+                expanded[i] = (Sint16) (alpha * expanded[i] + (1 - alpha) * expanded[i-1]);
             }
         }
 #endif /* #ifdef LOW_PASS_FILTER */
@@ -538,7 +538,7 @@
     printf("\n");
 }
 
-static boolean I_SDL_InitSound()
+static boolean I_SDL_InitSound(void)
 { 
     int i;
     
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -414,7 +414,7 @@
 
     if (val > mouse_threshold)
     {
-        return (val - mouse_threshold) * mouse_acceleration + mouse_threshold;
+        return (int)((val - mouse_threshold) * mouse_acceleration + mouse_threshold);
     }
     else
     {
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -37,6 +37,9 @@
 
 #ifdef _WIN32
 #include <io.h>
+#ifdef _MSC_VER
+#include <direct.h>
+#endif
 #else
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -1080,7 +1083,7 @@
                     break;
 
                 case DEFAULT_FLOAT:
-                    * (float *) def->location = atof(strparm);
+                    * (float *) def->location = (float) atof(strparm);
                     break;
             }
 
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -271,8 +271,8 @@
         {
             // Low level filter
 
-            average_latency = (average_latency * 0.9)
-                            + (latency * FRACUNIT * 0.1);
+            average_latency = (fixed_t)((average_latency * 0.9)
+                            + (latency * FRACUNIT * 0.1));
         }
     }
 
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -504,7 +504,7 @@
     
     // decide which patch to use for sprite relative to player
 #ifdef RANGECHECK
-    if (thing->sprite >= (unsigned int) numsprites)
+    if ((unsigned int) thing->sprite >= (unsigned int) numsprites)
 	I_Error ("R_ProjectSprite: invalid sprite number %i ",
 		 thing->sprite);
 #endif
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -27,6 +27,7 @@
 #include "SDL.h"
 
 #include <ctype.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
--- a/textscreen/txt_spinctrl.c
+++ b/textscreen/txt_spinctrl.c
@@ -403,7 +403,7 @@
     spincontrol->value = (void *) value;
     spincontrol->min.f = min;
     spincontrol->max.f = max;
-    spincontrol->step.f = 0.1;
+    spincontrol->step.f = 0.1f;
 
     return spincontrol;
 }
--- a/vc9/ChocolateDoom.vcproj
+++ b/vc9/ChocolateDoom.vcproj
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9.00"
+	Version="9,00"
 	Name="Chocolate Doom"
 	ProjectGUID="{8B744A3B-8F18-41A0-85A3-293816E85B6E}"
 	RootNamespace="ChocolateDoom"
@@ -42,7 +42,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -122,7 +122,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"
@@ -200,7 +200,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -281,7 +281,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"
@@ -360,7 +360,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -441,7 +441,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="..\src;..\setup;..\textscreen;..\pcsound;..\msvc"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"