From 18213f377c083df07fb9f61832f204f497b3504e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 20 Jul 2018 11:43:49 +0200 Subject: [PATCH] - fixed: Inventory items that have been modified with Dehacked to be monsters should not be killed by P_Massacre when being owned. --- src/actor.h | 2 +- src/g_inventory/a_pickups.cpp | 14 ++++++++++++++ src/g_inventory/a_pickups.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index 2199c205e..e9d50e9a3 100644 --- a/src/actor.h +++ b/src/actor.h @@ -807,7 +807,7 @@ public: void ObtainInventory (AActor *other); // Die. Now. - bool Massacre (); + virtual bool Massacre (); // Transforms the actor into a finely-ground paste virtual bool Grind(bool items); diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index 705a2539f..7b7721b48 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -147,6 +147,20 @@ void AInventory::Serialize(FSerializer &arc) ("droptime", DropTime, def->DropTime); } +//=========================================================================== +// +// AInventory :: Massacre +// +// This is a countermeasure for Dehacked modifications mainly. +// +//=========================================================================== + +bool AInventory::Massacre() +{ + if (Owner == nullptr) return Super::Massacre(); + return false; +} + //=========================================================================== // // AInventory :: MarkPrecacheSounds diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index cbcb2d9cd..4cb202f7d 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -75,6 +75,7 @@ public: virtual void MarkPrecacheSounds() const override; virtual void OnDestroy() override; virtual void Tick() override; + virtual bool Massacre() override; virtual bool Grind(bool items) override; bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function.