Merge branch 'CR_BRUH' into 'next'

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

See merge request STJr/SRB2!1274
This commit is contained in:
James R 2020-12-10 15:20:11 -05:00
commit ef6f69ee22
1 changed files with 6 additions and 3 deletions

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