From 400f952990b032974465849e782a85a0e76aa3f65b4cb3f24f493f25f1ca265f Mon Sep 17 00:00:00 2001 From: copecone Date: Mon, 10 Aug 2026 03:08:42 +0900 Subject: [PATCH] Add NonTile Mode Prototype --- Patch/Game/scnGamePatch.cs | 49 +++++++++++++++++++++++++++++++++++++ Patch/Game/scrFloorPatch.cs | 14 ++++++++++- RenderMod.cs | 2 +- Util/ParticleUtil.cs | 26 ++++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 Util/ParticleUtil.cs diff --git a/Patch/Game/scnGamePatch.cs b/Patch/Game/scnGamePatch.cs index f86fcdb..8e5329b 100644 --- a/Patch/Game/scnGamePatch.cs +++ b/Patch/Game/scnGamePatch.cs @@ -2,6 +2,7 @@ using System.IO; using ADOFAIRenderer.Core; using ADOFAIRenderer.Util; using HarmonyLib; +using MelonLoader; using UnityEngine; namespace ADOFAIRenderer.Patch.Game @@ -10,6 +11,54 @@ namespace ADOFAIRenderer.Patch.Game // ReSharper disable once InconsistentNaming public static class scnGamePatch { + [HarmonyPostfix] + [HarmonyPatch("Play")] + public static void ProcessFloors() + { + var nonTile = RenderManager.Instance.OverrideLoading && + RenderManager.Instance.Configuration.AdvancedConfig.NonTile; + + if (!nonTile) return; + foreach (var floor in ADOBase.lm.listFloors) + { + DisableRenderers( + floor.floorRenderer.renderer, floor.legacyFloorSpriteRenderer, + floor.iconsprite, floor.outlineSprite, + floor.topGlow, floor.bottomGlow, + floor.multiplanetLine + ); + + if (floor.holdRenderer) DisableRenderer(floor.holdRenderer.m_meshRenderer); + + if (floor.dummyPlanets == null) continue; + foreach (var planet in floor.dummyPlanets) + DisablePlanetRenderer(planet); + } + + Melon.Logger.Msg("Tile Hide"); + return; + + void DisablePlanetRenderer(PlanetRenderer planet) + { + if (planet.sprite) DisableRenderer(planet.sprite.meshRenderer); + DisableRenderers( + planet.coreParticles.GetRenderer(), planet.tailParticles.GetRenderer(), + planet.tailParticlesCoop.GetRenderer(), planet.sparks.GetRenderer(), planet.ring, planet.glow, + planet.faceSprite, planet.faceDetails, planet.samuraiSprite + ); + } + + void DisableRenderers(params Renderer?[] renderers) + { + foreach (var renderer in renderers) DisableRenderer(renderer); + } + + void DisableRenderer(Renderer? renderer) + { + if (renderer) renderer.enabled = false; + } + } + [HarmonyPrefix] [HarmonyPatch("UpdateVideo")] // ReSharper disable once InconsistentNaming diff --git a/Patch/Game/scrFloorPatch.cs b/Patch/Game/scrFloorPatch.cs index 68189bb..f42d9fd 100644 --- a/Patch/Game/scrFloorPatch.cs +++ b/Patch/Game/scrFloorPatch.cs @@ -1,7 +1,19 @@ +using ADOFAIRenderer.Core; +using HarmonyLib; + namespace ADOFAIRenderer.Patch.Game { + [HarmonyPatch(typeof(scrFloor))] + // ReSharper disable once InconsistentNaming public class scrFloorPatch { - + [HarmonyPrefix] + [HarmonyPatch("SpawnPortalParticles")] + public static bool SkipPortalSpawn() + { + var nonTile = RenderManager.Instance.OverrideLoading && + RenderManager.Instance.Configuration.AdvancedConfig.NonTile; + return !nonTile; + } } } \ No newline at end of file diff --git a/RenderMod.cs b/RenderMod.cs index fc9d506..71eb859 100644 --- a/RenderMod.cs +++ b/RenderMod.cs @@ -7,7 +7,7 @@ using MelonLoader.Utils; using UnityEngine; using UnityEngine.EventSystems; -[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.10-INDEV", "ADOFAI Editor Forum")] +[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.11-INDEV", "ADOFAI Editor Forum")] [assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")] namespace ADOFAIRenderer diff --git a/Util/ParticleUtil.cs b/Util/ParticleUtil.cs new file mode 100644 index 0000000..14a5986 --- /dev/null +++ b/Util/ParticleUtil.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.CompilerServices; +using UnityEngine; + +namespace ADOFAIRenderer.Util +{ + public static class ParticleUtil + { + private static readonly ConditionalWeakTable Cache = new(); + + public static ParticleSystemRenderer? GetRenderer(this ParticleSystem ps) + { + if (!ps) return null; + if (Cache.TryGetValue(ps, out var renderer) && renderer) return renderer; + + var particleSystems = ps.GetComponents(); + var renderers = ps.GetComponents(); + var index = Array.IndexOf(particleSystems, ps); + + renderer = index >= 0 && index < renderers.Length ? renderers[index] : ps.GetComponent(); + if (renderer) Cache.Add(ps, renderer); + + return renderer; + } + } +}