diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index e05f6071a..5c8cd9614 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1697,7 +1697,7 @@ void APowerRegeneration::DoEffect() { if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0) { - if (P_GiveBody(Owner, Strength)) + if (P_GiveBody(Owner, Strength/FRACUNIT)) { S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM ); } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4cb949539..8a015bae4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -46,6 +46,7 @@ #include "p_acs.h" #include "p_saveg.h" #include "p_lnspec.h" +#include "p_enemy.h" #include "m_random.h" #include "doomstat.h" #include "c_console.h" @@ -4233,6 +4234,7 @@ enum EACSFunctions ACSF_PlayActorSound, ACSF_SpawnDecal, ACSF_CheckFont, + ACSF_DropItem, // ZDaemon ACSF_GetTeamScore = 19620, // (int team) @@ -5235,6 +5237,39 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) // bool CheckFont(str fontname) return V_GetFont(FBehavior::StaticLookupString(args[0])) != NULL; + case ACSF_DropItem: + { + const char *type = FBehavior::StaticLookupString(args[1]); + int amount = argCount >= 3? args[2] : -1; + int chance = argCount >= 4? args[3] : -1; + const PClass *cls = PClass::FindClass(type); + int cnt = 0; + if (cls != NULL) + { + if (args[0] == 0) + { + if (activator != NULL) + { + P_DropItem(activator, cls, amount, chance); + cnt++; + } + } + else + { + FActorIterator it(args[0]); + AActor *actor; + + while ((actor = it.Next()) != NULL) + { + P_DropItem(actor, cls, amount, chance); + cnt++; + } + } + return cnt; + } + break; + } + default: break; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 476c29eaf..456a1d6e3 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4951,3 +4951,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) self->DamageType = damagetype; } + +//========================================================================== +// +// A_DropItem +// +//========================================================================== + +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) +{ + ACTION_PARAM_START(3); + ACTION_PARAM_CLASS(spawntype, 0); + ACTION_PARAM_INT(amount, 1); + ACTION_PARAM_INT(chance, 2); + + P_DropItem(self, spawntype, amount, chance); +} diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 0ea018422..31051a1a1 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -300,6 +300,7 @@ ACTOR Actor native //: Thinker action native A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); action native A_SetTics(int tics); action native A_SetDamageType(name damagetype); + action native A_DropItem(class item, int dropamount = -1, int chance = -1); action native A_CheckSightOrRange(float distance, state label); action native A_CheckRange(float distance, state label);