mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 23:02:07 +00:00
Revert "- the UDMF health key for actors was not correctly implemented. This addresses the problem by adding a second one and documenting 'Health' as implemented."
This reverts commit e4e023e59a
.
(This was nonsense.)
This commit is contained in:
parent
d5d383ee93
commit
3700dea336
5 changed files with 18 additions and 22 deletions
|
@ -263,8 +263,8 @@ Note: All <bool> fields default to false unless mentioned otherwise.
|
||||||
gravity = <float>; // Set per-actor gravity. Positive values are multiplied with the class's property,
|
gravity = <float>; // Set per-actor gravity. Positive values are multiplied with the class's property,
|
||||||
// negative values are used as their absolute. Default = 1.0.
|
// negative values are used as their absolute. Default = 1.0.
|
||||||
|
|
||||||
health = <int>; // Set per-actor health as an absolute value. Default = actor default.
|
health = <int>; // Set per-actor health. Positive values are multiplied with the class's property,
|
||||||
healthfactor = <float>; // Set per-actor health as a factor to the original. Default = 1.
|
// negative values are used as their absolute. Default = 1.
|
||||||
|
|
||||||
renderstyle = <string>; // Set per-actor render style, overriding the class default. Possible values can be "normal",
|
renderstyle = <string>; // Set per-actor render style, overriding the class default. Possible values can be "normal",
|
||||||
// "none", "add" or "additive", "subtract" or "subtractive", "stencil", "translucentstencil",
|
// "none", "add" or "additive", "subtract" or "subtractive", "stencil", "translucentstencil",
|
||||||
|
|
|
@ -3160,7 +3160,6 @@ void PClass::InitializeDefaults()
|
||||||
optr->ObjNext = nullptr;
|
optr->ObjNext = nullptr;
|
||||||
optr->SetClass(this);
|
optr->SetClass(this);
|
||||||
|
|
||||||
|
|
||||||
// Copy the defaults from the parent but leave the DObject part alone because it contains important data.
|
// Copy the defaults from the parent but leave the DObject part alone because it contains important data.
|
||||||
if (ParentClass->Defaults != nullptr)
|
if (ParentClass->Defaults != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -3174,6 +3173,13 @@ void PClass::InitializeDefaults()
|
||||||
{
|
{
|
||||||
memset(Defaults + sizeof(DObject), 0, Size - sizeof(DObject));
|
memset(Defaults + sizeof(DObject), 0, Size - sizeof(DObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MetaSize != 0)
|
||||||
|
{
|
||||||
|
Meta = (BYTE*)ClassDataAllocator.Alloc(MetaSize);
|
||||||
|
memset(Meta, 0, MetaSize);
|
||||||
|
if (ParentClass->MetaSize > 0) memcpy(Meta, ParentClass->Meta, ParentClass->MetaSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bRuntimeClass)
|
if (bRuntimeClass)
|
||||||
|
@ -3183,10 +3189,14 @@ void PClass::InitializeDefaults()
|
||||||
if (Defaults != nullptr) ParentClass->InitializeSpecials(Defaults, ParentClass->Defaults);
|
if (Defaults != nullptr) ParentClass->InitializeSpecials(Defaults, ParentClass->Defaults);
|
||||||
for (const PField *field : Fields)
|
for (const PField *field : Fields)
|
||||||
{
|
{
|
||||||
if (!(field->Flags & VARF_Native))
|
if (!(field->Flags & VARF_Native) && !(field->Flags & VARF_Meta))
|
||||||
{
|
{
|
||||||
field->Type->SetDefaultValue(Defaults, unsigned(field->Offset), &SpecialInits);
|
field->Type->SetDefaultValue(Defaults, unsigned(field->Offset), &SpecialInits);
|
||||||
}
|
}
|
||||||
|
if (!(field->Flags & VARF_Native) && (field->Flags & VARF_Meta))
|
||||||
|
{
|
||||||
|
field->Type->SetDefaultValue(Meta, unsigned(field->Offset), &MetaInits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,8 +560,9 @@ class PClass : public PNativeStruct
|
||||||
protected:
|
protected:
|
||||||
// We unravel _WITH_META here just as we did for PType.
|
// We unravel _WITH_META here just as we did for PType.
|
||||||
TArray<FTypeAndOffset> SpecialInits;
|
TArray<FTypeAndOffset> SpecialInits;
|
||||||
|
TArray<FTypeAndOffset> MetaInits;
|
||||||
void Derive(PClass *newclass, FName name);
|
void Derive(PClass *newclass, FName name);
|
||||||
void InitializeSpecials(void *addr, void *defaults) const;
|
void InitializeSpecials(void *addr, void *defaults, TArray<FTypeAndOffset>* PClass::*Inits);
|
||||||
void SetSuper();
|
void SetSuper();
|
||||||
public:
|
public:
|
||||||
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
||||||
|
@ -582,6 +583,8 @@ public:
|
||||||
const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default
|
const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default
|
||||||
const size_t *ArrayPointers; // dynamic arrays containing object pointers.
|
const size_t *ArrayPointers; // dynamic arrays containing object pointers.
|
||||||
BYTE *Defaults;
|
BYTE *Defaults;
|
||||||
|
BYTE *Meta; // Per-class static script data
|
||||||
|
unsigned MetaSize;
|
||||||
bool bRuntimeClass; // class was defined at run-time, not compile-time
|
bool bRuntimeClass; // class was defined at run-time, not compile-time
|
||||||
bool bExported; // This type has been declared in a script
|
bool bExported; // This type has been declared in a script
|
||||||
bool bDecorateClass; // may be subject to some idiosyncracies due to DECORATE backwards compatibility
|
bool bDecorateClass; // may be subject to some idiosyncracies due to DECORATE backwards compatibility
|
||||||
|
|
|
@ -46,7 +46,6 @@ xx(Shadow)
|
||||||
xx(Subtract)
|
xx(Subtract)
|
||||||
xx(Subtractive)
|
xx(Subtractive)
|
||||||
xx(FillColor)
|
xx(FillColor)
|
||||||
xx(HealthFactor)
|
|
||||||
|
|
||||||
// Healingradius types
|
// Healingradius types
|
||||||
xx(Mana)
|
xx(Mana)
|
||||||
|
|
|
@ -515,7 +515,6 @@ public:
|
||||||
FString arg0str, arg1str;
|
FString arg0str, arg1str;
|
||||||
|
|
||||||
memset(th, 0, sizeof(*th));
|
memset(th, 0, sizeof(*th));
|
||||||
double healthfactor = 1;
|
|
||||||
th->Gravity = 1;
|
th->Gravity = 1;
|
||||||
th->RenderStyle = STYLE_Count;
|
th->RenderStyle = STYLE_Count;
|
||||||
th->Alpha = -1;
|
th->Alpha = -1;
|
||||||
|
@ -739,52 +738,38 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Alpha:
|
case NAME_Alpha:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->Alpha = CheckFloat(key);
|
th->Alpha = CheckFloat(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_FillColor:
|
case NAME_FillColor:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->fillcolor = CheckInt(key);
|
th->fillcolor = CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Health:
|
case NAME_Health:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->health = CheckInt(key);
|
th->health = CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_HealthFactor:
|
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
healthfactor = CheckFloat(key);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NAME_Score:
|
case NAME_Score:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->score = CheckInt(key);
|
th->score = CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Pitch:
|
case NAME_Pitch:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->pitch = (short)CheckInt(key);
|
th->pitch = (short)CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Roll:
|
case NAME_Roll:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->roll = (short)CheckInt(key);
|
th->roll = (short)CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_ScaleX:
|
case NAME_ScaleX:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->Scale.X = CheckFloat(key);
|
th->Scale.X = CheckFloat(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_ScaleY:
|
case NAME_ScaleY:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->Scale.Y = CheckFloat(key);
|
th->Scale.Y = CheckFloat(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Scale:
|
case NAME_Scale:
|
||||||
CHECK_N(Zd | Zdt)
|
|
||||||
th->Scale.X = th->Scale.Y = CheckFloat(key);
|
th->Scale.X = th->Scale.Y = CheckFloat(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -808,7 +793,6 @@ public:
|
||||||
{
|
{
|
||||||
th->args[1] = -FName(arg1str);
|
th->args[1] = -FName(arg1str);
|
||||||
}
|
}
|
||||||
th->health = int(th->health * healthfactor);
|
|
||||||
// Thing specials are only valid in namespaces with Hexen-type specials
|
// Thing specials are only valid in namespaces with Hexen-type specials
|
||||||
// and in ZDoomTranslated - which will use the translator on them.
|
// and in ZDoomTranslated - which will use the translator on them.
|
||||||
if (namespc == NAME_ZDoomTranslated)
|
if (namespc == NAME_ZDoomTranslated)
|
||||||
|
|
Loading…
Reference in a new issue