- added IF_NOSCREENBLINK flag, see http://mantis.zdoom.org/view.php?id=9

This commit is contained in:
Christoph Oelckers 2017-01-10 19:57:51 +01:00
parent d9efeb206d
commit 3696d34806
5 changed files with 24 additions and 4 deletions

View file

@ -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;
}

View file

@ -30,6 +30,7 @@ public:
virtual void InitEffect ();
virtual void DoEffect () override;
virtual void EndEffect ();
bool isBlinking() const;
protected:
void CallInitEffect();

View file

@ -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.
};

View file

@ -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),

View file

@ -28,6 +28,7 @@ class Powerup : Inventory native
native virtual void InitEffect();
native virtual void EndEffect();
native bool isBlinking();
}