DEADSOFTWARE

Added vertical offset for virtual keyboard
[d2df-sdl.git] / src / game / g_options.pas
index d05ed835f86d43d5edd808f7db4a0ff6d17f217f..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;
@@ -190,21 +194,24 @@ begin
     KeyPrevWeapon := 71;
     KeyOpen := 54;
     KeyStrafe := 0;
-    for i := 0 to High(KeyWeapon) do
+    for i := 0 to 9 do
+      KeyWeapon[i] := 30 + i;
+    KeyWeapon[10] := 45;
+    for i := 10 to High(KeyWeapon) do
       KeyWeapon[i] := 0;
 
-    KeyRight2 := 0;
-    KeyLeft2 := 0;
-    KeyUp2 := 0;
-    KeyDown2 := 0;
-    KeyFire2 := 0;
-    KeyJump2 := 0;
-    KeyNextWeapon2 := 0;
-    KeyPrevWeapon2 := 0;
-    KeyOpen2 := 0;
-    KeyStrafe2 := 0;
+    KeyRight2 := VK_RIGHT;
+    KeyLeft2 := VK_LEFT;
+    KeyUp2 := VK_UP;
+    KeyDown2 := VK_DOWN;
+    KeyFire2 := VK_FIRE;
+    KeyJump2 := VK_JUMP;
+    KeyNextWeapon2 := VK_NEXT;
+    KeyPrevWeapon2 := VK_PREV;
+    KeyOpen2 := VK_OPEN;
+    KeyStrafe2 := VK_STRAFE;
     for i := 0 to High(KeyWeapon2) do
-      KeyWeapon2[i] := 0;
+      KeyWeapon2[i] := VK_0 + i;
   end;
 
   with gGameControls.P2Control do
@@ -416,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));
@@ -446,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', '');
@@ -655,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);
@@ -683,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);