From 29f6a4e0bad8759958c8628cc74919009e6daed3 Mon Sep 17 00:00:00 2001 From: ketmar Date: Wed, 6 Mar 2024 12:16:34 +0000 Subject: [PATCH] decorate: added `HasSpecialPowerup(type)` function (use `PWRT_BUDDHA`, `PWRT_REGEN`, `PWRT_INFAMMO` as `type`) FossilOrigin-Name: a5baceff11d7305c00d9a284dbe64317748a4c897aaf379dc03e4fc4a8d354af --- progs/common/linespec/actor/Actor.Decorate.Const.vc | 8 ++++++++ progs/common/linespec/actor/Actor.Decorate.vc | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/progs/common/linespec/actor/Actor.Decorate.Const.vc b/progs/common/linespec/actor/Actor.Decorate.Const.vc index f511db3b9..4a352ec01 100644 --- a/progs/common/linespec/actor/Actor.Decorate.Const.vc +++ b/progs/common/linespec/actor/Actor.Decorate.Const.vc @@ -640,3 +640,11 @@ enum [decorate] /*EWolfAttackFlags*/ { WAF_NORANDOM = 1, WAF_USEPUFF = 2, }; + + +// flags for HasSpecialPowerup +enum [decorate] { + PWRT_BUDDHA = 1, + PWRT_REGEN, + PWRT_INFAMMO, +}; diff --git a/progs/common/linespec/actor/Actor.Decorate.vc b/progs/common/linespec/actor/Actor.Decorate.vc index 03a31b7d7..bbda48f7d 100644 --- a/progs/common/linespec/actor/Actor.Decorate.vc +++ b/progs/common/linespec/actor/Actor.Decorate.vc @@ -2539,3 +2539,22 @@ final bool common_k8JumpIfLiquidFloor (EntityEx tgt, state label) { } return true; } + + +//========================================================================== +// +// decorate_HasSpecialPowerup +// +//========================================================================== +[decorate] final float decorate_HasSpecialPowerup (int type) { + PlayerEx pex = (bIsPlayer ? PlayerEx(Player) : none); + if (!pex || !pex.MO) return false; + PlayerPawn pawn = PlayerPawn(pex.MO); + if (!pawn) return false; + switch (type) { + case PWRT_BUDDHA: return (pawn.FindBuddhaPowerup() ? true : false); + case PWRT_REGEN: return (pawn.FindRegenerationPowerup() ? true : false); + case PWRT_INFAMMO: return (pawn.FindInfiniteAmmoPowerup() ? true : false); + } + return false; +} -- 2.11.4.GIT