From 956b7d5ea338b0aa5aecb19cba639489b39d66e9 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 26 May 2009 01:16:39 +0000 Subject: [PATCH] - Added Skulltag's PowerDoubleFiringSpeed. SVN r1608 (trunk) --- docs/rh-log.txt | 2 +- src/g_shared/a_artifacts.cpp | 35 +++++++++++++++++++++++ src/g_shared/a_artifacts.h | 8 ++++++ src/p_pspr.cpp | 5 ++++ wadsrc/static/actors/shared/inventory.txt | 4 +++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 2b0c2a7de..a653179f7 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,5 +1,5 @@ May 25, 2009 -- Specifiying non-existant directories with -savedir or the save_dir cvar now +- Specifying non-existent directories with -savedir or the save_dir cvar now attempts to create them. - I_CheckNativeMouse() now checks the foreground window to determine if the mouse should be grabbed. This fixes the case where you start the game in diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index f72e6a478..5140d54aa 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1707,6 +1707,41 @@ void APowerHighJump::EndEffect( ) } } +// Double firing speed rune --------------------------------------------- + +IMPLEMENT_CLASS(APowerDoubleFiringSpeed) + +//=========================================================================== +// +// APowerDoubleFiringSpeed :: InitEffect +// +//=========================================================================== + +void APowerDoubleFiringSpeed::InitEffect( ) +{ + if (Owner== NULL || Owner->player == NULL) + return; + + // Give the player the power to shoot twice as fast. + Owner->player->cheats |= CF_DOUBLEFIRINGSPEED; +} + +//=========================================================================== +// +// APowerDoubleFiringSpeed :: EndEffect +// +//=========================================================================== + +void APowerDoubleFiringSpeed::EndEffect( ) +{ + // Nothing to do if there's no owner. + if (Owner != NULL && Owner->player != NULL) + { + // Take away the shooting twice as fast power. + Owner->player->cheats &= ~CF_DOUBLEFIRINGSPEED; + } +} + // Morph powerup ------------------------------------------------------ IMPLEMENT_CLASS(APowerMorph) diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 187ed0562..adbe991ab 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -245,6 +245,14 @@ protected: void EndEffect( ); }; +class APowerDoubleFiringSpeed : public APowerup +{ + DECLARE_CLASS( APowerDoubleFiringSpeed, APowerup ) +protected: + void InitEffect( ); + void EndEffect( ); +}; + class APowerMorph : public APowerup { DECLARE_CLASS( APowerMorph, APowerup ) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 70ee7bcb8..5ce3f17ff 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -772,6 +772,11 @@ void P_MovePsprites (player_t *player) if (psp->tics != -1) // a -1 tic count never changes { psp->tics--; + + // [BC] Apply double firing speed. + if ( psp->tics && ( player->cheats & CF_DOUBLEFIRINGSPEED )) + psp->tics--; + if(!psp->tics) { P_SetPsprite (player, i, psp->state->GetNextState()); diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 5db058b32..02fc66110 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -294,6 +294,10 @@ ACTOR PowerHighJump : Powerup native { } +ACTOR PowerDoubleFiringSpeed : Powerup native +{ +} + ACTOR PowerMorph : Powerup native { Powerup.Duration -40