Skip to content

Commit c622c63

Browse files
Boondorlmadame-rachelle
authored andcommitted
Added PSpriteTick virtual
1 parent b0137e5 commit c622c63

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

wadsrc/static/zscript/actors/actor.zs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@ class Actor : Thinker native
509509
native clearscope void DisableLocalRendering(uint playerNum, bool disable);
510510
native ui bool ShouldRenderLocally(); // Only clients get to check this, never the playsim.
511511

512+
// Called when the Actor is being used within a PSprite. This happens before potentially changing PSprite
513+
// state so that any custom actions based on things like player input can be done before moving to the next
514+
// state of something like a weapon.
515+
virtual void PSpriteTick(PSprite psp) {}
516+
512517
// Called by inventory items to see if this actor is capable of touching them.
513518
// If true, the item will attempt to be picked up. Useful for things like
514519
// allowing morphs to pick up limited items such as keys while preventing

wadsrc/static/zscript/actors/player/player.zs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,13 +2708,23 @@ class PSprite : Object native play
27082708
{
27092709
if (processPending)
27102710
{
2711-
// drop tic count and possibly change state
2712-
if (Tics != -1) // a -1 tic count never changes
2711+
if (Caller)
27132712
{
2714-
Tics--;
2715-
// [BC] Apply double firing speed.
2716-
if (bPowDouble && Tics && (Owner.mo.FindInventory ("PowerDoubleFiringSpeed", true))) Tics--;
2717-
if (!Tics && Caller != null) SetState(CurState.NextState);
2713+
Caller.PSpriteTick(self);
2714+
if (bDestroyed)
2715+
return;
2716+
}
2717+
2718+
if (processPending)
2719+
{
2720+
// drop tic count and possibly change state
2721+
if (Tics != -1) // a -1 tic count never changes
2722+
{
2723+
Tics--;
2724+
// [BC] Apply double firing speed.
2725+
if (bPowDouble && Tics && (Owner.mo.FindInventory ("PowerDoubleFiringSpeed", true))) Tics--;
2726+
if (!Tics && Caller != null) SetState(CurState.NextState);
2727+
}
27182728
}
27192729
}
27202730
}

0 commit comments

Comments
 (0)