fix automap display for keys that were altered by Dehacked.

This commit is contained in:
Christoph Oelckers 2025-01-19 13:19:26 +01:00
parent a1460e88af
commit 7b30f9350c
2 changed files with 18 additions and 1 deletions

View file

@ -2910,11 +2910,18 @@ void DAutomap::drawKeys ()
mpoint_t p; mpoint_t p;
DAngle angle; DAngle angle;
auto it = Level->GetThinkerIterator<AActor>(NAME_Key); auto it = Level->GetThinkerIterator<AActor>(NAME_Inventory);
AActor *key; AActor *key;
while ((key = it.Next()) != nullptr) while ((key = it.Next()) != nullptr)
{ {
auto cls = key->GetClass();
if (cls->IsDescendantOf(NAME_DehackedPickup))
{
cls = cls->ActorInfo()->Replacee;
}
if (!cls->IsDescendantOf(NAME_Key)) continue;
DVector3 pos = key->PosRelative(MapPortalGroup); DVector3 pos = key->PosRelative(MapPortalGroup);
p.x = pos.X; p.x = pos.X;
p.y = pos.Y; p.y = pos.Y;

View file

@ -62,6 +62,16 @@ struct OneKey
// P_GetMapColorForKey() checks the key directly // P_GetMapColorForKey() checks the key directly
if (owner->IsA(key) || owner->GetSpecies() == key->TypeName) return true; if (owner->IsA(key) || owner->GetSpecies() == key->TypeName) return true;
if (owner->IsKindOf(NAME_DehackedPickup))
{
auto cls = owner->GetClass()->ActorInfo()->Replacee;
if (cls == key || owner->Species == key->TypeName)
{
return true;
}
}
// Other calls check an actor that may have a key in its inventory. // Other calls check an actor that may have a key in its inventory.
for (AActor *item = owner->Inventory; item != NULL; item = item->Inventory) for (AActor *item = owner->Inventory; item != NULL; item = item->Inventory)
{ {