change FOV slider use designated FOV option instead of hooking into GameRenderer, normalize FOV

This commit is contained in:
synanesthetics 2026-03-08 15:15:22 -05:00
parent 583f906c82
commit f58c0fe1a1
3 changed files with 20 additions and 14 deletions

View file

@ -838,10 +838,8 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
SetGameSettings(iPad,eGameSetting_RenderDistance,16); SetGameSettings(iPad,eGameSetting_RenderDistance,16);
SetGameSettings(iPad,eGameSetting_Gamma,50); 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 // jvnpr -- FOV setting is stored as 0-100 but mapped to 0-80 (offset from 30-110).
// 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) SetGameSettings(iPad,eGameSetting_FOV,75); // jvnpr -- new default is fov of 90 because legacy console edition default is 90
// FOV of 90 is internally an FOV of ~70, which is the default.
SetGameSettings(iPad,eGameSetting_FOV,75);
// 4J-PB - Don't reset the difficult level if we're in-game // 4J-PB - Don't reset the difficult level if we're in-game
if(Minecraft::GetInstance()->level==NULL) if(Minecraft::GetInstance()->level==NULL)
@ -1410,10 +1408,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_FOV: case eGameSetting_FOV:
if(iPad==ProfileManager.GetPrimaryPad()) if(iPad==ProfileManager.GetPrimaryPad())
{ {
float simulatedFovDeg = 30.0f + (float)GameSettingsA[iPad]->ucFov * 80.0f / 100.0f; // jvnpr -- convert 0-80 to 30-110 float v = (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->options->fov = ( v / 40.0f ) - 1;
pMinecraft->gameRenderer->SetFovVal(trueFovDeg);
pMinecraft->options->set(Options::Option::FOV, (float)GameSettingsA[iPad]->ucFov / 100.0f);
} }
break; break;
case eGameSetting_Difficulty: case eGameSetting_Difficulty:

View file

@ -6,6 +6,7 @@
#include "..\..\Minecraft.h" #include "..\..\Minecraft.h"
#include "..\..\MinecraftServer.h" #include "..\..\MinecraftServer.h"
#include "..\..\GameRenderer.h" #include "..\..\GameRenderer.h"
#include "..\..\Options.h"
#include "..\..\MultiPlayerLevel.h" #include "..\..\MultiPlayerLevel.h"
#include "ClientConnection.h" #include "ClientConnection.h"
#include "MultiPlayerLocalPlayer.h" #include "MultiPlayerLocalPlayer.h"
@ -279,14 +280,23 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue)
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
if (v < 0) v = 0; if (v < 0) v = 0;
if (v > 80) v = 80; 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 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); pMinecraft->gameRenderer->SetFovVal(trueFovDeg);
app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / (80.0f / 100.0f))); app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / (80.0f / 100.0f)));
WCHAR TempString[256]; WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"FOV: %d (True: %d)", simulatedFovDeg, (int)trueFovDeg); swprintf( (WCHAR *)TempString, 256, L"FOV: %d (True: %d)", simulatedFovDeg, (int)trueFovDeg);
m_sliderFov.setLabel(TempString); m_sliderFov.setLabel(TempString);
*/
} }
break; break;
}; };

View file

@ -194,14 +194,14 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
if (v < 0) v = 0; if (v < 0) v = 0;
if (v > 80) v = 80; if (v > 80) v = 80;
int simulatedFovDeg = v + 30; // jvnpr -- convert 0-80 to 30-110 int displayFOV = 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)));
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]; 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); m_sliderFOV.setLabel(TempString);
app.SetGameSettings(m_iPad, eGameSetting_FOV, (v / ( 80.0f / 100.0f )));
} }
break; break;