- Added a PainThreshold actor property.

SVN r1900 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-08 17:43:50 +00:00
parent 3900381565
commit 0c2288a010
5 changed files with 56 additions and 34 deletions

View file

@ -1,4 +1,5 @@
October 8, 2009 (Changes by Graf Zahl) October 8, 2009 (Changes by Graf Zahl)
- Added a PainThreshold actor property.
- fixed: Teleport_EndGame did not set the end sequence name properly. - fixed: Teleport_EndGame did not set the end sequence name properly.
October 7, 2009 October 7, 2009

View file

@ -842,6 +842,7 @@ public:
fixed_t MaxDropOffHeight, MaxStepHeight; fixed_t MaxDropOffHeight, MaxStepHeight;
SDWORD Mass; SDWORD Mass;
SWORD PainChance; SWORD PainChance;
int PainThreshold;
FNameNoInit DamageType; FNameNoInit DamageType;
FState *SpawnState; FState *SpawnState;

View file

@ -1268,6 +1268,11 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
} }
} }
if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) &&
!G_SkillProperty(SKILLP_NoPain) && !(target->flags & MF_SKULLFLY))
{
pc = target->GetClass()->ActorInfo->PainChances; pc = target->GetClass()->ActorInfo->PainChances;
painchance = target->PainChance; painchance = target->PainChance;
if (pc != NULL) if (pc != NULL)
@ -1279,11 +1284,10 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
} }
} }
dopain: if ((damage > target->PainThreshold && pr_damagemobj() < painchance) ||
if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) && (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN)))
!G_SkillProperty(SKILLP_NoPain) && (pr_damagemobj() < painchance ||
(inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) && !(target->flags & MF_SKULLFLY))
{ {
dopain:
if (mod == NAME_Electric) if (mod == NAME_Electric)
{ {
if (pr_lightning() < 96) if (pr_lightning() < 96)
@ -1315,6 +1319,7 @@ dopain:
} }
} }
} }
}
target->reactiontime = 0; // we're awake now... target->reactiontime = 0; // we're awake now...
if (source) if (source)
{ {

View file

@ -301,6 +301,11 @@ void AActor::Serialize (FArchive &arc)
<< Score << Score
<< Tag; << Tag;
if (SaveVersion >= 1900)
{
arc << PainThreshold;
}
for(int i=0; i<10; i++) arc << uservar[i]; for(int i=0; i<10; i++) arc << uservar[i];
if (arc.IsStoring ()) if (arc.IsStoring ())

View file

@ -363,6 +363,16 @@ DEFINE_PROPERTY(painchance, ZI, Actor)
} }
} }
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(painthreshold, I, Actor)
{
PROP_INT_PARM(id, 0);
defaults->PainThreshold = id;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================