From f101ed7c8335e5b224ec5bdd0f612cf4313ebf08 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 07:23:38 -0700 Subject: [PATCH] fix: clear spell visual instances on map change/world entry Active spell visual M2 instances were never cleaned up when the player teleported to a different map or re-entered the world. Orphaned effects could linger visually from the previous combat session. Now properly removes all active spell visual instances in resetCombatVisualState(), which is called on every world entry. --- src/rendering/renderer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index 6583f4bf..d9520348 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -3017,6 +3017,12 @@ void Renderer::resetCombatVisualState() { targetPosition = nullptr; meleeSwingTimer = 0.0f; meleeSwingCooldown = 0.0f; + // Clear lingering spell visual instances from the previous map/combat session. + // Without this, old effects could remain visible after teleport or map change. + for (auto& sv : activeSpellVisuals_) { + if (m2Renderer) m2Renderer->removeInstance(sv.instanceId); + } + activeSpellVisuals_.clear(); } bool Renderer::isMoving() const {