Skip to content

Commit 4b0aa83

Browse files
committed
[GEN][ZH] Double scroll amount for edge and keyboard scrolling
1 parent c1903b6 commit 4b0aa83

File tree

2 files changed

+14
-6
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream
  • Generals/Code/GameEngine/Source/GameClient/MessageStream

2 files changed

+14
-6
lines changed

Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ enum
6262

6363
static Bool scrollDir[4] = { false, false, false, false };
6464

65-
Int SCROLL_AMT = 100;
65+
// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour
66+
// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f.
67+
CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f;
68+
CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER;
6669

6770
static const Int edgeScrollSize = 3;
6871

@@ -430,8 +433,9 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
430433
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
431434
float vecLength = vec.length();
432435
vec.normalize();
433-
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor;
434-
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor;
436+
// 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
437+
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
438+
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
435439
}
436440
break;
437441
case SCROLL_KEY:

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ enum
6262

6363
static Bool scrollDir[4] = { false, false, false, false };
6464

65-
Int SCROLL_AMT = 100;
65+
// TheSuperHackers @info the scroll multiplier is used to rescale scroll settings so keyboard scrolling is faster and RMB scrolling matches 30FPS behaviour
66+
// The value 2.0 was chosen as the default scroll factor of 50 sets m_keyboardscrollfactor to 0.5f.
67+
CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f;
68+
CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER;
6669

6770
static const Int edgeScrollSize = 3;
6871

@@ -429,8 +432,9 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
429432
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
430433
float vecLength = vec.length();
431434
vec.normalize();
432-
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * TheGlobalData->m_keyboardScrollFactor;
433-
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * TheGlobalData->m_keyboardScrollFactor;
435+
// 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
436+
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
437+
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
434438
}
435439
break;
436440
case SCROLL_KEY:

0 commit comments

Comments
 (0)