From da08b148957238d7c264c4e09b60e31dd5266d4a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 11 May 2012 04:05:55 +0000 Subject: [PATCH] - Moved the regeneration powerup's effect out of P_PlayerThink() and into APowerRegeneration::DoEffect(). SVN r3640 (trunk) --- src/d_player.h | 1 - src/g_shared/a_artifacts.cpp | 31 +++++++------------------------ src/g_shared/a_artifacts.h | 3 +-- src/p_user.cpp | 13 ++++--------- 4 files changed, 12 insertions(+), 36 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index fc30df8d1..d0d01aa66 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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, diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 0d65bfe44..114c4832d 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -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 ); + } } } diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 9987877b0..f8a806956 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -214,8 +214,7 @@ class APowerRegeneration : public APowerup { DECLARE_CLASS( APowerRegeneration, APowerup ) protected: - void InitEffect( ); - void EndEffect( ); + void DoEffect(); }; class APowerHighJump : public APowerup diff --git a/src/p_user.cpp b/src/p_user.cpp index 1c99dbf2b..880a96399 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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) {