mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 06:42:12 +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,
|
||||
// negative values are used as their absolute. Default = 1.0.
|
||||
|
||||
health = <int>; // Set per-actor health as an absolute value. Default = actor default.
|
||||
healthfactor = <float>; // Set per-actor health as a factor to the original. Default = 1.
|
||||
health = <int>; // Set per-actor health. Positive values are multiplied with the class's property,
|
||||
// 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",
|
||||
// "none", "add" or "additive", "subtract" or "subtractive", "stencil", "translucentstencil",
|
||||
|
|
|
@ -3160,7 +3160,6 @@ void PClass::InitializeDefaults()
|
|||
optr->ObjNext = nullptr;
|
||||
optr->SetClass(this);
|
||||
|
||||
|
||||
// Copy the defaults from the parent but leave the DObject part alone because it contains important data.
|
||||
if (ParentClass->Defaults != nullptr)
|
||||
{
|
||||
|
@ -3174,6 +3173,13 @@ void PClass::InitializeDefaults()
|
|||
{
|
||||
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)
|
||||
|
@ -3183,10 +3189,14 @@ void PClass::InitializeDefaults()
|
|||
if (Defaults != nullptr) ParentClass->InitializeSpecials(Defaults, ParentClass->Defaults);
|
||||
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);
|
||||
}
|
||||
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:
|
||||
// We unravel _WITH_META here just as we did for PType.
|
||||
TArray<FTypeAndOffset> SpecialInits;
|
||||
TArray<FTypeAndOffset> MetaInits;
|
||||
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();
|
||||
public:
|
||||
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 *ArrayPointers; // dynamic arrays containing object pointers.
|
||||
BYTE *Defaults;
|
||||
BYTE *Meta; // Per-class static script data
|
||||
unsigned MetaSize;
|
||||
bool bRuntimeClass; // class was defined at run-time, not compile-time
|
||||
bool bExported; // This type has been declared in a script
|
||||
bool bDecorateClass; // may be subject to some idiosyncracies due to DECORATE backwards compatibility
|
||||
|
|
|
@ -46,7 +46,6 @@ xx(Shadow)
|
|||
xx(Subtract)
|
||||
xx(Subtractive)
|
||||
xx(FillColor)
|
||||
xx(HealthFactor)
|
||||
|
||||
// Healingradius types
|
||||
xx(Mana)
|
||||
|
|
|
@ -515,7 +515,6 @@ public:
|
|||
FString arg0str, arg1str;
|
||||
|
||||
memset(th, 0, sizeof(*th));
|
||||
double healthfactor = 1;
|
||||
th->Gravity = 1;
|
||||
th->RenderStyle = STYLE_Count;
|
||||
th->Alpha = -1;
|
||||
|
@ -739,52 +738,38 @@ 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;
|
||||
|
||||
|
@ -808,7 +793,6 @@ 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)
|
||||
|
|
Loading…
Reference in a new issue