mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 06:42:08 +00:00
- Added a PainThreshold actor property.
SVN r1900 (trunk)
This commit is contained in:
parent
3900381565
commit
0c2288a010
5 changed files with 56 additions and 34 deletions
|
@ -1,4 +1,5 @@
|
|||
October 8, 2009 (Changes by Graf Zahl)
|
||||
- Added a PainThreshold actor property.
|
||||
- fixed: Teleport_EndGame did not set the end sequence name properly.
|
||||
|
||||
October 7, 2009
|
||||
|
|
|
@ -842,6 +842,7 @@ public:
|
|||
fixed_t MaxDropOffHeight, MaxStepHeight;
|
||||
SDWORD Mass;
|
||||
SWORD PainChance;
|
||||
int PainThreshold;
|
||||
FNameNoInit DamageType;
|
||||
|
||||
FState *SpawnState;
|
||||
|
|
|
@ -1268,49 +1268,54 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
|
|||
}
|
||||
}
|
||||
|
||||
pc = target->GetClass()->ActorInfo->PainChances;
|
||||
painchance = target->PainChance;
|
||||
if (pc != NULL)
|
||||
{
|
||||
BYTE * ppc = pc->CheckKey(mod);
|
||||
if (ppc != NULL)
|
||||
{
|
||||
painchance = *ppc;
|
||||
}
|
||||
}
|
||||
|
||||
dopain:
|
||||
if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) &&
|
||||
!G_SkillProperty(SKILLP_NoPain) && (pr_damagemobj() < painchance ||
|
||||
(inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) && !(target->flags & MF_SKULLFLY))
|
||||
!G_SkillProperty(SKILLP_NoPain) && !(target->flags & MF_SKULLFLY))
|
||||
{
|
||||
if (mod == NAME_Electric)
|
||||
|
||||
pc = target->GetClass()->ActorInfo->PainChances;
|
||||
painchance = target->PainChance;
|
||||
if (pc != NULL)
|
||||
{
|
||||
if (pr_lightning() < 96)
|
||||
BYTE * ppc = pc->CheckKey(mod);
|
||||
if (ppc != NULL)
|
||||
{
|
||||
painchance = *ppc;
|
||||
}
|
||||
}
|
||||
|
||||
if ((damage > target->PainThreshold && pr_damagemobj() < painchance) ||
|
||||
(inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN)))
|
||||
{
|
||||
dopain:
|
||||
if (mod == NAME_Electric)
|
||||
{
|
||||
if (pr_lightning() < 96)
|
||||
{
|
||||
justhit = true;
|
||||
FState * painstate = target->FindState(NAME_Pain, mod);
|
||||
if (painstate != NULL) target->SetState (painstate);
|
||||
}
|
||||
else
|
||||
{ // "electrocute" the target
|
||||
target->renderflags |= RF_FULLBRIGHT;
|
||||
if ((target->flags3 & MF3_ISMONSTER) && pr_lightning() < 128)
|
||||
{
|
||||
target->Howl ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
justhit = true;
|
||||
FState * painstate = target->FindState(NAME_Pain, mod);
|
||||
if (painstate != NULL) target->SetState (painstate);
|
||||
}
|
||||
else
|
||||
{ // "electrocute" the target
|
||||
target->renderflags |= RF_FULLBRIGHT;
|
||||
if ((target->flags3 & MF3_ISMONSTER) && pr_lightning() < 128)
|
||||
if (mod == NAME_PoisonCloud)
|
||||
{
|
||||
target->Howl ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
justhit = true;
|
||||
FState * painstate = target->FindState(NAME_Pain, mod);
|
||||
if (painstate != NULL) target->SetState (painstate);
|
||||
if (mod == NAME_PoisonCloud)
|
||||
{
|
||||
if ((target->flags3 & MF3_ISMONSTER) && pr_poison() < 128)
|
||||
{
|
||||
target->Howl ();
|
||||
if ((target->flags3 & MF3_ISMONSTER) && pr_poison() < 128)
|
||||
{
|
||||
target->Howl ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,6 +301,11 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< Score
|
||||
<< Tag;
|
||||
|
||||
if (SaveVersion >= 1900)
|
||||
{
|
||||
arc << PainThreshold;
|
||||
}
|
||||
|
||||
for(int i=0; i<10; i++) arc << uservar[i];
|
||||
|
||||
if (arc.IsStoring ())
|
||||
|
|
|
@ -363,6 +363,16 @@ DEFINE_PROPERTY(painchance, ZI, Actor)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(painthreshold, I, Actor)
|
||||
{
|
||||
PROP_INT_PARM(id, 0);
|
||||
|
||||
defaults->PainThreshold = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue