From 4b0aa83ff25afc8860a17725d4050bad1f77eda4 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Tue, 15 Jul 2025 19:46:05 +0100 Subject: [PATCH 1/4] [GEN][ZH] Double scroll amount for edge and keyboard scrolling --- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 10 +++++++--- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 529e03ec2f..cf5964b76d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,7 +62,10 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -Int SCROLL_AMT = 100; +// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour +// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f. +CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; +CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; static const Int edgeScrollSize = 3; @@ -430,8 +433,9 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor; - offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor; + // TheSuperHackers @tweak Rescale the scroll factor so the default scroll speed at 50 will result in the RMB scrolling being identical to the original 30FPS retail behavior + offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } break; case SCROLL_KEY: diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 695fdde063..2eee4bc67d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,7 +62,10 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -Int SCROLL_AMT = 100; +// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour +// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f. +CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; +CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; static const Int edgeScrollSize = 3; @@ -429,8 +432,9 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor; - offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor; + // TheSuperHackers @tweak Rescale the scroll factor so the default scroll speed at 50 will result in the RMB scrolling being identical to the original 30FPS retail behavior + offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; + offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } break; case SCROLL_KEY: From c42111bfb19eca471c5e933c9de97b45758ee3c4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 20 Jul 2025 12:04:58 +0200 Subject: [PATCH 2/4] Modify comments --- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 12 +++++++++--- .../Source/GameClient/MessageStream/LookAtXlat.cpp | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index cf5964b76d..499daa223a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,8 +62,15 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour -// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f. +// TheSuperHackers @info Introduces the SCROLL_MULTIPLIER for all scrolling to +// +// 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version +// 2. increase the upper limit of the Scroll Factor when set from the Options Menu (0.20 to 2.90 instead of 0.10 to 1.45) +// 3. increase the scroll speed for Edge/Key scrolling to better fit the high speeds of RMB scrolling +// +// The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed +// and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier. + CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; @@ -433,7 +440,6 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - // TheSuperHackers @tweak Rescale the scroll factor so the default scroll speed at 50 will result in the RMB scrolling being identical to the original 30FPS retail behavior offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 2eee4bc67d..aa9adabb4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,8 +62,15 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour -// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f. +// TheSuperHackers @info Introduces the SCROLL_MULTIPLIER for all scrolling to +// +// 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version +// 2. increase the upper limit of the Scroll Factor when set from the Options Menu (0.20 to 2.90 instead of 0.10 to 1.45) +// 3. increase the scroll speed for Edge/Key scrolling to better fit the high speeds of RMB scrolling +// +// The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed +// and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier. + CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f; CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER; @@ -432,7 +439,6 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage // TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized float vecLength = vec.length(); vec.normalize(); - // TheSuperHackers @tweak Rescale the scroll factor so the default scroll speed at 50 will result in the RMB scrolling being identical to the original 30FPS retail behavior offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor; } From ccc0e3d0b277c2f9e628b701ecb6fcd489c6ec80 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 20 Jul 2025 22:32:16 +0200 Subject: [PATCH 3/4] tweak --- .../GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index aa9adabb4f..99ad42d6b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,7 +62,7 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -// TheSuperHackers @info Introduces the SCROLL_MULTIPLIER for all scrolling to +// TheSuperHackers @tweak Introduces the SCROLL_MULTIPLIER for all scrolling to // // 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version // 2. increase the upper limit of the Scroll Factor when set from the Options Menu (0.20 to 2.90 instead of 0.10 to 1.45) From 3936153e84210dc7ab32ef3437293cb6ffa64e9b Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 20 Jul 2025 22:32:47 +0200 Subject: [PATCH 4/4] tweak 2 --- .../GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 499daa223a..afe0e3fc94 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -62,7 +62,7 @@ enum static Bool scrollDir[4] = { false, false, false, false }; -// TheSuperHackers @info Introduces the SCROLL_MULTIPLIER for all scrolling to +// TheSuperHackers @tweak Introduces the SCROLL_MULTIPLIER for all scrolling to // // 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version // 2. increase the upper limit of the Scroll Factor when set from the Options Menu (0.20 to 2.90 instead of 0.10 to 1.45)