mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Optimized P_CheckPosition. (#1161)
- If the actor passed into the function has THRUACTORS, PIT_CheckThing won't be called anymore. - Moved THRUACTORS check to just under the self clipping check in PIT_CheckThing.
This commit is contained in:
parent
c20a7f53c9
commit
4cbcb84dc9
1 changed files with 4 additions and 3 deletions
|
@ -1298,6 +1298,9 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
||||||
if (thing == tm.thing)
|
if (thing == tm.thing)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
||||||
return true; // can't hit thing
|
return true; // can't hit thing
|
||||||
|
|
||||||
|
@ -1305,9 +1308,6 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
||||||
if (fabs(thing->X() - cres.Position.X) >= blockdist || fabs(thing->Y() - cres.Position.Y) >= blockdist)
|
if (fabs(thing->X() - cres.Position.X) >= blockdist || fabs(thing->Y() - cres.Position.Y) >= blockdist)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ((tm.thing->flags6 & MF6_THRUSPECIES) && (tm.thing->GetSpecies() == thing->GetSpecies()))
|
if ((tm.thing->flags6 & MF6_THRUSPECIES) && (tm.thing->GetSpecies() == thing->GetSpecies()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1787,6 +1787,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo
|
||||||
FMultiBlockThingsIterator it2(pcheck, thing->Level, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, false, newsec);
|
FMultiBlockThingsIterator it2(pcheck, thing->Level, pos.X, pos.Y, thing->Z(), thing->Height, thing->radius, false, newsec);
|
||||||
FMultiBlockThingsIterator::CheckResult tcres;
|
FMultiBlockThingsIterator::CheckResult tcres;
|
||||||
|
|
||||||
|
if (!(thing->flags2 & MF2_THRUACTORS))
|
||||||
while ((it2.Next(&tcres)))
|
while ((it2.Next(&tcres)))
|
||||||
{
|
{
|
||||||
if (!PIT_CheckThing(it2, tcres, it2.Box(), tm))
|
if (!PIT_CheckThing(it2, tcres, it2.Box(), tm))
|
||||||
|
|
Loading…
Reference in a new issue