Decompiled source of MachinimaTools v1.0.1

MachinimaTools.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Rewired;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Gobo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MachinimaTools")]
[assembly: AssemblyTitle("MachinimaTools")]
[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 MachinimaTools
{
	internal class Capture : MonoBehaviour
	{
		private string _dir;

		private int _stillPending;

		private int _defaultCaptureFramerate;

		private float _startedAt;

		private RenderTexture _rt;

		private int _pending;

		private bool _flip;

		private Coroutine _loop;

		public static Capture Instance { get; private set; }

		public bool Recording { get; private set; }

		public int Frames { get; private set; }

		public int Pending => _pending;

		public bool Hiding
		{
			get
			{
				if (!Recording)
				{
					return _stillPending > 0;
				}
				return true;
			}
		}

		public float Elapsed
		{
			get
			{
				if (!Recording)
				{
					return 0f;
				}
				return Time.unscaledTime - _startedAt;
			}
		}

		public static string Root
		{
			get
			{
				string text = Path.Combine(Paths.ConfigPath, "MachinimaTools", "captures");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
				}
				return text;
			}
		}

		private void Awake()
		{
			Instance = this;
			_flip = SystemInfo.graphicsUVStartsAtTop;
		}

		private void OnDestroy()
		{
			if (Recording)
			{
				StopSequence();
			}
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		public string Still()
		{
			_stillPending = 2;
			string text = "still_" + DateTime.Now.ToString("MMdd_HHmmss") + ".png";
			((MonoBehaviour)this).StartCoroutine(GrabStill(Path.Combine(Root, text)));
			return "Shot " + text;
		}

		private IEnumerator GrabStill(string path)
		{
			yield return (object)new WaitForEndOfFrame();
			ScreenCapture.CaptureScreenshot(path, Mathf.Clamp(Cfg.StillSupersize.Value, 1, 8));
			yield return (object)new WaitForEndOfFrame();
			_stillPending = 0;
			Log.Info("Saved " + path);
		}

		public string StartSequence()
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (Recording)
			{
				return StopSequence();
			}
			_dir = Path.Combine(Root, "seq_" + DateTime.Now.ToString("MMdd_HHmmss"));
			Directory.CreateDirectory(_dir);
			_defaultCaptureFramerate = Time.captureFramerate;
			Time.captureFramerate = Mathf.Clamp(Cfg.CaptureFps.Value, 1, 240);
			Frames = 0;
			_pending = 0;
			_startedAt = Time.unscaledTime;
			Recording = true;
			_loop = ((MonoBehaviour)this).StartCoroutine(RecordLoop());
			Log.Info($"Recording to {_dir} at {Time.captureFramerate}fps");
			return $"REC {Time.captureFramerate}fps. {Cfg.KeySequence.Value} or Esc to stop.";
		}

		public string StopSequence()
		{
			if (!Recording)
			{
				return "Not recording";
			}
			Recording = false;
			if (_loop != null)
			{
				((MonoBehaviour)this).StopCoroutine(_loop);
			}
			Time.captureFramerate = _defaultCaptureFramerate;
			Log.Info($"Sequence done: {Frames} frames in {_dir}");
			return $"Stopped. {Frames} frames" + ((_pending > 0) ? $", {_pending} still writing" : "");
		}

		private IEnumerator RecordLoop()
		{
			WaitForEndOfFrame wait = new WaitForEndOfFrame();
			while (Recording)
			{
				yield return wait;
				if (!Recording)
				{
					break;
				}
				if (Cfg.CaptureMaxSeconds.Value > 0 && Elapsed > (float)Cfg.CaptureMaxSeconds.Value)
				{
					Director.Instance?.Notify(StopSequence() + " (time limit)");
					break;
				}
				if (_pending > 8)
				{
					continue;
				}
				int w = Screen.width;
				int h = Screen.height;
				if ((Object)(object)_rt == (Object)null || ((Texture)_rt).width != w || ((Texture)_rt).height != h)
				{
					if ((Object)(object)_rt != (Object)null)
					{
						_rt.Release();
					}
					_rt = new RenderTexture(w, h, 0, (RenderTextureFormat)0);
					_rt.Create();
				}
				ScreenCapture.CaptureScreenshotIntoRenderTexture(_rt);
				string path = Path.Combine(_dir, $"{Frames:D5}.png");
				Frames++;
				Interlocked.Increment(ref _pending);
				AsyncGPUReadback.Request((Texture)(object)_rt, 0, (TextureFormat)4, (Action<AsyncGPUReadbackRequest>)delegate(AsyncGPUReadbackRequest req)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					OnReadback(req, path, w, h);
				});
			}
		}

		private void OnReadback(AsyncGPUReadbackRequest req, string path, int w, int h)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (((AsyncGPUReadbackRequest)(ref req)).hasError)
			{
				Interlocked.Decrement(ref _pending);
				Log.Warn("Readback failed for " + path);
				return;
			}
			byte[] pixels = ((AsyncGPUReadbackRequest)(ref req)).GetData<byte>(0).ToArray();
			bool flip = _flip;
			ThreadPool.QueueUserWorkItem(delegate
			{
				try
				{
					if (flip)
					{
						FlipRows(pixels, w, h);
					}
					byte[] bytes = ImageConversion.EncodeArrayToPNG((Array)pixels, (GraphicsFormat)8, (uint)w, (uint)h, 0u);
					File.WriteAllBytes(path, bytes);
				}
				catch (Exception ex)
				{
					Log.Warn("Frame write failed: " + ex.Message);
				}
				finally
				{
					Interlocked.Decrement(ref _pending);
				}
			});
		}

		private static void FlipRows(byte[] px, int w, int h)
		{
			int num = w * 4;
			byte[] array = new byte[num];
			for (int i = 0; i < h / 2; i++)
			{
				int num2 = i * num;
				int num3 = (h - 1 - i) * num;
				Buffer.BlockCopy(px, num2, array, 0, num);
				Buffer.BlockCopy(px, num3, px, num2, num);
				Buffer.BlockCopy(array, 0, px, num3, num);
			}
		}
	}
	internal static class Cfg
	{
		public static ConfigEntry<KeyCode> KeyToggleFreeCam;

		public static ConfigEntry<KeyCode> KeyToggleHud;

		public static ConfigEntry<KeyCode> KeyToggleFocus;

		public static ConfigEntry<KeyCode> KeyAddKeyframe;

		public static ConfigEntry<KeyCode> KeyDeleteKeyframe;

		public static ConfigEntry<KeyCode> KeyClearShot;

		public static ConfigEntry<KeyCode> KeyPlayShot;

		public static ConfigEntry<KeyCode> KeySaveShot;

		public static ConfigEntry<KeyCode> KeyCycleShot;

		public static ConfigEntry<KeyCode> KeyDurationDown;

		public static ConfigEntry<KeyCode> KeyDurationUp;

		public static ConfigEntry<KeyCode> KeyCycleTarget;

		public static ConfigEntry<KeyCode> KeyClearTarget;

		public static ConfigEntry<float> AimDamping;

		public static ConfigEntry<float> AimHeadroom;

		public static ConfigEntry<float> AimLead;

		public static ConfigEntry<float> AimDeadzone;

		public static ConfigEntry<KeyCode> KeyCycleParam;

		public static ConfigEntry<KeyCode> KeyParamDown;

		public static ConfigEntry<KeyCode> KeyParamUp;

		public static ConfigEntry<bool> RelinkMovement;

		public static ConfigEntry<KeyCode> KeyCycleRigMode;

		public static ConfigEntry<float> FollowDistance;

		public static ConfigEntry<float> FollowHeight;

		public static ConfigEntry<float> FollowSide;

		public static ConfigEntry<float> RigDamping;

		public static ConfigEntry<float> OrbitRadius;

		public static ConfigEntry<float> OrbitHeight;

		public static ConfigEntry<float> OrbitSpeed;

		public static ConfigEntry<bool> FollowUsesFacing;

		public static ConfigEntry<KeyCode> KeyCycleFocusMode;

		public static ConfigEntry<KeyCode> KeyRackFocus;

		public static ConfigEntry<float> Aperture;

		public static ConfigEntry<float> FocusDistance;

		public static ConfigEntry<float> FocusDamping;

		public static ConfigEntry<float> RackDuration;

		public static ConfigEntry<float> DofFocalLength;

		public static ConfigEntry<bool> LinkDofToLens;

		public static ConfigEntry<bool> MotionBlurEnabled;

		public static ConfigEntry<float> ShutterAngle;

		public static ConfigEntry<bool> CompensateShutter;

		public static ConfigEntry<KeyCode> KeyCycleMountBone;

		public static ConfigEntry<KeyCode> KeyDollyZoom;

		public static ConfigEntry<KeyCode> KeyStill;

		public static ConfigEntry<KeyCode> KeySequence;

		public static ConfigEntry<float> MountOffsetX;

		public static ConfigEntry<float> MountOffsetY;

		public static ConfigEntry<float> MountOffsetZ;

		public static ConfigEntry<float> MountPitch;

		public static ConfigEntry<float> MountYaw;

		public static ConfigEntry<float> MountDamping;

		public static ConfigEntry<MountFrame> MountFrame;

		public static ConfigEntry<bool> MountLevelHorizon;

		public static ConfigEntry<float> MountRotDamping;

		public static ConfigEntry<float> ShakePosition;

		public static ConfigEntry<float> ShakeRotation;

		public static ConfigEntry<float> ShakeFrequency;

		public static ConfigEntry<bool> ShakeScalesWithSpeed;

		public static ConfigEntry<int> StillSupersize;

		public static ConfigEntry<int> CaptureFps;

		public static ConfigEntry<KeyCode> KeyFreezeWorld;

		public static ConfigEntry<bool> FreezeParticles;

		public static ConfigEntry<bool> AllowClientTimeControls;

		public static ConfigEntry<bool> DisableModelFade;

		public static ConfigEntry<int> CaptureMaxSeconds;

		public static ConfigEntry<bool> ShowKeyframes;

		public static ConfigEntry<float> BookmarkBlend;

		public static ConfigEntry<KeyCode> KeyHideSelf;

		public static ConfigEntry<KeyCode> KeyHideOthers;

		public static ConfigEntry<KeyCode> KeyBookmarkModifier;

		public static ConfigEntry<bool> SunOverride;

		public static ConfigEntry<bool> SunShadows;

		public static ConfigEntry<bool> AmbientOverride;

		public static ConfigEntry<float> SunIntensity;

		public static ConfigEntry<float> SunKelvin;

		public static ConfigEntry<float> SunHue;

		public static ConfigEntry<float> SunSat;

		public static ConfigEntry<float> SunPitch;

		public static ConfigEntry<float> SunYaw;

		public static ConfigEntry<float> AmbientIntensity;

		public static ConfigEntry<float> AmbientKelvin;

		public static ConfigEntry<float> AmbientHue;

		public static ConfigEntry<float> AmbientSat;

		public static ConfigEntry<bool> GradeOn;

		public static ConfigEntry<bool> FxOn;

		public static ConfigEntry<bool> FogOn;

		public static ConfigEntry<bool> RainOn;

		public static ConfigEntry<float> GradeTemp;

		public static ConfigEntry<float> GradeTint;

		public static ConfigEntry<float> GradeSat;

		public static ConfigEntry<float> GradeContrast;

		public static ConfigEntry<float> GradeExposure;

		public static ConfigEntry<float> GradeHue;

		public static ConfigEntry<float> FxVignette;

		public static ConfigEntry<float> FxGrain;

		public static ConfigEntry<float> FxAberration;

		public static ConfigEntry<float> FogIntensity;

		public static ConfigEntry<float> FogPower;

		public static ConfigEntry<float> FogNear;

		public static ConfigEntry<float> FogFar;

		public static ConfigEntry<float> FogHeight;

		public static ConfigEntry<float> FogHue;

		public static ConfigEntry<float> FogSat;

		public static ConfigEntry<float> FogValue;

		public static ConfigEntry<float> RainIntensity;

		public static ConfigEntry<float> RainDensity;

		public static ConfigEntry<float> WeatherAmount;

		public static ConfigEntry<float> WeatherWind;

		public static ConfigEntry<KeyCode> KeyAddLight;

		public static ConfigEntry<KeyCode> KeyToggleLights;

		public static ConfigEntry<float> LightFade;

		public static ConfigEntry<bool> PadEnabled;

		public static ConfigEntry<float> PadLookSpeed;

		public static ConfigEntry<float> PadDeadzone;

		public static ConfigEntry<float> PadCurve;

		public static ConfigEntry<PadAxisAction>[] PadAxisMap;

		public static ConfigEntry<bool>[] PadAxisInvert;

		public static ConfigEntry<PadAction>[] PadButtonMap;

		private static ConfigFile _file;

		public static ConfigEntry<KeyCode> KeyToggleMenu;

		public static ConfigEntry<KeyCode> KeyTogglePause;

		public static ConfigEntry<KeyCode> KeyTimeDown;

		public static ConfigEntry<KeyCode> KeyTimeUp;

		public static ConfigEntry<KeyCode> KeyFovDown;

		public static ConfigEntry<KeyCode> KeyFovUp;

		public static ConfigEntry<KeyCode> KeyRollLeft;

		public static ConfigEntry<KeyCode> KeyRollRight;

		public static ConfigEntry<KeyCode> KeyResetRoll;

		public static ConfigEntry<KeyCode> KeyCycleGuide;

		public static ConfigEntry<KeyCode> KeyCycleMatte;

		public static ConfigEntry<KeyCode> KeyForward;

		public static ConfigEntry<KeyCode> KeyBack;

		public static ConfigEntry<KeyCode> KeyLeft;

		public static ConfigEntry<KeyCode> KeyRight;

		public static ConfigEntry<KeyCode> KeyUp;

		public static ConfigEntry<KeyCode> KeyDown;

		public static ConfigEntry<KeyCode> KeyFast;

		public static ConfigEntry<KeyCode> KeySlow;

		public static ConfigEntry<float> MoveSpeed;

		public static ConfigEntry<float> FastMultiplier;

		public static ConfigEntry<float> SlowMultiplier;

		public static ConfigEntry<float> LookSensitivity;

		public static ConfigEntry<float> LookSmoothing;

		public static ConfigEntry<float> MoveSmoothing;

		public static ConfigEntry<float> RollSpeed;

		public static ConfigEntry<float> FovStep;

		public static ConfigEntry<float> TransitionDuration;

		public static ConfigEntry<bool> InvertPitch;

		public static ConfigEntry<bool> HideHudOnEnter;

		public static ConfigEntry<bool> SuppressScreenShake;

		public static ConfigEntry<bool> EnableTimeControls;

		public static ConfigEntry<bool> ShowReadout;

		public static ConfigEntry<bool> ShowToasts;

		public static void Save()
		{
			ConfigFile file = _file;
			if (file != null)
			{
				file.Save();
			}
		}

		public static void ResetAll()
		{
			if (_file == null)
			{
				return;
			}
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in _file)
			{
				ConfigEntryBase value = item.Value;
				if (!(value.SettingType == typeof(KeyCode)))
				{
					value.BoxedValue = value.DefaultValue;
				}
			}
		}

		public static void Bind(ConfigFile c)
		{
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Expected O, but got Unknown
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Expected O, but got Unknown
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Expected O, but got Unknown
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Expected O, but got Unknown
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Expected O, but got Unknown
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Expected O, but got Unknown
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Expected O, but got Unknown
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Expected O, but got Unknown
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Expected O, but got Unknown
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0808: Expected O, but got Unknown
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_0893: Expected O, but got Unknown
			//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cb: Expected O, but got Unknown
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Expected O, but got Unknown
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_093b: Expected O, but got Unknown
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Expected O, but got Unknown
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e1: Expected O, but got Unknown
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aad: Expected O, but got Unknown
			//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae5: Expected O, but got Unknown
			//IL_0b13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1d: Expected O, but got Unknown
			//IL_0b81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8b: Expected O, but got Unknown
			//IL_0bb9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc3: Expected O, but got Unknown
			//IL_0bf1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfb: Expected O, but got Unknown
			//IL_0c29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c33: Expected O, but got Unknown
			//IL_0cca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd4: Expected O, but got Unknown
			//IL_0cfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d05: Expected O, but got Unknown
			//IL_0d2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d36: Expected O, but got Unknown
			//IL_0ded: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df7: Expected O, but got Unknown
			//IL_0e40: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4a: Expected O, but got Unknown
			//IL_0e78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e82: Expected O, but got Unknown
			//IL_0eb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eba: Expected O, but got Unknown
			//IL_0ee8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef2: Expected O, but got Unknown
			//IL_0f20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f2a: Expected O, but got Unknown
			//IL_0f58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f62: Expected O, but got Unknown
			//IL_0fc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd0: Expected O, but got Unknown
			//IL_0ffe: Unknown result type (might be due to invalid IL or missing references)
			//IL_1008: Expected O, but got Unknown
			//IL_1036: Unknown result type (might be due to invalid IL or missing references)
			//IL_1040: Expected O, but got Unknown
			//IL_106e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1078: Expected O, but got Unknown
			//IL_10c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_10cb: Expected O, but got Unknown
			//IL_10f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1103: Expected O, but got Unknown
			//IL_1131: Unknown result type (might be due to invalid IL or missing references)
			//IL_113b: Expected O, but got Unknown
			//IL_1169: Unknown result type (might be due to invalid IL or missing references)
			//IL_1173: Expected O, but got Unknown
			//IL_11a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ab: Expected O, but got Unknown
			//IL_11d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e3: Expected O, but got Unknown
			//IL_122c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1236: Expected O, but got Unknown
			//IL_1264: Unknown result type (might be due to invalid IL or missing references)
			//IL_126e: Expected O, but got Unknown
			//IL_129c: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a6: Expected O, but got Unknown
			//IL_12ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_12f9: Expected O, but got Unknown
			//IL_1327: Unknown result type (might be due to invalid IL or missing references)
			//IL_1331: Expected O, but got Unknown
			//IL_135f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1369: Expected O, but got Unknown
			//IL_1397: Unknown result type (might be due to invalid IL or missing references)
			//IL_13a1: Expected O, but got Unknown
			//IL_13cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_13d9: Expected O, but got Unknown
			//IL_1407: Unknown result type (might be due to invalid IL or missing references)
			//IL_1411: Expected O, but got Unknown
			//IL_143f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1449: Expected O, but got Unknown
			//IL_1477: Unknown result type (might be due to invalid IL or missing references)
			//IL_1481: Expected O, but got Unknown
			//IL_14ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_14d4: Expected O, but got Unknown
			//IL_1502: Unknown result type (might be due to invalid IL or missing references)
			//IL_150c: Expected O, but got Unknown
			//IL_153a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1544: Expected O, but got Unknown
			//IL_1572: Unknown result type (might be due to invalid IL or missing references)
			//IL_157c: Expected O, but got Unknown
			//IL_163a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1644: Expected O, but got Unknown
			//IL_1672: Unknown result type (might be due to invalid IL or missing references)
			//IL_167c: Expected O, but got Unknown
			//IL_16aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b4: Expected O, but got Unknown
			_file = c;
			c.SaveOnConfigSet = false;
			KeyToggleFreeCam = c.Bind<KeyCode>("1. Keybinds", "ToggleFreeCam", (KeyCode)283, "Enter / exit the machinima camera.");
			KeyToggleHud = c.Bind<KeyCode>("1. Keybinds", "ToggleHud", (KeyCode)284, "Show / hide the game HUD while in free cam.");
			KeyToggleFocus = c.Bind<KeyCode>("1. Keybinds", "ToggleControlFocus", (KeyCode)285, "Swap between flying the camera and driving your character.");
			KeyAddKeyframe = c.Bind<KeyCode>("1b. Shot keybinds", "AddKeyframe", (KeyCode)107, "Record the current camera pose as a keyframe.");
			KeyDeleteKeyframe = c.Bind<KeyCode>("1b. Shot keybinds", "DeleteLastKeyframe", (KeyCode)8, "Remove the most recent keyframe.");
			KeyClearShot = c.Bind<KeyCode>("1b. Shot keybinds", "ClearShot", (KeyCode)127, "Throw away the whole shot and start again.");
			KeyPlayShot = c.Bind<KeyCode>("1b. Shot keybinds", "PlayShot", (KeyCode)103, "Play or stop the current shot.");
			KeySaveShot = c.Bind<KeyCode>("1b. Shot keybinds", "SaveShot", (KeyCode)289, "Write the shot to BepInEx/config/MachinimaTools/shots.");
			KeyCycleShot = c.Bind<KeyCode>("1b. Shot keybinds", "CycleSavedShots", (KeyCode)290, "Load the next saved shot from disk.");
			KeyDurationDown = c.Bind<KeyCode>("1b. Shot keybinds", "DurationDown", (KeyCode)45, "Shorten the shot. Hold slow key for fine steps.");
			KeyDurationUp = c.Bind<KeyCode>("1b. Shot keybinds", "DurationUp", (KeyCode)61, "Lengthen the shot. Hold slow key for fine steps.");
			KeyCycleRigMode = c.Bind<KeyCode>("1b. Shot keybinds", "CycleRigMode", (KeyCode)117, "Cycle Free / Follow / Orbit / Mount. Everything but Free needs an aim target.");
			KeyCycleTarget = c.Bind<KeyCode>("1b. Shot keybinds", "CycleAimTarget", (KeyCode)116, "Lock the camera's aim onto the next living character.");
			KeyClearTarget = c.Bind<KeyCode>("1b. Shot keybinds", "ClearAimTarget", (KeyCode)121, "Release the aim lock and go back to manual look.");
			ShowKeyframes = c.Bind<bool>("1b. Shot keybinds", "ShowKeyframes", true, "Draw keyframe markers and the path in the world.");
			KeyBookmarkModifier = c.Bind<KeyCode>("1b. Shot keybinds", "BookmarkStoreModifier", (KeyCode)308, "Hold with 1-9 to store the camera there. 1-9 alone recalls.");
			BookmarkBlend = c.Bind<float>("1b. Shot keybinds", "BookmarkBlend", 0f, new ConfigDescription("Seconds to blend when recalling a bookmark. 0 = snap.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			KeyHideSelf = c.Bind<KeyCode>("1b. Shot keybinds", "HideOwnModel", (KeyCode)105, "Hide your own character.");
			KeyHideOthers = c.Bind<KeyCode>("1b. Shot keybinds", "HideEveryoneElse", (KeyCode)108, "Hide every character except the aim target (or you).");
			KeyToggleMenu = c.Bind<KeyCode>("1. Keybinds", "ToggleMenu", (KeyCode)286, "Open the clickable settings panel.");
			KeyTogglePause = c.Bind<KeyCode>("1. Keybinds", "TogglePause", (KeyCode)112, "Freeze / unfreeze everything. The camera keeps flying either way.");
			KeyFreezeWorld = c.Bind<KeyCode>("1. Keybinds", "FreezeWorldOnly", (KeyCode)104, "Freeze everything except your character.");
			KeyTimeDown = c.Bind<KeyCode>("1. Keybinds", "TimeScaleDown", (KeyCode)44, "Slow time down one step.");
			KeyTimeUp = c.Bind<KeyCode>("1. Keybinds", "TimeScaleUp", (KeyCode)46, "Speed time up one step.");
			KeyFovDown = c.Bind<KeyCode>("1. Keybinds", "FovDown", (KeyCode)91, "Narrow the field of view (longer lens).");
			KeyFovUp = c.Bind<KeyCode>("1. Keybinds", "FovUp", (KeyCode)93, "Widen the field of view (shorter lens).");
			KeyRollLeft = c.Bind<KeyCode>("1. Keybinds", "RollLeft", (KeyCode)122, "Dutch the camera counterclockwise.");
			KeyRollRight = c.Bind<KeyCode>("1. Keybinds", "RollRight", (KeyCode)99, "Dutch the camera clockwise.");
			KeyResetRoll = c.Bind<KeyCode>("1. Keybinds", "ResetRoll", (KeyCode)120, "Level the horizon.");
			KeyCycleGuide = c.Bind<KeyCode>("1. Keybinds", "CycleFramingGuide", (KeyCode)287, "Cycle composition guides: off, thirds, center, both.");
			KeyCycleMatte = c.Bind<KeyCode>("1. Keybinds", "CycleAspectMatte", (KeyCode)288, "Cycle aspect mattes: off, 2.39:1, 2.00:1, 1.85:1, 16:9, 9:16.");
			KeyForward = c.Bind<KeyCode>("2. Movement keys", "Forward", (KeyCode)119, "");
			KeyBack = c.Bind<KeyCode>("2. Movement keys", "Back", (KeyCode)115, "");
			KeyLeft = c.Bind<KeyCode>("2. Movement keys", "Left", (KeyCode)97, "");
			KeyRight = c.Bind<KeyCode>("2. Movement keys", "Right", (KeyCode)100, "");
			KeyUp = c.Bind<KeyCode>("2. Movement keys", "Up", (KeyCode)101, "");
			KeyDown = c.Bind<KeyCode>("2. Movement keys", "Down", (KeyCode)113, "");
			KeyFast = c.Bind<KeyCode>("2. Movement keys", "Fast", (KeyCode)304, "Hold to move faster.");
			KeySlow = c.Bind<KeyCode>("2. Movement keys", "Slow", (KeyCode)306, "Hold to move slower. Use this for the actual takes.");
			MoveSpeed = c.Bind<float>("3. Feel", "MoveSpeed", 12f, new ConfigDescription("Meters per second. Mouse wheel changes it live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 200f), Array.Empty<object>()));
			FastMultiplier = c.Bind<float>("3. Feel", "FastMultiplier", 4f, "");
			SlowMultiplier = c.Bind<float>("3. Feel", "SlowMultiplier", 0.15f, "Multiplier while the slow key is held.");
			LookSensitivity = c.Bind<float>("3. Feel", "LookSensitivity", 2.2f, "");
			LookSmoothing = c.Bind<float>("3. Feel", "LookSmoothing", 0.06f, new ConfigDescription("Mouse look damping in seconds. 0 = off, 0.5+ = heavy camera head that pulls toward where you dragged.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			MoveSmoothing = c.Bind<float>("3. Feel", "MoveSmoothing", 0.12f, new ConfigDescription("Movement damping in seconds. 0 = off.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			RollSpeed = c.Bind<float>("3. Feel", "RollSpeed", 40f, "Degrees per second.");
			FovStep = c.Bind<float>("3. Feel", "FovStep", 2f, "Degrees per keypress.");
			TransitionDuration = c.Bind<float>("3. Feel", "TransitionDuration", 0.35f, new ConfigDescription("Blend time entering/leaving free cam. 0 = hard cut.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
			InvertPitch = c.Bind<bool>("3. Feel", "InvertPitch", false, "");
			AimDamping = c.Bind<float>("3. Feel", "AimDamping", 0.09f, new ConfigDescription("Tracking lag in seconds. 0 = hard lock.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			AimHeadroom = c.Bind<float>("3. Feel", "AimHeadroom", 1.2f, new ConfigDescription("Meters above the target's core to aim at.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 10f), Array.Empty<object>()));
			AimLead = c.Bind<float>("3. Feel", "AimLead", 0.12f, new ConfigDescription("Seconds of velocity prediction. Stops fast targets lagging in frame.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			AimDeadzone = c.Bind<float>("3. Feel", "AimDeadzone", 0f, new ConfigDescription("Degrees of slack before the camera corrects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
			FollowDistance = c.Bind<float>("5. Follow and orbit", "FollowDistance", 8f, "Meters behind the subject.");
			FollowHeight = c.Bind<float>("5. Follow and orbit", "FollowHeight", 2.5f, "Meters above the subject's core.");
			FollowSide = c.Bind<float>("5. Follow and orbit", "FollowSide", 0f, "Lateral offset from the subject.");
			RigDamping = c.Bind<float>("5. Follow and orbit", "RigDamping", 0.35f, new ConfigDescription("Follow/orbit position lag in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			OrbitRadius = c.Bind<float>("5. Follow and orbit", "OrbitRadius", 9f, "Orbit distance.");
			OrbitHeight = c.Bind<float>("5. Follow and orbit", "OrbitHeight", 2.5f, "Orbit height above the subject's core.");
			OrbitSpeed = c.Bind<float>("5. Follow and orbit", "OrbitSpeed", 18f, new ConfigDescription("Degrees per second. Negative reverses.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>()));
			FollowUsesFacing = c.Bind<bool>("5. Follow and orbit", "FollowUsesFacing", true, "Anchor the follow offset to the subject's facing. Off = world-locked bearing.");
			KeyCycleFocusMode = c.Bind<KeyCode>("6. Lens", "CycleFocusMode", (KeyCode)102, "Cycle depth of field: off, manual, tracking the aim target.");
			KeyRackFocus = c.Bind<KeyCode>("6. Lens", "RackFocus", (KeyCode)114, "Pull focus from wherever it is onto the aim target, then hold.");
			Aperture = c.Bind<float>("6. Lens", "Aperture", 2f, new ConfigDescription("f-stop. Lower = shallower.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 32f), Array.Empty<object>()));
			FocusDistance = c.Bind<float>("6. Lens", "FocusDistance", 12f, new ConfigDescription("Meters to the focal plane.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 500f), Array.Empty<object>()));
			FocusDamping = c.Bind<float>("6. Lens", "FocusDamping", 0.18f, new ConfigDescription("Auto focus lag in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			RackDuration = c.Bind<float>("6. Lens", "RackDuration", 1.2f, new ConfigDescription("Seconds for a focus pull.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 10f), Array.Empty<object>()));
			DofFocalLength = c.Bind<float>("6. Lens", "DofFocalLength", 90f, new ConfigDescription("Blur focal length in mm. Main strength control. Under ~40mm there is nothing to see.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 300f), Array.Empty<object>()));
			LinkDofToLens = c.Bind<bool>("6. Lens", "LinkDofToLens", false, "Blur uses the real focal length. The game sits around 16mm, so this mostly means no blur.");
			MotionBlurEnabled = c.Bind<bool>("6. Lens", "MotionBlur", true, "");
			ShutterAngle = c.Bind<float>("6. Lens", "ShutterAngle", 180f, new ConfigDescription("Degrees. 180 = film standard.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
			CompensateShutter = c.Bind<bool>("6. Lens", "CompensateShutterForTimescale", true, "Widen the shutter as time slows so slow-mo keeps its blur.");
			KeyCycleMountBone = c.Bind<KeyCode>("7. Body mount", "CycleMountBone", (KeyCode)98, "Step through bones on the target's model.");
			MountOffsetX = c.Bind<float>("7. Body mount", "OffsetX", 0f, "Offset from the bone, in the chosen frame.");
			MountOffsetY = c.Bind<float>("7. Body mount", "OffsetY", 0.12f, "Offset from the bone, in the chosen frame.");
			MountOffsetZ = c.Bind<float>("7. Body mount", "OffsetZ", 0.2f, "Offset from the bone, in the chosen frame.");
			MountPitch = c.Bind<float>("7. Body mount", "Pitch", 0f, new ConfigDescription("Look pitch. Mouse drives this while mounted.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>()));
			MountYaw = c.Bind<float>("7. Body mount", "Yaw", 0f, new ConfigDescription("Look yaw. Mouse drives this while mounted.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>()));
			MountDamping = c.Bind<float>("7. Body mount", "Damping", 0f, new ConfigDescription("Position lag. 0 = rigidly bolted on, which is usually what you want.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			MountFrame = c.Bind<MountFrame>("7. Body mount", "Frame", MachinimaTools.MountFrame.Actor, "Actor = character facing. Bone = the bone itself. World = fixed axes.");
			MountLevelHorizon = c.Bind<bool>("7. Body mount", "LevelHorizon", true, "In Bone frame, drop the bone's roll so the horizon stays level.");
			MountRotDamping = c.Bind<float>("7. Body mount", "RotationDamping", 0.05f, new ConfigDescription("Smoothing on the inherited rotation. 0 = every jolt, 0.2 = steadicam.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ShakePosition = c.Bind<float>("8. Handheld", "PositionAmount", 0f, new ConfigDescription("Meters of positional shake. Start around 0.02.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ShakeRotation = c.Bind<float>("8. Handheld", "RotationAmount", 0f, new ConfigDescription("Degrees of rotational shake. Start around 0.4.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
			ShakeFrequency = c.Bind<float>("8. Handheld", "Frequency", 1.6f, new ConfigDescription("Noise speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 12f), Array.Empty<object>()));
			ShakeScalesWithSpeed = c.Bind<bool>("8. Handheld", "ScaleWithSpeed", true, "More shake while the camera is moving.");
			KeyDollyZoom = c.Bind<KeyCode>("9. Capture", "ToggleDollyZoom", (KeyCode)110, "Hold subject size while the distance changes.");
			KeyStill = c.Bind<KeyCode>("9. Capture", "Screenshot", (KeyCode)291, "Save a still, HUD and overlay hidden.");
			KeySequence = c.Bind<KeyCode>("9. Capture", "ToggleSequence", (KeyCode)292, "Start/stop a locked-framerate image sequence.");
			StillSupersize = c.Bind<int>("9. Capture", "StillSupersize", 2, new ConfigDescription("Resolution multiplier for stills.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>()));
			CaptureMaxSeconds = c.Bind<int>("9. Capture", "SequenceMaxSeconds", 120, new ConfigDescription("Auto stop after this many real seconds. 0 = no limit.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3600), Array.Empty<object>()));
			CaptureFps = c.Bind<int>("9. Capture", "SequenceFps", 60, new ConfigDescription("Output frame rate. The game runs slower while recording, the files still come out at this rate.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 240), Array.Empty<object>()));
			AllowClientTimeControls = c.Bind<bool>("4. Behavior", "AllowClientTimeControls", false, "Run time controls as a client. Local view only, networked things will stutter.");
			DisableModelFade = c.Bind<bool>("4. Behavior", "DisableModelFade", true, "Stop characters dithering out when the camera gets close.");
			FreezeParticles = c.Bind<bool>("4. Behavior", "FreezeParticles", true, "Pause particles on frozen objects. Off if freezing stutters.");
			KeyAddLight = c.Bind<KeyCode>("10. Scene", "AddSpotLight", (KeyCode)59, "Drop a spot light where the camera is.");
			KeyToggleLights = c.Bind<KeyCode>("10. Scene", "ToggleLights", (KeyCode)118, "Switch every placed light off, or back on. Hold the slow key for just the selected one.");
			LightFade = c.Bind<float>("10. Scene", "LightFade", 0.5f, new ConfigDescription("Seconds for a light to fade in or out. 0 = hard switch.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			SunOverride = c.Bind<bool>("10. Scene", "SunOverride", false, "Take control of the stage's sun.");
			SunIntensity = c.Bind<float>("10. Scene", "SunIntensity", 1f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 8f), Array.Empty<object>()));
			SunKelvin = c.Bind<float>("10. Scene", "SunKelvin", 5500f, new ConfigDescription("Color temperature. 2500 sunset, 6500 noon, 9000 blue hour.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1500f, 12000f), Array.Empty<object>()));
			SunHue = c.Bind<float>("10. Scene", "SunHue", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			SunSat = c.Bind<float>("10. Scene", "SunTint", 0f, new ConfigDescription("How much of the hue to mix in.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			SunPitch = c.Bind<float>("10. Scene", "SunPitch", 50f, new ConfigDescription("Elevation. Low values are long shadows.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-10f, 90f), Array.Empty<object>()));
			SunYaw = c.Bind<float>("10. Scene", "SunYaw", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
			SunShadows = c.Bind<bool>("10. Scene", "SunShadows", true, "");
			AmbientOverride = c.Bind<bool>("10. Scene", "AmbientOverride", false, "Take control of ambient light.");
			AmbientIntensity = c.Bind<float>("10. Scene", "AmbientIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4f), Array.Empty<object>()));
			AmbientKelvin = c.Bind<float>("10. Scene", "AmbientKelvin", 7000f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1500f, 12000f), Array.Empty<object>()));
			AmbientHue = c.Bind<float>("10. Scene", "AmbientHue", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			AmbientSat = c.Bind<float>("10. Scene", "AmbientTint", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			GradeOn = c.Bind<bool>("11. Look", "GradeOn", false, "Color grade override.");
			GradeTemp = c.Bind<float>("11. Look", "Temperature", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
			GradeTint = c.Bind<float>("11. Look", "Tint", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
			GradeSat = c.Bind<float>("11. Look", "Saturation", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
			GradeContrast = c.Bind<float>("11. Look", "Contrast", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
			GradeExposure = c.Bind<float>("11. Look", "Exposure", 0f, new ConfigDescription("Stops.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-4f, 4f), Array.Empty<object>()));
			GradeHue = c.Bind<float>("11. Look", "HueShift", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>()));
			FxOn = c.Bind<bool>("11. Look", "EffectsOn", false, "Vignette, grain, aberration override.");
			FxVignette = c.Bind<float>("11. Look", "Vignette", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FxGrain = c.Bind<float>("11. Look", "Grain", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FxAberration = c.Bind<float>("11. Look", "Aberration", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogOn = c.Bind<bool>("11. Look", "FogOn", false, "Override the stage fog.");
			FogIntensity = c.Bind<float>("11. Look", "FogIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogPower = c.Bind<float>("11. Look", "FogPower", 1f, new ConfigDescription("Falloff curve.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 4f), Array.Empty<object>()));
			FogNear = c.Bind<float>("11. Look", "FogNear", 0.05f, new ConfigDescription("Depth where fog starts, 0 to 1.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogFar = c.Bind<float>("11. Look", "FogFar", 0.9f, new ConfigDescription("Depth where fog is full, 0 to 1.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogHeight = c.Bind<float>("11. Look", "FogHeight", 0f, new ConfigDescription("Ground fog amount.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogHue = c.Bind<float>("11. Look", "FogHue", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogSat = c.Bind<float>("11. Look", "FogSat", 0.15f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FogValue = c.Bind<float>("11. Look", "FogBrightness", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			RainOn = c.Bind<bool>("11. Look", "RainOn", false, "The game's wet surface shimmer, on any stage. Drops come from the Rain weather.");
			RainIntensity = c.Bind<float>("11. Look", "RainIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			RainDensity = c.Bind<float>("11. Look", "RainDensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			WeatherAmount = c.Bind<float>("11. Look", "WeatherAmount", 1f, new ConfigDescription("Particle density multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 5f), Array.Empty<object>()));
			WeatherWind = c.Bind<float>("11. Look", "WeatherWind", 1f, new ConfigDescription("Sideways drift in m/s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-15f, 15f), Array.Empty<object>()));
			KeyCycleParam = c.Bind<KeyCode>("12. Live tuning", "CycleParameter", (KeyCode)111, "Select the next live-tunable parameter.");
			KeyParamDown = c.Bind<KeyCode>("12. Live tuning", "ParameterDown", (KeyCode)281, "Decrease the selected parameter.");
			KeyParamUp = c.Bind<KeyCode>("12. Live tuning", "ParameterUp", (KeyCode)280, "Increase the selected parameter.");
			RelinkMovement = c.Bind<bool>("4. Behavior", "RelinkMovementToAim", true, "Move relative to aim instead of the parked camera.");
			PadEnabled = c.Bind<bool>("13. Gamepad", "Enabled", true, "Camera on a controller. Mapping is below.");
			PadLookSpeed = c.Bind<float>("13. Gamepad", "LookSpeed", 140f, new ConfigDescription("Degrees per second at full stick.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 720f), Array.Empty<object>()));
			PadDeadzone = c.Bind<float>("13. Gamepad", "Deadzone", 0.15f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.6f), Array.Empty<object>()));
			PadCurve = c.Bind<float>("13. Gamepad", "Curve", 2f, new ConfigDescription("Stick response. 1 = linear, 2 = fine control near center.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), Array.Empty<object>()));
			PadAxisAction[] array = new PadAxisAction[7]
			{
				PadAxisAction.MoveX,
				PadAxisAction.MoveZ,
				PadAxisAction.LookX,
				PadAxisAction.LookY,
				PadAxisAction.MoveY,
				PadAxisAction.Roll,
				PadAxisAction.Fov
			};
			bool[] array2 = new bool[7] { false, false, false, false, false, false, true };
			string[] names = Enum.GetNames(typeof(PadAxis));
			PadAxisMap = new ConfigEntry<PadAxisAction>[names.Length];
			PadAxisInvert = new ConfigEntry<bool>[names.Length];
			for (int i = 0; i < names.Length; i++)
			{
				PadAxisMap[i] = c.Bind<PadAxisAction>("13. Gamepad", "Axis" + names[i], array[i], "");
				PadAxisInvert[i] = c.Bind<bool>("13. Gamepad", "Axis" + names[i] + "Invert", array2[i], "");
			}
			PadAction[] array3 = new PadAction[9]
			{
				PadAction.AddKeyframe,
				PadAction.PlayShot,
				PadAction.NextTarget,
				PadAction.RigMode,
				PadAction.Slow,
				PadAction.Fast,
				PadAction.LevelRoll,
				PadAction.FocusMode,
				PadAction.ToggleFocus
			};
			string[] names2 = Enum.GetNames(typeof(PadButton));
			PadButtonMap = new ConfigEntry<PadAction>[names2.Length];
			for (int j = 0; j < names2.Length; j++)
			{
				PadButtonMap[j] = c.Bind<PadAction>("13. Gamepad", "Button" + names2[j], array3[j], (j == 8) ? "Back/View/Select. ToggleFocus on this one also works while driving the character." : "");
			}
			HideHudOnEnter = c.Bind<bool>("4. Behavior", "HideHudOnEnter", true, "Hide the HUD on entering free cam.");
			SuppressScreenShake = c.Bind<bool>("4. Behavior", "SuppressScreenShake", true, "Zero the game's screen shake while filming.");
			EnableTimeControls = c.Bind<bool>("4. Behavior", "EnableTimeControls", true, "Pause and slow motion. Host or singleplayer only.");
			ShowReadout = c.Bind<bool>("4. Behavior", "ShowReadout", true, "Show the camera readout.");
			ShowToasts = c.Bind<bool>("4. Behavior", "ShowMessages", true, "Show the message line at the bottom of the screen.");
		}
	}
	internal static class Controls
	{
		public static bool Fine
		{
			get
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				if (!Input.GetKey(Cfg.KeySlow.Value))
				{
					return Pad.Slow;
				}
				return true;
			}
		}

		public static Vector2 GetLookDelta(float sensitivity)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
			float num = (Input.GetKey((KeyCode)275) ? 1f : 0f) - (Input.GetKey((KeyCode)276) ? 1f : 0f);
			float num2 = (Input.GetKey((KeyCode)273) ? 1f : 0f) - (Input.GetKey((KeyCode)274) ? 1f : 0f);
			if (num != 0f || num2 != 0f)
			{
				float num3 = (Fine ? 6f : 30f);
				val += new Vector2(num, num2) * num3 * Time.unscaledDeltaTime;
			}
			return val * sensitivity + Pad.Look();
		}

		public static Vector3 GetMoveIntent()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			float num = (Input.GetKey(Cfg.KeyRight.Value) ? 1f : 0f) - (Input.GetKey(Cfg.KeyLeft.Value) ? 1f : 0f);
			float num2 = (Input.GetKey(Cfg.KeyUp.Value) ? 1f : 0f) - (Input.GetKey(Cfg.KeyDown.Value) ? 1f : 0f);
			float num3 = (Input.GetKey(Cfg.KeyForward.Value) ? 1f : 0f) - (Input.GetKey(Cfg.KeyBack.Value) ? 1f : 0f);
			Vector3 result = new Vector3(num, num2, num3) + Pad.Move();
			if (!(((Vector3)(ref result)).sqrMagnitude > 1f))
			{
				return result;
			}
			return ((Vector3)(ref result)).normalized;
		}

		public static float GetRollIntent()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			return (Input.GetKey(Cfg.KeyRollRight.Value) ? 1f : 0f) - (Input.GetKey(Cfg.KeyRollLeft.Value) ? 1f : 0f) + Pad.Roll();
		}

		public static float GetScroll()
		{
			return Input.GetAxisRaw("Mouse ScrollWheel");
		}

		public static float SpeedMultiplier()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(Cfg.KeyFast.Value))
			{
				return Cfg.FastMultiplier.Value;
			}
			if (Input.GetKey(Cfg.KeySlow.Value))
			{
				return Cfg.SlowMultiplier.Value;
			}
			return Pad.SpeedMultiplier();
		}
	}
	internal class Director : MonoBehaviour
	{
		internal FreeCamRig FreeCam;

		internal Lens Optics;

		internal Capture Recorder;

		internal WorldFreeze Freeze;

		internal Lighting Lights;

		internal Weather Sky;

		private int _targetIndex = -1;

		private CameraRigController _rig;

		private float _defaultFixedDelta;

		private float _preTimeScale = 1f;

		private UserProfile _shakeProfile;

		private float _shakeOriginal = 1f;

		private int _lastRelinkFrame = -1;

		private bool _fadeWas = true;

		private readonly List<CharacterModel> _hidden = new List<CharacterModel>();

		private readonly Key[] _bookmarks = new Key[10];

		private float _messageUntil;

		public Shot Current = new Shot();

		private float _playStart;

		private List<string> _library = new List<string>();

		private int _libraryIndex = -1;

		private static readonly float[] TimeSteps = new float[11]
		{
			0.01f, 0.025f, 0.05f, 0.1f, 0.2f, 0.35f, 0.5f, 0.75f, 1f, 1.5f,
			2f
		};

		private int _timeIndex = 8;

		private Shot _transient;

		public static Director Instance { get; private set; }

		public bool SelfHidden { get; private set; }

		public bool OthersHidden { get; private set; }

		public bool Active { get; private set; }

		public string LastMessage { get; private set; } = "";

		public bool Playing { get; private set; }

		public float PlayHead { get; private set; }

		private Shot PlayingShot => _transient ?? Current;

		public bool HasMessage => Time.unscaledTime < _messageUntil;

		public bool HasBookmark(int i)
		{
			if (i >= 0 && i < 10)
			{
				return _bookmarks[i] != null;
			}
			return false;
		}

		private void Awake()
		{
			Instance = this;
			_defaultFixedDelta = Time.fixedDeltaTime;
			FreeCam = ((Component)this).gameObject.AddComponent<FreeCamRig>();
			Optics = ((Component)this).gameObject.AddComponent<Lens>();
			Recorder = ((Component)this).gameObject.AddComponent<Capture>();
			Freeze = ((Component)this).gameObject.AddComponent<WorldFreeze>();
			Lights = ((Component)this).gameObject.AddComponent<Lighting>();
			Sky = ((Component)this).gameObject.AddComponent<Weather>();
		}

		private void LateUpdate()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (Active && !((Object)(object)_rig == (Object)null) && Time.deltaTime == 0f)
			{
				CameraState cameraState = default(CameraState);
				FreeCam.GetCameraState(_rig, ref cameraState);
				_rig.SetCameraState(cameraState);
			}
		}

		public void RelinkMovementToAim()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if (!Active || (Object)(object)_rig == (Object)null || !Cfg.RelinkMovement.Value || FreeCam.Focus != FreeCamRig.ControlFocus.Character || _lastRelinkFrame == Time.frameCount)
			{
				return;
			}
			_lastRelinkFrame = Time.frameCount;
			CharacterBody targetBody = _rig.targetBody;
			if ((Object)(object)targetBody == (Object)null)
			{
				return;
			}
			InputBankTest inputBank = targetBody.inputBank;
			if ((Object)(object)inputBank == (Object)null)
			{
				return;
			}
			Vector3 moveVector = inputBank.moveVector;
			if (((Vector3)(ref moveVector)).sqrMagnitude < 1E-06f)
			{
				return;
			}
			Vector3 aimDirection = inputBank.aimDirection;
			aimDirection.y = 0f;
			if (!(((Vector3)(ref aimDirection)).sqrMagnitude < 1E-06f))
			{
				Quaternion val = Quaternion.LookRotation(((Vector3)(ref aimDirection)).normalized);
				float y = ((Quaternion)(ref val)).eulerAngles.y;
				float num = Mathf.DeltaAngle(((Component)_rig).transform.eulerAngles.y, y);
				if (!(Mathf.Abs(num) < 0.01f))
				{
					inputBank.moveVector = Quaternion.Euler(0f, num, 0f) * moveVector;
				}
			}
		}

		private void Update()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			Menu instance = Menu.Instance;
			if ((Object)(object)instance == (Object)null || !instance.Listening)
			{
				if (Input.GetKeyDown(Cfg.KeyToggleMenu.Value) && (Object)(object)instance != (Object)null)
				{
					instance.Toggle();
				}
				if (Input.GetKeyDown(Cfg.KeyToggleFreeCam.Value))
				{
					if (Active)
					{
						Exit();
					}
					else
					{
						Enter();
					}
				}
			}
			if (!Active)
			{
				return;
			}
			if ((Object)(object)_rig == (Object)null)
			{
				Exit("Camera rig gone, dropping out");
				return;
			}
			if (!_rig.IsOverrideCam((ICameraStateProvider)(object)FreeCam))
			{
				if (_rig.hasOverride)
				{
					Exit("Something else took the camera");
					return;
				}
				_rig.SetOverrideCam((ICameraStateProvider)(object)FreeCam, 0f);
			}
			bool flag = (Object)(object)Menu.Instance != (Object)null && Menu.Instance.Open;
			if (Recorder.Recording && (Input.GetKeyDown(Cfg.KeySequence.Value) || Input.GetKeyDown((KeyCode)27)))
			{
				Notify(Recorder.StopSequence());
				return;
			}
			if (!flag)
			{
				ReadHotkeys();
				ReadShotKeys();
				ReadPad();
			}
			if (Playing)
			{
				TickPlayback();
			}
			else
			{
				FreeCam.Tick(!flag);
			}
			FreeCam.ApplyAimTarget();
			FreeCam.TickShake();
			Optics.Tick(_rig, FreeCam);
			Lights.Tick(FreeCam);
			Sky.Tick(FreeCam);
		}

		private bool Hot(KeyCode k)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			if (!Input.GetKeyDown(k))
			{
				return false;
			}
			if (FreeCam.Focus == FreeCamRig.ControlFocus.Camera)
			{
				return true;
			}
			if ((int)k >= 282)
			{
				return (int)k <= 296;
			}
			return false;
		}

		private void ReadHotkeys()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			if (Hot(Cfg.KeyToggleHud.Value))
			{
				ToggleHud();
			}
			if (Hot(Cfg.KeyToggleFocus.Value))
			{
				ToggleFocus();
			}
			if (Cfg.EnableTimeControls.Value)
			{
				if (Hot(Cfg.KeyTogglePause.Value))
				{
					TogglePause();
				}
				if (Hot(Cfg.KeyTimeDown.Value))
				{
					StepTime(-1);
				}
				if (Hot(Cfg.KeyTimeUp.Value))
				{
					StepTime(1);
				}
			}
		}

		public void ToggleHud()
		{
			FreeCam.ShowHud = !FreeCam.ShowHud;
			Notify(FreeCam.ShowHud ? "HUD on" : "HUD off");
		}

		public void ToggleFocus()
		{
			bool flag = FreeCam.Focus == FreeCamRig.ControlFocus.Camera;
			FreeCam.Focus = (flag ? FreeCamRig.ControlFocus.Character : FreeCamRig.ControlFocus.Camera);
			if (!flag)
			{
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
			}
			Notify(flag ? "Character. Camera holds." : "Camera. Character locked.");
		}

		private void ReadPad()
		{
			if (!Pad.Connected)
			{
				return;
			}
			bool flag = FreeCam.Focus == FreeCamRig.ControlFocus.Character;
			for (int i = 0; i < Cfg.PadButtonMap.Length; i++)
			{
				if (Pad.Pressed((PadButton)i))
				{
					PadAction value = Cfg.PadButtonMap[i].Value;
					if (!Pad.IsHeldAction(value) && (!flag || value == PadAction.ToggleFocus))
					{
						RunPadAction(value);
					}
				}
			}
		}

		private void RunPadAction(PadAction a)
		{
			switch (a)
			{
			case PadAction.ToggleFocus:
				ToggleFocus();
				break;
			case PadAction.AddKeyframe:
				AddKeyframe();
				break;
			case PadAction.PlayShot:
				TogglePlay();
				break;
			case PadAction.NextTarget:
				CycleTarget();
				break;
			case PadAction.ReleaseTarget:
				ClearTarget();
				break;
			case PadAction.RigMode:
				CycleRigMode();
				break;
			case PadAction.LevelRoll:
				FreeCam.LevelRoll();
				Notify("Level");
				break;
			case PadAction.FocusMode:
				Notify(Optics.CycleMode());
				break;
			case PadAction.RackFocus:
				Notify(Optics.Rack(FreeCam));
				break;
			case PadAction.Screenshot:
				Notify(Recorder.Still());
				break;
			case PadAction.Record:
				ToggleSequence();
				break;
			case PadAction.FreezeAll:
				if (Cfg.EnableTimeControls.Value)
				{
					TogglePause();
				}
				break;
			case PadAction.FreezeWorld:
				ToggleWorldFreeze();
				break;
			case PadAction.Hud:
				ToggleHud();
				break;
			case PadAction.DollyZoom:
				Notify(FreeCam.ToggleDollyZoom());
				break;
			case PadAction.Panel:
				if ((Object)(object)Menu.Instance != (Object)null)
				{
					Menu.Instance.Toggle();
				}
				break;
			case PadAction.LightsToggle:
				Notify(Lights.ToggleAll());
				break;
			}
		}

		private void ReadShotKeys()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			if (Hot(Cfg.KeyAddKeyframe.Value))
			{
				AddKeyframe();
			}
			if (Hot(Cfg.KeyDeleteKeyframe.Value))
			{
				RemoveKeyframe();
			}
			if (Hot(Cfg.KeyClearShot.Value))
			{
				ClearShot();
			}
			if (Hot(Cfg.KeyPlayShot.Value))
			{
				TogglePlay();
			}
			if (Hot(Cfg.KeyDurationDown.Value))
			{
				Current.duration = Mathf.Max(0.25f, Current.duration - DurationStep());
				Notify($"Duration {Current.duration:0.##}s");
			}
			if (Hot(Cfg.KeyDurationUp.Value))
			{
				Current.duration = Mathf.Min(600f, Current.duration + DurationStep());
				Notify($"Duration {Current.duration:0.##}s");
			}
			if (Hot(Cfg.KeySaveShot.Value))
			{
				SaveShot();
			}
			if (Hot(Cfg.KeyCycleShot.Value))
			{
				CycleLibrary();
			}
			if (Hot(Cfg.KeyCycleParam.Value))
			{
				Tuner.Cycle((!Controls.Fine) ? 1 : (-1));
				Notify(Tuner.Selected.Label + "  " + Tuner.Selected.Display);
			}
			if (Hot(Cfg.KeyParamUp.Value) || Hot(Cfg.KeyParamDown.Value))
			{
				float direction = (Hot(Cfg.KeyParamUp.Value) ? 1f : (-1f));
				Tuner.Selected.Nudge(direction, Controls.Fine);
				Notify(Tuner.Selected.Label + "  " + Tuner.Selected.Display);
			}
			if (Hot(Cfg.KeyCycleFocusMode.Value))
			{
				Notify(Optics.CycleMode());
			}
			if (Hot(Cfg.KeyRackFocus.Value))
			{
				Notify(Optics.Rack(FreeCam));
			}
			if (Hot(Cfg.KeyCycleRigMode.Value))
			{
				CycleRigMode();
			}
			if (Hot(Cfg.KeyCycleMountBone.Value))
			{
				Notify(FreeCam.CycleMountBone());
			}
			if (Hot(Cfg.KeyDollyZoom.Value))
			{
				Notify(FreeCam.ToggleDollyZoom());
			}
			if (Hot(Cfg.KeyFreezeWorld.Value))
			{
				ToggleWorldFreeze();
			}
			if (Hot(Cfg.KeyHideSelf.Value))
			{
				ToggleHideSelf();
			}
			if (Hot(Cfg.KeyAddLight.Value))
			{
				Notify(Lights.Add(spot: true, FreeCam));
			}
			if (Hot(Cfg.KeyToggleLights.Value))
			{
				Notify(Controls.Fine ? Lights.ToggleSelected() : Lights.ToggleAll());
			}
			if (Hot(Cfg.KeyHideOthers.Value))
			{
				ToggleHideOthers();
			}
			bool key = Input.GetKey(Cfg.KeyBookmarkModifier.Value);
			for (int i = 1; i <= 9; i++)
			{
				if (FreeCam.Focus != FreeCamRig.ControlFocus.Camera)
				{
					break;
				}
				if (Input.GetKeyDown((KeyCode)(48 + i)))
				{
					if (key)
					{
						StoreBookmark(i);
					}
					else
					{
						RecallBookmark(i);
					}
				}
			}
			if (Hot(Cfg.KeyStill.Value))
			{
				Notify(Recorder.Still());
			}
			if (Hot(Cfg.KeySequence.Value))
			{
				ToggleSequence();
			}
			if (Hot(Cfg.KeyCycleTarget.Value))
			{
				CycleTarget();
			}
			if (Hot(Cfg.KeyClearTarget.Value))
			{
				ClearTarget();
			}
		}

		private void CycleRigMode()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)FreeCam.AimTarget == (Object)null)
			{
				Notify($"Need a target ({Cfg.KeyCycleTarget.Value})");
				return;
			}
			switch (FreeCam.Mode)
			{
			case FreeCamRig.RigMode.Free:
				FreeCam.Mode = FreeCamRig.RigMode.Follow;
				Notify("FOLLOW. WASD moves the offset, Q/E booms");
				break;
			case FreeCamRig.RigMode.Follow:
				FreeCam.SyncOrbitAngle();
				FreeCam.Mode = FreeCamRig.RigMode.Orbit;
				Notify("ORBIT. A/D arc, W/S radius, Q/E height");
				break;
			case FreeCamRig.RigMode.Orbit:
				FreeCam.Mode = FreeCamRig.RigMode.Mount;
				Notify(FreeCam.CycleMountBone() + $"   ({Cfg.KeyCycleMountBone.Value} for next bone)");
				break;
			default:
				FreeCam.Mode = FreeCamRig.RigMode.Free;
				Notify("FREE flight");
				break;
			}
		}

		public void CycleTarget()
		{
			ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
			if (readOnlyInstancesList.Count == 0)
			{
				Notify("Nothing to target");
				return;
			}
			List<CharacterBody> list = new List<CharacterBody>();
			for (int i = 0; i < readOnlyInstancesList.Count; i++)
			{
				CharacterBody val = readOnlyInstancesList[i];
				if (!((Object)(object)val == (Object)null))
				{
					HealthComponent healthComponent = val.healthComponent;
					if (!((Object)(object)healthComponent != (Object)null) || healthComponent.alive)
					{
						list.Add(val);
					}
				}
			}
			if (list.Count == 0)
			{
				Notify("Nothing alive to target");
				return;
			}
			_targetIndex = (_targetIndex + 1) % list.Count;
			FreeCam.AimTarget = list[_targetIndex];
			string text = FreeCam.AimTarget.GetDisplayName();
			if (string.IsNullOrEmpty(text))
			{
				text = ((Object)FreeCam.AimTarget).name;
			}
			Notify($"Tracking {text}  ({_targetIndex + 1}/{list.Count})");
		}

		public void ClearTarget()
		{
			FreeCam.AimTarget = null;
			FreeCam.Mode = FreeCamRig.RigMode.Free;
			_targetIndex = -1;
			Notify("Aim released");
		}

		public void SetTime(float s)
		{
			if (!NetAuth.CanControlTime)
			{
				Notify(NetAuth.Refusal);
				return;
			}
			SetTimeScale(s);
			Notify($"Time {s:0.###}x");
		}

		public void TogglePause()
		{
			if (!NetAuth.CanControlTime)
			{
				Notify(NetAuth.Refusal);
			}
			else if (Time.timeScale > 0f)
			{
				_preTimeScale = Time.timeScale;
				SetTimeScale(0f);
				Notify("Frozen. Camera still flies.");
			}
			else
			{
				SetTimeScale((_preTimeScale <= 0f) ? 1f : _preTimeScale);
				Notify($"Time {Time.timeScale:0.###}x");
			}
		}

		public void RemoveKeyframe()
		{
			Current.RemoveLast();
			Notify((Current.Count == 0) ? "Shot empty" : $"Keyframe removed, {Current.Count} left");
		}

		public void ClearShot()
		{
			Current = new Shot();
			Playing = false;
			Notify("Shot cleared");
		}

		public void TogglePlay()
		{
			if (Playing)
			{
				Playing = false;
				Notify("Playback stopped");
			}
			else if (Current.Playable)
			{
				Playing = true;
				_playStart = Time.unscaledTime;
				Notify($"Playing {Current.duration:0.#}s");
			}
			else
			{
				Notify("Need at least 2 keyframes");
			}
		}

		public void MountPreset(string preset)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)FreeCam.AimTarget == (Object)null && (Object)(object)_rig != (Object)null)
			{
				FreeCam.AimTarget = _rig.targetBody;
			}
			string text;
			switch (preset)
			{
			case "helmet":
				text = FreeCam.MountOn("head", MountFrame.Actor, new Vector3(0f, 0.1f, 0.25f), 0f, 0.04f, level: true);
				break;
			case "bob":
				text = FreeCam.MountOn("head", MountFrame.Bone, new Vector3(0f, 0.1f, 0.25f), 0f, 0f, level: true);
				break;
			case "shoulder":
				text = FreeCam.MountOn("chest", MountFrame.Actor, new Vector3(0.7f, 0.5f, -1.4f), 0.08f, 0.15f, level: true);
				break;
			case "chest":
				text = FreeCam.MountOn("chest", MountFrame.Actor, new Vector3(0f, 0f, 0.35f), 0f, 0.06f, level: true);
				break;
			case "weapon":
				text = FreeCam.MountOn("muzzle", MountFrame.Bone, new Vector3(0f, 0.08f, -0.4f), 0f, 0.02f, level: false);
				break;
			case "low":
				text = FreeCam.MountOn("pelvis", MountFrame.Actor, new Vector3(0f, -0.6f, 2.2f), 0.12f, 0.2f, level: true);
				Cfg.MountYaw.Value = 180f;
				Cfg.MountPitch.Value = -8f;
				break;
			default:
				text = FreeCam.MountOn("head", MountFrame.Actor, new Vector3(0f, 0.1f, 0.25f), 0f, 0.04f, level: true);
				break;
			}
			Notify(text + $"   ({Cfg.KeyCycleMountBone.Value} next bone)");
		}

		public void ToggleWorldFreeze()
		{
			if (!Freeze.Active && !NetAuth.CanControlTime)
			{
				Notify(NetAuth.Refusal);
				return;
			}
			CharacterBody val = FreeCam.AimTarget;
			if ((Object)(object)val == (Object)null && (Object)(object)_rig != (Object)null)
			{
				val = _rig.targetBody;
			}
			string text = (((Object)(object)val == (Object)null) ? "nobody" : val.GetDisplayName());
			string text2 = Freeze.Toggle(val);
			Notify(Freeze.Active ? (text2 + "  " + text + " still moves") : text2);
		}

		public void ToggleSequence()
		{
			if (Recorder.Recording)
			{
				Notify(Recorder.StopSequence());
				return;
			}
			if ((Object)(object)Menu.Instance != (Object)null)
			{
				Menu.Instance.SetOpen(open: false);
			}
			Notify(Recorder.StartSequence());
		}

		public void StoreBookmark(int i)
		{
			_bookmarks[i] = FreeCam.Snapshot();
			Notify($"Bookmark {i} stored");
		}

		public void RecallBookmark(int i)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			Key key = _bookmarks[i];
			if (key == null)
			{
				Notify($"No bookmark {i}. {Cfg.KeyBookmarkModifier.Value}+{i} to store.");
				return;
			}
			float value = Cfg.BookmarkBlend.Value;
			if (value > 0.01f)
			{
				Shot shot = new Shot
				{
					name = "bookmark",
					duration = value,
					easeEnds = true
				};
				shot.Add(FreeCam.Snapshot());
				shot.Add(key);
				_transient = shot;
				_playStart = Time.unscaledTime;
				Playing = true;
			}
			else
			{
				FreeCam.SetPose(key.pos, key.yaw, key.pitch, key.roll, key.fov);
			}
			Notify($"Bookmark {i}");
		}

		public void ScrubTo(float t)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (Current.Playable)
			{
				Playing = false;
				PlayHead = Mathf.Clamp01(t);
				Key key = Current.Evaluate(PlayHead);
				FreeCam.SetPose(key.pos, key.yaw, key.pitch, key.roll, key.fov);
				Optics.ApplyFromKey(key.focus, key.aperture);
			}
		}

		public void GoToKey(int i)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (i >= 0 && i < Current.Count)
			{
				Key key = Current.keys[i];
				Playing = false;
				FreeCam.SetPose(key.pos, key.yaw, key.pitch, key.roll, key.fov);
				Optics.ApplyFromKey(key.focus, key.aperture);
				Notify($"Key {i + 1}");
			}
		}

		public void OverwriteKey(int i)
		{
			if (i >= 0 && i < Current.Count)
			{
				Key key = FreeCam.Snapshot();
				if (Optics.Mode != Lens.FocusMode.Off)
				{
					key.focus = Optics.CurrentFocus;
					key.aperture = Cfg.Aperture.Value;
				}
				Current.keys[i] = key;
				Current.UnwrapAngles();
				Notify($"Key {i + 1} overwritten");
			}
		}

		public void DeleteKey(int i)
		{
			if (i >= 0 && i < Current.Count)
			{
				Current.keys.RemoveAt(i);
				Current.UnwrapAngles();
				Notify($"Key {i + 1} deleted");
			}
		}

		private static CharacterModel ModelOf(CharacterBody b)
		{
			ModelLocator val = (((Object)(object)b == (Object)null) ? null : b.modelLocator);
			Transform val2 = (((Object)(object)val == (Object)null) ? null : val.modelTransform);
			if (!((Object)(object)val2 == (Object)null))
			{
				return ((Component)val2).GetComponent<CharacterModel>();
			}
			return null;
		}

		private void Hide(CharacterModel m)
		{
			if (!((Object)(object)m == (Object)null) && !_hidden.Contains(m))
			{
				int invisibilityCount = m.invisibilityCount;
				m.invisibilityCount = invisibilityCount + 1;
				_hidden.Add(m);
			}
		}

		private void UnhideAll()
		{
			foreach (CharacterModel item in _hidden)
			{
				if ((Object)(object)item != (Object)null)
				{
					int invisibilityCount = item.invisibilityCount;
					item.invisibilityCount = invisibilityCount - 1;
				}
			}
			_hidden.Clear();
			SelfHidden = false;
			OthersHidden = false;
		}

		public void ToggleHideSelf()
		{
			SetHiding(!SelfHidden, OthersHidden);
		}

		public void ToggleHideOthers()
		{
			SetHiding(SelfHidden, !OthersHidden);
		}

		private void SetHiding(bool self, bool others)
		{
			UnhideAll();
			CharacterBody val = (((Object)(object)_rig == (Object)null) ? null : _rig.targetBody);
			CharacterBody val2 = (((Object)(object)FreeCam.AimTarget != (Object)null) ? FreeCam.AimTarget : val);
			if (self)
			{
				Hide(ModelOf(val));
			}
			if (others)
			{
				ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
				for (int i = 0; i < readOnlyInstancesList.Count; i++)
				{
					CharacterBody val3 = readOnlyInstancesList[i];
					if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)val2) && !((Object)(object)val3 == (Object)(object)val))
					{
						Hide(ModelOf(val3));
					}
				}
			}
			SelfHidden = self;
			OthersHidden = others;
			if (!self && !others)
			{
				Notify("Everyone visible");
			}
			else if (others)
			{
				Notify(((Object)(object)val2 == (Object)(object)val && self) ? "Everyone hidden" : ("Hidden all but " + ((val2 != null) ? val2.GetDisplayName() : null)));
			}
			else
			{
				Notify("Own model hidden");
			}
		}

		public void AddKeyframe()
		{
			Key key = FreeCam.Snapshot();
			if (Optics.Mode != Lens.FocusMode.Off)
			{
				key.focus = Optics.CurrentFocus;
				key.aperture = Cfg.Aperture.Value;
			}
			Current.Add(key);
			Notify($"Keyframe {Current.Count} recorded" + ((key.focus > 0f) ? $" (focus {key.focus:0.#}m)" : ""));
		}

		public void SaveShot()
		{
			if (Current.Count == 0)
			{
				Notify("Nothing to save");
				return;
			}
			if (Current.name == "untitled")
			{
				Current.name = "shot_" + DateTime.Now.ToString("MMdd_HHmmss");
			}
			string text = Current.Save();
			_library.Clear();
			Cfg.Save();
			Notify("Saved " + Current.name + ".json");
			Log.Info("Saved shot to " + text);
		}

		private float DurationStep()
		{
			if (!Controls.Fine)
			{
				return 1f;
			}
			return 0.25f;
		}

		public void CycleLibrary()
		{
			if (_library.Count == 0)
			{
				_library = Shot.List();
				_libraryIndex = -1;
			}
			if (_library.Count == 0)
			{
				Notify("No saved shots yet");
				return;
			}
			_libraryIndex = (_libraryIndex + 1) % _library.Count;
			Shot shot = Shot.Load(_library[_libraryIndex]);
			if (shot == null)
			{
				Notify("Failed to read that shot");
				return;
			}
			Current = shot;
			Playing = false;
			Notify($"Loaded {Current.name} ({Current.Count} keys, {Current.duration:0.#}s)");
		}

		private void TickPlayback()
		{
			//IL_000d: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (FreeCam.Focus == FreeCamRig.ControlFocus.Camera && Controls.GetMoveIntent() != Vector3.zero)
			{
				Playing = false;
				_transient = null;
				Notify("Playback canceled");
				return;
			}
			Shot playingShot = PlayingShot;
			float num = (Time.unscaledTime - _playStart) / Mathf.Max(0.05f, playingShot.duration);
			if (num >= 1f && !playingShot.loop)
			{
				num = 1f;
				Playing = false;
				if (_transient == null)
				{
					Notify("Shot complete");
				}
				_transient = null;
			}
			if (_transient == null)
			{
				PlayHead = (playingShot.loop ? Mathf.Repeat(num, 1f) : Mathf.Clamp01(num));
			}
			Key key = playingShot.Evaluate(num);
			FreeCam.SetPose(key.pos, key.yaw, key.pitch, key.roll, key.fov);
			Optics.ApplyFromKey(key.focus, key.aperture);
		}

		private void StepTime(int dir)
		{
			if (!NetAuth.CanControlTime)
			{
				Notify(NetAuth.Refusal);
				return;
			}
			_timeIndex = Mathf.Clamp(_timeIndex + dir, 0, TimeSteps.Length - 1);
			SetTimeScale(TimeSteps[_timeIndex]);
			Notify($"Time {Time.timeScale:0.###}x");
		}

		private void SetTimeScale(float s)
		{
			Time.timeScale = s;
			Time.fixedDeltaTime = _defaultFixedDelta * ((s <= 0f) ? 1f : s);
		}

		private void SuppressShake(CameraRigController rig)
		{
			LocalUser localUserViewer = rig.localUserViewer;
			UserProfile val = ((localUserViewer != null) ? localUserViewer.userProfile : null);
			if (val != null)
			{
				_shakeProfile = val;
				_shakeOriginal = val.screenShakeScale;
				val.screenShakeScale = 0f;
			}
		}

		private void RestoreShake()
		{
			if (_shakeProfile != null)
			{
				_shakeProfile.screenShakeScale = _shakeOriginal;
			}
			_shakeProfile = null;
		}

		public void Enter()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			CameraRigController val = ResolveLocalRig();
			if ((Object)(object)val == (Object)null)
			{
				Notify("No camera found. In a run?");
				Log.Warn("Enter() failed: no CameraRigController with a local viewer.");
				return;
			}
			_rig = val;
			FreeCam.Seed(val.currentCameraState);
			FreeCam.ShowHud = !Cfg.HideHudOnEnter.Value;
			FreeCam.Focus = FreeCamRig.ControlFocus.Camera;
			if (Cfg.SuppressScreenShake.Value)
			{
				SuppressShake(val);
			}
			_fadeWas = val.enableFading;
			if (Cfg.DisableModelFade.Value)
			{
				val.enableFading = false;
			}
			val.SetOverrideCam((ICameraStateProvider)(object)FreeCam, Cfg.TransitionDuration.Value);
			Active = true;
			Log.Info($"Free cam engaged at {FreeCam.Position}, fov {FreeCam.Fov:0.#}.");
			Notify("Free cam engaged");
		}

		public void Exit(string reason = null)
		{
			Playing = false;
			if ((Object)(object)_rig != (Object)null)
			{
				_rig.enableFading = _fadeWas;
			}
			if ((Object)(object)Lights != (Object)null)
			{
				Lights.Release();
			}
			if ((Object)(object)Sky != (Object)null)
			{
				Sky.Stop();
			}
			UnhideAll();
			if ((Object)(object)Recorder != (Object)null && Recorder.Recording)
			{
				Recorder.StopSequence();
			}
			if ((Object)(object)Freeze != (Object)null && Freeze.Active)
			{
				Freeze.Thaw();
			}
			if ((Object)(object)Menu.Instance != (Object)null)
			{
				Menu.Instance.SetOpen(open: false);
			}
			RestoreShake();
			if ((Object)(object)Optics != (Object)null)
			{
				Optics.Release();
			}
			if ((Object)(object)_rig != (Object)null)
			{
				_rig.SetOverrideCam((ICameraStateProvider)null, Cfg.TransitionDuration.Value);
			}
			_rig = null;
			Active = false;
			Pad.Drop();
			if (Cfg.EnableTimeControls.Value && Time.timeScale != 1f)
			{
				_timeIndex = 8;
				SetTimeScale(1f);
			}
			Cfg.Save();
			Log.Info("Free cam released." + ((reason == null) ? "" : (" " + reason)));
			Notify(reason ?? "Free cam released");
		}

		private static CameraRigController ResolveLocalRig()
		{
			ReadOnlyCollection<CameraRigController> readOnlyInstancesList = CameraRigController.readOnlyInstancesList;
			for (int i = 0; i < readOnlyInstancesList.Count; i++)
			{
				CameraRigController val = readOnlyInstancesList[i];
				if ((Object)(object)val != (Object)null && val.localUserViewer != null)
				{
					return val;
				}
			}
			for (int j = 0; j < readOnlyInstancesList.Count; j++)
			{
				if ((Object)(object)readOnlyInstancesList[j] != (Object)null)
				{
					return readOnlyInstancesList[j];
				}
			}
			return null;
		}

		public void Notify(string msg)
		{
			LastMessage = msg;
			_messageUntil = Time.unscaledTime + 2.5f;
		}

		private void OnDestroy()
		{
			if (Active)
			{
				Exit();
			}
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}
	}
	public enum MountFrame
	{
		Actor,
		Bone,
		World
	}
	internal class FreeCamRig : MonoBehaviour, ICameraStateProvider
	{
		public enum ControlFocus
		{
			Camera,
			Character
		}

		public enum RigMode
		{
			Free,
			Follow,
			Orbit,
			Mount
		}

		private Vector3 _targetPos;

		private float _targetYaw;

		private float _targetPitch;

		private Vector3 _pos;

		private float _yaw;

		private float _pitch;

		private float _roll;

		private Vector3 _posVelocity;

		private float _yawVelocity;

		private float _pitchVelocity;

		private float _aimYawVelocity;

		private float _aimPitchVelocity;

		private float _fov = 60f;

		private float _speed = 12f;

		public RigMode Mode;

		public ControlFocus Focus;

		public bool ShowHud;

		private float _orbitAngle;

		private Transform[] _bones;

		private int _boneIndex;

		private Transform _bone;

		private bool _useDirectRot;

		private Quaternion _directRot = Quaternion.identity;

		private Vector3 _shakePos;

		private Vector3 _shakeRot;

		private float _shakeSeed;

		private bool _dollyZoom;

		private float _dollyK;

		public CharacterBody AimTarget;

		private bool _input = true;

		private Quaternion _mountFrame = Quaternion.identity;

		private bool _mountFrameInit;

		private float _mountYawSm;

		private float _mountPitchSm;

		private float _mountYawVel;

		private float _mountPitchVel;

		private static readonly string[] BonePriority = new string[9] { "head", "neck", "chest", "spine", "muzzle", "hand", "weapon", "pelvis", "base" };

		public string BoneName
		{
			get
			{
				if (!((Object)(object)_bone == (Object)null))
				{
					return ((Object)_bone).name;
				}
				return "none";
			}
		}

		public bool DollyZoom => _dollyZoom;

		public Vector3 Position => _pos;

		public float Fov => _fov;

		public float Speed => _speed;

		public Vector3 EulerAngles => new Vector3(_pitch, _yaw, _roll);

		public int BoneIndex => _boneIndex;

		public float FocalLength35mm => 12f / Mathf.Tan(_fov * 0.5f * (MathF.PI / 180f));

		public void Seed(CameraState state)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			_pos = (_targetPos = state.position);
			Vector3 eulerAngles = ((Quaternion)(ref state.rotation)).eulerAngles;
			_pitch = (_targetPitch = NormalizeAngle(eulerAngles.x));
			_yaw = (_targetYaw = eulerAngles.y);
			_roll = 0f;
			_fov = ((state.fov > 1f) ? state.fov : 60f);
			_speed = Cfg.MoveSpeed.Value;
			_posVelocity = Vector3.zero;
			_yawVelocity = 0f;
			_pitchVelocity = 0f;
		}

		public void SetPose(Vector3 pos, float yaw, float pitch, float roll, float fov)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			_pos = (_targetPos = pos);
			_yaw = (_targetYaw = yaw);
			_pitch = (_targetPitch = pitch);
			_roll = roll;
			_fov = fov;
			_posVelocity = Vector3.zero;
			_yawVelocity = 0f;
			_pitchVelocity = 0f;
		}

		public void ReloadSpeed()
		{
			_speed = Cfg.MoveSpeed.Value;
		}

		public Key Snapshot()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Key
			{
				pos = _pos,
				yaw = _yaw,
				pitch = _pitch,
				roll = _roll,
				fov = _fov
			};
		}

		public void Tick(bool allowInput = true)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			if (Focus == ControlFocus.Character)
			{
				return;
			}
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			if (unscaledDeltaTime <= 0f)
			{
				return;
			}
			_input = allowInput;
			float num = (_input ? Controls.GetScroll() : 0f);
			if (Mathf.Abs(num) > 0.0001f)
			{
				_speed = Mathf.Clamp(_speed * Mathf.Exp(num * 3f), 0.05f, 400f);
				Cfg.MoveSpeed.Value = _speed;
			}
			if ((Object)(object)AimTarget == (Object)null && _input)
			{
				Vector2 lookDelta = Controls.GetLookDelta(Cfg.LookSensitivity.Value);
				_targetYaw += lookDelta.x;
				_targetPitch += (Cfg.InvertPitch.Value ? lookDelta.y : (0f - lookDelta.y));
				_targetPitch = Mathf.Clamp(_targetPitch, -89.9f, 89.9f);
				float value = Cfg.LookSmoothing.Value;
				if (value > 0.001f)
				{
					_yaw = Mathf.SmoothDampAngle(_yaw, _targetYaw, ref _yawVelocity, value, float.PositiveInfinity, unscaledDeltaTime);
					_pitch = Mathf.SmoothDampAngle(_pitch, _targetPitch, ref _pitchVelocity, value, float.PositiveInfinity, unscaledDeltaTime);
				}
				else
				{
					_yaw = _targetYaw;
					_pitch = _targetPitch;
				}
			}
			float num2 = (_input ? Controls.GetRollIntent() : 0f);
			if (Mathf.Abs(num2) > 0.001f)
			{
				_roll += num2 * Cfg.RollSpeed.Value * unscaledDeltaTime;
			}
			if (_input && Input.GetKeyDown(Cfg.KeyResetRoll.Value))
			{
				LevelRoll();
			}
			Vector3 intent = (_input ? Controls.GetMoveIntent() : Vector3.zero);
			float mul = (_input ? Controls.SpeedMultiplier() : 1f);
			if (Mode != RigMode.Free && (Object)(object)AimTarget == (Object)null)
			{
				Mode = RigMode.Free;
			}
			_useDirectRot = false;
			switch (Mode)
			{
			case RigMode.Follow:
				TickFollow(intent, mul, unscaledDeltaTime);
				break;
			case RigMode.Orbit:
				TickOrbit(intent, mul, unscaledDeltaTime);
				break;
			case RigMode.Mount:
				TickMount(intent, mul, unscaledDeltaTime);
				break;
			default:
				TickFree(intent, mul, unscaledDeltaTime);
				break;
			}
			float num3 = 0f;
			if (_input && Input.GetKey(Cfg.KeyFovUp.Value))
			{
				num3 += Cfg.FovStep.Value * unscaledDeltaTime * 20f;
			}
			if (_input && Input.GetKey(Cfg.KeyFovDown.Value))
			{
				num3 -= Cfg.FovStep.Value * unscaledDeltaTime * 20f;
			}
			if (_input)
			{
				num3 += Pad.Fov() * Cfg.FovStep.Value * unscaledDeltaTime * 20f;
			}
			if (_dollyZoom && num3 != 0f)
			{
				DollyZoomByFov(num3);
				return;
			}
			TickDollyZoom();
			if (num3 != 0f)
			{
				AdjustFov(num3);
			}
		}

		private void TickFree(Vector3 intent, float mul, float dt)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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)
			Vector3 val = Quaternion.Euler(_pitch, _yaw, 0f) * new Vector3(intent.x, 0f, intent.z) + Vector3.up * intent.y;
			_targetPos += val * (_speed * mul * dt);
			float value = Cfg.MoveSmoothing.Value;
			_pos = ((value > 0.001f) ? Vector3.SmoothDamp(_pos, _targetPos, ref _posVelocity, value, float.PositiveInfinity, dt) : _targetPos);
		}

		private void TickFollow(Vector3 intent, float mul, float dt)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			float num = 6f * mul * dt;
			if (intent.z != 0f)
			{
				Cfg.FollowDistance.Value = Mathf.Clamp(Cfg.FollowDistance.Value - intent.z * num, 0.5f, 200f);
			}
			if (intent.x != 0f)
			{
				Cfg.FollowSide.Value = Mathf.Clamp(Cfg.FollowSide.Value + intent.x * num, -100f, 100f);
			}
			if (intent.y != 0f)
			{
				Cfg.FollowHeight.Value = Mathf.Clamp(Cfg.FollowHeight.Value + intent.y * num, -50f, 100f);
			}
			Vector3 val = FollowForward();
			Vector3 val2 = Vector3.Cross(Vector3.up, val);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			Vector3 desired = AimTarget.corePosition - val * Cfg.FollowDistance.Value + Vector3.up * Cfg.FollowHeight.Value + normalized * Cfg.FollowSide.Value;
			Settle(desired, dt);
		}

		private void TickOrbit(Vector3 intent, float mul, float dt)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			_orbitAngle += (Cfg.OrbitSpeed.Value + intent.x * 45f * mul) * dt;
			float num = 8f * mul * dt;
			if (intent.z != 0f)
			{
				Cfg.OrbitRadius.Value = Mathf.Clamp(Cfg.OrbitRadius.Value - intent.z * num, 0.5f, 300f);
			}
			if (intent.y != 0f)
			{
				Cfg.OrbitHeight.Value = Mathf.Clamp(Cfg.OrbitHeight.Value + intent.y * num, -50f, 100f);
			}
			Vector3 val = Quaternion.Euler(0f, _orbitAngle, 0f) * (Vector3.forward * Cfg.OrbitRadius.Value);
			Vector3 desired = AimTarget.corePosition + val + Vector3.up * Cfg.OrbitHeight.Value;
			Settle(desired, dt);
		}

		private void TickMount(Vector3 intent, float mul, float dt)
		{
			//IL_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type