Allow non-player objects to apply the CR_PLAYER carry type without crashing the game

This commit is contained in:
SMS Alfredo 2020-11-28 22:03:02 -06:00
parent 50e15840fb
commit 95dfb93a11

View file

@ -12580,13 +12580,16 @@ void P_PlayerAfterThink(player_t *player)
player->powers[pw_carry] = CR_NONE;
else
{
P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->player->drawangle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->player->drawangle, 4*FRACUNIT), true);
if (tails->player)
P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->player->drawangle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->player->drawangle, 4*FRACUNIT), true);
else
P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->angle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->angle, 4*FRACUNIT), true);
player->mo->momx = tails->momx;
player->mo->momy = tails->momy;
player->mo->momz = tails->momz;
}
if (G_CoopGametype() && (!tails->player || tails->player->bot != 1))
if (G_CoopGametype() && tails->player && tails->player->bot != 1)
{
player->mo->angle = tails->angle;
@ -12601,7 +12604,7 @@ void P_PlayerAfterThink(player_t *player)
{
if (player->mo->state-states != S_PLAY_RIDE)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
if ((tails->skin && ((skin_t *)(tails->skin))->sprites[SPR2_SWIM].numframes) && (tails->eflags & MFE_UNDERWATER))
if (tails->player && (tails->skin && ((skin_t *)(tails->skin))->sprites[SPR2_SWIM].numframes) && (tails->eflags & MFE_UNDERWATER))
tails->player->powers[pw_tailsfly] = 0;
}
else