mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- Adjusted AlterWeaponSprite so that it properly handles multiple
invisibility powerups at the same time. SVN r450 (trunk)
This commit is contained in:
parent
14ecb21dee
commit
554573bcb3
6 changed files with 90 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
|||
January 13, 2007 (Changes by Graf Zahl)
|
||||
- Adjusted AlterWeaponSprite so that it properly handles multiple
|
||||
invisibility powerups at the same time.
|
||||
|
||||
January 13, 2007
|
||||
- Integrated the fatal error display into the text logger.
|
||||
Next: Figure out how to do all this fancy new startup window stuff with GTK+
|
||||
|
|
|
@ -454,8 +454,9 @@ void APowerInvulnerable::EndEffect ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis)
|
||||
int APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis)
|
||||
{
|
||||
int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis);
|
||||
if (Owner != NULL)
|
||||
{
|
||||
if (mode == NAME_Ghost && !(Owner->flags & MF_SHADOW))
|
||||
|
@ -464,6 +465,7 @@ void APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis)
|
|||
if (wp_alpha != FIXED_MAX) vis->alpha = wp_alpha;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
// Strength (aka Berserk) Powerup --------------------------------------------
|
||||
|
@ -574,6 +576,19 @@ void APowerInvisibility::EndEffect ()
|
|||
Owner->flags3 &= ~MF3_GHOST;
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
|
||||
// Check whether there are other invisibility items and refresh their effect.
|
||||
// If this isn't done there will be one incorrectly drawn frame when this
|
||||
// item expires.
|
||||
AInventory *item = Owner->Inventory;
|
||||
while (item != NULL)
|
||||
{
|
||||
if (item->IsKindOf(RUNTIME_CLASS(APowerInvisibility)) && item != this)
|
||||
{
|
||||
static_cast<APowerInvisibility*>(item)->InitEffect();
|
||||
}
|
||||
item = item->Inventory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,18 +598,23 @@ void APowerInvisibility::EndEffect ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerInvisibility::AlterWeaponSprite (vissprite_t *vis)
|
||||
int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis)
|
||||
{
|
||||
if (Inventory != NULL)
|
||||
{
|
||||
Inventory->AlterWeaponSprite (vis);
|
||||
}
|
||||
int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis);
|
||||
|
||||
// Blink if the powerup is wearing off
|
||||
if (EffectTics < 4*32 && !(EffectTics & 8))
|
||||
if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8))
|
||||
{
|
||||
vis->RenderStyle = STYLE_Normal;
|
||||
return 1;
|
||||
}
|
||||
else if (changed == 1)
|
||||
{
|
||||
// something else set the weapon sprite back to opaque but this item is still active.
|
||||
vis->alpha = FRACUNIT/5;
|
||||
vis->RenderStyle = STYLE_OptFuzzy;
|
||||
}
|
||||
return -1; // This item is valid so another one shouldn't reset the translucency
|
||||
}
|
||||
|
||||
// Ghost Powerup (Heretic's version of invisibility) -------------------------
|
||||
|
@ -617,6 +637,31 @@ void APowerGhost::InitEffect ()
|
|||
Owner->RenderStyle = STYLE_Translucent;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerGhost :: AlterWeaponSprite
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int APowerGhost::AlterWeaponSprite (vissprite_t *vis)
|
||||
{
|
||||
int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis);
|
||||
|
||||
// Blink if the powerup is wearing off
|
||||
if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8))
|
||||
{
|
||||
vis->RenderStyle = STYLE_Normal;
|
||||
return 1;
|
||||
}
|
||||
else if (changed == 1)
|
||||
{
|
||||
// something else set the weapon sprite back to opaque but this item is still active.
|
||||
vis->alpha = HR_SHADOW;
|
||||
vis->RenderStyle = STYLE_Translucent;
|
||||
}
|
||||
return -1; // This item is valid so another one shouldn't reset the translucency
|
||||
}
|
||||
|
||||
// Shadow Powerup (Strife's version of invisibility) -------------------------
|
||||
|
||||
IMPLEMENT_STATELESS_ACTOR (APowerShadow, Any, -1, 0)
|
||||
|
@ -637,6 +682,31 @@ void APowerShadow::InitEffect ()
|
|||
Owner->RenderStyle = STYLE_Translucent;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerShadow :: AlterWeaponSprite
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int APowerShadow::AlterWeaponSprite (vissprite_t *vis)
|
||||
{
|
||||
int changed = Inventory == NULL? false : Inventory->AlterWeaponSprite(vis);
|
||||
|
||||
// Blink if the powerup is wearing off
|
||||
if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8))
|
||||
{
|
||||
vis->RenderStyle = STYLE_Normal;
|
||||
return 1;
|
||||
}
|
||||
else if (changed == 1)
|
||||
{
|
||||
// something else set the weapon sprite back to opaque but this item is still active.
|
||||
vis->alpha = TRANSLUC25;
|
||||
vis->RenderStyle = STYLE_Translucent;
|
||||
}
|
||||
return -1; // This item is valid so another one shouldn't reset the translucency
|
||||
}
|
||||
|
||||
// Ironfeet Powerup ----------------------------------------------------------
|
||||
|
||||
IMPLEMENT_STATELESS_ACTOR (APowerIronFeet, Any, -1, 0)
|
||||
|
|
|
@ -69,7 +69,7 @@ protected:
|
|||
void InitEffect ();
|
||||
void DoEffect ();
|
||||
void EndEffect ();
|
||||
void AlterWeaponSprite (vissprite_t *vis);
|
||||
int AlterWeaponSprite (vissprite_t *vis);
|
||||
};
|
||||
|
||||
class APowerStrength : public APowerup
|
||||
|
@ -90,7 +90,7 @@ protected:
|
|||
void InitEffect ();
|
||||
void DoEffect ();
|
||||
void EndEffect ();
|
||||
void AlterWeaponSprite (vissprite_t *vis);
|
||||
int AlterWeaponSprite (vissprite_t *vis);
|
||||
};
|
||||
|
||||
class APowerGhost : public APowerInvisibility
|
||||
|
@ -98,6 +98,7 @@ class APowerGhost : public APowerInvisibility
|
|||
DECLARE_STATELESS_ACTOR (APowerGhost, APowerInvisibility)
|
||||
protected:
|
||||
void InitEffect ();
|
||||
int AlterWeaponSprite (vissprite_t *vis);
|
||||
};
|
||||
|
||||
class APowerShadow : public APowerInvisibility
|
||||
|
@ -105,6 +106,7 @@ class APowerShadow : public APowerInvisibility
|
|||
DECLARE_STATELESS_ACTOR (APowerShadow, APowerInvisibility)
|
||||
protected:
|
||||
void InitEffect ();
|
||||
int AlterWeaponSprite (vissprite_t *vis);
|
||||
};
|
||||
|
||||
class APowerIronFeet : public APowerup
|
||||
|
|
|
@ -768,12 +768,13 @@ void AInventory::AbsorbDamage (int damage, FName damageType, int &newdamage)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void AInventory::AlterWeaponSprite (vissprite_t *vis)
|
||||
int AInventory::AlterWeaponSprite (vissprite_t *vis)
|
||||
{
|
||||
if (Inventory != NULL)
|
||||
{
|
||||
Inventory->AlterWeaponSprite (vis);
|
||||
return Inventory->AlterWeaponSprite (vis);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
virtual void OwnerDied ();
|
||||
|
||||
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
||||
virtual void AlterWeaponSprite (vissprite_t *vis);
|
||||
virtual int AlterWeaponSprite (vissprite_t *vis);
|
||||
|
||||
virtual PalEntry GetBlend ();
|
||||
|
||||
|
|
|
@ -2619,7 +2619,7 @@ static void ActorMass (AActor *defaults, Baggage &bag)
|
|||
static void ActorXScale (AActor *defaults, Baggage &bag)
|
||||
{
|
||||
SC_MustGetFloat();
|
||||
defaults->scaleY = FLOAT2FIXED(sc_Float);
|
||||
defaults->scaleX = FLOAT2FIXED(sc_Float);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue