From bb33ed04eb2370f2dd3d6f0b76407f76a912c1b4 Mon Sep 17 00:00:00 2001 From: Causeless Date: Sat, 30 Aug 2025 00:04:58 +0100 Subject: [PATCH 1/4] Fixed crash when an actor is removed mid-update --- Source/Managers/MovableMan.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/Managers/MovableMan.cpp b/Source/Managers/MovableMan.cpp index a1722d28e6..056ee80267 100644 --- a/Source/Managers/MovableMan.cpp +++ b/Source/Managers/MovableMan.cpp @@ -1399,14 +1399,14 @@ void MovableMan::Update() { [&](int start, int end) { ZoneScopedN("Actors See"); for (int i = start; i < end; ++i) { - // 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 - // this is VERY bad, and needs investigation! - if (m_Actors[i]) { - m_Actors[i]->CastSeeRays(); - } + m_Actors[i]->CastSeeRays(); } }); + // TODO- right now RemoveActor just removes to actor directly (instead of setting it disabled and delaying the actual remoal), meaning that actorsSeeFuture must be finished immediately + // This isn't ideal, as we'd prefer to be able to run the actor/items/particle update in parallel + actorsSeeFuture.wait(); + { ZoneScopedN("Actors Update"); @@ -1478,8 +1478,9 @@ void MovableMan::Update() { particle->PostUpdate(); } } - - actorsSeeFuture.wait(); + + // See above TODO - this is only commented out because of how RemoveActor currently works + //actorsSeeFuture.wait(); } // namespace RTE ////////////////////////////////////////////////////////////////////// From 05e118717534ac71b334d4e08cf8b8e4979647a2 Mon Sep 17 00:00:00 2001 From: Causeless Date: Sat, 30 Aug 2025 00:15:01 +0100 Subject: [PATCH 2/4] less aggressive fix that also improves worst-case performance by delaying see rays by one frame instead --- Source/Managers/MovableMan.cpp | 28 ++++++++++++---------------- Source/Managers/MovableMan.h | 5 +++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Source/Managers/MovableMan.cpp b/Source/Managers/MovableMan.cpp index 056ee80267..e68d56cf0d 100644 --- a/Source/Managers/MovableMan.cpp +++ b/Source/Managers/MovableMan.cpp @@ -12,7 +12,6 @@ #include "Controller.h" #include "AtomGroup.h" #include "Actor.h" -#include "HeldDevice.h" #include "ADoor.h" #include "Atom.h" #include "Scene.h" @@ -1314,6 +1313,9 @@ void MovableMan::Update() { g_SceneMan.GetScene()->BlockUntilAllPathingRequestsComplete(); } + // Finish our Seeing rays from last frame + m_ActorsSeeFuture.wait(); + // Prior to controller/AI update, execute lua callbacks g_LuaMan.ExecuteLuaScriptCallbacks(); @@ -1395,18 +1397,6 @@ void MovableMan::Update() { g_PerformanceMan.StopPerformanceMeasurement(PerformanceMan::ScriptsUpdate); { - auto actorsSeeFuture = g_ThreadMan.GetPriorityThreadPool().parallelize_loop(m_Actors.size(), - [&](int start, int end) { - ZoneScopedN("Actors See"); - for (int i = start; i < end; ++i) { - m_Actors[i]->CastSeeRays(); - } - }); - - // TODO- right now RemoveActor just removes to actor directly (instead of setting it disabled and delaying the actual remoal), meaning that actorsSeeFuture must be finished immediately - // This isn't ideal, as we'd prefer to be able to run the actor/items/particle update in parallel - actorsSeeFuture.wait(); - { ZoneScopedN("Actors Update"); @@ -1478,9 +1468,6 @@ void MovableMan::Update() { particle->PostUpdate(); } } - - // See above TODO - this is only commented out because of how RemoveActor currently works - //actorsSeeFuture.wait(); } // namespace RTE ////////////////////////////////////////////////////////////////////// @@ -1680,6 +1667,15 @@ void MovableMan::Update() { } } + // Run seeing rays for all actors + m_ActorsSeeFuture = g_ThreadMan.GetPriorityThreadPool().parallelize_loop(m_Actors.size(), + [&](int start, int end) { + ZoneScopedN("Actors See"); + for (int i = start; i < end; ++i) { + m_Actors[i]->CastSeeRays(); + } + }); + // We've finished stuff that can interact with lua script, so it's the ideal time to start a gc run g_LuaMan.StartAsyncGarbageCollection(); diff --git a/Source/Managers/MovableMan.h b/Source/Managers/MovableMan.h index 00e2ba6141..3a4183a5ce 100644 --- a/Source/Managers/MovableMan.h +++ b/Source/Managers/MovableMan.h @@ -9,6 +9,8 @@ #include "Singleton.h" #include "Activity.h" +#include "BS_thread_pool.hpp" + #include #include #include @@ -596,6 +598,9 @@ namespace RTE { // Async to draw MOIDs while rendering std::future m_DrawMOIDsTask; + // Async to have actors see in parallel + BS::multi_future m_ActorsSeeFuture; + // Roster of each team's actors, sorted by their X positions in the scene. Actors not owned here std::list m_ActorRoster[Activity::MaxTeamCount]; // Whether to draw HUD lines between the actors of a specific team From 0202334f250ae68243637c26dad240b78df81f9e Mon Sep 17 00:00:00 2001 From: Causeless Date: Sat, 30 Aug 2025 08:06:23 +0100 Subject: [PATCH 3/4] fixed issue where buy menu gui could ignore mouse events --- CHANGELOG.md | 2 ++ Source/Menus/BuyMenuGUI.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee814a444a..6650f99d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -254,6 +254,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 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. +- Fixed an issue where the buy menu GUI could ignore mouse hover events until you clicked to reset the focus. +
Removed diff --git a/Source/Menus/BuyMenuGUI.cpp b/Source/Menus/BuyMenuGUI.cpp index ae00f1cd35..7705401a15 100644 --- a/Source/Menus/BuyMenuGUI.cpp +++ b/Source/Menus/BuyMenuGUI.cpp @@ -744,6 +744,9 @@ void BuyMenuGUI::Update() { // Animate the menu into and out of view if enabled or disabled if (m_MenuEnabled == ENABLING) { + // Make sure that nobody can hoard focus away from us + m_pGUIController->GetManager()->ReleaseMouse(); + m_pParentBox->SetEnabled(true); m_pParentBox->SetVisible(true); From ab167ba4fe88e75f3aef1e57618c18f8ab6f3586 Mon Sep 17 00:00:00 2001 From: Causeless Date: Sat, 30 Aug 2025 14:26:32 +0100 Subject: [PATCH 4/4] lol --- Source/System/RTETools.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Source/System/RTETools.cpp b/Source/System/RTETools.cpp index a0b3a9c090..9e3e1572d5 100644 --- a/Source/System/RTETools.cpp +++ b/Source/System/RTETools.cpp @@ -50,19 +50,6 @@ namespace RTE { float angleDelta = std::fmod(endRot.GetRadAngle() - startRot.GetRadAngle(), fullTurn); float angleDistance = std::fmod(angleDelta * 2.0F, fullTurn) - angleDelta; return Matrix(startRot.GetRadAngle() + (angleDistance * Lerp(scaleStart, scaleEnd, 0.0F, 1.0F, progressScalar))); - - float startRad = startRot.GetRadAngle(); - float endRad = endRot.GetRadAngle(); - float diff = startRad - endRad; - if (diff > c_PI) { - std::swap(startRad, endRad); - diff -= c_PI; - } else if (diff < -c_PI) { - std::swap(startRad, endRad); - diff += c_PI; - } - - return Matrix(startRad + (diff * Lerp(scaleStart, scaleEnd, 0.0F, 1.0F, progressScalar))); } float EaseIn(float start, float end, float progressScalar) {