Decompiled source of WiresCameraTweaks v0.2.1

WiresCameraTweaks.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityStandardAssets.ImageEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("WiresCameraTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d5f8042d94987c733d70f30120d6d47ed5f0e064")]
[assembly: AssemblyProduct("WiresCameraTweaks")]
[assembly: AssemblyTitle("WiresCameraTweaks")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WiresShakeItUp
{
	internal static class ZoomEngine
	{
		internal struct Capture
		{
			internal bool Active;

			internal float Target;
		}

		private sealed class State
		{
			internal bool Initialized;

			internal float Visual;
		}

		private static readonly FieldRef<GameCamera, float> Distance = AccessTools.FieldRefAccess<GameCamera, float>("m_distance");

		private static ConditionalWeakTable<GameCamera, State> States = new ConditionalWeakTable<GameCamera, State>();

		internal static Capture Begin(GameCamera camera, float dt)
		{
			Capture result = default(Capture);
			if ((Object)(object)camera == (Object)null || ModConfig.SmoothZoomEnabled == null || !ModConfig.SmoothZoomEnabled.Value || (Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).InIntro())
			{
				return result;
			}
			float num = Distance.Invoke(camera);
			State orCreateValue = States.GetOrCreateValue(camera);
			if (!orCreateValue.Initialized)
			{
				orCreateValue.Initialized = true;
				orCreateValue.Visual = num;
			}
			orCreateValue.Visual = EaseToward(orCreateValue.Visual, num, dt, ModConfig.ZoomResponse.Value);
			result.Active = true;
			result.Target = num;
			Distance.Invoke(camera) = orCreateValue.Visual;
			return result;
		}

		internal static void End(GameCamera camera, Capture capture)
		{
			if (capture.Active && (Object)(object)camera != (Object)null)
			{
				Distance.Invoke(camera) = capture.Target;
			}
		}

		internal static float EaseToward(float current, float target, float dt, float response)
		{
			float num = Mathf.Sin(Mathf.Clamp01(Mathf.Max(0f, dt) * Mathf.Max(0.01f, response)) * (float)Math.PI * 0.5f);
			float num2 = Mathf.Lerp(current, target, num);
			if (Mathf.Abs(num2 - target) < 0.002f)
			{
				num2 = target;
			}
			return num2;
		}

		internal static void Reset()
		{
			States = new ConditionalWeakTable<GameCamera, State>();
		}
	}
	internal static class CollisionAutoZoomEngine
	{
		internal struct Capture
		{
			internal Vector3 OffsetEye;

			internal Vector3 RequestedEnd;
		}

		private sealed class State
		{
			internal bool Active;

			internal float VisualDistance;

			internal int LastFrame = -1000;
		}

		private const float CollisionEpsilon = 0.015f;

		private static ConditionalWeakTable<GameCamera, State> States = new ConditionalWeakTable<GameCamera, State>();

		internal static Capture Begin(Vector3 offsetEye, Vector3 requestedEnd)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return new Capture
			{
				OffsetEye = offsetEye,
				RequestedEnd = requestedEnd
			};
		}

		internal static void End(GameCamera camera, ref Vector3 end, Capture capture)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)camera == (Object)null || ModConfig.CollisionAutoZoomEnabled == null || !ModConfig.CollisionAutoZoomEnabled.Value)
			{
				return;
			}
			Vector3 val = capture.RequestedEnd - capture.OffsetEye;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude <= 0.001f)
			{
				return;
			}
			float num = Mathf.Clamp(Vector3.Distance(capture.OffsetEye, end), 0f, magnitude);
			bool flag = num < magnitude - 0.015f;
			State orCreateValue = States.GetOrCreateValue(camera);
			if (Time.frameCount - orCreateValue.LastFrame > 2)
			{
				orCreateValue.Active = false;
				orCreateValue.VisualDistance = num;
			}
			orCreateValue.LastFrame = Time.frameCount;
			if (!orCreateValue.Active)
			{
				if (flag)
				{
					orCreateValue.Active = true;
					orCreateValue.VisualDistance = num;
				}
				return;
			}
			if (num < orCreateValue.VisualDistance)
			{
				orCreateValue.VisualDistance = num;
			}
			else
			{
				orCreateValue.VisualDistance = ZoomEngine.EaseToward(orCreateValue.VisualDistance, num, Time.unscaledDeltaTime, ModConfig.CollisionAutoZoomResponse.Value);
			}
			if (!flag && Mathf.Abs(orCreateValue.VisualDistance - magnitude) < 0.002f)
			{
				orCreateValue.VisualDistance = magnitude;
				orCreateValue.Active = false;
			}
			else
			{
				end = capture.OffsetEye + val / magnitude * Mathf.Min(orCreateValue.VisualDistance, num);
			}
		}

		internal static void Reset()
		{
			States = new ConditionalWeakTable<GameCamera, State>();
		}
	}
	[HarmonyPatch]
	internal static class CameraPositionPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.DeclaredMethod(typeof(GameCamera), "GetCameraPosition", new Type[3]
			{
				typeof(float),
				typeof(Vector3).MakeByRefType(),
				typeof(Quaternion).MakeByRefType()
			}, (Type[])null);
		}

		[HarmonyPrefix]
		private static void Prefix(GameCamera __instance, float dt, out ZoomEngine.Capture __state)
		{
			__state = ZoomEngine.Begin(__instance, dt);
		}

		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance, ZoomEngine.Capture __state)
		{
			ZoomEngine.End(__instance, __state);
		}
	}
	[HarmonyPatch(typeof(GameCamera), "CollideRay2")]
	internal static class CollisionAutoZoomPatch
	{
		[HarmonyPrefix]
		private static void Prefix(Vector3 offsetedEyePos, Vector3 end, out CollisionAutoZoomEngine.Capture __state)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			__state = CollisionAutoZoomEngine.Begin(offsetedEyePos, end);
		}

		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance, ref Vector3 end, CollisionAutoZoomEngine.Capture __state)
		{
			CollisionAutoZoomEngine.End(__instance, ref end, __state);
		}
	}
	[HarmonyPatch(typeof(CameraEffects), "UpdateDOF")]
	internal static class DepthOfFieldPatch
	{
		private static readonly FieldRef<CameraEffects, DepthOfField> DofRef = AccessTools.FieldRefAccess<CameraEffects, DepthOfField>("m_dof");

		private static float _lastTime = -1f;

		[HarmonyPrefix]
		private static bool Prefix(CameraEffects __instance)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (!ModConfig.DofEnabled.Value)
			{
				_lastTime = -1f;
				return true;
			}
			DepthOfField val = DofRef.Invoke(__instance);
			if ((Object)(object)val == (Object)null || !((Behaviour)val).enabled || !__instance.m_dofAutoFocus)
			{
				_lastTime = -1f;
				return false;
			}
			Transform transform = ((Component)__instance).transform;
			float num = __instance.m_dofMaxDistance;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(transform.position, transform.forward, ref val2, __instance.m_dofMaxDistance, LayerMask.op_Implicit(__instance.m_dofRayMask)))
			{
				num = ((RaycastHit)(ref val2)).distance;
			}
			float num2 = __instance.m_dofMinDistance;
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || (Object)(object)localPlayer.GetControlledShip() != (Object)null)
			{
				num2 = Mathf.Max(num2, __instance.m_dofMinDistanceShip);
			}
			num = Mathf.Max(new float[3] { num, num2, 0.1f });
			float unscaledTime = Time.unscaledTime;
			float num3 = Mathf.Max(val.focalLength, 0.1f);
			if (_lastTime < 0f || unscaledTime - _lastTime > 0.5f)
			{
				_lastTime = unscaledTime;
				val.focalLength = num;
				return false;
			}
			float num4 = unscaledTime - _lastTime;
			_lastTime = unscaledTime;
			float num5 = ((num < num3) ? ModConfig.DofBlurInTime.Value : ModConfig.DofClearTime.Value);
			float num6 = 1f - Mathf.Exp(-3f * num4 / Mathf.Max(num5, 0.01f));
			val.focalLength = Mathf.Exp(Mathf.Lerp(Mathf.Log(num3), Mathf.Log(num), num6));
			return false;
		}
	}
	internal sealed class LensEffect : MonoBehaviour
	{
		private const string BundleResource = "wirecameratweaks.bundle";

		private const float MaxBlurPixels = 26f;

		private const float PlayerRadius = 0.49f;

		private static Material _material;

		private static bool _loadTried;

		internal static LensEffect Instance;

		private Camera _camera;

		private CameraEffects _effects;

		private DepthOfField _vanillaDof;

		private bool _vanillaWanted;

		private bool _dofOn;

		private RenderTexture _focusA;

		private RenderTexture _focusB;

		private float _lastTime = -1f;

		private static readonly int FocusId = Shader.PropertyToID("_WireFocus");

		private static readonly int BlurId = Shader.PropertyToID("_WireBlur");

		private static readonly int ExcludeId = Shader.PropertyToID("_WireExclude");

		private static readonly int KInId = Shader.PropertyToID("_WireKIn");

		private static readonly int KOutId = Shader.PropertyToID("_WireKOut");

		private static readonly int NearLimitId = Shader.PropertyToID("_WireNearLimit");

		private static readonly int NearOnId = Shader.PropertyToID("_WireNearOn");

		private static readonly int FarCapId = Shader.PropertyToID("_WireFarCap");

		private static readonly int CocScaleId = Shader.PropertyToID("_WireCocScale");

		private static readonly int MaxRadiusId = Shader.PropertyToID("_WireMaxRadius");

		private static readonly int BarrelId = Shader.PropertyToID("_WireBarrel");

		internal static bool Ready => (Object)(object)LoadMaterial() != (Object)null;

		private static Material LoadMaterial()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			if (_loadTried)
			{
				return _material;
			}
			_loadTried = true;
			using (Stream stream = typeof(LensEffect).Assembly.GetManifestResourceStream("wirecameratweaks.bundle"))
			{
				if (stream == null)
				{
					Plugin.Log.LogWarning((object)"Lens shader bundle missing, using Valheim's depth of field.");
					return null;
				}
				MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				AssetBundle val = AssetBundle.LoadFromMemory(memoryStream.ToArray());
				Shader val2 = (((Object)(object)val != (Object)null) ? val.LoadAsset<Shader>("Assets/Shaders/WireLens.shader") : null);
				if ((Object)(object)val2 == (Object)null || !val2.isSupported)
				{
					Plugin.Log.LogWarning((object)"Lens shader failed to load, using Valheim's depth of field.");
					return null;
				}
				_material = new Material(val2)
				{
					hideFlags = (HideFlags)61
				};
			}
			return _material;
		}

		internal void Init(CameraEffects effects, DepthOfField vanillaDof)
		{
			_effects = effects;
			_vanillaDof = vanillaDof;
			_vanillaWanted = (Object)(object)vanillaDof != (Object)null && ((Behaviour)vanillaDof).enabled;
			Refresh();
		}

		internal void SetVanillaWanted(bool wanted)
		{
			_vanillaWanted = wanted;
			Refresh();
		}

		internal void Refresh()
		{
			bool ready = Ready;
			_dofOn = ready && _vanillaWanted && ModConfig.DofEnabled.Value && ModConfig.DofQuality.Value == ModConfig.DofMode.LensBlur;
			if ((Object)(object)_vanillaDof != (Object)null)
			{
				((Behaviour)_vanillaDof).enabled = _vanillaWanted && !_dofOn;
			}
			_lastTime = -1f;
			((Behaviour)this).enabled = _dofOn || (ready && WideLens.On);
		}

		private void Awake()
		{
			Instance = this;
			_camera = ((Component)this).GetComponent<Camera>();
		}

		private void OnEnable()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_camera != (Object)null)
			{
				Camera camera = _camera;
				camera.depthTextureMode = (DepthTextureMode)(camera.depthTextureMode | 1);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
			Release(ref _focusA);
			Release(ref _focusB);
		}

		private static void Release(ref RenderTexture rt)
		{
			if (!((Object)(object)rt == (Object)null))
			{
				rt.Release();
				Object.Destroy((Object)(object)rt);
				rt = null;
			}
		}

		private static RenderTexture Focus(ref RenderTexture rt)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			if ((Object)(object)rt == (Object)null || !rt.IsCreated())
			{
				Release(ref rt);
				rt = new RenderTexture(1, 1, 0, (RenderTextureFormat)12)
				{
					hideFlags = (HideFlags)61
				};
				rt.Create();
			}
			return rt;
		}

		private void OnRenderImage(RenderTexture src, RenderTexture dst)
		{
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			Material material = _material;
			if ((Object)(object)material == (Object)null)
			{
				Graphics.Blit((Texture)(object)src, dst);
				return;
			}
			RenderTexture val = null;
			if (_dofOn)
			{
				float unscaledTime = Time.unscaledTime;
				bool flag = _lastTime < 0f || unscaledTime - _lastTime > 0.5f;
				float dt = unscaledTime - _lastTime;
				_lastTime = unscaledTime;
				material.SetFloat(KInId, flag ? 1f : Blend(dt, ModConfig.DofBlurInTime.Value));
				material.SetFloat(KOutId, flag ? 1f : Blend(dt, ModConfig.DofClearTime.Value));
				float num = 0f;
				float num2 = 0f;
				float num3 = 1000000f;
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer != (Object)null)
				{
					float num4 = Vector3.Distance(((Component)this).transform.position, ((Character)localPlayer).GetCenterPoint());
					num = num4 + 0.49f;
					if (num4 - 0.49f > 0.05f)
					{
						num2 = 1f / (num4 - 0.49f);
					}
					if ((Object)(object)localPlayer.GetControlledShip() != (Object)null)
					{
						num3 = 1f / Mathf.Max(_effects.m_dofMinDistanceShip, 1f);
					}
				}
				float num5 = (float)((Texture)src).height * 0.5f;
				float num6 = Mathf.Tan(_camera.fieldOfView * 0.5f * ((float)Math.PI / 180f));
				material.SetFloat(ExcludeId, num);
				material.SetFloat(NearLimitId, num2);
				material.SetFloat(NearOnId, ModConfig.DofNearBlur.Value ? 1f : 0f);
				material.SetFloat(FarCapId, num3);
				material.SetFloat(CocScaleId, ModConfig.DofAperture.Value * 0.001f / (2f * num6) * num5);
				material.SetFloat(MaxRadiusId, Mathf.Min(26f, (float)((Texture)src).height * 0.05f) * 0.5f);
				RenderTexture val2 = Focus(ref _focusA);
				RenderTexture val3 = Focus(ref _focusB);
				Graphics.Blit((Texture)(object)val2, val3, material, 0);
				_focusA = val3;
				_focusB = val2;
				material.SetTexture(FocusId, (Texture)(object)val3);
				int num7 = Mathf.Max(1, ((Texture)src).width / 2);
				int num8 = Mathf.Max(1, ((Texture)src).height / 2);
				RenderTexture temporary = RenderTexture.GetTemporary(num7, num8, 0, (RenderTextureFormat)2);
				RenderTexture temporary2 = RenderTexture.GetTemporary(num7, num8, 0, (RenderTextureFormat)2);
				val = RenderTexture.GetTemporary(num7, num8, 0, (RenderTextureFormat)2);
				Graphics.Blit((Texture)(object)src, temporary, material, 1);
				Graphics.Blit((Texture)(object)temporary, temporary2, material, 2);
				Graphics.Blit((Texture)(object)temporary2, val, material, 3);
				RenderTexture.ReleaseTemporary(temporary);
				RenderTexture.ReleaseTemporary(temporary2);
				material.SetTexture(BlurId, (Texture)(object)val);
			}
			bool flag2 = WideLens.On;
			material.SetFloat(BarrelId, ModConfig.WideLensBarrel.Value);
			if (_dofOn && flag2)
			{
				RenderTexture temporary3 = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height, 0, src.format);
				Graphics.Blit((Texture)(object)src, temporary3, material, 4);
				Graphics.Blit((Texture)(object)temporary3, dst, material, 5);
				RenderTexture.ReleaseTemporary(temporary3);
			}
			else if (_dofOn)
			{
				Graphics.Blit((Texture)(object)src, dst, material, 4);
			}
			else
			{
				Graphics.Blit((Texture)(object)src, dst, material, 5);
			}
			if ((Object)(object)val != (Object)null)
			{
				RenderTexture.ReleaseTemporary(val);
			}
		}

		private static float Blend(float dt, float settle)
		{
			return 1f - Mathf.Exp(-3f * dt / Mathf.Max(settle, 0.01f));
		}
	}
	[HarmonyPatch(typeof(CameraEffects), "Awake")]
	internal static class CameraEffectsAwakePatch
	{
		private static readonly FieldRef<CameraEffects, DepthOfField> DofRef = AccessTools.FieldRefAccess<CameraEffects, DepthOfField>("m_dof");

		[HarmonyPostfix]
		private static void Postfix(CameraEffects __instance)
		{
			if (!((Object)(object)((Component)__instance).GetComponent<Camera>() == (Object)null))
			{
				LensEffect lensEffect = ((Component)__instance).gameObject.GetComponent<LensEffect>();
				if ((Object)(object)lensEffect == (Object)null)
				{
					lensEffect = ((Component)__instance).gameObject.AddComponent<LensEffect>();
				}
				lensEffect.Init(__instance, DofRef.Invoke(__instance));
			}
		}
	}
	[HarmonyPatch(typeof(CameraEffects), "SetDof")]
	internal static class CameraEffectsSetDofPatch
	{
		[HarmonyPostfix]
		private static void Postfix(CameraEffects __instance, bool enabled)
		{
			LensEffect component = ((Component)__instance).GetComponent<LensEffect>();
			if ((Object)(object)component != (Object)null)
			{
				component.SetVanillaWanted(enabled || __instance.m_forceDof);
			}
		}
	}
	internal static class ModConfig
	{
		public enum DofMode
		{
			Vanilla,
			LensBlur
		}

		internal static ConfigEntry<bool> ShakeEnabled;

		internal static ConfigEntry<float> OverallStrength;

		internal static ConfigEntry<float> RumbleStrength;

		internal static ConfigEntry<float> ImpactStrength;

		internal static ConfigEntry<float> ImpactDuration;

		internal static ConfigEntry<float> LongShakeSoftening;

		internal static ConfigEntry<float> MaxRumbleDegrees;

		internal static ConfigEntry<float> FrequencyMultiplier;

		internal static ConfigEntry<float> SecondaryMotion;

		internal static ConfigEntry<float> PositionShake;

		internal static ConfigEntry<float> RollStrength;

		internal static ConfigEntry<bool> DirectionalImpact;

		internal static ConfigEntry<float> ImpactThreshold;

		internal static ConfigEntry<bool> SmoothZoomEnabled;

		internal static ConfigEntry<float> ZoomResponse;

		internal static ConfigEntry<bool> CollisionAutoZoomEnabled;

		internal static ConfigEntry<float> CollisionAutoZoomResponse;

		internal static ConfigEntry<bool> DofEnabled;

		internal static ConfigEntry<DofMode> DofQuality;

		internal static ConfigEntry<float> DofBlurInTime;

		internal static ConfigEntry<float> DofClearTime;

		internal static ConfigEntry<bool> DofNearBlur;

		internal static ConfigEntry<float> DofAperture;

		internal static ConfigEntry<bool> WideLensEnabled;

		internal static ConfigEntry<float> WideLensFov;

		internal static ConfigEntry<float> WideLensBarrel;

		internal static void Bind(ConfigFile file)
		{
			ConfigEntry<bool> val = file.Bind<bool>("General", "Enabled", true, "Legacy migration value.");
			ConfigEntry<float> val2 = file.Bind<float>("General", "Overall Strength", 0.5f, "Legacy migration value.");
			ConfigEntry<float> val3 = file.Bind<float>("Rumble", "Rumble Strength", 0.85f, "Legacy migration value.");
			ConfigEntry<float> val4 = file.Bind<float>("Rumble", "Long Shake Softening", 0.8f, "Legacy migration value.");
			ConfigEntry<float> val5 = file.Bind<float>("Rumble", "Max Rumble Degrees", 1.25f, "Legacy migration value.");
			ConfigEntry<float> val6 = file.Bind<float>("Rumble", "Frequency Multiplier", 0.9f, "Legacy migration value.");
			ConfigEntry<float> val7 = file.Bind<float>("Rumble", "Secondary Motion", 0.18f, "Legacy migration value.");
			ConfigEntry<float> val8 = file.Bind<float>("Rumble", "Position Shake", 0.018f, "Legacy migration value.");
			ConfigEntry<float> val9 = file.Bind<float>("Impact", "Impact Strength", 1f, "Legacy migration value.");
			ConfigEntry<float> val10 = file.Bind<float>("Impact", "Impact Duration", 0.18f, "Legacy migration value.");
			ConfigEntry<float> val11 = file.Bind<float>("Impact", "Impact Threshold", 0.12f, "Legacy migration value.");
			ConfigEntry<bool> val12 = file.Bind<bool>("Impact", "Directional Impact", true, "Legacy migration value.");
			ConfigEntry<float> val13 = file.Bind<float>("Impact", "Roll Strength", 0f, "Legacy migration value.");
			bool value = val.Value;
			float value2 = val2.Value;
			float value3 = val3.Value;
			float value4 = val4.Value;
			float value5 = val5.Value;
			float value6 = val6.Value;
			float value7 = val7.Value;
			float value8 = val8.Value;
			float value9 = val9.Value;
			float value10 = val10.Value;
			float value11 = val11.Value;
			bool value12 = val12.Value;
			float value13 = val13.Value;
			file.Remove(((ConfigEntryBase)val).Definition);
			file.Remove(((ConfigEntryBase)val2).Definition);
			file.Remove(((ConfigEntryBase)val3).Definition);
			file.Remove(((ConfigEntryBase)val4).Definition);
			file.Remove(((ConfigEntryBase)val5).Definition);
			file.Remove(((ConfigEntryBase)val6).Definition);
			file.Remove(((ConfigEntryBase)val7).Definition);
			file.Remove(((ConfigEntryBase)val8).Definition);
			file.Remove(((ConfigEntryBase)val9).Definition);
			file.Remove(((ConfigEntryBase)val10).Definition);
			file.Remove(((ConfigEntryBase)val11).Definition);
			file.Remove(((ConfigEntryBase)val12).Definition);
			file.Remove(((ConfigEntryBase)val13).Definition);
			Remove(file, "2 - Collision", "Enabled");
			Remove(file, "2 - Collision", "Recovery Response");
			Remove(file, "2 - Collision", "Release Delay");
			Remove(file, "3 - Occlusion", "Enabled");
			Remove(file, "3 - Occlusion", "Fade Occluders");
			Remove(file, "3 - Occlusion", "Occluder Alpha");
			Remove(file, "3 - Occlusion", "Dither Occluders");
			Remove(file, "3 - Occlusion", "Dither Visibility");
			Remove(file, "3 - Occlusion", "Fade Response");
			Remove(file, "3 - Occlusion", "Ignore Small Obstacles");
			Remove(file, "3 - Occlusion", "Small Obstacle Max Volume");
			Remove(file, "3 - Occlusion", "Thin Obstacle Max Thickness");
			Remove(file, "3 - Player Follow", "Enabled");
			Remove(file, "3 - Player Follow", "Maximum Lag Distance");
			Remove(file, "3 - Player Follow", "Response");
			Remove(file, "3 - Player Follow", "Maximum Horizontal Lag");
			Remove(file, "3 - Player Follow", "Vertical Response");
			Remove(file, "3 - Player Follow", "Maximum Vertical Lag");
			Remove(file, "3 - Player Follow", "Horizontal Catch-up Response");
			Remove(file, "3 - Player Follow", "Horizontal Deadzone");
			Remove(file, "3 - Player Follow", "Maximum Horizontal Lead");
			Remove(file, "3 - Player Follow", "Vertical Catch-up Response");
			Remove(file, "3 - Player Follow", "Vertical Deadzone");
			Remove(file, "3 - Player Follow", "Maximum Vertical Lead");
			Remove(file, "4 - Zoom", "Enabled");
			Remove(file, "4 - Zoom", "Response");
			Remove(file, "5 - Motion", "Enabled");
			Remove(file, "5 - Motion", "Strafe Roll");
			Remove(file, "5 - Motion", "Turn Roll");
			Remove(file, "5 - Motion", "Response");
			Remove(file, "5 - Motion", "Roll Response");
			Remove(file, "5 - Motion", "Camera Lag Distance");
			Remove(file, "5 - Motion", "Camera Lag Response");
			ShakeEnabled = file.Bind<bool>("1 - Shake", "Enabled", value, "Enable the Wire's Shake It Up camera-shake rework.");
			OverallStrength = Float(file, "1 - Shake", "Overall Strength", value2, 0f, 2f, "Master multiplier for camera shake.");
			RumbleStrength = Float(file, "1 - Shake", "Rumble Strength", value3, 0f, 2f, "Strength of sustained shake after the initial impact.");
			LongShakeSoftening = Float(file, "1 - Shake", "Long Shake Softening", value4, 0f, 1f, "Prevents long vanilla shakes from becoming absurdly strong.");
			MaxRumbleDegrees = Float(file, "1 - Shake", "Max Rumble Degrees", value5, 0.1f, 4f, "Approximate cap for sustained rotational shake.");
			FrequencyMultiplier = Float(file, "1 - Shake", "Frequency Multiplier", value6, 0.25f, 2f, "Speed of sustained shake.");
			SecondaryMotion = Float(file, "1 - Shake", "Secondary Motion", value7, 0f, 1f, "Subtle second motion layer for less mechanical shake.");
			PositionShake = Float(file, "1 - Shake", "Position Shake", value8, 0f, 0.08f, "Small positional shake in metres.");
			ImpactStrength = Float(file, "1 - Shake", "Impact Strength", value9, 0f, 2f, "Strength of the short initial impact punch.");
			ImpactDuration = Float(file, "1 - Shake", "Impact Duration", value10, 0.05f, 0.5f, "Length of the initial impact kick.");
			ImpactThreshold = Float(file, "1 - Shake", "Impact Threshold", value11, 0f, 1f, "Tiny shakes below this strength do not receive an extra impact.");
			DirectionalImpact = file.Bind<bool>("1 - Shake", "Directional Impact", value12, "Bias the initial kick away from the shake source.");
			RollStrength = Float(file, "1 - Shake", "Roll Strength", value13, 0f, 1f, "Roll added to impacts. Zero avoids nausea.");
			SmoothZoomEnabled = file.Bind<bool>("2 - Smooth Zoom", "Enabled", true, "Smooth manual mouse-wheel/controller zoom.");
			ZoomResponse = Float(file, "2 - Smooth Zoom", "Manual Zoom Response", 18f, 5f, 40f, "How quickly manual zoom catches the requested target.");
			CollisionAutoZoomEnabled = file.Bind<bool>("2 - Smooth Zoom", "Smooth Collision Auto Zoom", true, "Smooth the automatic zoom-out recovery after Valheim collision forces the camera closer. Collision moving inward remains immediate.");
			CollisionAutoZoomResponse = Float(file, "2 - Smooth Zoom", "Automatic Zoom Response", 14f, 4f, 35f, "How quickly collision-forced camera distance eases back outward.");
			DofEnabled = file.Bind<bool>("3 - Depth of Field", "Enabled", true, "Depth of Field rework. Needs Valheim's Depth of Field graphics setting on.");
			DofQuality = file.Bind<DofMode>("3 - Depth of Field", "Quality", DofMode.LensBlur, "LensBlur: lens-like focus and bokeh blur. Vanilla: Valheim's own blur with smoother focus.");
			DofBlurInTime = Float(file, "3 - Depth of Field", "Blur In Time", 0.22f, 0.05f, 3f, "Seconds for the background to blur when you look at something closer.");
			DofClearTime = Float(file, "3 - Depth of Field", "Clear Time", 0.22f, 0.05f, 3f, "Seconds for the blur to clear when you look further away.");
			DofNearBlur = file.Bind<bool>("3 - Depth of Field", "Near Blur", true, "Blur things between the camera and your character, like grass or a branch right at the lens.");
			DofAperture = Float(file, "3 - Depth of Field", "Aperture", 30f, 1f, 150f, "Lens opening in millimetres. 30 is about a 50 mm f/1.8 photo lens. Higher blurs more.");
			WideLensEnabled = file.Bind<bool>("4 - Wide Lens", "Enabled", false, "Wider field of view with barrel distortion.");
			WideLensFov = Float(file, "4 - Wide Lens", "Extra FOV", 10f, 0f, 30f, "Degrees added to Valheim's field of view.");
			WideLensBarrel = Float(file, "4 - Wide Lens", "Barrel Distortion", 1f, 0f, 2f, "Lens curvature. 1 magnifies the centre about 6% while the edges stay put.");
			WideLensEnabled.SettingChanged += delegate
			{
				LensEffect.Instance?.Refresh();
			};
			DofEnabled.SettingChanged += delegate
			{
				LensEffect.Instance?.Refresh();
			};
			DofQuality.SettingChanged += delegate
			{
				LensEffect.Instance?.Refresh();
			};
			Hook<bool>(ShakeEnabled);
			Hook<float>(OverallStrength);
			Hook<float>(RumbleStrength);
			Hook<float>(ImpactStrength);
			Hook<float>(ImpactDuration);
			Hook<float>(LongShakeSoftening);
			Hook<float>(MaxRumbleDegrees);
			Hook<float>(FrequencyMultiplier);
			Hook<float>(SecondaryMotion);
			Hook<float>(PositionShake);
			Hook<float>(RollStrength);
			Hook<bool>(DirectionalImpact);
			Hook<float>(ImpactThreshold);
			Hook<bool>(SmoothZoomEnabled);
			Hook<bool>(CollisionAutoZoomEnabled);
		}

		private static ConfigEntry<float> Float(ConfigFile file, string section, string key, float value, float min, float max, string description)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			return file.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
		}

		private static void Remove(ConfigFile file, string section, string key)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			file.Remove(new ConfigDefinition(section, key));
		}

		private static void Hook<T>(ConfigEntry<T> entry)
		{
			entry.SettingChanged += delegate
			{
				ShakeEngine.ResetTransient();
				ZoomEngine.Reset();
				CollisionAutoZoomEngine.Reset();
			};
		}
	}
	[HarmonyPatch(typeof(GameCamera), "Awake")]
	internal static class GameCameraAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			ShakeEngine.ResetTransient();
		}
	}
	[HarmonyPatch(typeof(GameCamera), "GetAttenuatedShakeIntensity")]
	internal static class ShakeAmplitudePatch
	{
		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance, ref float __result)
		{
			__result = ShakeEngine.ShapeRumble(__instance, __result);
		}
	}
	[HarmonyPatch(typeof(GameCamera), "AddShake")]
	internal static class AddShakePatch
	{
		[HarmonyPrefix]
		private static void Prefix(GameCamera __instance, out float __state)
		{
			__state = ShakeEngine.CurrentIntensity(__instance);
		}

		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance, Vector3 point, float range, float strength, float __state)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ShakeEngine.ObserveShake(__instance, point, range, strength, __state);
		}
	}
	[HarmonyPatch(typeof(GameCamera), "UpdateCameraShake")]
	internal static class UpdateCameraShakePatch
	{
		[HarmonyPrefix]
		private static void Prefix(GameCamera __instance, out float __state)
		{
			__state = __instance.m_shakeFreq;
			if (ShakeEngine.Enabled(__instance))
			{
				__instance.m_shakeFreq = __state * ModConfig.FrequencyMultiplier.Value;
			}
		}

		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance, float dt, float __state)
		{
			try
			{
				ShakeEngine.AfterCameraShake(__instance, dt);
			}
			finally
			{
				__instance.m_shakeFreq = __state;
			}
		}
	}
	[BepInPlugin("wire.valheim.shakeitup", "Wire's Camera Tweaks", "0.2.1")]
	[BepInProcess("valheim.exe")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Guid = "wire.valheim.shakeitup";

		public const string Name = "Wire's Camera Tweaks";

		public const string Version = "0.2.1";

		internal static Plugin Instance;

		internal static ManualLogSource Log;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			ModConfig.Bind(((BaseUnityPlugin)this).Config);
			_harmony = new Harmony("wire.valheim.shakeitup");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Wire's Camera Tweaks 0.2.1 loaded.");
		}

		private void OnDestroy()
		{
			ShakeEngine.Reset();
			ZoomEngine.Reset();
			CollisionAutoZoomEngine.Reset();
			if (_harmony != null)
			{
				_harmony.UnpatchSelf();
			}
			Instance = null;
		}
	}
	internal static class ShakeEngine
	{
		private static readonly FieldRef<GameCamera, float> ShakeIntensity = AccessTools.FieldRefAccess<GameCamera, float>("m_shakeIntensity");

		private static readonly FieldRef<GameCamera, bool> CameraShakeEnabled = AccessTools.FieldRefAccess<GameCamera, bool>("m_cameraShakeEnabled");

		private static float _phase;

		private static float _kickRemaining;

		private static float _kickDuration;

		private static float _kickPitch;

		private static float _kickYaw;

		private static float _kickRoll;

		private static float _lastAcceptedCall = -999f;

		private static float _lastImpactTime = -999f;

		private static Vector3 _lastSource;

		private static bool _hasLastSource;

		internal static float CurrentIntensity(GameCamera camera)
		{
			if (!((Object)(object)camera == (Object)null))
			{
				return ShakeIntensity.Invoke(camera);
			}
			return 0f;
		}

		internal static bool IsCameraShakeEnabled(GameCamera camera)
		{
			if ((Object)(object)camera != (Object)null)
			{
				return CameraShakeEnabled.Invoke(camera);
			}
			return false;
		}

		internal static float ShapeRumble(GameCamera camera, float vanillaAmplitude)
		{
			if (!Enabled(camera))
			{
				return vanillaAmplitude;
			}
			float num = Mathf.Max(0f, CurrentIntensity(camera));
			if (num <= 0f)
			{
				return 0f;
			}
			float num2;
			if (num <= 1f)
			{
				num2 = num * num * num;
			}
			else
			{
				float value = ModConfig.LongShakeSoftening.Value;
				num2 = 1f + (num - 1f) * (1f - value);
				num2 = Mathf.Min(num2, ModConfig.MaxRumbleDegrees.Value);
			}
			return num2 * ModConfig.RumbleStrength.Value * ModConfig.OverallStrength.Value;
		}

		internal static void ObserveShake(GameCamera camera, Vector3 point, float range, float strength, float previousIntensity)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled(camera) || range <= 0f)
			{
				return;
			}
			float num = Vector3.Distance(point, ((Component)camera).transform.position);
			if (num > range)
			{
				return;
			}
			num = Mathf.Max(1f, num);
			float num2 = strength * (1f - num / range);
			if (!(num2 < ModConfig.ImpactThreshold.Value) && !(num2 + 0.0001f < previousIntensity))
			{
				float unscaledTime = Time.unscaledTime;
				bool flag = unscaledTime - _lastAcceptedCall > 0.16f;
				int num3;
				if (_hasLastSource)
				{
					Vector3 val = point - _lastSource;
					num3 = ((((Vector3)(ref val)).sqrMagnitude > 4f) ? 1 : 0);
				}
				else
				{
					num3 = 1;
				}
				bool flag2 = (byte)num3 != 0;
				bool flag3 = num2 > previousIntensity + Mathf.Max(0.08f, previousIntensity * 0.12f);
				if (unscaledTime - _lastImpactTime > 0.075f && (flag || flag2 || flag3))
				{
					StartImpact(camera, point, num2, unscaledTime);
				}
				_lastAcceptedCall = unscaledTime;
				_lastSource = point;
				_hasLastSource = true;
			}
		}

		private static void StartImpact(GameCamera camera, Vector3 point, float effective, float now)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(0.15f + 0.55f * Mathf.Sqrt(Mathf.Max(0f, effective)), 0f, 1.2f);
			num *= ModConfig.ImpactStrength.Value * ModConfig.OverallStrength.Value;
			_kickDuration = ModConfig.ImpactDuration.Value;
			_kickRemaining = _kickDuration;
			Vector3 val = point - ((Component)camera).transform.position;
			Vector3 val2 = Vector3.zero;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
			{
				val2 = ((Component)camera).transform.InverseTransformDirection(((Vector3)(ref val)).normalized);
			}
			float num2 = ((Mathf.Sin(point.x * 12.9898f + point.z * 78.233f + now * 3.173f) >= 0f) ? 1f : (-1f));
			if (ModConfig.DirectionalImpact.Value)
			{
				_kickYaw = num * ((0f - val2.x) * 0.55f + num2 * 0.12f);
				_kickPitch = (0f - num) * (0.68f - val2.y * 0.16f);
			}
			else
			{
				_kickYaw = num2 * num * 0.32f;
				_kickPitch = (0f - num) * 0.68f;
			}
			_kickRoll = num2 * num * 0.18f * ModConfig.RollStrength.Value;
			_lastImpactTime = now;
		}

		internal static void AfterCameraShake(GameCamera camera, float dt)
		{
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled(camera))
			{
				return;
			}
			if (!IsCameraShakeEnabled(camera))
			{
				_kickRemaining = 0f;
				return;
			}
			float num = Mathf.Max(0f, CurrentIntensity(camera));
			float num2 = ShapeRumble(camera, 0f) * camera.m_shakeMovement;
			float num3 = Mathf.InverseLerp(1f, 3f, num);
			float num4 = Mathf.Lerp(1.08f, 0.72f, num3);
			_phase += dt * camera.m_shakeFreq * num4;
			float num5 = num2 * ModConfig.SecondaryMotion.Value;
			float num6 = Mathf.Sin(_phase * 1.73f + 0.4f) * num5 * 0.42f;
			float num7 = Mathf.Cos(_phase * 1.37f + 1.1f) * num5 * 0.35f;
			float num8 = Mathf.Sin(_phase * 0.91f + 2.2f) * num5 * 0.08f * ModConfig.RollStrength.Value;
			if (_kickRemaining > 0f && _kickDuration > 0f)
			{
				float num9 = Mathf.Clamp01(_kickRemaining / _kickDuration);
				float num10 = num9 * num9 * (3f - 2f * num9);
				num6 += _kickPitch * num10;
				num7 += _kickYaw * num10;
				num8 += _kickRoll * num10;
				_kickRemaining = Mathf.Max(0f, _kickRemaining - dt);
			}
			if (Mathf.Abs(num6) > 0.0001f || Mathf.Abs(num7) > 0.0001f || Mathf.Abs(num8) > 0.0001f)
			{
				((Component)camera).transform.rotation = ((Component)camera).transform.rotation * Quaternion.Euler(num6, num7, num8);
			}
			float num11 = ModConfig.PositionShake.Value * ModConfig.OverallStrength.Value * Mathf.Clamp01(num2);
			if (num11 > 1E-05f)
			{
				Vector3 val = ((Component)camera).transform.right * (Mathf.Sin(_phase * 0.83f + 0.2f) * num11) + ((Component)camera).transform.up * (Mathf.Cos(_phase * 1.11f + 1.7f) * num11 * 0.55f);
				Transform transform = ((Component)camera).transform;
				transform.position += val;
			}
		}

		internal static bool Enabled(GameCamera camera)
		{
			if ((Object)(object)camera != (Object)null && ModConfig.ShakeEnabled != null)
			{
				return ModConfig.ShakeEnabled.Value;
			}
			return false;
		}

		internal static void ResetTransient()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			_phase = 0f;
			_kickRemaining = 0f;
			_kickDuration = 0f;
			_kickPitch = 0f;
			_kickYaw = 0f;
			_kickRoll = 0f;
			_lastAcceptedCall = -999f;
			_lastImpactTime = -999f;
			_lastSource = Vector3.zero;
			_hasLastSource = false;
		}

		internal static void Reset()
		{
			ResetTransient();
		}
	}
	internal static class WideLens
	{
		internal static bool On
		{
			get
			{
				if (ModConfig.WideLensEnabled.Value)
				{
					return LensEffect.Ready;
				}
				return false;
			}
		}
	}
	[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
	internal static class WideLensFovPatch
	{
		private static readonly FieldRef<GameCamera, Camera> CameraRef = AccessTools.FieldRefAccess<GameCamera, Camera>("m_camera");

		private static readonly FieldRef<GameCamera, bool> FreeFlyRef = AccessTools.FieldRefAccess<GameCamera, bool>("m_freeFly");

		[HarmonyPostfix]
		private static void Postfix(GameCamera __instance)
		{
			if (WideLens.On && !FreeFlyRef.Invoke(__instance))
			{
				float fieldOfView = __instance.m_fov + ModConfig.WideLensFov.Value;
				Camera val = CameraRef.Invoke(__instance);
				if ((Object)(object)val != (Object)null)
				{
					val.fieldOfView = fieldOfView;
				}
				if ((Object)(object)__instance.m_skyCamera != (Object)null)
				{
					__instance.m_skyCamera.fieldOfView = fieldOfView;
				}
			}
		}
	}
}