Skip to content

Commit 225836f

Browse files
authored
Merge pull request #213 from cortex-command-community/fixed-seeray-crash
Fixed Seeray Crash
2 parents 994ce49 + ab167ba commit 225836f

File tree

5 files changed

+22
-28
lines changed

5 files changed

+22
-28
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
254254

255255
- Fixed a minor inconsistency where `ACDropShip`s were frequently referred to as `ACDropship`s in Lua, the lower case 's' invalidating keywords where the typo occured.
256256

257+
- Fixed an issue where the buy menu GUI could ignore mouse hover events until you clicked to reset the focus.
258+
257259
</details>
258260

259261
<details><summary><b>Removed</b></summary>

Source/Managers/MovableMan.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "Controller.h"
1313
#include "AtomGroup.h"
1414
#include "Actor.h"
15-
#include "HeldDevice.h"
1615
#include "ADoor.h"
1716
#include "Atom.h"
1817
#include "Scene.h"
@@ -1314,6 +1313,9 @@ void MovableMan::Update() {
13141313
g_SceneMan.GetScene()->BlockUntilAllPathingRequestsComplete();
13151314
}
13161315

1316+
// Finish our Seeing rays from last frame
1317+
m_ActorsSeeFuture.wait();
1318+
13171319
// Prior to controller/AI update, execute lua callbacks
13181320
g_LuaMan.ExecuteLuaScriptCallbacks();
13191321

@@ -1395,18 +1397,6 @@ void MovableMan::Update() {
13951397
g_PerformanceMan.StopPerformanceMeasurement(PerformanceMan::ScriptsUpdate);
13961398

13971399
{
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-
14101400
{
14111401
ZoneScopedN("Actors Update");
14121402

@@ -1478,8 +1468,6 @@ void MovableMan::Update() {
14781468
particle->PostUpdate();
14791469
}
14801470
}
1481-
1482-
actorsSeeFuture.wait();
14831471
} // namespace RTE
14841472

14851473
//////////////////////////////////////////////////////////////////////
@@ -1679,6 +1667,15 @@ void MovableMan::Update() {
16791667
}
16801668
}
16811669

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+
16821679
// We've finished stuff that can interact with lua script, so it's the ideal time to start a gc run
16831680
g_LuaMan.StartAsyncGarbageCollection();
16841681

Source/Managers/MovableMan.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "Singleton.h"
1010
#include "Activity.h"
1111

12+
#include "BS_thread_pool.hpp"
13+
1214
#include <mutex>
1315
#include <map>
1416
#include <future>
@@ -596,6 +598,9 @@ namespace RTE {
596598
// Async to draw MOIDs while rendering
597599
std::future<void> m_DrawMOIDsTask;
598600

601+
// Async to have actors see in parallel
602+
BS::multi_future<void> m_ActorsSeeFuture;
603+
599604
// Roster of each team's actors, sorted by their X positions in the scene. Actors not owned here
600605
std::list<Actor*> m_ActorRoster[Activity::MaxTeamCount];
601606
// Whether to draw HUD lines between the actors of a specific team

Source/Menus/BuyMenuGUI.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,9 @@ void BuyMenuGUI::Update() {
744744
// Animate the menu into and out of view if enabled or disabled
745745

746746
if (m_MenuEnabled == ENABLING) {
747+
// Make sure that nobody can hoard focus away from us
748+
m_pGUIController->GetManager()->ReleaseMouse();
749+
747750
m_pParentBox->SetEnabled(true);
748751
m_pParentBox->SetVisible(true);
749752

Source/System/RTETools.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@ namespace RTE {
5050
float angleDelta = std::fmod(endRot.GetRadAngle() - startRot.GetRadAngle(), fullTurn);
5151
float angleDistance = std::fmod(angleDelta * 2.0F, fullTurn) - angleDelta;
5252
return Matrix(startRot.GetRadAngle() + (angleDistance * Lerp(scaleStart, scaleEnd, 0.0F, 1.0F, progressScalar)));
53-
54-
float startRad = startRot.GetRadAngle();
55-
float endRad = endRot.GetRadAngle();
56-
float diff = startRad - endRad;
57-
if (diff > c_PI) {
58-
std::swap(startRad, endRad);
59-
diff -= c_PI;
60-
} else if (diff < -c_PI) {
61-
std::swap(startRad, endRad);
62-
diff += c_PI;
63-
}
64-
65-
return Matrix(startRad + (diff * Lerp(scaleStart, scaleEnd, 0.0F, 1.0F, progressScalar)));
6653
}
6754

6855
float EaseIn(float start, float end, float progressScalar) {

0 commit comments

Comments
 (0)