foxygit / doom Log in
commit 19466db77813385693cf78b8bc7d97b58dd2b14c
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Mon Mar 24 00:18:33 2014 -0400
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Mon Mar 24 00:18:33 2014 -0400

    Fix various Clang compiler warnings.
---
 src/d_loop.c          |  2 +-
 src/doom/doomstat.h   |  7 +++----
 src/doom/g_game.c     |  6 +++---
 src/doom/statdump.c   | 18 +++++++++---------
 src/heretic/g_game.c  |  6 +++---
 src/heretic/p_enemy.c | 12 +++++++++++-
 src/heretic/p_inter.c |  2 +-
 src/heretic/p_spec.h  |  2 +-
 src/heretic/sb_bar.c  |  2 +-
 src/hexen/a_action.c  |  2 --
 src/hexen/g_game.c    |  4 ++--
 src/hexen/p_enemy.c   | 11 ++++++++++-
 src/hexen/p_inter.c   |  2 +-
 src/hexen/p_spec.c    |  3 ++-
 src/i_cdmus.c         |  2 +-
 src/net_client.c      |  4 ++--
 src/strife/doomstat.h |  7 +++----
 src/strife/g_game.c   |  6 +++---
 src/strife/p_maputl.c |  4 +++-
 src/strife/p_setup.c  |  5 +++--
 src/strife/st_stuff.c | 10 +++++-----
 src/v_video.c         |  2 +-
 22 files changed, 69 insertions(+), 50 deletions(-)

diff --git a/src/d_loop.c b/src/d_loop.c
index b68e2665..ba5cf0cb 100644
--- a/src/d_loop.c
+++ b/src/d_loop.c
@@ -573,7 +573,7 @@ static int oldnettics;
 static void OldNetSync(void)
 {
     unsigned int i;
-    unsigned int keyplayer = -1;
+    int keyplayer = -1;

     frameon++;

diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h
index bb203e0d..7984a7b3 100644
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -112,10 +112,9 @@ extern  boolean         respawnmonsters;
 // 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,
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 4a814871..1c838e92 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -123,7 +123,7 @@ int             starttime;          	// for comparative timing purposes

 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 @@ void G_DoLoadLevel (void)
     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)
     {
diff --git a/src/doom/statdump.c b/src/doom/statdump.c
index cba91776..a8c9ad30 100644
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -59,7 +59,7 @@ static const char *player_colors[] =
 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 @@ static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
     int level;
     int i;

-    if (discovered_gamemode != indetermined)
+    if (discovered_gamemission != none)
     {
         return;
     }
@@ -85,7 +85,7 @@ static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)

         if (stats[i].epsd > 0)
         {
-            discovered_gamemode = doom;
+            discovered_gamemission = doom;
             return;
         }

@@ -94,7 +94,7 @@ static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)

         if (level >= 9)
         {
-            discovered_gamemode = doom2;
+            discovered_gamemission = doom2;
             return;
         }

@@ -106,14 +106,14 @@ static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
         if (partime == doom1_par_times[level] * TICRATE
          && partime != doom2_par_times[level] * TICRATE)
         {
-            discovered_gamemode = doom;
+            discovered_gamemission = doom;
             return;
         }

         if (partime != doom1_par_times[level] * TICRATE
          && partime == doom2_par_times[level] * TICRATE)
         {
-            discovered_gamemode = doom2;
+            discovered_gamemission = doom2;
             return;
         }
     }
@@ -251,7 +251,7 @@ static void PrintLevelName(FILE *stream, int episode, int level)
 {
     PrintBanner(stream);

-    switch (discovered_gamemode)
+    switch (discovered_gamemission)
     {

         case doom:
@@ -261,7 +261,7 @@ static void PrintLevelName(FILE *stream, int episode, int level)
             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 @@ void StatDump(void)
     {
         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);
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index 5139c950..c48b9c8e 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -65,7 +65,7 @@ void D_AdvanceDemo(void);

 struct
 {
-    mobjtype_t type;
+    int type;   // mobjtype_t
     int speed[2];
 } MonsterMissileInfo[] = {
     { MT_IMPBALL, { 10, 20 } },
@@ -666,8 +666,8 @@ void G_DoLoadLevel(void)
     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)
     {
diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c
index c2864668..079a25eb 100644
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -435,7 +435,10 @@ void P_NewChaseDir(mobj_t * actor)
     }
     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 @@ void P_NewChaseDir(mobj_t * actor)
                 if (P_TryWalk(actor))
                     return;
             }
+
+            if (tdir == DI_EAST)
+            {
+                break;
+            }
+
+            --tdir;
         }
     }

diff --git a/src/heretic/p_inter.c b/src/heretic/p_inter.c
index 0e7b24b8..a68586ee 100644
--- a/src/heretic/p_inter.c
+++ b/src/heretic/p_inter.c
@@ -164,7 +164,7 @@ boolean P_GiveAmmo(player_t * player, ammotype_t ammo, int count)
     {
         return (false);
     }
