SHA256
Add Disable Tile Culling Option
This commit is contained in:
1 parent
7c6210d2c4
commit
d1ba5d5c18
7 files changed
+86
-2
No files matched your search
@@ -30,8 +30,19 @@ public static class scnGamePatch
|
||||
[HarmonyPatch("Play")]
|
||||
public static void ProcessFloors()
|
||||
{
|
||||
var nonTile = RenderManager.Instance.stage >= RenderStage.Load &&
|
||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||
if (RenderManager.Instance &&
|
||||
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||
RenderManager.Instance.Configuration?.AdvancedConfig?.DisableTileCulling == true)
|
||||
{
|
||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||
{
|
||||
if (floor) floor.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
var nonTile = RenderManager.Instance &&
|
||||
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||
RenderManager.Instance.Configuration?.AdvancedConfig?.NonTile == true;
|
||||
|
||||
if (!nonTile) return;
|
||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user