- 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 committed by drfrag
parent be8d1c950d
commit 9981674a27
6 changed files with 8 additions and 31 deletions

View file

@ -60,6 +60,7 @@
#include "p_conversation.h"
#include "g_level.h"
#include "d_event.h"
#include "p_enemy.h"
#include "m_argv.h"
#include "p_lnspec.h"
#include "v_video.h"
@ -2088,19 +2089,7 @@ uint8_t *FDynamicBuffer::GetData (int *len)
static int KillAll(PClassActor *cls)
{
AActor *actor;
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;
return P_Massacre(false, cls);
}
static int RemoveClass(const PClass *cls)

View file

@ -148,20 +148,6 @@ 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;
}
//===========================================================================
//
//

View file

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

View file

@ -3475,7 +3475,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
// partially taken from Chi's .46 port
@ -3485,7 +3485,7 @@ int P_Massacre (bool baddies)
int killcount = 0;
AActor *actor;
TThinkerIterator<AActor> iterator;
TThinkerIterator<AActor> iterator(cls);
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);
bool CheckBossDeath (AActor *);
int P_Massacre (bool baddies = false);
int P_Massacre (bool baddies = false, PClassActor *cls = nullptr);
bool P_CheckMissileRange (AActor *actor);
#define SKULLSPEED (20.)

View file

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