Readability changes

This commit is contained in:
lachwright 2019-10-07 13:35:10 +08:00
parent 7c50193dcb
commit 4b96eeb578

View file

@ -963,41 +963,27 @@ static boolean PIT_CheckThing(mobj_t *thing)
P_DamageMobj(thing, tmthing, tmthing, 1, 0); P_DamageMobj(thing, tmthing, tmthing, 1, 0);
} }
if (thing->type == MT_ROLLOUTROCK) if (thing->type == MT_ROLLOUTROCK && tmthing->player)
{ {
if (tmthing->player) if (tmthing->player->powers[pw_carry] == CR_ROLLOUT)
{ {
if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) return true;
{
return true;
}
if ((thing->flags & MF_PUSHABLE) // not carrying a player
&& ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP))
&& (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius))
&& (P_MobjFlip(tmthing)*tmthing->momz <= 0)
&& ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2))
|| (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2))))
{
thing->flags &= ~MF_PUSHABLE;
P_SetTarget(&thing->target, tmthing);
P_ResetPlayer(tmthing->player);
P_SetPlayerMobjState(tmthing, S_PLAY_WALK);
tmthing->player->powers[pw_carry] = CR_ROLLOUT;
P_SetTarget(&tmthing->tracer, thing);
P_SetObjectMomZ(thing, tmthing->momz, true);
return true;
}
} }
else if (tmthing->type == thing->type) if ((thing->flags & MF_PUSHABLE) // not carrying a player
&& ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP))
&& (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius))
&& (P_MobjFlip(tmthing)*tmthing->momz <= 0)
&& ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2))
|| (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2))))
{ {
if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height) thing->flags &= ~MF_PUSHABLE;
return true; P_SetTarget(&thing->target, tmthing);
P_ResetPlayer(tmthing->player);
fixed_t tempmomx = thing->momx, tempmomy = thing->momy; P_SetPlayerMobjState(tmthing, S_PLAY_WALK);
thing->momx = tmthing->momx; tmthing->player->powers[pw_carry] = CR_ROLLOUT;
thing->momy = tmthing->momy; P_SetTarget(&tmthing->tracer, thing);
tmthing->momx = tempmomx; P_SetObjectMomZ(thing, tmthing->momz, true);
tmthing->momy = tempmomy; return true;
} }
} }
else if (tmthing->type == MT_ROLLOUTROCK) else if (tmthing->type == MT_ROLLOUTROCK)
@ -1008,6 +994,15 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing == tmthing->target) if (thing == tmthing->target)
return true; return true;
if (thing->type == tmthing->type)
{
fixed_t tempmomx = thing->momx, tempmomy = thing->momy;
thing->momx = tmthing->momx;
thing->momy = tmthing->momy;
tmthing->momx = tempmomx;
tmthing->momy = tempmomy;
}
if (thing->flags & MF_SPRING) if (thing->flags & MF_SPRING)
{ {
P_DoSpring(thing, tmthing); P_DoSpring(thing, tmthing);