From d5250d6b9f87af047214926e4c8f7ac14cb65032 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 28 Feb 2017 12:56:35 +0100 Subject: [PATCH] - made WoundHealth modifiable to allow more control over the wound state. --- src/actor.h | 1 + src/info.cpp | 2 -- src/info.h | 1 - src/p_interaction.cpp | 2 +- src/p_mobj.cpp | 3 ++- src/scripting/thingdef_properties.cpp | 3 +-- wadsrc/static/zscript/actor.txt | 2 ++ 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/actor.h b/src/actor.h index e7d84f09d5..739f08f4ab 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1028,6 +1028,7 @@ public: double RadiusDamageFactor; // Radius damage factor double SelfDamageFactor; double StealthAlpha; // Minmum alpha for MF_STEALTH. + int WoundHealth; // Health needed to enter wound state SDWORD tics; // state tic counter FState *state; diff --git a/src/info.cpp b/src/info.cpp index b8abba9760..d81d4d8743 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -254,7 +254,6 @@ PClassActor::PClassActor() DeathHeight = -1; BurnHeight = -1; GibHealth = INT_MIN; - WoundHealth = 6; DropItems = NULL; // Record this in the master list. @@ -306,7 +305,6 @@ void PClassActor::DeriveData(PClass *newclass) newa->BurnHeight = BurnHeight; newa->BloodColor = BloodColor; newa->GibHealth = GibHealth; - newa->WoundHealth = WoundHealth; newa->HowlSound = HowlSound; newa->distancecheck = distancecheck; diff --git a/src/info.h b/src/info.h index f2a6101e9b..28a684281b 100644 --- a/src/info.h +++ b/src/info.h @@ -296,7 +296,6 @@ public: double BurnHeight; // Height on burning death PalEntry BloodColor; // Colorized blood int GibHealth; // Negative health below which this monster dies an extreme death - int WoundHealth; // Health needed to enter wound state FSoundID HowlSound; // Sound being played when electrocuted or poisoned FDropItem *DropItems; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 2af2a3da13..da60af8ad9 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1536,7 +1536,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da woundstate = target->FindState(NAME_Wound, mod); if (woundstate != NULL) { - int woundhealth = target->GetClass()->WoundHealth; + int woundhealth = target->WoundHealth; if (target->health <= woundhealth) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9ccdde24e3..22cbe1e3fa 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -315,6 +315,7 @@ DEFINE_FIELD(AActor, CameraHeight) DEFINE_FIELD(AActor, RadiusDamageFactor) DEFINE_FIELD(AActor, SelfDamageFactor) DEFINE_FIELD(AActor, StealthAlpha) +DEFINE_FIELD(AActor, WoundHealth) DEFINE_FIELD(PClassActor, Obituary) DEFINE_FIELD(PClassActor, HitObituary) @@ -322,7 +323,6 @@ DEFINE_FIELD(PClassActor, DeathHeight) DEFINE_FIELD(PClassActor, BurnHeight) DEFINE_FIELD(PClassActor, BloodColor) DEFINE_FIELD(PClassActor, GibHealth) -DEFINE_FIELD(PClassActor, WoundHealth) DEFINE_FIELD(PClassActor, HowlSound) //========================================================================== @@ -490,6 +490,7 @@ void AActor::Serialize(FSerializer &arc) A("visibleendangle",VisibleEndAngle) A("visiblestartpitch",VisibleStartPitch) A("visibleendpitch",VisibleEndPitch) + A("woundhealth", WoundHealth) A("rdfactor", RadiusDamageFactor) A("selfdamagefactor", SelfDamageFactor) A("stealthalpha", StealthAlpha); diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index a6657ce972..a70fa0c9e1 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -608,8 +608,7 @@ DEFINE_PROPERTY(gibhealth, I, Actor) DEFINE_PROPERTY(woundhealth, I, Actor) { PROP_INT_PARM(id, 0); - assert(info->IsKindOf(RUNTIME_CLASS(PClassActor))); - static_cast(info)->WoundHealth = id; + defaults->WoundHealth = id; } //========================================================================== diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 2fc0d6d3bd..4fa2323b00 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -297,6 +297,8 @@ class Actor : Thinker native RadiusDamageFactor 1; SelfDamageFactor 1; StealthAlpha 0; + WoundHealth 6; + }