From 0c350f0c075946d19dfd6d6d997358537af6222a Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Tue, 14 Oct 2014 21:43:50 -0400 Subject: [PATCH] silence various MSVC warnings --- CMakeLists.txt | 2 ++ include/multi.h | 2 +- include/pstypes.h | 2 +- src/ac/ac_stubs.cpp | 2 +- src/fonttool/fontstubs.cpp | 2 +- src/freespace2/freespace.cpp | 24 +++++++++---------- src/graphics/grgl1.cpp | 20 ++++++++-------- src/graphics/grgl1render.cpp | 38 +++++++++++++++---------------- src/io/joy_ff.cpp | 14 ++++++------ src/movie/decoder16.cpp | 2 +- src/movie/mve_audio.cpp | 2 +- src/movie/mvelib.cpp | 43 ++++++++++------------------------- src/nebedit/nebstubs.cpp | 2 +- src/network/multi.cpp | 12 +++++----- src/network/multi_log.cpp | 4 ++-- src/network/multi_respawn.cpp | 4 ++-- src/network/multi_update.cpp | 3 --- src/network/multimsgs.cpp | 18 ++++++++------- src/network/multiui.cpp | 4 ++-- src/playerman/managepilot.cpp | 2 +- src/pofview/pofviewstubs.cpp | 2 +- src/ship/awacs.cpp | 3 --- src/sound/acm.cpp | 4 ++-- src/sound/audiostr.cpp | 18 +++++++-------- src/sound/oal_efx.cpp | 6 ++--- src/sound/sound.cpp | 4 ++-- src/starfield/nebula.cpp | 7 ++---- src/stats/scoring.cpp | 2 +- src/weapon/beam.cpp | 4 ---- 29 files changed, 111 insertions(+), 141 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d49689..326ad14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ else() wsock32.lib winmm.lib ) + + add_definitions(/D _CRT_SECURE_NO_WARNINGS) endif() diff --git a/include/multi.h b/include/multi.h index d529332..28efdf0 100644 --- a/include/multi.h +++ b/include/multi.h @@ -672,7 +672,7 @@ typedef struct net_player_server_info { int kick_timestamp; // timestamp with which we'll disconnect a player if he hasn't reponded to a kick packet int kick_reason; // reason he was kicked int voice_token_timestamp; // timestamp set when a player loses a token (so we can prevent him from getting it again too quickly) - int reliable_connect_time; // after sending an accept packet, wait for this long for the guy to connect on the reliable socket + time_t reliable_connect_time; // after sending an accept packet, wait for this long for the guy to connect on the reliable socket // weapon select/linking information (maintained on the server and passed on respawn to all clients) char cur_primary_bank; // currently selected primary bank diff --git a/include/pstypes.h b/include/pstypes.h index 89ad44c..e4c1bb8 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -424,7 +424,7 @@ extern void __cdecl Warning( const char * filename, int line, const char * forma #define STUB_FUNCTION #else void gr_activate(int); -#define STUB_FUNCTION mprintf(("STUB: %s at %s, line %d, thread %d\n", __FUNCTION__, LOCATION, getpid())) +#define STUB_FUNCTION mprintf(("STUB: %s at %s, line %d\n", __FUNCTION__, LOCATION)) #endif //#define Int3() _asm { int 3 } diff --git a/src/ac/ac_stubs.cpp b/src/ac/ac_stubs.cpp index d0b04f3..4d0287e 100644 --- a/src/ac/ac_stubs.cpp +++ b/src/ac/ac_stubs.cpp @@ -145,5 +145,5 @@ int last_single_step; int Nebedit_running; void game_tst_mark(struct object*, struct ship*){} int game_do_cd_mission_check(char*){return 0;} -int Player_multi_died_check; +time_t Player_multi_died_check; int tst; diff --git a/src/fonttool/fontstubs.cpp b/src/fonttool/fontstubs.cpp index 58ca46a..5633ff4 100644 --- a/src/fonttool/fontstubs.cpp +++ b/src/fonttool/fontstubs.cpp @@ -107,7 +107,7 @@ int game_hacked_data(){return 0;} int Nebedit_running = 0; void game_tst_mark(struct object *, struct ship*){} int game_do_cd_mission_check(const char*){return 0;} -int Player_multi_died_check; +time_t Player_multi_died_check; int tst; int game_single_step; int last_single_step; diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index dbee4d3..8333c43 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -861,7 +861,7 @@ int Debug_dump_frame_num = 0; // amount of time to wait after the player has died before we display the death died popup #define PLAYER_DIED_POPUP_WAIT 2500 int Player_died_popup_wait = -1; -int Player_multi_died_check = -1; +time_t Player_multi_died_check = -1; // builtin mission list stuff #ifdef FS2_DEMO @@ -1673,7 +1673,7 @@ void game_level_init(int seed) // netgame security flags -- ensures that all players in multiplayer game will have the // same randon number sequence (with static rand functions) if ( Game_mode & GM_NORMAL ) { - Game_level_seed = time(NULL); + Game_level_seed = (int)time(NULL); } else { Game_level_seed = Netgame.security; } @@ -2052,10 +2052,10 @@ void freespace_mission_load_stuff() } } -uint load_gl_init; -uint load_mission_load; -uint load_post_level_init; -uint load_mission_stuff; +time_t load_gl_init; +time_t load_mission_load; +time_t load_post_level_init; +time_t load_mission_stuff; // tells the server to load the mission and initialize structures int game_start_mission() @@ -2292,7 +2292,7 @@ void game_init() Game_current_mission_filename[0] = 0; // seed the random number generator - Game_init_seed = time(NULL); + Game_init_seed = (int)time(NULL); srand( Game_init_seed ); Framerate_delay = 0; @@ -2958,7 +2958,7 @@ void show_debug_stuff() extern int Tool_enabled; int tst = 0; -int tst_time = 0; +time_t tst_time = 0; int tst_big = 0; vector tst_pos; int tst_bitmap = -1; @@ -4547,17 +4547,17 @@ void game_set_frametime(int state) if (Frametime < cap) { thistime = cap - Frametime; //mprintf(("Sleeping for %6.3f seconds.\n", f2fl(thistime))); - SDL_Delay( (f2fl(thistime) * 1000.0f) ); + SDL_Delay( fl2i(f2fl(thistime) * 1000.0f) ); Frametime = cap; thistime = timer_get_fixed_seconds(); } } if((Game_mode & GM_STANDALONE_SERVER) && - (f2fl(Frametime) < ((float)1.0/(float)Multi_options_g.std_framecap))){ + (f2fl(Frametime) < (1.0f/(float)Multi_options_g.std_framecap))){ - frame_cap_diff = ((float)1.0/(float)Multi_options_g.std_framecap) - f2fl(Frametime); - SDL_Delay((frame_cap_diff*1000)); + frame_cap_diff = (1.0f/(float)Multi_options_g.std_framecap) - f2fl(Frametime); + SDL_Delay( fl2i(frame_cap_diff * 1000.0f) ); thistime += fl2f((frame_cap_diff)); diff --git a/src/graphics/grgl1.cpp b/src/graphics/grgl1.cpp index ad03838..4ff0334 100644 --- a/src/graphics/grgl1.cpp +++ b/src/graphics/grgl1.cpp @@ -242,9 +242,9 @@ void gr_opengl1_activate(int active) void gr_opengl1_clear() { - glClearColor(gr_screen.current_clear_color.red / 255.0, - gr_screen.current_clear_color.green / 255.0, - gr_screen.current_clear_color.blue / 255.0, 1.0); + glClearColor(gr_screen.current_clear_color.red / 255.0f, + gr_screen.current_clear_color.green / 255.0f, + gr_screen.current_clear_color.blue / 255.0f, 1.0f); glClear( GL_COLOR_BUFFER_BIT ); } @@ -452,10 +452,10 @@ void gr_opengl1_fog_set(int fog_mode, int r, int g, int b, float fog_near, float gr_init_color( &gr_screen.current_fog_color, r, g, b ); - fc[0] = (float)r/255.0; - fc[1] = (float)g/255.0; - fc[2] = (float)b/255.0; - fc[3] = 1.0; + fc[0] = r / 255.0f; + fc[1] = g / 255.0f; + fc[2] = b / 255.0f; + fc[3] = 1.0f; glFogfv(GL_FOG_COLOR, fc); } @@ -726,7 +726,7 @@ void gr_opengl1_zbias(int bias) { if (bias) { glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0.0, -bias); + glPolygonOffset(0.0f, GLfloat(-bias)); } else { glDisable(GL_POLYGON_OFFSET_FILL); } @@ -739,11 +739,11 @@ void gr_opengl1_set_viewport(int width, int height) float ratio = gr_screen.max_w / i2fl(gr_screen.max_h); w = width; - h = i2fl((width / ratio) + 0.5f); + h = fl2i((width / ratio) + 0.5f); if (h > height) { h = height; - w = i2fl((height * ratio) + 0.5f); + w = fl2i((height * ratio) + 0.5f); } x = (width - w) / 2; diff --git a/src/graphics/grgl1render.cpp b/src/graphics/grgl1render.cpp index ca5437d..7e0c90d 100644 --- a/src/graphics/grgl1render.cpp +++ b/src/graphics/grgl1render.cpp @@ -330,7 +330,7 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i vertex * va = verts[i]; if ( Gr_zbuffering || (flags & TMAP_FLAG_NEBULA) ) { - sz = 1.0 - 1.0 / (1.0 + va->z / (32768.0 / 256.0)); + sz = 1.0f - 1.0f / (1.0f + va->z / (32768.0f / 256.0f)); if ( sz > 0.98f ) { sz = 0.98f; @@ -369,19 +369,19 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i // use constant RGB values... } - render_buffer[rb_offset].r = r; - render_buffer[rb_offset].g = g; - render_buffer[rb_offset].b = b; - render_buffer[rb_offset].a = a; + render_buffer[rb_offset].r = (ubyte)r; + render_buffer[rb_offset].g = (ubyte)g; + render_buffer[rb_offset].b = (ubyte)b; + render_buffer[rb_offset].a = (ubyte)a; if ( (flags & TMAP_FLAG_PIXEL_FOG) && (OGL_fog_mode == 1) ) { float f_val; opengl1_stuff_fog_value(va->z, &f_val); - render_buffer[rb_offset].sr = fl2i(((fr * f_val) * 255.0f) + 0.5f); - render_buffer[rb_offset].sg = fl2i(((fg * f_val) * 255.0f) + 0.5f); - render_buffer[rb_offset].sb = fl2i(((fb * f_val) * 255.0f) + 0.5f); + render_buffer[rb_offset].sr = (ubyte)(((fr * f_val) * 255.0f) + 0.5f); + render_buffer[rb_offset].sg = (ubyte)(((fg * f_val) * 255.0f) + 0.5f); + render_buffer[rb_offset].sb = (ubyte)(((fb * f_val) * 255.0f) + 0.5f); } x = fl2i(va->sx*16.0f); @@ -721,10 +721,10 @@ void gr_opengl1_line(int x1,int y1,int x2,int y2) float sx1, sy1; float sx2, sy2; - sx1 = i2fl(x1 + gr_screen.offset_x)+0.5; - sy1 = i2fl(y1 + gr_screen.offset_y)+0.5; - sx2 = i2fl(x2 + gr_screen.offset_x)+0.5; - sy2 = i2fl(y2 + gr_screen.offset_y)+0.5; + sx1 = i2fl(x1 + gr_screen.offset_x)+0.5f; + sy1 = i2fl(y1 + gr_screen.offset_y)+0.5f; + sx2 = i2fl(x2 + gr_screen.offset_x)+0.5f; + sy2 = i2fl(y2 + gr_screen.offset_y)+0.5f; opengl_alloc_render_buffer(2); @@ -804,10 +804,10 @@ void gr_opengl1_gradient(int x1,int y1,int x2,int y2) float sx1, sy1; float sx2, sy2; - sx1 = i2fl(x1 + gr_screen.offset_x)+0.5; - sy1 = i2fl(y1 + gr_screen.offset_y)+0.5; - sx2 = i2fl(x2 + gr_screen.offset_x)+0.5; - sy2 = i2fl(y2 + gr_screen.offset_y)+0.5; + sx1 = i2fl(x1 + gr_screen.offset_x)+0.5f; + sy1 = i2fl(y1 + gr_screen.offset_y)+0.5f; + sx2 = i2fl(x2 + gr_screen.offset_x)+0.5f; + sy2 = i2fl(y2 + gr_screen.offset_y)+0.5f; if ( x1 == x2 ) { if ( sy1 < sy2 ) { @@ -828,7 +828,7 @@ void gr_opengl1_gradient(int x1,int y1,int x2,int y2) render_buffer[0].r = gr_screen.current_color.red; render_buffer[0].g = gr_screen.current_color.green; render_buffer[0].b = gr_screen.current_color.blue; - render_buffer[0].a = ba; + render_buffer[0].a = (ubyte)ba; render_buffer[0].x = sx2; render_buffer[0].y = sy2; render_buffer[0].z = -0.99f; @@ -836,7 +836,7 @@ void gr_opengl1_gradient(int x1,int y1,int x2,int y2) render_buffer[1].r = gr_screen.current_color.red; render_buffer[1].g = gr_screen.current_color.green; render_buffer[1].b = gr_screen.current_color.blue; - render_buffer[1].a = aa; + render_buffer[1].a = (ubyte)aa; render_buffer[1].x = sx1; render_buffer[1].y = sy1; render_buffer[1].z = -0.99f; @@ -923,7 +923,7 @@ void gr_opengl1_flash(int r, int g, int b) x2 = i2fl(gr_screen.clip_right+gr_screen.offset_x); y2 = i2fl(gr_screen.clip_bottom+gr_screen.offset_y); - glColor4ub(r, g, b, 255); + glColor4ub((GLubyte)r, (GLubyte)g, (GLubyte)b, 255); opengl_alloc_render_buffer(4); diff --git a/src/io/joy_ff.cpp b/src/io/joy_ff.cpp index 4fbaa22..9a9fad1 100644 --- a/src/io/joy_ff.cpp +++ b/src/io/joy_ff.cpp @@ -522,7 +522,7 @@ void joy_ff_play_dir_effect(float x, float y) if (pHitEffect1.loaded) { pHitEffect1.eff.constant.direction.dir[0] = idegs; - pHitEffect1.eff.constant.level = fl2i(0x7FFF * (imag / 10000.0f)); + pHitEffect1.eff.constant.level = (Sint16)(32767.0f * (imag / 10000.0f)); if ( SDL_HapticUpdateEffect(haptic, pHitEffect1.id, &pHitEffect1.eff) < 0 ) { mprintf(("HapticERROR: Unable to update pHitEffect1:\n %s\n", SDL_GetError())); @@ -535,7 +535,7 @@ void joy_ff_play_dir_effect(float x, float y) if (pHitEffect2.loaded) { pHitEffect2.eff.periodic.direction.dir[0] = idegs; - pHitEffect2.eff.periodic.magnitude = fl2i(0x7FFF * (imag / 10000.0f)); + pHitEffect2.eff.periodic.magnitude = (Sint16)(32767.0f * (imag / 10000.0f)); if ( SDL_HapticUpdateEffect(haptic, pHitEffect2.id, &pHitEffect2.eff) < 0 ) { mprintf(("HapticERROR: Unable to update pHitEffect2:\n %s\n", SDL_GetError())); @@ -575,7 +575,7 @@ void joy_ff_play_primary_shoot(int gain) if (gain != primary_ff_level) { pShootEffect.eff.periodic.direction.dir[0] = 0; pShootEffect.eff.periodic.length = 160; - pShootEffect.eff.periodic.magnitude = fl2i(0x7FFF * (gain / 10000.0f)); + pShootEffect.eff.periodic.magnitude = (Sint16)(32767.0f * (gain / 10000.0f)); pShootEffect.eff.periodic.fade_length = 120; if ( SDL_HapticUpdateEffect(haptic, pShootEffect.id, &pShootEffect.eff) < 0 ) { @@ -619,7 +619,7 @@ void joy_ff_play_secondary_shoot(int gain) SDL_HapticStopEffect(haptic, pSecShootEffect.id); if (gain != secondary_ff_level) { - pSecShootEffect.eff.constant.level = fl2i(0x7FFF * (gain / 10000.0f)); + pSecShootEffect.eff.constant.level = (Sint16)(32767.0f * (gain / 10000.0f)); pSecShootEffect.eff.constant.length = (150000 + gain * 25) / 1000; if ( SDL_HapticUpdateEffect(haptic, pSecShootEffect.id, &pSecShootEffect.eff) < 0 ) { @@ -663,7 +663,7 @@ void joy_ff_adjust_handling(int speed) v = 10000; } - coeff = fl2i(0x7FFF * (v / 10000.0f)); + coeff = (short)(32767.0f * (v / 10000.0f)); for (int i = 0; i < SDL_HapticNumAxes(haptic); i++) { pSpring.eff.condition.right_coeff[i] = coeff; @@ -894,7 +894,7 @@ void joy_ff_fly_by(int mag) pAfterburn1.eff.periodic.length = (6000 * mag + 400000) / 1000; pAfterburn1.eff.periodic.period = 20; - pAfterburn1.eff.periodic.magnitude = fl2i(0x7FFF * (gain / 10000.0f)); + pAfterburn1.eff.periodic.magnitude = (Sint16)(32767.0f * (gain / 10000.0f)); pAfterburn1.eff.periodic.attack_length = 0; if ( SDL_HapticUpdateEffect(haptic, pAfterburn1.id, &pAfterburn1.eff) < 0 ) { @@ -906,7 +906,7 @@ void joy_ff_fly_by(int mag) pAfterburn2.eff.periodic.length = (6000 * mag + 400000) / 1000; pAfterburn2.eff.periodic.period = 100; - pAfterburn2.eff.periodic.magnitude = fl2i(0x7FFF * (gain / 10000.0f)); + pAfterburn2.eff.periodic.magnitude = (Sint16)(32767.0f * (gain / 10000.0f)); pAfterburn2.eff.periodic.attack_length = 0; if ( SDL_HapticUpdateEffect(haptic, pAfterburn2.id, &pAfterburn2.eff) < 0 ) { diff --git a/src/movie/decoder16.cpp b/src/movie/decoder16.cpp index 992cf85..0109e56 100644 --- a/src/movie/decoder16.cpp +++ b/src/movie/decoder16.cpp @@ -42,7 +42,7 @@ void decodeFrame16(unsigned char *pFrame, unsigned char *pMap, int mapRemain, un unsigned char *pOffData; ushort offset; int length; - int op; + unsigned char op; int i, j; int xb, yb; diff --git a/src/movie/mve_audio.cpp b/src/movie/mve_audio.cpp index 0649fdd..6e9ecf1 100644 --- a/src/movie/mve_audio.cpp +++ b/src/movie/mve_audio.cpp @@ -47,7 +47,7 @@ static int getWord(unsigned char **fin) static void sendWord(short **fout, int nOffset) { - *(*fout)++ = nOffset; + *(*fout)++ = (short)nOffset; } static void processSwath(short *fout, unsigned char *data, int swath, int *offsets) diff --git a/src/movie/mvelib.cpp b/src/movie/mvelib.cpp index 438644f..656b1fd 100644 --- a/src/movie/mvelib.cpp +++ b/src/movie/mvelib.cpp @@ -58,10 +58,7 @@ int mve_get_int(ubyte *data) // open an MVE file MVEFILE *mvefile_open(const char *filename) { - int cf_opened = 0; int mve_valid = 1; - char lower_name[MAX_FILENAME_LEN]; - char upper_name[MAX_FILENAME_LEN]; char buffer[20]; MVEFILE *file; @@ -75,39 +72,23 @@ MVEFILE *mvefile_open(const char *filename) file->cur_fill = 0; file->next_segment = 0; - // lower case filename for checking - SDL_strlcpy(lower_name, filename, sizeof(lower_name)); - SDL_strlwr(lower_name); - // upper case filename for checking - SDL_strlcpy(upper_name, filename, sizeof(upper_name)); - SDL_strupr(upper_name); - // NOTE: CF_TYPE *must* be ANY to get movies off of the CDs - while (1) { - // lower case filename check - off of HD/CD-ROM - if ( (file->stream = cfopen(lower_name, "rb", CFILE_NORMAL, CF_TYPE_MOVIES)) ) { - cf_opened = 1; - break; - } - // upper case filename check - off of CD-ROM (or HD if case not changed) - if ( (file->stream = cfopen(upper_name, "rb", CFILE_NORMAL, CF_TYPE_ANY)) ) { - cf_opened = 1; - break; - } + // lower case filename check - off of HD/CD-ROM + file->stream = cfopen(filename, "rb", CFILE_NORMAL, CF_TYPE_MOVIES); - // passed filename check - just because - if ( (file->stream = cfopen(filename, "rb", CFILE_NORMAL, CF_TYPE_ANY)) ) { - cf_opened = 1; - break; - } - - // uh-oh, couldn't open - cf_opened = 0; - break; + // upper case filename check - off of CD-ROM (or HD if case not changed) + if ( !file->stream ) { + char upper_name[MAX_FILENAME_LEN]; + + // upper case filename for checking + SDL_strlcpy(upper_name, filename, sizeof(upper_name)); + SDL_strupr(upper_name); + + file->stream = cfopen(upper_name, "rb", CFILE_NORMAL, CF_TYPE_ANY); } - if (!cf_opened) { + if ( !file->stream ) { mvefile_close(file); return NULL; } diff --git a/src/nebedit/nebstubs.cpp b/src/nebedit/nebstubs.cpp index 084472e..aca1668 100644 --- a/src/nebedit/nebstubs.cpp +++ b/src/nebedit/nebstubs.cpp @@ -92,7 +92,7 @@ void game_shudder_apply(int, float){} int Debug_octant; int game_hacked_data(){return 0;} int game_do_cd_mission_check(char*){return 0;} -int Player_multi_died_check; +time_t Player_multi_died_check; void game_tst_mark(struct object*, struct ship*){} int tst; int game_single_step; diff --git a/src/network/multi.cpp b/src/network/multi.cpp index 06ec206..d0d62c0 100644 --- a/src/network/multi.cpp +++ b/src/network/multi.cpp @@ -326,12 +326,12 @@ short Multi_id_num = 0; // for assigning player id #'s server_item* Game_server_head; // list of permanent game servers to be querying // timestamp data -int Netgame_send_time = -1; // timestamp used to send netgame info to players before misison starts -int State_send_time = -1; // timestamp used to send state information to the host before a mission starts -int Gameinfo_send_time = -1; // timestamp used by master to send game information to clients -int Next_ping_time = -1; // when we should next ping all +time_t Netgame_send_time = -1; // timestamp used to send netgame info to players before misison starts +time_t State_send_time = -1; // timestamp used to send state information to the host before a mission starts +time_t Gameinfo_send_time = -1; // timestamp used by master to send game information to clients +time_t Next_ping_time = -1; // when we should next ping all int Multi_server_check_count = 0; // var to keep track of reentrancy when checking server status -int Next_bytes_time = -1; // bytes sent +time_t Next_bytes_time = -1; // bytes sent // how often each player gets updated int Multi_client_update_times[MAX_PLAYERS]; // client update packet timestamp @@ -1338,7 +1338,7 @@ void multi_do_frame() // ping everyone multi_ping_send_all(); - Next_ping_time = time(NULL); + Next_ping_time = time(NULL); } // if I am the master, and we are not yet actually playing the mission, send off netgame diff --git a/src/network/multi_log.cpp b/src/network/multi_log.cpp index 8b3979d..5a35337 100644 --- a/src/network/multi_log.cpp +++ b/src/network/multi_log.cpp @@ -90,10 +90,10 @@ CFILE *Multi_log_out = NULL; // time when the logfile was opened -int Multi_log_open_systime = -1; +time_t Multi_log_open_systime = -1; // time when we last updated the logfile -int Multi_log_update_systime = -1; +time_t Multi_log_update_systime = -1; // ---------------------------------------------------------------------------------------------------- // MULTI LOGFILE FUNCTIONS diff --git a/src/network/multi_respawn.cpp b/src/network/multi_respawn.cpp index 88a4d45..5c2fe9a 100644 --- a/src/network/multi_respawn.cpp +++ b/src/network/multi_respawn.cpp @@ -720,7 +720,7 @@ void multi_respawn_process_packet(ubyte *data, header *hinfo) ushort net_sig,ship_ets; short player_id; int player_index; - vector v; + vector v = ZERO_VECTOR; char parse_name[1024] = ""; int offset = HEADER_LENGTH; @@ -767,7 +767,7 @@ void multi_respawn_process_packet(ubyte *data, header *hinfo) // if this is for me, I should jump back into gameplay if(&Net_players[player_index] == Net_player){ - extern int Player_multi_died_check; + extern time_t Player_multi_died_check; Player_multi_died_check = -1; gameseq_post_event(GS_EVENT_ENTER_GAME); diff --git a/src/network/multi_update.cpp b/src/network/multi_update.cpp index bb0b4eb..87d181a 100644 --- a/src/network/multi_update.cpp +++ b/src/network/multi_update.cpp @@ -239,9 +239,6 @@ int multi_update_error_verifying() default: return MULTI_UPDATE_MAIN_MENU; } - - // should never happen, but if so, move back to the main menu - return MULTI_UPDATE_MAIN_MENU; } // check to see if the version of FS on this machine is not recent. run in a popup diff --git a/src/network/multimsgs.cpp b/src/network/multimsgs.cpp index 9672a8c..59c0f21 100644 --- a/src/network/multimsgs.cpp +++ b/src/network/multimsgs.cpp @@ -1332,6 +1332,7 @@ void process_new_player_packet(ubyte* data, header* hinfo) // get the new players information GET_INT(new_player_num); + memset(&new_addr, 0, sizeof(net_addr)); get_net_addr(data, &offset, new_addr); GET_SHORT(new_id); @@ -1610,6 +1611,7 @@ void process_accept_player_data( ubyte *data, header *hinfo ) GET_INT(player_num); // add the player's address + memset(&addr, 0, sizeof(net_addr)); get_net_addr(data, &offset, addr); // get the player's id# @@ -4509,7 +4511,7 @@ void process_subsystem_destroyed_packet( ubyte *data, header *hinfo ) ushort signature; ubyte uindex; object *objp; - vector local_hit_pos, world_hit_pos; + vector local_hit_pos = ZERO_VECTOR, world_hit_pos; offset = HEADER_LENGTH; @@ -4736,7 +4738,7 @@ void process_jump_into_mission_packet(ubyte *data, header *hinfo) } } - extern int Player_multi_died_check; + extern time_t Player_multi_died_check; Player_multi_died_check = -1; // recalc all object pairs now @@ -6617,7 +6619,7 @@ void process_asteroid_info( ubyte *data, header *hinfo ) case ASTEROID_CREATE: { ushort psignature, signature; ubyte atype; - vector relvec; + vector relvec = ZERO_VECTOR; object *parent_objp; GET_USHORT( psignature ); @@ -6642,7 +6644,7 @@ void process_asteroid_info( ubyte *data, header *hinfo ) // asteroid throw packet -- asteroid has wrapped bounds case ASTEROID_THROW: { ushort signature; - vector pos, vel; + vector pos = ZERO_VECTOR, vel = ZERO_VECTOR; object *objp; GET_USHORT( signature ); @@ -6664,7 +6666,7 @@ void process_asteroid_info( ubyte *data, header *hinfo ) case ASTEROID_HIT: { ushort signature, osignature; object *objp, *other_objp; - vector hitpos; + vector hitpos = ZERO_VECTOR; float damage; GET_USHORT( signature ); @@ -7966,8 +7968,8 @@ void process_player_pain_packet(ubyte *data, header *hinfo) int offset; ubyte windex; ushort udamage; - vector force; - vector local_hit_pos; + vector force = ZERO_VECTOR; + vector local_hit_pos = ZERO_VECTOR; weapon_info *wip; // get the data for the pain packet @@ -8027,7 +8029,7 @@ void process_lightning_packet(ubyte *data, header *hinfo) { int offset; char bolt_type; - vector start, strike; + vector start = ZERO_VECTOR, strike = ZERO_VECTOR; // read the data offset = HEADER_LENGTH; diff --git a/src/network/multiui.cpp b/src/network/multiui.cpp index f300695..23ff373 100644 --- a/src/network/multiui.cpp +++ b/src/network/multiui.cpp @@ -7973,7 +7973,7 @@ void multi_sync_init() // reset all timestamp multi_reset_timestamps(); - extern int Player_multi_died_check; + extern time_t Player_multi_died_check; Player_multi_died_check = -1; if(!(Game_mode & GM_STANDALONE_SERVER)){ @@ -8181,7 +8181,7 @@ void multi_sync_common_close() nprintf(("General","WARNING : could not unload background bitmap %s\n",Multi_sync_bitmap_fname[gr_screen.res])); } - extern int Player_multi_died_check; + extern time_t Player_multi_died_check; Player_multi_died_check = -1; // destroy the UI_WINDOW diff --git a/src/playerman/managepilot.cpp b/src/playerman/managepilot.cpp index 77b8499..50c46c6 100644 --- a/src/playerman/managepilot.cpp +++ b/src/playerman/managepilot.cpp @@ -1656,7 +1656,7 @@ static short keycode_translate_to(SDL_Keycode keycode) for (int i = 0; i < tbl_size; i++) { if (keycode_lookup[i].sdl_code == keycode) { - return (keycode_lookup[i].fs_code | mods); + return (short)(keycode_lookup[i].fs_code | mods); } } diff --git a/src/pofview/pofviewstubs.cpp b/src/pofview/pofviewstubs.cpp index 3651fdf..1aff877 100644 --- a/src/pofview/pofviewstubs.cpp +++ b/src/pofview/pofviewstubs.cpp @@ -102,5 +102,5 @@ int game_single_step; int last_single_step; void game_tst_mark(struct object*, struct ship*){} int tst; -int Player_multi_died_check; +time_t Player_multi_died_check; int Nebedit_running = 0; diff --git a/src/ship/awacs.cpp b/src/ship/awacs.cpp index 0b94ebf..eccb861 100644 --- a/src/ship/awacs.cpp +++ b/src/ship/awacs.cpp @@ -376,9 +376,6 @@ float awacs_get_level(object *target, ship *viewer, int use_awacs) // untargetable at longer range return -1.0f; } - - Int3(); - return 1.5f; } diff --git a/src/sound/acm.cpp b/src/sound/acm.cpp index 95a586b..380cca9 100644 --- a/src/sound/acm.cpp +++ b/src/sound/acm.cpp @@ -170,7 +170,7 @@ static void do_adpcm_nibble(ubyte nib, ADPCMBLOCKHEADER *header, int lPredSamp) header->iDelta = delta; header->iSamp2 = header->iSamp1; - header->iSamp1 = lNewSamp; + header->iSamp1 = (short)lNewSamp; } static int decode_adpcm_sample_frame(SDL_RWops *rw, adpcm_fmt_t *fmt) @@ -500,7 +500,7 @@ int ACM_stream_open(WAVE_chunk *pwfxSrc, WAVE_chunk *pwfxDest, void **stream, in } str->fmt = fmt; - str->dest_bps = dest_bps; + str->dest_bps = (ushort)dest_bps; str->src_bps = pwfxSrc->bits_per_sample; *stream = str; diff --git a/src/sound/audiostr.cpp b/src/sound/audiostr.cpp index 616876b..f760707 100644 --- a/src/sound/audiostr.cpp +++ b/src/sound/audiostr.cpp @@ -199,7 +199,7 @@ public: bool Create(const char *pszFilename); bool Destroy(); void Play(float volume, int looping); - void Stop(int paused = 0); + void Stop(bool paused = false); void Stop_and_Rewind(); void Fade_and_Destroy(); void Fade_and_Stop(); @@ -209,17 +209,17 @@ public: void Set_Byte_Cutoff(uint num_bytes_cutoff); uint Get_Bytes_Committed(); - int Is_Playing() + bool Is_Playing() { return m_fPlaying; } - int Is_Paused() + bool Is_Paused() { return m_bIsPaused; } - int Is_Past_Limit() + bool Is_Past_Limit() { return m_bPastLimit; } @@ -234,7 +234,7 @@ public: return m_lDefaultVolume; } - int Is_looping() + bool Is_looping() { return m_bLooping; } @@ -1017,7 +1017,7 @@ uint AudioStream::GetMaxWriteSize() bool AudioStream::ServiceBuffer() { float vol; - int fRtn = true; + bool fRtn = true; if (type == ASF_FREE) { return false; @@ -1108,7 +1108,7 @@ bool AudioStream::ServiceBuffer() } } - return (fRtn); + return fRtn; } // Cue @@ -1247,7 +1247,7 @@ void AudioStream::Fade_and_Stop() } // Stop -void AudioStream::Stop(int paused) +void AudioStream::Stop(bool paused) { if (m_fPlaying) { if (paused) { @@ -1598,7 +1598,7 @@ void audiostream_stop(int i, int rewind, int paused) if (rewind) { Audio_streams[i].Stop_and_Rewind(); } else { - Audio_streams[i].Stop(paused); + Audio_streams[i].Stop( (paused != 0) ); } } diff --git a/src/sound/oal_efx.cpp b/src/sound/oal_efx.cpp index e9e35fd..e3615e4 100644 --- a/src/sound/oal_efx.cpp +++ b/src/sound/oal_efx.cpp @@ -365,13 +365,11 @@ int oal_efx_get_all(EAX_REVERBPROPERTIES *er, int id) return -1; } - uint active_env_save; - EFXEAXREVERBPROPERTIES env_save; + uint active_env_save = EFX_active_environment; + EFXEAXREVERBPROPERTIES env_save = EFX_env_properties; bool saved = false; if ( (id >= 0) && (id != (int)EFX_active_environment) ) { - active_env_save = EFX_active_environment; - env_save = EFX_env_properties; saved = true; oal_efx_set_environment(id); diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index c7741b5..9da7e14 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -1329,7 +1329,7 @@ void snd_rewind(int snd_handle, game_snd *gs, float seconds) return; desired_time = current_time - seconds; // where we want to be - desired_offset = desired_time * bps; // the target + desired_offset = fl2i(desired_time * bps); // the target oal_set_play_position(channel, desired_offset); } @@ -1369,7 +1369,7 @@ void snd_ffwd(int snd_handle, game_snd *gs, float seconds) return; desired_time = current_time + seconds; // where we want to be - desired_offset = desired_time * bps; // the target + desired_offset = fl2i(desired_time * bps); // the target oal_set_play_position(channel, desired_offset); } diff --git a/src/starfield/nebula.cpp b/src/starfield/nebula.cpp index e3b265a..a8212f7 100644 --- a/src/starfield/nebula.cpp +++ b/src/starfield/nebula.cpp @@ -317,14 +317,10 @@ void nebula_init( const char *filename, angles * pbh ) void nebula_render() { +#ifdef MAKE_FS1 int i; // int r, g, b; - // no nebula for you! -#ifndef MAKE_FS1 - return; -#endif - if ( !Nebula_loaded ) { return; } @@ -365,6 +361,7 @@ void nebula_render() if((The_mission.flags & MISSION_FLAG_FULLNEB) && (Neb2_render_mode == NEB2_RENDER_NONE)){ gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0, -1.0f, -1.0f); } +#endif } DCF(nebula,"Loads a different nebula") diff --git a/src/stats/scoring.cpp b/src/stats/scoring.cpp index 655fccb..151d4f0 100644 --- a/src/stats/scoring.cpp +++ b/src/stats/scoring.cpp @@ -526,7 +526,7 @@ void scoring_do_accept(scoring_struct *score) // add in mission time score->flight_time += (unsigned int)f2fl(Missiontime); score->last_backup = score->last_flown; - score->last_flown = time(NULL); + score->last_flown = (fs_time_t)time(NULL); score->missions_flown++; } diff --git a/src/weapon/beam.cpp b/src/weapon/beam.cpp index 55ff520..d43945c 100644 --- a/src/weapon/beam.cpp +++ b/src/weapon/beam.cpp @@ -1873,10 +1873,6 @@ int beam_get_model(object *objp) mprintf(("Beam couldn't find a good find a good object model/type!! (%d)", objp->type)); return -1; } - - // can't happen - Int3(); - return -1; } // start the warmup phase for the beam -- 2.39.2