- re-fixed the massacre fix for Dehacked-modified inventory items.

Instead of overriding the Massacre method it is preferable to clear the flags causing the bad behavior, most notably ISMONSTER.

# Conflicts:
#	src/g_inventory/a_pickups.cpp
#	src/g_inventory/a_pickups.h
This commit is contained in:
Christoph Oelckers 2018-11-27 00:14:51 +01:00
parent 7301bbc58e
commit a14b0c58bf
6 changed files with 8 additions and 31 deletions

View file

@ -52,6 +52,7 @@
#include "teaminfo.h" #include "teaminfo.h"
#include "p_conversation.h" #include "p_conversation.h"
#include "d_event.h" #include "d_event.h"
#include "p_enemy.h"
#include "m_argv.h" #include "m_argv.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_spec.h" #include "p_spec.h"
@ -2079,19 +2080,7 @@ uint8_t *FDynamicBuffer::GetData (int *len)
static int KillAll(PClassActor *cls) static int KillAll(PClassActor *cls)
{ {
AActor *actor; return P_Massacre(false, cls);
int killcount = 0;
TThinkerIterator<AActor> iterator(cls);
while ( (actor = iterator.Next ()) )
{
if (actor->IsA(cls))
{
if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER))
killcount += actor->Massacre ();
}
}
return killcount;
} }
static int RemoveClass(const PClass *cls) static int RemoveClass(const PClass *cls)

View file

@ -141,20 +141,6 @@ void AInventory::Serialize(FSerializer &arc)
("droptime", DropTime, def->DropTime); ("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;
}
//=========================================================================== //===========================================================================
// //
// //

View file

@ -72,7 +72,6 @@ public:
virtual void Serialize(FSerializer &arc) override; virtual void Serialize(FSerializer &arc) override;
virtual void Tick() override; virtual void Tick() override;
virtual bool Massacre() override;
bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function. bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function.

View file

@ -3465,7 +3465,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath)
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int P_Massacre (bool baddies) int P_Massacre (bool baddies, PClassActor *cls)
{ {
// jff 02/01/98 'em' cheat - kill all monsters // jff 02/01/98 'em' cheat - kill all monsters
// partially taken from Chi's .46 port // partially taken from Chi's .46 port
@ -3475,7 +3475,7 @@ int P_Massacre (bool baddies)
int killcount = 0; int killcount = 0;
AActor *actor; AActor *actor;
TThinkerIterator<AActor> iterator; TThinkerIterator<AActor> iterator(cls);
while ( (actor = iterator.Next ()) ) while ( (actor = iterator.Next ()) )
{ {

View file

@ -67,7 +67,7 @@ void A_FaceTarget(AActor *actor);
void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0); void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0);
bool CheckBossDeath (AActor *); bool CheckBossDeath (AActor *);
int P_Massacre (bool baddies = false); int P_Massacre (bool baddies = false, PClassActor *cls = nullptr);
bool P_CheckMissileRange (AActor *actor); bool P_CheckMissileRange (AActor *actor);
#define SKULLSPEED (20.) #define SKULLSPEED (20.)

View file

@ -212,6 +212,9 @@ class Inventory : Actor native
} }
ChangeTid(0); ChangeTid(0);
bSpecial = false; bSpecial = false;
// if the item was turned into a monster through Dehacked, undo that here.
bCountkill = false;
bIsMonster = false;
ChangeStatNum(STAT_INVENTORY); ChangeStatNum(STAT_INVENTORY);
// stop all sounds this item is playing. // stop all sounds this item is playing.
for(int i = 1;i<=7;i++) A_StopSound(i); for(int i = 1;i<=7;i++) A_StopSound(i);