- use an inventory flag to decide what items are slipped by DF_NO_HEALTH and DF_NO_ARMOR. With all the changes over the last 10 years this had become too spotty.
- use an enum type for ItemFlags, just like it was done for actor flags. Since the flag word is almost full it may soon be necessary to add a second one and then this kind of security check may become necessary.
This commit is contained in:
parent
dc6c91042b
commit
12915b5f6e
7 changed files with 34 additions and 24 deletions
|
|
@ -5821,27 +5821,23 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
// [RH] Other things that shouldn't be spawned depending on dmflags
|
||||
if (deathmatch || alwaysapplydmflags)
|
||||
{
|
||||
// Fixme: This needs to be done differently, it's quite broken.
|
||||
if (dmflags & DF_NO_HEALTH)
|
||||
if (i->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
||||
{
|
||||
if (i->IsDescendantOf (PClass::FindActor(NAME_Health)))
|
||||
return NULL;
|
||||
if (i->TypeName == NAME_Berserk)
|
||||
return NULL;
|
||||
if (i->TypeName == NAME_Megasphere)
|
||||
return NULL;
|
||||
}
|
||||
if (dmflags & DF_NO_ITEMS)
|
||||
{
|
||||
// if (i->IsDescendantOf (RUNTIME_CLASS(AArtifact)))
|
||||
// return;
|
||||
}
|
||||
if (dmflags & DF_NO_ARMOR)
|
||||
{
|
||||
if (i->IsDescendantOf (PClass::FindActor(NAME_Armor)))
|
||||
return NULL;
|
||||
if (i->TypeName == NAME_Megasphere)
|
||||
return NULL;
|
||||
auto it = static_cast<AInventory*>(GetDefaultByType(i));
|
||||
|
||||
if (dmflags & DF_NO_HEALTH)
|
||||
{
|
||||
if (it->ItemFlags & IF_ISHEALTH) return nullptr;
|
||||
}
|
||||
if (dmflags & DF_NO_ITEMS)
|
||||
{
|
||||
// if (i->IsDescendantOf (RUNTIME_CLASS(AArtifact)))
|
||||
// return;
|
||||
}
|
||||
if (dmflags & DF_NO_ARMOR)
|
||||
{
|
||||
if (it->ItemFlags & IF_ISARMOR) return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue