diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 0e272d4b2368003b24f37f72edc929add4947cfd..f43a8c6459dcd52dc57c82c486f2d553ed8f6057 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
gMenuSmallFont: DWORD;
PromptIP: string;
PromptPort: Word;
+ TempScale: Integer = -1;
implementation
gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0;
gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex;
gPlayerIndicator := TGUISwitch(menu.GetControl('swPlayerIndicator')).ItemIndex = 0;
- g_dbg_scale := TGUIScroll(menu.GetControl('scScaleFactor')).Value + 1;
+ if TGUIScroll(menu.GetControl('scScaleFactor')).Value <> TempScale then
+ begin
+ TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
+ g_dbg_scale := TempScale + 1;
+ end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
end;
end;
- if e_JoysticksAvailable > 0 then
+ if e_HasJoysticks then
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
with menu do
begin
- for i := 0 to e_JoysticksAvailable-1 do
- e_JoystickDeadzones[i] := TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value*(32767 div 20);
- end;
+ for i := 0 to e_MaxJoys - 1 do
+ if e_JoystickAvailable[i] then
+ e_JoystickDeadzones[i] := TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value*(32767 div 20)
+ end
end;
if g_touch_enabled then
if g_Game_IsClient then MC_SEND_PlayerSettings;
g_Options_Write(GameDir+'/'+CONFIG_FILENAME);
- g_Console_WriteConfig(GameDir + '/dfconfig.cfg');
+ g_Console_WriteGameConfig();
end;
procedure ReadOptions();
end;
end;
- if e_JoysticksAvailable > 0 then
+ if e_HasJoysticks then
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
with menu do
begin
- for i := 0 to e_JoysticksAvailable-1 do
- TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value := e_JoystickDeadzones[i] div (32767 div 20);
- end;
+ for i := 0 to e_MaxJoys - 1 do
+ if e_JoystickAvailable[i] then
+ TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value := e_JoystickDeadzones[i] div (32767 div 20)
+ end
end;
if g_touch_enabled then
with TGUISwitch(menu.GetControl('swPlayerIndicator')) do
if gPlayerIndicator then ItemIndex := 0 else ItemIndex := 1;
- TGUIScroll(menu.GetControl('scScaleFactor')).Value := Round(g_dbg_scale - 1);
+ TempScale := Round(g_dbg_scale - 1);
+ TGUIScroll(menu.GetControl('scScaleFactor')).Value := TempScale;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
menu: TGUIMenu;
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
- g_dbg_scale := TGUIScroll(menu.GetControl('scScaleFactor')).Value + 1;
+ if TGUIScroll(menu.GetControl('scScaleFactor')).Value <> TempScale then
+ begin
+ TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
+ g_dbg_scale := TempScale + 1;
+ end;
end;
procedure ProcChangeTouchSettings(Sender: TGUIControl);
AddButton(nil, _lc[I_MENU_PLAYER_2_KBD], 'OptionsControlsP2Menu');
{AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
AddButton(nil, _lc[I_MENU_PLAYER_2_WEAPONS], 'OptionsControlsP2MenuWeapons');
- if e_JoysticksAvailable <> 0 then
+ if e_HasJoysticks then
begin
AddSpace();
AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do
begin
Name := 'mOptionsControlsJoystickMenu';
- for i := 0 to e_JoysticksAvailable-1 do
- with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
- begin
- Name := 'scDeadzone' + IntToStr(i);
- Max := 20;
- end;
+ for i := 0 to e_MaxJoys - 1 do
+ if e_JoystickAvailable[i] then
+ with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
+ begin
+ Name := 'scDeadzone' + IntToStr(i);
+ Max := 20
+ end
end;
Menu.DefControl := 'mOptionsControlsJoystickMenu';
g_GUI_AddWindow(Menu);