- Moved the regeneration powerup's effect out of P_PlayerThink() and into APowerRegeneration::DoEffect().

SVN r3640 (trunk)
This commit is contained in:
Randy Heit 2012-05-11 04:05:55 +00:00
commit da08b14895
4 changed files with 12 additions and 36 deletions

View file

@ -1658,35 +1658,18 @@ IMPLEMENT_CLASS(APowerRegeneration)
//===========================================================================
//
// ARuneRegeneration :: InitEffect
// APowerRegeneration :: DoEffect
//
//===========================================================================
void APowerRegeneration::InitEffect( )
void APowerRegeneration::DoEffect()
{
Super::InitEffect();
if (Owner== NULL || Owner->player == NULL)
return;
// Give the player the power to regnerate lost life.
Owner->player->cheats |= CF_REGENERATION;
}
//===========================================================================
//
// ARuneRegeneration :: EndEffect
//
//===========================================================================
void APowerRegeneration::EndEffect( )
{
Super::EndEffect();
// Nothing to do if there's no owner.
if (Owner != NULL && Owner->player != NULL)
if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0)
{
// Take away the regeneration power.
Owner->player->cheats &= ~CF_REGENERATION;
if (P_GiveBody(Owner, 5))
{
S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM );
}
}
}