|
12 | 12 | #include "Controller.h" |
13 | 13 | #include "AtomGroup.h" |
14 | 14 | #include "Actor.h" |
15 | | -#include "HeldDevice.h" |
16 | 15 | #include "ADoor.h" |
17 | 16 | #include "Atom.h" |
18 | 17 | #include "Scene.h" |
@@ -1314,6 +1313,9 @@ void MovableMan::Update() { |
1314 | 1313 | g_SceneMan.GetScene()->BlockUntilAllPathingRequestsComplete(); |
1315 | 1314 | } |
1316 | 1315 |
|
| 1316 | + // Finish our Seeing rays from last frame |
| 1317 | + m_ActorsSeeFuture.wait(); |
| 1318 | + |
1317 | 1319 | // Prior to controller/AI update, execute lua callbacks |
1318 | 1320 | g_LuaMan.ExecuteLuaScriptCallbacks(); |
1319 | 1321 |
|
@@ -1395,18 +1397,6 @@ void MovableMan::Update() { |
1395 | 1397 | g_PerformanceMan.StopPerformanceMeasurement(PerformanceMan::ScriptsUpdate); |
1396 | 1398 |
|
1397 | 1399 | { |
1398 | | - auto actorsSeeFuture = g_ThreadMan.GetPriorityThreadPool().parallelize_loop(m_Actors.size(), |
1399 | | - [&](int start, int end) { |
1400 | | - ZoneScopedN("Actors See"); |
1401 | | - for (int i = start; i < end; ++i) { |
1402 | | - // TODO - this null check really shouldn't be required. There's almost definitely an issue where the actor update can somehow fuck with this mid-update |
1403 | | - // this is VERY bad, and needs investigation! |
1404 | | - if (m_Actors[i]) { |
1405 | | - m_Actors[i]->CastSeeRays(); |
1406 | | - } |
1407 | | - } |
1408 | | - }); |
1409 | | - |
1410 | 1400 | { |
1411 | 1401 | ZoneScopedN("Actors Update"); |
1412 | 1402 |
|
@@ -1478,8 +1468,6 @@ void MovableMan::Update() { |
1478 | 1468 | particle->PostUpdate(); |
1479 | 1469 | } |
1480 | 1470 | } |
1481 | | - |
1482 | | - actorsSeeFuture.wait(); |
1483 | 1471 | } // namespace RTE |
1484 | 1472 |
|
1485 | 1473 | ////////////////////////////////////////////////////////////////////// |
@@ -1679,6 +1667,15 @@ void MovableMan::Update() { |
1679 | 1667 | } |
1680 | 1668 | } |
1681 | 1669 |
|
| 1670 | + // Run seeing rays for all actors |
| 1671 | + m_ActorsSeeFuture = g_ThreadMan.GetPriorityThreadPool().parallelize_loop(m_Actors.size(), |
| 1672 | + [&](int start, int end) { |
| 1673 | + ZoneScopedN("Actors See"); |
| 1674 | + for (int i = start; i < end; ++i) { |
| 1675 | + m_Actors[i]->CastSeeRays(); |
| 1676 | + } |
| 1677 | + }); |
| 1678 | + |
1682 | 1679 | // We've finished stuff that can interact with lua script, so it's the ideal time to start a gc run |
1683 | 1680 | g_LuaMan.StartAsyncGarbageCollection(); |
1684 | 1681 |
|
|
0 commit comments