- Added an optional parameter to DamageScreenColor to scale the amount of damage for pain

flash calculations. This can range from 0.0 to 1.0.

SVN r2435 (trunk)
This commit is contained in:
Randy Heit 2010-07-16 03:46:20 +00:00
parent c29639426f
commit 5b63fd0675
3 changed files with 24 additions and 8 deletions

View File

@ -1507,16 +1507,19 @@ void DBaseStatusBar::BlendView (float blend[4])
AddBlend (0.8431f, 0.7333f, 0.2706f, cnt > 128 ? 0.5f : cnt / 255.f, blend);
}
cnt = DamageToAlpha[MIN (113, CPlayer->damagecount)];
if (CPlayer->mo->DamageFade.a != 0)
{
cnt = DamageToAlpha[MIN (113, CPlayer->damagecount * CPlayer->mo->DamageFade.a / 255)];
if (cnt)
{
if (cnt > 228)
cnt = 228;
APlayerPawn *mo = players[consoleplayer].mo;
APlayerPawn *mo = CPlayer->mo;
AddBlend (mo->DamageFade.r / 255.f, mo->DamageFade.g / 255.f, mo->DamageFade.b / 255.f, cnt / 255.f, blend);
}
}
// Unlike Doom, I did not have any utility source to look at to find the
// exact numbers to use here, so I've had to guess by looking at how they

View File

@ -426,6 +426,10 @@ void APlayerPawn::Serialize (FArchive &arc)
<< MorphWeapon
<< DamageFade
<< PlayerFlags;
if (SaveVersion < 2435)
{
DamageFade.a = 255;
}
}
//===========================================================================

View File

@ -2094,10 +2094,19 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, crouchsprite, S, PlayerPawn)
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(player, damagescreencolor, C, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, damagescreencolor, Cf, PlayerPawn)
{
PROP_COLOR_PARM(c, 0);
defaults->DamageFade = c;
if (PROP_PARM_COUNT < 3) // Because colors count as 2 parms
{
defaults->DamageFade.a = 255;
}
else
{
PROP_FLOAT_PARM(a, 2);
defaults->DamageFade.a = BYTE(255 * clamp(a, 0.f, 1.f));
}
}
//==========================================================================