diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 1ff46faf0..d8f6ef58c 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -110,7 +110,7 @@ END_POINTERS // //------------------------------------------------------------------------ -DPSprite::DPSprite(player_t *owner, AInventory *caller, int id) +DPSprite::DPSprite(player_t *owner, AActor *caller, int id) : processPending(true), firstTic(true), x(.0), y(.0), @@ -142,7 +142,7 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id) if (Next && Next->ID == ID && ID != 0) Next->Destroy(); // Replace it. - if (Caller->IsKindOf(RUNTIME_CLASS(AWeapon))) + if (Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) || Caller->IsKindOf(RUNTIME_CLASS(APlayerPawn))) Flags = (PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_CVARFAST); } @@ -177,8 +177,8 @@ DPSprite *player_t::FindPSprite(int layer) DPSprite *player_t::GetPSprite(PSPLayers layer) { - AInventory *oldcaller = nullptr; - AInventory *newcaller = nullptr; + AActor *oldcaller = nullptr; + AActor *newcaller = nullptr; if (layer >= PSP_TARGETCENTER) { @@ -972,7 +972,7 @@ void A_OverlayOffset(AActor *self, int layer, double wx, double wy, int flags) } } -DEFINE_ACTION_FUNCTION(AInventory, A_OverlayOffset) +DEFINE_ACTION_FUNCTION(AActor, A_OverlayOffset) { PARAM_ACTION_PROLOGUE; PARAM_INT_OPT(layer) { layer = PSP_WEAPON; } @@ -983,7 +983,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_OverlayOffset) return 0; } -DEFINE_ACTION_FUNCTION(AInventory, A_WeaponOffset) +DEFINE_ACTION_FUNCTION(AActor, A_WeaponOffset) { PARAM_ACTION_PROLOGUE; PARAM_FLOAT_OPT(wx) { wx = 0.; } @@ -999,7 +999,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_WeaponOffset) // //--------------------------------------------------------------------------- -DEFINE_ACTION_FUNCTION(AInventory, A_OverlayFlags) +DEFINE_ACTION_FUNCTION(AActor, A_OverlayFlags) { PARAM_ACTION_PROLOGUE; PARAM_INT(layer); @@ -1118,7 +1118,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise) // //--------------------------------------------------------------------------- -DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Overlay) +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay) { PARAM_ACTION_PROLOGUE; PARAM_INT (layer); @@ -1130,7 +1130,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Overlay) return 0; DPSprite *pspr; - pspr = new DPSprite(player, reinterpret_cast(stateowner), layer); + pspr = new DPSprite(player, stateowner, layer); pspr->SetState(state); return 0; } @@ -1312,7 +1312,7 @@ void player_t::TickPSprites() // Destroy the psprite if it's from a weapon that isn't currently selected by the player // or if it's from an inventory item that the player no longer owns. if ((pspr->Caller == nullptr || - (pspr->Caller->Owner != pspr->Owner->mo) || + (pspr->Caller->IsKindOf(RUNTIME_CLASS(AInventory)) && barrier_cast(pspr->Caller)->Owner != pspr->Owner->mo) || (pspr->Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) && pspr->Caller != pspr->Owner->ReadyWeapon))) { pspr->Destroy(); diff --git a/src/p_pspr.h b/src/p_pspr.h index 9ef3208e5..5f2dda275 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -64,7 +64,7 @@ class DPSprite : public DObject DECLARE_CLASS (DPSprite, DObject) HAS_OBJECT_POINTERS public: - DPSprite(player_t *owner, AInventory *caller, int id); + DPSprite(player_t *owner, AActor *caller, int id); static void NewTick(); void SetState(FState *newstate, bool pending = false); @@ -74,7 +74,7 @@ public: int GetFrame() const { return Frame; } FState* GetState() const { return State; } DPSprite* GetNext() { return Next; } - AInventory* GetCaller() { return Caller; } + AActor* GetCaller() { return Caller; } double x, y; double oldx, oldy; @@ -89,7 +89,7 @@ private: void Tick(); void Destroy(); - TObjPtr Caller; + TObjPtr Caller; TObjPtr Next; player_t *Owner; FState *State; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index aaa4981eb..5b50b4e1c 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5706,7 +5706,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) PARAM_ACTION_PROLOGUE; PARAM_INT(tics_to_set); - if (stateowner != self && self->player != nullptr && stateowner->IsKindOf(RUNTIME_CLASS(AInventory))) + if (self->player != nullptr) { // Need to check psp states for a match, then. Blah. DPSprite *pspr = self->player->psprites; while (pspr) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 44ebb1dc3..abf6cab8a 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -331,6 +331,11 @@ ACTOR Actor native //: Thinker native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER); + action native A_Overlay(int layer, state start = ""); + action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0); + action native A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0); + action native A_OverlayFlags(int layer, int flags, bool set); + native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); native int ACS_NamedSuspend(name script, int mapnum=0); native int ACS_NamedTerminate(name script, int mapnum=0); diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index d523afe5c..c98c88dd7 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -40,7 +40,6 @@ 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); @@ -49,10 +48,7 @@ ACTOR Inventory native action native A_RestoreSpecialDoomThing(); action native A_RestoreSpecialThing1(); action native A_RestoreSpecialThing2(); - action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0); - action native A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0); - action native A_OverlayFlags(int layer, int flags, bool set); - + States { HideDoomish: