mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 14:41:40 +00:00
- 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:
parent
9fc309d5b5
commit
e1cd0dc588
3 changed files with 14 additions and 1 deletions
|
@ -401,6 +401,7 @@ enum ActorFlag7
|
|||
enum ActorFlag8
|
||||
{
|
||||
MF8_FRIGHTENING = 0x00000001, // for those moments when halloween just won't do
|
||||
MF8_INSCROLLSEC = 0x00000002, // actor is partially inside a scrolling sector
|
||||
};
|
||||
|
||||
// --- mobj.renderflags ---
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue