mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +00:00
- run the dynamic light recreation loop before calling the light ticker.
This was done afterward which performed some needed cleanup too late.
This commit is contained in:
parent
1097bd6c73
commit
139f501ec5
2 changed files with 21 additions and 16 deletions
|
@ -175,22 +175,6 @@ void P_Ticker (void)
|
||||||
{
|
{
|
||||||
P_UpdateSpecials(Level);
|
P_UpdateSpecials(Level);
|
||||||
}
|
}
|
||||||
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
|
// for par times
|
||||||
Level->time++;
|
Level->time++;
|
||||||
|
|
|
@ -107,6 +107,25 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
||||||
|
|
||||||
ThinkCycles.Clock();
|
ThinkCycles.Clock();
|
||||||
|
|
||||||
|
auto recreateLights = [=]() {
|
||||||
|
auto 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 (auto 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!profilethinkers)
|
if (!profilethinkers)
|
||||||
{
|
{
|
||||||
// Tick every thinker left from last time
|
// Tick every thinker left from last time
|
||||||
|
@ -127,6 +146,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
||||||
|
|
||||||
if (Level->HasDynamicLights)
|
if (Level->HasDynamicLights)
|
||||||
{
|
{
|
||||||
|
recreateLights();
|
||||||
for (auto light = Level->lights; light;)
|
for (auto light = Level->lights; light;)
|
||||||
{
|
{
|
||||||
auto next = light->next;
|
auto next = light->next;
|
||||||
|
@ -156,6 +176,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
||||||
|
|
||||||
if (Level->lights && Level->HasDynamicLights)
|
if (Level->lights && Level->HasDynamicLights)
|
||||||
{
|
{
|
||||||
|
recreateLights();
|
||||||
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
|
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
|
||||||
auto &prof = Profiles[NAME_InternalDynamicLight];
|
auto &prof = Profiles[NAME_InternalDynamicLight];
|
||||||
prof.timer.Clock();
|
prof.timer.Clock();
|
||||||
|
|
Loading…
Reference in a new issue