mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
Finalize loop and prioritize missile searching.
This commit is contained in:
parent
846f14c03d
commit
2da868656e
1 changed files with 31 additions and 8 deletions
|
@ -4977,6 +4977,19 @@ enum RadiusGiveFlags
|
|||
|
||||
static bool DoRadiusGive(AActor *self, AActor *thing, const PClass *item, int amount, fixed_t distance, int flags, const PClass *filter, FName species, fixed_t mindist)
|
||||
{
|
||||
// [MC] We only want to make an exception for missiles here. Nothing else.
|
||||
bool missilePass = !!((flags & RGF_MISSILES) && thing->isMissile());
|
||||
if (thing == self)
|
||||
{
|
||||
if (!(flags & RGF_GIVESELF))
|
||||
return false;
|
||||
}
|
||||
else if (thing->isMissile())
|
||||
{
|
||||
if (!missilePass)
|
||||
return false;
|
||||
}
|
||||
|
||||
//[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s).
|
||||
bool filterpass = DoCheckClass(thing, filter, !!(flags & RGF_EXFILTER)),
|
||||
speciespass = DoCheckSpecies(thing, species, !!(flags & RGF_EXSPECIES));
|
||||
|
@ -4987,12 +5000,6 @@ static bool DoRadiusGive(AActor *self, AActor *thing, const PClass *item, int am
|
|||
return false;
|
||||
}
|
||||
|
||||
if (thing == self)
|
||||
{
|
||||
if (!(flags & RGF_GIVESELF))
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check for target, master, and tracer flagging.
|
||||
bool targetPass = true;
|
||||
bool masterPass = true;
|
||||
|
@ -5039,7 +5046,6 @@ static bool DoRadiusGive(AActor *self, AActor *thing, const PClass *item, int am
|
|||
}
|
||||
|
||||
bool itemPass = !!((flags & RGF_ITEMS) && thing->IsKindOf(RUNTIME_CLASS(AInventory)));
|
||||
bool missilePass = !!((flags & RGF_MISSILES) && thing->flags & MF_MISSILE);
|
||||
|
||||
if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass)
|
||||
{
|
||||
|
@ -5120,7 +5126,24 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
}
|
||||
AActor *thing;
|
||||
bool given = false;
|
||||
|
||||
if (flags & RGF_MISSILES)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
while ((thing = it.Next()))
|
||||
{
|
||||
bool giving = !!(DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist));
|
||||
if (giving) given = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), distance));
|
||||
while ((thing = it.Next()))
|
||||
{
|
||||
bool giving = !!(DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist));
|
||||
if (giving) given = true;
|
||||
}
|
||||
}
|
||||
ACTION_SET_RESULT(given);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue