From 9af7c9ecdcdf16163e91913f516e79eb3e23c9db Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sat, 25 Apr 2026 09:30:10 -0700 Subject: [PATCH] Fixed a bug were loading a map in radiant wouldn't clear the new cache. --- neo/tools/radiant/CamWnd.cpp | 10 +++++++--- neo/tools/radiant/CamWnd.h | 4 ++-- neo/tools/radiant/EditorBrush.cpp | 2 +- neo/tools/radiant/EditorMap.cpp | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/neo/tools/radiant/CamWnd.cpp b/neo/tools/radiant/CamWnd.cpp index 9b02d94d..14440133 100644 --- a/neo/tools/radiant/CamWnd.cpp +++ b/neo/tools/radiant/CamWnd.cpp @@ -2343,10 +2343,14 @@ void CCamWnd::FreeRendererState() { s_editorEntityStates.RemoveIndex(i); } - for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { - ent->modelDef = -1; - ent->lightDef = -1; + if (entities.next != NULL) + { + for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { + ent->modelDef = -1; + ent->lightDef = -1; + } } + for (int i = s_editorBModelStates.Num() - 1; i >= 0; i--) { EditorFreeBModelState(i); diff --git a/neo/tools/radiant/CamWnd.h b/neo/tools/radiant/CamWnd.h index 2b325e32..3dd2a18c 100644 --- a/neo/tools/radiant/CamWnd.h +++ b/neo/tools/radiant/CamWnd.h @@ -129,6 +129,8 @@ public: m_Camera.angles = angles; } + bool CullBrush(brush_t* b, bool cubicOnly); + void FreeRendererState(); protected: void Cam_Init(); void Cam_BuildMatrix(); @@ -138,7 +140,6 @@ protected: void Cam_MouseUp (int x, int y, int buttons); void Cam_MouseMoved (int x, int y, int buttons); void InitCull(); - bool CullBrush (brush_t *b, bool cubicOnly); void Cam_Draw(); void Cam_Render(); @@ -154,7 +155,6 @@ protected: bool selectMode; bool animationMode; bool soundMode; - void FreeRendererState(); void UpdateCaption(); bool BuildBrushRenderData(brush_t *brush); void DrawEntityData(); diff --git a/neo/tools/radiant/EditorBrush.cpp b/neo/tools/radiant/EditorBrush.cpp index 8ca105a1..79aadbf3 100644 --- a/neo/tools/radiant/EditorBrush.cpp +++ b/neo/tools/radiant/EditorBrush.cpp @@ -3928,7 +3928,7 @@ void Control_Draw(brush_t *b) { } glColor4f(1, 1, .5, 1); - glBegin(GL_POLYGON); + glBegin(GL_QUADS); for (i = 0; i < w->GetNumPoints(); i++) { glVertex3fv( (*w)[i].ToFloatPtr() ); } diff --git a/neo/tools/radiant/EditorMap.cpp b/neo/tools/radiant/EditorMap.cpp index 12bc31be..d58d6b2e 100644 --- a/neo/tools/radiant/EditorMap.cpp +++ b/neo/tools/radiant/EditorMap.cpp @@ -222,6 +222,8 @@ void Map_Free(void) { } } + g_pParentWnd->GetCamera()->FreeRendererState(); + // clear all the render and sound system data g_qeglobals.rw->InitFromMap( NULL ); g_qeglobals.sw->ClearAllSoundEmitters();