From 1ecfb5897b05c0b9605e5195e61433a5e5b17714 Mon Sep 17 00:00:00 2001 From: Leonard2 Date: Wed, 11 May 2016 23:13:02 +0200 Subject: [PATCH] Added A_Overlay --- src/p_pspr.cpp | 25 +++++++++++++++++++++++ wadsrc/static/actors/shared/inventory.txt | 1 + 2 files changed, 26 insertions(+) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 656ee4c38c..c271e47958 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -251,6 +251,11 @@ void DPSprite::SetState(FState *newstate, bool pending) FState *nextstate; if (newstate->CallAction(Owner->mo, Caller, &nextstate)) { + // It's possible this call resulted in this very layer being replaced. + if (ObjectFlags & OF_EuthanizeMe) + { + return; + } if (nextstate != nullptr) { newstate = nextstate; @@ -1001,8 +1006,28 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise) return 0; } +//--------------------------------------------------------------------------- +// +// PROC A_Overlay +// +//--------------------------------------------------------------------------- +DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Overlay) +{ + PARAM_ACTION_PROLOGUE; + PARAM_INT (layer); + PARAM_STATE_OPT (state) { state = nullptr; } + player_t *player = self->player; + + if (player == nullptr) + return 0; + + DPSprite *pspr; + pspr = new DPSprite(player, reinterpret_cast(stateowner), layer); + pspr->SetState(state); + return 0; +} // // A_GunFlash diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index f7250117d3..9902058692 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -40,6 +40,7 @@ ACTOR Inventory native action native A_ReFire(state flash = ""); action native A_ClearReFire(); action native A_CheckReload(); + action native A_Overlay(int layer, state start = ""); action native A_GunFlash(state flash = "", int flags = 0); action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff", int flags = 0, float range = 0, float/*angle*/ spread_xy = 2.8125, float/*angle*/ spread_z = 0, float lifesteal = 0, int lifestealmax = 0, class armorbonustype = "ArmorBonus"); action native state A_CheckForReload(int counter, state label, bool dontincrement = false);