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)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(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 KeyToggleFreeCam; public static ConfigEntry KeyToggleHud; public static ConfigEntry KeyToggleFocus; public static ConfigEntry KeyAddKeyframe; public static ConfigEntry KeyDeleteKeyframe; public static ConfigEntry KeyClearShot; public static ConfigEntry KeyPlayShot; public static ConfigEntry KeySaveShot; public static ConfigEntry KeyCycleShot; public static ConfigEntry KeyDurationDown; public static ConfigEntry KeyDurationUp; public static ConfigEntry KeyCycleTarget; public static ConfigEntry KeyClearTarget; public static ConfigEntry AimDamping; public static ConfigEntry AimHeadroom; public static ConfigEntry AimLead; public static ConfigEntry AimDeadzone; public static ConfigEntry KeyCycleParam; public static ConfigEntry KeyParamDown; public static ConfigEntry KeyParamUp; public static ConfigEntry RelinkMovement; public static ConfigEntry KeyCycleRigMode; public static ConfigEntry FollowDistance; public static ConfigEntry FollowHeight; public static ConfigEntry FollowSide; public static ConfigEntry RigDamping; public static ConfigEntry OrbitRadius; public static ConfigEntry OrbitHeight; public static ConfigEntry OrbitSpeed; public static ConfigEntry FollowUsesFacing; public static ConfigEntry KeyCycleFocusMode; public static ConfigEntry KeyRackFocus; public static ConfigEntry Aperture; public static ConfigEntry FocusDistance; public static ConfigEntry FocusDamping; public static ConfigEntry RackDuration; public static ConfigEntry DofFocalLength; public static ConfigEntry LinkDofToLens; public static ConfigEntry MotionBlurEnabled; public static ConfigEntry ShutterAngle; public static ConfigEntry CompensateShutter; public static ConfigEntry KeyCycleMountBone; public static ConfigEntry KeyDollyZoom; public static ConfigEntry KeyStill; public static ConfigEntry KeySequence; public static ConfigEntry MountOffsetX; public static ConfigEntry MountOffsetY; public static ConfigEntry MountOffsetZ; public static ConfigEntry MountPitch; public static ConfigEntry MountYaw; public static ConfigEntry MountDamping; public static ConfigEntry MountFrame; public static ConfigEntry MountLevelHorizon; public static ConfigEntry MountRotDamping; public static ConfigEntry ShakePosition; public static ConfigEntry ShakeRotation; public static ConfigEntry ShakeFrequency; public static ConfigEntry ShakeScalesWithSpeed; public static ConfigEntry StillSupersize; public static ConfigEntry CaptureFps; public static ConfigEntry KeyFreezeWorld; public static ConfigEntry FreezeParticles; public static ConfigEntry AllowClientTimeControls; public static ConfigEntry DisableModelFade; public static ConfigEntry CaptureMaxSeconds; public static ConfigEntry ShowKeyframes; public static ConfigEntry BookmarkBlend; public static ConfigEntry KeyHideSelf; public static ConfigEntry KeyHideOthers; public static ConfigEntry KeyBookmarkModifier; public static ConfigEntry SunOverride; public static ConfigEntry SunShadows; public static ConfigEntry AmbientOverride; public static ConfigEntry SunIntensity; public static ConfigEntry SunKelvin; public static ConfigEntry SunHue; public static ConfigEntry SunSat; public static ConfigEntry SunPitch; public static ConfigEntry SunYaw; public static ConfigEntry AmbientIntensity; public static ConfigEntry AmbientKelvin; public static ConfigEntry AmbientHue; public static ConfigEntry AmbientSat; public static ConfigEntry GradeOn; public static ConfigEntry FxOn; public static ConfigEntry FogOn; public static ConfigEntry RainOn; public static ConfigEntry GradeTemp; public static ConfigEntry GradeTint; public static ConfigEntry GradeSat; public static ConfigEntry GradeContrast; public static ConfigEntry GradeExposure; public static ConfigEntry GradeHue; public static ConfigEntry FxVignette; public static ConfigEntry FxGrain; public static ConfigEntry FxAberration; public static ConfigEntry FogIntensity; public static ConfigEntry FogPower; public static ConfigEntry FogNear; public static ConfigEntry FogFar; public static ConfigEntry FogHeight; public static ConfigEntry FogHue; public static ConfigEntry FogSat; public static ConfigEntry FogValue; public static ConfigEntry RainIntensity; public static ConfigEntry RainDensity; public static ConfigEntry WeatherAmount; public static ConfigEntry WeatherWind; public static ConfigEntry KeyAddLight; public static ConfigEntry KeyToggleLights; public static ConfigEntry LightFade; public static ConfigEntry PadEnabled; public static ConfigEntry PadLookSpeed; public static ConfigEntry PadDeadzone; public static ConfigEntry PadCurve; public static ConfigEntry[] PadAxisMap; public static ConfigEntry[] PadAxisInvert; public static ConfigEntry[] PadButtonMap; private static ConfigFile _file; public static ConfigEntry KeyToggleMenu; public static ConfigEntry KeyTogglePause; public static ConfigEntry KeyTimeDown; public static ConfigEntry KeyTimeUp; public static ConfigEntry KeyFovDown; public static ConfigEntry KeyFovUp; public static ConfigEntry KeyRollLeft; public static ConfigEntry KeyRollRight; public static ConfigEntry KeyResetRoll; public static ConfigEntry KeyCycleGuide; public static ConfigEntry KeyCycleMatte; public static ConfigEntry KeyForward; public static ConfigEntry KeyBack; public static ConfigEntry KeyLeft; public static ConfigEntry KeyRight; public static ConfigEntry KeyUp; public static ConfigEntry KeyDown; public static ConfigEntry KeyFast; public static ConfigEntry KeySlow; public static ConfigEntry MoveSpeed; public static ConfigEntry FastMultiplier; public static ConfigEntry SlowMultiplier; public static ConfigEntry LookSensitivity; public static ConfigEntry LookSmoothing; public static ConfigEntry MoveSmoothing; public static ConfigEntry RollSpeed; public static ConfigEntry FovStep; public static ConfigEntry TransitionDuration; public static ConfigEntry InvertPitch; public static ConfigEntry HideHudOnEnter; public static ConfigEntry SuppressScreenShake; public static ConfigEntry EnableTimeControls; public static ConfigEntry ShowReadout; public static ConfigEntry ShowToasts; public static void Save() { ConfigFile file = _file; if (file != null) { file.Save(); } } public static void ResetAll() { if (_file == null) { return; } foreach (KeyValuePair 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("1. Keybinds", "ToggleFreeCam", (KeyCode)283, "Enter / exit the machinima camera."); KeyToggleHud = c.Bind("1. Keybinds", "ToggleHud", (KeyCode)284, "Show / hide the game HUD while in free cam."); KeyToggleFocus = c.Bind("1. Keybinds", "ToggleControlFocus", (KeyCode)285, "Swap between flying the camera and driving your character."); KeyAddKeyframe = c.Bind("1b. Shot keybinds", "AddKeyframe", (KeyCode)107, "Record the current camera pose as a keyframe."); KeyDeleteKeyframe = c.Bind("1b. Shot keybinds", "DeleteLastKeyframe", (KeyCode)8, "Remove the most recent keyframe."); KeyClearShot = c.Bind("1b. Shot keybinds", "ClearShot", (KeyCode)127, "Throw away the whole shot and start again."); KeyPlayShot = c.Bind("1b. Shot keybinds", "PlayShot", (KeyCode)103, "Play or stop the current shot."); KeySaveShot = c.Bind("1b. Shot keybinds", "SaveShot", (KeyCode)289, "Write the shot to BepInEx/config/MachinimaTools/shots."); KeyCycleShot = c.Bind("1b. Shot keybinds", "CycleSavedShots", (KeyCode)290, "Load the next saved shot from disk."); KeyDurationDown = c.Bind("1b. Shot keybinds", "DurationDown", (KeyCode)45, "Shorten the shot. Hold slow key for fine steps."); KeyDurationUp = c.Bind("1b. Shot keybinds", "DurationUp", (KeyCode)61, "Lengthen the shot. Hold slow key for fine steps."); KeyCycleRigMode = c.Bind("1b. Shot keybinds", "CycleRigMode", (KeyCode)117, "Cycle Free / Follow / Orbit / Mount. Everything but Free needs an aim target."); KeyCycleTarget = c.Bind("1b. Shot keybinds", "CycleAimTarget", (KeyCode)116, "Lock the camera's aim onto the next living character."); KeyClearTarget = c.Bind("1b. Shot keybinds", "ClearAimTarget", (KeyCode)121, "Release the aim lock and go back to manual look."); ShowKeyframes = c.Bind("1b. Shot keybinds", "ShowKeyframes", true, "Draw keyframe markers and the path in the world."); KeyBookmarkModifier = c.Bind("1b. Shot keybinds", "BookmarkStoreModifier", (KeyCode)308, "Hold with 1-9 to store the camera there. 1-9 alone recalls."); BookmarkBlend = c.Bind("1b. Shot keybinds", "BookmarkBlend", 0f, new ConfigDescription("Seconds to blend when recalling a bookmark. 0 = snap.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); KeyHideSelf = c.Bind("1b. Shot keybinds", "HideOwnModel", (KeyCode)105, "Hide your own character."); KeyHideOthers = c.Bind("1b. Shot keybinds", "HideEveryoneElse", (KeyCode)108, "Hide every character except the aim target (or you)."); KeyToggleMenu = c.Bind("1. Keybinds", "ToggleMenu", (KeyCode)286, "Open the clickable settings panel."); KeyTogglePause = c.Bind("1. Keybinds", "TogglePause", (KeyCode)112, "Freeze / unfreeze everything. The camera keeps flying either way."); KeyFreezeWorld = c.Bind("1. Keybinds", "FreezeWorldOnly", (KeyCode)104, "Freeze everything except your character."); KeyTimeDown = c.Bind("1. Keybinds", "TimeScaleDown", (KeyCode)44, "Slow time down one step."); KeyTimeUp = c.Bind("1. Keybinds", "TimeScaleUp", (KeyCode)46, "Speed time up one step."); KeyFovDown = c.Bind("1. Keybinds", "FovDown", (KeyCode)91, "Narrow the field of view (longer lens)."); KeyFovUp = c.Bind("1. Keybinds", "FovUp", (KeyCode)93, "Widen the field of view (shorter lens)."); KeyRollLeft = c.Bind("1. Keybinds", "RollLeft", (KeyCode)122, "Dutch the camera counterclockwise."); KeyRollRight = c.Bind("1. Keybinds", "RollRight", (KeyCode)99, "Dutch the camera clockwise."); KeyResetRoll = c.Bind("1. Keybinds", "ResetRoll", (KeyCode)120, "Level the horizon."); KeyCycleGuide = c.Bind("1. Keybinds", "CycleFramingGuide", (KeyCode)287, "Cycle composition guides: off, thirds, center, both."); KeyCycleMatte = c.Bind("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("2. Movement keys", "Forward", (KeyCode)119, ""); KeyBack = c.Bind("2. Movement keys", "Back", (KeyCode)115, ""); KeyLeft = c.Bind("2. Movement keys", "Left", (KeyCode)97, ""); KeyRight = c.Bind("2. Movement keys", "Right", (KeyCode)100, ""); KeyUp = c.Bind("2. Movement keys", "Up", (KeyCode)101, ""); KeyDown = c.Bind("2. Movement keys", "Down", (KeyCode)113, ""); KeyFast = c.Bind("2. Movement keys", "Fast", (KeyCode)304, "Hold to move faster."); KeySlow = c.Bind("2. Movement keys", "Slow", (KeyCode)306, "Hold to move slower. Use this for the actual takes."); MoveSpeed = c.Bind("3. Feel", "MoveSpeed", 12f, new ConfigDescription("Meters per second. Mouse wheel changes it live.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 200f), Array.Empty())); FastMultiplier = c.Bind("3. Feel", "FastMultiplier", 4f, ""); SlowMultiplier = c.Bind("3. Feel", "SlowMultiplier", 0.15f, "Multiplier while the slow key is held."); LookSensitivity = c.Bind("3. Feel", "LookSensitivity", 2.2f, ""); LookSmoothing = c.Bind("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(0f, 2f), Array.Empty())); MoveSmoothing = c.Bind("3. Feel", "MoveSmoothing", 0.12f, new ConfigDescription("Movement damping in seconds. 0 = off.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); RollSpeed = c.Bind("3. Feel", "RollSpeed", 40f, "Degrees per second."); FovStep = c.Bind("3. Feel", "FovStep", 2f, "Degrees per keypress."); TransitionDuration = c.Bind("3. Feel", "TransitionDuration", 0.35f, new ConfigDescription("Blend time entering/leaving free cam. 0 = hard cut.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); InvertPitch = c.Bind("3. Feel", "InvertPitch", false, ""); AimDamping = c.Bind("3. Feel", "AimDamping", 0.09f, new ConfigDescription("Tracking lag in seconds. 0 = hard lock.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); AimHeadroom = c.Bind("3. Feel", "AimHeadroom", 1.2f, new ConfigDescription("Meters above the target's core to aim at.", (AcceptableValueBase)(object)new AcceptableValueRange(-5f, 10f), Array.Empty())); AimLead = c.Bind("3. Feel", "AimLead", 0.12f, new ConfigDescription("Seconds of velocity prediction. Stops fast targets lagging in frame.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); AimDeadzone = c.Bind("3. Feel", "AimDeadzone", 0f, new ConfigDescription("Degrees of slack before the camera corrects.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 20f), Array.Empty())); FollowDistance = c.Bind("5. Follow and orbit", "FollowDistance", 8f, "Meters behind the subject."); FollowHeight = c.Bind("5. Follow and orbit", "FollowHeight", 2.5f, "Meters above the subject's core."); FollowSide = c.Bind("5. Follow and orbit", "FollowSide", 0f, "Lateral offset from the subject."); RigDamping = c.Bind("5. Follow and orbit", "RigDamping", 0.35f, new ConfigDescription("Follow/orbit position lag in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 3f), Array.Empty())); OrbitRadius = c.Bind("5. Follow and orbit", "OrbitRadius", 9f, "Orbit distance."); OrbitHeight = c.Bind("5. Follow and orbit", "OrbitHeight", 2.5f, "Orbit height above the subject's core."); OrbitSpeed = c.Bind("5. Follow and orbit", "OrbitSpeed", 18f, new ConfigDescription("Degrees per second. Negative reverses.", (AcceptableValueBase)(object)new AcceptableValueRange(-180f, 180f), Array.Empty())); FollowUsesFacing = c.Bind("5. Follow and orbit", "FollowUsesFacing", true, "Anchor the follow offset to the subject's facing. Off = world-locked bearing."); KeyCycleFocusMode = c.Bind("6. Lens", "CycleFocusMode", (KeyCode)102, "Cycle depth of field: off, manual, tracking the aim target."); KeyRackFocus = c.Bind("6. Lens", "RackFocus", (KeyCode)114, "Pull focus from wherever it is onto the aim target, then hold."); Aperture = c.Bind("6. Lens", "Aperture", 2f, new ConfigDescription("f-stop. Lower = shallower.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 32f), Array.Empty())); FocusDistance = c.Bind("6. Lens", "FocusDistance", 12f, new ConfigDescription("Meters to the focal plane.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 500f), Array.Empty())); FocusDamping = c.Bind("6. Lens", "FocusDamping", 0.18f, new ConfigDescription("Auto focus lag in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 3f), Array.Empty())); RackDuration = c.Bind("6. Lens", "RackDuration", 1.2f, new ConfigDescription("Seconds for a focus pull.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 10f), Array.Empty())); DofFocalLength = c.Bind("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(1f, 300f), Array.Empty())); LinkDofToLens = c.Bind("6. Lens", "LinkDofToLens", false, "Blur uses the real focal length. The game sits around 16mm, so this mostly means no blur."); MotionBlurEnabled = c.Bind("6. Lens", "MotionBlur", true, ""); ShutterAngle = c.Bind("6. Lens", "ShutterAngle", 180f, new ConfigDescription("Degrees. 180 = film standard.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 360f), Array.Empty())); CompensateShutter = c.Bind("6. Lens", "CompensateShutterForTimescale", true, "Widen the shutter as time slows so slow-mo keeps its blur."); KeyCycleMountBone = c.Bind("7. Body mount", "CycleMountBone", (KeyCode)98, "Step through bones on the target's model."); MountOffsetX = c.Bind("7. Body mount", "OffsetX", 0f, "Offset from the bone, in the chosen frame."); MountOffsetY = c.Bind("7. Body mount", "OffsetY", 0.12f, "Offset from the bone, in the chosen frame."); MountOffsetZ = c.Bind("7. Body mount", "OffsetZ", 0.2f, "Offset from the bone, in the chosen frame."); MountPitch = c.Bind("7. Body mount", "Pitch", 0f, new ConfigDescription("Look pitch. Mouse drives this while mounted.", (AcceptableValueBase)(object)new AcceptableValueRange(-180f, 180f), Array.Empty())); MountYaw = c.Bind("7. Body mount", "Yaw", 0f, new ConfigDescription("Look yaw. Mouse drives this while mounted.", (AcceptableValueBase)(object)new AcceptableValueRange(-180f, 180f), Array.Empty())); MountDamping = c.Bind("7. Body mount", "Damping", 0f, new ConfigDescription("Position lag. 0 = rigidly bolted on, which is usually what you want.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MountFrame = c.Bind("7. Body mount", "Frame", MachinimaTools.MountFrame.Actor, "Actor = character facing. Bone = the bone itself. World = fixed axes."); MountLevelHorizon = c.Bind("7. Body mount", "LevelHorizon", true, "In Bone frame, drop the bone's roll so the horizon stays level."); MountRotDamping = c.Bind("7. Body mount", "RotationDamping", 0.05f, new ConfigDescription("Smoothing on the inherited rotation. 0 = every jolt, 0.2 = steadicam.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ShakePosition = c.Bind("8. Handheld", "PositionAmount", 0f, new ConfigDescription("Meters of positional shake. Start around 0.02.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ShakeRotation = c.Bind("8. Handheld", "RotationAmount", 0f, new ConfigDescription("Degrees of rotational shake. Start around 0.4.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 20f), Array.Empty())); ShakeFrequency = c.Bind("8. Handheld", "Frequency", 1.6f, new ConfigDescription("Noise speed.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 12f), Array.Empty())); ShakeScalesWithSpeed = c.Bind("8. Handheld", "ScaleWithSpeed", true, "More shake while the camera is moving."); KeyDollyZoom = c.Bind("9. Capture", "ToggleDollyZoom", (KeyCode)110, "Hold subject size while the distance changes."); KeyStill = c.Bind("9. Capture", "Screenshot", (KeyCode)291, "Save a still, HUD and overlay hidden."); KeySequence = c.Bind("9. Capture", "ToggleSequence", (KeyCode)292, "Start/stop a locked-framerate image sequence."); StillSupersize = c.Bind("9. Capture", "StillSupersize", 2, new ConfigDescription("Resolution multiplier for stills.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 8), Array.Empty())); CaptureMaxSeconds = c.Bind("9. Capture", "SequenceMaxSeconds", 120, new ConfigDescription("Auto stop after this many real seconds. 0 = no limit.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 3600), Array.Empty())); CaptureFps = c.Bind("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(1, 240), Array.Empty())); AllowClientTimeControls = c.Bind("4. Behavior", "AllowClientTimeControls", false, "Run time controls as a client. Local view only, networked things will stutter."); DisableModelFade = c.Bind("4. Behavior", "DisableModelFade", true, "Stop characters dithering out when the camera gets close."); FreezeParticles = c.Bind("4. Behavior", "FreezeParticles", true, "Pause particles on frozen objects. Off if freezing stutters."); KeyAddLight = c.Bind("10. Scene", "AddSpotLight", (KeyCode)59, "Drop a spot light where the camera is."); KeyToggleLights = c.Bind("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("10. Scene", "LightFade", 0.5f, new ConfigDescription("Seconds for a light to fade in or out. 0 = hard switch.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); SunOverride = c.Bind("10. Scene", "SunOverride", false, "Take control of the stage's sun."); SunIntensity = c.Bind("10. Scene", "SunIntensity", 1f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 8f), Array.Empty())); SunKelvin = c.Bind("10. Scene", "SunKelvin", 5500f, new ConfigDescription("Color temperature. 2500 sunset, 6500 noon, 9000 blue hour.", (AcceptableValueBase)(object)new AcceptableValueRange(1500f, 12000f), Array.Empty())); SunHue = c.Bind("10. Scene", "SunHue", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); SunSat = c.Bind("10. Scene", "SunTint", 0f, new ConfigDescription("How much of the hue to mix in.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); SunPitch = c.Bind("10. Scene", "SunPitch", 50f, new ConfigDescription("Elevation. Low values are long shadows.", (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 90f), Array.Empty())); SunYaw = c.Bind("10. Scene", "SunYaw", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 360f), Array.Empty())); SunShadows = c.Bind("10. Scene", "SunShadows", true, ""); AmbientOverride = c.Bind("10. Scene", "AmbientOverride", false, "Take control of ambient light."); AmbientIntensity = c.Bind("10. Scene", "AmbientIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 4f), Array.Empty())); AmbientKelvin = c.Bind("10. Scene", "AmbientKelvin", 7000f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(1500f, 12000f), Array.Empty())); AmbientHue = c.Bind("10. Scene", "AmbientHue", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); AmbientSat = c.Bind("10. Scene", "AmbientTint", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); GradeOn = c.Bind("11. Look", "GradeOn", false, "Color grade override."); GradeTemp = c.Bind("11. Look", "Temperature", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(-100f, 100f), Array.Empty())); GradeTint = c.Bind("11. Look", "Tint", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(-100f, 100f), Array.Empty())); GradeSat = c.Bind("11. Look", "Saturation", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(-100f, 100f), Array.Empty())); GradeContrast = c.Bind("11. Look", "Contrast", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(-100f, 100f), Array.Empty())); GradeExposure = c.Bind("11. Look", "Exposure", 0f, new ConfigDescription("Stops.", (AcceptableValueBase)(object)new AcceptableValueRange(-4f, 4f), Array.Empty())); GradeHue = c.Bind("11. Look", "HueShift", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(-180f, 180f), Array.Empty())); FxOn = c.Bind("11. Look", "EffectsOn", false, "Vignette, grain, aberration override."); FxVignette = c.Bind("11. Look", "Vignette", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FxGrain = c.Bind("11. Look", "Grain", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FxAberration = c.Bind("11. Look", "Aberration", 0f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogOn = c.Bind("11. Look", "FogOn", false, "Override the stage fog."); FogIntensity = c.Bind("11. Look", "FogIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogPower = c.Bind("11. Look", "FogPower", 1f, new ConfigDescription("Falloff curve.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 4f), Array.Empty())); FogNear = c.Bind("11. Look", "FogNear", 0.05f, new ConfigDescription("Depth where fog starts, 0 to 1.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogFar = c.Bind("11. Look", "FogFar", 0.9f, new ConfigDescription("Depth where fog is full, 0 to 1.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogHeight = c.Bind("11. Look", "FogHeight", 0f, new ConfigDescription("Ground fog amount.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogHue = c.Bind("11. Look", "FogHue", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogSat = c.Bind("11. Look", "FogSat", 0.15f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); FogValue = c.Bind("11. Look", "FogBrightness", 0.6f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); RainOn = c.Bind("11. Look", "RainOn", false, "The game's wet surface shimmer, on any stage. Drops come from the Rain weather."); RainIntensity = c.Bind("11. Look", "RainIntensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); RainDensity = c.Bind("11. Look", "RainDensity", 0.5f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); WeatherAmount = c.Bind("11. Look", "WeatherAmount", 1f, new ConfigDescription("Particle density multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 5f), Array.Empty())); WeatherWind = c.Bind("11. Look", "WeatherWind", 1f, new ConfigDescription("Sideways drift in m/s.", (AcceptableValueBase)(object)new AcceptableValueRange(-15f, 15f), Array.Empty())); KeyCycleParam = c.Bind("12. Live tuning", "CycleParameter", (KeyCode)111, "Select the next live-tunable parameter."); KeyParamDown = c.Bind("12. Live tuning", "ParameterDown", (KeyCode)281, "Decrease the selected parameter."); KeyParamUp = c.Bind("12. Live tuning", "ParameterUp", (KeyCode)280, "Increase the selected parameter."); RelinkMovement = c.Bind("4. Behavior", "RelinkMovementToAim", true, "Move relative to aim instead of the parked camera."); PadEnabled = c.Bind("13. Gamepad", "Enabled", true, "Camera on a controller. Mapping is below."); PadLookSpeed = c.Bind("13. Gamepad", "LookSpeed", 140f, new ConfigDescription("Degrees per second at full stick.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 720f), Array.Empty())); PadDeadzone = c.Bind("13. Gamepad", "Deadzone", 0.15f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.6f), Array.Empty())); PadCurve = c.Bind("13. Gamepad", "Curve", 2f, new ConfigDescription("Stick response. 1 = linear, 2 = fine control near center.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); 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[names.Length]; PadAxisInvert = new ConfigEntry[names.Length]; for (int i = 0; i < names.Length; i++) { PadAxisMap[i] = c.Bind("13. Gamepad", "Axis" + names[i], array[i], ""); PadAxisInvert[i] = c.Bind("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[names2.Length]; for (int j = 0; j < names2.Length; j++) { PadButtonMap[j] = c.Bind("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("4. Behavior", "HideHudOnEnter", true, "Hide the HUD on entering free cam."); SuppressScreenShake = c.Bind("4. Behavior", "SuppressScreenShake", true, "Zero the game's screen shake while filming."); EnableTimeControls = c.Bind("4. Behavior", "EnableTimeControls", true, "Pause and slow motion. Host or singleplayer only."); ShowReadout = c.Bind("4. Behavior", "ShowReadout", true, "Show the camera readout."); ShowToasts = c.Bind("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 _hidden = new List(); private readonly Key[] _bookmarks = new Key[10]; private float _messageUntil; public Shot Current = new Shot(); private float _playStart; private List _library = new List(); 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(); Optics = ((Component)this).gameObject.AddComponent(); Recorder = ((Component)this).gameObject.AddComponent(); Freeze = ((Component)this).gameObject.AddComponent(); Lights = ((Component)this).gameObject.AddComponent(); Sky = ((Component)this).gameObject.AddComponent(); } 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 readOnlyInstancesList = CharacterBody.readOnlyInstancesList; if (readOnlyInstancesList.Count == 0) { Notify("Nothing to target"); return; } List list = new List(); 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(); } 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 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 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 (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_0253: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bone == (Object)null) { CycleMountBone(); if ((Object)(object)_bone == (Object)null) { Mode = RigMode.Free; return; } } float num = 0.6f * mul * dt; if (intent.z != 0f) { Cfg.MountOffsetZ.Value = Mathf.Clamp(Cfg.MountOffsetZ.Value + intent.z * num, -10f, 10f); } if (intent.x != 0f) { Cfg.MountOffsetX.Value = Mathf.Clamp(Cfg.MountOffsetX.Value + intent.x * num, -10f, 10f); } if (intent.y != 0f) { Cfg.MountOffsetY.Value = Mathf.Clamp(Cfg.MountOffsetY.Value + intent.y * num, -10f, 10f); } Vector2 val = (_input ? Controls.GetLookDelta(Cfg.LookSensitivity.Value) : Vector2.zero); if (val != Vector2.zero) { Cfg.MountYaw.Value = Mathf.Repeat(Cfg.MountYaw.Value + val.x + 180f, 360f) - 180f; Cfg.MountPitch.Value = Mathf.Clamp(Cfg.MountPitch.Value + (Cfg.InvertPitch.Value ? val.y : (0f - val.y)), -89f, 89f); } Quaternion val2 = MountFrameNow(); float value = Cfg.MountRotDamping.Value; if (!_mountFrameInit || value <= 0.001f) { _mountFrame = val2; _mountFrameInit = true; } else { _mountFrame = Quaternion.Slerp(_mountFrame, val2, 1f - Mathf.Exp((0f - dt) / value)); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(Cfg.MountOffsetX.Value, Cfg.MountOffsetY.Value, Cfg.MountOffsetZ.Value); Vector3 val4 = _bone.position + _mountFrame * val3; float value2 = Cfg.MountDamping.Value; _pos = (_targetPos = ((value2 > 0.001f) ? Vector3.SmoothDamp(_pos, val4, ref _posVelocity, value2, float.PositiveInfinity, dt) : val4)); float value3 = Cfg.LookSmoothing.Value; if (value3 > 0.001f) { _mountYawSm = Mathf.SmoothDampAngle(_mountYawSm, Cfg.MountYaw.Value, ref _mountYawVel, value3, float.PositiveInfinity, dt); _mountPitchSm = Mathf.SmoothDampAngle(_mountPitchSm, Cfg.MountPitch.Value, ref _mountPitchVel, value3, float.PositiveInfinity, dt); } else { _mountYawSm = Cfg.MountYaw.Value; _mountPitchSm = Cfg.MountPitch.Value; } _useDirectRot = true; _directRot = _mountFrame * Quaternion.Euler(_mountPitchSm, _mountYawSm, _roll); Vector3 eulerAngles = ((Quaternion)(ref _directRot)).eulerAngles; _pitch = (_targetPitch = NormalizeAngle(eulerAngles.x)); _yaw = (_targetYaw = eulerAngles.y); } private Quaternion MountFrameNow() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_008a: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00bd: 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_00b9: Unknown result type (might be due to invalid IL or missing references) switch (Cfg.MountFrame.Value) { case MountFrame.World: return Quaternion.identity; case MountFrame.Actor: { Vector3 val2 = Vector3.forward; CharacterDirection characterDirection = AimTarget.characterDirection; val2 = ((!((Object)(object)characterDirection != (Object)null)) ? ((Component)AimTarget).transform.forward : characterDirection.forward); val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.forward; } return Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); } default: { Quaternion rotation = _bone.rotation; if (!Cfg.MountLevelHorizon.Value) { return rotation; } Vector3 val = rotation * Vector3.forward; if (Mathf.Abs(val.y) > 0.98f) { return rotation; } return Quaternion.LookRotation(val, Vector3.up); } } } public string MountOn(string boneKey, MountFrame frame, Vector3 offset, float posDamp, float rotDamp, bool level) { //IL_00be: 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_00de: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AimTarget == (Object)null) { return "Need a target"; } ModelLocator modelLocator = AimTarget.modelLocator; Transform val = (((Object)(object)modelLocator == (Object)null) ? null : modelLocator.modelTransform); if ((Object)(object)val == (Object)null) { return "No model on that target"; } _bones = BuildBoneList(val); _boneIndex = -1; for (int i = 0; i < _bones.Length; i++) { if (((Object)_bones[i]).name.ToLowerInvariant().Contains(boneKey)) { _boneIndex = i; break; } } if (_boneIndex < 0) { _boneIndex = 0; } _bone = _bones[_boneIndex]; Cfg.MountFrame.Value = frame; Cfg.MountOffsetX.Value = offset.x; Cfg.MountOffsetY.Value = offset.y; Cfg.MountOffsetZ.Value = offset.z; Cfg.MountDamping.Value = posDamp; Cfg.MountRotDamping.Value = rotDamp; Cfg.MountLevelHorizon.Value = level; Cfg.MountPitch.Value = 0f; Cfg.MountYaw.Value = 0f; _mountYawSm = (_mountPitchSm = (_mountYawVel = (_mountPitchVel = 0f))); _mountFrameInit = false; Mode = RigMode.Mount; return "Mounted on " + ((Object)_bone).name; } public string[] BoneNames(int max) { if (_bones == null) { return new string[0]; } int num = Mathf.Min(max, _bones.Length); string[] array = new string[num]; for (int i = 0; i < num; i++) { array[i] = (((Object)(object)_bones[i] == (Object)null) ? "?" : ((Object)_bones[i]).name); } return array; } public void SelectBone(int i) { if (_bones != null && i >= 0 && i < _bones.Length) { _boneIndex = i; _bone = _bones[i]; _mountFrameInit = false; } } public string CycleMountBone() { if ((Object)(object)AimTarget == (Object)null) { return "Lock a target first"; } ModelLocator modelLocator = AimTarget.modelLocator; Transform val = (((Object)(object)modelLocator == (Object)null) ? null : modelLocator.modelTransform); if ((Object)(object)val == (Object)null) { return "No model on that target"; } if (_bones == null || _bones.Length == 0 || (Object)(object)_bone == (Object)null || !_bone.IsChildOf(val)) { _bones = BuildBoneList(val); _boneIndex = -1; } if (_bones.Length == 0) { return "No bones found"; } _boneIndex = (_boneIndex + 1) % _bones.Length; _bone = _bones[_boneIndex]; return $"Mount: {((Object)_bone).name} ({_boneIndex + 1}/{_bones.Length})"; } private static Transform[] BuildBoneList(Transform model) { Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren(); List list = new List(); string[] bonePriority = BonePriority; Transform[] array; foreach (string value in bonePriority) { array = componentsInChildren; foreach (Transform val in array) { if (((Object)val).name.ToLowerInvariant().Contains(value) && !list.Contains(val)) { list.Add(val); } } } array = componentsInChildren; foreach (Transform item in array) { if (!list.Contains(item)) { list.Add(item); } } return list.ToArray(); } public string ToggleDollyZoom() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AimTarget == (Object)null) { return "Need a target for dolly zoom"; } _dollyZoom = !_dollyZoom; if (!_dollyZoom) { return "Dolly zoom off"; } float num = Mathf.Max(0.1f, Vector3.Distance(_pos, AimTarget.corePosition)); _dollyK = Mathf.Tan(_fov * 0.5f * (MathF.PI / 180f)) * num; return "Dolly zoom on. Subject size locked."; } private void DollyZoomByFov(float delta) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00cc: 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) //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_00e3: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AimTarget == (Object)null) { return; } _fov = Mathf.Clamp(_fov + delta, 5f, 170f); float num = _dollyK / Mathf.Tan(_fov * 0.5f * (MathF.PI / 180f)); switch (Mode) { case RigMode.Orbit: Cfg.OrbitRadius.Value = Mathf.Clamp(num, 0.5f, 300f); return; case RigMode.Follow: Cfg.FollowDistance.Value = Mathf.Clamp(num, 0.5f, 200f); return; case RigMode.Mount: return; } Vector3 val = _pos - AimTarget.corePosition; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _pos = (_targetPos = AimTarget.corePosition + ((Vector3)(ref val)).normalized * num); } } private void TickDollyZoom() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (_dollyZoom) { if ((Object)(object)AimTarget == (Object)null) { _dollyZoom = false; return; } float num = Mathf.Max(0.1f, Vector3.Distance(_pos, AimTarget.corePosition)); _fov = Mathf.Clamp(2f * Mathf.Atan(_dollyK / num) * 57.29578f, 5f, 170f); } } public void TickShake() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) float value = Cfg.ShakePosition.Value; float value2 = Cfg.ShakeRotation.Value; if (value <= 0.0001f && value2 <= 0.0001f) { _shakePos = Vector3.zero; _shakeRot = Vector3.zero; return; } if (_shakeSeed == 0f) { _shakeSeed = 13.7f; } float num = Time.unscaledTime * Cfg.ShakeFrequency.Value; float num2 = 1f; if (Cfg.ShakeScalesWithSpeed.Value) { num2 = Mathf.Clamp(((Vector3)(ref _posVelocity)).magnitude / Mathf.Max(1f, _speed), 0.25f, 3f); } _shakePos = new Vector3(Mathf.PerlinNoise(num, _shakeSeed) - 0.5f, Mathf.PerlinNoise(num, _shakeSeed + 11f) - 0.5f, Mathf.PerlinNoise(num, _shakeSeed + 23f) - 0.5f) * (value * 2f * num2); _shakeRot = new Vector3(Mathf.PerlinNoise(num * 0.8f, _shakeSeed + 31f) - 0.5f, Mathf.PerlinNoise(num * 0.8f, _shakeSeed + 47f) - 0.5f, Mathf.PerlinNoise(num * 0.6f, _shakeSeed + 59f) - 0.5f) * (value2 * 2f * num2); } private void Settle(Vector3 desired, float dt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) _targetPos = desired; float value = Cfg.RigDamping.Value; _pos = ((value > 0.001f) ? Vector3.SmoothDamp(_pos, desired, ref _posVelocity, value, float.PositiveInfinity, dt) : desired); } private Vector3 FollowForward() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0027: 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 (Cfg.FollowUsesFacing.Value) { CharacterDirection characterDirection = AimTarget.characterDirection; if ((Object)(object)characterDirection != (Object)null) { Vector3 forward = characterDirection.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { return ((Vector3)(ref forward)).normalized; } } } Vector3 val = AimTarget.corePosition - _pos; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } public void SyncOrbitAngle() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //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) //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)AimTarget == (Object)null)) { Vector3 val = _pos - AimTarget.corePosition; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); _orbitAngle = ((Quaternion)(ref val2)).eulerAngles.y; Cfg.OrbitRadius.Value = Mathf.Clamp(((Vector3)(ref val)).magnitude, 0.5f, 300f); Cfg.OrbitHeight.Value = Mathf.Clamp(_pos.y - AimTarget.corePosition.y, -50f, 100f); } } } public void ApplyAimTarget() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b1: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AimTarget == (Object)null || Mode == RigMode.Mount) { return; } float unscaledDeltaTime = Time.unscaledDeltaTime; if (unscaledDeltaTime <= 0f) { return; } Vector3 val = AimTarget.corePosition + Vector3.up * Cfg.AimHeadroom.Value; CharacterMotor characterMotor = AimTarget.characterMotor; if ((Object)(object)characterMotor != (Object)null && Cfg.AimLead.Value > 0f) { val += characterMotor.velocity * Cfg.AimLead.Value; } Vector3 val2 = val - _pos; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { return; } Quaternion val3 = Quaternion.LookRotation(val2); Vector3 eulerAngles = ((Quaternion)(ref val3)).eulerAngles; float num = NormalizeAngle(eulerAngles.x); float num2 = eulerAngles.y; float value = Cfg.AimDeadzone.Value; if (value > 0.01f) { if (Mathf.Abs(Mathf.DeltaAngle(_yaw, num2)) < value) { num2 = _yaw; } if (Mathf.Abs(Mathf.DeltaAngle(_pitch, num)) < value) { num = _pitch; } } float value2 = Cfg.AimDamping.Value; if (value2 <= 0.001f) { _yaw = num2; _pitch = num; } else { _yaw = Mathf.SmoothDampAngle(_yaw, num2, ref _aimYawVelocity, value2, float.PositiveInfinity, unscaledDeltaTime); _pitch = Mathf.SmoothDampAngle(_pitch, num, ref _aimPitchVelocity, value2, float.PositiveInfinity, unscaledDeltaTime); } _targetYaw = _yaw; _targetPitch = _pitch; } public void LevelRoll() { _roll = 0f; if (Mode == RigMode.Mount) { Cfg.MountYaw.Value = 0f; Cfg.MountPitch.Value = 0f; } } public void AdjustFov(float delta) { _fov = Mathf.Clamp(_fov + delta, 5f, 170f); } public void SetFocalLength(float mm) { _fov = Mathf.Clamp(Lens.FocalToFov(Mathf.Clamp(mm, 8f, 400f)), 5f, 170f); } private static float NormalizeAngle(float a) { if (!(a > 180f)) { return a; } return a - 360f; } public void GetCameraState(CameraRigController rig, ref CameraState cameraState) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_003b: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //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) Quaternion val = (_useDirectRot ? _directRot : Quaternion.Euler(_pitch, _yaw, _roll)); cameraState.position = _pos + val * _shakePos; cameraState.rotation = val * Quaternion.Euler(_shakeRot); cameraState.fov = _fov; } public bool IsUserLookAllowed(CameraRigController rig) { return Focus == ControlFocus.Character; } public bool IsUserControlAllowed(CameraRigController rig) { return Focus == ControlFocus.Character; } public bool IsHudAllowed(CameraRigController rig) { return ShowHud; } } internal class Lens : MonoBehaviour { public enum FocusMode { Off, Manual, Track } public FocusMode Mode; private PostProcessVolume _volume; private PostProcessProfile _profile; private DepthOfField _dof; private MotionBlur _blur; private Look _look; private bool _built; private bool _racking; private float _rackFrom; private float _rackTo; private float _rackStart; private float _focusVelocity; private float _lastFocus; private float _lastAperture; private float _lastFocal; private float _lastShutter; private bool _lastDofOn; private bool _lastBlurOn; private bool _dirtyInit; public float CurrentFocus { get; private set; } = 10f; public float BlurFocalLength { get { if (!Cfg.LinkDofToLens.Value) { return Cfg.DofFocalLength.Value; } return Mathf.Clamp(FovToFocal(((Object)(object)Director.Instance != (Object)null) ? Director.Instance.FreeCam.Fov : 60f), 1f, 300f); } } public bool Racking => _racking; public static float FocalToFov(float mm) { return 2f * Mathf.Atan(12f / Mathf.Max(1f, mm)) * 57.29578f; } public static float FovToFocal(float fov) { return 12f / Mathf.Tan(Mathf.Clamp(fov, 1f, 179f) * 0.5f * (MathF.PI / 180f)); } private void Build(CameraRigController rig) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown if (!_built) { _profile = ScriptableObject.CreateInstance(); ((Object)_profile).hideFlags = (HideFlags)61; _dof = _profile.AddSettings(); ((ParameterOverride)(object)((PostProcessEffectSettings)_dof).enabled).Override(true); ((PostProcessEffectSettings)_dof).active = true; ((ParameterOverride)(object)_dof.focusDistance).Override(10f); ((ParameterOverride)(object)_dof.aperture).Override(2.8f); ((ParameterOverride)(object)_dof.focalLength).Override(50f); ((ParameterOverride)(object)_dof.kernelSize).Override((KernelSize)2); _blur = _profile.AddSettings(); ((ParameterOverride)(object)((PostProcessEffectSettings)_blur).enabled).Override(true); ((PostProcessEffectSettings)_blur).active = true; ((ParameterOverride)(object)_blur.shutterAngle).Override(180f); ((ParameterOverride)(object)_blur.sampleCount).Override(10); _look = new Look(_profile); GameObject val = new GameObject("MachinimaTools.Lens"); Object.DontDestroyOnLoad((Object)(object)val); val.layer = ResolveVolumeLayer(rig); _volume = val.AddComponent(); _volume.isGlobal = true; _volume.priority = 10000f; _volume.weight = 0f; _volume.sharedProfile = _profile; _built = true; Log.Info($"Lens volume built on layer {val.layer}."); } } private static PostProcessLayer FindLayer(CameraRigController rig) { if ((Object)(object)rig != (Object)null && (Object)(object)rig.sceneCam != (Object)null) { PostProcessLayer component = ((Component)rig.sceneCam).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } } Camera[] allCameras = Camera.allCameras; for (int i = 0; i < allCameras.Length; i++) { PostProcessLayer component2 = ((Component)allCameras[i]).GetComponent(); if ((Object)(object)component2 != (Object)null) { return component2; } } return null; } private static int ResolveVolumeLayer(CameraRigController rig) { PostProcessLayer val = FindLayer(rig); if ((Object)(object)val == (Object)null) { Log.Warn("No PostProcessLayer, DoF won't render."); return 0; } int value = ((LayerMask)(ref val.volumeLayer)).value; if (value == 0) { return 0; } for (int i = 0; i < 32; i++) { if ((value & (1 << i)) != 0) { return i; } } return 0; } public void Tick(CameraRigController rig, FreeCamRig cam) { Build(rig); if (!_built) { return; } bool flag = Mode != FocusMode.Off; bool value = Cfg.MotionBlurEnabled.Value; _volume.weight = ((flag || value || Look.AnyOn) ? 1f : 0f); if (!(_volume.weight <= 0f)) { UpdateFocus(cam); ((PostProcessEffectSettings)_dof).active = flag; if (flag) { ((ParameterOverride)(object)_dof.focusDistance).value = CurrentFocus; ((ParameterOverride)(object)_dof.aperture).value = Cfg.Aperture.Value; ((ParameterOverride)(object)_dof.focalLength).value = BlurFocalLength; } ((PostProcessEffectSettings)_blur).active = value; if (value) { ((ParameterOverride)(object)_blur.shutterAngle).value = EffectiveShutter(); } bool force = _look.Tick(); MarkDirtyIfChanged(flag, value, force); } } private float EffectiveShutter() { float value = Cfg.ShutterAngle.Value; if (!Cfg.CompensateShutter.Value) { return value; } float timeScale = Time.timeScale; if (timeScale <= 0.001f || timeScale >= 1f) { return value; } return Mathf.Clamp(value / timeScale, 0f, 360f); } private void UpdateFocus(FreeCamRig cam) { //IL_0092: 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) if (_racking) { float num = (Time.unscaledTime - _rackStart) / Mathf.Max(0.05f, Cfg.RackDuration.Value); if (num >= 1f) { num = 1f; _racking = false; } float num2 = num * num * (3f - 2f * num); CurrentFocus = Mathf.Lerp(_rackFrom, _rackTo, num2); Cfg.FocusDistance.Value = CurrentFocus; } else if (Mode == FocusMode.Track && (Object)(object)cam.AimTarget != (Object)null) { float num3 = Vector3.Distance(cam.Position, cam.AimTarget.corePosition); float value = Cfg.FocusDamping.Value; CurrentFocus = ((value > 0.001f) ? Mathf.SmoothDamp(CurrentFocus, num3, ref _focusVelocity, value, float.PositiveInfinity, Time.unscaledDeltaTime) : num3); Cfg.FocusDistance.Value = CurrentFocus; } else { CurrentFocus = Cfg.FocusDistance.Value; } } private void MarkDirtyIfChanged(bool dofOn, bool blurOn, bool force) { float currentFocus = CurrentFocus; float value = Cfg.Aperture.Value; float blurFocalLength = BlurFocalLength; float num = EffectiveShutter(); if (force || !_dirtyInit || dofOn != _lastDofOn || blurOn != _lastBlurOn || !Mathf.Approximately(currentFocus, _lastFocus) || !Mathf.Approximately(value, _lastAperture) || !Mathf.Approximately(blurFocalLength, _lastFocal) || !Mathf.Approximately(num, _lastShutter)) { _lastDofOn = dofOn; _lastBlurOn = blurOn; _lastFocus = currentFocus; _lastAperture = value; _lastFocal = blurFocalLength; _lastShutter = num; _dirtyInit = true; PostProcessVolume.DispatchVolumeSettingsChangedEvent(); } } public string CycleMode() { switch (Mode) { case FocusMode.Off: Mode = FocusMode.Manual; return "Focus: manual"; case FocusMode.Manual: Mode = FocusMode.Track; return "Focus: tracking target"; default: Mode = FocusMode.Off; return "Depth of field off"; } } public string Rack(FreeCamRig cam) { //IL_0031: 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) if ((Object)(object)cam.AimTarget == (Object)null) { return "Need a target to rack onto"; } if (Mode == FocusMode.Off) { Mode = FocusMode.Manual; } _rackFrom = CurrentFocus; _rackTo = Vector3.Distance(cam.Position, cam.AimTarget.corePosition); _rackStart = Time.unscaledTime; _racking = true; return $"Racking {_rackFrom:0.#}m to {_rackTo:0.#}m over {Cfg.RackDuration.Value:0.##}s"; } public void ApplyFromKey(float focus, float aperture) { if (focus > 0f) { _racking = false; CurrentFocus = focus; Cfg.FocusDistance.Value = focus; if (Mode == FocusMode.Track) { Mode = FocusMode.Manual; } } if (aperture > 0f) { Cfg.Aperture.Value = aperture; } } public void Release() { _racking = false; if ((Object)(object)_volume != (Object)null) { _volume.weight = 0f; } } } internal class PlacedLight { public enum Follow { None, Camera, Target } public GameObject Go; public Light L; public Follow Mode; public Transform Anchor; public Vector3 LocalPos; public Quaternion LocalRot; public float Kelvin = 5500f; public float Hue; public float Sat; public float Intensity = 6f; public bool On = true; public float Level = 1f; } internal class Lighting : MonoBehaviour { public readonly List Lights = new List(); public int Selected = -1; private Light _sun; private float _sunIntensity; private Color _sunColor; private Quaternion _sunRot; private LightShadows _sunShadows; private bool _sunSaved; private bool _ambSaved; private AmbientMode _ambMode; private Color _ambLight; private Color _ambSky; private Color _ambEq; private Color _ambGround; private float _ambIntensity; public static Lighting Instance { get; private set; } public PlacedLight Current { get { if (Selected < 0 || Selected >= Lights.Count) { return null; } return Lights[Selected]; } } public bool SunFound => (Object)(object)_sun != (Object)null; public bool AnyOn { get { foreach (PlacedLight light in Lights) { if (light.On) { return true; } } return false; } } private void Awake() { Instance = this; } private void OnDestroy() { Release(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void Tick(FreeCamRig cam) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0184: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) for (int num = Lights.Count - 1; num >= 0; num--) { if ((Object)(object)Lights[num].Go == (Object)null) { Lights.RemoveAt(num); } } if (Selected >= Lights.Count) { Selected = Lights.Count - 1; } if (Cfg.SunOverride.Value) { ApplySun(); } else { RestoreSun(); } if (Cfg.AmbientOverride.Value) { ApplyAmbient(); } else { RestoreAmbient(); } float value = Cfg.LightFade.Value; float unscaledDeltaTime = Time.unscaledDeltaTime; foreach (PlacedLight light in Lights) { float num2 = (light.On ? 1f : 0f); light.Level = ((value > 0.001f) ? Mathf.MoveTowards(light.Level, num2, unscaledDeltaTime / value) : num2); float num3 = light.Level * light.Level * (3f - 2f * light.Level); light.L.intensity = light.Intensity * num3; ((Behaviour)light.L).enabled = num3 > 0.001f; switch (light.Mode) { case PlacedLight.Follow.Camera: light.Go.transform.SetPositionAndRotation(cam.Position + Quaternion.Euler(cam.EulerAngles) * light.LocalPos, Quaternion.Euler(cam.EulerAngles) * light.LocalRot); break; case PlacedLight.Follow.Target: if ((Object)(object)light.Anchor == (Object)null) { light.Mode = PlacedLight.Follow.None; } else { light.Go.transform.SetPositionAndRotation(light.Anchor.TransformPoint(light.LocalPos), light.Anchor.rotation * light.LocalRot); } break; } } } public void Release() { RestoreSun(); RestoreAmbient(); ClearLights(); } public string Add(bool spot, FreeCamRig cam) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0048: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MachinimaTools.Light"); Light val2 = val.AddComponent(); val2.type = (LightType)((!spot) ? 2 : 0); val2.intensity = 6f; val2.range = 25f; val2.spotAngle = 45f; val2.shadows = (LightShadows)2; val2.color = Color.white; val.transform.SetPositionAndRotation(cam.Position, Quaternion.Euler(cam.EulerAngles)); PlacedLight item = new PlacedLight { Go = val, L = val2, Intensity = val2.intensity }; Lights.Add(item); Selected = Lights.Count - 1; return string.Format("{0} light {1} placed here", spot ? "Spot" : "Point", Lights.Count); } public string MoveHere(FreeCamRig cam) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) PlacedLight current = Current; if (current == null) { return "No light selected"; } current.Mode = PlacedLight.Follow.None; current.Go.transform.SetPositionAndRotation(cam.Position, Quaternion.Euler(cam.EulerAngles)); return $"Light {Selected + 1} moved"; } public string Attach(PlacedLight.Follow mode, FreeCamRig cam) { //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_003b: 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_0042: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_006b: 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_00c6: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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) PlacedLight current = Current; if (current == null) { return "No light selected"; } current.Mode = mode; Transform transform = current.Go.transform; switch (mode) { case PlacedLight.Follow.Camera: { Quaternion val = Quaternion.Inverse(Quaternion.Euler(cam.EulerAngles)); current.LocalPos = val * (transform.position - cam.Position); current.LocalRot = val * transform.rotation; return $"Light {Selected + 1} rides the camera"; } case PlacedLight.Follow.Target: if ((Object)(object)cam.AimTarget == (Object)null) { current.Mode = PlacedLight.Follow.None; return "Need a target"; } current.Anchor = ((Component)cam.AimTarget).transform; current.LocalPos = current.Anchor.InverseTransformPoint(transform.position); current.LocalRot = Quaternion.Inverse(current.Anchor.rotation) * transform.rotation; return $"Light {Selected + 1} follows {cam.AimTarget.GetDisplayName()}"; default: return $"Light {Selected + 1} fixed"; } } public string Remove() { PlacedLight current = Current; if (current == null) { return "No light selected"; } if ((Object)(object)current.Go != (Object)null) { Object.Destroy((Object)(object)current.Go); } Lights.RemoveAt(Selected); Selected = Mathf.Min(Selected, Lights.Count - 1); return "Light removed"; } public string ToggleAll() { if (Lights.Count == 0) { return "No lights placed"; } bool flag = !AnyOn; foreach (PlacedLight light in Lights) { light.On = flag; } if (!flag) { return "Lights off"; } return "Lights on"; } public string ToggleSelected() { PlacedLight current = Current; if (current == null) { return "No light selected"; } current.On = !current.On; return string.Format("Light {0} {1}", Selected + 1, current.On ? "on" : "off"); } public void ClearLights() { foreach (PlacedLight light in Lights) { if ((Object)(object)light.Go != (Object)null) { Object.Destroy((Object)(object)light.Go); } } Lights.Clear(); Selected = -1; } public static Color Tinted(float kelvin, float hue, float sat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) Color val = Mathf.CorrelatedColorTemperatureToRGB(kelvin); if (sat <= 0.001f) { return val; } Color val2 = Color.HSVToRGB(hue, 1f, 1f); return Color.Lerp(val, val * val2 * 1.6f, sat); } public void ApplyColor(PlacedLight p) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) p.L.color = Tinted(p.Kelvin, p.Hue, p.Sat); } private Light FindSun() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 Light val = null; Light[] array = Object.FindObjectsOfType(); foreach (Light val2 in array) { if ((int)val2.type == 1 && ((Behaviour)val2).enabled && ((Object)(object)val == (Object)null || val2.intensity > val.intensity)) { val = val2; } } return val; } private void ApplySun() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ba: 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_00d0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_sun == (Object)null) { _sun = FindSun(); _sunSaved = false; } if (!((Object)(object)_sun == (Object)null)) { if (!_sunSaved) { _sunIntensity = _sun.intensity; _sunColor = _sun.color; _sunRot = ((Component)_sun).transform.rotation; _sunShadows = _sun.shadows; Cfg.SunIntensity.Value = _sunIntensity; Vector3 eulerAngles = ((Quaternion)(ref _sunRot)).eulerAngles; Cfg.SunPitch.Value = ((eulerAngles.x > 180f) ? (eulerAngles.x - 360f) : eulerAngles.x); Cfg.SunYaw.Value = eulerAngles.y; _sunSaved = true; } _sun.intensity = Cfg.SunIntensity.Value; _sun.color = Tinted(Cfg.SunKelvin.Value, Cfg.SunHue.Value, Cfg.SunSat.Value); ((Component)_sun).transform.rotation = Quaternion.Euler(Cfg.SunPitch.Value, Cfg.SunYaw.Value, 0f); _sun.shadows = (LightShadows)(Cfg.SunShadows.Value ? 2 : 0); } } private void RestoreSun() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_sun == (Object)null) && _sunSaved) { _sun.intensity = _sunIntensity; _sun.color = _sunColor; ((Component)_sun).transform.rotation = _sunRot; _sun.shadows = _sunShadows; _sunSaved = false; _sun = null; } } private void ApplyAmbient() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!_ambSaved) { _ambMode = RenderSettings.ambientMode; _ambLight = RenderSettings.ambientLight; _ambSky = RenderSettings.ambientSkyColor; _ambEq = RenderSettings.ambientEquatorColor; _ambGround = RenderSettings.ambientGroundColor; _ambIntensity = RenderSettings.ambientIntensity; _ambSaved = true; } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = Tinted(Cfg.AmbientKelvin.Value, Cfg.AmbientHue.Value, Cfg.AmbientSat.Value) * Cfg.AmbientIntensity.Value; } private void RestoreAmbient() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) if (_ambSaved) { RenderSettings.ambientMode = _ambMode; RenderSettings.ambientLight = _ambLight; RenderSettings.ambientSkyColor = _ambSky; RenderSettings.ambientEquatorColor = _ambEq; RenderSettings.ambientGroundColor = _ambGround; RenderSettings.ambientIntensity = _ambIntensity; _ambSaved = false; } } } internal static class Log { private static ManualLogSource _log; public static void Init(ManualLogSource log) { _log = log; } public static void Info(string msg) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)msg); } } public static void Warn(string msg) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)msg); } } public static void Error(string msg) { ManualLogSource log = _log; if (log != null) { log.LogError((object)msg); } } } internal class Look { private readonly ColorGrading _grade; private readonly Vignette _vignette; private readonly Grain _grain; private readonly ChromaticAberration _aberration; private readonly RampFog _fog; private readonly SobelRain _rain; private static Texture _rainTex; private static bool _rainLooked; private int _stamp; private bool _written; public static bool AnyOn { get { if (!Cfg.GradeOn.Value && !Cfg.FxOn.Value && !Cfg.FogOn.Value) { return Cfg.RainOn.Value; } return true; } } public static string RainStatus { get { if (!((Object)(object)_rainTex != (Object)null)) { if (!_rainLooked) { return ""; } return "no texture loaded yet"; } return "ready"; } } public Look(PostProcessProfile profile) { _grade = profile.AddSettings(); _vignette = profile.AddSettings(); _grain = profile.AddSettings(); _aberration = profile.AddSettings(); _fog = profile.AddSettings(); _rain = profile.AddSettings(); ((PostProcessEffectSettings)_grade).active = (((PostProcessEffectSettings)_vignette).active = (((PostProcessEffectSettings)_grain).active = (((PostProcessEffectSettings)_aberration).active = false))); ((PostProcessEffectSettings)_fog).active = (((PostProcessEffectSettings)_rain).active = false); } public bool Tick() { if (Cfg.RainOn.Value && !_rainLooked) { FindRainTexture(); } int num = Stamp(); if (_written && num == _stamp) { return false; } _stamp = num; _written = true; Write(); return true; } private void Write() { //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) ((PostProcessEffectSettings)_grade).active = Cfg.GradeOn.Value; if (((PostProcessEffectSettings)_grade).active) { On((PostProcessEffectSettings)(object)_grade); Set(_grade.temperature, Cfg.GradeTemp.Value); Set(_grade.tint, Cfg.GradeTint.Value); Set(_grade.saturation, Cfg.GradeSat.Value); Set(_grade.contrast, Cfg.GradeContrast.Value); Set(_grade.postExposure, Cfg.GradeExposure.Value); Set(_grade.brightness, Cfg.GradeExposure.Value * 25f); Set(_grade.hueShift, Cfg.GradeHue.Value); } bool value = Cfg.FxOn.Value; ((PostProcessEffectSettings)_vignette).active = (((PostProcessEffectSettings)_grain).active = (((PostProcessEffectSettings)_aberration).active = value)); if (value) { Enable((PostProcessEffectSettings)(object)_vignette, Cfg.FxVignette.Value); Set(_vignette.intensity, Cfg.FxVignette.Value); Set(_vignette.smoothness, 0.35f); Enable((PostProcessEffectSettings)(object)_grain, Cfg.FxGrain.Value); Set(_grain.intensity, Cfg.FxGrain.Value); Set(_grain.size, 1.2f); Enable((PostProcessEffectSettings)(object)_aberration, Cfg.FxAberration.Value); Set(_aberration.intensity, Cfg.FxAberration.Value); } ((PostProcessEffectSettings)_fog).active = Cfg.FogOn.Value; if (((PostProcessEffectSettings)_fog).active) { On((PostProcessEffectSettings)(object)_fog); Set(_fog.fogIntensity, Cfg.FogIntensity.Value); Set(_fog.fogPower, Cfg.FogPower.Value); Set(_fog.fogZero, Cfg.FogNear.Value); Set(_fog.fogOne, Cfg.FogFar.Value); Set(_fog.fogHeightIntensity, Cfg.FogHeight.Value); Color val = Color.HSVToRGB(Cfg.FogHue.Value, Cfg.FogSat.Value, Cfg.FogValue.Value); Set(_fog.fogColorStart, val * 0.6f); Set(_fog.fogColorMid, val); Set(_fog.fogColorEnd, val); } ((PostProcessEffectSettings)_rain).active = Cfg.RainOn.Value && (Object)(object)_rainTex != (Object)null; if (((PostProcessEffectSettings)_rain).active) { On((PostProcessEffectSettings)(object)_rain); ((ParameterOverride)_rain.rainTexture).overrideState = true; ((ParameterOverride)(object)_rain.rainTexture).value = _rainTex; Set(_rain.rainIntensity, Cfg.RainIntensity.Value); Set(_rain.rainDensity, Cfg.RainDensity.Value); Set(_rain.outlineScale, 1f); Set(_rain.rainColor, new Color(0.8f, 0.9f, 1f, 1f)); } } private static int Stamp() { return Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(Mix(17, Cfg.GradeOn.Value), Cfg.GradeTemp.Value), Cfg.GradeTint.Value), Cfg.GradeSat.Value), Cfg.GradeContrast.Value), Cfg.GradeExposure.Value), Cfg.GradeHue.Value), Cfg.FxOn.Value), Cfg.FxVignette.Value), Cfg.FxGrain.Value), Cfg.FxAberration.Value), Cfg.FogOn.Value), Cfg.FogIntensity.Value), Cfg.FogPower.Value), Cfg.FogNear.Value), Cfg.FogFar.Value), Cfg.FogHeight.Value), Cfg.FogHue.Value), Cfg.FogSat.Value), Cfg.FogValue.Value), Cfg.RainOn.Value), Cfg.RainIntensity.Value), Cfg.RainDensity.Value), (Object)(object)_rainTex != (Object)null); } private static int Mix(int h, float v) { return h * 31 + v.GetHashCode(); } private static int Mix(int h, bool v) { return h * 31 + (v ? 1 : 0); } private static void FindRainTexture() { _rainLooked = true; SobelRain[] array = Resources.FindObjectsOfTypeAll(); foreach (SobelRain val in array) { if ((Object)(object)val != (Object)null && val.rainTexture != null && (Object)(object)((ParameterOverride)(object)val.rainTexture).value != (Object)null) { _rainTex = ((ParameterOverride)(object)val.rainTexture).value; Log.Info("Rain texture found: " + ((Object)_rainTex).name); return; } } Log.Warn("No rain texture loaded yet. Visit a stage with rain first."); } public static void RetryRain() { _rainLooked = false; } private static void On(PostProcessEffectSettings s) { ((ParameterOverride)s.enabled).overrideState = true; ((ParameterOverride)(object)s.enabled).value = true; } private static void Enable(PostProcessEffectSettings s, float amount) { ((ParameterOverride)s.enabled).overrideState = true; ((ParameterOverride)(object)s.enabled).value = amount > 0.001f; } private static void Set(FloatParameter p, float v) { ((ParameterOverride)p).overrideState = true; ((ParameterOverride)(object)p).value = v; } private static void Set(ColorParameter p, Color v) { //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) ((ParameterOverride)p).overrideState = true; ((ParameterOverride)(object)p).value = v; } } internal class Menu : MonoBehaviour { private struct Bind { public string Label; public ConfigEntry Entry; public Bind(string label, ConfigEntry entry) { Label = label; Entry = entry; } } private Rect _rect = new Rect(60f, 60f, 520f, 560f); private int _tab; private float _resetArmedUntil; private Vector2 _scroll; private static readonly string[] Tabs = new string[9] { "Camera", "Track", "Lens", "Look", "Scene", "Shot", "Capture", "View", "Keys" }; private GUIStyle _label; private GUIStyle _header; private GUIStyle _small; private bool _stylesReady; private bool _cursorHeld; private readonly Dictionary _edit = new Dictionary(); private string _lastFocus = ""; private static Bind[][] _bindGroups; private static readonly string[] BindGroupNames = new string[9] { "Session", "Flight", "Lens", "Time", "Tracking", "Shots", "Scene", "Capture", "Tuning" }; private ConfigEntry _listening; private static KeyCode[] _allKeys; public static Menu Instance { get; private set; } public bool Open { get; private set; } private static Bind[][] BindGroups { get { object obj = _bindGroups; if (obj == null) { obj = new Bind[9][] { new Bind[6] { new Bind("Enter / exit camera", Cfg.KeyToggleFreeCam), new Bind("Game HUD", Cfg.KeyToggleHud), new Bind("Camera / character", Cfg.KeyToggleFocus), new Bind("This panel", Cfg.KeyToggleMenu), new Bind("Framing guides", Cfg.KeyCycleGuide), new Bind("Aspect matte", Cfg.KeyCycleMatte) }, new Bind[8] { new Bind("Forward", Cfg.KeyForward), new Bind("Back", Cfg.KeyBack), new Bind("Left", Cfg.KeyLeft), new Bind("Right", Cfg.KeyRight), new Bind("Up", Cfg.KeyUp), new Bind("Down", Cfg.KeyDown), new Bind("Fast", Cfg.KeyFast), new Bind("Slow / fine", Cfg.KeySlow) }, new Bind[7] { new Bind("Narrower fov", Cfg.KeyFovDown), new Bind("Wider fov", Cfg.KeyFovUp), new Bind("Roll left", Cfg.KeyRollLeft), new Bind("Roll right", Cfg.KeyRollRight), new Bind("Level", Cfg.KeyResetRoll), new Bind("Depth of field mode", Cfg.KeyCycleFocusMode), new Bind("Rack focus", Cfg.KeyRackFocus) }, new Bind[4] { new Bind("Freeze all", Cfg.KeyTogglePause), new Bind("Freeze world, not me", Cfg.KeyFreezeWorld), new Bind("Slower", Cfg.KeyTimeDown), new Bind("Faster", Cfg.KeyTimeUp) }, new Bind[5] { new Bind("Next target", Cfg.KeyCycleTarget), new Bind("Release target", Cfg.KeyClearTarget), new Bind("Rig mode", Cfg.KeyCycleRigMode), new Bind("Next mount bone", Cfg.KeyCycleMountBone), new Bind("Dolly zoom", Cfg.KeyDollyZoom) }, new Bind[9] { new Bind("Add keyframe", Cfg.KeyAddKeyframe), new Bind("Undo keyframe", Cfg.KeyDeleteKeyframe), new Bind("Clear shot", Cfg.KeyClearShot), new Bind("Play / stop", Cfg.KeyPlayShot), new Bind("Shorter", Cfg.KeyDurationDown), new Bind("Longer", Cfg.KeyDurationUp), new Bind("Save shot", Cfg.KeySaveShot), new Bind("Load next shot", Cfg.KeyCycleShot), new Bind("Bookmark store (hold)", Cfg.KeyBookmarkModifier) }, new Bind[4] { new Bind("Hide me", Cfg.KeyHideSelf), new Bind("Hide others", Cfg.KeyHideOthers), new Bind("Drop spot light", Cfg.KeyAddLight), new Bind("Lights on / off", Cfg.KeyToggleLights) }, new Bind[2] { new Bind("Screenshot", Cfg.KeyStill), new Bind("Record sequence", Cfg.KeySequence) }, new Bind[3] { new Bind("Next parameter", Cfg.KeyCycleParam), new Bind("Parameter down", Cfg.KeyParamDown), new Bind("Parameter up", Cfg.KeyParamUp) } }; _bindGroups = (Bind[][])obj; } return (Bind[][])obj; } } public bool Listening => _listening != null; private void Awake() { Instance = this; } private void OnDestroy() { HoldCursor(hold: false); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void Toggle() { SetOpen(!Open); } public void SetOpen(bool open) { Open = open; HoldCursor(open); if (!open) { Cfg.Save(); } } private void HoldCursor(bool hold) { if (hold != _cursorHeld) { MPEventSystem kbmEventSystem = MPEventSystemManager.kbmEventSystem; if ((Object)(object)kbmEventSystem == (Object)null) { Log.Warn("No kb/m event system, can't open the cursor"); return; } kbmEventSystem.cursorOpenerCount = (hold ? (kbmEventSystem.cursorOpenerCount + 1) : Mathf.Max(0, kbmEventSystem.cursorOpenerCount - 1)); _cursorHeld = hold; } } private void OnDisable() { HoldCursor(hold: false); } private void InitStyles() { //IL_0014: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003f: 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) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (!_stylesReady) { _label = new GUIStyle(GUI.skin.label) { fontSize = 12, richText = true, wordWrap = false }; _header = new GUIStyle(GUI.skin.label) { fontSize = 12, richText = true, fontStyle = (FontStyle)1 }; _small = new GUIStyle(GUI.skin.label) { fontSize = 11, richText = true, wordWrap = true }; _stylesReady = true; } } private void OnGUI() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Director instance = Director.Instance; if (!((Object)(object)instance == (Object)null) && instance.Active && Open && (!((Object)(object)Capture.Instance != (Object)null) || !Capture.Instance.Hiding)) { InitStyles(); _rect = GUI.Window(49534, _rect, new WindowFunction(DrawWindow), "Machinima Tools"); } } private void DrawWindow(int id) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) Director instance = Director.Instance; _tab = GUILayout.Toolbar(_tab, Tabs, Array.Empty()); GUILayout.Space(4f); _scroll = GUILayout.BeginScrollView(_scroll, Array.Empty()); switch (_tab) { case 0: DrawCamera(instance); break; case 1: DrawTrack(instance); break; case 2: DrawLens(instance); break; case 3: DrawLook(instance); break; case 4: DrawScene(instance); break; case 5: DrawShot(instance); break; case 6: DrawCapture(instance); break; case 7: DrawView(instance); break; default: DrawKeys(); break; } GUILayout.EndScrollView(); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button($"Close ({Cfg.KeyToggleMenu.Value})", Array.Empty())) { Toggle(); } bool flag = Time.unscaledTime < _resetArmedUntil; if (GUILayout.Button(flag ? "Sure? Everything but keys" : "Reset all settings", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(flag ? 190f : 140f) })) { if (flag) { Cfg.ResetAll(); instance.FreeCam.ReloadSpeed(); instance.Notify("Settings back to defaults"); _resetArmedUntil = 0f; } else { _resetArmedUntil = Time.unscaledTime + 3f; } } GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private void Slider(string category) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 string nameOfFocusedControl = GUI.GetNameOfFocusedControl(); if (_lastFocus != nameOfFocusedControl && _edit.TryGetValue(_lastFocus, out var value)) { Commit(_lastFocus, value); _edit.Remove(_lastFocus); } _lastFocus = nameOfFocusedControl; bool flag = (int)Event.current.type == 4 && ((int)Event.current.keyCode == 13 || (int)Event.current.keyCode == 271); foreach (Tunable item in Tuner.All) { if (item.Category != category) { continue; } string text = "mt_" + item.Label; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(item.Label, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); float num = GUILayout.HorizontalSlider(item.Get(), item.Min, item.Max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); if (!Mathf.Approximately(num, item.Get())) { item.Set(num); } if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { item.Nudge(-1f, fine: true); } if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { item.Nudge(1f, fine: true); } bool flag2 = nameOfFocusedControl == text; string value2; string text2 = ((flag2 && _edit.TryGetValue(text, out value2)) ? value2 : item.Get().ToString(item.Format)); GUI.SetNextControlName(text); string text3 = GUILayout.TextField(text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (flag2) { _edit[text] = text3; if (flag) { Commit(text, text3); _edit.Remove(text); GUI.FocusControl((string)null); Event.current.Use(); } } else if (text3 != text2) { _edit[text] = text3; } GUILayout.Label(item.Suffix, _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }); GUILayout.EndHorizontal(); } if (Tuner.HasDefaults(category)) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("Defaults", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { Tuner.ResetCategory(category); } GUILayout.EndHorizontal(); } } private static void Commit(string name, string text) { foreach (Tunable item in Tuner.All) { if (!("mt_" + item.Label != name)) { if (float.TryParse(text.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { item.Set(Mathf.Clamp(result, item.Min, item.Max)); } break; } } } private static bool Toggle(string label, ConfigEntry e) { bool flag = GUILayout.Toggle(e.Value, " " + label, Array.Empty()); if (flag != e.Value) { e.Value = flag; } return flag; } private void DrawCamera(Director d) { //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) FreeCamRig freeCam = d.FreeCam; GUILayout.Label("Control", _header, Array.Empty()); bool flag = freeCam.Focus == FreeCamRig.ControlFocus.Character; if (GUILayout.Button(flag ? "Driving character. Switch to camera" : "Driving camera. Switch to character", Array.Empty())) { freeCam.Focus = ((!flag) ? FreeCamRig.ControlFocus.Character : FreeCamRig.ControlFocus.Camera); } GUILayout.Space(6f); GUILayout.Label("Rig mode", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); FreeCamRig.RigMode[] array = new FreeCamRig.RigMode[4] { FreeCamRig.RigMode.Free, FreeCamRig.RigMode.Follow, FreeCamRig.RigMode.Orbit, FreeCamRig.RigMode.Mount }; for (int i = 0; i < array.Length; i++) { FreeCamRig.RigMode rigMode = array[i]; bool flag2 = freeCam.Mode == rigMode; if (!GUILayout.Toggle(flag2, rigMode.ToString(), GUI.skin.button, Array.Empty()) || flag2) { continue; } switch (rigMode) { case FreeCamRig.RigMode.Mount: d.MountPreset("helmet"); continue; default: if ((Object)(object)freeCam.AimTarget == (Object)null) { d.Notify("Lock a target first"); continue; } break; case FreeCamRig.RigMode.Free: break; } if (rigMode == FreeCamRig.RigMode.Orbit) { freeCam.SyncOrbitAngle(); } freeCam.Mode = rigMode; } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.Label("Feel", _header, Array.Empty()); Slider("Camera"); if (freeCam.Mode == FreeCamRig.RigMode.Mount) { GUILayout.Space(4f); GUILayout.Label("Mount presets", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Helmet", Array.Empty())) { d.MountPreset("helmet"); } if (GUILayout.Button("Bob cam", Array.Empty())) { d.MountPreset("bob"); } if (GUILayout.Button("Shoulder", Array.Empty())) { d.MountPreset("shoulder"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Chest", Array.Empty())) { d.MountPreset("chest"); } if (GUILayout.Button("Weapon", Array.Empty())) { d.MountPreset("weapon"); } if (GUILayout.Button("Low front", Array.Empty())) { d.MountPreset("low"); } GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.Label("Frame", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); MountFrame[] array2 = new MountFrame[3] { MountFrame.Actor, MountFrame.Bone, MountFrame.World }; for (int i = 0; i < array2.Length; i++) { MountFrame mountFrame = array2[i]; bool flag3 = Cfg.MountFrame.Value == mountFrame; if (GUILayout.Toggle(flag3, mountFrame.ToString(), GUI.skin.button, Array.Empty()) && !flag3) { Cfg.MountFrame.Value = mountFrame; } } GUILayout.EndHorizontal(); GUILayout.Label((Cfg.MountFrame.Value == MountFrame.Actor) ? "Follows the bone, faces where the character faces." : ((Cfg.MountFrame.Value == MountFrame.Bone) ? "Takes the bone's own rotation, every twitch of the animation." : "Fixed world axes. Bone position only."), _small, Array.Empty()); if (Cfg.MountFrame.Value == MountFrame.Bone) { Toggle("Level horizon", Cfg.MountLevelHorizon); } GUILayout.Space(4f); GUILayout.Label("Bone: " + freeCam.BoneName + "", _label, Array.Empty()); string[] array3 = freeCam.BoneNames(12); int num = 0; GUILayout.BeginHorizontal(Array.Empty()); for (int j = 0; j < array3.Length; j++) { string text = ((array3[j].Length > 14) ? array3[j].Substring(0, 14) : array3[j]); bool flag4 = freeCam.BoneIndex == j; if (GUILayout.Toggle(flag4, text, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }) && !flag4) { freeCam.SelectBone(j); } if (++num == 3 && j < array3.Length - 1) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); num = 0; } } GUILayout.EndHorizontal(); if (GUILayout.Button("More bones", Array.Empty())) { d.Notify(d.FreeCam.CycleMountBone()); } GUILayout.Space(4f); GUILayout.Label("Position and look", _header, Array.Empty()); Slider("Mount"); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Center look", Array.Empty())) { Cfg.MountPitch.Value = 0f; Cfg.MountYaw.Value = 0f; } if (GUILayout.Button("Zero offset", Array.Empty())) { Cfg.MountOffsetX.Value = 0f; Cfg.MountOffsetY.Value = 0f; Cfg.MountOffsetZ.Value = 0f; } GUILayout.EndHorizontal(); GUILayout.Label("Mouse looks around. WASD nudges the offset, Q/E up and down, X recenters.", _small, Array.Empty()); } GUILayout.Space(6f); GUILayout.Label("Rig and handheld", _header, Array.Empty()); Slider("Rig"); if (GUILayout.Button(freeCam.DollyZoom ? "Dolly zoom ON" : "Dolly zoom off", Array.Empty())) { d.Notify(d.FreeCam.ToggleDollyZoom()); } Toggle("Follow anchored to subject facing", Cfg.FollowUsesFacing); GUILayout.Space(6f); GUILayout.Label(NetAuth.IsServer ? "Time" : "Time (host only)", _header, Array.Empty()); if (!NetAuth.IsServer) { GUILayout.Label("Client: local view only, things will snap back.", _small, Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button((Time.timeScale > 0f) ? "Freeze all" : "Resume", Array.Empty())) { d.TogglePause(); } if (GUILayout.Button("0.1x", Array.Empty())) { d.SetTime(0.1f); } if (GUILayout.Button("0.5x", Array.Empty())) { d.SetTime(0.5f); } if (GUILayout.Button("1x", Array.Empty())) { d.SetTime(1f); } GUILayout.EndHorizontal(); if (GUILayout.Button(d.Freeze.Active ? $"Unfreeze world ({d.Freeze.FrozenCount} held)" : "Freeze world, keep me moving", Array.Empty())) { d.ToggleWorldFreeze(); } GUILayout.Space(6f); GUILayout.Label("Visibility", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(d.SelfHidden ? "Show me" : "Hide me", Array.Empty())) { d.ToggleHideSelf(); } if (GUILayout.Button(d.OthersHidden ? "Show others" : "Hide others", Array.Empty())) { d.ToggleHideOthers(); } GUILayout.EndHorizontal(); Toggle("No dither fade near characters", Cfg.DisableModelFade); GUILayout.Space(6f); GUILayout.Label("Bookmarks", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); for (int k = 1; k <= 9; k++) { bool flag5 = d.HasBookmark(k); if (GUILayout.Button(flag5 ? k.ToString() : "-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { if (Input.GetKey(Cfg.KeyBookmarkModifier.Value) || !flag5) { d.StoreBookmark(k); } else { d.RecallBookmark(k); } } } GUILayout.EndHorizontal(); GUILayout.Label($"1-9 recalls, {Cfg.KeyBookmarkModifier.Value}+number stores. Empty slot stores on click.", _small, Array.Empty()); GUILayout.Space(6f); Toggle("Suppress screen shake", Cfg.SuppressScreenShake); Toggle("Pause particles when freezing", Cfg.FreezeParticles); Toggle("Movement relative to aim", Cfg.RelinkMovement); } private void DrawTrack(Director d) { FreeCamRig freeCam = d.FreeCam; GUILayout.Label("Target", _header, Array.Empty()); GUILayout.Label(((Object)(object)freeCam.AimTarget != (Object)null) ? ("Tracking " + freeCam.AimTarget.GetDisplayName() + "") : "No target, aim is manual", _label, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Next target", Array.Empty())) { d.CycleTarget(); } if (GUILayout.Button("Release", Array.Empty())) { d.ClearTarget(); } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.Label("Behavior", _header, Array.Empty()); Slider("Track"); GUILayout.Space(6f); GUILayout.Label("Damping = how heavy the rig feels. Lead stops fast targets lagging.", _small, Array.Empty()); } private void DrawLens(Director d) { Lens optics = d.Optics; GUILayout.Label("Depth of field", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); Lens.FocusMode[] array = new Lens.FocusMode[3] { Lens.FocusMode.Off, Lens.FocusMode.Manual, Lens.FocusMode.Track }; for (int i = 0; i < array.Length; i++) { Lens.FocusMode focusMode = array[i]; bool flag = optics.Mode == focusMode; if (GUILayout.Toggle(flag, focusMode.ToString(), GUI.skin.button, Array.Empty()) && !flag) { optics.Mode = focusMode; } } GUILayout.EndHorizontal(); if (GUILayout.Button($"Rack focus onto target ({Cfg.RackDuration.Value:0.##}s)", Array.Empty())) { d.Notify(optics.Rack(d.FreeCam)); } GUILayout.Space(6f); Slider("Lens"); Toggle("Link blur to real focal length (kills the blur)", Cfg.LinkDofToLens); GUILayout.Label("Blur focal is the strength knob. Try 90mm at f/2. Under 40mm does nothing.", _small, Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Motion blur", _header, Array.Empty()); Toggle("Enabled", Cfg.MotionBlurEnabled); Toggle("Compensate shutter for slow motion", Cfg.CompensateShutter); } private void DrawLook(Director d) { GUILayout.Label("Grade", _header, Array.Empty()); Toggle("Override color grade", Cfg.GradeOn); if (Cfg.GradeOn.Value) { Slider("Grade"); } GUILayout.Space(6f); GUILayout.Label("Effects", _header, Array.Empty()); Toggle("Override effects", Cfg.FxOn); if (Cfg.FxOn.Value) { Slider("Fx"); } GUILayout.Space(6f); GUILayout.Label("Fog", _header, Array.Empty()); Toggle("Override stage fog", Cfg.FogOn); if (Cfg.FogOn.Value) { Slider("Fog"); } GUILayout.Space(6f); GUILayout.Label("Weather", _header, Array.Empty()); Toggle("Wet surfaces (the game's rain shimmer)", Cfg.RainOn); if (Cfg.RainOn.Value && Look.RainStatus == "no texture loaded yet") { GUILayout.Label("Needs the ripple texture, which only loads with a stage that has rain. Visit one, then retry.", _small, Array.Empty()); if (GUILayout.Button("Retry", Array.Empty())) { Look.RetryRain(); } } Weather sky = d.Sky; GUILayout.BeginHorizontal(Array.Empty()); Weather.Kind[] array = new Weather.Kind[6] { Weather.Kind.None, Weather.Kind.Rain, Weather.Kind.Snow, Weather.Kind.Dust, Weather.Kind.Embers, Weather.Kind.Ash }; for (int i = 0; i < array.Length; i++) { Weather.Kind kind = array[i]; bool flag = sky.Current == kind; if (GUILayout.Toggle(flag, (kind == Weather.Kind.None) ? "Off" : kind.ToString(), GUI.skin.button, Array.Empty()) && !flag) { d.Notify(sky.Set(kind)); } } GUILayout.EndHorizontal(); Slider("Weather"); } private void DrawScene(Director d) { //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_03e1: Invalid comparison between Unknown and I4 Lighting lights = d.Lights; GUILayout.Label("Sun", _header, Array.Empty()); Toggle("Override sun", Cfg.SunOverride); if (Cfg.SunOverride.Value) { if (!lights.SunFound) { GUILayout.Label("No directional light on this stage.", _small, Array.Empty()); } Slider("Sun"); Toggle("Sun shadows", Cfg.SunShadows); } GUILayout.Space(6f); GUILayout.Label("Ambient", _header, Array.Empty()); Toggle("Override ambient", Cfg.AmbientOverride); if (Cfg.AmbientOverride.Value) { Slider("Ambient"); } GUILayout.Space(6f); GUILayout.Label($"Lights ({lights.Lights.Count})", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Spot here", Array.Empty())) { d.Notify(lights.Add(spot: true, d.FreeCam)); } if (GUILayout.Button("Point here", Array.Empty())) { d.Notify(lights.Add(spot: false, d.FreeCam)); } if (GUILayout.Button("Clear all", Array.Empty())) { lights.ClearLights(); d.Notify("Lights cleared"); } GUILayout.EndHorizontal(); if (lights.Lights.Count > 0) { if (GUILayout.Button(lights.AnyOn ? $"All off ({Cfg.KeyToggleLights.Value})" : $"All on ({Cfg.KeyToggleLights.Value})", Array.Empty())) { d.Notify(lights.ToggleAll()); } Slider("Lights"); } if (lights.Lights.Count > 0) { GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < lights.Lights.Count; i++) { bool flag = lights.Selected == i; string text = (((int)lights.Lights[i].L.type == 0) ? "S" : "P") + (i + 1) + (lights.Lights[i].On ? "" : " off"); if (GUILayout.Toggle(flag, text, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }) && !flag) { lights.Selected = i; } } GUILayout.EndHorizontal(); } PlacedLight current = lights.Current; if (current == null) { return; } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(current.On ? "Switch off" : "Switch on", Array.Empty())) { d.Notify(lights.ToggleSelected()); } if (GUILayout.Button("Move here", Array.Empty())) { d.Notify(lights.MoveHere(d.FreeCam)); } if (GUILayout.Button("Remove", Array.Empty())) { d.Notify(lights.Remove()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Follow", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); PlacedLight.Follow[] array = new PlacedLight.Follow[3] { PlacedLight.Follow.None, PlacedLight.Follow.Camera, PlacedLight.Follow.Target }; for (int j = 0; j < array.Length; j++) { PlacedLight.Follow follow = array[j]; bool flag2 = current.Mode == follow; if (GUILayout.Toggle(flag2, (follow == PlacedLight.Follow.None) ? "Fixed" : follow.ToString(), GUI.skin.button, Array.Empty()) && !flag2) { d.Notify(lights.Attach(follow, d.FreeCam)); } } GUILayout.EndHorizontal(); bool flag3 = (int)current.L.shadows > 0; bool flag4 = GUILayout.Toggle(flag3, " Shadows", Array.Empty()); if (flag4 != flag3) { current.L.shadows = (LightShadows)(flag4 ? 2 : 0); } Slider("Light"); GUILayout.Label("Spot here drops a light at the camera, pointing the same way.", _small, Array.Empty()); } private void DrawShot(Director d) { Shot current = d.Current; GUILayout.Label($"{current.name} {current.Count} keys {current.duration:0.##}s", _label, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Add key", Array.Empty())) { d.AddKeyframe(); } if (GUILayout.Button("Undo key", Array.Empty())) { d.RemoveKeyframe(); } if (GUILayout.Button("Clear", Array.Empty())) { d.ClearShot(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(d.Playing ? "Stop" : "Play", Array.Empty())) { d.TogglePlay(); } if (GUILayout.Button("Save", Array.Empty())) { d.SaveShot(); } if (GUILayout.Button("Load next", Array.Empty())) { d.CycleLibrary(); } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Duration", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); float num = GUILayout.HorizontalSlider(current.duration, 0.25f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); if (!Mathf.Approximately(num, current.duration)) { current.duration = num; } GUILayout.Label($"{current.duration:0.##}s", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.EndHorizontal(); current.easeEnds = GUILayout.Toggle(current.easeEnds, " Ease in and out" + (current.HasCuts ? " (each section)" : ""), Array.Empty()); current.loop = GUILayout.Toggle(current.loop, " Loop", Array.Empty()); current.closed = GUILayout.Toggle(current.closed, " Closed path, last key runs back into the first" + (current.HasCuts ? " (off while there are cuts)" : ""), Array.Empty()); if (current.closed && !current.HasCuts) { GUILayout.Label("Constant speed around the loop, ease is ignored. Turn Loop on to keep going.", _small, Array.Empty()); } bool flag = GUILayout.Toggle(Cfg.ShowKeyframes.Value, " Show keys in world", Array.Empty()); if (flag != Cfg.ShowKeyframes.Value) { Cfg.ShowKeyframes.Value = flag; } if (current.Playable) { GUILayout.Space(6f); DrawTimeline(d, current); } if (current.Count <= 0) { return; } GUILayout.Space(6f); GUILayout.Label("Keys", _header, Array.Empty()); for (int i = 0; i < current.Count; i++) { Key key = current.keys[i]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"{i + 1}", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) }); GUILayout.Label($"{Lens.FovToFocal(key.fov):0}mm" + ((key.focus > 0f) ? $" f {key.focus:0.#}m" : ""), _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }); if (GUILayout.Button("Go", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { d.GoToKey(i); } if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { d.OverwriteKey(i); } if (i > 0) { key.cut = GUILayout.Toggle(key.cut, "Cut", GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); } else { GUILayout.Space(48f); } if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) })) { d.DeleteKey(i); GUILayout.EndHorizontal(); break; } GUILayout.EndHorizontal(); } GUILayout.Label("Cut: jump to this key instead of blending into it. A lone key between cuts holds.", _small, Array.Empty()); } private void DrawTimeline(Director d, Shot s) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Invalid comparison between Unknown and I4 //IL_0071: 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) Rect rect = GUILayoutUtility.GetRect(380f, 26f); GUI.Box(rect, ""); Color color = GUI.color; for (int i = 0; i < s.Count; i++) { float num = ((Rect)(ref rect)).x + 4f + (((Rect)(ref rect)).width - 8f) * s.KeyTime(i); if (i > 0 && s.keys[i].cut) { GUI.color = new Color(1f, 0.5f, 0.45f); } GUI.Box(new Rect(num - 2f, ((Rect)(ref rect)).y + 4f, 4f, ((Rect)(ref rect)).height - 8f), ""); GUI.color = color; } float num2 = ((Rect)(ref rect)).x + 4f + (((Rect)(ref rect)).width - 8f) * d.PlayHead; GUI.color = new Color(0.6f, 1f, 0.65f); GUI.Box(new Rect(num2 - 1f, ((Rect)(ref rect)).y + 1f, 2f, ((Rect)(ref rect)).height - 2f), ""); GUI.color = color; Event current = Event.current; if (((int)current.type == 0 || (int)current.type == 3) && ((Rect)(ref rect)).Contains(current.mousePosition)) { float t = Mathf.Clamp01((current.mousePosition.x - ((Rect)(ref rect)).x - 4f) / (((Rect)(ref rect)).width - 8f)); d.ScrubTo(t); current.Use(); } GUILayout.Label($"{d.PlayHead * s.duration:0.00}s / {s.duration:0.##}s drag to scrub", _small, Array.Empty()); } private void DrawCapture(Director d) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) Capture recorder = d.Recorder; GUILayout.Label("Stills", _header, Array.Empty()); if (GUILayout.Button($"Screenshot ({Cfg.KeyStill.Value})", Array.Empty())) { d.Notify(recorder.Still()); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Supersize", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); int num = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Cfg.StillSupersize.Value, 1f, 8f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })); if (num != Cfg.StillSupersize.Value) { Cfg.StillSupersize.Value = num; } GUILayout.Label($"{num}x", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label("Image sequence", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Frame rate", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); int num2 = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Cfg.CaptureFps.Value, 12f, 120f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })); if (num2 != Cfg.CaptureFps.Value) { Cfg.CaptureFps.Value = num2; } GUILayout.Label($"{num2}", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Max seconds", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); int num3 = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Cfg.CaptureMaxSeconds.Value, 0f, 600f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })); if (num3 != Cfg.CaptureMaxSeconds.Value) { Cfg.CaptureMaxSeconds.Value = num3; } GUILayout.Label((num3 == 0) ? "none" : $"{num3}", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); GUILayout.EndHorizontal(); if (GUILayout.Button(recorder.Recording ? $"STOP. {recorder.Frames} frames, {recorder.Pending} writing" : $"Record ({Cfg.KeySequence.Value})", Array.Empty())) { d.ToggleSequence(); } GUILayout.Label($"{Cfg.KeySequence.Value} or Esc stops. Panel hides while recording.", _small, Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Game runs slow while recording. Output is still exact fps.\nFiles: config/MachinimaTools/captures", _small, Array.Empty()); } private void DrawView(Director d) { Overlay instance = Overlay.Instance; GUILayout.Label("HUD", _header, Array.Empty()); bool flag = GUILayout.Toggle(d.FreeCam.ShowHud, " Show game HUD", Array.Empty()); if (flag != d.FreeCam.ShowHud) { d.FreeCam.ShowHud = flag; } Toggle("Show camera readout", Cfg.ShowReadout); Toggle("Show messages at the bottom", Cfg.ShowToasts); if ((Object)(object)instance == (Object)null) { return; } GUILayout.Space(6f); GUILayout.Label("Framing guides", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); Overlay.Guide[] array = new Overlay.Guide[4] { Overlay.Guide.Off, Overlay.Guide.Thirds, Overlay.Guide.Center, Overlay.Guide.ThirdsAndCenter }; for (int i = 0; i < array.Length; i++) { Overlay.Guide guide = array[i]; bool flag2 = instance.GuideMode == guide; if (GUILayout.Toggle(flag2, (guide == Overlay.Guide.ThirdsAndCenter) ? "Both" : guide.ToString(), GUI.skin.button, Array.Empty()) && !flag2) { instance.GuideMode = guide; } } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.Label("Aspect matte", _header, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); for (int j = 0; j < Overlay.MatteNames.Length; j++) { bool flag3 = instance.Matte == j; if (GUILayout.Toggle(flag3, Overlay.MatteNames[j], GUI.skin.button, Array.Empty()) && !flag3) { instance.Matte = j; } } GUILayout.EndHorizontal(); } private void Update() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (_listening == null) { return; } if (!Open) { _listening = null; return; } if (_allKeys == null) { _allKeys = (KeyCode[])Enum.GetValues(typeof(KeyCode)); } KeyCode[] allKeys = _allKeys; foreach (KeyCode val in allKeys) { if ((int)val != 0 && ((int)val < 323 || (int)val > 329) && Input.GetKeyDown(val)) { if ((int)val != 27) { _listening.Value = val; } _listening = null; break; } } } private static string UsedBy(ConfigEntry e) { //IL_002c: 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) Bind[][] bindGroups = BindGroups; foreach (Bind[] array in bindGroups) { for (int j = 0; j < array.Length; j++) { Bind bind = array[j]; if (bind.Entry != e && bind.Entry.Value == e.Value) { return bind.Label; } } } return null; } private void DrawKeys() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Click a key, press the new one. Esc cancels. 1-9 are bookmarks and arrows nudge the view, those stay.", _small, Array.Empty()); for (int i = 0; i < BindGroups.Length; i++) { GUILayout.Space(6f); GUILayout.Label(BindGroupNames[i], _header, Array.Empty()); Bind[] array = BindGroups[i]; for (int j = 0; j < array.Length; j++) { Bind bind = array[j]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(bind.Label, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); bool flag = _listening == bind.Entry; if (GUILayout.Button(flag ? "press a key" : ((object)bind.Entry.Value/*cast due to .constrained prefix*/).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) })) { _listening = (flag ? null : bind.Entry); } string text = UsedBy(bind.Entry); if (text != null) { GUILayout.Label("also " + text, _small, Array.Empty()); } GUILayout.EndHorizontal(); } } GUILayout.Space(8f); if (GUILayout.Button("Reset keys to default", Array.Empty())) { Bind[][] bindGroups = BindGroups; foreach (Bind[] array in bindGroups) { for (int k = 0; k < array.Length; k++) { Bind bind2 = array[k]; bind2.Entry.Value = (KeyCode)((ConfigEntryBase)bind2.Entry).DefaultValue; } } _listening = null; } GUILayout.Space(10f); GUILayout.Label("Gamepad", _header, Array.Empty()); Toggle("Use a controller", Cfg.PadEnabled); if (!Cfg.PadEnabled.Value) { return; } GUILayout.Label(Pad.Connected ? "Connected." : "No controller seen yet.", _small, Array.Empty()); Slider("Pad"); GUILayout.Space(4f); GUILayout.Label("Sticks and triggers", _header, Array.Empty()); for (int l = 0; l < Cfg.PadAxisMap.Length; l++) { ConfigEntry val = Cfg.PadAxisMap[l]; GUILayout.BeginHorizontal(Array.Empty()); PadAxis padAxis = (PadAxis)l; GUILayout.Label(padAxis.ToString(), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { val.Value = (PadAxisAction)Step((int)val.Value, -1, typeof(PadAxisAction)); } GUILayout.Label(val.Value.ToString(), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { val.Value = (PadAxisAction)Step((int)val.Value, 1, typeof(PadAxisAction)); } Toggle("invert", Cfg.PadAxisInvert[l]); GUILayout.EndHorizontal(); } GUILayout.Space(4f); GUILayout.Label("Buttons", _header, Array.Empty()); for (int m = 0; m < Cfg.PadButtonMap.Length; m++) { ConfigEntry val2 = Cfg.PadButtonMap[m]; GUILayout.BeginHorizontal(Array.Empty()); PadButton padButton = (PadButton)m; GUILayout.Label(padButton.ToString(), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { val2.Value = (PadAction)Step((int)val2.Value, -1, typeof(PadAction)); } GUILayout.Label(val2.Value.ToString() + (Pad.IsHeldAction(val2.Value) ? " (hold)" : ""), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { val2.Value = (PadAction)Step((int)val2.Value, 1, typeof(PadAction)); } GUILayout.EndHorizontal(); } GUILayout.Label("ToggleFocus on Back also works while driving the character. Everything else is camera only.", _small, Array.Empty()); if (GUILayout.Button("Reset pad to default", Array.Empty())) { ConfigEntry[] padAxisMap = Cfg.PadAxisMap; foreach (ConfigEntry obj in padAxisMap) { obj.Value = (PadAxisAction)((ConfigEntryBase)obj).DefaultValue; } ConfigEntry[] padAxisInvert = Cfg.PadAxisInvert; foreach (ConfigEntry obj2 in padAxisInvert) { obj2.Value = (bool)((ConfigEntryBase)obj2).DefaultValue; } ConfigEntry[] padButtonMap = Cfg.PadButtonMap; foreach (ConfigEntry obj3 in padButtonMap) { obj3.Value = (PadAction)((ConfigEntryBase)obj3).DefaultValue; } } } private static int Step(int v, int dir, Type type) { int length = Enum.GetValues(type).Length; return (v + dir + length) % length; } } internal static class NetAuth { public static bool IsServer => NetworkServer.active; public static bool CanControlTime { get { if (!IsServer) { return Cfg.AllowClientTimeControls.Value; } return true; } } public static string Refusal => "Host only. Time controls desync on a client."; } internal class Overlay : MonoBehaviour { public enum Guide { Off, Thirds, Center, ThirdsAndCenter, Count } private static readonly float[] MatteRatios = new float[6] { 0f, 2.39f, 2f, 1.85f, 1.7777778f, 0.5625f }; public static readonly string[] MatteNames = new string[6] { "off", "2.39:1", "2.00:1", "1.85:1", "16:9", "9:16" }; private Guide _guide; private int _matte; private Texture2D _px; private GUIStyle _label; private GUIStyle _box; public static Overlay Instance { get; private set; } public Guide GuideMode { get { return _guide; } set { _guide = value; } } public int Matte { get { return _matte; } set { _matte = Mathf.Clamp(value, 0, MatteRatios.Length - 1); } } private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) Instance = this; _px = new Texture2D(1, 1, (TextureFormat)5, false); _px.SetPixel(0, 0, Color.white); _px.Apply(); ((Object)_px).hideFlags = (HideFlags)61; } private void Update() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Director.Instance == (Object)null) && Director.Instance.Active && (!((Object)(object)Menu.Instance != (Object)null) || !Menu.Instance.Listening)) { if (Input.GetKeyDown(Cfg.KeyCycleGuide.Value)) { _guide = (Guide)((int)(_guide + 1) % 4); } if (Input.GetKeyDown(Cfg.KeyCycleMatte.Value)) { _matte = (_matte + 1) % MatteRatios.Length; } } } private void OnGUI() { Director instance = Director.Instance; if (!((Object)(object)instance == (Object)null) && instance.Active && (!((Object)(object)Capture.Instance != (Object)null) || !Capture.Instance.Hiding)) { MakeStyles(); if (Cfg.ShowKeyframes.Value) { DrawKeyframes(instance); } DrawLights(instance); DrawMatte(); DrawGuides(); if (Cfg.ShowReadout.Value) { DrawReadout(instance); } if (Cfg.ShowToasts.Value && instance.HasMessage) { DrawToast(instance.LastMessage); } } } private void MakeStyles() { //IL_0014: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006d: Expected O, but got Unknown //IL_0072: Expected O, but got Unknown if (_label == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 12, richText = true }; val.normal.textColor = new Color(0.92f, 0.94f, 1f); _label = val; _box = new GUIStyle(GUI.skin.box) { padding = new RectOffset(10, 10, 8, 8) }; } } private void Fill(Rect r, Color c) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)_px); GUI.color = color; } private void DrawMatte() { //IL_0066: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_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) float num = MatteRatios[_matte]; if (!(num <= 0f)) { float num2 = Screen.width; float num3 = Screen.height; float num4 = num2 / num3; Color c = default(Color); ((Color)(ref c))..ctor(0f, 0f, 0f, 0.92f); if (num4 > num) { float num5 = num3 * num; float num6 = (num2 - num5) * 0.5f; Fill(new Rect(0f, 0f, num6, num3), c); Fill(new Rect(num2 - num6, 0f, num6, num3), c); } else if (num4 < num) { float num7 = num2 / num; float num8 = (num3 - num7) * 0.5f; Fill(new Rect(0f, 0f, num2, num8), c); Fill(new Rect(0f, num3 - num8, num2, num8), c); } } } private void DrawGuides() { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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 (_guide == Guide.Off) { return; } float num = Screen.width; float num2 = Screen.height; Color c = default(Color); ((Color)(ref c))..ctor(1f, 1f, 1f, 0.22f); if (_guide == Guide.Thirds || _guide == Guide.ThirdsAndCenter) { for (int i = 1; i <= 2; i++) { Fill(new Rect(num * (float)i / 3f, 0f, 1f, num2), c); Fill(new Rect(0f, num2 * (float)i / 3f, num, 1f), c); } } if (_guide == Guide.Center || _guide == Guide.ThirdsAndCenter) { float num3 = num * 0.5f; float num4 = num2 * 0.5f; Color c2 = default(Color); ((Color)(ref c2))..ctor(1f, 1f, 1f, 0.35f); Fill(new Rect(num3 - 12f, num4, 24f, 1f), c2); Fill(new Rect(num3, num4 - 12f, 1f, 24f), c2); } } private void DrawReadout(Director d) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) FreeCamRig freeCam = d.FreeCam; Vector3 position = freeCam.Position; Vector3 eulerAngles = freeCam.EulerAngles; string text = ((Time.timeScale <= 0f) ? "FROZEN" : $"{Time.timeScale:0.###}x"); if ((Object)(object)WorldFreeze.Instance != (Object)null && WorldFreeze.Instance.Active) { text += $" WORLD HELD ({WorldFreeze.Instance.FrozenCount})"; } string text2 = ((freeCam.Focus == FreeCamRig.ControlFocus.Camera) ? "driving CAMERA" : "driving CHARACTER (camera held)"); string text3 = ((d.Current.Count == 0) ? "shot empty" : ($"shot {d.Current.name} {d.Current.Count} keys {d.Current.duration:0.##}s" + (d.Playing ? $" PLAYING {d.PlayHead * 100f:0}%" : ""))); string text4 = "MACHINIMA TOOLS " + text2 + "\n" + $"pos {position.x,8:0.00} {position.y,8:0.00} {position.z,8:0.00}\n" + $"rot {eulerAngles.y,8:0.0}° yaw {eulerAngles.x,6:0.0}° pitch {eulerAngles.z,5:0.0}° roll\n" + $"lens {freeCam.FocalLength35mm:0}mm f/{Cfg.Aperture.Value:0.0} {freeCam.Fov:0.0}° fov" + ((d.Optics.Mode == Lens.FocusMode.Off) ? " dof off" : string.Format(" focus {0:0.#}m blur@{1:0}mm {2}", d.Optics.CurrentFocus, d.Optics.BlurFocalLength, d.Optics.Racking ? "RACKING" : d.Optics.Mode.ToString().ToLower())) + "\n" + $"speed {freeCam.Speed:0.##} m/s time {text}\n" + "rig " + freeCam.Mode.ToString().ToUpper() + "" + ((freeCam.Mode == FreeCamRig.RigMode.Mount) ? (" " + freeCam.BoneName + " / " + Cfg.MountFrame.Value.ToString().ToLower() + " frame") : "") + (freeCam.DollyZoom ? " DOLLY ZOOM" : "") + ((freeCam.Mode == FreeCamRig.RigMode.Orbit) ? $" {Cfg.OrbitRadius.Value:0.#}m {Cfg.OrbitSpeed.Value:0.#}°/s" : "") + ((freeCam.Mode == FreeCamRig.RigMode.Follow) ? $" {Cfg.FollowDistance.Value:0.#}m back {Cfg.FollowSide.Value:0.#}m side" : "") + "\naim " + (((Object)(object)freeCam.AimTarget != (Object)null) ? ("" + freeCam.AimTarget.GetDisplayName() + "") : "manual") + "\ntune " + Tuner.Selected.Label + " " + Tuner.Selected.Display + "\n" + string.Format("hud {0} matte {1} guide {2}\n", freeCam.ShowHud ? "on" : "off", MatteNames[_matte], _guide) + text3 + "\n" + $"[{Cfg.KeyToggleMenu.Value} panel]"; GUILayout.BeginArea(new Rect(14f, 14f, 500f, 196f), _box); GUILayout.Label(text4, _label, Array.Empty()); GUILayout.EndArea(); } private void Line(Vector2 a, Vector2 b, Color c, float width = 2f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003d: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector2 val = b - a; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude < 0.5f)) { float num = Mathf.Atan2(val.y, val.x) * 57.29578f; Matrix4x4 matrix = GUI.matrix; GUIUtility.RotateAroundPivot(num, a); Fill(new Rect(a.x, a.y - width * 0.5f, magnitude, width), c); GUI.matrix = matrix; } } private static bool ToScreen(Camera cam, Vector3 world, out Vector2 gui) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0015: 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_0026: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.WorldToScreenPoint(world); gui = new Vector2(val.x, (float)Screen.height - val.y); return val.z > 0f; } private void DrawKeyframes(Director d) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) Shot current = d.Current; if (current.Count == 0) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Color c = default(Color); ((Color)(ref c))..ctor(0.55f, 0.85f, 1f, 0.55f); Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.82f, 0.4f, 0.95f); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.45f, 0.4f, 0.95f); Color c2 = default(Color); ((Color)(ref c2))..ctor(0.6f, 1f, 0.65f, 0.95f); if (current.Playable) { int num = Mathf.Clamp(current.Count * 12, 24, 240); Vector2 a = default(Vector2); bool flag = false; int num2 = -1; for (int i = 0; i <= num; i++) { int section; Key key = current.Evaluate((float)i / (float)num, out section); Vector2 gui; bool num3 = ToScreen(main, key.pos, out gui); if (num3 && flag && section == num2) { Line(a, gui, c); } a = gui; flag = num3; num2 = section; } } for (int j = 0; j < current.Count; j++) { if (ToScreen(main, current.keys[j].pos, out var gui2)) { Fill(new Rect(gui2.x - 5f, gui2.y - 5f, 10f, 10f), (j > 0 && current.keys[j].cut) ? val2 : val); GUI.Label(new Rect(gui2.x + 7f, gui2.y - 9f, 60f, 18f), (j + 1).ToString(), _label); Quaternion val3 = Quaternion.Euler(current.keys[j].pitch, current.keys[j].yaw, 0f); if (ToScreen(main, current.keys[j].pos + val3 * Vector3.forward * 1.5f, out var gui3)) { Line(gui2, gui3, val, 1f); } } } if (d.Playing || d.PlayHead > 0f) { Key key2 = current.Evaluate(d.PlayHead); if (ToScreen(main, key2.pos, out var gui4)) { Fill(new Rect(gui4.x - 3f, gui4.y - 3f, 6f, 6f), c2); } } } private void DrawLights(Director d) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00af: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Lighting lights = d.Lights; if ((Object)(object)lights == (Object)null || lights.Lights.Count == 0) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } for (int i = 0; i < lights.Lights.Count; i++) { PlacedLight placedLight = lights.Lights[i]; if (!((Object)(object)placedLight.Go == (Object)null) && ToScreen(main, placedLight.Go.transform.position, out var gui)) { Color val = ((lights.Selected == i) ? new Color(1f, 0.95f, 0.5f, 1f) : new Color(1f, 0.9f, 0.5f, 0.55f)); if (!placedLight.On) { ((Color)(ref val))..ctor(0.6f, 0.6f, 0.6f, val.a); } Fill(new Rect(gui.x - 4f, gui.y - 4f, 8f, 8f), val); if ((int)placedLight.L.type == 0 && ToScreen(main, placedLight.Go.transform.position + placedLight.Go.transform.forward * 2f, out var gui2)) { Line(gui, gui2, val, 1f); } GUI.Label(new Rect(gui.x + 6f, gui.y - 9f, 40f, 18f), (((int)placedLight.L.type == 0) ? "S" : "P") + (i + 1), _label); } } } private void DrawToast(string msg) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(_label) { alignment = (TextAnchor)4, fontSize = 14 }; float num = 560f; float num2 = 30f; GUI.Label(new Rect(((float)Screen.width - num) * 0.5f, (float)(Screen.height - 90), num, num2), msg, val); } } public enum PadAxis { LeftStickX, LeftStickY, RightStickX, RightStickY, Triggers, DPadX, DPadY } public enum PadAxisAction { None, MoveX, MoveY, MoveZ, LookX, LookY, Fov, Roll } public enum PadButton { A, B, X, Y, LeftBumper, RightBumper, LeftStick, RightStick, Back } public enum PadAction { None, Fast, Slow, Up, Down, ToggleFocus, AddKeyframe, PlayShot, NextTarget, ReleaseTarget, RigMode, LevelRoll, FocusMode, RackFocus, Screenshot, Record, FreezeAll, FreezeWorld, Hud, DollyZoom, Panel, LightsToggle } internal static class Pad { private static IGamepadTemplate _pad; private static float _nextLookup; private static int _frame = -1; private static Vector3 _move; private static Vector2 _look; private static float _fov; private static float _roll; public static bool Connected { get { if (Cfg.PadEnabled.Value) { return Get() != null; } return false; } } public static bool Slow => Held(PadAction.Slow); private static IGamepadTemplate Get() { if (_pad != null) { return _pad; } if (Time.unscaledTime < _nextLookup) { return null; } _nextLookup = Time.unscaledTime + 1f; try { if (!ReInput.isReady) { return null; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); Player val = ((firstLocalUser != null) ? firstLocalUser.inputPlayer : null); IList list = ((val != null) ? val.controllers.Joysticks : ReInput.controllers.Joysticks); if (list == null) { return null; } foreach (Joystick item in list) { IGamepadTemplate val2 = ((item != null) ? ((Controller)item).GetTemplate() : null); if (val2 != null) { _pad = val2; Log.Info("Gamepad: " + ((Controller)item).name); break; } } } catch (Exception ex) { Log.Warn("Gamepad lookup failed: " + ex.Message); } return _pad; } public static void Drop() { _pad = null; } private static Vector2 Shape(Vector2 v) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) float value = Cfg.PadDeadzone.Value; float magnitude = ((Vector2)(ref v)).magnitude; if (magnitude <= value) { return Vector2.zero; } magnitude = Mathf.Min(1f, (magnitude - value) / (1f - value)); magnitude = Mathf.Pow(magnitude, Cfg.PadCurve.Value); return ((Vector2)(ref v)).normalized * magnitude; } private static void Sample() { //IL_0017: 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_0026: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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) if (_frame == Time.frameCount) { return; } _frame = Time.frameCount; _move = Vector3.zero; _look = Vector2.zero; _fov = 0f; _roll = 0f; IGamepadTemplate val = (Connected ? _pad : null); if (val == null) { return; } Vector2 val2 = Shape(val.leftStick.value); Vector2 val3 = Shape(val.rightStick.value); Vector2 value = val.dPad.value; float num = val.rightTrigger.value - val.leftTrigger.value; for (int i = 0; i < Cfg.PadAxisMap.Length; i++) { float num2 = (PadAxis)i switch { PadAxis.LeftStickX => val2.x, PadAxis.LeftStickY => val2.y, PadAxis.RightStickX => val3.x, PadAxis.RightStickY => val3.y, PadAxis.Triggers => num, PadAxis.DPadX => value.x, _ => value.y, }; if (num2 != 0f) { if (Cfg.PadAxisInvert[i].Value) { num2 = 0f - num2; } switch (Cfg.PadAxisMap[i].Value) { case PadAxisAction.MoveX: _move.x += num2; break; case PadAxisAction.MoveY: _move.y += num2; break; case PadAxisAction.MoveZ: _move.z += num2; break; case PadAxisAction.LookX: _look.x += num2; break; case PadAxisAction.LookY: _look.y += num2; break; case PadAxisAction.Fov: _fov += num2; break; case PadAxisAction.Roll: _roll += num2; break; } } } if (Held(PadAction.Up)) { _move.y += 1f; } if (Held(PadAction.Down)) { _move.y -= 1f; } } public static Vector3 Move() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Sample(); return _move; } public static Vector2 Look() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Sample(); return _look * (Cfg.PadLookSpeed.Value * Time.unscaledDeltaTime); } public static float Fov() { Sample(); return _fov; } public static float Roll() { Sample(); return _roll; } public static float SpeedMultiplier() { if (Held(PadAction.Fast)) { return Cfg.FastMultiplier.Value; } if (Held(PadAction.Slow)) { return Cfg.SlowMultiplier.Value; } return 1f; } private static IControllerTemplateButton Button(IGamepadTemplate p, PadButton b) { return (IControllerTemplateButton)(b switch { PadButton.A => p.a, PadButton.B => p.b, PadButton.X => p.x, PadButton.Y => p.y, PadButton.LeftBumper => p.leftBumper, PadButton.RightBumper => p.rightBumper, PadButton.LeftStick => p.leftStick.press, PadButton.RightStick => p.rightStick.press, _ => p.back, }); } public static bool Held(PadAction a) { IGamepadTemplate val = (Connected ? _pad : null); if (val == null) { return false; } for (int i = 0; i < Cfg.PadButtonMap.Length; i++) { if (Cfg.PadButtonMap[i].Value == a && Button(val, (PadButton)i).value) { return true; } } return false; } public static bool Pressed(PadButton b) { IGamepadTemplate val = (Connected ? _pad : null); if (val != null) { return Button(val, b).justPressed; } return false; } public static bool IsHeldAction(PadAction a) { if (a != PadAction.Fast && a != PadAction.Slow && a != PadAction.Up) { return a == PadAction.Down; } return true; } } [HarmonyPatch(typeof(PlayerCharacterMasterController), "Update")] internal static class MoveBasisPatch { private static void Postfix() { Director.Instance?.RelinkMovementToAim(); } } [BepInPlugin("com.gobo.machinimatools", "Machinima Tools", "1.0.0")] [BepInProcess("Risk of Rain 2.exe")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.gobo.machinimatools"; public const string Name = "Machinima Tools"; public const string Version = "1.0.0"; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); Cfg.Bind(((BaseUnityPlugin)this).Config); GameObject val = new GameObject("MachinimaTools.Director"); val.transform.SetParent(((Component)this).gameObject.transform); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent(); val.AddComponent(); val.AddComponent(); new Harmony("com.gobo.machinimatools").PatchAll(typeof(Plugin).Assembly); Log.Info(string.Format("{0} {1} loaded. {2} in a run.", "Machinima Tools", "1.0.0", Cfg.KeyToggleFreeCam.Value)); } } [Serializable] public class Key { public Vector3 pos; public float yaw; public float pitch; public float roll; public float fov; public float focus; public float aperture; public bool cut; } [Serializable] public class Shot { public string name = "untitled"; public float duration = 6f; public bool easeEnds = true; public bool loop; public bool closed; public List keys = new List(); public int Count => keys?.Count ?? 0; public bool Playable => Count >= 2; public bool HasCuts { get { for (int i = 1; i < keys.Count; i++) { if (keys[i].cut) { return true; } } return false; } } public static string ShotsDirectory { get { string text = Path.Combine(Paths.ConfigPath, "MachinimaTools", "shots"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } return text; } } public void Add(Key k) { keys.Add(k); UnwrapAngles(); } public void RemoveLast() { if (Count > 0) { keys.RemoveAt(keys.Count - 1); } } public void UnwrapAngles() { for (int i = 1; i < keys.Count; i++) { keys[i].yaw = Unwrap(keys[i - 1].yaw, keys[i].yaw); keys[i].pitch = Unwrap(keys[i - 1].pitch, keys[i].pitch); keys[i].roll = Unwrap(keys[i - 1].roll, keys[i].roll); } } private static float Unwrap(float prev, float next) { while (next - prev > 180f) { next -= 360f; } while (next - prev < -180f) { next += 360f; } return next; } private int SectionEnd(int key) { int i; for (i = key; i + 1 < keys.Count && !keys[i + 1].cut; i++) { } return i; } private static int Segments(int start, int end) { return Mathf.Max(1, end - start); } private int TotalSegments() { if (closed && !HasCuts) { return Count; } int num = 0; for (int num2 = 0; num2 < Count; num2 = SectionEnd(num2) + 1) { num += Segments(num2, SectionEnd(num2)); } return num; } public float KeyTime(int i) { if (Count < 2) { return 0f; } float num = TotalSegments(); if (closed && !HasCuts) { return (float)i / num; } int num2 = 0; int num3 = 0; while (num3 < Count) { int num4 = SectionEnd(num3); if (i <= num4) { return (float)(num2 + ((num4 > num3) ? (i - num3) : 0)) / num; } num2 += Segments(num3, num4); num3 = num4 + 1; } return 1f; } public Key Evaluate(float t) { int section; return Evaluate(t, out section); } public Key Evaluate(float t, out int section) { section = 0; if (Count == 0) { return new Key(); } if (Count == 1) { return keys[0]; } t = (loop ? Mathf.Repeat(t, 1f) : Mathf.Clamp01(t)); if (closed && !HasCuts) { float num = t * (float)Count; int num2 = Mathf.Min(Mathf.FloorToInt(num), Count - 1); return Blend(keys[(num2 - 1 + Count) % Count], keys[num2], keys[(num2 + 1) % Count], keys[(num2 + 2) % Count], num - (float)num2); } float num3 = t * (float)TotalSegments(); int num4 = 0; int num5 = 0; while (num5 < Count) { int num6 = SectionEnd(num5); int num7 = Segments(num5, num6); bool flag = num6 == Count - 1; if (num3 > (float)(num4 + num7) && !flag) { num4 += num7; num5 = num6 + 1; section++; continue; } if (num6 == num5) { return keys[num5]; } float num8 = Mathf.Clamp(num3 - (float)num4, 0f, (float)num7); if (easeEnds) { float num9 = num8 / (float)num7; num8 = num9 * num9 * (3f - 2f * num9) * (float)num7; } int num10 = Mathf.Min(Mathf.FloorToInt(num8), num7 - 1); float u = num8 - (float)num10; return Blend(keys[Mathf.Max(num5, num5 + num10 - 1)], keys[num5 + num10], keys[num5 + num10 + 1], keys[Mathf.Min(num6, num5 + num10 + 2)], u); } return keys[Count - 1]; } private static Key Blend(Key p0, Key p1, Key p2, Key p3, float u) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) return new Key { pos = CatmullRom(p0.pos, p1.pos, p2.pos, p3.pos, u), yaw = CatmullRom(Near(p1.yaw, p0.yaw), p1.yaw, Near(p1.yaw, p2.yaw), Near(p1.yaw, p3.yaw), u), pitch = CatmullRom(Near(p1.pitch, p0.pitch), p1.pitch, Near(p1.pitch, p2.pitch), Near(p1.pitch, p3.pitch), u), roll = CatmullRom(Near(p1.roll, p0.roll), p1.roll, Near(p1.roll, p2.roll), Near(p1.roll, p3.roll), u), fov = CatmullRom(p0.fov, p1.fov, p2.fov, p3.fov, u), focus = ((p1.focus > 0f && p2.focus > 0f) ? Mathf.Lerp(p1.focus, p2.focus, u * u * (3f - 2f * u)) : 0f), aperture = ((p1.aperture > 0f && p2.aperture > 0f) ? Mathf.Lerp(p1.aperture, p2.aperture, u) : 0f) }; } private static float Near(float reference, float a) { while (a - reference > 180f) { a -= 360f; } while (a - reference < -180f) { a += 360f; } return a; } private static float CatmullRom(float a, float b, float c, float d, float u) { float num = u * u; float num2 = num * u; return 0.5f * (2f * b + (0f - a + c) * u + (2f * a - 5f * b + 4f * c - d) * num + (0f - a + 3f * b - 3f * c + d) * num2); } private static Vector3 CatmullRom(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float u) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003e: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) return new Vector3(CatmullRom(a.x, b.x, c.x, d.x, u), CatmullRom(a.y, b.y, c.y, d.y, u), CatmullRom(a.z, b.z, c.z, d.z, u)); } public string Save() { string text = string.Join("_", name.Split(Path.GetInvalidFileNameChars())); if (string.IsNullOrEmpty(text)) { text = "untitled"; } string text2 = Path.Combine(ShotsDirectory, text + ".json"); File.WriteAllText(text2, JsonUtility.ToJson((object)this, true)); return text2; } public static List List() { List list = new List(); string[] files = Directory.GetFiles(ShotsDirectory, "*.json"); foreach (string item in files) { list.Add(item); } list.Sort(); return list; } public static Shot Load(string path) { Shot shot = JsonUtility.FromJson(File.ReadAllText(path)); if (shot?.keys == null) { return null; } shot.UnwrapAngles(); return shot; } } internal class Tunable { public string Label; public string Category; public float Min; public float Max; public float Coarse; public float Fine; public Func Get; public Action Set; public string Format = "0.###"; public string Suffix = ""; public float? Default; public string Display => Get().ToString(Format) + Suffix; public void Nudge(float direction, bool fine) { float num = (fine ? Fine : Coarse) * direction; Set(Mathf.Clamp(Get() + num, Min, Max)); } } internal static class Tuner { private static List _params; private static int _index; private static FreeCamRig Cam { get { Director instance = Director.Instance; if (!((Object)(object)instance == (Object)null)) { return instance.FreeCam; } return null; } } private static PlacedLight L { get { if (!((Object)(object)Lighting.Instance == (Object)null)) { return Lighting.Instance.Current; } return null; } } public static Tunable Selected => All[Mathf.Clamp(_index, 0, All.Count - 1)]; public static List All { get { if (_params != null) { return _params; } _params = new List { Make("Track damping", Cfg.AimDamping, 0f, 2f, 0.05f, 0.01f, "s", "Track"), Make("Track lead", Cfg.AimLead, 0f, 2f, 0.05f, 0.01f, "s", "Track"), Make("Track headroom", Cfg.AimHeadroom, -5f, 10f, 0.25f, 0.05f, "m", "Track"), Make("Track deadzone", Cfg.AimDeadzone, 0f, 20f, 0.5f, 0.1f, "°", "Track"), Make("Focal length", () => (!((Object)(object)Cam == (Object)null)) ? Lens.FovToFocal(Cam.Fov) : 50f, delegate(float v) { Cam?.SetFocalLength(v); }, 8f, 400f, 2f, 0.5f, "mm", "Lens"), Make("DoF blur focal", Cfg.DofFocalLength, 1f, 300f, 5f, 1f, "mm", "Lens"), Make("Aperture", Cfg.Aperture, 0.5f, 32f, 0.2f, 0.05f, " f", "Lens"), Make("Focus distance", Cfg.FocusDistance, 0.1f, 500f, 0.5f, 0.1f, "m", "Lens"), Make("Focus damping", Cfg.FocusDamping, 0f, 3f, 0.02f, 0.005f, "s", "Lens"), Make("Rack duration", Cfg.RackDuration, 0.05f, 10f, 0.1f, 0.02f, "s", "Lens"), Make("Shutter angle", Cfg.ShutterAngle, 0f, 360f, 5f, 1f, "°", "Lens"), Make("Shake position", Cfg.ShakePosition, 0f, 1f, 0.005f, 0.001f, "m", "Rig"), Make("Shake rotation", Cfg.ShakeRotation, 0f, 20f, 0.1f, 0.02f, "°", "Rig"), Make("Shake frequency", Cfg.ShakeFrequency, 0.05f, 12f, 0.1f, 0.02f, "", "Rig"), Make("Mount offset X", Cfg.MountOffsetX, -10f, 10f, 0.02f, 0.005f, "m", "Mount"), Make("Mount offset Y", Cfg.MountOffsetY, -10f, 10f, 0.02f, 0.005f, "m", "Mount"), Make("Mount offset Z", Cfg.MountOffsetZ, -10f, 10f, 0.02f, 0.005f, "m", "Mount"), Make("Mount pitch", Cfg.MountPitch, -180f, 180f, 1f, 0.2f, "°", "Mount"), Make("Mount yaw", Cfg.MountYaw, -180f, 180f, 1f, 0.2f, "°", "Mount"), Make("Mount pos damping", Cfg.MountDamping, 0f, 1f, 0.01f, 0.002f, "s", "Mount"), Make("Mount rot damping", Cfg.MountRotDamping, 0f, 1f, 0.01f, 0.002f, "s", "Mount"), Make("Rig damping", Cfg.RigDamping, 0f, 3f, 0.05f, 0.01f, "s", "Rig"), Make("Orbit speed", Cfg.OrbitSpeed, -180f, 180f, 2f, 0.5f, "°/s", "Rig"), Make("Orbit radius", Cfg.OrbitRadius, 0.5f, 300f, 0.5f, 0.1f, "m", "Rig"), Make("Orbit height", Cfg.OrbitHeight, -50f, 100f, 0.25f, 0.05f, "m", "Rig"), Make("Follow distance", Cfg.FollowDistance, 0.5f, 200f, 0.5f, 0.1f, "m", "Rig"), Make("Follow height", Cfg.FollowHeight, -50f, 100f, 0.25f, 0.05f, "m", "Rig"), Make("Follow side", Cfg.FollowSide, -100f, 100f, 0.25f, 0.05f, "m", "Rig"), Make("Light intensity", () => (L != null) ? L.Intensity : 0f, delegate(float v) { if (L != null) { L.Intensity = v; } }, 0f, 60f, 0.5f, 0.1f, "", "Light", 6f), Make("Light range", () => (L != null) ? L.L.range : 0f, delegate(float v) { if (L != null) { L.L.range = v; } }, 1f, 200f, 1f, 0.25f, "m", "Light", 25f), Make("Light cone", () => (L != null) ? L.L.spotAngle : 0f, delegate(float v) { if (L != null) { L.L.spotAngle = v; } }, 5f, 170f, 2f, 0.5f, "°", "Light", 45f), Make("Light kelvin", () => (L != null) ? L.Kelvin : 5500f, delegate(float v) { if (L != null) { L.Kelvin = v; Lighting.Instance.ApplyColor(L); } }, 1500f, 12000f, 100f, 25f, "K", "Light", 5500f), Make("Light hue", () => (L != null) ? L.Hue : 0f, delegate(float v) { if (L != null) { L.Hue = v; Lighting.Instance.ApplyColor(L); } }, 0f, 1f, 0.02f, 0.005f, "", "Light", 0f), Make("Light tint", () => (L != null) ? L.Sat : 0f, delegate(float v) { if (L != null) { L.Sat = v; Lighting.Instance.ApplyColor(L); } }, 0f, 1f, 0.05f, 0.01f, "", "Light", 0f), Make("Light fade", Cfg.LightFade, 0f, 10f, 0.1f, 0.02f, "s", "Lights"), Make("Sun intensity", Cfg.SunIntensity, 0f, 8f, 0.1f, 0.02f, "", "Sun"), Make("Sun kelvin", Cfg.SunKelvin, 1500f, 12000f, 100f, 25f, "K", "Sun"), Make("Sun hue", Cfg.SunHue, 0f, 1f, 0.02f, 0.005f, "", "Sun"), Make("Sun tint", Cfg.SunSat, 0f, 1f, 0.05f, 0.01f, "", "Sun"), Make("Sun pitch", Cfg.SunPitch, -10f, 90f, 1f, 0.25f, "°", "Sun"), Make("Sun yaw", Cfg.SunYaw, 0f, 360f, 2f, 0.5f, "°", "Sun"), Make("Ambient intensity", Cfg.AmbientIntensity, 0f, 4f, 0.05f, 0.01f, "", "Ambient"), Make("Ambient kelvin", Cfg.AmbientKelvin, 1500f, 12000f, 100f, 25f, "K", "Ambient"), Make("Ambient hue", Cfg.AmbientHue, 0f, 1f, 0.02f, 0.005f, "", "Ambient"), Make("Ambient tint", Cfg.AmbientSat, 0f, 1f, 0.05f, 0.01f, "", "Ambient"), Make("Temperature", Cfg.GradeTemp, -100f, 100f, 2f, 0.5f, "", "Grade"), Make("Tint", Cfg.GradeTint, -100f, 100f, 2f, 0.5f, "", "Grade"), Make("Saturation", Cfg.GradeSat, -100f, 100f, 2f, 0.5f, "", "Grade"), Make("Contrast", Cfg.GradeContrast, -100f, 100f, 2f, 0.5f, "", "Grade"), Make("Exposure", Cfg.GradeExposure, -4f, 4f, 0.1f, 0.02f, " ev", "Grade"), Make("Hue shift", Cfg.GradeHue, -180f, 180f, 2f, 0.5f, "°", "Grade"), Make("Vignette", Cfg.FxVignette, 0f, 1f, 0.02f, 0.005f, "", "Fx"), Make("Grain", Cfg.FxGrain, 0f, 1f, 0.02f, 0.005f, "", "Fx"), Make("Aberration", Cfg.FxAberration, 0f, 1f, 0.02f, 0.005f, "", "Fx"), Make("Fog amount", Cfg.FogIntensity, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Fog falloff", Cfg.FogPower, 0.1f, 4f, 0.05f, 0.01f, "", "Fog"), Make("Fog near", Cfg.FogNear, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Fog far", Cfg.FogFar, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Ground fog", Cfg.FogHeight, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Fog hue", Cfg.FogHue, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Fog saturation", Cfg.FogSat, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Fog brightness", Cfg.FogValue, 0f, 1f, 0.02f, 0.005f, "", "Fog"), Make("Rain intensity", Cfg.RainIntensity, 0f, 1f, 0.02f, 0.005f, "", "Weather"), Make("Rain density", Cfg.RainDensity, 0f, 1f, 0.02f, 0.005f, "", "Weather"), Make("Particle amount", Cfg.WeatherAmount, 0.05f, 5f, 0.1f, 0.02f, "x", "Weather"), Make("Wind", Cfg.WeatherWind, -15f, 15f, 0.5f, 0.1f, " m/s", "Weather"), Make("Pad look speed", Cfg.PadLookSpeed, 10f, 720f, 10f, 2f, "°/s", "Pad"), Make("Pad deadzone", Cfg.PadDeadzone, 0f, 0.6f, 0.02f, 0.005f, "", "Pad"), Make("Pad curve", Cfg.PadCurve, 0.5f, 4f, 0.1f, 0.02f, "", "Pad"), Make("Look sensitivity", Cfg.LookSensitivity, 0.1f, 10f, 0.1f, 0.02f, ""), Make("Look smoothing", Cfg.LookSmoothing, 0f, 2f, 0.05f, 0.01f, "s"), Make("Move smoothing", Cfg.MoveSmoothing, 0f, 1f, 0.02f, 0.005f, "s"), Make("Blend in/out", Cfg.TransitionDuration, 0f, 5f, 0.05f, 0.01f, "s") }; return _params; } } private static Tunable Make(string label, Func get, Action set, float min, float max, float coarse, float fine, string suffix, string category = "Camera", float? def = null) { return new Tunable { Label = label, Category = category, Get = get, Set = set, Min = min, Max = max, Coarse = coarse, Fine = fine, Suffix = suffix, Default = def }; } private static Tunable Make(string label, ConfigEntry e, float min, float max, float coarse, float fine, string suffix, string category = "Camera") { return Make(label, () => e.Value, delegate(float v) { e.Value = v; }, min, max, coarse, fine, suffix, category, (float)((ConfigEntryBase)e).DefaultValue); } public static bool HasDefaults(string category) { foreach (Tunable item in All) { if (item.Category == category && item.Default.HasValue) { return true; } } return false; } public static void ResetCategory(string category) { foreach (Tunable item in All) { if (item.Category == category && item.Default.HasValue) { item.Set(item.Default.Value); } } } public static void Cycle(int direction) { int count = All.Count; _index = ((_index + direction) % count + count) % count; } } internal class Weather : MonoBehaviour { public enum Kind { None, Rain, Snow, Dust, Embers, Ash } private GameObject _go; private ParticleSystem _ps; private Material _mat; private static readonly string[] ShaderNames = new string[4] { "Particles/Standard Unlit", "Legacy Shaders/Particles/Alpha Blended", "Sprites/Default", "UI/Default" }; public Kind Current { get; private set; } private void OnDestroy() { Stop(); } public string Set(Kind k) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown if (k == Current) { return Current.ToString(); } Stop(); if (k == Kind.None) { return "Weather off"; } if ((Object)(object)_mat == (Object)null) { _mat = MakeMaterial(); } if ((Object)(object)_mat == (Object)null) { return "No particle shader available"; } _go = new GameObject("MachinimaTools.Weather"); _ps = _go.AddComponent(); ((Renderer)_go.GetComponent()).material = _mat; Configure(k); Current = k; return k.ToString(); } public void Stop() { if ((Object)(object)_go != (Object)null) { Object.Destroy((Object)(object)_go); } _go = null; _ps = null; Current = Kind.None; } public void Tick(FreeCamRig cam) { //IL_0039: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_ps == (Object)null) { if (Current != Kind.None) { Kind current = Current; Current = Kind.None; Set(current); } } else { _go.transform.position = cam.Position + Vector3.up * 12f; EmissionModule emission = _ps.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(BaseRate(Current) * Cfg.WeatherAmount.Value); VelocityOverLifetimeModule velocityOverLifetime = _ps.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1; float value = Cfg.WeatherWind.Value; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(value * 0.7f, value * 1.3f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(value * 0.2f, value * 0.5f); } } private static float BaseRate(Kind k) { return k switch { Kind.Rain => 1600f, Kind.Snow => 900f, Kind.Dust => 250f, Kind.Embers => 120f, Kind.Ash => 300f, _ => 0f, }; } private void Configure(Kind k) { //IL_0006: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00b6: 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_010e: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: 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_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) MainModule main = _ps.main; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 6000; ((MainModule)(ref main)).playOnAwake = true; ((MainModule)(ref main)).loop = true; ShapeModule shape = _ps.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).scale = new Vector3(50f, 2f, 50f); ColorOverLifetimeModule colorOverLifetime = _ps.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val = new Gradient(); SizeOverLifetimeModule sizeOverLifetime = _ps.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = false; NoiseModule noise = _ps.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).frequency = 0.25f; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.6f); ((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.3f); ParticleSystemRenderer component = _go.GetComponent(); component.renderMode = (ParticleSystemRenderMode)0; switch (k) { case Kind.Rain: ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(2.5f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.015f, 0.03f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(3f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.75f, 0.85f, 1f)); ((ShapeModule)(ref shape)).scale = new Vector3(40f, 1f, 40f); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.45f, 0.1f), new GradientAlphaKey(0.45f, 0.9f), new GradientAlphaKey(0f, 1f) }); ((NoiseModule)(ref noise)).enabled = false; component.renderMode = (ParticleSystemRenderMode)1; component.lengthScale = 0f; component.velocityScale = 0.04f; break; case Kind.Snow: ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(9f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.12f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.06f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.white); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.9f, 0.1f), new GradientAlphaKey(0.9f, 0.85f), new GradientAlphaKey(0f, 1f) }); ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(1.2f); break; case Kind.Dust: ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(14f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.02f, 0.05f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(1f, 0.95f, 0.8f)); ((ShapeModule)(ref shape)).scale = new Vector3(30f, 14f, 30f); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.5f, 0.2f), new GradientAlphaKey(0.5f, 0.8f), new GradientAlphaKey(0f, 1f) }); ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.4f); break; case Kind.Embers: ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(6f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.03f, 0.08f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(1f, 0.55f, 0.15f)); ((ShapeModule)(ref shape)).scale = new Vector3(40f, 8f, 40f); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(1f, 0.8f, 0.3f), 0f), new GradientColorKey(new Color(1f, 0.3f, 0.05f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.1f), new GradientAlphaKey(0f, 1f) }); ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(1.5f); ((NoiseModule)(ref noise)).frequency = 0.5f; break; case Kind.Ash: ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(12f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.04f, 0.1f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.02f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.35f, 0.33f, 0.3f)); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.8f, 0.15f), new GradientAlphaKey(0f, 1f) }); ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(1f); break; } ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val); _go.transform.position = Vector3.zero; _ps.Play(); } private static Material MakeMaterial() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown Shader val = null; Shader[] array = Resources.FindObjectsOfTypeAll(); string[] shaderNames = ShaderNames; foreach (string text in shaderNames) { Shader[] array2 = array; foreach (Shader val2 in array2) { if (((Object)val2).name == text) { val = val2; break; } } if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { shaderNames = ShaderNames; foreach (string text2 in shaderNames) { try { val = Shader.Find(text2); } catch { val = null; } if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val == (Object)null) { ParticleSystemRenderer[] array3 = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array3.Length; i++) { Material sharedMaterial = ((Renderer)array3[i]).sharedMaterial; if ((Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial.shader != (Object)null && (Object)(object)sharedMaterial.mainTexture == (Object)null) { return new Material(sharedMaterial); } } Log.Warn("No particle shader found, weather is off"); return null; } return new Material(val) { mainTexture = (Texture)(object)Dot() }; } private static Texture2D Dot() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { float num = ((float)j + 0.5f) / 16f - 0.5f; float num2 = ((float)i + 0.5f) / 16f - 0.5f; float num3 = Mathf.Clamp01(1f - Mathf.Sqrt(num * num + num2 * num2) * 2.2f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num3 * num3)); } } val.Apply(); return val; } } internal class WorldFreeze : MonoBehaviour { private CharacterBody _exempt; private float _rescanAt; private readonly HashSet _seen = new HashSet(); private readonly List _comps = new List(); private readonly List _animators = new List(); private readonly List _animSpeeds = new List(); private readonly List _bodies = new List(); private readonly List _vel = new List(); private readonly List _angVel = new List(); private readonly List _motors = new List(); private readonly List _particles = new List(); public static WorldFreeze Instance { get; private set; } public bool Active { get; private set; } public int FrozenCount { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if (Active) { Thaw(); } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public string Toggle(CharacterBody exempt) { if (Active) { return Thaw(); } _exempt = exempt; Active = true; Scan(); return $"World frozen, {FrozenCount} objects. You still move."; } public string Thaw() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _comps.Count; i++) { if ((Object)(object)_comps[i] != (Object)null) { _comps[i].enabled = true; } } for (int j = 0; j < _animators.Count; j++) { if ((Object)(object)_animators[j] != (Object)null) { _animators[j].speed = _animSpeeds[j]; } } for (int k = 0; k < _bodies.Count; k++) { Rigidbody val = _bodies[k]; if (!((Object)(object)val == (Object)null)) { val.isKinematic = false; val.velocity = _vel[k]; val.angularVelocity = _angVel[k]; } } for (int l = 0; l < _particles.Count; l++) { if ((Object)(object)_particles[l] != (Object)null) { _particles[l].Play(false); } } _comps.Clear(); _animators.Clear(); _animSpeeds.Clear(); _bodies.Clear(); _vel.Clear(); _angVel.Clear(); _motors.Clear(); _particles.Clear(); _seen.Clear(); Active = false; FrozenCount = 0; return "World running"; } private void Update() { //IL_002d: 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) if (!Active) { return; } for (int i = 0; i < _motors.Count; i++) { if ((Object)(object)_motors[i] != (Object)null) { _motors[i].velocity = Vector3.zero; } } if (Time.unscaledTime >= _rescanAt) { _rescanAt = Time.unscaledTime + 0.5f; Scan(); } } private void Scan() { ReadOnlyCollection readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)_exempt) && _seen.Add(((Object)val).GetInstanceID())) { FreezeBody(val); } } foreach (ProjectileController instances in InstanceTracker.GetInstancesList()) { if (_seen.Add(((Object)instances).GetInstanceID())) { FreezeProjectile(((Component)instances).gameObject); } } FrozenCount = _seen.Count; } private void FreezeBody(CharacterBody b) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine[] components = ((Component)b).GetComponents(); foreach (EntityStateMachine b2 in components) { Off((Behaviour)(object)b2); } CharacterMaster master = b.master; if ((Object)(object)master != (Object)null) { BaseAI[] components2 = ((Component)master).GetComponents(); foreach (BaseAI b3 in components2) { Off((Behaviour)(object)b3); } } CharacterMotor characterMotor = b.characterMotor; if ((Object)(object)characterMotor != (Object)null) { characterMotor.velocity = Vector3.zero; _motors.Add(characterMotor); Off((Behaviour)(object)characterMotor); } if ((Object)(object)b.characterDirection != (Object)null) { Off((Behaviour)(object)b.characterDirection); } Rigidbody component = ((Component)b).GetComponent(); if ((Object)(object)component != (Object)null) { Freeze(component); } ModelLocator modelLocator = b.modelLocator; Transform val = (((Object)(object)modelLocator == (Object)null) ? null : modelLocator.modelTransform); if ((Object)(object)val != (Object)null) { FreezeVisuals(val); } } private void FreezeProjectile(GameObject go) { Rigidbody component = go.GetComponent(); if ((Object)(object)component != (Object)null) { Freeze(component); } ProjectileSimple component2 = go.GetComponent(); if ((Object)(object)component2 != (Object)null) { Off((Behaviour)(object)component2); } ProjectileSteerTowardTarget component3 = go.GetComponent(); if ((Object)(object)component3 != (Object)null) { Off((Behaviour)(object)component3); } FreezeVisuals(go.transform); } private void FreezeVisuals(Transform root) { Animator[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Animator val in componentsInChildren) { _animators.Add(val); _animSpeeds.Add(val.speed); val.speed = 0f; } if (!Cfg.FreezeParticles.Value) { return; } ParticleSystem[] componentsInChildren2 = ((Component)root).GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren2) { if (val2.isPlaying) { _particles.Add(val2); val2.Pause(false); } } } private void Freeze(Rigidbody rb) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) if (!rb.isKinematic) { _bodies.Add(rb); _vel.Add(rb.velocity); _angVel.Add(rb.angularVelocity); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = true; } } private void Off(Behaviour b) { if (!((Object)(object)b == (Object)null) && b.enabled) { _comps.Add(b); b.enabled = false; } } } }