-    if (ammo < 0 || ammo > NUMAMMO)
+    if ((unsigned int) ammo > NUMAMMO)
     {
         I_Error("P_GiveAmmo: bad type %i", ammo);
     }
diff --git a/src/heretic/p_spec.h b/src/heretic/p_spec.h
index 7f5e2c43..550cd883 100644
--- a/src/heretic/p_spec.h
+++ b/src/heretic/p_spec.h
@@ -49,7 +49,7 @@ typedef struct
 //
 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;
diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c
index 4db3094b..3de57cb1 100644
--- a/src/heretic/sb_bar.c
+++ b/src/heretic/sb_bar.c
@@ -1188,7 +1188,7 @@ static void CheatArtifact3Func(player_t * player, Cheat_t * cheat)
     char args[2];
     int i;
     int j;
-    artitype_t type;
+    int type;
     int count;

     cht_GetParam(cheat->seq, args);
diff --git a/src/hexen/a_action.c b/src/hexen/a_action.c
index af727480..19b1543b 100644
--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -860,8 +860,6 @@ boolean A_LocalQuake(byte * args, mobj_t * actor)
     int lastfound = 0;
     int success = false;

-    actor = actor;              // suppress warning
-
     // Find all quake foci
     do
     {
diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c
index bc58b128..17ec04b9 100644
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -662,8 +662,8 @@ void G_DoLoadLevel(void)
     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)
     {
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index da987f16..6c9ca194 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -430,7 +430,9 @@ void P_NewChaseDir(mobj_t * actor)
     }
     else
     {
-        for (tdir = DI_SOUTHEAST; tdir != DI_EAST-1; tdir--)
+        tdir = DI_SOUTHEAST;
+
+        for (;;)
         {
             if (tdir != turnaround)
             {
@@ -438,6 +440,13 @@ void P_NewChaseDir(mobj_t * actor)
                 if (P_TryWalk(actor))
                     return;
             }
+
+            if (tdir == DI_EAST)
+            {
+                break;
+            }
+
+            --tdir;
         }
     }

diff --git a/src/hexen/p_inter.c b/src/hexen/p_inter.c
index 9e196c79..063e3c64 100644
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -177,7 +177,7 @@ boolean P_GiveMana(player_t * player, manatype_t mana, int count)
     {
         return (false);
     }
-    if (mana < 0 || mana > NUMMANA)
+    if ((unsigned int) mana > NUMMANA)
     {
         I_Error("P_GiveMana: bad type %i", mana);
     }
diff --git a/src/hexen/p_spec.c b/src/hexen/p_spec.c
index 03c98cbc..99ae73ae 100644
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -447,7 +447,8 @@ boolean EV_LineSearchForPuzzleItem(line_t * line, byte * args, mobj_t * mo)
 {
     player_t *player;
     int i;
-    artitype_t type, arti;
+    int type;
+    artitype_t arti;

     if (!mo)
         return false;
diff --git a/src/i_cdmus.c b/src/i_cdmus.c
index e9756dd9..7dad8315 100644
--- 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;

diff --git a/src/net_client.c b/src/net_client.c
index 239691c8..b32f59de 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1060,8 +1060,8 @@ void NET_CL_Disconnect(void)
         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;
diff --git a/src/strife/doomstat.h b/src/strife/doomstat.h
index 95803c29..cce091d8 100644
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -102,10 +102,9 @@ extern  boolean         respawnmonsters;
 // 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,
diff --git a/src/strife/g_game.c b/src/strife/g_game.c
index dc9ee351..5c3bfe03 100644
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -122,7 +122,7 @@ int             starttime;              // for comparative timing purposes

 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 @@ void G_DoLoadLevel (void)
     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)
     {
diff --git a/src/strife/p_maputl.c b/src/strife/p_maputl.c
index ee8485ca..3c39a1b5 100644
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -574,7 +574,7 @@ divline_t 	trace;
 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 @@ P_TraverseIntercepts

 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 @@ static void InterceptsOverrun(int num_intercepts, intercept_t *intercept)
     InterceptsMemoryOverrun(location + 4, intercept->isaline);
     InterceptsMemoryOverrun(location + 8, (int) intercept->d.thing);
 }
+#endif


 //
diff --git a/src/strife/p_setup.c b/src/strife/p_setup.c
index 694d0185..80a49e75 100644
--- a/src/strife/p_setup.c
+++ b/src/strife/p_setup.c
@@ -700,8 +700,9 @@ static void PadRejectArray(byte *array, unsigned int len)

     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).

diff --git a/src/strife/st_stuff.c b/src/strife/st_stuff.c
index 0be72b05..290edc5c 100644
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -183,7 +183,7 @@ static boolean          st_showkeys = false;

 // 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 @@ static patch_t*         invfontg[10];
 // 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 @@ static st_number_t      w_ammo[NUMAMMO];     // haleyjd [STRIFE]: Still used.
 // 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
diff --git a/src/v_video.c b/src/v_video.c
index 330e0d51..f37aac86 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -801,11 +801,11 @@ void V_ScreenShot(char *format)
     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";