Streamlined the minecart death handling

This commit is contained in:
MascaraSnake 2019-06-15 21:43:36 +02:00
parent 8e61cc6d13
commit 39deb64e4f
2 changed files with 3 additions and 3 deletions

View file

@ -2607,6 +2607,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
case MT_MINECART:
A_Scream(target);
target->momx = target->momy = target->momz = 0;
if (target->target && target->target->health)
P_KillMobj(target->target, target, source, 0);
break;
case MT_PLAYER:

View file

@ -10004,7 +10004,6 @@ static void P_MinecartThink(player_t *player)
fa = (minecart->angle >> ANGLETOFINESHIFT) & FINEMASK;
if (!P_TryMove(minecart, minecart->x + FINECOSINE(fa), minecart->y + FINESINE(fa), true))
{
P_KillMobj(player->mo, NULL, NULL, 0);
P_KillMobj(minecart, NULL, NULL, 0);
return;
}
@ -10041,7 +10040,7 @@ static void P_MinecartThink(player_t *player)
if (!axis)
{
P_KillMobj(player->mo, NULL, NULL, 0);
P_KillMobj(minecart, NULL, NULL, 0);
return;
}
@ -10152,7 +10151,6 @@ static void P_MinecartThink(player_t *player)
if ((P_IsObjectOnGround(minecart) && minecart->movefactor >= 5) // off rail
|| (abs(minecart->momx) < minecart->scale/2 && abs(minecart->momy) < minecart->scale/2)) // hit a wall
{
P_KillMobj(player->mo, NULL, NULL, 0);
P_KillMobj(minecart, NULL, NULL, 0);
return;
}