- added Major Cooke's Death/Paintype submission.

SVN r3237 (trunk)
This commit is contained in:
Christoph Oelckers 2011-06-13 17:15:09 +00:00
parent e4455c293f
commit 4d7fcbf1b8
5 changed files with 41 additions and 5 deletions

View file

@ -920,6 +920,9 @@ public:
FNameNoInit DamageTypeReceived;
fixed_t DamageFactor;
FNameNoInit PainType;
FNameNoInit DeathType;
FState *SpawnState;
FState *SeeState;
FState *MeleeState;

View file

@ -641,6 +641,7 @@ void AActor::Die (AActor *source, AActor *inflictor)
FState *diestate = NULL;
FName damagetype = (inflictor && inflictor->DeathType != NAME_None) ? inflictor->DeathType : DamageType;
if (DamageType != NAME_None)
{
@ -1316,7 +1317,7 @@ dopain:
else
{
justhit = true;
FState *painstate = target->FindState(NAME_Pain, mod);
FState *painstate = target->FindState(NAME_Pain, ((inflictor && inflictor->PainType != NAME_None) ? inflictor->PainType : mod));
if (painstate != NULL)
target->SetState(painstate);
if (mod == NAME_PoisonCloud)
@ -1569,8 +1570,8 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
}
if (!(level.time&63) && playPainSound)
{
FState * painstate = target->FindState(NAME_Pain, target->DamageType);
if (painstate != NULL) target->SetState (painstate);
FState * painstate = target->FindState(NAME_Pain,((inflictor && inflictor->PainType != NAME_None) ? inflictor->PainType : target->DamageType));
if (painstate != NULL) target->SetState (painstate);
}
/*
if((P_Random() < target->info->painchance)

View file

@ -294,8 +294,14 @@ void AActor::Serialize (FArchive &arc)
<< maxtargetrange
<< meleethreshold
<< meleerange
<< DamageType
<< gravity
<< DamageType;
if (SaveVersion >= 3237)
{
arc
<< PainType
<< DeathType;
}
arc << gravity
<< FastChaseStrafeCount
<< master
<< smokecounter
@ -5474,6 +5480,10 @@ int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FN
{
return damage;
}
if (inflictor && inflictor->DeathType != NAME_None)
damagetype = inflictor->DeathType;
if (damagetype == NAME_Ice)
{
death = FindState (NAME_Death, NAME_Ice, true);

View file

@ -1016,6 +1016,26 @@ DEFINE_PROPERTY(damagetype, S, Actor)
else defaults->DamageType=str;
}
//==========================================================================
//==========================================================================
DEFINE_PROPERTY(paintype, S, Actor)
{
PROP_STRING_PARM(str, 0);
if (!stricmp(str, "Normal")) defaults->PainType = NAME_None;
else defaults->PainType=str;
}
//==========================================================================
//==========================================================================
DEFINE_PROPERTY(deathtype, S, Actor)
{
PROP_STRING_PARM(str, 0);
if (!stricmp(str, "Normal")) defaults->DeathType = NAME_None;
else defaults->DeathType=str;
}
//==========================================================================
//
//==========================================================================

View file

@ -22,6 +22,8 @@ ACTOR Actor native //: Thinker
WeaveIndexXY 0
WeaveIndexZ 16
DesignatedTeam 255
PainType Normal
DeathType Normal
// Variables for the expression evaluator
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion