Skip to content

Commit d69f72e

Browse files
committed
Replicate in Generals
1 parent 9a76f9e commit d69f72e

File tree

1 file changed

+20
-11
lines changed
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

1 file changed

+20
-11
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,13 @@ Real OptionPreferences::getScrollFactor(void)
336336
return TheGlobalData->m_keyboardDefaultScrollFactor;
337337

338338
Int factor = atoi(it->second.str());
339-
if (factor < 0)
340-
factor = 0;
341-
if (factor > 100)
342-
factor = 100;
343-
339+
340+
// TheSuperHackers @tweak xezon 11/07/2025
341+
// No longer caps the upper limit to 100, because the options setting can go beyond that.
342+
// No longer caps the lower limit to 0, because that would mean standstill.
343+
if (factor < 1)
344+
factor = 1;
345+
344346
return factor/100.0f;
345347
}
346348

@@ -818,13 +820,12 @@ static void setDefaults( void )
818820

819821
//-------------------------------------------------------------------------------------------------
820822
// // scroll speed val
821-
Int valMin, valMax;
822-
// GadgetSliderGetMinMax(sliderScrollSpeed,&valMin, &valMax);
823-
// GadgetSliderSetPosition(sliderScrollSpeed, ((valMax - valMin) / 2 + valMin));
824823
Int scrollPos = (Int)(TheGlobalData->m_keyboardDefaultScrollFactor*100.0f);
825824
GadgetSliderSetPosition( sliderScrollSpeed, scrollPos );
826825

827826

827+
Int valMin, valMax;
828+
828829
//-------------------------------------------------------------------------------------------------
829830
// slider music volume
830831
GadgetSliderGetMinMax(sliderMusicVolume,&valMin, &valMax);
@@ -1129,7 +1130,7 @@ static void saveOptions( void )
11291130
//-------------------------------------------------------------------------------------------------
11301131
// scroll speed val
11311132
val = GadgetSliderGetPosition(sliderScrollSpeed);
1132-
if(val != -1)
1133+
if(val > 0)
11331134
{
11341135
TheWritableGlobalData->m_keyboardScrollFactor = val/100.0f;
11351136
DEBUG_LOG(("Scroll Spped val %d, keyboard scroll factor %f", val, TheGlobalData->m_keyboardScrollFactor));
@@ -1768,9 +1769,17 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
17681769
GadgetCheckBoxSetChecked(checkAlternateMouse, TheGlobalData->m_useAlternateMouse);
17691770

17701771
// set scroll speed slider
1772+
// TheSuperHackers @tweak xezon 11/07/2025 No longer sets the slider position if the user setting
1773+
// is set beyond the slider limits. This gives the user more freedom to customize the scroll
1774+
// speed. The slider value remains 0.
17711775
Int scrollPos = (Int)(TheGlobalData->m_keyboardScrollFactor*100.0f);
1772-
GadgetSliderSetPosition( sliderScrollSpeed, scrollPos );
1773-
DEBUG_LOG(("Scroll SPeed %d", scrollPos));
1776+
Int scrollMin, scrollMax;
1777+
GadgetSliderGetMinMax( sliderScrollSpeed, &scrollMin, &scrollMax );
1778+
if (scrollPos >= scrollMin && scrollPos <= scrollMax)
1779+
{
1780+
GadgetSliderSetPosition( sliderScrollSpeed, scrollPos );
1781+
}
1782+
DEBUG_LOG(("Scroll Speed %d", scrollPos));
17741783

17751784
// set the send delay check box
17761785
GadgetCheckBoxSetChecked(checkSendDelay, TheGlobalData->m_firewallSendDelay);

0 commit comments

Comments
 (0)