diff --git a/src/g_inventory/a_artifacts.cpp b/src/g_inventory/a_artifacts.cpp index 6ece99b38e..2f2cc3c0e2 100644 --- a/src/g_inventory/a_artifacts.cpp +++ b/src/g_inventory/a_artifacts.cpp @@ -167,7 +167,7 @@ void APowerup::Serialize(FSerializer &arc) PalEntry APowerup::GetBlend () { - if (EffectTics <= BLINKTHRESHOLD && !(EffectTics & 8)) + if (isBlinking()) return 0; if (IsSpecialColormap(BlendColor)) return 0; @@ -202,6 +202,22 @@ void APowerup::CallInitEffect() else InitEffect(); } +//=========================================================================== +// +// APowerup :: isBlinking +// +//=========================================================================== + +bool APowerup::isBlinking() const +{ + return (EffectTics <= BLINKTHRESHOLD && (EffectTics & 8) && !(ItemFlags & IF_NOSCREENBLINK)); +} + +DEFINE_ACTION_FUNCTION(APowerup, isBlinking) +{ + PARAM_SELF_PROLOGUE(APowerup); + ACTION_RETURN_BOOL(self->isBlinking()); +} //=========================================================================== // @@ -222,7 +238,7 @@ void APowerup::DoEffect () if (Colormap != NOFIXEDCOLORMAP) { - if (EffectTics > BLINKTHRESHOLD || (EffectTics & 8)) + if (!isBlinking()) { Owner->player->fixedcolormap = Colormap; } @@ -294,7 +310,7 @@ bool APowerup::DrawPowerup (int x, int y) { return false; } - if (EffectTics > BLINKTHRESHOLD || !(EffectTics & 16)) + if (!isBlinking()) { FTexture *pic = TexMan(Icon); screen->DrawTexture (pic, x, y, @@ -903,7 +919,7 @@ void APowerLightAmp::DoEffect () if (Owner->player != NULL && Owner->player->fixedcolormap < NUMCOLORMAPS) { - if (EffectTics > BLINKTHRESHOLD || (EffectTics & 8)) + if (!isBlinking()) { Owner->player->fixedlightlevel = 1; } diff --git a/src/g_inventory/a_artifacts.h b/src/g_inventory/a_artifacts.h index f8eec5554d..95182ce43b 100644 --- a/src/g_inventory/a_artifacts.h +++ b/src/g_inventory/a_artifacts.h @@ -30,6 +30,7 @@ public: virtual void InitEffect (); virtual void DoEffect () override; virtual void EndEffect (); + bool isBlinking() const; protected: void CallInitEffect(); diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index ea87cfe85b..eedadbdffe 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -46,6 +46,7 @@ enum IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper IF_NOTELEPORTFREEZE = 1<<25, // does not 'freeze' the player right after teleporting. + IF_NOSCREENBLINK = 1<<26, // Does not blink the screen overlay when expiring. }; diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 46485b2268..a1f2786da7 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -408,6 +408,7 @@ static FFlagDef InventoryFlagDefs[] = DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags), DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags), DEFINE_FLAG(IF, NOTELEPORTFREEZE, AInventory, ItemFlags), + DEFINE_FLAG(IF, NOSCREENBLINK, AInventory, ItemFlags), DEFINE_DUMMY_FLAG(FORCERESPAWNINSURVIVAL, false), diff --git a/wadsrc/static/zscript/shared/powerups.txt b/wadsrc/static/zscript/shared/powerups.txt index 549c3eece4..2842989f0c 100644 --- a/wadsrc/static/zscript/shared/powerups.txt +++ b/wadsrc/static/zscript/shared/powerups.txt @@ -28,6 +28,7 @@ class Powerup : Inventory native native virtual void InitEffect(); native virtual void EndEffect(); + native bool isBlinking(); }