Add Disable Tile Culling Option

This commit is contained in:
copecone committed 2026-10-19 18:14:02 +09:00
1 parent 7c6210d2c4
commit d1ba5d5c18
7 files changed
+86 -2

No files matched your search

+37
View File
@@ -33,4 +33,41 @@ public class scrFloorPatch
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
return !nonTile;
}
/// <summary>
/// Postfix of <c>scrFloor.Start</c>.
/// The game sets <c>enabled = isVisible</c> in Start(), which disables all off-screen tiles right at spawn.
/// When <c>DisableTileCulling</c> is enabled, force every floor to remain enabled.
/// </summary>
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void ForceEnableOnStart(scrFloor __instance)
{
if (RenderManager.Instance &&
RenderManager.Instance.stage >= RenderStage.Load &&
RenderManager.Instance.Configuration.AdvancedConfig.DisableTileCulling)
{
__instance.enabled = true;
}
}
/// <summary>
/// Prefix of <c>scrFloor.OnBecameInvisible</c>.
/// Skips disabling the floor component (<c>enabled = false</c>) while rendering with
/// <c>AdvancedConfig.DisableTileCulling</c> enabled, preventing the 1-frame update lag/glitch
/// when tiles enter the camera view.
/// </summary>
[HarmonyPrefix]
[HarmonyPatch("OnBecameInvisible")]
// ReSharper disable once InconsistentNaming
public static bool PreventTileCulling(scrFloor __instance)
{
if (RenderManager.Instance &&
RenderManager.Instance.stage >= RenderStage.Load &&
RenderManager.Instance.Configuration.AdvancedConfig.DisableTileCulling)
{
return false;
}
return true;
}
}