shithub: choc

Download patch

ref: 609dca9fdf9a03500c0f4023da7bcc4389f36c52
parent: 7019bf097b3adf2e079e92d363723e0c9b923d0c
author: Simon Howard <[email protected]>
date: Sun Sep 14 17:29:13 EDT 2008

Silence some compiler warnings on heretic/hexen code.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1228

--- a/src/heretic/am_map.c
+++ b/src/heretic/am_map.c
@@ -796,8 +796,8 @@
 {
     enum
     { LEFT = 1, RIGHT = 2, BOTTOM = 4, TOP = 8 };
-    register outcode1 = 0, outcode2 = 0, outside;
-    fpoint_t tmp;
+    int outcode1 = 0, outcode2 = 0, outside;
+    fpoint_t tmp = { 0, 0 };
     int dx, dy;
 
 #define DOOUTCODE(oc, mx, my) \
@@ -902,7 +902,7 @@
 {
 
     register int x, y, dx, dy, sx, sy, ax, ay, d;
-    static fuck = 0;
+    static int fuck = 0;
 
     switch (color)
     {
@@ -1448,8 +1448,6 @@
 
 void AM_Drawer(void)
 {
-    int highestEpisode;
-
     if (!automapactive)
         return;
 
--- a/src/heretic/ct_chat.c
+++ b/src/heretic/ct_chat.c
@@ -387,7 +387,7 @@
 
 void CT_queueChatChar(char ch)
 {
-    if ((tail + 1) & (QUEUESIZE - 1) == head)
+    if (((tail + 1) & (QUEUESIZE - 1)) == head)
     {                           // the queue is full
         return;
     }
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -107,7 +107,7 @@
 void D_PostEvent(event_t * ev)
 {
     events[eventhead] = *ev;
-    eventhead = (++eventhead) & (MAXEVENTS - 1);
+    eventhead = (eventhead + 1) & (MAXEVENTS - 1);
 }
 
 //---------------------------------------------------------------------------
@@ -123,7 +123,7 @@
     event_t *ev;
 
     for (; eventtail != eventhead;
-         eventtail = (++eventtail) & (MAXEVENTS - 1))
+         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
     {
         ev = &events[eventtail];
         if (F_Responder(ev))
--- a/src/heretic/d_net.c
+++ b/src/heretic/d_net.c
@@ -479,7 +479,7 @@
 
     I_StartTic();
     for (; eventtail != eventhead;
-         eventtail = (++eventtail) & (MAXEVENTS - 1))
+         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
     {
         ev = &events[eventtail];
         if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -62,23 +62,22 @@
 {
     mobjtype_t type;
     int speed[2];
-} MonsterMissileInfo[] =
-{
-    { MT_IMPBALL, 10, 20},
-    { MT_MUMMYFX1, 9, 18},
-    { MT_KNIGHTAXE, 9, 18},
-    { MT_REDAXE, 9, 18},
-    { MT_BEASTBALL, 12, 20},
-    { MT_WIZFX1, 18, 24},
-    { MT_SNAKEPRO_A, 14, 20},
-    { MT_SNAKEPRO_B, 14, 20},
-    { MT_HEADFX1, 13, 20},
-    { MT_HEADFX3, 10, 18},
-    { MT_MNTRFX1, 20, 26},
-    { MT_MNTRFX2, 14, 20},
-    { MT_SRCRFX1, 20, 28},
-    { MT_SOR2FX1, 20, 28},
-    { -1, -1, -1}                 // Terminator
+} MonsterMissileInfo[] = {
+    { MT_IMPBALL, { 10, 20 } },
+    { MT_MUMMYFX1, { 9, 18 } },
+    { MT_KNIGHTAXE, { 9, 18 } },
+    { MT_REDAXE, { 9, 18 } },
+    { MT_BEASTBALL, { 12, 20 } },
+    { MT_WIZFX1, { 18, 24 } },
+    { MT_SNAKEPRO_A, { 14, 20 } },
+    { MT_SNAKEPRO_B, { 14, 20 } },
+    { MT_HEADFX1, { 13, 20 } },
+    { MT_HEADFX3, { 10, 18 } },
+    { MT_MNTRFX1, { 20, 26 } },
+    { MT_MNTRFX2, { 14, 20 } },
+    { MT_SRCRFX1, { 20, 28 } },
+    { MT_SOR2FX1, { 20, 28 } },
+    { -1, { -1, -1 } }                 // Terminator
 };
 
 FILE *SaveGameFP;
@@ -930,7 +929,7 @@
 void G_Ticker(void)
 {
     int i, buf;
-    ticcmd_t *cmd;
+    ticcmd_t *cmd = NULL;
 
 //
 // do player reborns if needed
@@ -1499,7 +1498,7 @@
     // Skip the description field
     memset(vcheck, 0, sizeof(vcheck));
     sprintf(vcheck, "version %i", VERSION);
-    if (strcmp(save_p, vcheck))
+    if (strcmp((char *) save_p, vcheck) != 0)
     {                           // Bad version
         return;
     }
--- a/src/heretic/in_lude.c
+++ b/src/heretic/in_lude.c
@@ -815,7 +815,6 @@
     int ypos;
     int xpos;
     int kpos;
-    int x;
 
     static int sounds;
 
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -23,6 +23,7 @@
 
 // P_enemy.c
 
+#include <stdlib.h>
 #include "doomdef.h"
 #include "p_local.h"
 #include "soundst.h"
@@ -2375,7 +2376,7 @@
 
 void A_ESound(mobj_t * mo)
 {
-    int sound;
+    int sound = sfx_None;
 
     switch (mo->type)
     {
@@ -2446,7 +2447,7 @@
 void A_InitKeyGizmo(mobj_t * gizmo)
 {
     mobj_t *mo;
-    statenum_t state;
+    statenum_t state = S_NULL;
 
     switch (gizmo->type)
     {
--- a/src/heretic/p_inter.c
+++ b/src/heretic/p_inter.c
@@ -1162,7 +1162,11 @@
     int superCount;
     int superSlot;
 
-    normalCount = superCount = 0;
+    normalCount = 0;
+    superCount = 0;
+    normalSlot = 0;
+    superSlot = 0;
+
     for (i = 0; i < player->inventorySlotNum; i++)
     {
         if (player->inventory[i].type == arti_health)
--- a/src/heretic/p_map.c
+++ b/src/heretic/p_map.c
@@ -22,6 +22,8 @@
 //-----------------------------------------------------------------------------
 // P_map.c
 
+#include <stdlib.h>
+
 #include "doomdef.h"
 #include "p_local.h"
 #include "soundst.h"
@@ -40,21 +42,48 @@
 
 mobj_t NOTES
 
-mobj_ts are used to tell the refresh where to draw an image, tell the world simulation when objects are contacted, and tell the sound driver how to position a sound.
+mobj_ts are used to tell the refresh where to draw an image, tell the world
+simulation when objects are contacted, and tell the sound driver how to
+position a sound.
 
-The refresh uses the next and prev links to follow lists of things in sectors as they are being drawn.  The sprite, frame, and angle elements determine which patch_t is used to draw the sprite if it is visible.  The sprite and frame values are allmost allways set from state_t structures.  The statescr.exe utility generates the states.h and states.c files that contain the sprite/frame numbers from the statescr.txt source file.  The xyz origin point represents a point at the bottom middle of the sprite (between the feet of a biped).  This is the default origin position for patch_ts grabbed with lumpy.exe.  A walking creature will have its z equal to the floor it is standing on.
+The refresh uses the next and prev links to follow lists of things in sectors
+as they are being drawn.  The sprite, frame, and angle elements determine which
+patch_t is used to draw the sprite if it is visible.  The sprite and frame
+values are allmost allways set from state_t structures.  The statescr.exe
+utility generates the states.h and states.c files that contain the sprite/frame
+numbers from the statescr.txt source file.  The xyz origin point represents a
+point at the bottom middle of the sprite (between the feet of a biped).  This
+is the default origin position for patch_ts grabbed with lumpy.exe.  A walking
+creature will have its z equal to the floor it is standing on.
  
-The sound code uses the x,y, and subsector fields to do stereo positioning of any sound effited by the mobj_t.
+The sound code uses the x,y, and subsector fields to do stereo positioning of
+any sound effited by the mobj_t.
 
-The play simulation uses the blocklinks, x,y,z, radius, height to determine when mobj_ts are touching each other, touching lines in the map, or hit by trace lines (gunshots, lines of sight, etc). The mobj_t->flags element has various bit flags used by the simulation.
+The play simulation uses the blocklinks, x,y,z, radius, height to determine
+when mobj_ts are touching each other, touching lines in the map, or hit by
+trace lines (gunshots, lines of sight, etc). The mobj_t->flags element has
+various bit flags used by the simulation.
 
 
 Every mobj_t is linked into a single sector based on it's origin coordinates.
-The subsector_t is found with R_PointInSubsector(x,y), and the sector_t can be found with subsector->sector.  The sector links are only used by the rendering code,  the play simulation does not care about them at all.
+The subsector_t is found with R_PointInSubsector(x,y), and the sector_t can be
+found with subsector->sector.  The sector links are only used by the rendering
+code,  the play simulation does not care about them at all.
 
-Any mobj_t that needs to be acted upon be something else in the play world (block movement, be shot, etc) will also need to be linked into the blockmap.  If the thing has the MF_NOBLOCK flag set, it will not use the block links. It can still interact with other things, but only as the instigator (missiles will run into other things, but nothing can run into a missile).   Each block in the grid is 128*128 units, and knows about every line_t that it contains a piece of, and every interactable mobj_t that has it's origin contained.  
+Any mobj_t that needs to be acted upon be something else in the play world
+(block movement, be shot, etc) will also need to be linked into the blockmap. 
+If the thing has the MF_NOBLOCK flag set, it will not use the block links. It
+can still interact with other things, but only as the instigator (missiles will
+run into other things, but nothing can run into a missile).   Each block in
+the grid is 128*128 units, and knows about every line_t that it contains a
+piece of, and every interactable mobj_t that has it's origin contained.  
 
-A valid mobj_t is a mobj_t that has the proper subsector_t filled in for it's xy coordinates and is linked into the subsector's sector or has the MF_NOSECTOR flag set (the subsector_t needs to be valid even if MF_NOSECTOR is set), and is linked into a blockmap block or has the MF_NOBLOCKMAP flag set.  Links should only be modified by the P_[Un]SetThingPosition () functions.  Do not change the MF_NO? flags while a thing is valid.
+A valid mobj_t is a mobj_t that has the proper subsector_t filled in for it's
+xy coordinates and is linked into the subsector's sector or has the MF_NOSECTOR
+flag set (the subsector_t needs to be valid even if MF_NOSECTOR is set), and is
+linked into a blockmap block or has the MF_NOBLOCKMAP flag set.  Links should
+only be modified by the P_[Un]SetThingPosition () functions.  Do not change
+the MF_NO? flags while a thing is valid.
 
 
 ===============================================================================
--- a/src/heretic/p_maputl.c
+++ b/src/heretic/p_maputl.c
@@ -23,6 +23,8 @@
 
 // P_maputl.c
 
+#include <stdlib.h>
+
 #include "doomdef.h"
 #include "p_local.h"
 
@@ -98,7 +100,7 @@
 
 int P_BoxOnLineSide(fixed_t * tmbox, line_t * ld)
 {
-    int p1, p2;
+    int p1 = 0, p2 = 0;
 
     switch (ld->slopetype)
     {
--- a/src/heretic/p_pspr.c
+++ b/src/heretic/p_pspr.c
@@ -1068,7 +1068,7 @@
     player->ammo[am_mace] -= USE_MACE_AMMO_1;
     pmo = player->mo;
     ball = P_SpawnMobj(pmo->x, pmo->y, pmo->z + 28 * FRACUNIT
-                       - FOOTCLIPSIZE * (pmo->flags2 & MF2_FEETARECLIPPED !=
+                       - FOOTCLIPSIZE * ((pmo->flags2 & MF2_FEETARECLIPPED) !=
                                          0), MT_MACEFX2);
     ball->momz = 2 * FRACUNIT + ((player->lookdir) << (FRACBITS - 5));
     angle = pmo->angle;
--- a/src/heretic/p_sight.c
+++ b/src/heretic/p_sight.c
@@ -22,6 +22,8 @@
 //-----------------------------------------------------------------------------
 // P_sight.c
 
+#include <stdlib.h>
+
 #include "doomdef.h"
 #include "p_local.h"
 
--- a/src/heretic/p_user.c
+++ b/src/heretic/p_user.c
@@ -23,6 +23,8 @@
 
 // P_user.c
 
+#include <stdlib.h>
+
 #include "doomdef.h"
 #include "p_local.h"
 #include "soundst.h"
@@ -1001,7 +1003,7 @@
                              player->mo->y + 24 * finesine[angle],
                              player->mo->z -
                              15 * FRACUNIT *
-                             (player->mo->flags2 & MF2_FEETARECLIPPED != 0),
+                             (player->mo->flags2 & MF2_FEETARECLIPPED) != 0,
                              MT_FIREBOMB);
             mo->target = player->mo;
             break;
--- a/src/heretic/r_main.c
+++ b/src/heretic/r_main.c
@@ -22,6 +22,7 @@
 //-----------------------------------------------------------------------------
 // R_main.c
 
+#include <stdlib.h>
 #include <math.h>
 #include "doomdef.h"
 #include "r_local.h"
--- a/src/heretic/r_plane.c
+++ b/src/heretic/r_plane.c
@@ -22,6 +22,7 @@
 //-----------------------------------------------------------------------------
 // R_planes.c
 
+#include <stdlib.h>
 #include "doomdef.h"
 #include "r_local.h"
 
--- a/src/heretic/r_segs.c
+++ b/src/heretic/r_segs.c
@@ -29,6 +29,8 @@
 //**
 //**************************************************************************
 
+#include <stdlib.h>
+
 #include "doomdef.h"
 #include "r_local.h"
 
@@ -189,7 +191,7 @@
     fixed_t texturecolumn;
     int top, bottom;
 
-//      texturecolumn = 0;                              // shut up compiler warning
+    texturecolumn = 0;               // shut up compiler warning
 
     for (; rw_x < rw_stopx; rw_x++)
     {
--- a/src/hexen/am_map.c
+++ b/src/hexen/am_map.c
@@ -703,8 +703,8 @@
 {
     enum
     { LEFT = 1, RIGHT = 2, BOTTOM = 4, TOP = 8 };
-    register outcode1 = 0, outcode2 = 0, outside;
-    fpoint_t tmp;
+    int outcode1 = 0, outcode2 = 0, outside;
+    fpoint_t tmp = { 0, 0 };
     int dx, dy;
 
 #define DOOUTCODE(oc, mx, my) \
--- a/src/hexen/ct_chat.c
+++ b/src/hexen/ct_chat.c
@@ -412,7 +412,7 @@
 
 void CT_queueChatChar(char ch)
 {
-    if ((tail + 1) & (QUEUESIZE - 1) == head)
+    if (((tail + 1) & (QUEUESIZE - 1)) == head)
     {                           // the queue is full
         return;
     }
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -517,7 +517,7 @@
 
     I_StartTic();
     for (; eventtail != eventhead;
-         eventtail = (++eventtail) & (MAXEVENTS - 1))
+         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
     {
         ev = &events[eventtail];
         if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
@@ -722,7 +722,9 @@
     netbuffer = &doomcom->data;
     consoleplayer = displayplayer = doomcom->consoleplayer;
     pClass = PCLASS_FIGHTER;
-    if (i = M_CheckParm("-class"))
+    i = M_CheckParm("-class");
+
+    if (i > 0)
     {
         pClass = atoi(myargv[i + 1]);
         if (pClass > PCLASS_MAGE || pClass < PCLASS_FIGHTER)
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -536,7 +536,7 @@
     event_t *ev;
 
     for (; eventtail != eventhead;
-         eventtail = (++eventtail) & (MAXEVENTS - 1))
+         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
     {
         ev = &events[eventtail];
         if (F_Responder(ev))
@@ -562,7 +562,7 @@
 void H2_PostEvent(event_t * ev)
 {
     events[eventhead] = *ev;
-    eventhead = (++eventhead) & (MAXEVENTS - 1);
+    eventhead = (eventhead + 1) & (MAXEVENTS - 1);
 }
 
 //==========================================================================