From 609dca9fdf9a03500c0f4023da7bcc4389f36c52 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 14 Sep 2008 21:29:13 +0000 Subject: Silence some compiler warnings on heretic/hexen code. Subversion-branch: /branches/raven-branch Subversion-revision: 1228 --- src/heretic/am_map.c | 8 +++----- src/heretic/ct_chat.c | 2 +- src/heretic/d_main.c | 4 ++-- src/heretic/d_net.c | 2 +- src/heretic/g_game.c | 37 ++++++++++++++++++------------------- src/heretic/in_lude.c | 1 - src/heretic/p_enemy.c | 5 +++-- src/heretic/p_inter.c | 6 +++++- src/heretic/p_map.c | 49 +++++++++++++++++++++++++++++++++++++++---------- src/heretic/p_maputl.c | 4 +++- src/heretic/p_pspr.c | 2 +- src/heretic/p_sight.c | 2 ++ src/heretic/p_user.c | 4 +++- src/heretic/r_main.c | 1 + src/heretic/r_plane.c | 1 + src/heretic/r_segs.c | 4 +++- src/hexen/am_map.c | 4 ++-- src/hexen/ct_chat.c | 2 +- src/hexen/d_net.c | 6 ++++-- src/hexen/h2_main.c | 4 ++-- 20 files changed, 95 insertions(+), 53 deletions(-) diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c index 267ac009..0c2ab6ee 100644 --- a/src/heretic/am_map.c +++ b/src/heretic/am_map.c @@ -796,8 +796,8 @@ boolean AM_clipMline(mline_t * ml, fline_t * fl) { 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 @@ void AM_drawFline(fline_t * fl, int color) { 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_drawCrosshair(int color) void AM_Drawer(void) { - int highestEpisode; - if (!automapactive) return; diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index 94e92471..73a43fc1 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -387,7 +387,7 @@ void CT_Drawer(void) void CT_queueChatChar(char ch) { - if ((tail + 1) & (QUEUESIZE - 1) == head) + if (((tail + 1) & (QUEUESIZE - 1)) == head) { // the queue is full return; } diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index bf9c5a0f..073b3d36 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -107,7 +107,7 @@ int eventtail; void D_PostEvent(event_t * ev) { events[eventhead] = *ev; - eventhead = (++eventhead) & (MAXEVENTS - 1); + eventhead = (eventhead + 1) & (MAXEVENTS - 1); } //--------------------------------------------------------------------------- @@ -123,7 +123,7 @@ void D_ProcessEvents(void) event_t *ev; for (; eventtail != eventhead; - eventtail = (++eventtail) & (MAXEVENTS - 1)) + eventtail = (eventtail + 1) & (MAXEVENTS - 1)) { ev = &events[eventtail]; if (F_Responder(ev)) diff --git a/src/heretic/d_net.c b/src/heretic/d_net.c index b78c2c4d..525107a2 100644 --- a/src/heretic/d_net.c +++ b/src/heretic/d_net.c @@ -479,7 +479,7 @@ void CheckAbort(void) 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) diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index a6a03271..252095a9 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -62,23 +62,22 @@ struct { 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 @@ boolean G_Responder(event_t * ev) void G_Ticker(void) { int i, buf; - ticcmd_t *cmd; + ticcmd_t *cmd = NULL; // // do player reborns if needed @@ -1499,7 +1498,7 @@ void G_DoLoadGame(void) // 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; } diff --git a/src/heretic/in_lude.c b/src/heretic/in_lude.c index 80b3e4bb..88b7d7e6 100644 --- a/src/heretic/in_lude.c +++ b/src/heretic/in_lude.c @@ -815,7 +815,6 @@ void IN_DrawDMStats(void) int ypos; int xpos; int kpos; - int x; static int sounds; diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c index 62f8dac5..b6c476f6 100644 --- a/src/heretic/p_enemy.c +++ b/src/heretic/p_enemy.c @@ -23,6 +23,7 @@ // P_enemy.c +#include #include "doomdef.h" #include "p_local.h" #include "soundst.h" @@ -2375,7 +2376,7 @@ void A_BossDeath(mobj_t * actor) void A_ESound(mobj_t * mo) { - int sound; + int sound = sfx_None; switch (mo->type) { @@ -2446,7 +2447,7 @@ void A_AccTeleGlitter(mobj_t * actor) void A_InitKeyGizmo(mobj_t * gizmo) { mobj_t *mo; - statenum_t state; + statenum_t state = S_NULL; switch (gizmo->type) { diff --git a/src/heretic/p_inter.c b/src/heretic/p_inter.c index 5e65fb5c..85ee381a 100644 --- a/src/heretic/p_inter.c +++ b/src/heretic/p_inter.c @@ -1162,7 +1162,11 @@ void P_AutoUseHealth(player_t * player, int saveHealth) 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) diff --git a/src/heretic/p_map.c b/src/heretic/p_map.c index 24cb7162..f189e798 100644 --- a/src/heretic/p_map.c +++ b/src/heretic/p_map.c @@ -22,6 +22,8 @@ //----------------------------------------------------------------------------- // P_map.c +#include + #include "doomdef.h" #include "p_local.h" #include "soundst.h" @@ -40,21 +42,48 @@ NOTES: 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. - -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. +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 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. - -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. +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. + +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. =============================================================================== diff --git a/src/heretic/p_maputl.c b/src/heretic/p_maputl.c index c72a6826..23aed3b2 100644 --- a/src/heretic/p_maputl.c +++ b/src/heretic/p_maputl.c @@ -23,6 +23,8 @@ // P_maputl.c +#include + #include "doomdef.h" #include "p_local.h" @@ -98,7 +100,7 @@ int P_PointOnLineSide(fixed_t x, fixed_t y, line_t * line) int P_BoxOnLineSide(fixed_t * tmbox, line_t * ld) { - int p1, p2; + int p1 = 0, p2 = 0; switch (ld->slopetype) { diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c index 211f5231..4c7b9811 100644 --- a/src/heretic/p_pspr.c +++ b/src/heretic/p_pspr.c @@ -1068,7 +1068,7 @@ void A_FireMacePL1B(player_t * player, pspdef_t * psp) 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; diff --git a/src/heretic/p_sight.c b/src/heretic/p_sight.c index 7e589368..257c784b 100644 --- a/src/heretic/p_sight.c +++ b/src/heretic/p_sight.c @@ -22,6 +22,8 @@ //----------------------------------------------------------------------------- // P_sight.c +#include + #include "doomdef.h" #include "p_local.h" diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c index 3c392a1b..ca587abb 100644 --- a/src/heretic/p_user.c +++ b/src/heretic/p_user.c @@ -23,6 +23,8 @@ // P_user.c +#include + #include "doomdef.h" #include "p_local.h" #include "soundst.h" @@ -1001,7 +1003,7 @@ boolean P_UseArtifact(player_t * player, artitype_t arti) 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; diff --git a/src/heretic/r_main.c b/src/heretic/r_main.c index 806028b7..2f3d604a 100644 --- a/src/heretic/r_main.c +++ b/src/heretic/r_main.c @@ -22,6 +22,7 @@ //----------------------------------------------------------------------------- // R_main.c +#include #include #include "doomdef.h" #include "r_local.h" diff --git a/src/heretic/r_plane.c b/src/heretic/r_plane.c index 6014189d..bb694dd2 100644 --- a/src/heretic/r_plane.c +++ b/src/heretic/r_plane.c @@ -22,6 +22,7 @@ //----------------------------------------------------------------------------- // R_planes.c +#include #include "doomdef.h" #include "r_local.h" diff --git a/src/heretic/r_segs.c b/src/heretic/r_segs.c index 91726779..0d2940a4 100644 --- a/src/heretic/r_segs.c +++ b/src/heretic/r_segs.c @@ -29,6 +29,8 @@ //** //************************************************************************** +#include + #include "doomdef.h" #include "r_local.h" @@ -189,7 +191,7 @@ void R_RenderSegLoop(void) 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++) { diff --git a/src/hexen/am_map.c b/src/hexen/am_map.c index b3744736..be16a8ac 100644 --- a/src/hexen/am_map.c +++ b/src/hexen/am_map.c @@ -703,8 +703,8 @@ boolean AM_clipMline(mline_t * ml, fline_t * fl) { 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) \ diff --git a/src/hexen/ct_chat.c b/src/hexen/ct_chat.c index cd721273..3e16a567 100644 --- a/src/hexen/ct_chat.c +++ b/src/hexen/ct_chat.c @@ -412,7 +412,7 @@ void CT_Drawer(void) void CT_queueChatChar(char ch) { - if ((tail + 1) & (QUEUESIZE - 1) == head) + if (((tail + 1) & (QUEUESIZE - 1)) == head) { // the queue is full return; } diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index 18d50774..f7381d4e 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -517,7 +517,7 @@ void CheckAbort(void) 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 @@ void D_CheckNetGame(void) 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) diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 2313b463..60ae9f64 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -536,7 +536,7 @@ void H2_ProcessEvents(void) 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_ProcessEvents(void) void H2_PostEvent(event_t * ev) { events[eventhead] = *ev; - eventhead = (++eventhead) & (MAXEVENTS - 1); + eventhead = (eventhead + 1) & (MAXEVENTS - 1); } //========================================================================== -- cgit v1.2.3