- migrated P_PlayerStartStomp to FMultiThingIterator.

Note: This replaces AActor::intersects with a direct calculation. Although that function could be adjusted it'd mean some redundant distance calculations which are easily avoided.
This commit is contained in:
Christoph Oelckers 2016-02-20 23:07:37 +01:00
parent f8a8d8eed2
commit 26967bd0ee
1 changed files with 8 additions and 4 deletions

View File

@ -531,11 +531,14 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
void P_PlayerStartStomp(AActor *actor, bool mononly) void P_PlayerStartStomp(AActor *actor, bool mononly)
{ {
AActor *th; FPortalGroupArray grouplist;
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius)); FMultiBlockThingsIterator mit(grouplist, actor);
FMultiBlockThingsIterator::CheckResult cres;
while ((th = it.Next())) while ((mit.Next(&cres)))
{ {
AActor *th = cres.thing;
if (!(th->flags & MF_SHOOTABLE)) if (!(th->flags & MF_SHOOTABLE))
continue; continue;
@ -543,7 +546,8 @@ void P_PlayerStartStomp(AActor *actor, bool mononly)
if (th == actor || (th->player == actor->player && th->player != NULL)) if (th == actor || (th->player == actor->player && th->player != NULL))
continue; continue;
if (!th->intersects(actor)) fixed_t blockdist = th->radius + actor->radius;
if (abs(th->X() - cres.position.x) >= blockdist || abs(th->Y() - cres.position.y) >= blockdist)
continue; continue;
// only kill monsters and other players // only kill monsters and other players