From f58c0fe1a1c811a2ff597b041bbcd1cf6a11f69f Mon Sep 17 00:00:00 2001 From: synanesthetics Date: Sun, 8 Mar 2026 15:15:22 -0500 Subject: [PATCH] change FOV slider use designated FOV option instead of hooking into GameRenderer, normalize FOV --- Minecraft.Client/Common/Consoles_App.cpp | 12 ++++-------- Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp | 12 +++++++++++- .../Common/UI/UIScene_SettingsGraphicsMenu.cpp | 10 +++++----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index efd09f24a..556ebcc5f 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -838,10 +838,8 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con SetGameSettings(iPad,eGameSetting_RenderDistance,16); SetGameSettings(iPad,eGameSetting_Gamma,50); - // jvnpr -- FOV setting is stored as 0-100 but mapped to 0-80 (offset from 30-110). FOV is calculated from the equiation: ( eGameSetting_FOV * 0.8 ) + 30 - // Default value of 75 is an FOV of 90. Displayed / stored FOV is further clamped to a range from 30-85 for internal use because an FOV of 85 on LCE is the equivalent of 110 on other platforms. (This is why 110 on LCE is so much wider than on Java) - // FOV of 90 is internally an FOV of ~70, which is the default. - SetGameSettings(iPad,eGameSetting_FOV,75); + // jvnpr -- FOV setting is stored as 0-100 but mapped to 0-80 (offset from 30-110). + SetGameSettings(iPad,eGameSetting_FOV,75); // jvnpr -- new default is fov of 90 because legacy console edition default is 90 // 4J-PB - Don't reset the difficult level if we're in-game if(Minecraft::GetInstance()->level==NULL) @@ -1410,10 +1408,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_FOV: if(iPad==ProfileManager.GetPrimaryPad()) { - float simulatedFovDeg = 30.0f + (float)GameSettingsA[iPad]->ucFov * 80.0f / 100.0f; // jvnpr -- convert 0-80 to 30-110 - float trueFovDeg = ( 55.0f / 80.0f ) * (simulatedFovDeg - 30.0f) + 30.0f; // jnvpr -- further convert 30-110 to a range from 30-85 to better reflect JE fov values - pMinecraft->gameRenderer->SetFovVal(trueFovDeg); - pMinecraft->options->set(Options::Option::FOV, (float)GameSettingsA[iPad]->ucFov / 100.0f); + float v = (float)GameSettingsA[iPad]->ucFov * 80.0f / 100.0f; // jvnpr -- convert 0-80 to 30-110 + pMinecraft->options->fov = ( v / 40.0f ) - 1; } break; case eGameSetting_Difficulty: diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 1045f92d0..40b3e4096 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -6,6 +6,7 @@ #include "..\..\Minecraft.h" #include "..\..\MinecraftServer.h" #include "..\..\GameRenderer.h" +#include "..\..\Options.h" #include "..\..\MultiPlayerLevel.h" #include "ClientConnection.h" #include "MultiPlayerLocalPlayer.h" @@ -279,14 +280,23 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) Minecraft *pMinecraft = Minecraft::GetInstance(); if (v < 0) v = 0; if (v > 80) v = 80; + int displayFOV = v + 30; // jvnpr -- convert 0-80 to 30-110 + + pMinecraft->options->fov = ( v / 40.0f ) - 1; + WCHAR TempString[256]; + swprintf( (WCHAR *)TempString, 256, L"FOV: %d", displayFOV); + m_sliderFov.setLabel(TempString); + + /* int simulatedFovDeg = v + 30; // jvnpr -- convert 0-80 to 30-110 - float trueFovDeg = ( 55.0f / 80.0f ) * (simulatedFovDeg - 30.0f) + 30.0f; // jvnpr -- further convert 30-110 to an internal range of 30-85 to better reflect JE fov values + float trueFovDeg = (30.0f + (v / ( 80.0f / 100.0f )) * (50.0f / 100.0f)); // jvnpr -- further convert 30-110 to an internal range of 30-85 to better reflect JE fov values pMinecraft->gameRenderer->SetFovVal(trueFovDeg); app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / (80.0f / 100.0f))); WCHAR TempString[256]; swprintf( (WCHAR *)TempString, 256, L"FOV: %d (True: %d)", simulatedFovDeg, (int)trueFovDeg); m_sliderFov.setLabel(TempString); + */ } break; }; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 7c8ec1487..ed1f14ebc 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -194,14 +194,14 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal Minecraft *pMinecraft = Minecraft::GetInstance(); if (v < 0) v = 0; if (v > 80) v = 80; - int simulatedFovDeg = v + 30; // jvnpr -- convert 0-80 to 30-110 - float trueFovDeg = ( 55.0f / 80.0f ) * (simulatedFovDeg - 30.0f) + 30.0f; // jvnpr -- further convert 30-110 to an internal range of 30-85 to better reflect JE fov values - pMinecraft->gameRenderer->SetFovVal(trueFovDeg); - app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / (80.0f / 100.0f))); + int displayFOV = v + 30; // jvnpr -- convert 0-80 to 30-110 + pMinecraft->options->fov = ( v / 40.0f ) - 1 ; // jvnpr -- use FOV option instead of hooking into gamerenderer (range from -1 to 1 for 30-110) WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"FOV: %d (True: %d)", simulatedFovDeg, (int)trueFovDeg); + swprintf( (WCHAR *)TempString, 256, L"FOV: %d", displayFOV); m_sliderFOV.setLabel(TempString); + + app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / ( 80.0f / 100.0f ))); } break;