From 4f778fcc9d885a5719ccf4d74c77ce3a35db1952 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sat, 18 Jan 2025 18:02:29 +0100 Subject: [PATCH] Fixed crash when switching maps and editLights is still running. close #960 --- neo/d3xp/Game_local.cpp | 12 ++++++++++++ neo/tools/imgui/ImGuiTools.cpp | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index cdf05d86..39fc5598 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/d3xp/Game_local.cpp @@ -1715,6 +1715,18 @@ void idGameLocal::MapShutdown() gameRenderWorld->DebugClearPolygons( 0 ); } + // RB: kill ingame editors to prevent crashes during shutdown + if( com_editors != 0 ) + { + com_editors = 0; + g_editEntityMode.SetInteger( 0 ); + + // turn off light debug drawing in the render backend + r_singleLight.SetInteger( -1 ); + r_showLights.SetInteger( 0 ); + } + // RB end + // clear out camera if we're in a cinematic if( inCinematic ) { diff --git a/neo/tools/imgui/ImGuiTools.cpp b/neo/tools/imgui/ImGuiTools.cpp index 0bfee222..04af9ddd 100644 --- a/neo/tools/imgui/ImGuiTools.cpp +++ b/neo/tools/imgui/ImGuiTools.cpp @@ -74,6 +74,11 @@ bool ReleaseMouseForTools() void DrawToolWindows() { + if( !AreEditorsActive() ) + { + return; + } + if( LightEditor::Instance().IsShown() ) { LightEditor::Instance().Draw();