ref: 7b348d34f239e5584ace5bd52f8ef66c87f60f61
parent: b37418d89a373dfc99437cbceff252e1aef12d82
parent: 1b06590a72efd79fce90d91adfa0694e31a7c3e5
author: Michael Francis <mikefrancis95@gmail.com>
date: Mon Dec 16 03:53:46 EST 2019
Merge pull request #1228 from mfrancis95/redundancyfixes Remove unnecessary checks in Hexen
--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -153,12 +153,9 @@
{
mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_POTTERYBIT1);
P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 5));
- if (mo)
- {
- mo->momz = ((P_Random() & 7) + 5) * (3 * FRACUNIT / 4);
- mo->momx = P_SubRandom() << (FRACBITS - 6);
- mo->momy = P_SubRandom() << (FRACBITS - 6);
- }
+ mo->momz = ((P_Random() & 7) + 5) * (3 * FRACUNIT / 4);
+ mo->momx = P_SubRandom() << (FRACBITS - 6);
+ mo->momy = P_SubRandom() << (FRACBITS - 6);
}
S_StartSound(mo, SFX_POTTERY_EXPLODE);
if (actor->args[0])
@@ -262,12 +259,9 @@
{
mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_CORPSEBIT);
P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 3));
- if (mo)
- {
- mo->momz = ((P_Random() & 7) + 5) * (3 * FRACUNIT / 4);
- mo->momx = P_SubRandom() << (FRACBITS - 6);
- mo->momy = P_SubRandom() << (FRACBITS - 6);
- }
+ mo->momz = ((P_Random() & 7) + 5) * (3 * FRACUNIT / 4);
+ mo->momx = P_SubRandom() << (FRACBITS - 6);
+ mo->momy = P_SubRandom() << (FRACBITS - 6);
}
// Spawn a skull
mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_CORPSEBIT);
@@ -1177,12 +1171,9 @@
actor->z + (r1 * actor->height / 256),
MT_ZARMORCHUNK);
P_SetMobjState(mo, mo->info->spawnstate + i);
- if (mo)
- {
- mo->momz = ((P_Random() & 7) + 5) * FRACUNIT;
- mo->momx = P_SubRandom() << (FRACBITS - 6);
- mo->momy = P_SubRandom() << (FRACBITS - 6);
- }
+ mo->momz = ((P_Random() & 7) + 5) * FRACUNIT;
+ mo->momx = P_SubRandom() << (FRACBITS - 6);
+ mo->momy = P_SubRandom() << (FRACBITS - 6);
}
if (actor->args[0])
{ // Spawn an item
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -4876,13 +4876,10 @@
actor->z + (r1 * actor->height / 255),
MT_ICECHUNK);
P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 3));
- if (mo)
- {
- mo->momz = FixedDiv(mo->z - actor->z, actor->height) << 2;
- mo->momx = P_SubRandom() << (FRACBITS - 7);
- mo->momy = P_SubRandom() << (FRACBITS - 7);
- A_IceSetTics(mo); // set a random tic wait
- }
+ mo->momz = FixedDiv(mo->z - actor->z, actor->height) << 2;
+ mo->momx = P_SubRandom() << (FRACBITS - 7);
+ mo->momy = P_SubRandom() << (FRACBITS - 7);
+ A_IceSetTics(mo); // set a random tic wait
}
for (i = 12 + (P_Random() & 15); i >= 0; i--)
{
@@ -4896,13 +4893,10 @@
actor->z + (r1 * actor->height / 255),
MT_ICECHUNK);
P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 3));
- if (mo)
- {
- mo->momz = FixedDiv(mo->z - actor->z, actor->height) << 2;
- mo->momx = P_SubRandom() << (FRACBITS - 7);
- mo->momy = P_SubRandom() << (FRACBITS - 7);
- A_IceSetTics(mo); // set a random tic wait
- }
+ mo->momz = FixedDiv(mo->z - actor->z, actor->height) << 2;
+ mo->momx = P_SubRandom() << (FRACBITS - 7);
+ mo->momy = P_SubRandom() << (FRACBITS - 7);
+ A_IceSetTics(mo); // set a random tic wait
}
if (actor->player)
{ // attach the player's view to a chunk of ice
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -2174,7 +2174,7 @@
{ // mobj is invulnerable
return;
}
- if (player && gameskill == sk_baby)
+ if (gameskill == sk_baby)
{
// Take half damage in trainer mode
damage >>= 1;
@@ -2203,7 +2203,7 @@
if (target->health <= 0)
{ // Death
target->special1.i = damage;
- if (player && inflictor && !player->morphTics)
+ if (inflictor && !player->morphTics)
{ // Check for flame death
if ((inflictor->flags2 & MF2_FIREDAMAGE)
&& (target->health > -50) && (damage > 25))