Skip to content

Commit fbd4468

Browse files
authored
[GEN][ZH] Double scroll amount for RMB, edge and keyboard scrolling (#1288)
1 parent a1d2347 commit fbd4468

File tree

2 files changed

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

2 files changed

+26
-6
lines changed

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

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

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

65-
Int SCROLL_AMT = 100;
65+
// TheSuperHackers @tweak Introduces the SCROLL_MULTIPLIER for all scrolling to
66+
//
67+
// 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version
68+
// 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)
69+
// 3. increase the scroll speed for Edge/Key scrolling to better fit the high speeds of RMB scrolling
70+
//
71+
// The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed
72+
// and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier.
73+
74+
CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f;
75+
CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER;
6676

6777
static const Int edgeScrollSize = 3;
6878

@@ -430,8 +440,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
430440
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
431441
float vecLength = vec.length();
432442
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;
443+
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
444+
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
435445
}
436446
break;
437447
case SCROLL_KEY:

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

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

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

65-
Int SCROLL_AMT = 100;
65+
// TheSuperHackers @tweak Introduces the SCROLL_MULTIPLIER for all scrolling to
66+
//
67+
// 1. bring the RMB scroll speed back to how it was at 30 FPS in the retail game version
68+
// 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)
69+
// 3. increase the scroll speed for Edge/Key scrolling to better fit the high speeds of RMB scrolling
70+
//
71+
// The multiplier of 2 was logically chosen because originally the Scroll Factor did practically not affect the RMB scroll speed
72+
// and because the default Scroll Factor is/was 0.5, it needs to be doubled to get to a neutral 1x multiplier.
73+
74+
CONSTEXPR const Real SCROLL_MULTIPLIER = 2.0f;
75+
CONSTEXPR const Real SCROLL_AMT = 100.0f * SCROLL_MULTIPLIER;
6676

6777
static const Int edgeScrollSize = 3;
6878

@@ -429,8 +439,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
429439
// TheSuperHackers @info calculate the length of the vector to obtain the movement speed before the vector is normalized
430440
float vecLength = vec.length();
431441
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;
442+
offset.x = TheGlobalData->m_horizontalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.x * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
443+
offset.y = TheGlobalData->m_verticalScrollSpeedFactor * logicToFpsRatio * vecLength * vec.y * SCROLL_MULTIPLIER * TheGlobalData->m_keyboardScrollFactor;
434444
}
435445
break;
436446
case SCROLL_KEY:

0 commit comments

Comments
 (0)