Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</details>

<details><summary><b>Removed</b></summary>
Expand Down
27 changes: 12 additions & 15 deletions Source/Managers/MovableMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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) {
// 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();
}
}
});

{
ZoneScopedN("Actors Update");

Expand Down Expand Up @@ -1478,8 +1468,6 @@ void MovableMan::Update() {
particle->PostUpdate();
}
}

actorsSeeFuture.wait();
} // namespace RTE

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1679,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();

Expand Down
5 changes: 5 additions & 0 deletions Source/Managers/MovableMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "Singleton.h"
#include "Activity.h"

#include "BS_thread_pool.hpp"

#include <mutex>
#include <map>
#include <future>
Expand Down Expand Up @@ -596,6 +598,9 @@ namespace RTE {
// Async to draw MOIDs while rendering
std::future<void> m_DrawMOIDsTask;

// Async to have actors see in parallel
BS::multi_future<void> m_ActorsSeeFuture;

// Roster of each team's actors, sorted by their X positions in the scene. Actors not owned here
std::list<Actor*> m_ActorRoster[Activity::MaxTeamCount];
// Whether to draw HUD lines between the actors of a specific team
Expand Down
3 changes: 3 additions & 0 deletions Source/Menus/BuyMenuGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 0 additions & 13 deletions Source/System/RTETools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading