Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(camera): let Options.ini raise the zoom-out ceiling
Olcay Seygan037d487091de
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.hindex a495a5d42..a559b496c 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h@@ -107,6 +107,7 @@ public:Int getStaticGameDetail(void); // detail level selected by the user.Int getIdealStaticGameDetail(void); // detail level detected for user.Real getGammaValue(void);+ Real getMaxCameraHeight(void);Int getTextureReduction(void);void getResolution(Int *xres, Int *yres);Bool get3DShadowsEnabled(void);diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cppindex ba3c04d2f..d73aecd5b 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp@@ -359,6 +359,10 @@ void GameLODManager::init(void)TheWritableGlobalData->m_useTrees = optionPref.getTreesEnabled();}+ // Camera zoom-out is not a detail level: honor the Options.ini override at+ // every preset, floored at the GameData.ini value (see getMaxCameraHeight).+ TheWritableGlobalData->m_maxCameraHeight = optionPref.getMaxCameraHeight();+setStaticLODLevel(userSetDetail);}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cppindex 9dbd6b37b..cb3039d63 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp@@ -708,6 +708,22 @@ Int OptionPreferences::getParticleCap(void)return factor;}+Real OptionPreferences::getMaxCameraHeight(void)+{+ // Not written by the options menu - a power-user Options.ini key. The+ // GameData.ini value (retail ~310) is the floor: raising it lets you zoom+ // out further, lowering it below retail is never honored.+ OptionPreferences::const_iterator it = find("MaxCameraHeight");+ if (it == end())+ return TheGlobalData->m_maxCameraHeight;++ Real height = (Real) atof(it->second.str());+ if (height < TheGlobalData->m_maxCameraHeight)+ height = TheGlobalData->m_maxCameraHeight;++ return height;+}+Int OptionPreferences::getTextureReduction(void){OptionPreferences::const_iterator it = find("TextureReduction");diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cppindex c732831d0..8bedecde6 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp@@ -229,16 +229,12 @@ void W3DView::setWidth(Int width)//we want to maintain the same scale, so we'll need to adjust the fov.//default W3D fov for full-screen is 50 degrees.- //Widescreen (PLAN.md Phase 6): 50 degrees is the *4:3* horizontal FOV. The- //camera derives the vertical extent as X/aspect, so a wider aspect with a- //fixed hfov crops the vertical view (vert-). Widen the hfov so the vertical- //view stays exactly what 4:3 shows and the extra screen shows more world- //horizontally (hor+). At 4:3 the factor is 1 and nothing changes.- Real hfov = (Real)width/(Real)TheDisplay->getWidth()*DEG_TO_RADF(50.0f);- Real aspect = (getHeight() > 0) ? (Real)width/(Real)getHeight() : (4.0f/3.0f);- if (aspect > (4.0f/3.0f))- hfov = 2.0f * (Real)atan( tan(hfov * 0.5f) * aspect / (4.0f/3.0f) );- m_3DCamera->Set_View_Plane(hfov,-1);+ //Widescreen (PLAN.md Phase 6): deliberately retail behavior. A hor++ //widening (vertical view pinned to 4:3, extra width showing more world)+ //was tried and reverted: the engine's maps assume the 4:3 view cone, and+ //the widened edges look past the map border into black from most camera+ //positions. Stock vert- keeps the horizontal view identical to 4:3.+ m_3DCamera->Set_View_Plane((Real)width/(Real)TheDisplay->getWidth()*DEG_TO_RADF(50.0f),-1);}//-------------------------------------------------------------------------------------------------