- fixed attached dynamic light setup.

This was only run on a state change and missed every external light change.
Any place which wants to flag a light change now only will set a flag and at the end of the thinker loop all flagged actors will be processed.
For performance reasons this was merged with the P_RunEffects iterator loop.
This commit is contained in:
Christoph Oelckers 2019-08-18 13:48:52 +02:00
commit ae57bc71d4
6 changed files with 29 additions and 36 deletions

View file

@ -134,7 +134,6 @@ void P_Ticker (void)
for (auto Level : AllLevels())
{
// todo: set up a sandbox for secondary levels here.
auto it = Level->GetThinkerIterator<AActor>();
AActor *ac;
@ -142,6 +141,7 @@ void P_Ticker (void)
{
ac->ClearInterpolation();
}
P_ThinkParticles(Level); // [RH] make the particles think
for (i = 0; i < MAXPLAYERS; i++)
@ -157,7 +157,22 @@ void P_Ticker (void)
if (!Level->isFrozen())
{
P_UpdateSpecials(Level);
P_RunEffects(Level); // [RH] Run particle effects
}
it = Level->GetThinkerIterator<AActor>();
// Set dynamic lights at the end of the tick, so that this catches all changes being made through the last frame.
while ((ac = it.Next()))
{
if (ac->flags8 & MF8_RECREATELIGHTS)
{
ac->flags8 &= ~MF8_RECREATELIGHTS;
ac->SetDynamicLights();
}
// This was merged from P_RunEffects to eliminate the costly duplicate ThinkerIterator loop.
if ((ac->effects || ac->fountaincolor) && !Level->isFrozen())
{
P_RunEffect(ac, ac->effects);
}
}
// for par times