using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityStandardAssets.ImageEffects; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CameraAdditions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CameraAdditions")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c6fd29f0-a888-4b3b-8107-2a1bde68b381")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CameraAdditions { [BepInPlugin("Distance.CameraAdditions", "Camera Additions", "1.3.0")] public sealed class Mod : BaseUnityPlugin { private const string modGUID = "Distance.CameraAdditions"; private const string modName = "Camera Additions"; private const string modVersion = "1.3.0"; public static string DecreaseFOVShortcutKey = "The Decrease FOV Shortcut"; public static string DecreaseXShortcutKey = "The Decrease X Offset Shortcut"; public static string DecreaseYShortcutKey = "The Decrease Y Offset Shortcut"; public static string DecreaseZShortcutKey = "The Decrease Z or Zoom Offset Shortcut"; public static string DefaultShortcutKey = "The Shortcut that sets all values to their Defaults"; public static string EnableFreeCamKey = "Enable Free Cam"; public static string EnableRotationShortcutKey = "The Shortcut that toggles whether the offset shortcuts affect rotation"; public static string FOVKey = "Locked FOV Value"; public static string FOVOffsetKey = "FOV Offset"; public static string IncreaseFOVShortcutKey = "The Increase FOV Shortcut"; public static string IncreaseXShortcutKey = "The Increase X Offset Shortcut"; public static string IncreaseYShortcutKey = "The Increase Y Offset Shortcut"; public static string IncreaseZShortcutKey = "The Increase Z or Zoom Offset Shortcut"; public static string LockPositionKey = "Lock the Cameras Position"; public static string LockFOVKey = "Lock the Cameras FOV"; public static string XOffsetKey = "Offset of X axis Position"; public static string XRotationOffsetKey = "Offset of X axis Rotation"; public static string YOffsetKey = "Offset of Y axis Position"; public static string YRotationOffsetKey = "Offset of Y axis Rotation"; public static string ZoomOffsetKey = "Offset of Z axis Position"; public static string ZRotationOffsetKey = "Offset of Z axis Rotation"; private bool defaultWasFired; private bool rotationWasFired; private bool shortcutsAffectRotation; private static readonly Harmony harmony = new Harmony("Distance.CameraAdditions"); public static ManualLogSource Log = new ManualLogSource("Camera Additions"); public static Mod Instance; public static ConfigEntry EnableFreeCam { get; set; } public static ConfigEntry LockCameraPosition { get; set; } public static ConfigEntry LockFOV { get; set; } public static ConfigEntry CameraCollision { get; set; } public static ConfigEntry DrawDistance { get; set; } public static ConfigEntry XOffset { get; set; } public static ConfigEntry XRotationOffset { get; set; } public static ConfigEntry YOffset { get; set; } public static ConfigEntry YRotationOffset { get; set; } public static ConfigEntry ZoomOffset { get; set; } public static ConfigEntry ZRotationOffset { get; set; } public static ConfigEntry FOV { get; set; } public static ConfigEntry FOVOffset { get; set; } public static ConfigEntry DecreaseFOVShortcut { get; set; } public static ConfigEntry DecreaseXOffsetShortcut { get; set; } public static ConfigEntry DecreaseYOffsetShortcut { get; set; } public static ConfigEntry DecreaseZOffsetShortcut { get; set; } public static ConfigEntry DefaultsShortcut { get; set; } public static ConfigEntry EnableRotationShortcut { get; set; } public static ConfigEntry IncreaseFOVShortcut { get; set; } public static ConfigEntry IncreaseXOffsetShortcut { get; set; } public static ConfigEntry IncreaseYOffsetShortcut { get; set; } public static ConfigEntry IncreaseZOffsetShortcut { get; set; } public bool isGraphicsMenuOpen { get; set; } public float maxDistanceLowSpeed { get; private set; } public float maxDistanceHighSpeed { get; private set; } public float minDistance { get; private set; } public float height { get; private set; } public float yOffset { get; } public float xOffset { get; } private void Awake() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Expected O, but got Unknown //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Expected O, but got Unknown //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Expected O, but got Unknown //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Expected O, but got Unknown //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Expected O, but got Unknown //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = Logger.CreateLogSource("Distance.CameraAdditions"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Thanks for using Camera Additions!"); maxDistanceLowSpeed = 4.5f; maxDistanceHighSpeed = 3.25f; minDistance = 4f; height = 1.3f; EnableFreeCam = ((BaseUnityPlugin)this).Config.Bind("General", EnableFreeCamKey, false, new ConfigDescription("Make Free Cam an available camera while playing (Will not apply until outside gameplay)", (AcceptableValueBase)null, new object[0])); LockCameraPosition = ((BaseUnityPlugin)this).Config.Bind("General", LockPositionKey, false, new ConfigDescription("Lock the cameras position when in Chase Cam mode", (AcceptableValueBase)null, new object[0])); FOVOffset = ((BaseUnityPlugin)this).Config.Bind("General", FOVOffsetKey, 0, new ConfigDescription("Adjust the offset of the FOV (Affects all cameras)", (AcceptableValueBase)null, new object[0])); LockFOV = ((BaseUnityPlugin)this).Config.Bind("General", LockFOVKey, false, new ConfigDescription("Lock the FOV of Chase Cam mode", (AcceptableValueBase)null, new object[0])); FOV = ((BaseUnityPlugin)this).Config.Bind("General", FOVKey, 125, new ConfigDescription("Adjust the FOV of Chase Cam mode (Affective only when LOCK FOV is toggled on)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 180), new object[0])); CameraCollision = ((BaseUnityPlugin)this).Config.Bind("General", "Camera Collision", true, new ConfigDescription("Toggle the camera's collision detection in Chase Camera Mode", (AcceptableValueBase)null, new object[0])); DrawDistance = ((BaseUnityPlugin)this).Config.Bind("General", "Draw Distance", 1f, new ConfigDescription("Directly control the Draw Distance value. \nNear = .67 | Medium = 1 | Far = 1.5", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 7.5f), new object[0])); XOffset = ((BaseUnityPlugin)this).Config.Bind("Position Offsets", XOffsetKey, 0f, new ConfigDescription("Adjust the X axis offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0])); YOffset = ((BaseUnityPlugin)this).Config.Bind("Position Offsets", YOffsetKey, 0f, new ConfigDescription("Adjust the Y axis offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0])); ZoomOffset = ((BaseUnityPlugin)this).Config.Bind("Position Offsets", ZoomOffsetKey, 0f, new ConfigDescription("Adjust the Z axis offset of all Car Camera Modes (For the Chase Camera it affects the Zoom, not the Z axis)", (AcceptableValueBase)null, new object[0])); XRotationOffset = ((BaseUnityPlugin)this).Config.Bind("Rotation Offsets", XRotationOffsetKey, 0f, new ConfigDescription("Adjust the X rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0])); YRotationOffset = ((BaseUnityPlugin)this).Config.Bind("Rotation Offsets", YRotationOffsetKey, 0f, new ConfigDescription("Adjust the Y rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0])); ZRotationOffset = ((BaseUnityPlugin)this).Config.Bind("Rotation Offsets", ZRotationOffsetKey, 0f, new ConfigDescription("Adjust the Z rotational offset of all Car Camera Modes", (AcceptableValueBase)null, new object[0])); DefaultsShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", DefaultShortcutKey, new KeyboardShortcut((KeyCode)261, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut for setting all values to default", (AcceptableValueBase)null, new object[0])); EnableRotationShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", EnableRotationShortcutKey, new KeyboardShortcut((KeyCode)256, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut toggling if the offset shortcuts affect rotation", (AcceptableValueBase)null, new object[0])); IncreaseFOVShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", IncreaseFOVShortcutKey, new KeyboardShortcut((KeyCode)265, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut for increasing the FOV value", (AcceptableValueBase)null, new object[0])); DecreaseFOVShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", DecreaseFOVShortcutKey, new KeyboardShortcut((KeyCode)263, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut for decreasing the FOV value", (AcceptableValueBase)null, new object[0])); IncreaseXOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", IncreaseXShortcutKey, new KeyboardShortcut((KeyCode)262, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut increasing the X Offset", (AcceptableValueBase)null, new object[0])); DecreaseXOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", DecreaseXShortcutKey, new KeyboardShortcut((KeyCode)260, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut decreasing the X Offset", (AcceptableValueBase)null, new object[0])); IncreaseYOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", IncreaseYShortcutKey, new KeyboardShortcut((KeyCode)264, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut increasing the Y Offset", (AcceptableValueBase)null, new object[0])); DecreaseYOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", DecreaseYShortcutKey, new KeyboardShortcut((KeyCode)258, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut decreasing the Y Offset", (AcceptableValueBase)null, new object[0])); IncreaseZOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", IncreaseZShortcutKey, new KeyboardShortcut((KeyCode)259, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut increasing the Z Offset", (AcceptableValueBase)null, new object[0])); DecreaseZOffsetShortcut = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", DecreaseZShortcutKey, new KeyboardShortcut((KeyCode)257, (KeyCode[])(object)new KeyCode[0]), new ConfigDescription("Set the shortcut decreasing the Z Offset", (AcceptableValueBase)null, new object[0])); DecreaseFOVShortcut.SettingChanged += OnConfigChanged; DecreaseXOffsetShortcut.SettingChanged += OnConfigChanged; DecreaseYOffsetShortcut.SettingChanged += OnConfigChanged; DecreaseZOffsetShortcut.SettingChanged += OnConfigChanged; DefaultsShortcut.SettingChanged += OnConfigChanged; EnableFreeCam.SettingChanged += OnConfigChanged; EnableRotationShortcut.SettingChanged += OnConfigChanged; FOV.SettingChanged += OnConfigChanged; FOVOffset.SettingChanged += OnConfigChanged; IncreaseFOVShortcut.SettingChanged += OnConfigChanged; IncreaseXOffsetShortcut.SettingChanged += OnConfigChanged; IncreaseYOffsetShortcut.SettingChanged += OnConfigChanged; IncreaseZOffsetShortcut.SettingChanged += OnConfigChanged; LockCameraPosition.SettingChanged += OnConfigChanged; LockFOV.SettingChanged += OnConfigChanged; XOffset.SettingChanged += OnConfigChanged; YOffset.SettingChanged += OnConfigChanged; ZoomOffset.SettingChanged += OnConfigChanged; DrawDistance.SettingChanged += OnConfigChanged; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading..."); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!"); } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) //IL_0111: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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) if (!Input.anyKey) { return; } KeyboardShortcut value = DefaultsShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { SetDefaults(); } value = EnableRotationShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { shortcutsAffectRotation = !shortcutsAffectRotation; } value = IncreaseFOVShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { ConfigEntry fOVOffset = FOVOffset; int value2 = fOVOffset.Value; fOVOffset.Value = value2 + 1; } value = DecreaseFOVShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { ConfigEntry fOVOffset2 = FOVOffset; int value2 = fOVOffset2.Value; fOVOffset2.Value = value2 - 1; } value = IncreaseXOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry obj = XOffset; obj.Value += 0.25f; } else { ConfigEntry xRotationOffset = XRotationOffset; xRotationOffset.Value += 0.5f; } } value = DecreaseXOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry obj2 = XOffset; obj2.Value -= 0.25f; } else { ConfigEntry xRotationOffset2 = XRotationOffset; xRotationOffset2.Value -= 0.5f; } } value = IncreaseYOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry obj3 = YOffset; obj3.Value += 0.25f; } else { ConfigEntry yRotationOffset = YRotationOffset; yRotationOffset.Value += 0.5f; } } value = DecreaseYOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry obj4 = YOffset; obj4.Value -= 0.25f; } else { ConfigEntry yRotationOffset2 = YRotationOffset; yRotationOffset2.Value -= 0.5f; } } value = IncreaseZOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry zoomOffset = ZoomOffset; zoomOffset.Value += 0.25f; } else { ConfigEntry zRotationOffset = ZRotationOffset; zRotationOffset.Value += 0.5f; } } value = DecreaseZOffsetShortcut.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { if (!shortcutsAffectRotation) { ConfigEntry zoomOffset2 = ZoomOffset; zoomOffset2.Value -= 0.25f; } else { ConfigEntry zRotationOffset2 = ZRotationOffset; zRotationOffset2.Value -= 0.5f; } } } private void OnConfigChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (val != null && sender == DrawDistance && Object.op_Implicit((Object)(object)G.Sys.OptionsManager_) && (Object)(object)G.Sys.OptionsManager_.Graphics_ != (Object)null && !isGraphicsMenuOpen) { G.Sys.OptionsManager_.Graphics_.SetCameraSettings(); } } public void SetChaseCamValues(bool isNear) { if (isNear) { maxDistanceLowSpeed = 4.5f; maxDistanceHighSpeed = 3.25f; minDistance = 4f; height = 1.3f; } else { maxDistanceLowSpeed = 5.625f; maxDistanceHighSpeed = 4.0625f; minDistance = 4f; height = 1.55f; } } private void SetDefaults() { FOV.Value = 125; FOVOffset.Value = 0; LockCameraPosition.Value = false; LockFOV.Value = false; XOffset.Value = 0f; XRotationOffset.Value = 0f; YOffset.Value = 0f; YRotationOffset.Value = 0f; ZoomOffset.Value = 0f; ZRotationOffset.Value = 0f; } } } namespace CameraAdditions.Patches { [HarmonyPatch(typeof(CarCamera), "IncrementCameraModes")] internal static class CarCamera__IncrementCameraModes { [HarmonyPostfix] internal static void SetChaseCamValues(CarCamera __instance) { if (__instance.userSelectedCameraModeIndex_ == 5) { Mod.Instance.SetChaseCamValues(isNear: true); } else if (__instance.userSelectedCameraModeIndex_ == 6) { Mod.Instance.SetChaseCamValues(isNear: false); } } } [HarmonyPatch(typeof(CarCamera), "SetCameraFOV")] internal static class CarCamera__SetCameraFOV { [HarmonyPostfix] internal static void FOVPostfix(CarCamera __instance) { if (__instance.activeCameraMode_ is ChaseCamMode && Mod.LockFOV.Value) { __instance.fov_ = Mod.FOV.Value; __instance.camera_.fieldOfView = Mod.FOV.Value; } __instance.fov_ += (float)Mod.FOVOffset.Value; Camera camera_ = __instance.camera_; camera_.fieldOfView += (float)Mod.FOVOffset.Value; } } [HarmonyPatch(typeof(CarCamera), "SetUserSelectedCameraModeIndex")] internal static class CarCamera__SetUserSelectedCameraModeIndex { [HarmonyPostfix] internal static void SetChaseCamValues(CarCamera __instance) { if (__instance.userSelectedCameraModeIndex_ == 5) { Mod.Instance.SetChaseCamValues(isNear: true); } else if (__instance.userSelectedCameraModeIndex_ == 6) { Mod.Instance.SetChaseCamValues(isNear: false); } } } [HarmonyPatch(typeof(ChaseCamMode), "CamModeLateUpdate")] internal static class ChaseCamMode__CamModeLateUpdate { [HarmonyPrefix] internal static void PositionPrefix(ChaseCamMode __instance) { float num = ((!(Mod.ZoomOffset.Value < -3f)) ? Mod.ZoomOffset.Value : (-3f)); __instance.maxDistanceLowSpeed_ = Mod.Instance.maxDistanceLowSpeed + num; __instance.maxDistanceHighSpeed_ = Mod.Instance.maxDistanceHighSpeed + num; __instance.minDistance_ = Mod.Instance.minDistance + num; __instance.height_ = Mod.Instance.height + num / 4.5f; if (Mod.LockCameraPosition.Value) { __instance.maxDistanceLowSpeed_ = __instance.maxDistanceHighSpeed_; } } [HarmonyPostfix] internal static void PositionPostfix(ChaseCamMode __instance) { //IL_0008: 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_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_0039: 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_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_006a: 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_007e: 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_0095: 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_00a9: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) Transform transform = ((Component)__instance).transform; transform.position += ((Component)__instance).transform.right * Mod.XOffset.Value; Transform transform2 = ((Component)__instance).transform; transform2.position += ((Component)__instance).transform.up * Mod.YOffset.Value; Transform transform3 = ((Component)__instance).transform; transform3.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward); Transform transform4 = ((Component)__instance).transform; transform4.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right); Transform transform5 = ((Component)__instance).transform; transform5.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up); } } [HarmonyPatch(typeof(ChaseCamMode), "RayCastCamera")] internal static class ChaseCamMod__RayCastCamera { [HarmonyPostfix] internal static void RayCastDisabler(ChaseCamMode __instance, ref Vector3 __result, Vector3 rayPos, Vector3 rayDir, float dist) { //IL_0014: 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_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_0022: Unknown result type (might be due to invalid IL or missing references) if (!Mod.CameraCollision.Value) { __result = rayPos + rayDir * dist; } } } [HarmonyPatch(typeof(CockpitCamMode), "CamModeLateUpdate")] internal static class CockpitCamMode__CamModeLateUpdate { [HarmonyPostfix] internal static void PositionPostfix(CockpitCamMode __instance) { //IL_0008: 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_0028: 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_003f: 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_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) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ad: 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_00d8: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)__instance).transform; transform.position += ((Component)__instance).transform.right * (Mod.XOffset.Value / 10f); Transform transform2 = ((Component)__instance).transform; transform2.position += ((Component)__instance).transform.up * (Mod.YOffset.Value / 10f); Transform transform3 = ((Component)__instance).transform; transform3.position += ((Component)__instance).transform.forward * (Mod.ZoomOffset.Value / 10f); Transform transform4 = ((Component)__instance).transform; transform4.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward); Transform transform5 = ((Component)__instance).transform; transform5.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right); Transform transform6 = ((Component)__instance).transform; transform6.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up); } } [HarmonyPatch(typeof(GlobalFog), "OnPreCull")] internal static class GlobalFog__OnPreCull { [HarmonyPostfix] internal static void DrawDistancePostfix(GlobalFog __instance) { //IL_003a: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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) if ((Object)(object)G.Sys.EnvironmentManager_ == (Object)null || !((PostEffectsBase)__instance).CheckResources()) { return; } Settings bioSettings = G.Sys.EnvironmentManager_.GetBioSettings(((Component)__instance).transform.position, true); float num = bioSettings.skybox_.common_.skyFadeDistance_; if (__instance.affectsDrawDistance_) { float num2 = Mod.DrawDistance.Value; if (LevelEditor.IsActive_ && !__instance.camera_.orthographic) { num2 = 1f; } num = bioSettings.skybox_.common_.skyFadeDistance_ * num2; __instance.SetCamFarClip(__instance.camera_, (!LevelEditor.IsActive_ || G.Sys.LevelEditor_.ShowFogInEditor_) ? (bioSettings.skybox_.common_.skyFar_ * num2 * OptimizationManager.cameraFarDistanceMult_) : 50000f); } Vector4 val = default(Vector4); ((Vector4)(ref val))..ctor(bioSettings.fog_.near_, bioSettings.fog_.far_, bioSettings.fog_.maxDistance_, num); Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor(1f / bioSettings.fog_.bottomPenumbra_, 1f / bioSettings.fog_.topPenumbra_, (float)(1.0 / ((double)bioSettings.fog_.far_ - (double)bioSettings.fog_.near_)), 1f / num); Material fogMaterial_ = __instance.fogMaterial_; fogMaterial_.SetVector(__instance.shaderIDs_[0], val); fogMaterial_.SetVector(__instance.shaderIDs_[3], val2); Material depthMaskMaterial_ = __instance.depthMaskMaterial_; depthMaskMaterial_.SetVector(__instance.shaderIDs_[0], val); depthMaskMaterial_.SetVector(__instance.shaderIDs_[3], val2); Vector4 val3 = default(Vector4); ((Vector4)(ref val3))..ctor(__instance.camera_.nearClipPlane, __instance.camera_.farClipPlane, 0f, 0f); depthMaskMaterial_.SetMatrix(__instance.shaderIDs_[9], __instance.camera_.cameraToWorldMatrix); depthMaskMaterial_.SetVector(__instance.shaderIDs_[11], val3); __instance.SetViveOffset(depthMaskMaterial_); } } [HarmonyPatch(typeof(GraphicsMenu), "Initialize")] internal static class GraphicsMenu__Initialize { [HarmonyPostfix] internal static void InitializeCheck(GraphicsMenu __instance) { Mod.Instance.isGraphicsMenuOpen = __instance.isInitialized_; } } [HarmonyPatch(typeof(GraphicsMenu), "CleanUp")] internal static class GraphicsMenu__CleanUp { [HarmonyPostfix] internal static void InitializeCheck(GraphicsMenu __instance) { Mod.Instance.isGraphicsMenuOpen = __instance.isInitialized_; } } [HarmonyPatch(typeof(GraphicsSettings), "SetCameraImageEffects")] internal static class GraphicsSettings__SetCameraImageEffects { [HarmonyPostfix] internal static void DrawDistancePostfix(GraphicsSettings __instance, GameObject camObj) { //IL_0015: 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_0026: 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_002a: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown Camera component = camObj.GetComponent(); GlobalFog component2 = camObj.GetComponent(); CameraCullDistance val = (CameraCullDistance)__instance.drawDistance_; if (Mod.Instance.isGraphicsMenuOpen) { CameraCullDistance val2 = val; CameraCullDistance val3 = val2; switch (val3 - 1) { case 0: Mod.DrawDistance.Value = 0.67f; break; case 1: Mod.DrawDistance.Value = 1f; break; case 2: Mod.DrawDistance.Value = 1.5f; break; } } if ((Object)(object)component2 == (Object)null) { float farClipPlane = __instance.carCamera_.GetComponent().camera_.farClipPlane; if (!Mod.Instance.isGraphicsMenuOpen) { component.farClipPlane = farClipPlane * Mod.DrawDistance.Value; } } CameraEx.SetCullDistances(component); } } [HarmonyPatch(typeof(MountedCamMode), "CamModeLateUpdate")] internal static class MountedCamMode__CamModeLateUpdate { [HarmonyPostfix] internal static void PositionPostfix(CockpitCamMode __instance) { //IL_0008: 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_0028: 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_003f: 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_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) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ad: 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_00d8: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)__instance).transform; transform.position += ((Component)__instance).transform.right * (Mod.XOffset.Value / 10f); Transform transform2 = ((Component)__instance).transform; transform2.position += ((Component)__instance).transform.up * (Mod.YOffset.Value / 10f); Transform transform3 = ((Component)__instance).transform; transform3.position += ((Component)__instance).transform.forward * (Mod.ZoomOffset.Value / 10f); Transform transform4 = ((Component)__instance).transform; transform4.rotation *= Quaternion.AngleAxis(Mod.ZRotationOffset.Value, Vector3.forward); Transform transform5 = ((Component)__instance).transform; transform5.rotation *= Quaternion.AngleAxis(Mod.XRotationOffset.Value, Vector3.right); Transform transform6 = ((Component)__instance).transform; transform6.rotation *= Quaternion.AngleAxis(Mod.YRotationOffset.Value, Vector3.up); } } [HarmonyPatch(typeof(SpectatorFreeCamera), "CamModeInitialize")] internal static class SpectatorFreeCamera__CamModeInitialize { [HarmonyPrefix] internal static void AddFreeCameraToPlayModeCycle(SpectatorFreeCamera __instance) { if (Mod.EnableFreeCam.Value) { ((AbstractCamMode)__instance).includeInPlayModeCycle_ = true; } } } }