From 4d7fcbf1b88655d6ad438dc446ec3efd8784cf58 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Jun 2011 17:15:09 +0000 Subject: [PATCH] - added Major Cooke's Death/Paintype submission. SVN r3237 (trunk) --- src/actor.h | 3 +++ src/p_interaction.cpp | 7 ++++--- src/p_mobj.cpp | 14 ++++++++++++-- src/thingdef/thingdef_properties.cpp | 20 ++++++++++++++++++++ wadsrc/static/actors/actor.txt | 2 ++ 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/actor.h b/src/actor.h index d9d1dbcfe..f41ec986b 100644 --- a/src/actor.h +++ b/src/actor.h @@ -920,6 +920,9 @@ public: FNameNoInit DamageTypeReceived; fixed_t DamageFactor; + FNameNoInit PainType; + FNameNoInit DeathType; + FState *SpawnState; FState *SeeState; FState *MeleeState; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 6337d71cf..5e37444fe 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -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) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 075124a1e..abaf52fb8 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 69adc302f..4c3301a13 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 251be5e0d..51c1377d0 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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