- major optimization on carry scroller code.

The old version was checking every single actor in every single sector for being affected by a carry scroller if there was so much as a single such scroller in the map.
Changed it so that the scroll thinker flags all actors in the affected sectors so that these expensive calculations can be skipped for everything else.
This change and reduce think time by 1/3 on maps like ZDCMP2 (on the test machine it went down from 6 ms to 4 ms on this map.)
This commit is contained in:
Christoph Oelckers 2017-05-19 16:31:44 +02:00
commit e1cd0dc588
3 changed files with 14 additions and 1 deletions

View file

@ -4098,6 +4098,7 @@ void AActor::Tick ()
CheckPortalTransition(false);
LinkToWorld(&ctx);
}
flags8 &= MF8_INSCROLLSEC;
}
else
{
@ -4250,12 +4251,16 @@ void AActor::Tick ()
// [RH] Consider carrying sectors here
DVector2 cumm(0, 0);
if ((level.Scrolls.Size() != 0 || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
if ((((flags8 & MF8_INSCROLLSEC) && level.Scrolls.Size() > 0) || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
{
double height, waterheight; // killough 4/4/98: add waterheight
const msecnode_t *node;
int countx, county;
// Clear the flag for the next frame.
flags8 &= MF8_INSCROLLSEC;
// killough 3/7/98: Carry things on floor
// killough 3/20/98: use new sector list which reflects true members
// killough 3/27/98: fix carrier bug
@ -5079,6 +5084,8 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a
{
level.total_secrets++;
}
// force scroller check in the first tic.
actor->flags8 |= MF8_INSCROLLSEC;
return actor;
}