From 9bcb06d92a4b40c9bc9ba69627f43fac5bb89fbd Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 19 Mar 2022 20:52:13 -0400 Subject: [PATCH] CCubeRenderer: Limit dynamic light count in ActivateLightsForModel --- Runtime/Graphics/CCubeRenderer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Runtime/Graphics/CCubeRenderer.cpp b/Runtime/Graphics/CCubeRenderer.cpp index eb933a373..c30e98aa0 100644 --- a/Runtime/Graphics/CCubeRenderer.cpp +++ b/Runtime/Graphics/CCubeRenderer.cpp @@ -519,6 +519,10 @@ void CCubeRenderer::ActivateLightsForModel(const CAreaListItem* areaItem, CCubeM u32 lightIdx = 0; for (const auto& light : x300_dynamicLights) { + if (lightIdx >= LightCount) { + break; + } + if (lightOctreeWords == nullptr || TestBit(lightOctreeWords, model.GetIndex())) { bool loaded = false; const float radius =