Add some P_MobjWasRemoved checks around code that shrink touches

It's the only place in the vanilla game where K_DropItems
is called that isn't from a direct collision with the player
it's being called on. It's also a syncfail that doesn't happen
anywhere else, and I saw my sync state appear to get slightly
corrupted when it happened. Let's see if this fixes anything...
This commit is contained in:
fickleheart 2019-02-17 22:09:37 -06:00
parent 32d1f75199
commit 6f3b10313f
1 changed files with 21 additions and 13 deletions

View File

@ -1978,12 +1978,16 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
static void K_RemoveGrowShrink(player_t *player)
{
player->kartstuff[k_growshrinktimer] = 0;
if (player->kartstuff[k_invincibilitytimer] == 0)
player->mo->color = player->skincolor;
player->mo->scalespeed = mapobjectscale/TICRATE;
player->mo->destscale = mapobjectscale;
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
if (!P_MobjWasRemoved(player->mo))
{
if (player->kartstuff[k_invincibilitytimer] == 0)
player->mo->color = player->skincolor;
player->mo->scalespeed = mapobjectscale/TICRATE;
player->mo->destscale = mapobjectscale;
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
}
P_RestoreMusic(player);
}
@ -3290,11 +3294,15 @@ static void K_DoShrink(player_t *user)
{
// Start shrinking!
K_DropItems(&players[i]);
players[i].mo->scalespeed = mapobjectscale/TICRATE;
players[i].mo->destscale = (6*mapobjectscale)/8;
if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot)
players[i].mo->destscale = (6*players[i].mo->destscale)/8;
players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position])));
if (!P_MobjWasRemoved(players[i].mo))
{
players[i].mo->scalespeed = mapobjectscale/TICRATE;
players[i].mo->destscale = (6*mapobjectscale)/8;
if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot)
players[i].mo->destscale = (6*players[i].mo->destscale)/8;
players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position])));
}
}
// Grow should get taken away.
@ -3419,7 +3427,7 @@ void K_DropHnextList(player_t *player)
mobjtype_t type;
boolean orbit, ponground, dropall = true;
if (!work)
if (!work || P_MobjWasRemoved(work))
return;
flip = P_MobjFlip(player->mo);
@ -3556,7 +3564,7 @@ void K_DropItems(player_t *player)
K_DropHnextList(player);
if (player->mo && player->kartstuff[k_itemamount])
if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount])
{
mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM);
P_SetScale(drop, drop->scale>>4);