- 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

@ -256,6 +256,11 @@ void DScroller::Tick ()
case EScroll::sc_carry:
level.Scrolls[m_Affectee].X += dx;
level.Scrolls[m_Affectee].Y += dy;
// mark all potentially affected things here so that the very expensive calculation loop in AActor::Tick does not need to run for actors which do not touch a scrolling sector.
for (auto n = level.sectors[m_Affectee].touching_thinglist; n; n = n->m_snext)
{
n->m_thing->flags8 |= MF8_INSCROLLSEC;
}
break;
case EScroll::sc_carry_ceiling: // to be added later