Skip to content

Commit b6aa0a9

Browse files
committed
feat(video): wire options menu brightness slider to post-processing filter
1 parent 7c124e9 commit b6aa0a9

File tree

2 files changed

+22
-0
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

2 files changed

+22
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,17 @@ static void saveOptions( void )
14521452
{ TheWritableGlobalData->m_displayGamma = gammaval;
14531453
TheDisplay->setGamma(TheGlobalData->m_displayGamma,0.0f, 1.0f, FALSE);
14541454
}
1455+
1456+
// TheSuperHackers @feature bobtista 11/02/2025 Map slider value to GenTool brightness range (-128 to +256)
1457+
// Slider: 0=darkest, 50=neutral, 100=brightest
1458+
// Formula: brightness = (val - 50) * 7.68, clamped to [-128, 256]
1459+
Int brightness = static_cast<Int>((val - 50) * 7.68f);
1460+
if (brightness < -128) brightness = -128;
1461+
if (brightness > 256) brightness = 256;
1462+
1463+
// Apply brightness to post-processing filter
1464+
extern void setBrightnessFilterValue(Int value); // Forward declaration
1465+
setBrightnessFilterValue(brightness);
14551466
}
14561467

14571468
//-------------------------------------------------------------------------------------------------

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,17 @@ static void saveOptions( void )
15121512
{ TheWritableGlobalData->m_displayGamma = gammaval;
15131513
TheDisplay->setGamma(TheGlobalData->m_displayGamma,0.0f, 1.0f, FALSE);
15141514
}
1515+
1516+
// TheSuperHackers @feature bobtista 11/02/2025 Map slider value to GenTool brightness range (-128 to +256)
1517+
// Slider: 0=darkest, 50=neutral, 100=brightest
1518+
// Formula: brightness = (val - 50) * 7.68, clamped to [-128, 256]
1519+
Int brightness = static_cast<Int>((val - 50) * 7.68f);
1520+
if (brightness < -128) brightness = -128;
1521+
if (brightness > 256) brightness = 256;
1522+
1523+
// Apply brightness to post-processing filter
1524+
extern void setBrightnessFilterValue(Int value); // Forward declaration
1525+
setBrightnessFilterValue(brightness);
15151526
}
15161527

15171528
//-------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)