mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- If A_SeekerMissile is used with the SMF_LOOK flag and its targets is unseekable, it now clears
its tracer so that it will look for a new target the next time it is called. - Extended P_RoughMonsterSearch() with a flag to indicate that it should only search for seekable targets. SVN r3572 (trunk)
This commit is contained in:
parent
86842bc1da
commit
5b86ce9f7d
5 changed files with 19 additions and 8 deletions
|
@ -335,7 +335,7 @@ static void CHolyFindTarget (AActor *actor)
|
||||||
{
|
{
|
||||||
AActor *target;
|
AActor *target;
|
||||||
|
|
||||||
if ( (target = P_RoughMonsterSearch (actor, 6)) )
|
if ( (target = P_RoughMonsterSearch (actor, 6, true)) )
|
||||||
{
|
{
|
||||||
actor->tracer = target;
|
actor->tracer = target;
|
||||||
actor->flags |= MF_NOCLIP|MF_SKULLFLY;
|
actor->flags |= MF_NOCLIP|MF_SKULLFLY;
|
||||||
|
|
|
@ -167,7 +167,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffTrack)
|
||||||
{
|
{
|
||||||
if ((self->tracer == 0) && (pr_mstafftrack()<50))
|
if ((self->tracer == 0) && (pr_mstafftrack()<50))
|
||||||
{
|
{
|
||||||
self->tracer = P_RoughMonsterSearch (self, 10);
|
self->tracer = P_RoughMonsterSearch (self, 10, true);
|
||||||
}
|
}
|
||||||
P_SeekerMissile (self, ANGLE_1*2, ANGLE_1*10);
|
P_SeekerMissile (self, ANGLE_1*2, ANGLE_1*10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ public:
|
||||||
#define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint
|
#define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint
|
||||||
|
|
||||||
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL);
|
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL);
|
||||||
AActor *P_RoughMonsterSearch (AActor *mo, int distance);
|
AActor *P_RoughMonsterSearch (AActor *mo, int distance, bool onlyseekable=false);
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_MAP
|
// P_MAP
|
||||||
|
|
|
@ -1401,9 +1401,9 @@ FPathTraverse::~FPathTraverse()
|
||||||
// distance is in MAPBLOCKUNITS
|
// distance is in MAPBLOCKUNITS
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
AActor *P_RoughMonsterSearch (AActor *mo, int distance)
|
AActor *P_RoughMonsterSearch (AActor *mo, int distance, bool onlyseekable)
|
||||||
{
|
{
|
||||||
return P_BlockmapSearch (mo, distance, RoughBlockCheck);
|
return P_BlockmapSearch (mo, distance, RoughBlockCheck, (void *)onlyseekable);
|
||||||
}
|
}
|
||||||
|
|
||||||
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params)
|
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params)
|
||||||
|
@ -1501,14 +1501,19 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static AActor *RoughBlockCheck (AActor *mo, int index, void *)
|
static AActor *RoughBlockCheck (AActor *mo, int index, void *param)
|
||||||
{
|
{
|
||||||
|
bool onlyseekable = param != NULL;
|
||||||
FBlockNode *link;
|
FBlockNode *link;
|
||||||
|
|
||||||
for (link = blocklinks[index]; link != NULL; link = link->NextActor)
|
for (link = blocklinks[index]; link != NULL; link = link->NextActor)
|
||||||
{
|
{
|
||||||
if (link->Me != mo)
|
if (link->Me != mo)
|
||||||
{
|
{
|
||||||
|
if (onlyseekable && !mo->CanSeek(link->Me))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (mo->IsOkayToAttack (link->Me))
|
if (mo->IsOkayToAttack (link->Me))
|
||||||
{
|
{
|
||||||
return link->Me;
|
return link->Me;
|
||||||
|
|
|
@ -501,9 +501,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
||||||
|
|
||||||
if ((flags & SMF_LOOK) && (self->tracer == 0) && (pr_seekermissile()<chance))
|
if ((flags & SMF_LOOK) && (self->tracer == 0) && (pr_seekermissile()<chance))
|
||||||
{
|
{
|
||||||
self->tracer = P_RoughMonsterSearch (self, distance);
|
self->tracer = P_RoughMonsterSearch (self, distance, true);
|
||||||
|
}
|
||||||
|
if (!P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1, !!(flags & SMF_PRECISE), !!(flags & SMF_CURSPEED)))
|
||||||
|
{
|
||||||
|
if (flags & SMF_LOOK)
|
||||||
|
{ // This monster is no longer seekable, so let us look for another one next time.
|
||||||
|
self->tracer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1, !!(flags & SMF_PRECISE), !!(flags & SMF_CURSPEED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue