ref: 19466db77813385693cf78b8bc7d97b58dd2b14c
parent: 42faefce1fd03f5d613bf709d3c14925ee560064
author: Simon Howard <[email protected]>
date: Sun Mar 23 20:18:33 EDT 2014
Fix various Clang compiler warnings.
--- a/src/d_loop.c
+++ b/src/d_loop.c
@@ -573,7 +573,7 @@
static void OldNetSync(void)
{
unsigned int i;
- unsigned int keyplayer = -1;
+ int keyplayer = -1;
frameon++;
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -112,10 +112,9 @@
// Netgame? Only true if >1 player.
extern boolean netgame;
-// Flag: true only if started as net deathmatch.
-// An enum might handle altdeath/cooperative better.
-extern boolean deathmatch;
-
+// 0=Cooperative; 1=Deathmatch; 2=Altdeath
+extern int deathmatch;
+
// -------------------------
// Internal parameters for sound rendering.
// These have been taken from the DOS version,
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -123,7 +123,7 @@
boolean viewactive;
-boolean deathmatch; // only if started as net death
+int deathmatch; // only if started as net death
boolean netgame; // only true if packets are broadcast
boolean playeringame[MAXPLAYERS];
player_t players[MAXPLAYERS];
@@ -642,8 +642,8 @@
joyxmove = joyymove = 0;
mousex = mousey = 0;
sendpause = sendsave = paused = false;
- memset (mousebuttons, 0, sizeof(mousebuttons));
- memset (joybuttons, 0, sizeof(joybuttons));
+ memset(mousearray, 0, sizeof(mousearray));
+ memset(joyarray, 0, sizeof(joyarray));
if (testcontrols)
{
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -59,7 +59,7 @@
static wbstartstruct_t captured_stats[MAX_CAPTURES];
static int num_captured_stats = 0;
-static GameMode_t discovered_gamemode = indetermined;
+static GameMission_t discovered_gamemission = none;
/* Try to work out whether this is a Doom 1 or Doom 2 game, by looking
* at the episode and map, and the par times. This is used to decide
@@ -72,7 +72,7 @@
int level;
int i;
- if (discovered_gamemode != indetermined)
+ if (discovered_gamemission != none)
{
return;
}
@@ -85,7 +85,7 @@
if (stats[i].epsd > 0)
{
- discovered_gamemode = doom;
+ discovered_gamemission = doom;
return;
}
@@ -94,7 +94,7 @@
if (level >= 9)
{
- discovered_gamemode = doom2;
+ discovered_gamemission = doom2;
return;
}
@@ -106,7 +106,7 @@
if (partime == doom1_par_times[level] * TICRATE
&& partime != doom2_par_times[level] * TICRATE)
{
- discovered_gamemode = doom;
+ discovered_gamemission = doom;
return;
}
@@ -113,7 +113,7 @@
if (partime != doom1_par_times[level] * TICRATE
&& partime == doom2_par_times[level] * TICRATE)
{
- discovered_gamemode = doom2;
+ discovered_gamemission = doom2;
return;
}
}
@@ -251,7 +251,7 @@
{
PrintBanner(stream);
- switch (discovered_gamemode)
+ switch (discovered_gamemission)
{
case doom:
@@ -261,7 +261,7 @@
fprintf(stream, "MAP%02i\n", level + 1);
break;
default:
- case indetermined:
+ case none:
fprintf(stream, "E%iM%i / MAP%02i\n",
episode + 1, level + 1, level + 1);
break;
@@ -332,7 +332,7 @@
{
printf("Statistics captured for %i level(s)\n", num_captured_stats);
- // We actually know what the real gamemode is, but this has
+ // We actually know what the real gamemission is, but this has
// to match the output from statdump.exe.
DiscoverGamemode(captured_stats, num_captured_stats);
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -65,7 +65,7 @@
struct
{
- mobjtype_t type;
+ int type; // mobjtype_t
int speed[2];
} MonsterMissileInfo[] = {
{ MT_IMPBALL, { 10, 20 } },
@@ -666,8 +666,8 @@
joyxmove = joyymove = 0;
mousex = mousey = 0;
sendpause = sendsave = paused = false;
- memset(mousebuttons, 0, sizeof(mousebuttons));
- memset(joybuttons, 0, sizeof(joybuttons));
+ memset(mousearray, 0, sizeof(mousearray));
+ memset(joyarray, 0, sizeof(joyarray));
if (testcontrols)
{
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -435,7 +435,10 @@
}
else
{
- for (tdir = DI_SOUTHEAST; tdir != DI_EAST-1; tdir--)
+ // Iterate over all movedirs.
+ tdir = DI_SOUTHEAST;
+
+ for (;;)
{
if (tdir != turnaround)
{
@@ -443,6 +446,13 @@
if (P_TryWalk(actor))
return;
}
+
+ if (tdir == DI_EAST)
+ {
+ break;
+ }
+
+ --tdir;
}
}
--- a/src/heretic/p_inter.c
+++ b/src/heretic/p_inter.c
@@ -164,7 +164,7 @@
{
return (false);
}
- if (ammo < 0 || ammo > NUMAMMO)
+ if ((unsigned int) ammo > NUMAMMO)
{
I_Error("P_GiveAmmo: bad type %i", ammo);
}
--- a/src/heretic/p_spec.h
+++ b/src/heretic/p_spec.h
@@ -49,7 +49,7 @@
//
typedef struct
{
- boolean istexture; // if false, it's a flat
+ int istexture; // if false, it's a flat
char endname[9];
char startname[9];
int speed;
--- a/src/heretic/sb_bar.c
+++ b/src/heretic/sb_bar.c
@@ -1188,7 +1188,7 @@
char args[2];
int i;
int j;
- artitype_t type;
+ int type;
int count;
cht_GetParam(cheat->seq, args);
--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -860,8 +860,6 @@
int lastfound = 0;
int success = false;
- actor = actor; // suppress warning
-
// Find all quake foci
do
{
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -662,8 +662,8 @@
joyxmove = joyymove = 0;
mousex = mousey = 0;
sendpause = sendsave = paused = false;
- memset(mousebuttons, 0, sizeof(mousebuttons));
- memset(joybuttons, 0, sizeof(joybuttons));
+ memset(mousearray, 0, sizeof(mousearray));
+ memset(joyarray, 0, sizeof(joyarray));
if (testcontrols)
{
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -430,7 +430,9 @@
}
else
{
- for (tdir = DI_SOUTHEAST; tdir != DI_EAST-1; tdir--)
+ tdir = DI_SOUTHEAST;
+
+ for (;;)
{
if (tdir != turnaround)
{
@@ -438,6 +440,13 @@
if (P_TryWalk(actor))
return;
}
+
+ if (tdir == DI_EAST)
+ {
+ break;
+ }
+
+ --tdir;
}
}
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -177,7 +177,7 @@
{
return (false);
}
- if (mana < 0 || mana > NUMMANA)
+ if ((unsigned int) mana > NUMMANA)
{
I_Error("P_GiveMana: bad type %i", mana);
}
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -447,7 +447,8 @@
{
player_t *player;
int i;
- artitype_t type, arti;
+ int type;
+ artitype_t arti;
if (!mo)
return false;
--- a/src/i_cdmus.c
+++ b/src/i_cdmus.c
@@ -36,7 +36,7 @@
static SDL_CD *cd_handle = NULL;
static char *startup_error = NULL;
-static char *cd_name = NULL;
+static const char *cd_name = NULL;
int cd_Error;
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1060,8 +1060,8 @@
if (I_GetTimeMS() - start_time > 5000)
{
// time out after 5 seconds
-
- client_state = NET_CONN_STATE_DISCONNECTED;
+
+ client_state = CLIENT_STATE_WAITING_START;
fprintf(stderr, "NET_CL_Disconnect: Timeout while disconnecting from server\n");
break;
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -102,10 +102,9 @@
// Netgame? Only true if >1 player.
extern boolean netgame;
-// Flag: true only if started as net deathmatch.
-// An enum might handle altdeath/cooperative better.
-extern boolean deathmatch;
-
+// 0=Co-op; 1=Deathmatch; 2=Altdeath
+extern int deathmatch;
+
// -------------------------
// Internal parameters for sound rendering.
// These have been taken from the DOS version,
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -122,7 +122,7 @@
boolean viewactive;
-boolean deathmatch; // only if started as net death
+int deathmatch; // only if started as net death
boolean netgame; // only true if packets are broadcast
boolean playeringame[MAXPLAYERS];
player_t players[MAXPLAYERS];
@@ -702,8 +702,8 @@
joyxmove = joyymove = 0;
mousex = mousey = 0;
sendpause = sendsave = paused = false;
- memset (mousebuttons, 0, sizeof(mousebuttons));
- memset (joybuttons, 0, sizeof(joybuttons));
+ memset(mousearray, 0, sizeof(mousearray));
+ memset(joyarray, 0, sizeof(joyarray));
if (testcontrols)
{
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -574,7 +574,7 @@
boolean earlyout;
int ptflags;
-static void InterceptsOverrun(int num_intercepts, intercept_t *intercept);
+//static void InterceptsOverrun(int num_intercepts, intercept_t *intercept);
//
// PIT_AddLineIntercepts.
@@ -782,6 +782,7 @@
extern fixed_t bulletslope;
+#if 0
// Intercepts Overrun emulation, from PrBoom-plus.
// Thanks to Andrey Budko (entryway) for researching this and his
// implementation of Intercepts Overrun emulation in PrBoom-plus
@@ -906,6 +907,7 @@
InterceptsMemoryOverrun(location + 4, intercept->isaline);
InterceptsMemoryOverrun(location + 8, (int) intercept->d.thing);
}
+#endif
//
--- a/src/strife/p_setup.c
+++ b/src/strife/p_setup.c
@@ -700,8 +700,9 @@
if (len > sizeof(rejectpad))
{
- fprintf(stderr, "PadRejectArray: REJECT lump too short to pad! (%i > %i)\n",
- len, sizeof(rejectpad));
+ fprintf(stderr,
+ "PadRejectArray: REJECT lump too short to pad! (%i > %i)\n",
+ len, (int) sizeof(rejectpad));
// Pad remaining space with 0 (or 0xff, if specified on command line).
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -183,7 +183,7 @@
// villsa [STRIFE] TODO - identify variables
static int st_keypage = -1;
-static int dword_88490 = 0;
+// [unused] static int dword_88490 = 0;
// haleyjd 09/19/10: [STRIFE] Cached player data
static int st_lastcursorpos;
@@ -226,8 +226,8 @@
// 0-9, yellow numbers
static patch_t* invfonty[10];
-// 3 key-cards, 3 skulls -- [STRIFE] has a lot more keys than 3 :P
-static patch_t* keys[NUMCARDS];
+// [unused] 3 key-cards, 3 skulls -- [STRIFE] has a lot more keys than 3 :P
+//static patch_t* keys[NUMCARDS];
// ready-weapon widget
static st_number_t w_ready; // haleyjd [STRIFE]: This is still used.
@@ -242,8 +242,8 @@
// max ammo widgets
static st_number_t w_maxammo[NUMAMMO]; // haleyjd [STRIFE]: Still used.
-// number of frags so far in deathmatch
-static int st_fragscount;
+// [unused] number of frags so far in deathmatch
+//static int st_fragscount;
cheatseq_t cheat_mus = CHEAT("spin", 2); // [STRIFE]: idmus -> spin
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -801,11 +801,11 @@
int i;
char lbmname[16]; // haleyjd 20110213: BUG FIX - 12 is too small!
char *ext;
- extern int png_screenshots;
// find a file name to save it to
#ifdef HAVE_LIBPNG
+ extern int png_screenshots;
if (png_screenshots)
{
ext = "png";