mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Exported AActor::Grind to ZScript.
This commit is contained in:
parent
df6fe563c3
commit
927d333063
8 changed files with 52 additions and 32 deletions
|
@ -814,7 +814,8 @@ public:
|
||||||
virtual bool Massacre ();
|
virtual bool Massacre ();
|
||||||
|
|
||||||
// Transforms the actor into a finely-ground paste
|
// Transforms the actor into a finely-ground paste
|
||||||
virtual bool Grind(bool items);
|
bool Grind(bool items);
|
||||||
|
bool CallGrind(bool items);
|
||||||
|
|
||||||
// Get this actor's team
|
// Get this actor's team
|
||||||
int GetTeam();
|
int GetTeam();
|
||||||
|
|
|
@ -173,33 +173,6 @@ void AInventory::MarkPrecacheSounds() const
|
||||||
PickupSound.MarkUsed();
|
PickupSound.MarkUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// AInventory :: Grind
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
bool AInventory::Grind(bool items)
|
|
||||||
{
|
|
||||||
// Does this grind request even care about items?
|
|
||||||
if (!items)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Dropped items are normally destroyed by crushers. Set the DONTGIB flag,
|
|
||||||
// and they'll act like corpses with it set and be immune to crushers.
|
|
||||||
if (flags & MF_DROPPED)
|
|
||||||
{
|
|
||||||
if (!(flags3 & MF3_DONTGIB))
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Non-dropped items call the super method for compatibility.
|
|
||||||
return Super::Grind(items);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// AInventory :: BecomeItem
|
// AInventory :: BecomeItem
|
||||||
|
|
|
@ -76,7 +76,6 @@ public:
|
||||||
virtual void OnDestroy() override;
|
virtual void OnDestroy() override;
|
||||||
virtual void Tick() override;
|
virtual void Tick() override;
|
||||||
virtual bool Massacre() override;
|
virtual bool Massacre() override;
|
||||||
virtual bool Grind(bool items) 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.
|
||||||
|
|
||||||
|
|
|
@ -6485,7 +6485,7 @@ void P_FindBelowIntersectors(AActor *actor)
|
||||||
|
|
||||||
void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
||||||
{
|
{
|
||||||
if (!(thing && thing->Grind(true) && cpos)) return;
|
if (!(thing && thing->CallGrind(true) && cpos)) return;
|
||||||
cpos->nofit = true;
|
cpos->nofit = true;
|
||||||
|
|
||||||
if ((cpos->crushchange > 0) && !(level.maptime & 3))
|
if ((cpos->crushchange > 0) && !(level.maptime & 3))
|
||||||
|
|
|
@ -1903,6 +1903,26 @@ bool AActor::Grind(bool items)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(AActor, Grind)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
PARAM_BOOL(items);
|
||||||
|
ACTION_RETURN_BOOL(self->Grind(items));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AActor::CallGrind(bool items)
|
||||||
|
{
|
||||||
|
IFVIRTUAL(AActor, Grind)
|
||||||
|
{
|
||||||
|
VMValue params[] = { (DObject*)this, items };
|
||||||
|
int retv;
|
||||||
|
VMReturn ret(&retv);
|
||||||
|
VMCall(func, params, 2, &ret, 1);
|
||||||
|
return !!retv;
|
||||||
|
}
|
||||||
|
return Grind(items);
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// AActor :: Massacre
|
// AActor :: Massacre
|
||||||
|
|
|
@ -869,7 +869,7 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
|
||||||
P_TraceBleed (newdam > 0 ? newdam : crush, actor);
|
P_TraceBleed (newdam > 0 ? newdam : crush, actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (level.flags2 & LEVEL2_POLYGRIND) actor->Grind(false); // crush corpses that get caught in a polyobject's way
|
if (level.flags2 & LEVEL2_POLYGRIND) actor->CallGrind(false); // crush corpses that get caught in a polyobject's way
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -577,6 +577,7 @@ class Actor : Thinker native
|
||||||
native void ClearCounters();
|
native void ClearCounters();
|
||||||
native bool GiveBody (int num, int max=0);
|
native bool GiveBody (int num, int max=0);
|
||||||
native bool HitFloor();
|
native bool HitFloor();
|
||||||
|
native virtual bool Grind(bool items);
|
||||||
native clearscope bool isTeammate(Actor other) const;
|
native clearscope bool isTeammate(Actor other) const;
|
||||||
native clearscope int PlayerNumber() const;
|
native clearscope int PlayerNumber() const;
|
||||||
native void SetFriendPlayer(PlayerInfo player);
|
native void SetFriendPlayer(PlayerInfo player);
|
||||||
|
|
|
@ -144,7 +144,33 @@ class Inventory : Actor native
|
||||||
Spawn ("ItemFog", Pos, ALLOW_REPLACE);
|
Spawn ("ItemFog", Pos, ALLOW_REPLACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// AInventory :: Grind
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
override bool Grind(bool items)
|
||||||
|
{
|
||||||
|
// Does this grind request even care about items?
|
||||||
|
if (!items)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Dropped items are normally destroyed by crushers. Set the DONTGIB flag,
|
||||||
|
// and they'll act like corpses with it set and be immune to crushers.
|
||||||
|
if (bDropped)
|
||||||
|
{
|
||||||
|
if (!bDontGib)
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Non-dropped items call the super method for compatibility.
|
||||||
|
return Super.Grind(items);
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue