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
fix(gameengine): fix the zoom ceiling for everyone, and speed the wheel up
Olcay Seygan47a33c49915c
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.hindex 01f4b6ea1..4af4e21a6 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h@@ -107,7 +107,6 @@ public:Int getStaticGameDetail(void); // detail level selected by the user.Int getIdealStaticGameDetail(void); // detail level detected for user.Real getGammaValue(void);- Real getMaxCameraHeight(void);Bool getUseGridHotKeys(void);Bool getEdgeScrollInWindowedMode(void);Bool getSnapBuildPlacementTo45(void);diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cppindex 4c4130e43..0c7cff4fb 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp@@ -359,9 +359,8 @@ 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();+ // Camera zoom-out is deliberately not settable here: how much of the battlefield you can see+ // is a competitive advantage, so it stays at the GameData.ini value for everyone.// Grid command-bar keys are an input scheme, not a detail level either.TheWritableGlobalData->m_useGridHotKeys = optionPref.getUseGridHotKeys();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cppindex 46338b156..7f57b3202 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp@@ -708,21 +708,11 @@ 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;-}+/* There is deliberately no MaxCameraHeight here. The zoom ceiling is how much of the battlefield+ you can see at once, so a local Options.ini key would hand one player a permanent advantage over+ everyone else in the game - and unlike GameData.ini, Options.ini is not covered by the file+ mismatch check that refuses to start a LAN game between machines whose data differs. The+ ceiling is fixed for everyone at ZOOM_OUT_LIMIT_FACTOR times the GameData.ini value. */Bool OptionPreferences::getUseGridHotKeys(void){diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cppindex 0e5c02fde..9d4cedc15 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp@@ -128,14 +128,20 @@ View *View::prependViewToList( View *list )// One "step" is what a single mouse wheel notch does, and what one 30Hz frame of a held// zoom key does; a caller driving this from a render frame passes the fraction of a logic// frame that has actually gone by, so the zoom rate stops depending on the frame rate.+//+// EA's step was 10 world units. The reachable band is roughly 100 (MinCameraHeight) to 480+// (MaxCameraHeight * ZOOM_OUT_LIMIT_FACTOR), so crossing it took about 38 notches - most of a+// wheel's travel to go from the ground to the whole map. 30 puts it at about 13.+#define ZOOM_STEP_HEIGHT (30.0f)+void View::zoomIn( Real steps ){- setHeightAboveGround(getHeightAboveGround() - 10.0f * steps);+ setHeightAboveGround(getHeightAboveGround() - ZOOM_STEP_HEIGHT * steps);}void View::zoomOut( Real steps ){- setHeightAboveGround(getHeightAboveGround() + 10.0f * steps);+ setHeightAboveGround(getHeightAboveGround() + ZOOM_STEP_HEIGHT * steps);}/**