summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bd535b1)
raw | patch | inline | side by side (parent: bd535b1)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 2 Mar 2018 16:56:31 +0000 (19:56 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 17 Mar 2018 00:04:27 +0000 (02:04 +0200) |
src/game/g_language.pas | patch | blob | history | |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_options.pas | patch | blob | history | |
src/game/g_touch.pas | patch | blob | history |
index 5bb1e5ac53dea314205b1aadb7f957d56ece3635..18d0d72750a361b145eb823c115007667d8d4f95 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MENU_CONTROL_TOUCH,
I_MENU_CONTROL_TOUCH_FIRE,
I_MENU_CONTROL_TOUCH_SIZE,
+ I_MENU_CONTROL_TOUCH_OFFSET,
I_MENU_CONTROL_GLOBAL,
I_MENU_CONTROL_SCREENSHOT,
'Ñòðåëÿòü ââåðõ/âíèç:'),
('MENU CONTROL TOUCH SIZE', 'Button size:',
'Ðàçìåð êíîïîê:'),
+ ('MENU CONTROL TOUCH OFFSET', 'Vertical offset:',
+ 'Âåðòèêàëüíîå ñìåùåíèå:'),
('MENU CONTROL GLOBAL', 'Global Controls',
'ÎÁÙÅÅ ÓÏÐÀÂËÅÍÈÅ'),
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 35a4a0b473d3f03bd102de176efe607f010f89b4..629c38c69adc30a0a8feccfefddf376c6f462480 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
g_touch_fire := TGUISwitch(menu.GetControl('swTouchFire')).ItemIndex = 1;
+ g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
TGUIScroll(menu.GetControl('scTouchSize')).Value := Round((g_touch_size - 0.5) * 10);
with TGUISwitch(menu.GetControl('swTouchFire')) do
if g_touch_fire then ItemIndex := 1 else ItemIndex := 0;
+ TGUIScroll(menu.GetControl('scTouchOffset')).Value := Round(g_touch_offset / 5);
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
+ g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
end;
procedure ProcOptionsPlayersMIMenu();
AddItem(_lc[I_MENU_NO]);
AddItem(_lc[I_MENU_YES]);
end;
+ with AddScroll(_lc[I_MENU_CONTROL_TOUCH_OFFSET]) do
+ begin
+ Name := 'scTouchOffset';
+ Max := 20;
+ OnChange := ProcChangeTouchSettings;
+ end;
end;
Menu.DefControl := 'mOptionsControlsTouchMenu';
g_GUI_AddWindow(Menu);
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 7b2a13c4050c3f25bcf271bead8596e25f62a43e..0397f37f65d2a75f2d1918779222cad5344e5857 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
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;
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));
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
diff --git a/src/game/g_touch.pas b/src/game/g_touch.pas
index 8519f0d4c1dc3dc7d120103e1df23ecb49b50dc7..d98d2df6074f17085969945cf8b184f5b2ef11b2 100644 (file)
--- a/src/game/g_touch.pas
+++ b/src/game/g_touch.pas
SDL2;
var
- g_touch_size: Single;
- g_touch_fire: Boolean;
+ g_touch_size: Single = 1.0;
+ g_touch_offset: Single = 50;
+ g_touch_fire: Boolean = True;
procedure g_Touch_Init;
procedure g_Touch_ShowKeyboard(yes: Boolean);
end
else
begin
- x := 0; y := 0; w := sz; h := sz;
+ x := 0; y := Round(sh * g_touch_offset / 100); w := sz; h := sz;
case key of
- VK_LSTRAFE: begin x := 0; y := sh div 2 - h div 2; w := w div 2 end;
- VK_LEFT: begin x := w div 2; y := sh div 2 - h div 2 end;
- VK_RIGHT: begin x := w div 2 + 1*w;y := sh div 2 - h div 2 end;
- VK_RSTRAFE: begin x := w div 2 + 2*w;y := sh div 2 - h div 2; w := w div 2 end;
- VK_UP: begin x := sw - w - 1; y := sh div 2 - h div 2 - h end;
- VK_FIRE: begin x := sw - 1*w - 1; y := sh div 2 - h div 2 end;
- VK_DOWN: begin x := sw - w - 1; y := sh div 2 - h div 2 + h end;
- VK_NEXT: begin x := sw - 2*w - 1; y := sh div 2 - h div 2 - h end;
- VK_JUMP: begin x := sw - 2*w - 1; y := sh div 2 - h div 2 end;
- VK_PREV: begin x := sw - 3*w - 1; y := sh div 2 - h div 2 - h end;
- VK_OPEN: begin x := sw - 3*w - 1; y := sh div 2 - h div 2 end;
+ VK_LSTRAFE: begin x := 0; y := y - h div 2; w := w div 2 end;
+ VK_LEFT: begin x := w div 2; y := y - h div 2 end;
+ VK_RIGHT: begin x := w div 2 + 1*w; y := y - h div 2 end;
+ VK_RSTRAFE: begin x := w div 2 + 2*w; y := y - h div 2; w := w div 2 end;
+ VK_UP: begin x := sw - w - 1; y := y - h div 2 - h end;
+ VK_FIRE: begin x := sw - 1*w - 1; y := y - h div 2 end;
+ VK_DOWN: begin x := sw - w - 1; y := y - h div 2 + h end;
+ VK_NEXT: begin x := sw - 2*w - 1; y := y - h div 2 - h end;
+ VK_JUMP: begin x := sw - 2*w - 1; y := y - h div 2 end;
+ VK_PREV: begin x := sw - 3*w - 1; y := y - h div 2 - h end;
+ VK_OPEN: begin x := sw - 3*w - 1; y := y - h div 2 end;
else
- w := sz div 2; h := sz div 2;
+ x := 0; y := 0; w := sz div 2; h := sz div 2;
case key of
VK_0: begin x := sw div 2 - w div 2 - 5*w - 1; y := sh - 1*h - 1 end;
VK_1: begin x := sw div 2 - w div 2 - 4*w - 1; y := sh - 1*h - 1 end;
conRegVar('touch_enable', @enabled, 'enable/disable virtual buttons', 'draw buttons');
conRegVar('touch_fire', @g_touch_fire, 'enable/disable fire when press virtual up/down', 'fire when press up/down');
conRegVar('touch_size', @g_touch_size, 0.1, 10, 'size of virtual buttons', 'button size');
+ conRegVar('touch_offset', @g_touch_offset, 0, 100, '', '');
conRegVar('touch_alt', @jab, 'althernative virtual buttons layout', 'althernative layout');
end.