Decompiled source of WoodzCameraTweaks v1.0.0

WoodzCamera.dll

Decompiled 6 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("WoodzCamera")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Camera tweaks for Bomb Rush Cyberfunk")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WoodzCamera")]
[assembly: AssemblyTitle("WoodzCamera")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 woodzcamera
{
	[BepInPlugin("info.mariobluegloves.woodzcamerap", "Woodz Camera Tweaks", "1.0.0")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class WoodzCameraTweaks : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StageChunk), "UpdateChunk")]
		public class Patch_UpdateChunk
		{
			public static void Prefix(ref bool __runOriginal)
			{
				__runOriginal = false;
			}

			public static void Postfix(StageChunk __instance)
			{
				//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)
				//IL_0024: 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)
				if (!__instance.isActive)
				{
					__instance.ActivateChunk(true);
				}
				Vector3 currentCameraPosition = WorldHandler.instance.CurrentCameraPosition;
				__instance.UpdateStreetLife(currentCameraPosition);
				__instance.UpdateMoveObjects(currentCameraPosition);
				JunkBehaviour.JunkUpdate(__instance.junkBehaviour, Core.dt);
			}
		}

		public float C;

		public float ofd;

		public float mof;

		public float js;

		private bool sceneLoaded = false;

		private void Awake()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
			ApplyCullingCfg(CameraTweaksWoodz.setCulling.Value);
			ApplyOfdCfg(CameraTweaksWoodz.setOfd.Value);
			ApplyMofCfg(CameraTweaksWoodz.setMof.Value);
			ApplyJoyCfg(CameraTweaksWoodz.setJoy.Value);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			sceneLoaded = true;
		}

		private void ApplyCullingCfg(float culling)
		{
			C = culling;
		}

		private void ApplyOfdCfg(float ofdfactor)
		{
			ofd = ofdfactor;
		}

		private void ApplyMofCfg(float orbitfactor)
		{
			mof = orbitfactor;
		}

		private void ApplyJoyCfg(float joyFcator)
		{
			js = joyFcator;
		}

		private void Update()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			if (!sceneLoaded)
			{
				return;
			}
			GameObject val = GameObject.Find("gameplayCamera(Clone)");
			if ((Object)(object)val != (Object)null)
			{
				Camera component = val.GetComponent<Camera>();
				GameplayCamera component2 = val.GetComponent<GameplayCamera>();
				Scene activeScene;
				if ((Object)(object)component2 != (Object)null)
				{
					component2.joystickFactor = js;
					component2.lookAngleHighest = 89f;
					component2.lookAngleLowest = -89f;
					component2.orbitFadeDuration = ofd;
					((CameraMode)component2.cameraModeDrag).manualOrbitFactor = mof;
					activeScene = SceneManager.GetActiveScene();
					Debug.Log((object)("Camera settings adjusted for gameplayCamera(Clone)'s GameplayCamera in scene: " + ((Scene)(ref activeScene)).name));
				}
				if ((Object)(object)component != (Object)null)
				{
					component.farClipPlane = C;
					activeScene = SceneManager.GetActiveScene();
					Debug.Log((object)("Camera settings adjusted for gameplayCamera(Clone)'s Camera in scene: " + ((Scene)(ref activeScene)).name));
					sceneLoaded = false;
				}
			}
		}
	}
	[BepInPlugin("info.mariobluegloves.woodzcamera", "Woodz Camera Tweaks", "1.0.0")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class CameraTweaksWoodz : BaseUnityPlugin
	{
		private static ConfigEntry<bool> applyPatches;

		public static ConfigEntry<float> setCulling;

		public static ConfigEntry<float> setOfd;

		public static ConfigEntry<float> setMof;

		public static ConfigEntry<float> setJoy;

		private void Awake()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			applyPatches = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "KeepChunksLoaded", false, "Keeps chunks always loaded regardless of camera position. Not recommended for low-end PCs. Will cause problems on certain maps, for example Brink Terminal's LOD.");
			setCulling = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "SetClipping", 1000f, "Sets the far clip plane, which is what cuts off things from being rendered at a distance. Set higher to have things that are further away be rendered that normally wouldn't.");
			setOfd = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "SetOfd", 5f, "Sets the orbit fade duration. Set this to -1 to disable camera's automatic re-centering, set to 5 for vanilla, lower will be a lower time it will take to re-center and higher will be a higher one.");
			setMof = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "SetMof", 1f, "Sets the manual orbit factor. Set this to 0 to fix certain issues with turning off re-centering such as camera zooming in when boosting at high speeds, set to 1 for vanilla re-centering.");
			setJoy = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "SetJoy", 1.5f, "Sets joystick sensitivity. This is a separate value than the one in your options menu which will scale this one, so feel free to set both. Vanilla is 1.5.");
			Harmony val = new Harmony("info.mariobluegloves.woodzcamerap");
			if (applyPatches.Value)
			{
				val.PatchAll();
			}
		}
	}
}