summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hexen/h2def.h2
-rw-r--r--src/hexen/m_misc.c6
-rw-r--r--src/hexen/p_enemy.c6
-rw-r--r--src/hexen/p_maputl.c17
-rw-r--r--src/hexen/p_mobj.c2
-rw-r--r--src/hexen/p_plats.c10
-rw-r--r--src/hexen/p_pspr.c5
-rw-r--r--src/hexen/p_setup.c1
-rw-r--r--src/hexen/p_telept.c6
-rw-r--r--src/hexen/p_user.c1
-rw-r--r--src/hexen/po_man.c20
-rw-r--r--src/hexen/r_segs.c2
-rw-r--r--src/hexen/sb_bar.c2
-rw-r--r--src/hexen/sn_sonix.c4
-rw-r--r--src/hexen/sv_save.c6
15 files changed, 55 insertions, 35 deletions
diff --git a/src/hexen/h2def.h b/src/hexen/h2def.h
index fa90f6dd..6a4a3a89 100644
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -1193,11 +1193,11 @@ void M_ForceUppercase(char *text);
// Changes a string to uppercase
int M_Random(void);
+int P_Random(void);
// returns a number from 0 to 255
extern unsigned char rndtable[256];
extern int prndindex;
-#define P_Random() rndtable[(++prndindex)&0xff]
// as M_Random, but used only by the play simulation
void M_ClearRandom(void);
diff --git a/src/hexen/m_misc.c b/src/hexen/m_misc.c
index 9903e200..c493b23f 100644
--- a/src/hexen/m_misc.c
+++ b/src/hexen/m_misc.c
@@ -168,6 +168,12 @@ unsigned char rndtable[256] = {
int rndindex = 0;
int prndindex = 0;
+int P_Random(void)
+{
+ prndindex = (prndindex + 1) & 0xff;
+ return rndtable[prndindex];
+}
+
int M_Random(void)
{
rndindex = (rndindex + 1) & 0xff;
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index 4651d630..cb603e99 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -3533,7 +3533,7 @@ void A_FiredSpawnRock(mobj_t * actor)
{
mobj_t *mo;
int x, y, z;
- int rtype;
+ int rtype = 0;
switch (P_Random() % 5)
{
@@ -3970,7 +3970,7 @@ void A_SorcBallOrbit(mobj_t * actor)
break;
default:
I_Error("corrupted sorcerer");
- break;
+ return;
}
actor->angle = angle;
angle >>= ANGLETOFINESHIFT;
@@ -5047,7 +5047,7 @@ void A_KoraxDecide(mobj_t * actor)
void A_KoraxMissile(mobj_t * actor)
{
int type = P_Random() % 6;
- int sound;
+ int sound = 0;
S_StartSound(actor, SFX_KORAX_ATTACK);
diff --git a/src/hexen/p_maputl.c b/src/hexen/p_maputl.c
index 2067f8b5..762b9dbf 100644
--- a/src/hexen/p_maputl.c
+++ b/src/hexen/p_maputl.c
@@ -98,7 +98,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)
{
@@ -839,7 +839,8 @@ mobj_t *P_RoughMonsterSearch(mobj_t * mo, int distance)
if (startX >= 0 && startX < bmapwidth && startY >= 0
&& startY < bmapheight)
{
- if (target = RoughBlockCheck(mo, startY * bmapwidth + startX))
+ target = RoughBlockCheck(mo, startY * bmapwidth + startX);
+ if (target != NULL)
{ // found a target right away
return target;
}
@@ -892,7 +893,8 @@ mobj_t *P_RoughMonsterSearch(mobj_t * mo, int distance)
// Trace the first block section (along the top)
for (; blockIndex <= firstStop; blockIndex++)
{
- if (target = RoughBlockCheck(mo, blockIndex))
+ target = RoughBlockCheck(mo, blockIndex);
+ if (target != NULL)
{
return target;
}
@@ -900,7 +902,8 @@ mobj_t *P_RoughMonsterSearch(mobj_t * mo, int distance)
// Trace the second block section (right edge)
for (blockIndex--; blockIndex <= secondStop; blockIndex += bmapwidth)
{
- if (target = RoughBlockCheck(mo, blockIndex))
+ target = RoughBlockCheck(mo, blockIndex);
+ if (target != NULL)
{
return target;
}
@@ -908,7 +911,8 @@ mobj_t *P_RoughMonsterSearch(mobj_t * mo, int distance)
// Trace the third block section (bottom edge)
for (blockIndex -= bmapwidth; blockIndex >= thirdStop; blockIndex--)
{
- if (target = RoughBlockCheck(mo, blockIndex))
+ target = RoughBlockCheck(mo, blockIndex);
+ if (target != NULL)
{
return target;
}
@@ -916,7 +920,8 @@ mobj_t *P_RoughMonsterSearch(mobj_t * mo, int distance)
// Trace the final block section (left edge)
for (blockIndex++; blockIndex > finalStop; blockIndex -= bmapwidth)
{
- if (target = RoughBlockCheck(mo, blockIndex))
+ target = RoughBlockCheck(mo, blockIndex);
+ if (target != NULL)
{
return target;
}
diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c
index 11124794..45c43b89 100644
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1351,7 +1351,7 @@ void P_SpawnPlayer(mapthing_t * mthing)
break;
default:
I_Error("P_SpawnPlayer: Unknown class type");
- break;
+ return;
}
// Set translation table data
diff --git a/src/hexen/p_plats.c b/src/hexen/p_plats.c
index 0fec8f34..ced14141 100644
--- a/src/hexen/p_plats.c
+++ b/src/hexen/p_plats.c
@@ -224,11 +224,13 @@ void EV_StopPlat(line_t * line, byte * args)
for (i = 0; i < MAXPLATS; i++)
{
- if ((activeplats[i])->tag = args[0])
+ activeplats[i]->tag = args[0];
+
+ if (activeplats[i]->tag != 0)
{
- (activeplats[i])->sector->specialdata = NULL;
- P_TagFinished((activeplats[i])->sector->tag);
- P_RemoveThinker(&(activeplats[i])->thinker);
+ activeplats[i]->sector->specialdata = NULL;
+ P_TagFinished(activeplats[i]->sector->tag);
+ P_RemoveThinker(&activeplats[i]->thinker);
activeplats[i] = NULL;
return;
diff --git a/src/hexen/p_pspr.c b/src/hexen/p_pspr.c
index 639086b9..b5c4cecd 100644
--- a/src/hexen/p_pspr.c
+++ b/src/hexen/p_pspr.c
@@ -922,7 +922,7 @@ void A_LightningReady(player_t * player, pspdef_t * psp)
void A_LightningClip(mobj_t * actor)
{
mobj_t *cMo;
- mobj_t *target;
+ mobj_t *target = NULL;
int zigZag;
if (actor->type == MT_LIGHTNING_FLOOR)
@@ -1968,7 +1968,8 @@ static void CHolyFindTarget(mobj_t * actor)
{
mobj_t *target;
- if (target = P_RoughMonsterSearch(actor, 6))
+ target = P_RoughMonsterSearch(actor, 6);
+ if (target != NULL)
{
actor->special1 = (int) target;
actor->flags |= MF_NOCLIP | MF_SKULLFLY;
diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c
index abcab748..75939ecb 100644
--- a/src/hexen/p_setup.c
+++ b/src/hexen/p_setup.c
@@ -657,7 +657,6 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
int i;
int parm;
char lumpname[9];
- char auxName[128];
int lumpnum;
mobj_t *mobj;
diff --git a/src/hexen/p_telept.c b/src/hexen/p_telept.c
index 10454c79..746938ce 100644
--- a/src/hexen/p_telept.c
+++ b/src/hexen/p_telept.c
@@ -181,11 +181,15 @@ boolean EV_Teleport(int tid, mobj_t * thing, boolean fog)
}
count = 1 + (P_Random() % count);
searcher = -1;
+ mo = NULL;
+
for (i = 0; i < count; i++)
{
mo = P_FindMobjFromTID(tid, &searcher);
}
- if (!mo)
+ if (mo == NULL)
+ {
I_Error("Can't find teleport mapspot\n");
+ }
return P_Teleport(thing, mo->x, mo->y, mo->angle, fog);
}
diff --git a/src/hexen/p_user.c b/src/hexen/p_user.c
index 832ba959..cc6ca8b2 100644
--- a/src/hexen/p_user.c
+++ b/src/hexen/p_user.c
@@ -543,6 +543,7 @@ boolean P_UndoPlayerMorph(player_t * player)
default:
I_Error("P_UndoPlayerMorph: Unknown player class %d\n",
player->class);
+ return false;
}
if (P_TestMobjLocation(mo) == false)
{ // Didn't fit
diff --git a/src/hexen/po_man.c b/src/hexen/po_man.c
index 864c0c4c..71c1db97 100644
--- a/src/hexen/po_man.c
+++ b/src/hexen/po_man.c
@@ -129,7 +129,8 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean
polyobj_t *poly;
polyNum = args[0];
- if (poly = GetPolyobj(polyNum))
+ poly = GetPolyobj(polyNum);
+ if (poly != NULL)
{
if (poly->specialdata && !overRide)
{ // poly is already moving
@@ -164,7 +165,7 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean
SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE +
poly->seqType);
- while (mirror = GetPolyobjMirror(polyNum))
+ while ((mirror = GetPolyobjMirror(polyNum)) != 0)
{
poly = GetPolyobj(mirror);
if (poly && poly->specialdata && !overRide)
@@ -191,7 +192,8 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean
{
pe->dist = ANGLE_MAX - 1;
}
- if (poly = GetPolyobj(polyNum))
+ poly = GetPolyobj(polyNum);
+ if (poly != NULL)
{
poly->specialdata = pe;
}
@@ -259,7 +261,8 @@ boolean EV_MovePoly(line_t * line, byte * args, boolean timesEight, boolean
angle_t an;
polyNum = args[0];
- if (poly = GetPolyobj(polyNum))
+ poly = GetPolyobj(polyNum);
+ if (poly != NULL)
{
if (poly->specialdata && !overRide)
{ // poly is already moving
@@ -293,7 +296,7 @@ boolean EV_MovePoly(line_t * line, byte * args, boolean timesEight, boolean
SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE +
poly->seqType);
- while (mirror = GetPolyobjMirror(polyNum))
+ while ((mirror = GetPolyobjMirror(polyNum)) != 0)
{
poly = GetPolyobj(mirror);
if (poly && poly->specialdata && !overRide)
@@ -463,10 +466,11 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type)
int polyNum;
polydoor_t *pd;
polyobj_t *poly;
- angle_t an;
+ angle_t an = 0;
polyNum = args[0];
- if (poly = GetPolyobj(polyNum))
+ poly = GetPolyobj(polyNum);
+ if (poly != NULL)
{
if (poly->specialdata)
{ // poly is already moving
@@ -509,7 +513,7 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type)
poly->specialdata = pd;
- while (mirror = GetPolyobjMirror(polyNum))
+ while ((mirror = GetPolyobjMirror(polyNum)) != 0)
{
poly = GetPolyobj(mirror);
if (poly && poly->specialdata)
diff --git a/src/hexen/r_segs.c b/src/hexen/r_segs.c
index 1fb49199..ac7c1934 100644
--- a/src/hexen/r_segs.c
+++ b/src/hexen/r_segs.c
@@ -182,7 +182,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/sb_bar.c b/src/hexen/sb_bar.c
index 77f7bfad..fe74cf17 100644
--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -1978,8 +1978,6 @@ static void CheatWarpFunc(player_t * player, Cheat_t * cheat)
int ones;
int map;
char mapName[9];
- char auxName[128];
- FILE *fp;
tens = cheat->args[0] - '0';
ones = cheat->args[1] - '0';
diff --git a/src/hexen/sn_sonix.c b/src/hexen/sn_sonix.c
index 161bcc37..625176dd 100644
--- a/src/hexen/sn_sonix.c
+++ b/src/hexen/sn_sonix.c
@@ -183,8 +183,8 @@ void SN_InitSequenceScript(void)
{
int i, j;
int inSequence;
- int *tempDataStart;
- int *tempDataPtr;
+ int *tempDataStart = NULL;
+ int *tempDataPtr = NULL;
inSequence = -1;
ActiveSequences = 0;
diff --git a/src/hexen/sv_save.c b/src/hexen/sv_save.c
index e2fba15a..7a2134f7 100644
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -379,7 +379,7 @@ void SV_LoadGame(int slot)
SavePtr.b = SaveBuffer + HXS_DESCRIPTION_LENGTH;
// Check the version text
- if (strcmp(SavePtr.b, HXS_VERSION_TEXT))
+ if (strcmp((char *) SavePtr.b, HXS_VERSION_TEXT))
{ // Bad version
return;
}
@@ -475,8 +475,8 @@ void SV_MapTeleport(int map, int position)
boolean rClass;
boolean playerWasReborn;
boolean oldWeaponowned[NUMWEAPONS];
- int oldKeys;
- int oldPieces;
+ int oldKeys = 0;
+ int oldPieces = 0;
int bestWeapon;
if (!deathmatch)