DEADSOFTWARE

Added vertical offset for virtual keyboard
[d2df-sdl.git] / src / game / g_options.pas
index b3b2f5a3234ca3fdf5bb5b518cf3b97a1dfe7345..0397f37f65d2a75f2d1918779222cad5344e5857 100644 (file)
@@ -141,7 +141,7 @@ uses
 {$ENDIF}
   e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
   g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
-  g_items, wadreader, e_graphics;
+  g_items, wadreader, e_graphics, g_touch;
 
 procedure g_Options_SetDefault();
 var
@@ -166,6 +166,10 @@ begin
   gDrawBackGround := True;
   gShowMessages := True;
   gRevertPlayers := False;
+  g_dbg_scale := 1.0;
+  g_touch_size := 1.0;
+  g_touch_fire := True;
+  g_touch_offset := 50;
 
   for i := 0 to e_MaxJoys-1 do
     e_JoystickDeadzones[i] := 8192;
@@ -419,6 +423,10 @@ begin
   for i := 0 to e_MaxJoys-1 do
     e_JoystickDeadzones[i] := config.ReadInt('Joysticks', 'Deadzone' + IntToStr(i), 8192);
 
+  g_touch_size := Max(config.ReadInt('Touch', 'Size', 10) / 10, 0.1);
+  g_touch_fire := config.ReadBool('Touch', 'Fire', True);
+  g_touch_offset := Max(Min(config.ReadInt('Touch', 'Offset', 50), 100), 0);
+
   g_GFX_SetMax(Min(config.ReadInt('Game', 'MaxParticles', 1000), 50000));
   g_Shells_SetMax(Min(config.ReadInt('Game', 'MaxShells', 300), 600));
   g_Gibs_SetMax(Min(config.ReadInt('Game', 'MaxGibs', 150), 500));
@@ -449,6 +457,7 @@ begin
   e_FastScreenshots := config.ReadBool('Game', 'FastScreenshots', True);
   gDefaultMegawadStart := config.ReadStr('Game', 'DefaultMegawadStart', DF_Default_Megawad_Start);
   gBerserkAutoswitch := config.ReadBool('Game', 'BerserkAutoswitching', True);
+  g_dbg_scale := Max(config.ReadInt('Game', 'Scale', 100) / 100, 1.0);
 
 // Ãåéìïëåé â ñâîåé èãðå
   gcMap := config.ReadStr('GameplayCustom', 'Map', '');
@@ -658,6 +667,10 @@ begin
   for i := 0 to e_MaxJoys-1 do
     config.WriteInt('Joysticks', 'Deadzone' + IntToStr(i), e_JoystickDeadzones[i]);
 
+  config.WriteInt('Touch', 'Size', Round(g_touch_size * 10));
+  config.WriteBool('Touch', 'Fire', g_touch_fire);
+  config.WriteInt('Touch', 'Offset', Round(g_touch_offset));
+
   with config do
     case gGibsCount of
       0: config.WriteInt('Game', 'GibsCount', 0);
@@ -686,6 +699,7 @@ begin
   config.WriteBool('Game', 'FastScreenshots', e_FastScreenshots);
   config.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart);
   config.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch);
+  config.WriteInt('Game', 'Scale', Round(g_dbg_scale * 100));
 
   config.WriteStr ('GameplayCustom', 'Map', gcMap);
   config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);