From 1a72c5f7b9cd767c908e79842caf72bd2993234a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 8 Mar 2007 23:34:54 +0000 Subject: [PATCH] - Fixed: In Strife, using the shadow armor a second time while it is still active should make you completely invisible and your first-person weapon inverse grayscale. SVN r499 (trunk) --- docs/rh-log.txt | 5 ++++ src/g_shared/a_artifacts.cpp | 49 ++++++++++++++++++++++++++++++++---- src/g_shared/a_artifacts.h | 1 + 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c936c303f..22c1c9660 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +March 8, 2007 +- Fixed: In Strife, using the shadow armor a second time while it is still + active should make you completely invisible and your first-person weapon + inverse grayscale. + March 7, 2007 - Changed P_SpawnPlayerMissile() to use the same height calculation as P_(Aim)LineAttack(). diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index a921dece9..28ea3a76a 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -456,7 +456,7 @@ void APowerInvulnerable::EndEffect () int APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis) { - int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis); + int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); if (Owner != NULL) { if (mode == NAME_Ghost && !(Owner->flags & MF_SHADOW)) @@ -600,7 +600,7 @@ void APowerInvisibility::EndEffect () int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis) { - int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis); + int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); // Blink if the powerup is wearing off if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8)) @@ -645,7 +645,7 @@ void APowerGhost::InitEffect () int APowerGhost::AlterWeaponSprite (vissprite_t *vis) { - int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis); + int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); // Blink if the powerup is wearing off if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8)) @@ -669,6 +669,40 @@ IMPLEMENT_STATELESS_ACTOR (APowerShadow, Any, -1, 0) PROP_Inventory_FlagsSet (IF_HUBPOWER) END_DEFAULTS +//=========================================================================== +// +// APowerShadow :: HandlePickup +// +// If the player already has the first stage of the powerup, getting it +// again makes them completely invisible. Special1 tracks which stage we +// are in, initially 0. +// +//=========================================================================== + +bool APowerShadow::HandlePickup (AInventory *item) +{ + if (special1 == 0 && item->GetClass() == GetClass()) + { + APowerup *power = static_cast(item); + if (power->EffectTics == 0) + { + power->ItemFlags |= IF_PICKUPGOOD; + return true; + } + // Only increase the EffectTics, not decrease it. + // Color also gets transferred only when the new item has an effect. + if (power->EffectTics > EffectTics) + { + EffectTics = power->EffectTics; + BlendColor = power->BlendColor; + } + special1 = 1; // Go to stage 2. + power->ItemFlags |= IF_PICKUPGOOD; + return true; + } + return Super::HandlePickup (item); +} + //=========================================================================== // // APowerShadow :: InitEffect @@ -678,7 +712,7 @@ END_DEFAULTS void APowerShadow::InitEffect () { Owner->flags |= MF_SHADOW; - Owner->alpha = TRANSLUC25; + Owner->alpha = special1 == 0 ? TRANSLUC25 : 0; Owner->RenderStyle = STYLE_Translucent; } @@ -690,7 +724,7 @@ void APowerShadow::InitEffect () int APowerShadow::AlterWeaponSprite (vissprite_t *vis) { - int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis); + int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); // Blink if the powerup is wearing off if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8)) @@ -704,6 +738,11 @@ int APowerShadow::AlterWeaponSprite (vissprite_t *vis) vis->alpha = TRANSLUC25; vis->RenderStyle = STYLE_Translucent; } + if (special1 == 1) + { + vis->alpha = TRANSLUC25; + vis->colormap = InverseColormap; + } return -1; // This item is valid so another one shouldn't reset the translucency } diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 734d1be7a..151b228cb 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -105,6 +105,7 @@ class APowerShadow : public APowerInvisibility { DECLARE_STATELESS_ACTOR (APowerShadow, APowerInvisibility) protected: + bool HandlePickup (AInventory *item); void InitEffect (); int AlterWeaponSprite (vissprite_t *vis); };