- 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; FNameNoInit DamageTypeReceived;
fixed_t DamageFactor; fixed_t DamageFactor;
FNameNoInit PainType;
FNameNoInit DeathType;
FState *SpawnState; FState *SpawnState;
FState *SeeState; FState *SeeState;
FState *MeleeState; FState *MeleeState;

View file

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

View file

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

View file

@ -1016,6 +1016,26 @@ DEFINE_PROPERTY(damagetype, S, Actor)
else defaults->DamageType=str; 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 WeaveIndexXY 0
WeaveIndexZ 16 WeaveIndexZ 16
DesignatedTeam 255 DesignatedTeam 255
PainType Normal
DeathType Normal
// Variables for the expression evaluator // Variables for the expression evaluator
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion // NOTE: fixed_t and angle_t are only used here to ensure proper conversion