diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index f4af55f2d..553c75360 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -263,8 +263,8 @@ Note: All fields default to false unless mentioned otherwise. gravity = ; // Set per-actor gravity. Positive values are multiplied with the class's property, // negative values are used as their absolute. Default = 1.0. - health = ; // Set per-actor health. Positive values are multiplied with the class's property, - // negative values are used as their absolute. Default = 1. + health = ; // Set per-actor health as an absolute value. Default = actor default. + healthfactor = ; // Set per-actor health as a factor to the original. Default = 1. renderstyle = ; // Set per-actor render style, overriding the class default. Possible values can be "normal", // "none", "add" or "additive", "subtract" or "subtractive", "stencil", "translucentstencil", diff --git a/src/namedef.h b/src/namedef.h index bb42fc76d..28de56818 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -46,6 +46,7 @@ xx(Shadow) xx(Subtract) xx(Subtractive) xx(FillColor) +xx(HealthFactor) // Healingradius types xx(Mana) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 27293b918..b9300f654 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -515,6 +515,7 @@ public: FString arg0str, arg1str; memset(th, 0, sizeof(*th)); + double healthfactor = 1; th->Gravity = 1; th->RenderStyle = STYLE_Count; th->Alpha = -1; @@ -738,38 +739,52 @@ public: break; case NAME_Alpha: + CHECK_N(Zd | Zdt) th->Alpha = CheckFloat(key); break; case NAME_FillColor: + CHECK_N(Zd | Zdt) th->fillcolor = CheckInt(key); break; case NAME_Health: + CHECK_N(Zd | Zdt) th->health = CheckInt(key); break; + case NAME_HealthFactor: + CHECK_N(Zd | Zdt) + healthfactor = CheckFloat(key); + break; + case NAME_Score: + CHECK_N(Zd | Zdt) th->score = CheckInt(key); break; case NAME_Pitch: + CHECK_N(Zd | Zdt) th->pitch = (short)CheckInt(key); break; case NAME_Roll: + CHECK_N(Zd | Zdt) th->roll = (short)CheckInt(key); break; case NAME_ScaleX: + CHECK_N(Zd | Zdt) th->Scale.X = CheckFloat(key); break; case NAME_ScaleY: + CHECK_N(Zd | Zdt) th->Scale.Y = CheckFloat(key); break; case NAME_Scale: + CHECK_N(Zd | Zdt) th->Scale.X = th->Scale.Y = CheckFloat(key); break; @@ -793,6 +808,7 @@ public: { th->args[1] = -FName(arg1str); } + th->health = int(th->health * healthfactor); // Thing specials are only valid in namespaces with Hexen-type specials // and in ZDoomTranslated - which will use the translator on them. if (namespc == NAME_ZDoomTranslated)