- Fixed: Pain flashes were not inheritable.

SVN r3779 (trunk)
This commit is contained in:
Randy Heit 2012-07-21 02:58:52 +00:00
parent 5c7e04c539
commit d2843c199e
3 changed files with 28 additions and 8 deletions

View file

@ -329,6 +329,32 @@ void FActorInfo::SetPainFlash(FName type, PalEntry color)
// //
//========================================================================== //==========================================================================
bool FActorInfo::GetPainFlash(FName type, PalEntry *color) const
{
const FActorInfo *info = this;
while (info != NULL)
{
if (info->PainFlashes != NULL)
{
PalEntry *flash = info->PainFlashes->CheckKey(type);
if (flash != NULL)
{
*color = *flash;
return true;
}
}
// Try parent class
info = info->Class->ParentClass->ActorInfo;
}
return false;
}
//==========================================================================
//
//
//==========================================================================
void FActorInfo::SetColorSet(int index, const FPlayerColorSet *set) void FActorInfo::SetColorSet(int index, const FPlayerColorSet *set)
{ {
if (set != NULL) if (set != NULL)

View file

@ -224,6 +224,7 @@ struct FActorInfo
void SetDamageFactor(FName type, fixed_t factor); void SetDamageFactor(FName type, fixed_t factor);
void SetPainChance(FName type, int chance); void SetPainChance(FName type, int chance);
void SetPainFlash(FName type, PalEntry color); void SetPainFlash(FName type, PalEntry color);
bool GetPainFlash(FName type, PalEntry *color) const;
void SetColorSet(int index, const FPlayerColorSet *set); void SetColorSet(int index, const FPlayerColorSet *set);
FState *FindState (int numnames, FName *names, bool exact=false) const; FState *FindState (int numnames, FName *names, bool exact=false) const;

View file

@ -120,15 +120,8 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
BPART(gameinfo.pickupcolor)/255.f, cnt > 128 ? 0.5f : cnt / 255.f, blend); BPART(gameinfo.pickupcolor)/255.f, cnt > 128 ? 0.5f : cnt / 255.f, blend);
} }
PainFlashList * pfl = CPlayer->mo->GetClass()->ActorInfo->PainFlashes;
PalEntry painFlash = CPlayer->mo->DamageFade; PalEntry painFlash = CPlayer->mo->DamageFade;
CPlayer->mo->GetClass()->ActorInfo->GetPainFlash(CPlayer->mo->DamageTypeReceived, &painFlash);
if (pfl)
{
PalEntry * color = pfl->CheckKey(CPlayer->mo->DamageTypeReceived);
if (color) painFlash = *color;
}
if (painFlash.a != 0) if (painFlash.a != 0)
{ {