DEADSOFTWARE

Disable accelerometer and add g_dbg_scale as option
[d2df-sdl.git] / src / game / g_menu.pas
index 0ba399a571c94dfeaa23e66e2f09f00ee990cccf..3056950af666495842af15a008ba3f4cc2ac211c 100644 (file)
@@ -42,11 +42,16 @@ var
 implementation
 
 uses
+{$IFDEF USE_NANOGL}
+  nanoGL,
+{$ELSE}
+  GL, GLExt,
+{$ENDIF}
   g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
   g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
-  e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
+  e_log, SysUtils, CONFIG, g_playermodel, DateUtils, sdl2,
   MAPDEF, Math, g_saveload,
-  e_texture, GL, GLExt, g_language,
+  e_texture, g_language,
   g_net, g_netmsg, g_netmaster, g_items, e_input,
   utils, wadreader;
 
@@ -106,6 +111,7 @@ procedure ProcApplyOptions();
 var
   menu: TGUIMenu;
   i: Integer;
+  ovs: Boolean;
 begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
 
@@ -113,7 +119,11 @@ begin
     gBPP := 16
   else
     gBPP := 32;
+
+  ovs := gVSync;
   gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
+  if (ovs <> gVSync) then g_SetVSync(gVSync);
+
   gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
   glLegacyNPOT := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
 
@@ -154,6 +164,7 @@ begin
   gShowMessages := TGUISwitch(menu.GetControl('swMessages')).ItemIndex = 0;
   gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0;
   gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex;
+  g_dbg_scale := TGUIScroll(menu.GetControl('swScaleFactor')).Value + 1;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
 
@@ -485,6 +496,8 @@ begin
   with TGUISwitch(menu.GetControl('swChatBubble')) do
     ItemIndex := gChatBubble;
 
+  TGUIScroll(menu.GetControl('swScaleFactor')).Value := Round(g_dbg_scale - 1);
+
   menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
 
   TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model);
@@ -1249,6 +1262,14 @@ begin
   );
 end;
 
+procedure ProcChangeGameSettings(Sender: TGUIControl);
+var
+  menu: TGUIMenu;
+begin
+  menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
+  g_dbg_scale := TGUIScroll(menu.GetControl('swScaleFactor')).Value + 1;
+end;
+
 procedure ProcOptionsPlayersMIMenu();
 var
   s, a: string;
@@ -2663,6 +2684,12 @@ begin
       AddItem(_lc[I_MENU_GAME_CHAT_TYPE_COLOR]);
       AddItem(_lc[I_MENU_GAME_CHAT_TYPE_TEXTURE]);
     end;
+    with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do
+    begin
+      Name := 'swScaleFactor';
+      Max := 10;
+      OnChange := ProcChangeGameSettings;
+    end;
     ReAlign();
   end;
   Menu.DefControl := 'mOptionsGameMenu';