From 1c057bb24ab342eaee686e367976678b52837810 Mon Sep 17 00:00:00 2001 From: SuperDude88 <82904174+SuperDude88@users.noreply.github.com> Date: Wed, 15 Apr 2026 22:00:05 -0400 Subject: [PATCH] Fix Unloading Gates (#397) * Fix Unloading Gates - Fix CitS/Lakebed gates not loading if you don't restart the game between the different instances Comment should be upstreamed to decomp (+ daDsh_c brief should be changed from "Death Sword Shutter Gate" which isn't accurate) * Clarify Comment - Add details about GC/Wii vs TPHD --- src/d/actor/d_a_dshutter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/d/actor/d_a_dshutter.cpp b/src/d/actor/d_a_dshutter.cpp index 4a0cf397f4..fc122cd4e3 100644 --- a/src/d/actor/d_a_dshutter.cpp +++ b/src/d/actor/d_a_dshutter.cpp @@ -215,7 +215,16 @@ int daDsh_c::create() { mType = getType(); +#ifdef TARGET_PC + const char* l_resName[] = {l_arcName[mType], ""}; +#else + // !@bug By making this static, it is only initialized the first time it runs + // If gate types that use other arcs are loaded later (without reloading the code) + // this array never gets updated and will load the incorrect arc + // On GC/Wii, REL loading causes this to reset/reinitialize so the bug is avoided + // but TPHD is all statically linked so daDsh_c::CreateHeap fails to get model data and the gate unloads static const char* l_resName[] = {l_arcName[mType], ""}; +#endif int phase = mResLoader.load(l_resName, NULL); if (phase == cPhs_COMPLEATE_e) {