Fix use-after-free when Metal Sonic charges energy balls

This commit is contained in:
Gustaf Alhäll 2023-04-07 14:49:31 +02:00
parent 3c81938496
commit 8218ce0fe2
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD

View file

@ -5665,8 +5665,11 @@ static void P_Boss9Thinker(mobj_t *mobj)
missile->fuse = 1;
if (missile->fuse > mobj->fuse)
{
P_RemoveMobj(missile);
}
else
{
if (mobj->health > mobj->info->damage)
{
P_SetScale(missile, FRACUNIT/3);
@ -5681,6 +5684,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
missile->scalespeed = abs(missile->scale - missile->destscale)/missile->fuse;
missile->colorized = true;
}
}
// ...then down. easier than changing the missile's momz after-the-fact
mobj->z -= mobj->height/2;