Gachabom Rebound: fix crash after owner object is removed

This commit is contained in:
James R 2024-01-12 02:05:45 -08:00
parent e26a95af6e
commit 69c3aaf4f2
2 changed files with 3 additions and 2 deletions

View file

@ -5601,7 +5601,7 @@ state_t states[NUMSTATES] =
{SPR_UFOS, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SPECIAL_UFO_STEM
{SPR_GBOM, FF_ANIMATE, -1, {NULL}, 3, 1, S_NULL}, // S_GACHABOM
{SPR_GBOM, FF_INVERT, 2, {NULL}, 0, 0, S_NULL}, // S_GACHABOM_DEAD
{SPR_GBOM, FF_INVERT, 175, {NULL}, 0, 0, S_NULL}, // S_GACHABOM_DEAD
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_GACHABOM_EXPLOSION_2},
{SPR_GCHX, 0|FF_PAPERSPRITE|FF_ANIMATE, 14, {NULL}, 6, 2, S_GACHABOM_EXPLOSION_3A}, // S_GACHABOM_EXPLOSION_2

View file

@ -284,12 +284,13 @@ boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
S_StartSound(t1, t1->info->deathsound);
P_KillMobj(t1, t2, t2, DMG_NORMAL);
if (t1->type == MT_GACHABOM)
if (t1->type == MT_GACHABOM && !P_MobjWasRemoved(orbinaut_owner(t1)))
{
// Instead of flying out at an angle when
// destroyed, spawn an explosion and eventually
// return to sender. The original Gachabom will be
// removed next tic (see deathstate).
t1->tics = 2;
Obj_SpawnGachaBomRebound(t1, orbinaut_owner(t1));
}
else