From 9935860426430cae26f58c0d066c8fb72cca2c3e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 28 Feb 2008 20:04:10 +0000 Subject: Add fixes for MSVC warnings (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1095 --- NEWS | 2 +- src/am_map.c | 14 +++++++------- src/i_pcsound.c | 22 +++++++++++----------- src/i_scale.c | 4 ++++ src/i_sdlsound.c | 8 ++++---- src/i_video.c | 2 +- src/m_misc.c | 5 ++++- src/net_client.c | 4 ++-- src/r_things.c | 2 +- textscreen/txt_sdl.c | 1 + textscreen/txt_spinctrl.c | 2 +- vc9/ChocolateDoom.vcproj | 14 +++++++------- 12 files changed, 44 insertions(+), 36 deletions(-) diff --git a/NEWS b/NEWS index 59729cee..4d859507 100644 --- 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 diff --git a/src/am_map.c b/src/am_map.c index 30d140f8..41da0071 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -195,17 +195,17 @@ mline_t cheat_player_arrow[] = { #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 fixed_t old_m_x, old_m_y; 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; diff --git a/src/i_pcsound.c b/src/i_pcsound.c index 0bf0d723..c41ba022 100644 --- a/src/i_pcsound.c +++ b/src/i_pcsound.c @@ -47,17 +47,17 @@ static unsigned int current_sound_remaining = 0; 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) diff --git a/src/i_scale.c b/src/i_scale.c index 864b1de0..a022ab15 100644 --- 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; diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c index b63be648..6764d19e 100644 --- a/src/i_sdlsound.c +++ b/src/i_sdlsound.c @@ -273,13 +273,13 @@ static void ExpandSoundData_SDL(byte *data, // 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 mouse_threshold) { - return (val - mouse_threshold) * mouse_acceleration + mouse_threshold; + return (int)((val - mouse_threshold) * mouse_acceleration + mouse_threshold); } else { diff --git a/src/m_misc.c b/src/m_misc.c index 506c2f7a..40bf2bce 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -37,6 +37,9 @@ #ifdef _WIN32 #include +#ifdef _MSC_VER +#include +#endif #else #include #include @@ -1080,7 +1083,7 @@ static void LoadDefaultCollection(default_collection_t *collection) break; case DEFAULT_FLOAT: - * (float *) def->location = atof(strparm); + * (float *) def->location = (float) atof(strparm); break; } diff --git a/src/net_client.c b/src/net_client.c index 870d98ef..36dafe7a 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -271,8 +271,8 @@ static void NET_CL_ExpandFullTiccmd(net_full_ticcmd_t *cmd, unsigned int seq) { // 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)); } } diff --git a/src/r_things.c b/src/r_things.c index bdcdefd6..68f4b2fe 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -504,7 +504,7 @@ void R_ProjectSprite (mobj_t* thing) // 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 diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index aeb8cd63..823685a1 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -27,6 +27,7 @@ #include "SDL.h" #include +#include #include #include diff --git a/textscreen/txt_spinctrl.c b/textscreen/txt_spinctrl.c index be9da823..2b99f535 100644 --- a/textscreen/txt_spinctrl.c +++ b/textscreen/txt_spinctrl.c @@ -403,7 +403,7 @@ txt_spincontrol_t *TXT_NewFloatSpinControl(float *value, float min, float max) spincontrol->value = (void *) value; spincontrol->min.f = min; spincontrol->max.f = max; - spincontrol->step.f = 0.1; + spincontrol->step.f = 0.1f; return spincontrol; } diff --git a/vc9/ChocolateDoom.vcproj b/vc9/ChocolateDoom.vcproj index 4291a9b6..e627f7d8 100755 --- a/vc9/ChocolateDoom.vcproj +++ b/vc9/ChocolateDoom.vcproj @@ -1,7 +1,7 @@