Ironman: visibility/hyudoro behavior cleanup

This commit is contained in:
AJ Martinez 2022-11-03 15:44:49 -07:00
parent 7c839e841a
commit 1410b6c0e0
2 changed files with 26 additions and 10 deletions

View file

@ -7636,11 +7636,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
else
mobj->renderflags &= ~RF_DONTDRAW;
}
else if (mobj->extravalue2 == TICRATE/3 && mobj->target)
else if (mobj->extravalue2 == TICRATE/3 && !P_MobjWasRemoved(mobj->target))
{
mobj->target->renderflags &= ~RF_DONTDRAW;
mobj->momx = mobj->target->momx;
mobj->momy = mobj->target->momy;
mobj->momz = mobj->target->momz;
@ -7659,15 +7656,29 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
S_StartSound(mobj, sfx_kc2e);
S_StartSound(mobj, sfx_s3k9f);
K_SpawnMagicianParticles(mobj, 5);
if (mobj->target->player->hyudorotimer)
{
P_RemoveMobj(mobj);
break;
}
else
{
K_SpawnMagicianParticles(mobj, 5);
}
return true;
}
else
else if (mobj->target && !P_MobjWasRemoved(mobj->target))
{
mobj->target->renderflags |= RF_DONTDRAW;
mobj->renderflags &= ~RF_DONTDRAW;
mobj->renderflags |= (mobj->target->renderflags & RF_DONTDRAW);
// NB: This depends on order of thinker execution!
// SetRandomFakePlayerSkin (r_skins.c) sets cusval on the bottom (last) side (i=5).
// This writes to the player's visibility only after every other side has ticked and inherited it.
if (mobj->cusval)
mobj->target->renderflags |= RF_DONTDRAW;
}
if (!mobj->target || !mobj->target->health || !mobj->target->player) {
if (P_MobjWasRemoved(mobj->target) || !mobj->target->health || !mobj->target->player) {
mobj->extravalue2 = min(mobj->extravalue2, TICRATE/3);
return true;
}

View file

@ -382,8 +382,13 @@ void SetRandomFakePlayerSkin(player_t* player, boolean fast)
box->extravalue1 = 1;
box->extravalue2 = 3*TICRATE/2;
}
if (j == 0)
box->cusval = 1; // Should play sounds when disappearing
// cusval controls behavior that should run only once, like disappear FX and RF_DONTDRAW handling.
// NB: Order of thinker execution matters here!
// We want the other sides to inherit the player's "existing" RF_DONTDRAW before the last side writes to it.
// See the MT_MAGICIANBOX thinker in p_mobj.c.
if (j == 5)
box->cusval = 1;
else
box->cusval = 0;