private static void Distort_Render(On.Celeste.Distort.orig_Render orig, Texture2D source, Texture2D map, bool hasDistortion) { if (GameplayRendererExt.RenderDebug || Settings.SimplifiedGraphics) { Distort.Anxiety = 0f; Distort.GameRate = 1f; hasDistortion = false; } orig(source, map, hasDistortion); }
private void OnDistortRender(On.Celeste.Distort.orig_Render orig, Texture2D source, Texture2D map, bool hasDistortion) { if (!Celeste.Settings.Instance.DisableFlashes) { var anxietyField = typeof(Celeste.Distort).GetField("anxiety", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); float anxiety = (float)anxietyField.GetValue(null); float anxietyBonus = Math.Max(0, Session.AnxietyBonus * 0.5f + Session.AnxietyBonus * 0.5f * Session.AnxietyStutter); float anxietyForUse = anxiety + anxietyBonus; Celeste.GFX.FxDistort.Parameters["anxiety"].SetValue(anxietyForUse); anxietyField.SetValue(null, anxietyForUse); orig(source, map, hasDistortion); Celeste.GFX.FxDistort.Parameters["anxiety"].SetValue(anxiety); anxietyField.SetValue(null, anxiety); } else { orig(source, map, hasDistortion); } }