- 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
parent 1ac8f8b348
commit da08b14895
4 changed files with 12 additions and 36 deletions

View file

@ -193,7 +193,6 @@ typedef enum
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
CF_WEAPONREADY = 1 << 14, // [RH] Weapon is in the ready state and can fire its primary attack
CF_DRAIN = 1 << 16, // Player owns a drain powerup
CF_REGENERATION = 1 << 17, // Player owns a regeneration artifact
CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;)
CF_REFLECTION = 1 << 19,
CF_PROSPERITY = 1 << 20,

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;
if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0)
{
if (P_GiveBody(Owner, 5))
{
S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM );
}
//===========================================================================
//
// ARuneRegeneration :: EndEffect
//
//===========================================================================
void APowerRegeneration::EndEffect( )
{
Super::EndEffect();
// Nothing to do if there's no owner.
if (Owner != NULL && Owner->player != NULL)
{
// Take away the regeneration power.
Owner->player->cheats &= ~CF_REGENERATION;
}
}

View file

@ -214,8 +214,7 @@ class APowerRegeneration : public APowerup
{
DECLARE_CLASS( APowerRegeneration, APowerup )
protected:
void InitEffect( );
void EndEffect( );
void DoEffect();
};
class APowerHighJump : public APowerup

View file

@ -2446,15 +2446,6 @@ void P_PlayerThink (player_t *player)
P_PoisonDamage (player, player->poisoner, 1, true);
}
// [BC] Apply regeneration.
if (( level.time & 31 ) == 0 && ( player->cheats & CF_REGENERATION ) && ( player->health ))
{
if ( P_GiveBody( player->mo, 5 ))
{
S_Sound(player->mo, CHAN_ITEM, "*regenerate", 1, ATTN_NORM );
}
}
// Apply degeneration.
if (dmflags2 & DF2_YES_DEGENERATION)
{
@ -2702,6 +2693,10 @@ void player_t::Serialize (FArchive &arc)
{
cheats &= ~(1 << 15); // make sure old CF_TIMEFREEZE bit is cleared
}
if (SaveVersion < 3640)
{
cheats &= ~(1 << 17); // make sure old CF_REGENERATION bit is cleared
}
if (isbot)
{