mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[MenuScalePatch] Added FOV adjustment handling.
This commit is contained in:
parent
cf7e19511a
commit
b6c284857b
8 changed files with 32 additions and 6 deletions
|
@ -184,4 +184,20 @@ internal class HarmonyPatches
|
||||||
|
|
||||||
return patchedInstructions;
|
return patchedInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(CVR_DesktopCameraController), nameof(CVR_DesktopCameraController.UpdateFov))]
|
||||||
|
private static void Postfix_CVR_DesktopCameraController_UpdateFov()
|
||||||
|
{
|
||||||
|
if (!MenuScalePatch.EntryUseFOVAdjustment.Value)
|
||||||
|
{
|
||||||
|
MSP_MenuInfo.FOVAdjustment = 1f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float minFovValue = 60f;
|
||||||
|
const float maxFovValue = 120f;
|
||||||
|
MSP_MenuInfo.FOVAdjustment =
|
||||||
|
1f + (2f * Mathf.Clamp01((CVR_DesktopCameraController.defaultFov - minFovValue) / (maxFovValue - minFovValue)));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -95,7 +95,7 @@ public class MainMenuHelper : MonoBehaviour
|
||||||
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableMMHelper) return;
|
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableMMHelper) return;
|
||||||
|
|
||||||
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
||||||
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor, 0.9f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 0.9f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f);
|
||||||
transform.position = activeAnchor.position + activeAnchor.forward * 1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.AspectRatio;
|
transform.position = activeAnchor.position + activeAnchor.forward * 1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.AspectRatio;
|
||||||
transform.rotation = activeAnchor.rotation;
|
transform.rotation = activeAnchor.rotation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class QuickMenuHelper : MonoBehaviour
|
||||||
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableQMHelper) return;
|
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableQMHelper) return;
|
||||||
|
|
||||||
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
|
||||||
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
|
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f);
|
||||||
transform.rotation = activeAnchor.rotation;
|
transform.rotation = activeAnchor.rotation;
|
||||||
transform.position = activeAnchor.position + activeAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
transform.position = activeAnchor.position + activeAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class MSP_MenuInfo
|
||||||
//Shared Info
|
//Shared Info
|
||||||
internal static float ScaleFactor = 1f;
|
internal static float ScaleFactor = 1f;
|
||||||
internal static float AspectRatio = 1f;
|
internal static float AspectRatio = 1f;
|
||||||
|
internal static float FOVAdjustment = 1f;
|
||||||
internal static Transform CameraTransform;
|
internal static Transform CameraTransform;
|
||||||
|
|
||||||
//Settings...?
|
//Settings...?
|
||||||
|
|
|
@ -12,6 +12,9 @@ public class MenuScalePatch : MelonMod
|
||||||
|
|
||||||
public static MelonPreferences_Entry<bool> EntryPlayerAnchorMenus =
|
public static MelonPreferences_Entry<bool> EntryPlayerAnchorMenus =
|
||||||
Category.CreateEntry<bool>("Player Anchor Menus", true, description: "Should the menus be anchored to & constantly follow the player?");
|
Category.CreateEntry<bool>("Player Anchor Menus", true, description: "Should the menus be anchored to & constantly follow the player?");
|
||||||
|
|
||||||
|
public static MelonPreferences_Entry<bool> EntryUseFOVAdjustment =
|
||||||
|
Category.CreateEntry<bool>("Use FOV Adjustment", true, description: "Should the menus adjust to your changed FOV?");
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,6 @@ using System.Reflection;
|
||||||
namespace NAK.MenuScalePatch.Properties;
|
namespace NAK.MenuScalePatch.Properties;
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "4.2.7";
|
public const string Version = "4.2.8";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_id": 95,
|
"_id": 95,
|
||||||
"name": "MenuScalePatch",
|
"name": "MenuScalePatch",
|
||||||
"modversion": "4.2.7",
|
"modversion": "4.2.8",
|
||||||
"gameversion": "2022r170p1",
|
"gameversion": "2022r170p1",
|
||||||
"loaderversion": "0.6.1",
|
"loaderversion": "0.6.1",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"None"
|
"None"
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/MenuScalePatch.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r13/MenuScalePatch.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/MenuScalePatch/",
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/MenuScalePatch/",
|
||||||
"changelog": "- Menus are no longer forced closed on world load.",
|
"changelog": "- Added FOV handling to menu scaling. The menu will scale with changes to your FOV.",
|
||||||
"embedcolor": "363020"
|
"embedcolor": "363020"
|
||||||
}
|
}
|
|
@ -69,6 +69,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FuckCohtmlResourceHandler",
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlaySpaceScaleFix", "PlaySpaceScaleFix\PlaySpaceScaleFix.csproj", "{61368493-5B0E-489B-828C-DE10428AB81A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlaySpaceScaleFix", "PlaySpaceScaleFix\PlaySpaceScaleFix.csproj", "{61368493-5B0E-489B-828C-DE10428AB81A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FOVAdjustment", "FOVAdjustment\FOVAdjustment.csproj", "{EE552804-30B1-49CF-BBDE-3B312895AFF7}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -207,6 +209,10 @@ Global
|
||||||
{61368493-5B0E-489B-828C-DE10428AB81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{61368493-5B0E-489B-828C-DE10428AB81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{61368493-5B0E-489B-828C-DE10428AB81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{61368493-5B0E-489B-828C-DE10428AB81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{61368493-5B0E-489B-828C-DE10428AB81A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{61368493-5B0E-489B-828C-DE10428AB81A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue