summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a52956b)
raw | patch | inline | side by side (parent: a52956b)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 9 Apr 2019 19:57:25 +0000 (22:57 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 9 Apr 2019 19:57:25 +0000 (22:57 +0300) |
diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas
index ea34841f13ae707ab926449caaab38640cd8b63f..b055bf91e11d9916ebde53629cb18bddddb0ed31 100644 (file)
--- a/src/engine/e_input.pas
+++ b/src/engine/e_input.pas
JOY2_PREV = JOYK_BEG + 2*e_MaxJoyBtns + 4;
JOY3_PREV = JOYK_BEG + 3*e_MaxJoyBtns + 4;
- JOY0_LEFT = JOYA_BEG + 0*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
- JOY1_LEFT = JOYA_BEG + 1*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
- JOY2_LEFT = JOYA_BEG + 2*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
- JOY3_LEFT = JOYA_BEG + 3*e_MaxJoyAxes*2 + 0*2 + AX_MINUS;
- JOY0_RIGHT = JOYA_BEG + 0*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
- JOY1_RIGHT = JOYA_BEG + 1*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
- JOY2_RIGHT = JOYA_BEG + 2*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
- JOY3_RIGHT = JOYA_BEG + 3*e_MaxJoyAxes*2 + 0*2 + AX_PLUS;
- JOY0_UP = JOYA_BEG + 0*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
- JOY1_UP = JOYA_BEG + 1*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
- JOY2_UP = JOYA_BEG + 2*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
- JOY3_UP = JOYA_BEG + 3*e_MaxJoyAxes*2 + 1*2 + AX_MINUS;
- JOY0_DOWN = JOYA_BEG + 0*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
- JOY1_DOWN = JOYA_BEG + 1*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
- JOY2_DOWN = JOYA_BEG + 2*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
- JOY3_DOWN = JOYA_BEG + 3*e_MaxJoyAxes*2 + 1*2 + AX_PLUS;
+ JOY0_LEFT = JOYH_BEG + 0*e_MaxJoyHats*4 + 0*4 + HAT_LEFT;
+ JOY1_LEFT = JOYH_BEG + 1*e_MaxJoyHats*4 + 0*4 + HAT_LEFT;
+ JOY2_LEFT = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_LEFT;
+ JOY3_LEFT = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_LEFT;
+ JOY0_RIGHT = JOYH_BEG + 0*e_MaxJoyHats*4 + 0*4 + HAT_RIGHT;
+ JOY1_RIGHT = JOYH_BEG + 1*e_MaxJoyHats*4 + 0*4 + HAT_RIGHT;
+ JOY2_RIGHT = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_RIGHT;
+ JOY3_RIGHT = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_RIGHT;
+ JOY0_UP = JOYH_BEG + 0*e_MaxJoyHats*4 + 0*4 + HAT_UP;
+ JOY1_UP = JOYH_BEG + 1*e_MaxJoyHats*4 + 0*4 + HAT_UP;
+ JOY2_UP = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_UP;
+ JOY3_UP = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_UP;
+ JOY0_DOWN = JOYH_BEG + 0*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
+ JOY1_DOWN = JOYH_BEG + 1*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
+ JOY2_DOWN = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
+ JOY3_DOWN = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
function e_InitInput: Boolean;
procedure e_ReleaseInput;
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index f1b82c341a4f04d3e07c2184717cd89eee6defcb..a0839f3d3d0a2dba96e743b4f0b33cc8f6bc4521 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
gInputBinds: Array [0..e_MaxInputKeys - 1] of record
down, up: SSArray;
end;
+ menu_toggled: BOOLEAN;
// poor man's floating literal parser; i'm sorry, but `StrToFloat()` sux cocks
for i := 0 to e_MaxInputKeys - 1 do
g_Console_BindKey(i, '');
'showkeyboard':
- g_Touch_ShowKeyboard(True);
+ g_Touch_ShowKeyboard(True);
'hidekeyboard':
- g_Touch_ShowKeyboard(False);
+ g_Touch_ShowKeyboard(False);
+ 'togglemenu':
+ begin
+ // this is HACK
+ KeyPress(VK_ESCAPE);
+ menu_toggled := True
+ end;
end
end;
AddCommand('unbindall', BindCommands);
AddCommand('showkeyboard', BindCommands);
AddCommand('hidekeyboard', BindCommands);
+ AddCommand('togglemenu', BindCommands);
AddCommand('clear', ConsoleCommands, 'clear console');
AddCommand('clearhistory', ConsoleCommands);
else
for i := 0 to High(gInputBinds[key].up) do
g_Console_Process(gInputBinds[key].up[i], True)
- end
+ end;
+ if down and not menu_toggled then
+ KeyPress(key);
+ menu_toggled := False
end;
procedure g_Console_ResetBinds;
for i := 0 to e_MaxInputKeys - 1 do
g_Console_BindKey(i, '', '');
+ g_Console_BindKey(IK_ESCAPE, 'togglemenu');
g_Console_BindKey(IK_A, '+p1_moveleft', '-p1_moveleft');
g_Console_BindKey(IK_D, '+p1_moveright', '-p1_moveright');
g_Console_BindKey(IK_W, '+p1_lookup', '-p1_lookup');
(* for i := 0 to e_MaxJoys - 1 do *)
for i := 0 to 1 do
begin
- g_Console_BindKey(e_JoyAxisToKey(i, 0, AX_MINUS), '+p' + IntToStr(i mod 2 + 1) + '_moveleft', '-p' + IntToStr(i mod 2 + 1) + '_moveleft');
- g_Console_BindKey(e_JoyAxisToKey(i, 0, AX_PLUS), '+p' + IntToStr(i mod 2 + 1) + '_moveright', '-p' + IntToStr(i mod 2 + 1) + '_moveright');
- g_Console_BindKey(e_JoyAxisToKey(i, 1, AX_MINUS), '+p' + IntToStr(i mod 2 + 1) + '_lookup', '-p' + IntToStr(i mod 2 + 1) + '_lookup');
- g_Console_BindKey(e_JoyAxisToKey(i, 1, AX_PLUS), '+p' + IntToStr(i mod 2 + 1) + '_lookdown', '-p' + IntToStr(i mod 2 + 1) + '_lookdown');
+ g_Console_BindKey(e_JoyHatToKey(i, 0, HAT_LEFT), '+p' + IntToStr(i mod 2 + 1) + '_moveleft', '-p' + IntToStr(i mod 2 + 1) + '_moveleft');
+ g_Console_BindKey(e_JoyHatToKey(i, 0, HAT_RIGHT), '+p' + IntToStr(i mod 2 + 1) + '_moveright', '-p' + IntToStr(i mod 2 + 1) + '_moveright');
+ g_Console_BindKey(e_JoyHatToKey(i, 0, HAT_UP), '+p' + IntToStr(i mod 2 + 1) + '_lookup', '-p' + IntToStr(i mod 2 + 1) + '_lookup');
+ g_Console_BindKey(e_JoyHatToKey(i, 0, HAT_DOWN), '+p' + IntToStr(i mod 2 + 1) + '_lookdown', '-p' + IntToStr(i mod 2 + 1) + '_lookdown');
g_Console_BindKey(e_JoyButtonToKey(i, 2), '+p' + IntToStr(i mod 2 + 1) + '_jump', '-p' + IntToStr(i mod 2 + 1) + '_jump');
g_Console_BindKey(e_JoyButtonToKey(i, 0), '+p' + IntToStr(i mod 2 + 1) + '_attack', '-p' + IntToStr(i mod 2 + 1) + '_attack');
g_Console_BindKey(e_JoyButtonToKey(i, 3), '+p' + IntToStr(i mod 2 + 1) + '_activate', '-p' + IntToStr(i mod 2 + 1) + '_activate');
g_Console_BindKey(e_JoyButtonToKey(i, 1), '+p' + IntToStr(i mod 2 + 1) + '_weapnext', '-p' + IntToStr(i mod 2 + 1) + '_weapnext');
g_Console_BindKey(e_JoyButtonToKey(i, 4), '+p' + IntToStr(i mod 2 + 1) + '_weapprev', '-p' + IntToStr(i mod 2 + 1) + '_weapprev');
g_Console_BindKey(e_JoyButtonToKey(i, 7), '+p' + IntToStr(i mod 2 + 1) + '_strafe', '-p' + IntToStr(i mod 2 + 1) + '_strafe');
+ g_Console_BindKey(e_JoyButtonToKey(i, 10), 'togglemenu');
end;
+ // HACK: VK_ESCAPE always used as togglemenu, so don't touch it!
+ // VK_CONSOLE
g_Console_BindKey(VK_LSTRAFE, '+moveleft; +strafe', '-moveleft; -strafe');
g_Console_BindKey(VK_RSTRAFE, '+moveright; +strafe', '-moveright; -strafe');
g_Console_BindKey(VK_LEFT, '+moveleft', '-moveleft');
g_Console_BindKey(VK_STATUS, '+scores', '-scores');
g_Console_BindKey(VK_SHOWKBD, 'showkeyboard');
g_Console_BindKey(VK_HIDEKBD, 'hidekeyboard');
-
- // VK_CONSOLE
- // VK_ESCAPE
end;
procedure g_Console_ReadConfig (filename: String);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 7e1249d6aa474c9e7d4e184c53c7a803991a1fee..df564347985c186103783938645e2ad44d63e28f 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
- e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
+ if e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
begin
State := 0;
break;
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 8a599fd7a3a9a0c99c05245216c0f1882937dec6..9b44f6f8a7b8a4e572c1e4b31216598c57b4ec6d 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
if Msg.Msg = WM_KEYDOWN then
begin
case Msg.wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
g_GUI_HideWindow;
Exit
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
FIsQuery := True;
end
- else
+ else if (wParam < VK_FIRSTKEY) and (wParam > VK_LASTKEY) then
begin
- FKey := IK_ENTER; // <Enter>
+ // FKey := IK_ENTER; // <Enter>
+ FKey := wParam;
FIsQuery := False;
actDefCtl();
end;
else if FIsQuery then
begin
case wParam of
- IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ IK_ENTER, IK_KPRETURN, VK_FIRSTKEY..VK_LASTKEY, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
else
if e_KeyNames[wParam] <> '' then
FKey := wParam;
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
FIsQuery := True;
end
- else
+ else if (wParam < VK_FIRSTKEY) and (wParam > VK_LASTKEY) then
begin
- if (FKeyIdx = 0) then FKey0 := IK_ENTER else FKey1 := IK_ENTER; // <Enter>
+ // if (FKeyIdx = 0) then FKey0 := IK_ENTER else FKey1 := IK_ENTER; // <Enter>
+ if (FKeyIdx = 0) then FKey0 := wParam else FKey1 := wParam;
FIsQuery := False;
actDefCtl();
end;
else if FIsQuery then
begin
case wParam of
- IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN,
- JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ IK_ENTER, IK_KPRETURN, VK_FIRSTKEY..VK_LASTKEY, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
else
if e_KeyNames[wParam] <> '' then
begin
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index 5daed9b341abb7e029f41863d229117e35b1d23b..23113e77f629fd2b426ddc783bc1c31f0b30a33f 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
g_Console_Switch()
end;
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP: // <Esc>:
+ IK_ESCAPE: // <Esc>:
+ begin
+ if gChatShow then
+ g_Console_Chat_Switch
+ else if gConsoleShow then
+ g_Console_Switch
+ end;
+
+ VK_ESCAPE: // <Esc>:
begin
if gChatShow then
begin
else if (g_ActiveWindow <> nil) then
begin
Msg.Msg := WM_KEYDOWN;
- Msg.WParam := IK_ESCAPE;
+ Msg.WParam := VK_ESCAPE;
g_ActiveWindow.OnMessage(Msg);
if (not g_Game_IsNet) and (g_ActiveWindow = nil) then g_Game_Pause(false); //Fn loves to do this
end
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 76a91813e5e6f77444d486bfded34c9e3ea05209..953b430a5590cae3f9ef31e5351f0ef96d372eff 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
- e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
+ if e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
OuterLoop := False;
end;
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or
- e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
+ if e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
break;
end;
Result := msgStream;
index 4ca51eb6bf6bde69a5e5e2017f6bdbaf0fe220ab..957f53289ced17e4c8fbc0d7aa9169d4326e2dbe 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
qm := g_ProcessMessages(); // this updates kbd
- if qm or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or
- e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
+ if qm or e_KeyPressed(VK_ESCAPE) then
begin
SL := nil;
ST := nil;
diff --git a/src/game/g_touch.pas b/src/game/g_touch.pas
index 0638cc2713bfbfb432e484160ff431faa77adcbf..972c5422283f1c53f42d7ceb50097d7488661f14 100644 (file)
--- a/src/game/g_touch.pas
+++ b/src/game/g_touch.pas
uses
SysUtils,
- e_log, e_graphics, e_input, g_options, g_game, g_main, g_weapons, g_console;
+ e_log, e_graphics, e_input, g_options, g_game, g_main, g_gui, g_weapons, g_console;
var
angleFire: Boolean;
g_Console_ProcessBind(i, False);
(* up/down + fire hack *)
- if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and angleFire then
+ if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) and angleFire then
begin
if (i = VK_UP) or (i = VK_DOWN) then
begin
procedure KeyDown (finger, i: Integer);
begin
- KeyPress(i); // Menu events
keyFinger[i] := finger;
e_KeyUpDown(i, True);
g_Console_ProcessBind(i, True);
(* up/down + fire hack *)
- if g_touch_fire and (gGameSettings.GameType <> GT_NONE) then
+ if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) then
begin
if i = VK_UP then
begin
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 50fccd40a095fc55d7e64c5f7b73d80b2c3c94b5..df44683f8276c42d790daa11396ed1d141f32a33 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
e_KeyUpDown(key, down);
g_Console_ProcessBind(key, down)
end;
- if down then KeyPress(key);
end;
SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP:
e_LogWritefln('Input Debug: jbutton, joy=%s, button=%s, keycode=%s, press=%s', [ev.jbutton.which, ev.jbutton.button, key, down]);
e_KeyUpDown(key, down);
g_Console_ProcessBind(key, down);
- if down then KeyPress(key)
end
else
begin
end;
e_KeyUpDown(minuskey, True);
g_Console_ProcessBind(minuskey, True);
- KeyPress(minuskey);
end
else if ev.jaxis.value > JoystickZeroAxes[ev.jaxis.which, ev.jaxis.axis] + e_JoystickDeadzones[ev.jaxis.which] then
begin
end;
e_KeyUpDown(key, True);
g_Console_ProcessBind(key, True);
- KeyPress(key);
end
else
begin
key := e_JoyHatToKey(ev.jhat.which, ev.jhat.hat, i);
e_KeyUpDown(key, down);
g_Console_ProcessBind(key, down);
- if down then KeyPress(key)
end
end;
JoystickHatState[ev.jhat.which, ev.jhat.hat] := hat