diff --git a/src/gl/dynlights/gl_dynlight.cpp b/src/gl/dynlights/gl_dynlight.cpp index 3fffe3641..ae19ecf60 100644 --- a/src/gl/dynlights/gl_dynlight.cpp +++ b/src/gl/dynlights/gl_dynlight.cpp @@ -1081,6 +1081,7 @@ void gl_AttachLight(AActor *actor, unsigned int count, const FLightDefaults *lig light = Spawn(actor->Pos(), NO_REPLACE); light->target = actor; light->owned = true; + light->ObjectFlags |= OF_Transient; actor->dynamiclights.Push(light); } light->flags2&=~MF2_DORMANT; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 4b7bc762f..b53be4aaa 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -1199,7 +1199,6 @@ void FGLInterface::StateChanged(AActor *actor) void FGLInterface::StartSerialize(FSerializer &arc) { - gl_DeleteAllAttachedLights(); if (arc.BeginObject("glinfo")) { arc("fogdensity", fogdensity) @@ -1211,8 +1210,11 @@ void FGLInterface::StartSerialize(FSerializer &arc) void FGLInterface::EndSerialize(FSerializer &arc) { - gl_RecreateAllAttachedLights(); - if (arc.isReading()) gl_InitPortals(); + if (arc.isReading()) + { + gl_RecreateAllAttachedLights(); + gl_InitPortals(); + } } //===========================================================================